Merge from Chromium at DEPS revision r212014

This commit was generated by merge_to_master.py.

Change-Id: Ib07d03553a1e81485ac4ffc92b91e977c4875409
diff --git a/Source/core/DEPS b/Source/core/DEPS
index f9cd78a..92c1566 100644
--- a/Source/core/DEPS
+++ b/Source/core/DEPS
@@ -4,7 +4,6 @@
     "+mozilla",
     "+public/platform",
     "+sys",
-    "+unicode",
     "+weborigin",
 
     "-WebKit",
diff --git a/Source/core/Init.cpp b/Source/core/Init.cpp
index 6f1ff40..ae924cc 100644
--- a/Source/core/Init.cpp
+++ b/Source/core/Init.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "Init.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "FontFamilyNames.h"
 #include "HTMLNames.h"
 #include "MathMLNames.h"
@@ -60,12 +61,11 @@
     XMLNSNames::init();
     XMLNames::init();
     FontFamilyNames::init();
+    CachedResourceInitiatorTypeNames::init();
     MediaFeatureNames::init();
     WTF::StringStatics::init();
     QualifiedName::init();
-#if ENABLE(PARTITION_ALLOC)
     Partitions::init();
-#endif
     EventTracer::initialize();
 }
 
diff --git a/Source/core/accessibility/AXObjectCache.cpp b/Source/core/accessibility/AXObjectCache.cpp
index 17fb379..dd40ea5 100644
--- a/Source/core/accessibility/AXObjectCache.cpp
+++ b/Source/core/accessibility/AXObjectCache.cpp
@@ -75,7 +75,7 @@
 #include "core/rendering/RenderTableCell.h"
 #include "core/rendering/RenderTableRow.h"
 #include "core/rendering/RenderView.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
@@ -160,9 +160,9 @@
     if (!focusedNode)
         focusedNode = focusedDocument;
 
-    if (focusedNode->hasTagName(areaTag))
-        return focusedImageMapUIElement(static_cast<HTMLAreaElement*>(focusedNode));
-    
+    if (isHTMLAreaElement(focusedNode))
+        return focusedImageMapUIElement(toHTMLAreaElement(focusedNode));
+
     AccessibilityObject* obj = focusedNode->document()->axObjectCache()->getOrCreate(focusedNode);
     if (!obj)
         return 0;
@@ -791,7 +791,7 @@
         handleAriaRoleChanged(element);
     else if (attrName == altAttr || attrName == titleAttr)
         textChanged(element);
-    else if (attrName == forAttr && element->hasTagName(labelTag))
+    else if (attrName == forAttr && isHTMLLabelElement(element))
         labelChanged(element);
 
     if (!attrName.localName().string().startsWith("aria-"))
@@ -819,9 +819,7 @@
 
 void AXObjectCache::labelChanged(Element* element)
 {
-    ASSERT(element->hasTagName(labelTag));
-    HTMLElement* correspondingControl = static_cast<HTMLLabelElement*>(element)->control();
-    textChanged(correspondingControl);
+    textChanged(toHTMLLabelElement(element)->control());
 }
 
 void AXObjectCache::recomputeIsIgnored(RenderObject* renderer)
diff --git a/Source/core/accessibility/AccessibilityARIAGrid.h b/Source/core/accessibility/AccessibilityARIAGrid.h
index c3010b2..cfb3489 100644
--- a/Source/core/accessibility/AccessibilityARIAGrid.h
+++ b/Source/core/accessibility/AccessibilityARIAGrid.h
@@ -30,7 +30,7 @@
 #define AccessibilityARIAGrid_h
 
 #include "core/accessibility/AccessibilityTable.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/accessibility/AccessibilityListBoxOption.cpp b/Source/core/accessibility/AccessibilityListBoxOption.cpp
index 6a413c2..c847b4e 100644
--- a/Source/core/accessibility/AccessibilityListBoxOption.cpp
+++ b/Source/core/accessibility/AccessibilityListBoxOption.cpp
@@ -59,8 +59,8 @@
 {
     if (!m_optionElement)
         return false;
-    
-    if (m_optionElement->hasTagName(optgroupTag))
+
+    if (isHTMLOptGroupElement(m_optionElement))
         return false;
 
     if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
@@ -154,10 +154,10 @@
     
     if (m_optionElement->hasTagName(optionTag))
         return toHTMLOptionElement(m_optionElement)->text();
-    
-    if (m_optionElement->hasTagName(optgroupTag))
-        return static_cast<HTMLOptGroupElement*>(m_optionElement)->groupLabelText();
-    
+
+    if (isHTMLOptGroupElement(m_optionElement))
+        return toHTMLOptGroupElement(m_optionElement)->groupLabelText();
+
     return String();
 }
 
@@ -200,10 +200,10 @@
     
     if (m_optionElement->hasTagName(optionTag))
         return toHTMLOptionElement(m_optionElement)->ownerSelectElement();
-    
-    if (m_optionElement->hasTagName(optgroupTag))
-        return static_cast<HTMLOptGroupElement*>(m_optionElement)->ownerSelectElement();
-    
+
+    if (isHTMLOptGroupElement(m_optionElement))
+        return toHTMLOptGroupElement(m_optionElement)->ownerSelectElement();
+
     return 0;
 }
 
diff --git a/Source/core/accessibility/AccessibilityListBoxOption.h b/Source/core/accessibility/AccessibilityListBoxOption.h
index f51fe5c..987b5bc 100644
--- a/Source/core/accessibility/AccessibilityListBoxOption.h
+++ b/Source/core/accessibility/AccessibilityListBoxOption.h
@@ -31,7 +31,7 @@
 
 #include "core/accessibility/AccessibilityObject.h"
 #include "core/html/HTMLElement.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/accessibility/AccessibilityNodeObject.cpp b/Source/core/accessibility/AccessibilityNodeObject.cpp
index 1cc5f00..ec36ae7 100644
--- a/Source/core/accessibility/AccessibilityNodeObject.cpp
+++ b/Source/core/accessibility/AccessibilityNodeObject.cpp
@@ -33,6 +33,7 @@
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Text.h"
 #include "core/dom/UserGestureIndicator.h"
+#include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFrameElementBase.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLLabelElement.h"
@@ -200,7 +201,7 @@
         HTMLSelectElement* selectElement = toHTMLSelectElement(node());
         return selectElement->multiple() ? ListBoxRole : PopUpButtonRole;
     }
-    if (node()->hasTagName(textareaTag))
+    if (isHTMLTextAreaElement(node()))
         return TextAreaRole;
     if (headingLevel())
         return HeadingRole;
@@ -208,7 +209,7 @@
         return DivRole;
     if (node()->hasTagName(pTag))
         return ParagraphRole;
-    if (node()->hasTagName(labelTag))
+    if (isHTMLLabelElement(node()))
         return LabelRole;
     if (node()->isFocusable())
         return GroupRole;
@@ -350,8 +351,8 @@
     }
 
     for (Element* parent = element->parentElement(); parent; parent = parent->parentElement()) {
-        if (parent->hasTagName(labelTag))
-            return static_cast<HTMLLabelElement*>(parent);
+        if (isHTMLLabelElement(parent))
+            return toHTMLLabelElement(parent);
     }
 
     return 0;
@@ -581,7 +582,7 @@
     if (!node)
         return false;
 
-    if (node->hasTagName(textareaTag))
+    if (isHTMLTextAreaElement(node))
         return true;
 
     if (node->hasTagName(inputTag)) {
@@ -696,7 +697,7 @@
     if (!node)
         return true;
 
-    if (node->hasTagName(textareaTag))
+    if (isHTMLTextAreaElement(node))
         return toHTMLFormControlElement(node)->isReadOnly();
 
     if (node->hasTagName(inputTag)) {
@@ -830,7 +831,7 @@
     if (!node)
         return String();
 
-    if (isNativeTextControl() && (node->hasTagName(textareaTag) || node->hasTagName(inputTag)))
+    if (isNativeTextControl() && (isHTMLTextAreaElement(node) || node->hasTagName(inputTag)))
         return toHTMLTextFormControlElement(node)->value();
 
     if (!node->isElementNode())
@@ -1368,7 +1369,7 @@
     // search up the DOM tree for an anchor element
     // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElement
     for ( ; node; node = node->parentNode()) {
-        if (node->hasTagName(aTag) || (node->renderer() && cache->getOrCreate(node->renderer())->isAnchor()))
+        if (isHTMLAnchorElement(node) || (node->renderer() && cache->getOrCreate(node->renderer())->isAnchor()))
             return toElement(node);
     }
 
diff --git a/Source/core/accessibility/AccessibilityNodeObject.h b/Source/core/accessibility/AccessibilityNodeObject.h
index df735b1..c975006 100644
--- a/Source/core/accessibility/AccessibilityNodeObject.h
+++ b/Source/core/accessibility/AccessibilityNodeObject.h
@@ -31,7 +31,7 @@
 
 #include "core/accessibility/AccessibilityObject.h"
 #include "core/platform/graphics/LayoutRect.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/accessibility/AccessibilityRenderObject.cpp b/Source/core/accessibility/AccessibilityRenderObject.cpp
index cdb352c..094a0d1 100644
--- a/Source/core/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/core/accessibility/AccessibilityRenderObject.cpp
@@ -39,6 +39,7 @@
 #include "core/editing/RenderedPosition.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
+#include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLLabelElement.h"
 #include "core/html/HTMLOptionElement.h"
@@ -270,8 +271,8 @@
 
     // find if this has a parent that is a label
     for (Node* parentNode = m_renderer->node(); parentNode; parentNode = parentNode->parentNode()) {
-        if (parentNode->hasTagName(labelTag))
-            return static_cast<HTMLLabelElement*>(parentNode);
+        if (isHTMLLabelElement(parentNode))
+            return toHTMLLabelElement(parentNode);
     }
 
     return 0;
@@ -404,7 +405,7 @@
     if (node && node->hasTagName(pTag))
         return ParagraphRole;
 
-    if (node && node->hasTagName(labelTag))
+    if (node && isHTMLLabelElement(node))
         return LabelRole;
 
     if (node && node->hasTagName(divTag))
@@ -432,7 +433,7 @@
         return LandmarkContentInfoRole;
 
     // The HTML element should not be exposed as an element. That's what the RenderView element does.
-    if (node && node->hasTagName(htmlTag))
+    if (node && isHTMLHtmlElement(node))
         return IgnoredRole;
 
     // There should only be one banner/contentInfo per page. If header/footer are being used within an article or section
@@ -511,10 +512,10 @@
         return false;
 
     Element* anchor = anchorElement();
-    if (!anchor || !anchor->hasTagName(aTag))
+    if (!anchor || !isHTMLAnchorElement(anchor))
         return false;
 
-    return !static_cast<HTMLAnchorElement*>(anchor)->href().isEmpty();
+    return !toHTMLAnchorElement(anchor)->href().isEmpty();
 }
 
 bool AccessibilityRenderObject::isLoaded() const
@@ -707,7 +708,7 @@
         }
 
         // text elements that are just empty whitespace should not be returned
-        return renderText->text()->containsOnlyWhitespace();
+        return renderText->text().impl()->containsOnlyWhitespace();
     }
 
     if (isHeading())
@@ -725,7 +726,7 @@
 
     // don't ignore labels, because they serve as TitleUIElements
     Node* node = m_renderer->node();
-    if (node && node->hasTagName(labelTag))
+    if (node && isHTMLLabelElement(node))
         return false;
 
     // Anything that is content editable should not be ignored.
@@ -928,8 +929,8 @@
 
 KURL AccessibilityRenderObject::url() const
 {
-    if (isAnchor() && m_renderer->node()->hasTagName(aTag)) {
-        if (HTMLAnchorElement* anchor = static_cast<HTMLAnchorElement*>(anchorElement()))
+    if (isAnchor() && isHTMLAnchorElement(m_renderer->node())) {
+        if (HTMLAnchorElement* anchor = toHTMLAnchorElement(anchorElement()))
             return anchor->href();
     }
 
@@ -1397,8 +1398,8 @@
         return 0;
     Node* node = hitTestResult.innerNode()->deprecatedShadowAncestorNode();
 
-    if (node->hasTagName(areaTag))
-        return accessibilityImageMapHitTest(static_cast<HTMLAreaElement*>(node), point);
+    if (isHTMLAreaElement(node))
+        return accessibilityImageMapHitTest(toHTMLAreaElement(node), point);
 
     if (node->hasTagName(optionTag))
         node = toHTMLOptionElement(node)->ownerSelectElement();
@@ -1664,7 +1665,7 @@
     // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElement
     Node* node = currRenderer->node();
     for ( ; node; node = node->parentNode()) {
-        if (node->hasTagName(aTag) || (node->renderer() && cache->getOrCreate(node->renderer())->isAnchor()))
+        if (isHTMLAnchorElement(node) || (node->renderer() && cache->getOrCreate(node->renderer())->isAnchor()))
             return toElement(node);
     }
 
@@ -1735,7 +1736,7 @@
 
     Document* document = this->document();
     if (!on)
-        document->setFocusedNode(0);
+        document->setFocusedElement(0);
     else {
         Node* node = this->node();
         if (node && node->isElementNode()) {
@@ -1743,11 +1744,12 @@
             // That is a problem when focus is removed from the webpage to chrome, and then returns.
             // In these cases, we need to do what keyboard and mouse focus do, which is reset focus first.
             if (document->focusedNode() == node)
-                document->setFocusedNode(0);
+                document->setFocusedElement(0);
 
             toElement(node)->focus();
-        } else
-            document->setFocusedNode(node);
+        } else {
+            document->setFocusedElement(0);
+        }
     }
 }
 
@@ -1774,8 +1776,6 @@
 {
     if (!m_renderer || !m_renderer->node() || !m_renderer->node()->isElementNode())
         return;
-    Element* element = toElement(m_renderer->node());
-
     if (!m_renderer->isBoxModelObject())
         return;
     RenderBoxModelObject* renderer = toRenderBoxModelObject(m_renderer);
@@ -1783,10 +1783,10 @@
     // FIXME: Do we want to do anything here for ARIA textboxes?
     if (renderer->isTextField()) {
         // FIXME: This is not safe!  Other elements could have a TextField renderer.
-        toHTMLInputElement(element)->setValue(string);
+        toHTMLInputElement(m_renderer->node())->setValue(string);
     } else if (renderer->isTextArea()) {
         // FIXME: This is not safe!  Other elements could have a TextArea renderer.
-        static_cast<HTMLTextAreaElement*>(element)->setValue(string);
+        toHTMLTextAreaElement(m_renderer->node())->setValue(string);
     }
 }
 
@@ -2083,9 +2083,9 @@
         return 0;
 
     // Right now, we do not support ARIA links as internal link elements
-    if (!element->hasTagName(aTag))
+    if (!isHTMLAnchorElement(element))
         return 0;
-    HTMLAnchorElement* anchor = static_cast<HTMLAnchorElement*>(element);
+    HTMLAnchorElement* anchor = toHTMLAnchorElement(element);
 
     KURL linkURL = anchor->href();
     String fragmentIdentifier = linkURL.fragmentIdentifier();
@@ -2351,9 +2351,9 @@
 
     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 (current->hasTagName(areaTag) && current->isLink()) {
+        if (isHTMLAreaElement(current) && current->isLink()) {
             AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
-            areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current));
+            areaObject->setHTMLAreaElement(toHTMLAreaElement(current));
             areaObject->setHTMLMapElement(map);
             areaObject->setParent(this);
             if (!areaObject->accessibilityIsIgnored())
diff --git a/Source/core/accessibility/AccessibilityRenderObject.h b/Source/core/accessibility/AccessibilityRenderObject.h
index 9200b53..66847f8 100644
--- a/Source/core/accessibility/AccessibilityRenderObject.h
+++ b/Source/core/accessibility/AccessibilityRenderObject.h
@@ -31,7 +31,7 @@
 
 #include "core/accessibility/AccessibilityNodeObject.h"
 #include "core/platform/graphics/LayoutRect.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/accessibility/AccessibilityTable.cpp b/Source/core/accessibility/AccessibilityTable.cpp
index ac0fcf8..8720001 100644
--- a/Source/core/accessibility/AccessibilityTable.cpp
+++ b/Source/core/accessibility/AccessibilityTable.cpp
@@ -103,17 +103,17 @@
     // Only "data" tables should be exposed as tables.
     // Unfortunately, there is no good way to determine the difference
     // between a "layout" table and a "data" table.
-    
+
     RenderTable* table = toRenderTable(m_renderer);
     Node* tableNode = table->node();
-    if (!tableNode || !tableNode->hasTagName(tableTag))
+    if (!tableNode || !isHTMLTableElement(tableNode))
         return false;
 
     // if there is a caption element, summary, THEAD, or TFOOT section, it's most certainly a data table
-    HTMLTableElement* tableElement = static_cast<HTMLTableElement*>(tableNode);
+    HTMLTableElement* tableElement = toHTMLTableElement(tableNode);
     if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElement->tFoot() || tableElement->caption())
         return true;
-    
+
     // if someone used "rules" attribute than the table should appear
     if (!tableElement->rules().isEmpty())
         return true;    
@@ -531,15 +531,15 @@
     String title;
     if (!m_renderer)
         return title;
-    
+
     // see if there is a caption
     Node* tableElement = m_renderer->node();
-    if (tableElement && tableElement->hasTagName(tableTag)) {
-        HTMLTableCaptionElement* caption = static_cast<HTMLTableElement*>(tableElement)->caption();
+    if (tableElement && isHTMLTableElement(tableElement)) {
+        HTMLTableCaptionElement* caption = toHTMLTableElement(tableElement)->caption();
         if (caption)
             title = caption->innerText();
     }
-    
+
     // try the standard 
     if (title.isEmpty())
         title = AccessibilityRenderObject::title();
diff --git a/Source/core/accessibility/AccessibilityTable.h b/Source/core/accessibility/AccessibilityTable.h
index 07bafdf..4833556 100644
--- a/Source/core/accessibility/AccessibilityTable.h
+++ b/Source/core/accessibility/AccessibilityTable.h
@@ -30,7 +30,7 @@
 #define AccessibilityTable_h
 
 #include "core/accessibility/AccessibilityRenderObject.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/CustomElementCallback.h b/Source/core/animation/AnimatableNeutral.h
similarity index 63%
copy from Source/core/dom/CustomElementCallback.h
copy to Source/core/animation/AnimatableNeutral.h
index d71e35a..e044ee8 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/animation/AnimatableNeutral.h
@@ -28,34 +28,42 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
+#ifndef AnimatableNeutral_h
+#define AnimatableNeutral_h
 
-#include "wtf/RefCounted.h"
+#include "core/animation/AnimatableValue.h"
 
 namespace WebCore {
 
-class Element;
-
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
+class AnimatableNeutral : public AnimatableValue {
 public:
-    virtual ~CustomElementCallback() { }
+    virtual ~AnimatableNeutral() { }
 
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
+    virtual PassRefPtr<CSSValue> toCSSValue() const OVERRIDE
+    {
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+
+    virtual bool isNeutral() const OVERRIDE { return true; }
 
 protected:
-    enum CallbackType {
-        None,
-        Ready
-    };
+    static PassRefPtr<AnimatableNeutral> create() { return adoptRef(new AnimatableNeutral()); }
 
-    CustomElementCallback(CallbackType which) : m_which(which) { }
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, double fraction) const OVERRIDE
+    {
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue* value) const OVERRIDE { return defaultAddWith(this, value); }
 
 private:
-    CallbackType m_which;
+    AnimatableNeutral() : AnimatableValue(TypeNeutral) { }
+
+    friend class AnimatableValue;
 };
 
-}
+} // namespace WebCore
 
-#endif // CustomElementCallback_h
+#endif // AnimatableNeutral_h
diff --git a/Source/core/loader/FrameLoadRequest.cpp b/Source/core/animation/AnimatableNeutralTest.cpp
similarity index 66%
copy from Source/core/loader/FrameLoadRequest.cpp
copy to Source/core/animation/AnimatableNeutralTest.cpp
index 0ec26ba..0eb0188 100644
--- a/Source/core/loader/FrameLoadRequest.cpp
+++ b/Source/core/animation/AnimatableNeutralTest.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (c) 2013, Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,19 +29,29 @@
  */
 
 #include "config.h"
-#include "core/loader/FrameLoadRequest.h"
+#include "core/animation/AnimatableNeutral.h"
 
-#include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#include "core/animation/AnimatableUnknown.h"
+#include "core/css/CSSArrayFunctionValue.h"
 
-namespace WebCore {
+#include <gtest/gtest.h>
 
-FrameLoadRequest::FrameLoadRequest(Frame* frame, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
-    : m_requester(frame->document()->securityOrigin())
-    , m_resourceRequest(resourceRequest)
-    , m_lockHistory(false)
-    , m_substituteData(substituteData)
+using namespace WebCore;
+
+namespace {
+
+TEST(AnimatableNeutral, Create)
 {
+    EXPECT_TRUE(AnimatableValue::neutralValue());
 }
 
-} // namespace WebCore
+TEST(AnimatableNeutral, Add)
+{
+    RefPtr<CSSValue> cssValue = CSSArrayFunctionValue::create();
+    RefPtr<AnimatableValue> animatableUnknown = AnimatableUnknown::create(cssValue);
+
+    EXPECT_EQ(cssValue, AnimatableValue::add(animatableUnknown.get(), AnimatableValue::neutralValue())->toCSSValue());
+    EXPECT_EQ(cssValue, AnimatableValue::add(AnimatableValue::neutralValue(), animatableUnknown.get())->toCSSValue());
+}
+
+}
diff --git a/Source/core/animation/AnimatableNumber.cpp b/Source/core/animation/AnimatableNumber.cpp
new file mode 100644
index 0000000..e0929f2
--- /dev/null
+++ b/Source/core/animation/AnimatableNumber.cpp
@@ -0,0 +1,224 @@
+/*
+ * 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/platform/CalculationValue.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() const
+{
+    return toCSSPrimitiveValue();
+}
+
+PassRefPtr<AnimatableValue> AnimatableNumber::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(isSameType(value));
+    const AnimatableNumber* number = static_cast<const AnimatableNumber*>(value);
+    return AnimatableNumber::create(scale(1 - fraction).get(), number->scale(fraction).get());
+}
+
+PassRefPtr<AnimatableValue> AnimatableNumber::addWith(const AnimatableValue* value) const
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(isSameType(value));
+
+    // Optimization for adding with 0.
+    if (!m_isCalc && !m_number)
+        return takeConstRef(value);
+    const AnimatableNumber* number = static_cast<const AnimatableNumber*>(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(), m_number == trunc(m_number));
+}
+
+PassRefPtr<CSSPrimitiveValue> AnimatableNumber::toCSSPrimitiveValue() const
+{
+    ASSERT(m_unitType != UnitTypeInvalid);
+    if (!m_cachedCSSPrimitiveValue) {
+        if (m_isCalc)
+            m_cachedCSSPrimitiveValue = CSSPrimitiveValue::create(CSSCalcValue::create(m_calcExpression));
+        else
+            m_cachedCSSPrimitiveValue = CSSPrimitiveValue::create(m_number, 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 UnitTypeNone;
+    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 UnitTypeNone:
+        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
new file mode 100644
index 0000000..42a6d68
--- /dev/null
+++ b/Source/core/animation/AnimatableNumber.h
@@ -0,0 +1,120 @@
+/*
+ * 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 {
+
+// 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:
+    virtual ~AnimatableNumber() { }
+    static bool canCreateFrom(const CSSValue*);
+    static PassRefPtr<AnimatableNumber> create(CSSValue*);
+    virtual PassRefPtr<CSSValue> toCSSValue() const OVERRIDE;
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+private:
+    enum NumberUnitType {
+        UnitTypeNone,
+        UnitTypeLength,
+        UnitTypeFontSize,
+        UnitTypeFontXSize,
+        UnitTypeRootFontSize,
+        UnitTypePercentage,
+        UnitTypeViewportWidth,
+        UnitTypeViewportHeight,
+        UnitTypeViewportMin,
+        UnitTypeViewportMax,
+        UnitTypeTime,
+        UnitTypeAngle,
+        UnitTypeFrequency,
+        UnitTypeResolution,
+        UnitTypeInvalid,
+    };
+
+    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(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue = 0)
+    {
+        return adoptRef(new AnimatableNumber(number, unitType, cssPrimitiveValue));
+    }
+    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() const;
+    PassRefPtr<CSSCalcExpressionNode> toCSSCalcExpressionNode() const;
+
+    PassRefPtr<AnimatableNumber> scale(double) const;
+    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;
+};
+
+
+} // namespace WebCore
+
+#endif // AnimatableNumber_h
diff --git a/Source/core/animation/AnimatableNumberTest.cpp b/Source/core/animation/AnimatableNumberTest.cpp
new file mode 100644
index 0000000..d11ea0a
--- /dev/null
+++ b/Source/core/animation/AnimatableNumberTest.cpp
@@ -0,0 +1,254 @@
+/*
+ * 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 "wtf/MathExtras.h"
+
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+class AnimatableNumberTest : public ::testing::Test {
+protected:
+    virtual void SetUp()
+    {
+    }
+
+    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<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 AnimatableValue::interpolate(numberA, numberB, fraction)->toCSSValue()->equals(*cssValueExpected);
+    }
+    bool testAdd(CSSValue* cssValueExpected, AnimatableNumber* numberA, AnimatableNumber* numberB)
+    {
+        return AnimatableValue::add(numberA, numberB)->toCSSValue()->equals(*cssValueExpected);
+    }
+};
+
+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, 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/dom/CustomElementCallback.h b/Source/core/animation/AnimatableUnknown.h
similarity index 61%
copy from Source/core/dom/CustomElementCallback.h
copy to Source/core/animation/AnimatableUnknown.h
index d71e35a..d253478 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/animation/AnimatableUnknown.h
@@ -28,34 +28,46 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
+#ifndef AnimatableUnknown_h
+#define AnimatableUnknown_h
 
-#include "wtf/RefCounted.h"
+#include "core/animation/AnimatableValue.h"
 
 namespace WebCore {
 
-class Element;
-
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
+class AnimatableUnknown : public AnimatableValue {
 public:
-    virtual ~CustomElementCallback() { }
+    virtual ~AnimatableUnknown() { }
 
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
+    static PassRefPtr<AnimatableUnknown> create(PassRefPtr<CSSValue> value)
+    {
+        return adoptRef(new AnimatableUnknown(value));
+    }
+
+    virtual PassRefPtr<CSSValue> toCSSValue() const OVERRIDE { return m_value; }
 
 protected:
-    enum CallbackType {
-        None,
-        Ready
-    };
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, double fraction) const OVERRIDE
+    {
+        return defaultInterpolateTo(this, value, fraction);
+    }
 
-    CustomElementCallback(CallbackType which) : m_which(which) { }
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue* value) const OVERRIDE
+    {
+        return defaultAddWith(this, value);
+    }
 
 private:
-    CallbackType m_which;
+    explicit AnimatableUnknown(PassRefPtr<CSSValue> value)
+        : AnimatableValue(TypeUnknown)
+        , m_value(value)
+    {
+        ASSERT(m_value);
+    }
+
+    RefPtr<CSSValue> m_value;
 };
 
-}
+} // namespace WebCore
 
-#endif // CustomElementCallback_h
+#endif // AnimatableUnknown_h
diff --git a/Source/core/animation/AnimatableUnknownTest.cpp b/Source/core/animation/AnimatableUnknownTest.cpp
new file mode 100644
index 0000000..a5c51d9
--- /dev/null
+++ b/Source/core/animation/AnimatableUnknownTest.cpp
@@ -0,0 +1,92 @@
+/*
+ * 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/AnimatableUnknown.h"
+
+#include "core/animation/AnimatableNeutral.h"
+#include "core/css/CSSArrayFunctionValue.h"
+
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+class AnimatableUnknownTest : public ::testing::Test {
+protected:
+    virtual void SetUp()
+    {
+        cssValue = CSSArrayFunctionValue::create();
+        animatableUnknown = AnimatableUnknown::create(cssValue);
+
+        otherCSSValue = CSSArrayFunctionValue::create();
+        otherAnimatableUnknown = AnimatableUnknown::create(otherCSSValue);
+    }
+
+    RefPtr<CSSValue> cssValue;
+    RefPtr<AnimatableValue> animatableUnknown;
+
+    RefPtr<CSSValue> otherCSSValue;
+    RefPtr<AnimatableValue> otherAnimatableUnknown;
+};
+
+TEST_F(AnimatableUnknownTest, Create)
+{
+    EXPECT_TRUE(animatableUnknown);
+}
+
+TEST_F(AnimatableUnknownTest, ToCSSValue)
+{
+    EXPECT_EQ(cssValue, animatableUnknown->toCSSValue());
+}
+
+TEST_F(AnimatableUnknownTest, Interpolate)
+{
+    EXPECT_EQ(cssValue, AnimatableValue::interpolate(animatableUnknown.get(), otherAnimatableUnknown.get(), 0)->toCSSValue());
+    EXPECT_EQ(cssValue, AnimatableValue::interpolate(animatableUnknown.get(), otherAnimatableUnknown.get(), 0.4)->toCSSValue());
+    EXPECT_EQ(otherCSSValue, AnimatableValue::interpolate(animatableUnknown.get(), otherAnimatableUnknown.get(), 0.5)->toCSSValue());
+    EXPECT_EQ(otherCSSValue, AnimatableValue::interpolate(animatableUnknown.get(), otherAnimatableUnknown.get(), 0.6)->toCSSValue());
+    EXPECT_EQ(otherCSSValue, AnimatableValue::interpolate(animatableUnknown.get(), otherAnimatableUnknown.get(), 1)->toCSSValue());
+
+    EXPECT_EQ(otherCSSValue, AnimatableValue::interpolate(otherAnimatableUnknown.get(), animatableUnknown.get(), 0)->toCSSValue());
+    EXPECT_EQ(otherCSSValue, AnimatableValue::interpolate(otherAnimatableUnknown.get(), animatableUnknown.get(), 0.4)->toCSSValue());
+    EXPECT_EQ(cssValue, AnimatableValue::interpolate(otherAnimatableUnknown.get(), animatableUnknown.get(), 0.5)->toCSSValue());
+    EXPECT_EQ(cssValue, AnimatableValue::interpolate(otherAnimatableUnknown.get(), animatableUnknown.get(), 0.6)->toCSSValue());
+    EXPECT_EQ(cssValue, AnimatableValue::interpolate(otherAnimatableUnknown.get(), animatableUnknown.get(), 1)->toCSSValue());
+}
+
+TEST_F(AnimatableUnknownTest, Add)
+{
+    EXPECT_EQ(otherCSSValue, AnimatableValue::add(animatableUnknown.get(), otherAnimatableUnknown.get())->toCSSValue());
+    EXPECT_EQ(cssValue, AnimatableValue::add(otherAnimatableUnknown.get(), animatableUnknown.get())->toCSSValue());
+}
+
+}
diff --git a/Source/core/animation/AnimatableValue.cpp b/Source/core/animation/AnimatableValue.cpp
index 6631605..7637880 100644
--- a/Source/core/animation/AnimatableValue.cpp
+++ b/Source/core/animation/AnimatableValue.cpp
@@ -31,12 +31,56 @@
 #include "config.h"
 #include "core/animation/AnimatableValue.h"
 
+#include "core/animation/AnimatableNeutral.h"
+#include "core/animation/AnimatableNumber.h"
+#include "core/animation/AnimatableUnknown.h"
+
+#include <algorithm>
+
 namespace WebCore {
 
-PassRefPtr<CSSValue> AnimatableValue::toCSSValue() const
+PassRefPtr<AnimatableValue> AnimatableValue::create(CSSValue* value)
 {
-    ASSERT_NOT_REACHED();
-    return 0;
+    // FIXME: Move this logic to a separate factory class.
+    // FIXME: Handle all animatable CSSValue types.
+    if (AnimatableNumber::canCreateFrom(value))
+        return AnimatableNumber::create(value);
+    return AnimatableUnknown::create(value);
+}
+
+const AnimatableValue* AnimatableValue::neutralValue()
+{
+    static AnimatableNeutral* neutralSentinelValue = AnimatableNeutral::create().leakRef();
+    return neutralSentinelValue;
+}
+
+PassRefPtr<AnimatableValue> AnimatableValue::interpolate(const AnimatableValue* left, const AnimatableValue* right, double fraction)
+{
+    ASSERT(left);
+    ASSERT(right);
+    ASSERT(!left->isNeutral());
+    ASSERT(!right->isNeutral());
+
+    if (fraction && fraction != 1 && left->isSameType(right))
+        return left->interpolateTo(right, fraction);
+
+    return defaultInterpolateTo(left, right, fraction);
+}
+
+PassRefPtr<AnimatableValue> AnimatableValue::add(const AnimatableValue* left, const AnimatableValue* right)
+{
+    ASSERT(left);
+    ASSERT(right);
+
+    if (left->isNeutral())
+        return takeConstRef(right);
+    if (right->isNeutral())
+        return takeConstRef(left);
+
+    if (left->isSameType(right))
+        return left->addWith(right);
+
+    return defaultAddWith(left, right);
 }
 
 } // namespace WebCore
diff --git a/Source/core/animation/AnimatableValue.h b/Source/core/animation/AnimatableValue.h
index 2387661..3cc1697 100644
--- a/Source/core/animation/AnimatableValue.h
+++ b/Source/core/animation/AnimatableValue.h
@@ -32,14 +32,51 @@
 #define AnimatableValue_h
 
 #include "core/css/CSSValue.h"
-#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
-// FIXME: This class is currently just a stub.
-class AnimatableValue {
+class CSSValue;
+
+class AnimatableValue : public RefCounted<AnimatableValue> {
 public:
-    PassRefPtr<CSSValue> toCSSValue() const;
+    virtual ~AnimatableValue() { }
+    static PassRefPtr<AnimatableValue> create(CSSValue*);
+    virtual PassRefPtr<CSSValue> toCSSValue() const = 0;
+
+    static const AnimatableValue* neutralValue();
+    virtual bool isNeutral() const { return false; }
+
+    static PassRefPtr<AnimatableValue> interpolate(const AnimatableValue*, const AnimatableValue*, double fraction);
+    // 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*);
+
+protected:
+    enum AnimatableType {
+        TypeNeutral,
+        TypeNumber,
+        TypeUnknown,
+    };
+
+    AnimatableValue(AnimatableType type) : m_type(type) { }
+
+    bool isSameType(const AnimatableValue* value) const
+    {
+        ASSERT(value);
+        return value->m_type == m_type;
+    }
+
+    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); }
+
+    // For noncommutative values read A->addWith(B) to mean the value A with B composed onto it.
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const = 0;
+    static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* left, const AnimatableValue* right) { return takeConstRef(right); }
+
+    template <class T>
+    static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(const_cast<T*>(value)); }
+
+    AnimatableType m_type;
 };
 
 } // namespace WebCore
diff --git a/Source/core/animation/Animation.cpp b/Source/core/animation/Animation.cpp
index af1db4c..e2b5673 100644
--- a/Source/core/animation/Animation.cpp
+++ b/Source/core/animation/Animation.cpp
@@ -61,7 +61,7 @@
         m_isInTargetActiveAnimationsList = true;
     }
     m_compositableValues = m_effect->sample(currentIteration(), timeFraction());
-    m_target->setNeedsStyleRecalc(SyntheticStyleChange);
+    m_target->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
 }
 
 void Animation::clearEffects()
diff --git a/Source/core/animation/AnimationEffect.h b/Source/core/animation/AnimationEffect.h
index c39aff2..57b053b 100644
--- a/Source/core/animation/AnimationEffect.h
+++ b/Source/core/animation/AnimationEffect.h
@@ -42,13 +42,17 @@
 
 class AnimationEffect : public RefCounted<AnimationEffect> {
 public:
+    enum CompositeOperation {
+        CompositeReplace,
+        CompositeAdd,
+    };
     // Encapsulates the value which results from applying a set of composition operations onto an
     // underlying value. It is used to represent the output of the effect phase of the Web
     // Animations model.
     class CompositableValue : public RefCounted<CompositableValue> {
     public:
         virtual ~CompositableValue() { }
-        virtual AnimatableValue composite(const AnimatableValue&) const = 0;
+        virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue*) const = 0;
     };
 
     virtual ~AnimationEffect() { }
diff --git a/Source/core/animation/DocumentTimeline.cpp b/Source/core/animation/DocumentTimeline.cpp
index 5c1481f..0c91f0e 100644
--- a/Source/core/animation/DocumentTimeline.cpp
+++ b/Source/core/animation/DocumentTimeline.cpp
@@ -73,4 +73,12 @@
         m_document->view()->scheduleAnimation();
 }
 
+void DocumentTimeline::pauseAnimationsForTesting(double pauseTime)
+{
+    for (size_t i = 0; i < m_players.size(); i++) {
+        m_players[i]->setPaused(true);
+        m_players[i]->setCurrentTime(pauseTime);
+    }
+}
+
 } // namespace
diff --git a/Source/core/animation/DocumentTimeline.h b/Source/core/animation/DocumentTimeline.h
index 0e69c30..a2bd963 100644
--- a/Source/core/animation/DocumentTimeline.h
+++ b/Source/core/animation/DocumentTimeline.h
@@ -49,6 +49,7 @@
     void serviceAnimations(double);
     PassRefPtr<Player> play(TimedItem*);
     double currentTime() { return m_currentTime; }
+    void pauseAnimationsForTesting(double);
 
 private:
     DocumentTimeline(Document*);
diff --git a/Source/core/animation/DocumentTimelineTest.cpp b/Source/core/animation/DocumentTimelineTest.cpp
index 2f71cab..ca515be 100644
--- a/Source/core/animation/DocumentTimelineTest.cpp
+++ b/Source/core/animation/DocumentTimelineTest.cpp
@@ -32,6 +32,7 @@
 #include "core/animation/DocumentTimeline.h"
 
 #include "core/animation/Animation.h"
+#include "core/animation/KeyframeAnimationEffect.h"
 #include "core/animation/TimedItem.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
@@ -43,38 +44,50 @@
 
 namespace {
 
-class EmptyAnimationEffect : public AnimationEffect {
-public:
-    static PassRefPtr<EmptyAnimationEffect> create()
+class DocumentTimelineTest : public ::testing::Test {
+protected:
+    virtual void SetUp()
     {
-        return adoptRef(new EmptyAnimationEffect);
+        document = Document::create();
+        element = Element::create(nullQName() , document.get());
+        timeline = DocumentTimeline::create(document.get());
     }
-    virtual PassOwnPtr<CompositableValueMap> sample(int iteration, double fraction) const
-    {
-        return adoptPtr(new CompositableValueMap);
-    }
-private:
-    EmptyAnimationEffect() { }
+
+    RefPtr<Document> document;
+    RefPtr<Element> element;
+    RefPtr<DocumentTimeline> timeline;
+    Timing timing;
 };
 
-TEST(DocumentTimeline, AddAnAnimation)
+TEST_F(DocumentTimelineTest, EmptyKeyframeAnimation)
 {
-    RefPtr<Document> d = Document::create(0, KURL());
-    RefPtr<Element> e = Element::create(nullQName() , d.get());
-    RefPtr<DocumentTimeline> timeline = DocumentTimeline::create(d.get());
-    Timing timing;
-    RefPtr<Animation> anim = Animation::create(e.get(), EmptyAnimationEffect::create(), timing);
-    ASSERT_TRUE(isNull(timeline->currentTime()));
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector());
+    RefPtr<Animation> anim = Animation::create(element.get(), effect, timing);
+
+    EXPECT_TRUE(isNull(timeline->currentTime()));
 
     timeline->play(anim.get());
-    ASSERT_TRUE(isNull(timeline->currentTime()));
+    EXPECT_TRUE(isNull(timeline->currentTime()));
 
     timeline->serviceAnimations(0);
-    ASSERT_EQ(0, timeline->currentTime());
-    ASSERT_TRUE(anim->compositableValues()->isEmpty());
+    EXPECT_FLOAT_EQ(0, timeline->currentTime());
+    EXPECT_TRUE(anim->compositableValues()->isEmpty());
 
     timeline->serviceAnimations(100);
-    ASSERT_EQ(100, timeline->currentTime());
+    EXPECT_FLOAT_EQ(100, timeline->currentTime());
+}
+
+TEST_F(DocumentTimelineTest, PauseForTesting)
+{
+    float seekTime = 1;
+    RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector()), timing);
+    RefPtr<Animation> anim2  = Animation::create(element.get(), KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector()), timing);
+    RefPtr<Player> player1 = timeline->play(anim1.get());
+    RefPtr<Player> player2 = timeline->play(anim2.get());
+    timeline->pauseAnimationsForTesting(seekTime);
+
+    EXPECT_FLOAT_EQ(seekTime, player1->currentTime());
+    EXPECT_FLOAT_EQ(seekTime, player2->currentTime());
 }
 
 }
diff --git a/Source/core/animation/KeyframeAnimationEffect.cpp b/Source/core/animation/KeyframeAnimationEffect.cpp
new file mode 100644
index 0000000..bea5fb3
--- /dev/null
+++ b/Source/core/animation/KeyframeAnimationEffect.cpp
@@ -0,0 +1,315 @@
+/*
+ * 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/KeyframeAnimationEffect.h"
+
+#include "wtf/MathExtras.h"
+#include "wtf/text/StringHash.h"
+
+namespace {
+
+using namespace WebCore;
+
+class ReplaceCompositableValue : public AnimationEffect::CompositableValue {
+public:
+    static PassRefPtr<ReplaceCompositableValue> create(const AnimatableValue* value)
+    {
+        return adoptRef(new ReplaceCompositableValue(value));
+    }
+    virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue* underlyingValue) const
+    {
+        return PassRefPtr<AnimatableValue>(m_value);
+    }
+private:
+    ReplaceCompositableValue(const AnimatableValue* value)
+        : m_value(const_cast<AnimatableValue*>(value))
+    {
+    }
+    RefPtr<AnimatableValue> m_value;
+};
+
+class AddCompositableValue : public AnimationEffect::CompositableValue {
+public:
+    static PassRefPtr<AddCompositableValue> create(const AnimatableValue* value)
+    {
+        return adoptRef(new AddCompositableValue(value));
+    }
+    virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue* underlyingValue) const
+    {
+        return AnimatableValue::add(underlyingValue, m_value.get());
+    }
+private:
+    AddCompositableValue(const AnimatableValue* value)
+        : m_value(const_cast<AnimatableValue*>(value))
+    {
+    }
+    RefPtr<AnimatableValue> m_value;
+};
+
+class BlendedCompositableValue : public AnimationEffect::CompositableValue {
+public:
+    static PassRefPtr<BlendedCompositableValue> create(const AnimationEffect::CompositableValue* before, const AnimationEffect::CompositableValue* after, double fraction)
+    {
+        return adoptRef(new BlendedCompositableValue(before, after, fraction));
+    }
+    virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue* underlyingValue) const
+    {
+        return AnimatableValue::interpolate(m_before->compositeOnto(underlyingValue).get(), m_after->compositeOnto(underlyingValue).get(), m_fraction);
+    }
+private:
+    BlendedCompositableValue(const AnimationEffect::CompositableValue* before, const AnimationEffect::CompositableValue* after, double fraction)
+        : m_before(const_cast<AnimationEffect::CompositableValue*>(before))
+        , m_after(const_cast<AnimationEffect::CompositableValue*>(after))
+        , m_fraction(fraction)
+    { }
+    RefPtr<AnimationEffect::CompositableValue> m_before;
+    RefPtr<AnimationEffect::CompositableValue> m_after;
+    double m_fraction;
+};
+
+bool compareOffsets(const RefPtr<Keyframe>& a, const RefPtr<Keyframe>& b)
+{
+    return a->offset() < b->offset();
+}
+
+} // namespace
+
+
+namespace WebCore {
+
+Keyframe::Keyframe()
+    : m_offset(std::numeric_limits<double>::quiet_NaN())
+    , m_composite(AnimationEffect::CompositeReplace)
+{ }
+
+void Keyframe::setPropertyValue(CSSPropertyID property, const AnimatableValue* value)
+{
+    m_propertyValues.add(property, const_cast<AnimatableValue*>(value));
+}
+
+const AnimatableValue* Keyframe::propertyValue(CSSPropertyID property) const
+{
+    ASSERT(m_propertyValues.contains(property));
+    return m_propertyValues.get(property);
+}
+
+PropertySet Keyframe::properties() const
+{
+    // This is only used when setting up the keyframe groups, so there's no
+    // need to cache the result.
+    PropertySet properties;
+    for (PropertyValueMap::const_iterator iter = m_propertyValues.begin(); iter != m_propertyValues.end(); ++iter)
+        properties.add(*iter.keys());
+    return properties;
+}
+
+
+KeyframeAnimationEffect::KeyframeAnimationEffect(const KeyframeVector& keyframes)
+    : m_keyframes(keyframes)
+{
+}
+
+PassOwnPtr<AnimationEffect::CompositableValueMap> KeyframeAnimationEffect::sample(int iteration, double fraction) const
+{
+    const_cast<KeyframeAnimationEffect*>(this)->ensureKeyframeGroups();
+    OwnPtr<CompositableValueMap> map = adoptPtr(new CompositableValueMap());
+    for (KeyframeGroupMap::const_iterator iter = m_keyframeGroups->begin(); iter != m_keyframeGroups->end(); ++iter)
+        map->add(iter->key, iter->value->sample(iteration, fraction));
+    return map.release();
+}
+
+KeyframeAnimationEffect::KeyframeVector KeyframeAnimationEffect::normalizedKeyframes() const
+{
+    KeyframeVector keyframes = m_keyframes;
+
+    // Set offsets at 0.0 and 1.0 at ends if unset.
+    if (keyframes.size() >= 2) {
+        Keyframe* firstKeyframe = keyframes.first().get();
+        if (std::isnan(firstKeyframe->offset()))
+            firstKeyframe->setOffset(0.0);
+    }
+    if (keyframes.size() >= 1) {
+        Keyframe* lastKeyframe = keyframes.last().get();
+        if (lastKeyframe && std::isnan(lastKeyframe->offset()))
+            lastKeyframe->setOffset(1.0);
+    }
+
+    // FIXME: Distribute offsets where missing.
+    for (KeyframeVector::iterator iter = keyframes.begin(); iter != keyframes.end(); ++iter)
+        ASSERT(!std::isnan((*iter)->offset()));
+
+    // Sort by offset.
+    std::stable_sort(keyframes.begin(), keyframes.end(), compareOffsets);
+    return keyframes;
+}
+
+void KeyframeAnimationEffect::ensureKeyframeGroups()
+{
+    if (m_keyframeGroups)
+        return;
+
+    m_keyframeGroups = adoptPtr(new KeyframeGroupMap);
+    const KeyframeVector& keyframes = normalizedKeyframes();
+    for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyframeIter != keyframes.end(); ++keyframeIter) {
+        const Keyframe* keyframe = keyframeIter->get();
+        PropertySet keyframeProperties = keyframe->properties();
+        for (PropertySet::const_iterator propertyIter = keyframeProperties.begin(); propertyIter != keyframeProperties.end(); ++propertyIter) {
+            CSSPropertyID property = *propertyIter;
+            KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(property);
+            if (groupIter == m_keyframeGroups->end()) {
+                KeyframeGroupMap::AddResult result = m_keyframeGroups->add(property, adoptPtr(new PropertySpecificKeyframeGroup));
+                ASSERT(result.isNewEntry);
+                groupIter = result.iterator;
+            }
+            groupIter->value->appendKeyframe(adoptPtr(
+                new PropertySpecificKeyframe(keyframe->offset(), keyframe->propertyValue(property), keyframe->composite())));
+        }
+    }
+
+    // Add synthetic keyframes.
+    for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_keyframeGroups->end(); ++iter) {
+        iter->value->addSyntheticKeyframeIfRequired();
+        iter->value->removeRedundantKeyframes();
+    }
+}
+
+
+KeyframeAnimationEffect::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, const AnimatableValue* value, CompositeOperation composite)
+    : m_offset(offset)
+    , m_value(composite == AnimationEffect::CompositeReplace ?
+        static_cast<PassRefPtr<CompositableValue> >(ReplaceCompositableValue::create(value)) :
+        static_cast<PassRefPtr<CompositableValue> >(AddCompositableValue::create(value)))
+{
+}
+
+KeyframeAnimationEffect::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, PassRefPtr<CompositableValue> value)
+    : m_offset(offset)
+    , m_value(value)
+{
+    ASSERT(!std::isnan(m_offset));
+}
+
+PassOwnPtr<KeyframeAnimationEffect::PropertySpecificKeyframe> KeyframeAnimationEffect::PropertySpecificKeyframe::cloneWithOffset(double offset) const
+{
+    return adoptPtr(new PropertySpecificKeyframe(offset, PassRefPtr<CompositableValue>(m_value)));
+}
+
+
+void KeyframeAnimationEffect::PropertySpecificKeyframeGroup::appendKeyframe(PassOwnPtr<PropertySpecificKeyframe> keyframe)
+{
+    ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->offset());
+    m_keyframes.append(keyframe);
+}
+
+void KeyframeAnimationEffect::PropertySpecificKeyframeGroup::removeRedundantKeyframes()
+{
+    // As an optimization, removes keyframes in the following categories, as
+    // they will never be used by sample().
+    // - End keyframes with the same offset as their neighbor
+    // - Interior keyframes with the same offset as both their neighbors
+    // Note that synthetic keyframes must be added before this method is
+    // called.
+    ASSERT(m_keyframes.size() >= 2);
+    for (int i = m_keyframes.size() - 1; i >= 0; --i) {
+        double offset = m_keyframes[i]->offset();
+        bool hasSameOffsetAsPreviousNeighbor = !i || m_keyframes[i - 1]->offset() == offset;
+        bool hasSameOffsetAsNextNeighbor = i == m_keyframes.size() - 1 || m_keyframes[i + 1]->offset() == offset;
+        if (hasSameOffsetAsPreviousNeighbor && hasSameOffsetAsNextNeighbor)
+            m_keyframes.remove(i);
+    }
+    ASSERT(m_keyframes.size() >= 2);
+}
+
+void KeyframeAnimationEffect::PropertySpecificKeyframeGroup::addSyntheticKeyframeIfRequired()
+{
+    ASSERT(!m_keyframes.isEmpty());
+    double offset = m_keyframes.first()->offset();
+    bool allOffsetsEqual = true;
+    for (PropertySpecificKeyframeVector::const_iterator iter = m_keyframes.begin() + 1; iter != m_keyframes.end(); ++iter) {
+        if ((*iter)->offset() != offset) {
+            allOffsetsEqual = false;
+            break;
+        }
+    }
+    if (!allOffsetsEqual)
+        return;
+
+    if (!offset)
+        appendKeyframe(m_keyframes.first()->cloneWithOffset(1.0));
+    else
+        m_keyframes.insert(0, adoptPtr(new PropertySpecificKeyframe(0.0, AnimatableValue::neutralValue(), CompositeAdd)));
+}
+
+PassRefPtr<AnimationEffect::CompositableValue> KeyframeAnimationEffect::PropertySpecificKeyframeGroup::sample(int iteration, double offset) const
+{
+    // FIXME: Implement accumulation.
+    ASSERT_UNUSED(iteration, !iteration);
+
+    double minimumOffset = m_keyframes.first()->offset();
+    double maximumOffset = m_keyframes.last()->offset();
+    ASSERT(minimumOffset != maximumOffset);
+
+    PropertySpecificKeyframeVector::const_iterator before;
+    PropertySpecificKeyframeVector::const_iterator after;
+
+    // Note that this algorithm is simpler than that in the spec because we
+    // have removed keyframes with equal offsets in
+    // removeRedundantKeyframes().
+    if (offset < minimumOffset) {
+        before = m_keyframes.begin();
+        after = before + 1;
+        ASSERT((*before)->offset() > offset);
+        ASSERT((*after)->offset() > offset);
+    } else if (offset >= maximumOffset) {
+        after = m_keyframes.end() - 1;
+        before = after - 1;
+        ASSERT((*before)->offset() < offset);
+        ASSERT((*after)->offset() <= offset);
+    } else {
+        // FIXME: This is inefficient for large numbers of keyframes. Consider
+        // using binary search.
+        after = m_keyframes.begin();
+        while ((*after)->offset() <= offset)
+            ++after;
+        before = after - 1;
+        ASSERT((*before)->offset() <= offset);
+        ASSERT((*after)->offset() > offset);
+    }
+
+    if ((*before)->offset() == offset)
+        return const_cast<CompositableValue*>((*before)->value());
+    if ((*after)->offset() == offset)
+        return const_cast<CompositableValue*>((*after)->value());
+    return BlendedCompositableValue::create((*before)->value(), (*after)->value(),
+        (offset - (*before)->offset()) / ((*after)->offset() - (*before)->offset()));
+}
+
+} // namespace
diff --git a/Source/core/animation/KeyframeAnimationEffect.h b/Source/core/animation/KeyframeAnimationEffect.h
new file mode 100644
index 0000000..14985b9
--- /dev/null
+++ b/Source/core/animation/KeyframeAnimationEffect.h
@@ -0,0 +1,125 @@
+/*
+ * 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 KeyframeAnimationEffect_h
+#define KeyframeAnimationEffect_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/AnimationEffect.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+typedef HashSet<CSSPropertyID> PropertySet;
+
+// Represents the keyframes set through the API.
+class Keyframe : public RefCounted<Keyframe> {
+public:
+    static PassRefPtr<Keyframe> create()
+    {
+        return adoptRef(new Keyframe);
+    }
+    void setOffset(double offset) { m_offset = offset; }
+    double offset() const { return m_offset; }
+    void setComposite(AnimationEffect::CompositeOperation composite) { m_composite = composite; }
+    AnimationEffect::CompositeOperation composite() const { return m_composite; }
+    void setPropertyValue(CSSPropertyID, const AnimatableValue*);
+    const AnimatableValue* propertyValue(CSSPropertyID) const;
+    PropertySet properties() const;
+private:
+    Keyframe();
+    double m_offset;
+    AnimationEffect::CompositeOperation m_composite;
+    typedef HashMap<CSSPropertyID, RefPtr<AnimatableValue> > PropertyValueMap;
+    PropertyValueMap m_propertyValues;
+};
+
+class KeyframeAnimationEffect : public AnimationEffect {
+public:
+    typedef Vector<RefPtr<Keyframe> > KeyframeVector;
+    // FIXME: Implement accumulation.
+    static PassRefPtr<KeyframeAnimationEffect> create(const KeyframeVector& keyframes)
+    {
+        return adoptRef(new KeyframeAnimationEffect(keyframes));
+    }
+
+    // AnimationEffect implementation.
+    virtual PassOwnPtr<CompositableValueMap> sample(int iteration, double fraction) const OVERRIDE;
+
+    // FIXME: Implement setFrames()
+    const KeyframeVector& getFrames() const { return m_keyframes; }
+
+private:
+    class PropertySpecificKeyframe {
+    public:
+        PropertySpecificKeyframe(double offset, const AnimatableValue*, CompositeOperation);
+        double offset() const { return m_offset; }
+        const CompositableValue* value() const { return m_value.get(); }
+        PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const;
+    private:
+        // Used by cloneWithOffset().
+        PropertySpecificKeyframe(double offset, PassRefPtr<CompositableValue>);
+        double m_offset;
+        RefPtr<CompositableValue> m_value;
+    };
+
+    class PropertySpecificKeyframeGroup {
+    public:
+        void appendKeyframe(PassOwnPtr<PropertySpecificKeyframe>);
+        void removeRedundantKeyframes();
+        void addSyntheticKeyframeIfRequired();
+        PassRefPtr<CompositableValue> sample(int iteration, double offset) const;
+    private:
+        typedef Vector<OwnPtr<PropertySpecificKeyframe> > PropertySpecificKeyframeVector;
+        PropertySpecificKeyframeVector m_keyframes;
+    };
+
+    KeyframeAnimationEffect(const KeyframeVector& keyframes);
+
+    KeyframeVector normalizedKeyframes() const;
+    // Lazily computes the groups of property-specific keyframes.
+    void ensureKeyframeGroups();
+
+    KeyframeVector m_keyframes;
+    // The spec describes filtering the normalized keyframes at sampling time
+    // to get the 'property-specific keyframes'. For efficiency, we cache the
+    // property-specific lists.
+    typedef HashMap<CSSPropertyID, OwnPtr<PropertySpecificKeyframeGroup> > KeyframeGroupMap;
+    OwnPtr<KeyframeGroupMap> m_keyframeGroups;
+};
+
+} // namespace WebCore
+
+#endif // KeyframeAnimationEffect_h
diff --git a/Source/core/animation/KeyframeAnimationEffectTest.cpp b/Source/core/animation/KeyframeAnimationEffectTest.cpp
new file mode 100644
index 0000000..08ff67e
--- /dev/null
+++ b/Source/core/animation/KeyframeAnimationEffectTest.cpp
@@ -0,0 +1,325 @@
+/*
+ * 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/KeyframeAnimationEffect.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+AnimatableValue* unknownAnimatableValue(double n)
+{
+    return AnimatableValue::create(CSSPrimitiveValue::create(n, CSSPrimitiveValue::CSS_UNKNOWN).get()).leakRef();
+}
+
+AnimatableValue* pixelAnimatableValue(double n)
+{
+    return AnimatableValue::create(CSSPrimitiveValue::create(n, CSSPrimitiveValue::CSS_PX).get()).leakRef();
+}
+
+KeyframeAnimationEffect::KeyframeVector keyframesAtZeroAndOne(AnimatableValue* zeroValue, AnimatableValue* oneValue)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(2);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue);
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(1.0);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue);
+    return keyframes;
+}
+
+void expectDoubleValue(double expectedValue, PassRefPtr<AnimatableValue> value)
+{
+    EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), toCSSPrimitiveValue(value->toCSSValue().get())->getDoubleValue());
+}
+
+
+TEST(KeyframeAnimationEffect, BasicOperation)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnimatableValue(3.0), unknownAnimatableValue(5.0));
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    OwnPtr<AnimationEffect::CompositableValueMap> values = effect->sample(0, 0.6);
+    ASSERT_EQ(1, values->size());
+    EXPECT_EQ(CSSPropertyLeft, values->begin()->key);
+    expectDoubleValue(5.0, values->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, CompositeReplaceNonInterpolable)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnimatableValue(3.0), unknownAnimatableValue(5.0));
+    keyframes[0]->setComposite(AnimationEffect::CompositeReplace);
+    keyframes[1]->setComposite(AnimationEffect::CompositeReplace);
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(5.0, effect->sample(0, 0.6)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, CompositeReplace)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimatableValue(3.0), pixelAnimatableValue(5.0));
+    keyframes[0]->setComposite(AnimationEffect::CompositeReplace);
+    keyframes[1]->setComposite(AnimationEffect::CompositeReplace);
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, effect->sample(0, 0.6)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, CompositeAdd)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimatableValue(3.0), pixelAnimatableValue(5.0));
+    keyframes[0]->setComposite(AnimationEffect::CompositeAdd);
+    keyframes[1]->setComposite(AnimationEffect::CompositeAdd);
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, effect->sample(0, 0.6)->begin()->value->compositeOnto(pixelAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, ExtrapolateReplaceNonInterpolable)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnimatableValue(3.0), unknownAnimatableValue(5.0));
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    keyframes[0]->setComposite(AnimationEffect::CompositeReplace);
+    keyframes[1]->setComposite(AnimationEffect::CompositeReplace);
+    expectDoubleValue(5.0, effect->sample(0, 1.6)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, ExtrapolateReplace)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimatableValue(3.0), pixelAnimatableValue(5.0));
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    keyframes[0]->setComposite(AnimationEffect::CompositeReplace);
+    keyframes[1]->setComposite(AnimationEffect::CompositeReplace);
+    expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, effect->sample(0, 1.6)->begin()->value->compositeOnto(pixelAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, ExtrapolateAdd)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimatableValue(3.0), pixelAnimatableValue(5.0));
+    keyframes[0]->setComposite(AnimationEffect::CompositeAdd);
+    keyframes[1]->setComposite(AnimationEffect::CompositeAdd);
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, effect->sample(0, 1.6)->begin()->value->compositeOnto(pixelAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, ZeroKeyframes)
+{
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector());
+    EXPECT_TRUE(effect->sample(0, 0.5)->isEmpty());
+}
+
+TEST(KeyframeAnimationEffect, SingleKeyframeAtOffsetZero)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(1);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(3.0, effect->sample(0, 0.6)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, SingleKeyframeAtOffsetOne)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(1);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(1.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(7.0 * 0.4 + 5.0 * 0.6, effect->sample(0, 0.6)->begin()->value->compositeOnto(pixelAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, MoreThanTwoKeyframes)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(3);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0));
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(0.5);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0));
+    keyframes[2] = Keyframe::create();
+    keyframes[2]->setOffset(1.0);
+    keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(4.0, effect->sample(0, 0.3)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    expectDoubleValue(5.0, effect->sample(0, 0.8)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, EndKeyframeOffsetsUnspecified)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(3);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0));
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(0.5);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0));
+    keyframes[2] = Keyframe::create();
+    keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(3.0, effect->sample(0, 0.1)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    expectDoubleValue(4.0, effect->sample(0, 0.6)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    expectDoubleValue(5.0, effect->sample(0, 0.9)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, SampleOnKeyframe)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(3);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0));
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(0.5);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0));
+    keyframes[2] = Keyframe::create();
+    keyframes[2]->setOffset(1.0);
+    keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(3.0, effect->sample(0, 0.0)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    expectDoubleValue(4.0, effect->sample(0, 0.5)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    expectDoubleValue(5.0, effect->sample(0, 1.0)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+// Note that this tests an implementation detail, not behaviour defined by the spec.
+TEST(KeyframeAnimationEffect, SampleReturnsSameAnimatableValueInstance)
+{
+    AnimatableValue* threePixelsValue = unknownAnimatableValue(3.0);
+    AnimatableValue* fourPixelsValue = unknownAnimatableValue(4.0);
+    AnimatableValue* fivePixelsValue = unknownAnimatableValue(5.0);
+
+    KeyframeAnimationEffect::KeyframeVector keyframes(3);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, threePixelsValue);
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(0.5);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, fourPixelsValue);
+    keyframes[2] = Keyframe::create();
+    keyframes[2]->setOffset(1.0);
+    keyframes[2]->setPropertyValue(CSSPropertyLeft, fivePixelsValue);
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    EXPECT_EQ(threePixelsValue, effect->sample(0, 0.0)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    EXPECT_EQ(threePixelsValue, effect->sample(0, 0.1)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    EXPECT_EQ(fourPixelsValue, effect->sample(0, 0.4)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    EXPECT_EQ(fourPixelsValue, effect->sample(0, 0.5)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    EXPECT_EQ(fourPixelsValue, effect->sample(0, 0.6)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    EXPECT_EQ(fivePixelsValue, effect->sample(0, 0.9)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+    EXPECT_EQ(fivePixelsValue, effect->sample(0, 1.0)->begin()->value->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, MultipleKeyframesWithSameOffset)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(7);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.1);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(1.0));
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(0.1);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(2.0));
+    keyframes[2] = Keyframe::create();
+    keyframes[2]->setOffset(0.5);
+    keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0));
+    keyframes[3] = Keyframe::create();
+    keyframes[3]->setOffset(0.5);
+    keyframes[3]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0));
+    keyframes[4] = Keyframe::create();
+    keyframes[4]->setOffset(0.5);
+    keyframes[4]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0));
+    keyframes[5] = Keyframe::create();
+    keyframes[5]->setOffset(0.9);
+    keyframes[5]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(6.0));
+    keyframes[6] = Keyframe::create();
+    keyframes[6]->setOffset(0.9);
+    keyframes[6]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(2.0, effect->sample(0, 0.0)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+    expectDoubleValue(2.0, effect->sample(0, 0.2)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+    expectDoubleValue(3.0, effect->sample(0, 0.4)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+    expectDoubleValue(5.0, effect->sample(0, 0.5)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+    expectDoubleValue(5.0, effect->sample(0, 0.6)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+    expectDoubleValue(6.0, effect->sample(0, 0.8)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+    expectDoubleValue(6.0, effect->sample(0, 1.0)->begin()->value->compositeOnto(unknownAnimatableValue(8.0)));
+}
+
+TEST(KeyframeAnimationEffect, PerKeyframeComposite)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(2);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0));
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(1.0);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0));
+    keyframes[1]->setComposite(AnimationEffect::CompositeAdd);
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    expectDoubleValue(3.0 * 0.4 + (7.0 + 5.0) * 0.6, effect->sample(0, 0.6)->begin()->value->compositeOnto(pixelAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, MultipleProperties)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes(2);
+    keyframes[0] = Keyframe::create();
+    keyframes[0]->setOffset(0.0);
+    keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0));
+    keyframes[0]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(4.0));
+    keyframes[1] = Keyframe::create();
+    keyframes[1]->setOffset(1.0);
+    keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0));
+    keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0));
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    OwnPtr<AnimationEffect::CompositableValueMap> values = effect->sample(0, 0.6);
+    ASSERT_EQ(2, values->size());
+    ASSERT_TRUE(values->contains(CSSPropertyLeft));
+    expectDoubleValue(5.0, values->get(CSSPropertyLeft)->compositeOnto(unknownAnimatableValue(7.0)));
+    ASSERT_TRUE(values->contains(CSSPropertyRight));
+    expectDoubleValue(6.0, values->get(CSSPropertyRight)->compositeOnto(unknownAnimatableValue(7.0)));
+}
+
+TEST(KeyframeAnimationEffect, RecompositeCompositableValue)
+{
+    KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimatableValue(3.0), pixelAnimatableValue(5.0));
+    keyframes[0]->setComposite(AnimationEffect::CompositeAdd);
+    keyframes[1]->setComposite(AnimationEffect::CompositeAdd);
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+    OwnPtr<AnimationEffect::CompositableValueMap> values = effect->sample(0, 0.6);
+    expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->begin()->value->compositeOnto(pixelAnimatableValue(7.0)));
+    expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->begin()->value->compositeOnto(pixelAnimatableValue(9.0)));
+}
+
+} // namespace
diff --git a/Source/core/animation/PlayerTest.cpp b/Source/core/animation/PlayerTest.cpp
index a5f86ca..26970a9 100644
--- a/Source/core/animation/PlayerTest.cpp
+++ b/Source/core/animation/PlayerTest.cpp
@@ -45,7 +45,7 @@
 protected:
     virtual void SetUp()
     {
-        document = Document::create(0, KURL());
+        document = Document::create();
         timeline = DocumentTimeline::create(document.get());
         player = Player::create(timeline.get(), 0);
     }
diff --git a/Source/core/core.gyp b/Source/core/core.gyp
index d30200a..7f6e199 100644
--- a/Source/core/core.gyp
+++ b/Source/core/core.gyp
@@ -81,11 +81,11 @@
             '../devtools/protocol.json',
           ],
           'outputs': [
-            '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendDispatcher.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorBackendDispatcher.cpp',
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorBackendDispatcher.h',
-            '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorFrontend.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorFrontend.cpp',
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorFrontend.h',
-            '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorTypeBuilder.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorTypeBuilder.cpp',
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorTypeBuilder.h',
           ],
           'variables': {
@@ -96,8 +96,7 @@
             'python',
             'inspector/CodeGeneratorInspector.py',
             '../devtools/protocol.json',
-            '--output_h_dir', '<(SHARED_INTERMEDIATE_DIR)/webkit',
-            '--output_cpp_dir', '<(SHARED_INTERMEDIATE_DIR)/webcore',
+            '--output_dir', '<(SHARED_INTERMEDIATE_DIR)/webkit',
           ],
           'message': 'Generating Inspector protocol backend sources from protocol.json',
           'msvs_cygwin_shell': 1,
@@ -124,14 +123,13 @@
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorInstrumentationInl.h',
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorOverridesInl.h',
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InstrumentingAgentsInl.h',
-            '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorInstrumentationImpl.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorInstrumentationImpl.cpp',
           ],
           'action': [
             'python',
             'inspector/CodeGeneratorInstrumentation.py',
             'inspector/InspectorInstrumentation.idl',
-            '--output_h_dir', '<(SHARED_INTERMEDIATE_DIR)/webkit',
-            '--output_cpp_dir', '<(SHARED_INTERMEDIATE_DIR)/webcore',
+            '--output_dir', '<(SHARED_INTERMEDIATE_DIR)/webkit',
           ],
           'message': 'Generating Inspector instrumentation code from InspectorInstrumentation.idl',
           'msvs_cygwin_shell': 1,
@@ -236,10 +234,6 @@
         '<(libjpeg_gyp_path):libjpeg',
       ],
       'include_dirs': [
-        # FIXME:  Remove <(SHARED_INTERMEDIATE_DIR)/webcore when we
-        # can entice gyp into letting us put both the .cpp and .h
-        # files in the same output directory.
-        '<(SHARED_INTERMEDIATE_DIR)/webcore',
         '<(SHARED_INTERMEDIATE_DIR)/webkit',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
         '<@(webcore_include_dirs)',
@@ -270,6 +264,7 @@
         # Additional .cpp files from make_derived_sources actions.
         '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/CachedResourceInitiatorTypeNames.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/CalendarPicker.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorSuggestionPicker.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/Event.cpp',
@@ -293,14 +288,17 @@
         # Generated from RuntimeEnabledFeatures.in
         '<(SHARED_INTERMEDIATE_DIR)/webkit/RuntimeEnabledFeatures.cpp',
 
+        # Generated from CSSParser-in.cpp
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSParser.cpp',
+
         # Additional .cpp files from the make_derived_sources rules.
         '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSGrammar.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/XPathGrammar.cpp',
 
         # Additional .cpp files from the inspector_protocol_sources list.
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorFrontend.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendDispatcher.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorTypeBuilder.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorFrontend.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorBackendDispatcher.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorTypeBuilder.cpp',
 
         # Additional .cpp files from the inspector_instrumentation_sources list.
         '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorCanvasInstrumentationInl.h',
@@ -309,7 +307,7 @@
         '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorInstrumentationInl.h',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorOverridesInl.h',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/InstrumentingAgentsInl.h',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorInstrumentationImpl.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorInstrumentationImpl.cpp',
 
         # Additional .cpp files for SVG.
         '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.cpp',
@@ -358,7 +356,7 @@
         '../wtf/wtf.gyp:wtf',
         '../config.gyp:config',
         '../weborigin/weborigin.gyp:weborigin',
-        '<(angle_path)/src/build_angle.gyp:translator_glsl',
+        '<(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/iccjpeg/iccjpeg.gyp:iccjpeg',
@@ -378,7 +376,7 @@
       'export_dependent_settings': [
         '../wtf/wtf.gyp:wtf',
         '../config.gyp:config',
-        '<(angle_path)/src/build_angle.gyp:translator_glsl',
+        '<(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/iccjpeg/iccjpeg.gyp:iccjpeg',
@@ -404,7 +402,7 @@
         'include_dirs': [
           '<@(webcore_include_dirs)',
           '<(DEPTH)/gpu',
-          '<(angle_path)/include/GLSLANG',
+          '<(DEPTH)/third_party/angle_dx11/include/GLSLANG',
         ],
         'msvs_disabled_warnings': [
           4138, 4244, 4291, 4305, 4344, 4355, 4521, 4099,
@@ -1102,17 +1100,19 @@
       ],
       'sources': [
         '<@(webcore_test_support_files)',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8MallocStatistics.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8MallocStatistics.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8MallocStatistics.h',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8TypeConversions.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8TypeConversions.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8TypeConversions.h',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8Internals.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8Internals.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8Internals.h',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8InternalSettings.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalProfilers.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalProfilers.h',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalSettings.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalSettings.h',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8InternalSettingsGenerated.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalSettingsGenerated.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalSettingsGenerated.h',
-        '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8InternalRuntimeFlags.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalRuntimeFlags.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8InternalRuntimeFlags.h',
       ],
       'sources/': [
diff --git a/Source/core/core.gypi b/Source/core/core.gypi
index f05128a..cc62245 100644
--- a/Source/core/core.gypi
+++ b/Source/core/core.gypi
@@ -1,6 +1,6 @@
 {
     'variables': {
-        'core_idl_files': [
+        'deprecated_perl_core_idl_files': [
             'css/CSS.idl',
             'css/CSSCharsetRule.idl',
             'css/CSSFontFaceLoadEvent.idl',
@@ -44,7 +44,6 @@
             'dom/BeforeLoadEvent.idl',
             'dom/CDATASection.idl',
             'dom/CharacterData.idl',
-            'dom/ChildNode.idl',
             'dom/ClientRect.idl',
             'dom/ClientRectList.idl',
             'dom/Clipboard.idl',
@@ -61,7 +60,6 @@
             'dom/DeviceOrientationEvent.idl',
             'dom/Document.idl',
             'dom/DocumentFragment.idl',
-            'dom/DocumentFullscreen.idl',
             'dom/DocumentType.idl',
             'dom/Element.idl',
             'dom/Entity.idl',
@@ -86,7 +84,6 @@
             'dom/Notation.idl',
             'dom/OverflowEvent.idl',
             'dom/PageTransitionEvent.idl',
-            'dom/ParentNode.idl',
             'dom/PopStateEvent.idl',
             'dom/ProcessingInstruction.idl',
             'dom/ProgressEvent.idl',
@@ -206,7 +203,6 @@
             'html/ValidityState.idl',
             'html/VoidCallback.idl',
             'html/canvas/ANGLEInstancedArrays.idl',
-            'html/canvas/ArrayBuffer.idl',
             'html/canvas/ArrayBufferView.idl',
             'html/canvas/CanvasGradient.idl',
             'html/canvas/CanvasPattern.idl',
@@ -274,6 +270,8 @@
             'page/Console.idl',
             'page/EventSource.idl',
             'page/History.idl',
+            'page/ImageBitmap.idl',
+            'page/ImageBitmapCallback.idl',
             'page/Location.idl',
             'page/MemoryInfo.idl',
             'page/Navigator.idl',
@@ -293,8 +291,6 @@
             'page/SpeechInputResultList.idl',
             'page/WebKitPoint.idl',
             'page/Window.idl',
-            'page/WindowPagePopup.idl',
-            'page/WindowTimers.idl',
             'page/WorkerNavigator.idl',
             'plugins/MimeType.idl',
             'plugins/MimeTypeArray.idl',
@@ -302,7 +298,6 @@
             'plugins/PluginArray.idl',
             'storage/Storage.idl',
             'storage/StorageEvent.idl',
-            'workers/AbstractWorker.idl',
             'workers/DedicatedWorkerGlobalScope.idl',
             'workers/SharedWorker.idl',
             'workers/SharedWorkerGlobalScope.idl',
@@ -310,6 +305,7 @@
             'workers/WorkerGlobalScope.idl',
             'workers/WorkerLocation.idl',
             'xml/DOMParser.idl',
+            'xml/DocumentXPathEvaluator.idl',
             'xml/XMLHttpRequest.idl',
             'xml/XMLHttpRequestProgressEvent.idl',
             'xml/XMLHttpRequestUpload.idl',
@@ -320,7 +316,15 @@
             'xml/XPathResult.idl',
             'xml/XSLTProcessor.idl',
         ],
-        'svg_idl_files': [
+        'python_core_idl_files': [
+            'dom/ChildNode.idl',
+            'dom/DocumentFullscreen.idl',
+            'dom/ParentNode.idl',
+            'page/WindowPagePopup.idl',
+            'page/WindowTimers.idl',
+            'workers/AbstractWorker.idl',
+        ],
+        'deprecated_perl_svg_idl_files': [
             'svg/SVGAElement.idl',
             'svg/SVGAltGlyphElement.idl',
             'svg/SVGAltGlyphItemElement.idl',
@@ -355,7 +359,6 @@
             'svg/SVGElementInstance.idl',
             'svg/SVGElementInstanceList.idl',
             'svg/SVGEllipseElement.idl',
-            'svg/SVGExternalResourcesRequired.idl',
             'svg/SVGFEBlendElement.idl',
             'svg/SVGFEColorMatrixElement.idl',
             'svg/SVGFEComponentTransferElement.idl',
@@ -382,8 +385,6 @@
             'svg/SVGFETileElement.idl',
             'svg/SVGFETurbulenceElement.idl',
             'svg/SVGFilterElement.idl',
-            'svg/SVGFilterPrimitiveStandardAttributes.idl',
-            'svg/SVGFitToViewBox.idl',
             'svg/SVGFontElement.idl',
             'svg/SVGFontFaceElement.idl',
             'svg/SVGFontFaceFormatElement.idl',
@@ -454,7 +455,6 @@
             'svg/SVGSymbolElement.idl',
             'svg/SVGTRefElement.idl',
             'svg/SVGTSpanElement.idl',
-            'svg/SVGTests.idl',
             'svg/SVGTextContentElement.idl',
             'svg/SVGTextElement.idl',
             'svg/SVGTextPathElement.idl',
@@ -462,15 +462,21 @@
             'svg/SVGTitleElement.idl',
             'svg/SVGTransform.idl',
             'svg/SVGTransformList.idl',
-            'svg/SVGURIReference.idl',
             'svg/SVGUnitTypes.idl',
             'svg/SVGUseElement.idl',
             'svg/SVGViewElement.idl',
             'svg/SVGViewSpec.idl',
             'svg/SVGVKernElement.idl',
-            'svg/SVGZoomAndPan.idl',
             'svg/SVGZoomEvent.idl',
         ],
+        'python_svg_idl_files': [
+            'svg/SVGExternalResourcesRequired.idl',
+            'svg/SVGFilterPrimitiveStandardAttributes.idl',
+            'svg/SVGFitToViewBox.idl',
+            'svg/SVGTests.idl',
+            'svg/SVGURIReference.idl',
+            'svg/SVGZoomAndPan.idl',
+        ],
         'webcore_files': [
             'Init.cpp',
             'Init.h',
@@ -526,6 +532,10 @@
             'accessibility/AccessibilityTableHeaderContainer.h',
             'accessibility/AccessibilityTableRow.cpp',
             'accessibility/AccessibilityTableRow.h',
+            'animation/AnimatableNeutral.h',
+            'animation/AnimatableNumber.cpp',
+            'animation/AnimatableNumber.h',
+            'animation/AnimatableUnknown.h',
             'animation/AnimatableValue.cpp',
             'animation/AnimatableValue.h',
             'animation/Animation.cpp',
@@ -533,6 +543,8 @@
             'animation/AnimationEffect.h',
             'animation/DocumentTimeline.cpp',
             'animation/DocumentTimeline.h',
+            'animation/KeyframeAnimationEffect.cpp',
+            'animation/KeyframeAnimationEffect.h',
             'animation/Player.cpp',
             'animation/Player.h',
             'animation/TimedItem.cpp',
@@ -609,7 +621,6 @@
             'css/CSSOMUtils.h',
             'css/CSSPageRule.cpp',
             'css/CSSPageRule.h',
-            'css/CSSParser.cpp',
             'css/CSSParser.h',
             'css/CSSParserMode.h',
             'css/CSSParserValues.cpp',
@@ -656,8 +667,6 @@
             'css/CSSViewportRule.h',
             'css/CSSViewportRule.cpp',
             'css/Counter.h',
-            'css/DeprecatedStyleBuilder.cpp',
-            'css/DeprecatedStyleBuilder.h',
             'css/DOMWindowCSS.cpp',
             'css/DOMWindowCSS.h',
             'css/DocumentRuleSets.cpp',
@@ -705,7 +714,6 @@
             'css/RuleSet.h',
             'css/SVGCSSComputedStyleDeclaration.cpp',
             'css/SVGCSSParser.cpp',
-            'css/SVGCSSStyleSelector.cpp',
             'css/SelectorChecker.cpp',
             'css/SelectorChecker.h',
             'css/SelectorCheckerFastPath.cpp',
@@ -739,8 +747,18 @@
             'css/resolver/ElementStyleResources.h',
             'css/resolver/FilterOperationResolver.cpp',
             'css/resolver/FilterOperationResolver.h',
+            'css/resolver/MatchedPropertiesCache.cpp',
+            'css/resolver/MatchedPropertiesCache.h',
+            'css/resolver/MatchResult.cpp',
+            'css/resolver/MatchResult.h',
+            'css/resolver/MediaQueryResult.cpp',
+            'css/resolver/MediaQueryResult.h',
             'css/resolver/ScopedStyleResolver.cpp',
             'css/resolver/ScopedStyleResolver.h',
+            'css/resolver/SharedStyleFinder.cpp',
+            'css/resolver/SharedStyleFinder.h',
+            'css/resolver/StyleAdjuster.cpp',
+            'css/resolver/StyleAdjuster.h',
             'css/resolver/StyleBuilderCustom.cpp',
             'css/resolver/StyleResolver.cpp',
             'css/resolver/StyleResolver.h',
@@ -869,36 +887,6 @@
             'history/BackForwardClient.h',
             'history/BackForwardController.cpp',
             'history/HistoryItem.cpp',
-            'icu/unicode/parseerr.h',
-            'icu/unicode/platform.h',
-            'icu/unicode/putil.h',
-            'icu/unicode/ubrk.h',
-            'icu/unicode/uchar.h',
-            'icu/unicode/ucnv.h',
-            'icu/unicode/ucnv_cb.h',
-            'icu/unicode/ucnv_err.h',
-            'icu/unicode/ucol.h',
-            'icu/unicode/ucoleitr.h',
-            'icu/unicode/uconfig.h',
-            'icu/unicode/ucsdet.h',
-            'icu/unicode/uenum.h',
-            'icu/unicode/uidna.h',
-            'icu/unicode/uiter.h',
-            'icu/unicode/uloc.h',
-            'icu/unicode/umachine.h',
-            'icu/unicode/unorm.h',
-            'icu/unicode/urename.h',
-            'icu/unicode/uscript.h',
-            'icu/unicode/usearch.h',
-            'icu/unicode/uset.h',
-            'icu/unicode/ushape.h',
-            'icu/unicode/ustring.h',
-            'icu/unicode/utf.h',
-            'icu/unicode/utf16.h',
-            'icu/unicode/utf8.h',
-            'icu/unicode/utf_old.h',
-            'icu/unicode/utypes.h',
-            'icu/unicode/uversion.h',
             'inspector/BindingVisitors.h',
             'inspector/ConsoleAPITypes.h',
             'inspector/ConsoleMessage.cpp',
@@ -1048,7 +1036,7 @@
             'loader/EmptyClients.h',
             'loader/FormState.cpp',
             'loader/FormSubmission.cpp',
-            'loader/FrameLoadRequest.cpp',
+            'loader/FrameLoadRequest.h',
             'loader/FrameLoader.cpp',
             'loader/FrameLoaderStateMachine.cpp',
             'loader/HistoryController.cpp',
@@ -1117,7 +1105,6 @@
             'loader/cache/CachedResourceLoader.cpp',
             'loader/cache/CachedResourceRequest.cpp',
             'loader/cache/CachedResourceInitiatorInfo.h',
-            'loader/cache/CachedResourceRequestInitiators.cpp',
             'loader/cache/CachedScript.cpp',
             'loader/cache/CachedScript.h',
             'loader/cache/CachedShader.cpp',
@@ -1137,6 +1124,8 @@
             'page/ContentSecurityPolicy.cpp',
             'page/ContextMenuController.cpp',
             'page/ContextMenuProvider.h',
+            'page/CreateWindow.cpp',
+            'page/CreateWindow.h',
             'page/DeviceClient.h',
             'page/DeviceController.cpp',
             'page/DeviceController.h',
@@ -1167,6 +1156,10 @@
             'page/FrameView.cpp',
             'page/History.cpp',
             'page/History.h',
+            'page/ImageBitmap.cpp',
+            'page/ImageBitmap.h',
+            'page/ImageBitmapCallback.cpp',
+            'page/ImageBitmapCallback.h',
             'page/LayoutMilestones.h',
             'page/Location.cpp',
             'page/Location.h',
@@ -1302,6 +1295,8 @@
             'rendering/OrderIterator.cpp',
             'rendering/OrderIterator.h',
             'rendering/LayoutRepainter.cpp',
+            'rendering/Pagination.cpp',
+            'rendering/Pagination.h',
             'rendering/PointerEventsHitRules.cpp',
             'rendering/PointerEventsHitRules.h',
             'rendering/RenderApplet.cpp',
@@ -1492,6 +1487,7 @@
             'rendering/shapes/ShapeOutsideInfo.cpp',
             'rendering/shapes/ShapeOutsideInfo.h',
             'rendering/style/BasicShapes.cpp',
+            'rendering/style/CachedUAStyle.h',
             'rendering/style/ContentData.cpp',
             'rendering/style/CounterDirectives.cpp',
             'rendering/style/FillLayer.cpp',
@@ -1502,6 +1498,7 @@
             'rendering/style/QuotesData.cpp',
             'rendering/style/QuotesData.h',
             'rendering/style/RenderStyle.cpp',
+            'rendering/style/RenderStyle.h',
             'rendering/style/ShadowData.cpp',
             'rendering/style/StyleBackgroundData.cpp',
             'rendering/style/StyleBoxData.cpp',
@@ -1619,6 +1616,8 @@
             'xml/parser/XMLDocumentParserScope.cpp',
             'xml/parser/XMLDocumentParserScope.h',
             'xml/parser/XMLParserInput.h',
+            'xml/DocumentXPathEvaluator.cpp',
+            'xml/DocumentXPathEvaluator.h',
             'xml/DOMParser.cpp',
             'xml/DOMParser.h',
             'xml/NativeXPathNSResolver.cpp',
@@ -1718,11 +1717,19 @@
             'dom/ContextLifecycleNotifier.cpp',
             'dom/ContextLifecycleNotifier.h',
             'dom/CrossThreadTask.h',
-            'dom/CustomElementDefinition.cpp',
-            'dom/CustomElementDefinition.h',
-            'dom/CustomElementCallback.h',
             'dom/CustomElementCallbackDispatcher.cpp',
             'dom/CustomElementCallbackDispatcher.h',
+            'dom/CustomElementCallbackInvocation.cpp',
+            'dom/CustomElementCallbackInvocation.h',
+            'dom/CustomElementCallbackQueue.cpp',
+            'dom/CustomElementCallbackQueue.h',
+            'dom/CustomElementDefinition.cpp',
+            'dom/CustomElementDefinition.h',
+            'dom/CustomElementDescriptor.h',
+            'dom/CustomElementDescriptorHash.h',
+            'dom/CustomElementLifecycleCallbacks.h',
+            'dom/CustomElementRegistrationContext.cpp',
+            'dom/CustomElementRegistrationContext.h',
             'dom/CustomElementRegistry.cpp',
             'dom/CustomElementRegistry.h',
             'dom/CustomElementUpgradeCandidateMap.cpp',
@@ -1758,6 +1765,8 @@
             'dom/DocumentFragment.cpp',
             'dom/DocumentFullscreen.cpp',
             'dom/DocumentFullscreen.h',
+            'dom/DocumentInit.cpp',
+            'dom/DocumentInit.h',
             'dom/DocumentLifecycleObserver.cpp',
             'dom/DocumentLifecycleObserver.h',
             'dom/DocumentMarkerController.cpp',
@@ -1768,6 +1777,7 @@
             'dom/DocumentParser.cpp',
             'dom/DocumentSharedObjectPool.cpp',
             'dom/DocumentStyleSheetCollection.cpp',
+            'dom/DocumentStyleSheetCollection.h',
             'dom/DocumentType.cpp',
             'dom/Element.cpp',
             'dom/ElementRareData.cpp',
@@ -1886,9 +1896,9 @@
             'dom/ResourceProgressEvent.h',
             'dom/ScopedEventQueue.cpp',
             'dom/ScopedEventQueue.h',
-            'dom/ScriptElement.cpp',
-            'dom/ScriptElement.h',
             'dom/ScriptExecutionContext.cpp',
+            'dom/ScriptLoader.cpp',
+            'dom/ScriptLoader.h',
             'dom/ScriptRunner.cpp',
             'dom/ScriptableDocumentParser.cpp',
             'dom/ScriptableDocumentParser.h',
@@ -1907,11 +1917,15 @@
             'dom/StringCallback.h',
             'dom/StyleElement.cpp',
             'dom/StyleElement.h',
+            'dom/StyleSheetCollection.cpp',
+            'dom/StyleSheetCollection.h',
             'dom/TagNodeList.cpp',
             'dom/TagNodeList.h',
             'dom/Text.cpp',
             'dom/TextEvent.cpp',
             'dom/TextEvent.h',
+            'dom/TextLinkColors.cpp',
+            'dom/TextLinkColors.h',
             'dom/Touch.cpp',
             'dom/Touch.h',
             'dom/TouchEvent.cpp',
@@ -2040,6 +2054,8 @@
             'html/HTMLDetailsElement.h',
             'html/HTMLDialogElement.cpp',
             'html/HTMLDialogElement.h',
+            'html/HTMLDimension.cpp',
+            'html/HTMLDimension.h',
             'html/HTMLDirectoryElement.cpp',
             'html/HTMLDirectoryElement.h',
             'html/HTMLDivElement.cpp',
@@ -2074,6 +2090,8 @@
             'html/HTMLImageElement.h',
             'html/HTMLImageLoader.cpp',
             'html/HTMLImageLoader.h',
+            'html/HTMLImport.cpp',
+            'html/HTMLImport.h',
             'html/HTMLImportsController.cpp',
             'html/HTMLImportsController.h',
             'html/HTMLInputElement.cpp',
@@ -2196,6 +2214,8 @@
             'html/MediaKeyError.h',
             'html/MediaKeyEvent.cpp',
             'html/MediaKeyEvent.h',
+            'html/HTMLMediaSource.cpp',
+            'html/HTMLMediaSource.h',
             'html/MonthInputType.cpp',
             'html/MonthInputType.h',
             'html/NumberInputType.cpp',
@@ -2430,6 +2450,8 @@
             'html/shadow/MediaControlsChromiumAndroid.h',
             'html/shadow/MeterShadowElement.cpp',
             'html/shadow/MeterShadowElement.h',
+            'html/shadow/PasswordGeneratorButtonElement.cpp',
+            'html/shadow/PasswordGeneratorButtonElement.h',
             'html/shadow/ProgressShadowElement.cpp',
             'html/shadow/ProgressShadowElement.h',
             'html/shadow/ShadowElementNames.cpp',
@@ -2440,8 +2462,6 @@
             'html/shadow/SpinButtonElement.h',
             'html/shadow/TextControlInnerElements.cpp',
             'html/shadow/TextControlInnerElements.h',
-            'html/shadow/TextFieldDecorationElement.cpp',
-            'html/shadow/TextFieldDecorationElement.h',
             'html/ime/Composition.cpp',
             'html/ime/Composition.h',
             'html/ime/InputMethodContext.cpp',
@@ -2909,6 +2929,8 @@
             'platform/graphics/filters/LightSource.h',
             'platform/graphics/filters/PointLightSource.cpp',
             'platform/graphics/filters/PointLightSource.h',
+            'platform/graphics/filters/ReferenceFilter.cpp',
+            'platform/graphics/filters/ReferenceFilter.h',
             'platform/graphics/filters/SkiaImageFilterBuilder.cpp',
             'platform/graphics/filters/SkiaImageFilterBuilder.h',
             'platform/graphics/filters/SourceAlpha.cpp',
@@ -3058,7 +3080,6 @@
             'platform/midi/MIDIAccessor.h',
             'platform/midi/MIDIAccessor.cpp',
             'platform/midi/MIDIAccessorClient.h',
-            'platform/mock/DeviceMotionClientMock.cpp',
             'platform/mock/DeviceOrientationClientMock.cpp',
             'platform/mock/GeolocationClientMock.cpp',
             'platform/mock/PlatformSpeechSynthesizerMock.cpp',
@@ -3167,6 +3188,8 @@
         'webcore_svg_files': [
             'rendering/style/SVGRenderStyle.cpp',
             'rendering/style/SVGRenderStyleDefs.cpp',
+            'rendering/svg/ReferenceFilterBuilder.cpp',
+            'rendering/svg/ReferenceFilterBuilder.h',
             'rendering/svg/RenderSVGBlock.cpp',
             'rendering/svg/RenderSVGBlock.h',
             'rendering/svg/RenderSVGContainer.cpp',
@@ -3307,6 +3330,8 @@
             'svg/SVGAnimatedString.cpp',
             'svg/SVGAnimatedTransformList.cpp',
             'svg/SVGAnimatedType.cpp',
+            'svg/SVGAnimatedTypeAnimator.cpp',
+            'svg/SVGAnimatedTypeAnimator.h',
             'svg/SVGAnimateElement.cpp',
             'svg/SVGAnimateElement.h',
             'svg/SVGAnimateMotionElement.cpp',
@@ -3473,21 +3498,36 @@
             'svg/SVGPathParser.h',
             'svg/SVGPathSeg.h',
             'svg/SVGPathSegArc.h',
+            'svg/SVGPathSegArcAbs.h',
+            'svg/SVGPathSegArcRel.h',
             'svg/SVGPathSegClosePath.h',
             'svg/SVGPathSegCurvetoCubic.h',
+            'svg/SVGPathSegCurvetoCubicAbs.h',
+            'svg/SVGPathSegCurvetoCubicRel.h',
             'svg/SVGPathSegCurvetoCubicSmooth.h',
+            'svg/SVGPathSegCurvetoCubicSmoothAbs.h',
+            'svg/SVGPathSegCurvetoCubicSmoothRel.h',
             'svg/SVGPathSegCurvetoQuadratic.h',
-            'svg/SVGPathSegCurvetoQuadraticSmooth.h',
-            'svg/SVGPathSegLineto.h',
+            'svg/SVGPathSegCurvetoQuadraticAbs.h',
+            'svg/SVGPathSegCurvetoQuadraticRel.h',
+            'svg/SVGPathSegCurvetoQuadraticSmoothAbs.h',
+            'svg/SVGPathSegCurvetoQuadraticSmoothRel.h',
+            'svg/SVGPathSegLinetoAbs.h',
+            'svg/SVGPathSegLinetoRel.h',
             'svg/SVGPathSegLinetoHorizontal.h',
+            'svg/SVGPathSegLinetoHorizontalAbs.h',
+            'svg/SVGPathSegLinetoHorizontalRel.h',
             'svg/SVGPathSegLinetoVertical.h',
+            'svg/SVGPathSegLinetoVerticalAbs.h',
+            'svg/SVGPathSegLinetoVerticalRel.h',
             'svg/SVGPathSegList.cpp',
             'svg/SVGPathSegList.h',
             'svg/SVGPathSegListBuilder.cpp',
             'svg/SVGPathSegListBuilder.h',
             'svg/SVGPathSegListSource.cpp',
             'svg/SVGPathSegListSource.h',
-            'svg/SVGPathSegMoveto.h',
+            'svg/SVGPathSegMovetoAbs.h',
+            'svg/SVGPathSegMovetoRel.h',
             'svg/SVGPathSegWithContext.h',
             'svg/SVGPathSource.h',
             'svg/SVGPathStringBuilder.cpp',
@@ -3500,6 +3540,7 @@
             'svg/SVGPathUtilities.h',
             'svg/SVGPatternElement.cpp',
             'svg/SVGPatternElement.h',
+            'svg/SVGPoint.h',
             'svg/SVGPointList.cpp',
             'svg/SVGPointList.h',
             'svg/SVGPolyElement.cpp',
@@ -3587,18 +3628,23 @@
             'svg/graphics/filters/SVGFilter.h',
             'svg/graphics/filters/SVGFilterBuilder.cpp',
             'svg/graphics/filters/SVGFilterBuilder.h',
+            'svg/properties/SVGAnimatedProperty.cpp',
+            'svg/properties/SVGAnimatedProperty.h',
             'svg/properties/SVGAttributeToPropertyMap.cpp',
             'svg/properties/SVGAnimatedPathSegListPropertyTearOff.h',
             'svg/properties/SVGPathSegListPropertyTearOff.cpp',
         ],
-        'webcore_test_support_idl_files': [
+        'deprecated_perl_webcore_test_support_idl_files': [
           'testing/Internals.idl',
+          'testing/InternalProfilers.idl',
           'testing/InternalSettings.idl',
           'testing/MallocStatistics.idl',
           'testing/TypeConversions.idl',
           '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalSettingsGenerated.idl',
           '<(SHARED_INTERMEDIATE_DIR)/webkit/InternalRuntimeFlags.idl',
         ],
+        'python_webcore_test_support_idl_files': [
+        ],
         'webcore_test_support_files': [
             'testing/v8/WebCoreTestSupport.cpp',
             'testing/v8/WebCoreTestSupport.h',
@@ -3606,6 +3652,8 @@
             'testing/InspectorFrontendClientLocal.h',
             'testing/Internals.cpp',
             'testing/Internals.h',
+            'testing/InternalProfilers.cpp',
+            'testing/InternalProfilers.h',
             'testing/InternalSettings.cpp',
             'testing/InternalSettings.h',
             'testing/MallocStatistics.h',
@@ -3621,6 +3669,7 @@
             'platform/chromium/support/WebActiveGestureAnimation.h',
             'platform/chromium/support/WebAudioBus.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',
@@ -3664,28 +3713,39 @@
             'platform/chromium/support/WrappedResourceResponse.h',
         ],
         'core_unittest_files': [
+            'animation/AnimatableNeutralTest.cpp',
+            'animation/AnimatableNumberTest.cpp',
+            'animation/AnimatableUnknownTest.cpp',
             'animation/DocumentTimelineTest.cpp',
+            'animation/KeyframeAnimationEffectTest.cpp',
             'animation/PlayerTest.cpp',
             'animation/TimedItemCalculationsTest.cpp',
             'animation/TimedItemTest.cpp',
+            'html/TimeRangesTest.cpp',
             'loader/cache/CachedImageTest.cpp',
             'loader/cache/MemoryCacheTest.cpp',
             'platform/DecimalTest.cpp',
             'platform/SharedBufferTest.cpp',
             'platform/chromium/ClipboardChromiumTest.cpp',
+            'platform/graphics/FontTest.cpp',
             'platform/graphics/UnitBezierTest.cpp',
             'platform/graphics/chromium/AnimationTranslationUtilTest.cpp',
+            'platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp',
+            'platform/graphics/chromium/Canvas2DLayerManagerTest.cpp',
             'platform/graphics/chromium/DeferredImageDecoderTest.cpp',
             'platform/graphics/chromium/ImageDecodingStoreTest.cpp',
             'platform/graphics/chromium/ImageFrameGeneratorTest.cpp',
             'platform/graphics/chromium/ThreadSafeDataTransportTest.cpp',
             'platform/graphics/chromium/test/MockDiscardablePixelRef.h',
             'platform/graphics/chromium/test/MockImageDecoder.h',
+            'platform/graphics/gpu/DrawingBufferTest.cpp',
             'platform/image-decoders/ImageDecoderTest.cpp',
             'platform/image-decoders/gif/GIFImageDecoderTest.cpp',
             'platform/image-decoders/webp/WEBPImageDecoderTest.cpp',
             'platform/text/DateTimeFormatTest.cpp',
+            'tests/FakeWebGraphicsContext3D.h',
             'tests/HeapGraphSerializerTest.cpp',
+            'tests/HTMLDimension.cpp',
             'tests/LayoutUnit.cpp',
             'tests/LinkRelAttribute.cpp',
         ],
diff --git a/Source/core/core_derived_sources.gyp b/Source/core/core_derived_sources.gyp
index 8265a95..2883904 100644
--- a/Source/core/core_derived_sources.gyp
+++ b/Source/core/core_derived_sources.gyp
@@ -431,8 +431,7 @@
               'css/svg.css',
               'css/mathml.css',
               'css/mediaControls.css',
-              'css/mediaControlsChromium.css',
-              'css/mediaControlsChromiumAndroid.css',
+              'css/mediaControlsAndroid.css',
               'css/fullscreen.css',
             ],
           },
@@ -457,6 +456,29 @@
           'msvs_cygwin_shell': 1,
         },
         {
+          'action_name': 'CachedResourceInitiatorTypeNames',
+          'inputs': [
+            'scripts/Hasher.pm',
+            'scripts/StaticString.pm',
+            'scripts/make_names.pl',
+            'loader/cache/CachedResourceInitiatorTypeNames.in',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/CachedResourceInitiatorTypeNames.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/CachedResourceInitiatorTypeNames.h',
+          ],
+          'action': [
+            'python',
+            'scripts/action_makenames.py',
+            '<@(_outputs)',
+            '--',
+            '<@(_inputs)',
+            '--',
+            '--resourceTypes',
+          ],
+          'msvs_cygwin_shell': 1,
+        },
+        {
           'action_name': 'PickerCommon',
           'inputs': [
             'Resources/pagepopups/pickerCommon.css',
@@ -606,6 +628,23 @@
             '<@(_inputs)',
           ],
         },
+        {
+          'action_name': 'MakeTokenMatcher',
+          'inputs': [
+            '<@(scripts_for_in_files)',
+            '../core/scripts/make_token_matcher.py',
+            '../core/css/CSSParser-in.cpp',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSParser.cpp',
+          ],
+          'action': [
+            'python',
+            '../core/scripts/make_token_matcher.py',
+            '../core/css/CSSParser-in.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSParser.cpp',
+          ],
+        },
       ],
       'rules': [
         {
diff --git a/Source/core/css/BasicShapeFunctions.cpp b/Source/core/css/BasicShapeFunctions.cpp
index fe53cd0..7bfd7ad 100644
--- a/Source/core/css/BasicShapeFunctions.cpp
+++ b/Source/core/css/BasicShapeFunctions.cpp
@@ -33,7 +33,7 @@
 #include "core/css/CSSBasicShapes.h"
 #include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/css/CSSValuePool.h"
-#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/StyleResolverState.h"
 #include "core/rendering/style/BasicShapes.h"
 
 namespace WebCore {
@@ -50,11 +50,8 @@
         rectangleValue->setY(cssValuePool().createValue(rectangle->y()));
         rectangleValue->setWidth(cssValuePool().createValue(rectangle->width()));
         rectangleValue->setHeight(cssValuePool().createValue(rectangle->height()));
-        if (!rectangle->cornerRadiusX().isUndefined()) {
-            rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
-            if (!rectangle->cornerRadiusY().isUndefined())
-                rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
-        }
+        rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
+        rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
 
         basicShapeValue = rectangleValue.release();
         break;
@@ -102,11 +99,8 @@
         rectangleValue->setRight(cssValuePool().createValue(rectangle->right()));
         rectangleValue->setBottom(cssValuePool().createValue(rectangle->bottom()));
         rectangleValue->setLeft(cssValuePool().createValue(rectangle->left()));
-        if (!rectangle->cornerRadiusX().isUndefined()) {
-            rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
-            if (!rectangle->cornerRadiusY().isUndefined())
-                rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
-        }
+        rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
+        rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
 
         basicShapeValue = rectangleValue.release();
         break;
@@ -117,12 +111,12 @@
     return cssValuePool().createValue<PassRefPtr<CSSBasicShape> >(basicShapeValue.release());
 }
 
-static Length convertToLength(const StyleResolver* styleResolver, CSSPrimitiveValue* value)
+static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue* value)
 {
-    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+    return value->convertToLength<FixedIntegerConversion | FixedFloatConversion | PercentConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
 }
 
-PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver* styleResolver, const CSSBasicShape* basicShapeValue)
+PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, const CSSBasicShape* basicShapeValue)
 {
     RefPtr<BasicShape> basicShape;
 
@@ -131,14 +125,20 @@
         const CSSBasicShapeRectangle* rectValue = static_cast<const CSSBasicShapeRectangle *>(basicShapeValue);
         RefPtr<BasicShapeRectangle> rect = BasicShapeRectangle::create();
 
-        rect->setX(convertToLength(styleResolver, rectValue->x()));
-        rect->setY(convertToLength(styleResolver, rectValue->y()));
-        rect->setWidth(convertToLength(styleResolver, rectValue->width()));
-        rect->setHeight(convertToLength(styleResolver, rectValue->height()));
+        rect->setX(convertToLength(state, rectValue->x()));
+        rect->setY(convertToLength(state, rectValue->y()));
+        rect->setWidth(convertToLength(state, rectValue->width()));
+        rect->setHeight(convertToLength(state, rectValue->height()));
         if (rectValue->radiusX()) {
-            rect->setCornerRadiusX(convertToLength(styleResolver, rectValue->radiusX()));
+            Length radiusX = convertToLength(state, rectValue->radiusX());
+            rect->setCornerRadiusX(radiusX);
             if (rectValue->radiusY())
-                rect->setCornerRadiusY(convertToLength(styleResolver, rectValue->radiusY()));
+                rect->setCornerRadiusY(convertToLength(state, rectValue->radiusY()));
+            else
+                rect->setCornerRadiusY(radiusX);
+        } else {
+            rect->setCornerRadiusX(Length(0, Fixed));
+            rect->setCornerRadiusY(Length(0, Fixed));
         }
         basicShape = rect.release();
         break;
@@ -147,9 +147,9 @@
         const CSSBasicShapeCircle* circleValue = static_cast<const CSSBasicShapeCircle *>(basicShapeValue);
         RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create();
 
-        circle->setCenterX(convertToLength(styleResolver, circleValue->centerX()));
-        circle->setCenterY(convertToLength(styleResolver, circleValue->centerY()));
-        circle->setRadius(convertToLength(styleResolver, circleValue->radius()));
+        circle->setCenterX(convertToLength(state, circleValue->centerX()));
+        circle->setCenterY(convertToLength(state, circleValue->centerY()));
+        circle->setRadius(convertToLength(state, circleValue->radius()));
 
         basicShape = circle.release();
         break;
@@ -158,10 +158,10 @@
         const CSSBasicShapeEllipse* ellipseValue = static_cast<const CSSBasicShapeEllipse *>(basicShapeValue);
         RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create();
 
-        ellipse->setCenterX(convertToLength(styleResolver, ellipseValue->centerX()));
-        ellipse->setCenterY(convertToLength(styleResolver, ellipseValue->centerY()));
-        ellipse->setRadiusX(convertToLength(styleResolver, ellipseValue->radiusX()));
-        ellipse->setRadiusY(convertToLength(styleResolver, ellipseValue->radiusY()));
+        ellipse->setCenterX(convertToLength(state, ellipseValue->centerX()));
+        ellipse->setCenterY(convertToLength(state, ellipseValue->centerY()));
+        ellipse->setRadiusX(convertToLength(state, ellipseValue->radiusX()));
+        ellipse->setRadiusY(convertToLength(state, ellipseValue->radiusY()));
 
         basicShape = ellipse.release();
         break;
@@ -173,7 +173,7 @@
         polygon->setWindRule(polygonValue->windRule());
         const Vector<RefPtr<CSSPrimitiveValue> >& values = polygonValue->values();
         for (unsigned i = 0; i < values.size(); i += 2)
-            polygon->appendPoint(convertToLength(styleResolver, values.at(i).get()), convertToLength(styleResolver, values.at(i + 1).get()));
+            polygon->appendPoint(convertToLength(state, values.at(i).get()), convertToLength(state, values.at(i + 1).get()));
 
         basicShape = polygon.release();
         break;
@@ -182,14 +182,20 @@
         const CSSBasicShapeInsetRectangle* rectValue = static_cast<const CSSBasicShapeInsetRectangle *>(basicShapeValue);
         RefPtr<BasicShapeInsetRectangle> rect = BasicShapeInsetRectangle::create();
 
-        rect->setTop(convertToLength(styleResolver, rectValue->top()));
-        rect->setRight(convertToLength(styleResolver, rectValue->right()));
-        rect->setBottom(convertToLength(styleResolver, rectValue->bottom()));
-        rect->setLeft(convertToLength(styleResolver, rectValue->left()));
+        rect->setTop(convertToLength(state, rectValue->top()));
+        rect->setRight(convertToLength(state, rectValue->right()));
+        rect->setBottom(convertToLength(state, rectValue->bottom()));
+        rect->setLeft(convertToLength(state, rectValue->left()));
         if (rectValue->radiusX()) {
-            rect->setCornerRadiusX(convertToLength(styleResolver, rectValue->radiusX()));
+            Length radiusX = convertToLength(state, rectValue->radiusX());
+            rect->setCornerRadiusX(radiusX);
             if (rectValue->radiusY())
-                rect->setCornerRadiusY(convertToLength(styleResolver, rectValue->radiusY()));
+                rect->setCornerRadiusY(convertToLength(state, rectValue->radiusY()));
+            else
+                rect->setCornerRadiusY(radiusX);
+        } else {
+            rect->setCornerRadiusX(Length(0, Fixed));
+            rect->setCornerRadiusY(Length(0, Fixed));
         }
         basicShape = rect.release();
         break;
diff --git a/Source/core/css/BasicShapeFunctions.h b/Source/core/css/BasicShapeFunctions.h
index d3607e9..4b3d39f 100644
--- a/Source/core/css/BasicShapeFunctions.h
+++ b/Source/core/css/BasicShapeFunctions.h
@@ -30,17 +30,17 @@
 #ifndef BasicShapeFunctions_h
 #define BasicShapeFunctions_h
 
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
 class BasicShape;
 class CSSBasicShape;
 class CSSValue;
-class StyleResolver;
+class StyleResolverState;
 
 PassRefPtr<CSSValue> valueForBasicShape(const BasicShape*);
-PassRefPtr<BasicShape> basicShapeForValue(const StyleResolver*, const CSSBasicShape*);
+PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState&, const CSSBasicShape*);
 
 }
 #endif
diff --git a/Source/core/css/CSSBasicShapes.cpp b/Source/core/css/CSSBasicShapes.cpp
index 1505149..f02c43a 100644
--- a/Source/core/css/CSSBasicShapes.cpp
+++ b/Source/core/css/CSSBasicShapes.cpp
@@ -28,10 +28,9 @@
  */
 
 #include "config.h"
-
 #include "core/css/CSSBasicShapes.h"
 
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 using namespace WTF;
 
diff --git a/Source/core/css/CSSBasicShapes.h b/Source/core/css/CSSBasicShapes.h
index e099e19..e739ab0 100644
--- a/Source/core/css/CSSBasicShapes.h
+++ b/Source/core/css/CSSBasicShapes.h
@@ -32,9 +32,9 @@
 
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/platform/graphics/WindRule.h"
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSBorderImageSliceValue.cpp b/Source/core/css/CSSBorderImageSliceValue.cpp
index 0c4eed0..bcebb8d 100644
--- a/Source/core/css/CSSBorderImageSliceValue.cpp
+++ b/Source/core/css/CSSBorderImageSliceValue.cpp
@@ -27,7 +27,7 @@
 #include "core/css/CSSBorderImageSliceValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSBorderImageSliceValue.h b/Source/core/css/CSSBorderImageSliceValue.h
index fdc7f8e..758b934 100644
--- a/Source/core/css/CSSBorderImageSliceValue.h
+++ b/Source/core/css/CSSBorderImageSliceValue.h
@@ -27,8 +27,8 @@
 #define CSSBorderImageSliceValue_h
 
 #include "core/css/CSSPrimitiveValue.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSCalculationValue.cpp b/Source/core/css/CSSCalculationValue.cpp
index 8f3c243..7a367f6 100644
--- a/Source/core/css/CSSCalculationValue.cpp
+++ b/Source/core/css/CSSCalculationValue.cpp
@@ -31,12 +31,12 @@
 #include "config.h"
 #include "core/css/CSSCalculationValue.h"
 
+#include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringBuilder.h"
 
 static const int maxExpressionDepth = 100;
 
@@ -197,7 +197,7 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
 
-    static PassRefPtr<CSSCalcPrimitiveValue> create(CSSPrimitiveValue* value, bool isInteger)
+    static PassRefPtr<CSSCalcPrimitiveValue> create(PassRefPtr<CSSPrimitiveValue> value, bool isInteger)
     {
         return adoptRef(new CSSCalcPrimitiveValue(value, isInteger));
     }
@@ -237,8 +237,12 @@
         case CalcLength:
             return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));
         case CalcPercent:
-        case CalcPercentLength:
-            return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, zoom)));
+        case CalcPercentLength: {
+            CSSPrimitiveValue* primitiveValue = m_value.get();
+            return adoptPtr(new CalcExpressionLength(primitiveValue
+                ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, zoom)
+                : Length(Undefined)));
+        }
         // Only types that could be part of a Length expression can be converted
         // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length.
         case CalcPercentNumber:
@@ -297,7 +301,7 @@
     }
 
 private:
-    explicit CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger)
+    explicit CSSCalcPrimitiveValue(PassRefPtr<CSSPrimitiveValue> value, bool isInteger)
         : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value->primitiveType()), isInteger)
         , m_value(value)
     {
@@ -711,6 +715,16 @@
     }
 };
 
+PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(PassRefPtr<CSSPrimitiveValue> value, bool isInteger)
+{
+    return CSSCalcPrimitiveValue::create(value, isInteger);
+}
+
+PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(PassRefPtr<CSSCalcExpressionNode> leftSide, PassRefPtr<CSSCalcExpressionNode> rightSide, CalcOperator op)
+{
+    return CSSCalcBinaryOperation::create(leftSide, rightSide, op);
+}
+
 PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserValueList* parserValueList, CalculationPermittedValueRange range)
 {    
     CSSCalcExpressionNodeParser parser;    
@@ -723,4 +737,9 @@
     return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0;
 }
 
+PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode> expression, CalculationPermittedValueRange range)
+{
+    return adoptRef(new CSSCalcValue(expression, range));
+}
+
 } // namespace WebCore
diff --git a/Source/core/css/CSSCalculationValue.h b/Source/core/css/CSSCalculationValue.h
index 82f91fe..2968a2d 100644
--- a/Source/core/css/CSSCalculationValue.h
+++ b/Source/core/css/CSSCalculationValue.h
@@ -35,9 +35,9 @@
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValue.h"
 #include "core/platform/CalculationValue.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
@@ -94,7 +94,10 @@
 class CSSCalcValue : public CSSValue {
 public:
     static PassRefPtr<CSSCalcValue> create(CSSParserString name, CSSParserValueList*, CalculationPermittedValueRange);
-    static PassRefPtr<CSSCalcValue> create(CalculationValue*);
+    static PassRefPtr<CSSCalcValue> create(PassRefPtr<CSSCalcExpressionNode>, CalculationPermittedValueRange = CalculationRangeAll);
+
+    static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(PassRefPtr<CSSPrimitiveValue>, bool isInteger = false);
+    static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(PassRefPtr<CSSCalcExpressionNode>, PassRefPtr<CSSCalcExpressionNode>, CalcOperator);
 
     PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom = 1.0) const
     {
@@ -105,7 +108,8 @@
     double doubleValue() const;
     bool isNegative() const { return m_expression->doubleValue() < 0; }
     double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;
-        
+    CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); }
+
     String customCssText() const;
     bool equals(const CSSCalcValue&) const;
     String customSerializeResolvingVariables(const HashMap<AtomicString, String>&) const;
@@ -126,7 +130,20 @@
     const RefPtr<CSSCalcExpressionNode> m_expression;
     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);
+}
+
 } // namespace WebCore
 
+
 #endif // CSSCalculationValue_h
diff --git a/Source/core/css/CSSCanvasValue.cpp b/Source/core/css/CSSCanvasValue.cpp
index cf9cc51..842afaa 100644
--- a/Source/core/css/CSSCanvasValue.cpp
+++ b/Source/core/css/CSSCanvasValue.cpp
@@ -28,7 +28,7 @@
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/rendering/RenderObject.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index a5fb17f..a0e8c8c 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -26,6 +26,7 @@
 
 #include "CSSPropertyNames.h"
 #include "FontFamilyNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include "core/css/BasicShapeFunctions.h"
 #include "core/css/CSSArrayFunctionValue.h"
 #include "core/css/CSSAspectRatioValue.h"
@@ -170,12 +171,12 @@
     CSSPropertyTableLayout,
     CSSPropertyTabSize,
     CSSPropertyTextAlign,
+    CSSPropertyTextAlignLast,
     CSSPropertyTextDecoration,
     CSSPropertyTextDecorationLine,
     CSSPropertyTextDecorationStyle,
     CSSPropertyTextDecorationColor,
 #if ENABLE(CSS3_TEXT)
-    CSSPropertyWebkitTextAlignLast,
     CSSPropertyWebkitTextUnderlinePosition,
 #endif // CSS3_TEXT
     CSSPropertyTextIndent,
@@ -910,8 +911,8 @@
             DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
             filterValue = CSSFilterValue::create(CSSFilterValue::DropShadowFilterOperation);
             // We want our computed style to look like that of a text shadow (has neither spread nor inset style).
-            ShadowData shadowData = ShadowData(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, dropShadowOperation->color());
-            filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShadow, style));
+            OwnPtr<ShadowData> shadow = ShadowData::create(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, dropShadowOperation->color());
+            filterValue->append(valueForShadow(shadow.get(), CSSPropertyTextShadow, style));
             break;
         }
         case FilterOperation::VALIDATED_CUSTOM:
@@ -1217,7 +1218,7 @@
 
 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
@@ -1534,7 +1535,7 @@
     Node* styledNode = this->styledNode();
     ASSERT(styledNode);
     RenderObject* renderer = styledNode->renderer();
-    if (renderer && renderer->isComposited() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
+    if (renderer && renderer->isComposited() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID) && !RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
         AnimationUpdateBlock animationUpdateBlock(renderer->animation());
         if (m_pseudoElementSpecifier && !styledNode->isPseudoElement()) {
             // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
@@ -2160,6 +2161,8 @@
             return cssValuePool().createValue(style->tableLayout());
         case CSSPropertyTextAlign:
             return cssValuePool().createValue(style->textAlign());
+        case CSSPropertyTextAlignLast:
+            return cssValuePool().createValue(style->textAlignLast());
         case CSSPropertyTextDecoration:
         case CSSPropertyTextDecorationLine:
             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
@@ -2168,8 +2171,6 @@
         case CSSPropertyTextDecorationColor:
             return currentColorOrValidColor(style.get(), style->textDecorationColor());
 #if ENABLE(CSS3_TEXT)
-        case CSSPropertyWebkitTextAlignLast:
-            return cssValuePool().createValue(style->textAlignLast());
         case CSSPropertyWebkitTextUnderlinePosition:
             return cssValuePool().createValue(style->textUnderlinePosition());
 #endif // CSS3_TEXT
@@ -2985,12 +2986,12 @@
 
 void CSSComputedStyleDeclaration::setProperty(const String&, const String&, const String&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 String CSSComputedStyleDeclaration::removeProperty(const String&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
     return String();
 }
     
@@ -3006,7 +3007,7 @@
 
 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValue() const
diff --git a/Source/core/css/CSSComputedStyleDeclaration.h b/Source/core/css/CSSComputedStyleDeclaration.h
index e628cd8..b0f6cc8 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.h
+++ b/Source/core/css/CSSComputedStyleDeclaration.h
@@ -23,8 +23,8 @@
 
 #include "core/css/CSSStyleDeclaration.h"
 #include "core/rendering/style/RenderStyleConstants.h"
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSCrossfadeValue.cpp b/Source/core/css/CSSCrossfadeValue.cpp
index d0321c0..77e4588 100644
--- a/Source/core/css/CSSCrossfadeValue.cpp
+++ b/Source/core/css/CSSCrossfadeValue.cpp
@@ -32,7 +32,7 @@
 #include "core/platform/graphics/CrossfadeGeneratedImage.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/style/StyleCachedImage.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSCursorImageValue.cpp b/Source/core/css/CSSCursorImageValue.cpp
index a9f27c2..032971a 100644
--- a/Source/core/css/CSSCursorImageValue.cpp
+++ b/Source/core/css/CSSCursorImageValue.cpp
@@ -102,13 +102,13 @@
         // FIXME: This will override hot spot specified in CSS, which is probably incorrect.
         SVGLengthContext lengthContext(0);
         m_hasHotSpot = true;
-        float x = roundf(cursorElement->x().value(lengthContext));
+        float x = roundf(cursorElement->xCurrentValue().value(lengthContext));
         m_hotSpot.setX(static_cast<int>(x));
 
-        float y = roundf(cursorElement->y().value(lengthContext));
+        float y = roundf(cursorElement->yCurrentValue().value(lengthContext));
         m_hotSpot.setY(static_cast<int>(y));
 
-        if (cachedImageURL() != element->document()->completeURL(cursorElement->href()))
+        if (cachedImageURL() != element->document()->completeURL(cursorElement->hrefCurrentValue()))
             clearCachedImage();
 
         SVGElement* svgElement = toSVGElement(element);
@@ -136,7 +136,7 @@
             RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get());
             // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
             if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(imageValue->url(), loader->document())) {
-                RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(cursorElement->href());
+                RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(cursorElement->hrefCurrentValue());
                 StyleCachedImage* cachedImage = svgImageValue->cachedImage(loader);
                 m_image = cachedImage;
                 return cachedImage;
diff --git a/Source/core/css/CSSCursorImageValue.h b/Source/core/css/CSSCursorImageValue.h
index 04723dd..9dc6a4e 100644
--- a/Source/core/css/CSSCursorImageValue.h
+++ b/Source/core/css/CSSCursorImageValue.h
@@ -23,7 +23,7 @@
 
 #include "core/css/CSSImageValue.h"
 #include "core/platform/graphics/IntPoint.h"
-#include <wtf/HashSet.h>
+#include "wtf/HashSet.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSDefaultStyleSheets.cpp b/Source/core/css/CSSDefaultStyleSheets.cpp
index 22b1e72..28bc053 100644
--- a/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -34,6 +34,9 @@
 #include "core/css/RuleSet.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/FullscreenController.h"
+#include "core/html/HTMLAnchorElement.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLVideoElement.h"
 #include "core/rendering/RenderTheme.h"
 
 namespace WebCore {
@@ -58,7 +61,7 @@
 
 static inline bool elementCanUseSimpleDefaultStyle(Element* e)
 {
-    return e->hasTagName(htmlTag) || e->hasTagName(headTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag) || e->hasTagName(aTag);
+    return isHTMLHtmlElement(e) || e->hasTagName(headTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag) || isHTMLAnchorElement(e);
 }
 
 static const MediaQueryEvaluator& screenEval()
@@ -165,7 +168,7 @@
         changedDefaultStyle = true;
     }
 
-    if (!mediaControlsStyleSheet && (element->hasTagName(videoTag) || element->hasTagName(audioTag))) {
+    if (!mediaControlsStyleSheet && (isHTMLVideoElement(element) || element->hasTagName(audioTag))) {
         String mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + RenderTheme::themeForPage(element->document()->page())->extraMediaControlsStyleSheet();
         mediaControlsStyleSheet = parseUASheet(mediaRules);
         defaultStyle->addRulesFromSheet(mediaControlsStyleSheet, screenEval());
diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp
index 9196a3c..0acd552 100644
--- a/Source/core/css/CSSFontFace.cpp
+++ b/Source/core/css/CSSFontFace.cpp
@@ -87,7 +87,7 @@
     CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector();
     fontSelector->fontLoaded();
 
-    if (m_loadState == Loading) {
+    if (fontSelector->document() && m_loadState == Loading) {
         if (source->ensureFontData())
             setLoadState(Loaded);
         else if (!isValid())
diff --git a/Source/core/css/CSSFontFaceRule.cpp b/Source/core/css/CSSFontFaceRule.cpp
index a176945..49bde93 100644
--- a/Source/core/css/CSSFontFaceRule.cpp
+++ b/Source/core/css/CSSFontFaceRule.cpp
@@ -26,7 +26,7 @@
 #include "core/css/StylePropertySet.h"
 #include "core/css/StyleRule.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSFontFaceSource.cpp b/Source/core/css/CSSFontFaceSource.cpp
index 53c9347..7e1d04d 100644
--- a/Source/core/css/CSSFontFaceSource.cpp
+++ b/Source/core/css/CSSFontFaceSource.cpp
@@ -166,7 +166,7 @@
                     return 0;
 
                 fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
-                    fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
+                    fontDescription.orientation(), fontDescription.widthVariant()), true, false);
             }
         } else {
 #if ENABLE(SVG_FONTS)
diff --git a/Source/core/css/CSSFontFaceSource.h b/Source/core/css/CSSFontFaceSource.h
index bd24171..b2cb70b 100644
--- a/Source/core/css/CSSFontFaceSource.h
+++ b/Source/core/css/CSSFontFaceSource.h
@@ -29,8 +29,8 @@
 #include "core/loader/cache/CachedFont.h"
 #include "core/loader/cache/CachedResourceHandle.h"
 #include "core/platform/Timer.h"
-#include <wtf/HashMap.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/HashMap.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSFontFaceSrcValue.cpp b/Source/core/css/CSSFontFaceSrcValue.cpp
index 302a327..35012f5 100644
--- a/Source/core/css/CSSFontFaceSrcValue.cpp
+++ b/Source/core/css/CSSFontFaceSrcValue.cpp
@@ -25,6 +25,8 @@
 
 #include "config.h"
 #include "core/css/CSSFontFaceSrcValue.h"
+
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/Document.h"
 #include "core/dom/Node.h"
@@ -32,10 +34,9 @@
 #include "core/loader/cache/CachedFont.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/platform/graphics/FontCustomPlatformData.h"
 #include "core/svg/SVGFontFaceElement.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -97,7 +98,7 @@
 CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document)
 {
     if (!m_cachedFont) {
-        CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource)), cachedResourceRequestInitiators().css);
+        CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource)), CachedResourceInitiatorTypeNames::css);
         m_cachedFont = document->cachedResourceLoader()->requestFont(request);
     }
     return m_cachedFont.get();
diff --git a/Source/core/css/CSSFontFaceSrcValue.h b/Source/core/css/CSSFontFaceSrcValue.h
index 0356edf..9f19c39 100644
--- a/Source/core/css/CSSFontFaceSrcValue.h
+++ b/Source/core/css/CSSFontFaceSrcValue.h
@@ -28,8 +28,8 @@
 
 #include "core/css/CSSValue.h"
 #include "core/loader/cache/CachedResourceHandle.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSGradientValue.cpp b/Source/core/css/CSSGradientValue.cpp
index 4c1fe6b..0469e76 100644
--- a/Source/core/css/CSSGradientValue.cpp
+++ b/Source/core/css/CSSGradientValue.cpp
@@ -28,17 +28,17 @@
 
 #include "CSSValueKeywords.h"
 #include "core/css/CSSCalculationValue.h"
-#include "core/css/resolver/StyleResolverState.h"
 #include "core/dom/NodeRenderStyle.h"
+#include "core/dom/TextLinkColors.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #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 <wtf/MemoryInstrumentationVector.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 using namespace std;
 
@@ -114,7 +114,7 @@
     { }
 };
 
-PassRefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(StyleResolverState& styleResolverState)
+PassRefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(const TextLinkColors& textLinkColors, Color currentColor)
 {
     bool derived = false;
     for (unsigned i = 0; i < m_stops.size(); i++)
@@ -137,7 +137,7 @@
     }
 
     for (unsigned i = 0; i < result->m_stops.size(); i++)
-        result->m_stops[i].m_resolvedColor = styleResolverState.resolveColorFromPrimitiveValue(result->m_stops[i].m_color.get());
+        result->m_stops[i].m_resolvedColor = textLinkColors.colorFromPrimitiveValue(result->m_stops[i].m_color.get(), currentColor);
 
     return result.release();
 }
diff --git a/Source/core/css/CSSGradientValue.h b/Source/core/css/CSSGradientValue.h
index 1ed7c95..a92da75 100644
--- a/Source/core/css/CSSGradientValue.h
+++ b/Source/core/css/CSSGradientValue.h
@@ -28,14 +28,14 @@
 
 #include "core/css/CSSImageGeneratorValue.h"
 #include "core/css/CSSPrimitiveValue.h"
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
 class FloatPoint;
 class Gradient;
-class StyleResolverState;
+class TextLinkColors;
 
 enum CSSGradientType {
     CSSDeprecatedLinearGradient,
@@ -90,7 +90,7 @@
     bool knownToBeOpaque(const RenderObject*) const;
 
     void loadSubimages(CachedResourceLoader*) { }
-    PassRefPtr<CSSGradientValue> gradientWithStylesResolved(StyleResolverState&);
+    PassRefPtr<CSSGradientValue> gradientWithStylesResolved(const TextLinkColors&, Color currentColor);
 
 protected:
     CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientType gradientType)
diff --git a/Source/core/css/CSSGrammar.y.includes b/Source/core/css/CSSGrammar.y.includes
index 60162a5..708e08b 100644
--- a/Source/core/css/CSSGrammar.y.includes
+++ b/Source/core/css/CSSGrammar.y.includes
@@ -38,7 +38,7 @@
 #include "core/css/StyleRule.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/Document.h"
-#include <wtf/FastMalloc.h>
+#include "wtf/FastMalloc.h"
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/Source/core/css/CSSGroupingRule.cpp b/Source/core/css/CSSGroupingRule.cpp
index 3a592ff..a9453d0 100644
--- a/Source/core/css/CSSGroupingRule.cpp
+++ b/Source/core/css/CSSGroupingRule.cpp
@@ -64,8 +64,8 @@
     ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
 
     if (index > m_groupRule->childRules().size()) {
-        // INDEX_SIZE_ERR: Raised if the specified index is not a valid insertion point.
-        ec = INDEX_SIZE_ERR;
+        // IndexSizeError: Raised if the specified index is not a valid insertion point.
+        ec = IndexSizeError;
         return 0;
     }
 
@@ -73,20 +73,20 @@
     CSSParser parser(parserContext(), UseCounter::getFrom(styleSheet));
     RefPtr<StyleRuleBase> newRule = parser.parseRule(styleSheet ? styleSheet->contents() : 0, ruleString);
     if (!newRule) {
-        // SYNTAX_ERR: Raised if the specified rule has a syntax error and is unparsable.
-        ec = SYNTAX_ERR;
+        // SyntaxError: Raised if the specified rule has a syntax error and is unparsable.
+        ec = SyntaxError;
         return 0;
     }
 
     if (newRule->isImportRule()) {
-        // FIXME: an HIERARCHY_REQUEST_ERR should also be thrown for a @charset or a nested
-        // @media rule. They are currently not getting parsed, resulting in a SYNTAX_ERR
+        // FIXME: an HierarchyRequestError should also be thrown for a @charset or a nested
+        // @media rule. They are currently not getting parsed, resulting in a SyntaxError
         // to get raised above.
 
-        // HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified
+        // HierarchyRequestError: Raised if the rule cannot be inserted at the specified
         // index, e.g., if an @import rule is inserted after a standard rule set or other
         // at-rule.
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return 0;
     }
     CSSStyleSheet::RuleMutationScope mutationScope(this);
@@ -102,9 +102,9 @@
     ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
 
     if (index >= m_groupRule->childRules().size()) {
-        // INDEX_SIZE_ERR: Raised if the specified index does not correspond to a
+        // IndexSizeError: Raised if the specified index does not correspond to a
         // rule in the media rule list.
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
diff --git a/Source/core/css/CSSGroupingRule.h b/Source/core/css/CSSGroupingRule.h
index 7c6dd83..f495c7c 100644
--- a/Source/core/css/CSSGroupingRule.h
+++ b/Source/core/css/CSSGroupingRule.h
@@ -25,7 +25,7 @@
 
 #include "core/css/CSSRule.h"
 #include "core/css/StyleRule.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSHelper.h b/Source/core/css/CSSHelper.h
index 6f2ffca..ac2c792 100644
--- a/Source/core/css/CSSHelper.h
+++ b/Source/core/css/CSSHelper.h
@@ -22,7 +22,7 @@
 #ifndef CSSHelper_h
 #define CSSHelper_h
 
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSHostRule.cpp b/Source/core/css/CSSHostRule.cpp
index 631e865..983c377 100644
--- a/Source/core/css/CSSHostRule.cpp
+++ b/Source/core/css/CSSHostRule.cpp
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "core/css/CSSHostRule.h"
 
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSImageGeneratorValue.h b/Source/core/css/CSSImageGeneratorValue.h
index 0d25592..88a2fc5 100644
--- a/Source/core/css/CSSImageGeneratorValue.h
+++ b/Source/core/css/CSSImageGeneratorValue.h
@@ -28,8 +28,8 @@
 
 #include "core/css/CSSValue.h"
 #include "core/platform/graphics/IntSizeHash.h"
-#include <wtf/HashCountedSet.h>
-#include <wtf/RefPtr.h>
+#include "wtf/HashCountedSet.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSImageSetValue.cpp b/Source/core/css/CSSImageSetValue.cpp
index 387081e..35318e2 100644
--- a/Source/core/css/CSSImageSetValue.cpp
+++ b/Source/core/css/CSSImageSetValue.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/css/CSSImageSetValue.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/CSSImageValue.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/dom/Document.h"
@@ -33,10 +34,9 @@
 #include "core/loader/cache/CachedImage.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/rendering/style/StyleCachedImageSet.h"
 #include "core/rendering/style/StylePendingImage.h"
-#include <wtf/MemoryInstrumentationVector.h>
+#include "wtf/MemoryInstrumentationVector.h"
 
 namespace WebCore {
 
@@ -104,7 +104,7 @@
         // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
         ImageWithScale image = bestImageForScaleFactor();
         if (Document* document = loader->document()) {
-            CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), cachedResourceRequestInitiators().css);
+            CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), CachedResourceInitiatorTypeNames::css);
             if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request)) {
                 m_imageSet = StyleCachedImageSet::create(cachedImage.get(), image.scaleFactor, this);
                 m_accessedBestFitImage = true;
diff --git a/Source/core/css/CSSImageValue.cpp b/Source/core/css/CSSImageValue.cpp
index 2769433..542be36 100644
--- a/Source/core/css/CSSImageValue.cpp
+++ b/Source/core/css/CSSImageValue.cpp
@@ -21,13 +21,13 @@
 #include "config.h"
 #include "core/css/CSSImageValue.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/CSSParser.h"
 #include "core/dom/Document.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedImage.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/rendering/style/StyleCachedImage.h"
 #include "core/rendering/style/StylePendingImage.h"
 
@@ -67,7 +67,7 @@
     if (!m_accessedImage) {
         m_accessedImage = true;
 
-        CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)), m_initiatorName.isEmpty() ? cachedResourceRequestInitiators().css : m_initiatorName, options);
+        CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)), m_initiatorName.isEmpty() ? CachedResourceInitiatorTypeNames::css : m_initiatorName, options);
         if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request))
             m_image = StyleCachedImage::create(cachedImage.get());
     }
diff --git a/Source/core/css/CSSImageValue.h b/Source/core/css/CSSImageValue.h
index 49e9818..125f6d2 100644
--- a/Source/core/css/CSSImageValue.h
+++ b/Source/core/css/CSSImageValue.h
@@ -23,7 +23,7 @@
 
 #include "core/css/CSSValue.h"
 #include "core/loader/cache/CachedResourceLoader.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSImportRule.cpp b/Source/core/css/CSSImportRule.cpp
index c728b8b..02ffaba 100644
--- a/Source/core/css/CSSImportRule.cpp
+++ b/Source/core/css/CSSImportRule.cpp
@@ -22,12 +22,12 @@
 #include "config.h"
 #include "core/css/CSSImportRule.h"
 
-#include <wtf/text/StringBuilder.h>
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/MediaList.h"
 #include "core/css/StyleRuleImport.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSInheritedValue.cpp b/Source/core/css/CSSInheritedValue.cpp
index a9f3d01..82e5ebb 100644
--- a/Source/core/css/CSSInheritedValue.cpp
+++ b/Source/core/css/CSSInheritedValue.cpp
@@ -22,7 +22,7 @@
 #include "core/css/CSSInheritedValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSInheritedValue.h b/Source/core/css/CSSInheritedValue.h
index 911e7ae..d4957b7 100644
--- a/Source/core/css/CSSInheritedValue.h
+++ b/Source/core/css/CSSInheritedValue.h
@@ -22,7 +22,7 @@
 #define CSSInheritedValue_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSInitialValue.cpp b/Source/core/css/CSSInitialValue.cpp
index 9bd55d4..2a3a328 100644
--- a/Source/core/css/CSSInitialValue.cpp
+++ b/Source/core/css/CSSInitialValue.cpp
@@ -22,7 +22,7 @@
 #include "core/css/CSSInitialValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSInitialValue.h b/Source/core/css/CSSInitialValue.h
index 89ab827..fb7a91f 100644
--- a/Source/core/css/CSSInitialValue.h
+++ b/Source/core/css/CSSInitialValue.h
@@ -22,7 +22,7 @@
 #define CSSInitialValue_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSKeyframeRule.h b/Source/core/css/CSSKeyframeRule.h
index 365ef74..c6639b0 100644
--- a/Source/core/css/CSSKeyframeRule.h
+++ b/Source/core/css/CSSKeyframeRule.h
@@ -46,6 +46,9 @@
     ~StyleKeyframe();
 
     String keyText() const { return m_key; }
+    // FIXME: Should we trim whitespace?
+    // FIXME: Should we leave keyText unchanged when attempting to set to an
+    // invalid string?
     void setKeyText(const String& s) { m_key = s; }
 
     void getKeys(Vector<float>& keys) const   { parseKeyString(m_key, keys); }
diff --git a/Source/core/css/CSSLineBoxContainValue.cpp b/Source/core/css/CSSLineBoxContainValue.cpp
index 710c2eb..2296160 100644
--- a/Source/core/css/CSSLineBoxContainValue.cpp
+++ b/Source/core/css/CSSLineBoxContainValue.cpp
@@ -27,8 +27,8 @@
 #include "core/css/CSSLineBoxContainValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSMatrix.cpp b/Source/core/css/CSSMatrix.cpp
index 8efcc2a..49777ff 100644
--- a/Source/core/css/CSSMatrix.cpp
+++ b/Source/core/css/CSSMatrix.cpp
@@ -69,7 +69,7 @@
 
         TransformOperations operations;
         if (!TransformBuilder::createTransformOperations(value.get(), 0, 0, operations)) {
-            ec = SYNTAX_ERR;
+            ec = SyntaxError;
             return;
         }
 
@@ -78,15 +78,16 @@
         TransformationMatrix t;
         for (unsigned i = 0; i < operations.operations().size(); ++i) {
             if (operations.operations()[i].get()->apply(t, IntSize(0, 0))) {
-                ec = SYNTAX_ERR;
+                ec = SyntaxError;
                 return;
             }
         }
 
         // set the matrix
         m_matrix = t;
-    } else // There is something there but parsing failed.
-        ec = SYNTAX_ERR;
+    } else { // There is something there but parsing failed.
+        ec = SyntaxError;
+    }
 }
 
 // Perform a concatenation of the matrices (this * secondMatrix)
@@ -101,7 +102,7 @@
 PassRefPtr<CSSMatrix> CSSMatrix::inverse(ExceptionCode& ec) const
 {
     if (!m_matrix.isInvertible()) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
diff --git a/Source/core/css/CSSOMUtils.cpp b/Source/core/css/CSSOMUtils.cpp
index d9a4684..36545dd 100644
--- a/Source/core/css/CSSOMUtils.cpp
+++ b/Source/core/css/CSSOMUtils.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "core/css/CSSOMUtils.h"
 
-#include <wtf/HexNumber.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/HexNumber.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser-in.cpp
similarity index 95%
rename from Source/core/css/CSSParser.cpp
rename to Source/core/css/CSSParser-in.cpp
index 63f4985..70e52b4 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -356,14 +356,15 @@
     m_lexFunc = &CSSParser::realLex<UChar>;
 }
 
-void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, int startLineNumber, SourceDataHandler* sourceDataHandler, bool logErrors)
+void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, const TextPosition& startPosition, SourceDataHandler* sourceDataHandler, bool logErrors)
 {
     setStyleSheet(sheet);
     m_defaultNamespace = starAtom; // Reset the default namespace.
     m_sourceDataHandler = sourceDataHandler;
     m_logErrors = logErrors && sheet->singleOwnerDocument() && !sheet->baseURL().isEmpty() && sheet->singleOwnerDocument()->page();
     m_ignoreErrors = false;
-    m_lineNumber = startLineNumber;
+    m_lineNumber = 0;
+    m_startPosition = startPosition;
     m_source = &string;
     setupParser("", string, "");
     cssyyparse(this);
@@ -371,6 +372,7 @@
     m_source = 0;
     m_sourceDataHandler = 0;
     m_rule = 0;
+    m_lineEndings.clear();
     m_ignoreErrors = false;
     m_logErrors = false;
 }
@@ -686,6 +688,12 @@
         if (valueID == CSSValueAuto || valueID == CSSValueFixed)
             return true;
         break;
+    case CSSPropertyTextAlignLast:
+        // auto | start | end | left | right | center | justify
+        if (RuntimeEnabledFeatures::css3TextEnabled()
+            && ((valueID >= CSSValueLeft && valueID <= CSSValueJustify) || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueAuto))
+            return true;
+        break;
     case CSSPropertyTextLineThroughMode:
     case CSSPropertyTextOverlineMode:
     case CSSPropertyTextUnderlineMode:
@@ -857,13 +865,6 @@
             return true;
         break;
 
-#if ENABLE(CSS3_TEXT)
-    case CSSPropertyWebkitTextAlignLast:
-        // auto | start | end | left | right | center | justify
-        if ((valueID >= CSSValueLeft && valueID <= CSSValueJustify) || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueAuto)
-            return true;
-        break;
-#endif // CSS3_TEXT
     case CSSPropertyWebkitTextCombine:
         if (valueID == CSSValueNone || valueID == CSSValueHorizontal)
             return true;
@@ -929,6 +930,8 @@
     switch (propertyId) {
     case CSSPropertyMixBlendMode:
         return RuntimeEnabledFeatures::cssCompositingEnabled();
+    case CSSPropertyTextAlignLast:
+        return RuntimeEnabledFeatures::css3TextEnabled();
     case CSSPropertyBorderBottomStyle:
     case CSSPropertyBorderCollapse:
     case CSSPropertyBorderLeftStyle:
@@ -1011,9 +1014,6 @@
     case CSSPropertyWebkitRegionFragment:
     case CSSPropertyWebkitRtlOrdering:
     case CSSPropertyWebkitRubyPosition:
-#if ENABLE(CSS3_TEXT)
-    case CSSPropertyWebkitTextAlignLast:
-#endif // CSS3_TEXT
     case CSSPropertyWebkitTextCombine:
     case CSSPropertyWebkitTextEmphasisPosition:
     case CSSPropertyWebkitTextSecurity:
@@ -2766,6 +2766,7 @@
     case CSSPropertyResize:
     case CSSPropertySpeak:
     case CSSPropertyTableLayout:
+    case CSSPropertyTextAlignLast:
     case CSSPropertyTextLineThroughMode:
     case CSSPropertyTextLineThroughStyle:
     case CSSPropertyTextOverflow:
@@ -2821,9 +2822,6 @@
     case CSSPropertyWebkitRegionFragment:
     case CSSPropertyWebkitRtlOrdering:
     case CSSPropertyWebkitRubyPosition:
-#if ENABLE(CSS3_TEXT)
-    case CSSPropertyWebkitTextAlignLast:
-#endif // CSS3_TEXT
     case CSSPropertyWebkitTextCombine:
     case CSSPropertyWebkitTextEmphasisPosition:
     case CSSPropertyWebkitTextSecurity:
@@ -7809,227 +7807,103 @@
         } else
             characters = name.characters16();
 
-        switch (nameLength) {
-        case 5:
-            // Valid name: skew(.
-            if (((characters[0] == 's') || (characters[0] == 'S'))
-                & ((characters[1] == 'k') || (characters[1] == 'K'))
-                & ((characters[2] == 'e') || (characters[2] == 'E'))
-                & ((characters[3] == 'w') || (characters[3] == 'W'))
-                & (characters[4] == '(')) {
+        SWITCH(characters, nameLength) {
+            CASE("skew(") {
                 m_unit = CSSParser::FAngle;
                 m_type = CSSTransformValue::SkewTransformOperation;
                 m_allowSingleArgument = true;
                 m_argCount = 3;
             }
-            break;
-        case 6:
-            // Valid names: skewx(, skewy(, scale(.
-            if ((characters[1] == 'c') || (characters[1] == 'C')) {
-                if (((characters[0] == 's') || (characters[0] == 'S'))
-                    & ((characters[2] == 'a') || (characters[2] == 'A'))
-                    & ((characters[3] == 'l') || (characters[3] == 'L'))
-                    & ((characters[4] == 'e') || (characters[4] == 'E'))
-                    & (characters[5] == '(')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::ScaleTransformOperation;
-                    m_allowSingleArgument = true;
-                    m_argCount = 3;
-                }
-            } else if (((characters[0] == 's') || (characters[0] == 'S'))
-                       & ((characters[1] == 'k') || (characters[1] == 'K'))
-                       & ((characters[2] == 'e') || (characters[2] == 'E'))
-                       & ((characters[3] == 'w') || (characters[3] == 'W'))
-                       & (characters[5] == '(')) {
-                if ((characters[4] == 'x') || (characters[4] == 'X')) {
-                    m_unit = CSSParser::FAngle;
-                    m_type = CSSTransformValue::SkewXTransformOperation;
-                } else if ((characters[4] == 'y') || (characters[4] == 'Y')) {
-                    m_unit = CSSParser::FAngle;
-                    m_type = CSSTransformValue::SkewYTransformOperation;
-                }
+            CASE("scale(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::ScaleTransformOperation;
+                m_allowSingleArgument = true;
+                m_argCount = 3;
             }
-            break;
-        case 7:
-            // Valid names: matrix(, rotate(, scalex(, scaley(, scalez(.
-            if ((characters[0] == 'm') || (characters[0] == 'M')) {
-                if (((characters[1] == 'a') || (characters[1] == 'A'))
-                    & ((characters[2] == 't') || (characters[2] == 'T'))
-                    & ((characters[3] == 'r') || (characters[3] == 'R'))
-                    & ((characters[4] == 'i') || (characters[4] == 'I'))
-                    & ((characters[5] == 'x') || (characters[5] == 'X'))
-                    & (characters[6] == '(')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::MatrixTransformOperation;
-                    m_argCount = 11;
-                }
-            } else if ((characters[0] == 'r') || (characters[0] == 'R')) {
-                if (((characters[1] == 'o') || (characters[1] == 'O'))
-                    & ((characters[2] == 't') || (characters[2] == 'T'))
-                    & ((characters[3] == 'a') || (characters[3] == 'A'))
-                    & ((characters[4] == 't') || (characters[4] == 'T'))
-                    & ((characters[5] == 'e') || (characters[5] == 'E'))
-                    & (characters[6] == '(')) {
-                    m_unit = CSSParser::FAngle;
-                    m_type = CSSTransformValue::RotateTransformOperation;
-                }
-            } else if (((characters[0] == 's') || (characters[0] == 'S'))
-                       & ((characters[1] == 'c') || (characters[1] == 'C'))
-                       & ((characters[2] == 'a') || (characters[2] == 'A'))
-                       & ((characters[3] == 'l') || (characters[3] == 'L'))
-                       & ((characters[4] == 'e') || (characters[4] == 'E'))
-                       & (characters[6] == '(')) {
-                if ((characters[5] == 'x') || (characters[5] == 'X')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::ScaleXTransformOperation;
-                } else if ((characters[5] == 'y') || (characters[5] == 'Y')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::ScaleYTransformOperation;
-                } else if ((characters[5] == 'z') || (characters[5] == 'Z')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::ScaleZTransformOperation;
-                }
+            CASE("skewx(") {
+                m_unit = CSSParser::FAngle;
+                m_type = CSSTransformValue::SkewXTransformOperation;
             }
-            break;
-        case 8:
-            // Valid names: rotatex(, rotatey(, rotatez(, scale3d(.
-            if ((characters[0] == 's') || (characters[0] == 'S')) {
-                if (((characters[1] == 'c') || (characters[1] == 'C'))
-                    & ((characters[2] == 'a') || (characters[2] == 'A'))
-                    & ((characters[3] == 'l') || (characters[3] == 'L'))
-                    & ((characters[4] == 'e') || (characters[4] == 'E'))
-                    & (characters[5] == '3')
-                    & ((characters[6] == 'd') || (characters[6] == 'D'))
-                    & (characters[7] == '(')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::Scale3DTransformOperation;
-                    m_argCount = 5;
-                }
-            } else if (((characters[0] == 'r') || (characters[0] == 'R'))
-                       & ((characters[1] == 'o') || (characters[1] == 'O'))
-                       & ((characters[2] == 't') || (characters[2] == 'T'))
-                       & ((characters[3] == 'a') || (characters[3] == 'A'))
-                       & ((characters[4] == 't') || (characters[4] == 'T'))
-                       & ((characters[5] == 'e') || (characters[5] == 'E'))
-                       & (characters[7] == '(')) {
-                if ((characters[6] == 'x') || (characters[6] == 'X')) {
-                    m_unit = CSSParser::FAngle;
-                    m_type = CSSTransformValue::RotateXTransformOperation;
-                } else if ((characters[6] == 'y') || (characters[6] == 'Y')) {
-                    m_unit = CSSParser::FAngle;
-                    m_type = CSSTransformValue::RotateYTransformOperation;
-                } else if ((characters[6] == 'z') || (characters[6] == 'Z')) {
-                    m_unit = CSSParser::FAngle;
-                    m_type = CSSTransformValue::RotateZTransformOperation;
-                }
+            CASE("skewy(") {
+                m_unit = CSSParser::FAngle;
+                m_type = CSSTransformValue::SkewYTransformOperation;
             }
-            break;
-        case 9:
-            // Valid names: matrix3d(, rotate3d(.
-            if ((characters[0] == 'm') || (characters[0] == 'M')) {
-                if (((characters[1] == 'a') || (characters[1] == 'A'))
-                    & ((characters[2] == 't') || (characters[2] == 'T'))
-                    & ((characters[3] == 'r') || (characters[3] == 'R'))
-                    & ((characters[4] == 'i') || (characters[4] == 'I'))
-                    & ((characters[5] == 'x') || (characters[5] == 'X'))
-                    & (characters[6] == '3')
-                    & ((characters[7] == 'd') || (characters[7] == 'D'))
-                    & (characters[8] == '(')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::Matrix3DTransformOperation;
-                    m_argCount = 31;
-                }
-            } else if (((characters[0] == 'r') || (characters[0] == 'R'))
-                       & ((characters[1] == 'o') || (characters[1] == 'O'))
-                       & ((characters[2] == 't') || (characters[2] == 'T'))
-                       & ((characters[3] == 'a') || (characters[3] == 'A'))
-                       & ((characters[4] == 't') || (characters[4] == 'T'))
-                       & ((characters[5] == 'e') || (characters[5] == 'E'))
-                       & (characters[6] == '3')
-                       & ((characters[7] == 'd') || (characters[7] == 'D'))
-                       & (characters[8] == '(')) {
+            CASE("matrix(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::MatrixTransformOperation;
+                m_argCount = 11;
+            }
+            CASE("rotate(") {
+                m_unit = CSSParser::FAngle;
+                m_type = CSSTransformValue::RotateTransformOperation;
+            }
+            CASE("scalex(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::ScaleXTransformOperation;
+            }
+            CASE("scaley(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::ScaleYTransformOperation;
+            }
+            CASE("scalez(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::ScaleZTransformOperation;
+            }
+            CASE("scale3d(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::Scale3DTransformOperation;
+                m_argCount = 5;
+            }
+            CASE("rotatex(") {
+                m_unit = CSSParser::FAngle;
+                m_type = CSSTransformValue::RotateXTransformOperation;
+            }
+            CASE("rotatey(") {
+                m_unit = CSSParser::FAngle;
+                m_type = CSSTransformValue::RotateYTransformOperation;
+            }
+            CASE("rotatez(") {
+                m_unit = CSSParser::FAngle;
+                m_type = CSSTransformValue::RotateZTransformOperation;
+            }
+            CASE("matrix3d(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::Matrix3DTransformOperation;
+                m_argCount = 31;
+            }
+            CASE("rotate3d(") {
                 m_unit = CSSParser::FNumber;
                 m_type = CSSTransformValue::Rotate3DTransformOperation;
                 m_argCount = 7;
             }
-            break;
-        case 10:
-            // Valid name: translate(.
-            if (((characters[0] == 't') || (characters[0] == 'T'))
-                & ((characters[1] == 'r') || (characters[1] == 'R'))
-                & ((characters[2] == 'a') || (characters[2] == 'A'))
-                & ((characters[3] == 'n') || (characters[3] == 'N'))
-                & ((characters[4] == 's') || (characters[4] == 'S'))
-                & ((characters[5] == 'l') || (characters[5] == 'L'))
-                & ((characters[6] == 'a') || (characters[6] == 'A'))
-                & ((characters[7] == 't') || (characters[7] == 'T'))
-                & ((characters[8] == 'e') || (characters[8] == 'E'))
-                & (characters[9] == '(')) {
+            CASE("translate(") {
                 m_unit = CSSParser::FLength | CSSParser::FPercent;
                 m_type = CSSTransformValue::TranslateTransformOperation;
                 m_allowSingleArgument = true;
                 m_argCount = 3;
             }
-            break;
-        case 11:
-            // Valid names: translatex(, translatey(, translatez(.
-            if (((characters[0] == 't') || (characters[0] == 'T'))
-                & ((characters[1] == 'r') || (characters[1] == 'R'))
-                & ((characters[2] == 'a') || (characters[2] == 'A'))
-                & ((characters[3] == 'n') || (characters[3] == 'N'))
-                & ((characters[4] == 's') || (characters[4] == 'S'))
-                & ((characters[5] == 'l') || (characters[5] == 'L'))
-                & ((characters[6] == 'a') || (characters[6] == 'A'))
-                & ((characters[7] == 't') || (characters[7] == 'T'))
-                & ((characters[8] == 'e') || (characters[8] == 'E'))
-                & (characters[10] == '(')) {
-                if ((characters[9] == 'x') || (characters[9] == 'X')) {
-                    m_unit = CSSParser::FLength | CSSParser::FPercent;
-                    m_type = CSSTransformValue::TranslateXTransformOperation;
-                } else if ((characters[9] == 'y') || (characters[9] == 'Y')) {
-                    m_unit = CSSParser::FLength | CSSParser::FPercent;
-                    m_type = CSSTransformValue::TranslateYTransformOperation;
-                } else if ((characters[9] == 'z') || (characters[9] == 'Z')) {
-                    m_unit = CSSParser::FLength | CSSParser::FPercent;
-                    m_type = CSSTransformValue::TranslateZTransformOperation;
-                }
+            CASE("translatex(") {
+                m_unit = CSSParser::FLength | CSSParser::FPercent;
+                m_type = CSSTransformValue::TranslateXTransformOperation;
             }
-            break;
-        case 12:
-            // Valid names: perspective(, translate3d(.
-            if ((characters[0] == 'p') || (characters[0] == 'P')) {
-                if (((characters[1] == 'e') || (characters[1] == 'E'))
-                    & ((characters[2] == 'r') || (characters[2] == 'R'))
-                    & ((characters[3] == 's') || (characters[3] == 'S'))
-                    & ((characters[4] == 'p') || (characters[4] == 'P'))
-                    & ((characters[5] == 'e') || (characters[5] == 'E'))
-                    & ((characters[6] == 'c') || (characters[6] == 'C'))
-                    & ((characters[7] == 't') || (characters[7] == 'T'))
-                    & ((characters[8] == 'i') || (characters[8] == 'I'))
-                    & ((characters[9] == 'v') || (characters[9] == 'V'))
-                    & ((characters[10] == 'e') || (characters[10] == 'E'))
-                    & (characters[11] == '(')) {
-                    m_unit = CSSParser::FNumber;
-                    m_type = CSSTransformValue::PerspectiveTransformOperation;
-                }
-            } else if (((characters[0] == 't') || (characters[0] == 'T'))
-                       & ((characters[1] == 'r') || (characters[1] == 'R'))
-                       & ((characters[2] == 'a') || (characters[2] == 'A'))
-                       & ((characters[3] == 'n') || (characters[3] == 'N'))
-                       & ((characters[4] == 's') || (characters[4] == 'S'))
-                       & ((characters[5] == 'l') || (characters[5] == 'L'))
-                       & ((characters[6] == 'a') || (characters[6] == 'A'))
-                       & ((characters[7] == 't') || (characters[7] == 'T'))
-                       & ((characters[8] == 'e') || (characters[8] == 'E'))
-                       & (characters[9] == '3')
-                       & ((characters[10] == 'd') || (characters[10] == 'D'))
-                       & (characters[11] == '(')) {
+            CASE("translatey(") {
+                m_unit = CSSParser::FLength | CSSParser::FPercent;
+                m_type = CSSTransformValue::TranslateYTransformOperation;
+            }
+            CASE("translatez(") {
+                m_unit = CSSParser::FLength | CSSParser::FPercent;
+                m_type = CSSTransformValue::TranslateZTransformOperation;
+            }
+            CASE("perspective(") {
+                m_unit = CSSParser::FNumber;
+                m_type = CSSTransformValue::PerspectiveTransformOperation;
+            }
+            CASE("translate3d(") {
                 m_unit = CSSParser::FLength | CSSParser::FPercent;
                 m_type = CSSTransformValue::Translate3DTransformOperation;
                 m_argCount = 5;
             }
-            break;
-        } // end switch ()
+        }
     }
 
     CSSTransformValue::TransformOperationType type() const { return m_type; }
@@ -9539,17 +9413,30 @@
     return m_dataStart16.get();
 }
 
-CSSParserLocation CSSParser::currentLocation()
+void CSSParser::ensureLineEndings()
+{
+    if (!m_lineEndings)
+        m_lineEndings = lineEndings(*m_source);
+}
+
+template <typename CharacterType>
+inline CSSParserLocation CSSParser::tokenLocation()
 {
     CSSParserLocation location;
+    location.token.init(tokenStart<CharacterType>(), currentCharacter<CharacterType>() - tokenStart<CharacterType>());
     location.lineNumber = m_tokenStartLineNumber;
-    if (is8BitSource())
-        location.token.init(tokenStart<LChar>(), currentCharacter<LChar>() - tokenStart<LChar>());
-    else
-        location.token.init(tokenStart<UChar>(), currentCharacter<UChar>() - tokenStart<UChar>());
+    location.offset = tokenStart<CharacterType>() - dataStart<CharacterType>();
     return location;
 }
 
+CSSParserLocation CSSParser::currentLocation()
+{
+    if (is8BitSource())
+        return tokenLocation<LChar>();
+    else
+        return tokenLocation<UChar>();
+}
+
 template <typename CharacterType>
 inline bool CSSParser::isIdentifierStart()
 {
@@ -9912,63 +9799,46 @@
 {
     ASSERT(length > 0);
     CharacterType* name = tokenStart<CharacterType>();
-
-    switch (length) {
-    case 3:
-        if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaselessEqual(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't')) {
+    SWITCH(name, length) {
+        CASE("not") {
             m_token = NOTFUNCTION;
             return true;
         }
-        if (isASCIIAlphaCaselessEqual(name[0], 'u') && isASCIIAlphaCaselessEqual(name[1], 'r') && isASCIIAlphaCaselessEqual(name[2], 'l')) {
+        CASE("url") {
             m_token = URI;
             return true;
         }
-        if (isASCIIAlphaCaselessEqual(name[0], 'c') && isASCIIAlphaCaselessEqual(name[1], 'u') && isASCIIAlphaCaselessEqual(name[2], 'e')) {
+        CASE("cue") {
             m_token = CUEFUNCTION;
             return true;
         }
-        if (RuntimeEnabledFeatures::cssVariablesEnabled() && isASCIIAlphaCaselessEqual(name[0], 'v') && isASCIIAlphaCaselessEqual(name[1], 'a') && isASCIIAlphaCaselessEqual(name[2], 'r')) {
+        CASE("var") {
+            if (!RuntimeEnabledFeatures::cssVariablesEnabled())
+                return false;
             m_token = VARFUNCTION;
             return true;
         }
-        return false;
-
-    case 4:
-        if (isEqualToCSSIdentifier(name, "calc")) {
+        CASE("calc") {
             m_token = CALCFUNCTION;
             return true;
         }
-        return false;
-
-    case 9:
-        if (isEqualToCSSIdentifier(name, "nth-child")) {
+        CASE("nth-child") {
             m_parsingMode = NthChildMode;
             return true;
         }
-        return false;
-
-    case 11:
-        if (isEqualToCSSIdentifier(name, "nth-of-type")) {
+        CASE("nth-of-type") {
             m_parsingMode = NthChildMode;
             return true;
         }
-        return false;
-
-    case 14:
-        if (isEqualToCSSIdentifier(name, "nth-last-child")) {
+        CASE("nth-last-child") {
             m_parsingMode = NthChildMode;
             return true;
         }
-        return false;
-
-    case 16:
-        if (isEqualToCSSIdentifier(name, "nth-last-of-type")) {
+        CASE("nth-last-of-type") {
             m_parsingMode = NthChildMode;
             return true;
         }
-        return false;
     }
-
     return false;
 }
 
@@ -9978,15 +9848,16 @@
     ASSERT(m_parsingMode == MediaQueryMode);
     CharacterType* name = tokenStart<CharacterType>();
 
-    if (length == 3) {
-        if (isASCIIAlphaCaselessEqual(name[0], 'a') && isASCIIAlphaCaselessEqual(name[1], 'n') && isASCIIAlphaCaselessEqual(name[2], 'd'))
+    SWITCH(name, length) {
+        CASE("and") {
             m_token = MEDIA_AND;
-        else if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaselessEqual(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't'))
+        }
+        CASE("not") {
             m_token = MEDIA_NOT;
-    } else if (length == 4) {
-        if (isASCIIAlphaCaselessEqual(name[0], 'o') && isASCIIAlphaCaselessEqual(name[1], 'n')
-                && isASCIIAlphaCaselessEqual(name[2], 'l') && isASCIIAlphaCaselessEqual(name[3], 'y'))
+        }
+        CASE("only") {
             m_token = MEDIA_ONLY;
+        }
     }
 }
 
@@ -9995,123 +9866,91 @@
 {
     ASSERT(length > 0);
 
-    switch (toASCIILowerUnchecked(type[0])) {
-    case 'c':
-        if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'm'))
+    SWITCH(type, length) {
+        CASE("cm") {
             m_token = CMS;
-        else if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'h'))
+        }
+        CASE("ch") {
             m_token = CHS;
-        return;
-
-    case 'd':
-        if (length == 3 && isASCIIAlphaCaselessEqual(type[1], 'e') && isASCIIAlphaCaselessEqual(type[2], 'g'))
+        }
+        CASE("deg") {
             m_token = DEGS;
-        else if (length > 2 && isASCIIAlphaCaselessEqual(type[1], 'p')) {
-            if (length == 4) {
+        }
+        CASE("dppx") {
                 // There is a discussion about the name of this unit on www-style.
                 // Keep this compile time guard in place until that is resolved.
                 // http://lists.w3.org/Archives/Public/www-style/2012May/0915.html
-                if (isASCIIAlphaCaselessEqual(type[2], 'p') && isASCIIAlphaCaselessEqual(type[3], 'x'))
-                    m_token = DPPX;
-                else if (isASCIIAlphaCaselessEqual(type[2], 'c') && isASCIIAlphaCaselessEqual(type[3], 'm'))
-                    m_token = DPCM;
-            } else if (length == 3 && isASCIIAlphaCaselessEqual(type[2], 'i'))
-                    m_token = DPI;
+            m_token = DPPX;
         }
-        return;
-
-    case 'e':
-        if (length == 2) {
-            if (isASCIIAlphaCaselessEqual(type[1], 'm'))
-                m_token = EMS;
-            else if (isASCIIAlphaCaselessEqual(type[1], 'x'))
-                m_token = EXS;
+        CASE("dpcm") {
+            m_token = DPCM;
         }
-        return;
-
-    case 'f':
-        if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'r'))
+        CASE("dpi") {
+            m_token = DPI;
+        }
+        CASE("em") {
+            m_token = EMS;
+        }
+        CASE("ex") {
+            m_token = EXS;
+        }
+        CASE("fr") {
             m_token = FR;
-        return;
-    case 'g':
-        if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'r')
-                && isASCIIAlphaCaselessEqual(type[2], 'a') && isASCIIAlphaCaselessEqual(type[3], 'd'))
+        }
+        CASE("grad") {
             m_token = GRADS;
-        return;
-
-    case 'h':
-        if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'z'))
+        }
+        CASE("hz") {
             m_token = HERTZ;
-        return;
-
-    case 'i':
-        if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'n'))
+        }
+        CASE("in") {
             m_token = INS;
-        return;
-
-    case 'k':
-        if (length == 3 && isASCIIAlphaCaselessEqual(type[1], 'h') && isASCIIAlphaCaselessEqual(type[2], 'z'))
+        }
+        CASE("khz") {
             m_token = KHERTZ;
-        return;
-
-    case 'm':
-        if (length == 2) {
-            if (isASCIIAlphaCaselessEqual(type[1], 'm'))
-                m_token = MMS;
-            else if (isASCIIAlphaCaselessEqual(type[1], 's'))
-                m_token = MSECS;
         }
-        return;
-
-    case 'p':
-        if (length == 2) {
-            if (isASCIIAlphaCaselessEqual(type[1], 'x'))
-                m_token = PXS;
-            else if (isASCIIAlphaCaselessEqual(type[1], 't'))
-                m_token = PTS;
-            else if (isASCIIAlphaCaselessEqual(type[1], 'c'))
-                m_token = PCS;
+        CASE("mm") {
+            m_token = MMS;
         }
-        return;
-
-    case 'r':
-        if (length == 3) {
-            if (isASCIIAlphaCaselessEqual(type[1], 'a') && isASCIIAlphaCaselessEqual(type[2], 'd'))
-                m_token = RADS;
-            else if (isASCIIAlphaCaselessEqual(type[1], 'e') && isASCIIAlphaCaselessEqual(type[2], 'm'))
-                m_token = REMS;
+        CASE("ms") {
+            m_token = MSECS;
         }
-        return;
-
-    case 's':
-        if (length == 1)
+        CASE("px") {
+            m_token = PXS;
+        }
+        CASE("pt") {
+            m_token = PTS;
+        }
+        CASE("pc") {
+            m_token = PCS;
+        }
+        CASE("rad") {
+            m_token = RADS;
+        }
+        CASE("rem") {
+            m_token = REMS;
+        }
+        CASE("s") {
             m_token = SECS;
-        return;
-
-    case 't':
-        if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'u')
-                && isASCIIAlphaCaselessEqual(type[2], 'r') && isASCIIAlphaCaselessEqual(type[3], 'n'))
-            m_token = TURNS;
-        return;
-    case 'v':
-        if (length == 2) {
-            if (isASCIIAlphaCaselessEqual(type[1], 'w'))
-                m_token = VW;
-            else if (isASCIIAlphaCaselessEqual(type[1], 'h'))
-                m_token = VH;
-        } else if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'm')) {
-            if (isASCIIAlphaCaselessEqual(type[2], 'i') && isASCIIAlphaCaselessEqual(type[3], 'n'))
-                m_token = VMIN;
-            else if (isASCIIAlphaCaselessEqual(type[2], 'a') && isASCIIAlphaCaselessEqual(type[3], 'x'))
-                m_token = VMAX;
         }
-        return;
-
-    default:
-        if (type[0] == '_' && length == 5 && type[1] == '_' && isASCIIAlphaCaselessEqual(type[2], 'q')
-                && isASCIIAlphaCaselessEqual(type[3], 'e') && isASCIIAlphaCaselessEqual(type[4], 'm'))
+        CASE("turn") {
+            m_token = TURNS;
+        }
+        CASE("vw") {
+            m_token = VW;
+        }
+        CASE("vh") {
+            m_token = VH;
+        }
+        CASE("vmin") {
+            m_token = VMIN;
+        }
+        CASE("vmax") {
+            m_token = VMAX;
+        }
+        CASE("__qem") {
             m_token = QEMS;
-        return;
+        }
     }
 }
 
@@ -10120,17 +9959,30 @@
 {
     CharacterType* name = tokenStart<CharacterType>();
 
-    if (length == 11) {
-        if (isASCIIAlphaCaselessEqual(name[10], 'y') && isEqualToCSSIdentifier(name + 1, "webkit-an"))
+    // Ignore leading dash.
+    ++name;
+    --length;
+
+    SWITCH(name, length) {
+        CASE("webkit-any") {
             m_token = ANYFUNCTION;
-        else if (isASCIIAlphaCaselessEqual(name[10], 'n') && isEqualToCSSIdentifier(name + 1, "webkit-mi"))
+        }
+        CASE("webkit-min") {
             m_token = MINFUNCTION;
-        else if (isASCIIAlphaCaselessEqual(name[10], 'x') && isEqualToCSSIdentifier(name + 1, "webkit-ma"))
+        }
+        CASE("webkit-max") {
             m_token = MAXFUNCTION;
-    } else if (length == 12 && isEqualToCSSIdentifier(name + 1, "webkit-calc"))
-        m_token = CALCFUNCTION;
-    else if (length == 19 && isEqualToCSSIdentifier(name + 1, "webkit-distributed"))
-        m_token = DISTRIBUTEDFUNCTION;
+        }
+        CASE("webkit-var") {
+            m_token = VARFUNCTION;
+        }
+        CASE("webkit-calc") {
+            m_token = CALCFUNCTION;
+        }
+        CASE("webkit-distributed") {
+            m_token = DISTRIBUTEDFUNCTION;
+        }
+    }
 }
 
 template <typename CharacterType>
@@ -10360,14 +10212,16 @@
     ASSERT(m_parsingMode == SupportsMode);
     CharacterType* name = tokenStart<CharacterType>();
 
-    if (length == 2) {
-        if (isASCIIAlphaCaselessEqual(name[0], 'o') && isASCIIAlphaCaselessEqual(name[1], 'r'))
+    SWITCH(name, length) {
+        CASE("or") {
             m_token = SUPPORTS_OR;
-    } else if (length == 3) {
-        if (isASCIIAlphaCaselessEqual(name[0], 'a') && isASCIIAlphaCaselessEqual(name[1], 'n') && isASCIIAlphaCaselessEqual(name[2], 'd'))
+        }
+        CASE("and") {
             m_token = SUPPORTS_AND;
-        else if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaselessEqual(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't'))
+        }
+        CASE("not") {
             m_token = SUPPORTS_NOT;
+        }
     }
 }
 
@@ -11072,7 +10926,8 @@
         return;
 
     CSSParserLocation location;
-    location.lineNumber = m_ruleHeaderStartLineNumber;
+    location.lineNumber = m_lineNumber;
+    location.offset = m_ruleHeaderStartOffset;
     if (is8BitSource())
         location.token.init(m_dataStart8.get() + m_ruleHeaderStartOffset, 0);
     else
@@ -11152,7 +11007,7 @@
 
     builder.append(content);
 
-    logError(builder.toString(), location.lineNumber);
+    logError(builder.toString(), location);
 }
 
 bool CSSParser::isLoggingErrors()
@@ -11160,10 +11015,20 @@
     return m_logErrors && !m_ignoreErrors;
 }
 
-void CSSParser::logError(const String& message, int lineNumber)
+void CSSParser::logError(const String& message, const CSSParserLocation& location)
 {
+    unsigned lineNumberInStyleSheet;
+    unsigned columnNumber = 0;
     PageConsole* console = m_styleSheet->singleOwnerDocument()->page()->console();
-    console->addMessage(CSSMessageSource, WarningMessageLevel, message, m_styleSheet->baseURL().string(), lineNumber + 1);
+    if (InspectorInstrumentation::hasFrontends()) {
+        ensureLineEndings();
+        TextPosition tokenPosition = TextPosition::fromOffsetAndLineEndings(location.offset, *m_lineEndings);
+        lineNumberInStyleSheet = tokenPosition.m_line.zeroBasedInt();
+        columnNumber = (lineNumberInStyleSheet ? 0 : m_startPosition.m_column.zeroBasedInt()) + tokenPosition.m_column.zeroBasedInt();
+    } else {
+        lineNumberInStyleSheet = location.lineNumber;
+    }
+    console->addMessage(CSSMessageSource, WarningMessageLevel, message, m_styleSheet->baseURL().string(), lineNumberInStyleSheet + m_startPosition.m_line.zeroBasedInt() + 1, columnNumber + 1);
 }
 
 StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > popKeyframes)
@@ -11470,7 +11335,7 @@
 
 void CSSParser::updateLastSelectorLineAndPosition()
 {
-    m_lastSelectorLineNumber = m_lineNumber;
+    m_lastSelectorLineNumber = m_lineNumber + m_startPosition.m_line.zeroBasedInt();
 }
 
 void CSSParser::startRuleHeader(CSSRuleSourceData::Type ruleType)
diff --git a/Source/core/css/CSSParser.h b/Source/core/css/CSSParser.h
index d1ecd6b..fdb7779 100644
--- a/Source/core/css/CSSParser.h
+++ b/Source/core/css/CSSParser.h
@@ -40,6 +40,7 @@
 #include "wtf/OwnArrayPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/AtomicString.h"
+#include "wtf/text/TextPosition.h"
 
 namespace WebCore {
 
@@ -67,7 +68,8 @@
 class StyleSheetContents;
 
 struct CSSParserLocation {
-    int lineNumber;
+    unsigned offset;
+    unsigned lineNumber;
     CSSParserString token;
 };
 
@@ -95,7 +97,7 @@
 
     ~CSSParser();
 
-    void parseSheet(StyleSheetContents*, const String&, int startLineNumber = 0, SourceDataHandler* = 0, bool = false);
+    void parseSheet(StyleSheetContents*, const String&, const TextPosition& startPosition = TextPosition::minimumPosition(), SourceDataHandler* = 0, bool = false);
     PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
     PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&);
     bool parseSupportsCondition(const String&);
@@ -472,6 +474,11 @@
     template <typename CharacterType>
     inline bool isIdentifierStart();
 
+    inline void ensureLineEndings();
+
+    template <typename CharacterType>
+    inline CSSParserLocation tokenLocation();
+
     template <typename CharacterType>
     unsigned parseEscape(CharacterType*&);
     template <typename DestCharacterType>
@@ -581,12 +588,14 @@
     } m_tokenStart;
     unsigned m_length;
     int m_token;
+    TextPosition m_startPosition;
     int m_lineNumber;
     int m_tokenStartLineNumber;
     int m_lastSelectorLineNumber;
     CSSRuleSourceData::Type m_ruleHeaderType;
     unsigned m_ruleHeaderStartOffset;
     int m_ruleHeaderStartLineNumber;
+    OwnPtr<Vector<unsigned> > m_lineEndings;
 
     bool m_allowImportRules;
     bool m_allowNamespaceDeclarations;
@@ -650,7 +659,7 @@
     };
 
     bool isLoggingErrors();
-    void logError(const String& message, int lineNumber);
+    void logError(const String& message, const CSSParserLocation&);
 
     bool validCalculationUnit(CSSParserValue*, Units, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue);
 
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index f1345e1..8281371 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -120,36 +120,36 @@
     // Here we violate the spec (http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSPrimitiveValue) and allow conversions
     // between CSS_PX and relative lengths (see cssPixelsPerInch comment in core/css/CSSHelper.h for the topic treatment).
     switch (type) {
-    case CSSPrimitiveValue::CSS_NUMBER:
+    case CSS_NUMBER:
         return CSSPrimitiveValue::UNumber;
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
+    case CSS_PERCENTAGE:
         return CSSPrimitiveValue::UPercent;
-    case CSSPrimitiveValue::CSS_PX:
-    case CSSPrimitiveValue::CSS_CM:
-    case CSSPrimitiveValue::CSS_MM:
-    case CSSPrimitiveValue::CSS_IN:
-    case CSSPrimitiveValue::CSS_PT:
-    case CSSPrimitiveValue::CSS_PC:
+    case CSS_PX:
+    case CSS_CM:
+    case CSS_MM:
+    case CSS_IN:
+    case CSS_PT:
+    case CSS_PC:
         return CSSPrimitiveValue::ULength;
-    case CSSPrimitiveValue::CSS_MS:
-    case CSSPrimitiveValue::CSS_S:
+    case CSS_MS:
+    case CSS_S:
         return CSSPrimitiveValue::UTime;
-    case CSSPrimitiveValue::CSS_DEG:
-    case CSSPrimitiveValue::CSS_RAD:
-    case CSSPrimitiveValue::CSS_GRAD:
-    case CSSPrimitiveValue::CSS_TURN:
+    case CSS_DEG:
+    case CSS_RAD:
+    case CSS_GRAD:
+    case CSS_TURN:
         return CSSPrimitiveValue::UAngle;
-    case CSSPrimitiveValue::CSS_HZ:
-    case CSSPrimitiveValue::CSS_KHZ:
+    case CSS_HZ:
+    case CSS_KHZ:
         return CSSPrimitiveValue::UFrequency;
-    case CSSPrimitiveValue::CSS_VW:
-    case CSSPrimitiveValue::CSS_VH:
-    case CSSPrimitiveValue::CSS_VMIN:
-    case CSSPrimitiveValue::CSS_VMAX:
+    case CSS_VW:
+    case CSS_VH:
+    case CSS_VMIN:
+    case CSS_VMAX:
         return CSSPrimitiveValue::UViewportPercentageLength;
-    case CSSPrimitiveValue::CSS_DPPX:
-    case CSSPrimitiveValue::CSS_DPI:
-    case CSSPrimitiveValue::CSS_DPCM:
+    case CSS_DPPX:
+    case CSS_DPI:
+    case CSS_DPCM:
         return CSSPrimitiveValue::UResolution;
     default:
         return CSSPrimitiveValue::UOther;
@@ -182,26 +182,26 @@
     if (m_primitiveUnitType == CSS_PROPERTY_ID || m_primitiveUnitType == CSS_VALUE_ID)
         return CSS_IDENT;
 
-    if (m_primitiveUnitType != CSSPrimitiveValue::CSS_CALC)
+    if (m_primitiveUnitType != CSS_CALC)
         return m_primitiveUnitType; 
     
     switch (m_value.calc->category()) {
     case CalcNumber:
-        return CSSPrimitiveValue::CSS_NUMBER;
+        return CSS_NUMBER;
     case CalcPercent:
-        return CSSPrimitiveValue::CSS_PERCENTAGE;
+        return CSS_PERCENTAGE;
     case CalcLength:
-        return CSSPrimitiveValue::CSS_PX;
+        return CSS_PX;
     case CalcPercentNumber:
-        return CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER;
+        return CSS_CALC_PERCENTAGE_WITH_NUMBER;
     case CalcPercentLength:
-        return CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH;
+        return CSS_CALC_PERCENTAGE_WITH_LENGTH;
     case CalcVariable:
-        return CSSPrimitiveValue::CSS_UNKNOWN; // The type of a calculation containing a variable cannot be known until the value of the variable is determined.
+        return CSS_UNKNOWN; // The type of a calculation containing a variable cannot be known until the value of the variable is determined.
     case CalcOther:
-        return CSSPrimitiveValue::CSS_UNKNOWN;
+        return CSS_UNKNOWN;
     }
-    return CSSPrimitiveValue::CSS_UNKNOWN;
+    return CSS_UNKNOWN;
 }
 
 static const AtomicString& propertyName(CSSPropertyID propertyID)
@@ -593,7 +593,7 @@
     // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
     // No other engine supports mutating style through this API. Computed style is always read-only anyway.
     // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(unsigned short unitType)
@@ -601,48 +601,48 @@
     double factor = 1.0;
     // FIXME: the switch can be replaced by an array of scale factors.
     switch (unitType) {
-        // These are "canonical" units in their respective categories.
-        case CSSPrimitiveValue::CSS_PX:
-        case CSSPrimitiveValue::CSS_DEG:
-        case CSSPrimitiveValue::CSS_MS:
-        case CSSPrimitiveValue::CSS_HZ:
-            break;
-        case CSSPrimitiveValue::CSS_CM:
-            factor = cssPixelsPerInch / 2.54; // (2.54 cm/in)
-            break;
-        case CSSPrimitiveValue::CSS_DPCM:
-            factor = 2.54 / cssPixelsPerInch; // (2.54 cm/in)
-            break;
-        case CSSPrimitiveValue::CSS_MM:
-            factor = cssPixelsPerInch / 25.4;
-            break;
-        case CSSPrimitiveValue::CSS_IN:
-            factor = cssPixelsPerInch;
-            break;
-        case CSSPrimitiveValue::CSS_DPI:
-            factor = 1 / cssPixelsPerInch;
-            break;
-        case CSSPrimitiveValue::CSS_PT:
-            factor = cssPixelsPerInch / 72.0;
-            break;
-        case CSSPrimitiveValue::CSS_PC:
-            factor = cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
-            break;
-        case CSSPrimitiveValue::CSS_RAD:
-            factor = 180 / piDouble;
-            break;
-        case CSSPrimitiveValue::CSS_GRAD:
-            factor = 0.9;
-            break;
-        case CSSPrimitiveValue::CSS_TURN:
-            factor = 360;
-            break;
-        case CSSPrimitiveValue::CSS_S:
-        case CSSPrimitiveValue::CSS_KHZ:
-            factor = 1000;
-            break;
-        default:
-            break;
+    // These are "canonical" units in their respective categories.
+    case CSS_PX:
+    case CSS_DEG:
+    case CSS_MS:
+    case CSS_HZ:
+        break;
+    case CSS_CM:
+        factor = cssPixelsPerInch / 2.54; // (2.54 cm/in)
+        break;
+    case CSS_DPCM:
+        factor = 2.54 / cssPixelsPerInch; // (2.54 cm/in)
+        break;
+    case CSS_MM:
+        factor = cssPixelsPerInch / 25.4;
+        break;
+    case CSS_IN:
+        factor = cssPixelsPerInch;
+        break;
+    case CSS_DPI:
+        factor = 1 / cssPixelsPerInch;
+        break;
+    case CSS_PT:
+        factor = cssPixelsPerInch / 72.0;
+        break;
+    case CSS_PC:
+        factor = cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
+        break;
+    case CSS_RAD:
+        factor = 180 / piDouble;
+        break;
+    case CSS_GRAD:
+        factor = 0.9;
+        break;
+    case CSS_TURN:
+        factor = 360;
+        break;
+    case CSS_S:
+    case CSS_KHZ:
+        factor = 1000;
+        break;
+    default:
+        break;
     }
 
     return factor;
@@ -653,7 +653,7 @@
     double result = 0;
     bool success = getDoubleValueInternal(static_cast<UnitTypes>(unitType), &result);
     if (!success) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0.0;
     }
 
@@ -754,7 +754,7 @@
     // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
     // No other engine supports mutating style through this API. Computed style is always read-only anyway.
     // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 String CSSPrimitiveValue::getStringValue(ExceptionCode& ec) const
@@ -771,7 +771,7 @@
         case CSS_PROPERTY_ID:
             return propertyName(m_value.propertyID);
         default:
-            ec = INVALID_ACCESS_ERR;
+            ec = InvalidAccessError;
             break;
     }
 
@@ -801,7 +801,7 @@
 {
     ec = 0;
     if (m_primitiveUnitType != CSS_COUNTER) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -812,7 +812,7 @@
 {
     ec = 0;
     if (m_primitiveUnitType != CSS_RECT) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -823,7 +823,7 @@
 {
     ec = 0;
     if (m_primitiveUnitType != CSS_QUAD) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -834,7 +834,7 @@
 {
     ec = 0;
     if (m_primitiveUnitType != CSS_RGBCOLOR) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -846,7 +846,7 @@
 {
     ec = 0;
     if (m_primitiveUnitType != CSS_PAIR) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
diff --git a/Source/core/css/CSSPrimitiveValueMappings.h b/Source/core/css/CSSPrimitiveValueMappings.h
index d9a01fb..a9fb25e 100644
--- a/Source/core/css/CSSPrimitiveValueMappings.h
+++ b/Source/core/css/CSSPrimitiveValueMappings.h
@@ -47,8 +47,7 @@
 #include "core/rendering/style/LineClampValue.h"
 #include "core/rendering/style/RenderStyleConstants.h"
 #include "core/rendering/style/SVGRenderStyleDefs.h"
-
-#include <wtf/MathExtras.h>
+#include "wtf/MathExtras.h"
 
 namespace WebCore {
 
@@ -2301,7 +2300,6 @@
     }
 }
 
-#if ENABLE(CSS3_TEXT)
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAlignLast e)
     : CSSValue(PrimitiveClass)
 {
@@ -2355,7 +2353,6 @@
     ASSERT_NOT_REACHED();
     return TextAlignLastAuto;
 }
-#endif // CSS3_TEXT
 
 template<> inline CSSPrimitiveValue::operator TextDecoration() const
 {
diff --git a/Source/core/css/CSSProperties.in b/Source/core/css/CSSProperties.in
index cefab14..5fb8090 100644
--- a/Source/core/css/CSSProperties.in
+++ b/Source/core/css/CSSProperties.in
@@ -17,19 +17,38 @@
 background-repeat-y custom_all
 background-size custom_all
 border-bottom-color custom_all
+border-bottom-left-radius initial=initialBorderRadius, custom_value
+border-bottom-right-radius initial=initialBorderRadius, custom_value
 border-bottom-style type_name=EBorderStyle, initial=initialBorderStyle
+border-bottom-width type_name=unsigned, initial=initialBorderWidth, custom_value
 border-collapse
+border-image-outset custom_all
+border-image-repeat custom_all
+border-image-slice custom_all
+border-image-source custom_value
+border-image-width custom_all
 border-left-color custom_all
 border-left-style type_name=EBorderStyle, initial=initialBorderStyle
+border-left-width type_name=unsigned, initial=initialBorderWidth, custom_value
 border-right-color custom_all
 border-right-style type_name=EBorderStyle, initial=initialBorderStyle
+border-right-width type_name=unsigned, initial=initialBorderWidth, custom_value
 border-top-color custom_all
+border-top-left-radius initial=initialBorderRadius, custom_value
+border-top-right-radius initial=initialBorderRadius, custom_value
 border-top-style type_name=EBorderStyle, initial=initialBorderStyle
+border-top-width type_name=unsigned, initial=initialBorderWidth, custom_value
 bottom apply_type=length, initial=initialOffset, use_auto
 box-sizing
 caption-side
 clear
+clip custom_all
 color custom_all
+counter-increment custom_all
+counter-reset custom_all
+cursor custom_all
+direction custom_value
+display custom_inherit, custom_value
 empty-cells type_name=EEmptyCell
 flex-basis apply_type=length, use_auto
 flex-direction
@@ -37,11 +56,19 @@
 flex-shrink type_name=float
 flex-wrap
 float type_name=EFloat, name_for_methods=Floating
+font-family custom_all
+font-size custom_all
+font-style custom_all
+font-variant custom_all
+font-weight custom_all
 grid-auto-flow type_name=GridAutoFlow
 height apply_type=length, initial=initialSize, use_auto, use_intrinsic
 justify-content
 image-rendering
 left apply_type=length, initial=initialOffset, use_auto
+letter-spacing type_name=float, initial=initialLetterWordSpacing, custom_value
+line-height getter=specifiedLineHeight, custom_value
+list-style-image type_name=StyleImage*, custom_value
 list-style-position
 list-style-type
 margin-bottom apply_type=length, initial=initialMargin, use_auto
@@ -50,13 +77,16 @@
 margin-top apply_type=length, initial=initialMargin, use_auto
 max-height apply_type=length, initial=initialMaxSize, use_auto, use_intrinsic, use_none
 max-width apply_type=length, initial=initialMaxSize, use_auto, use_intrinsic, use_none
-min-height apply_type=length, initial=initialMinSize, use_auto, use_intrinsic, use_none
+min-height apply_type=length, initial=initialMinSize, use_auto, use_intrinsic
 min-width apply_type=length, initial=initialMinSize, use_auto, use_intrinsic
 mix-blend-mode type_name=BlendMode, name_for_methods=BlendMode
 opacity type_name=float
 order type_name=int
 orphans type_name=short, custom_all
 outline-color custom_all
+outline-offset type_name=int, custom_value
+outline-style custom_all
+outline-width type_name=unsigned short, custom_value
 overflow-wrap
 overflow-x type_name=EOverflow
 overflow-y type_name=EOverflow
@@ -69,22 +99,32 @@
 page-break-inside type_name=EPageBreak, initial=initialPageBreak
 pointer-events
 position
+resize custom_value
 right apply_type=length, initial=initialOffset, use_auto
+size custom_all
 speak
 table-layout
 tab-size type_name=unsigned
+text-align custom_value
+text-align-last type_name=TextAlignLast
+text-decoration custom_value
+text-decoration-line use_handlers_for=CSSPropertyTextDecoration
 text-decoration-color custom_all
 text-decoration-style type_name=TextDecorationStyle
+text-indent custom_all
 text-overflow type_name=TextOverflow
+text-rendering custom_all
 text-transform
 top apply_type=length, initial=initialOffset, use_auto
 touch-action type_name=TouchAction, initial=initialTouchAction
 unicode-bidi
+vertical-align custom_value
 visibility
 white-space
 widows type_name=short, custom_all
 width apply_type=length, initial=initialSize, use_auto, use_intrinsic
 word-break
+word-spacing type_name=float, initial=initialLetterWordSpacing, custom_value
 // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
 word-wrap name_for_methods=OverflowWrap
 zoom custom_all
@@ -99,13 +139,16 @@
 -webkit-animation-play-state custom_all
 -webkit-animation-timing-function custom_all
 -webkit-appearance type_name=ControlPart
+-webkit-aspect-ratio custom_all
 -webkit-backface-visibility
 -webkit-background-clip use_handlers_for=CSSPropertyBackgroundClip
 -webkit-background-composite custom_all
 -webkit-background-origin use_handlers_for=CSSPropertyBackgroundOrigin
 -webkit-background-size use_handlers_for=CSSPropertyBackgroundSize
 -webkit-border-fit
+-webkit-border-horizontal-spacing type_name=short, name_for_methods=HorizontalBorderSpacing, custom_value
 -webkit-border-image initial=initialNinePieceImage, custom_value
+-webkit-border-vertical-spacing type_name=short, name_for_methods=VerticalBorderSpacing, custom_value
 -webkit-box-align type_name=EBoxAlignment
 -webkit-box-decoration-break
 -webkit-box-direction
@@ -115,6 +158,7 @@
 -webkit-box-ordinal-group type_name=unsigned int
 -webkit-box-orient
 -webkit-box-pack
+-webkit-clip-path custom_value
 -webkit-column-axis type_name=ColumnAxis
 -webkit-column-break-after type_name=EPageBreak, initial=initialPageBreak
 -webkit-column-break-before type_name=EPageBreak, initial=initialPageBreak
@@ -124,10 +168,14 @@
 -webkit-column-progression type_name=ColumnProgression
 -webkit-column-rule-color custom_all
 -webkit-column-rule-style type_name=EBorderStyle, initial=initialBorderStyle
+-webkit-column-rule-width type_name=unsigned short, custom_value
 -webkit-column-span type_name=ColumnSpan
 -webkit-column-width type_name=float, custom_all
 -webkit-flow-from type_name=const AtomicString&, name_for_methods=RegionThread, custom_value
 -webkit-flow-into type_name=const AtomicString&, name_for_methods=FlowThread, custom_value
+-webkit-font-kerning custom_all
+-webkit-font-smoothing custom_all
+-webkit-font-variant-ligatures custom_all
 -webkit-highlight type_name=const AtomicString&, custom_value
 -webkit-hyphenate-character type_name=const AtomicString&, name_for_methods=HyphenationString, custom_value
 -webkit-hyphenate-limit-after type_name=short, name_for_methods=HyphenationLimitAfter, custom_value
@@ -146,8 +194,14 @@
 -webkit-marquee-direction
 -webkit-marquee-increment custom_value
 -webkit-marquee-repetition type_name=int, name_for_methods=MarqueeLoopCount, custom_value
+-webkit-marquee-speed custom_value
 -webkit-marquee-style name_for_methods=MarqueeBehavior
 -webkit-mask-box-image initial=initialNinePieceImage, custom_value
+-webkit-mask-box-image-outset custom_all
+-webkit-mask-box-image-repeat custom_all
+-webkit-mask-box-image-slice custom_all
+-webkit-mask-box-image-source custom_value
+-webkit-mask-box-image-width custom_all
 -webkit-mask-clip custom_all
 -webkit-mask-composite custom_all
 -webkit-mask-image custom_all
@@ -157,6 +211,7 @@
 -webkit-mask-repeat-x custom_all
 -webkit-mask-repeat-y custom_all
 -webkit-mask-size custom_all
+-webkit-perspective-origin custom_all
 -webkit-perspective-origin-x apply_type=length
 -webkit-perspective-origin-y apply_type=length
 -webkit-print-color-adjust type_name=PrintColorAdjust
@@ -166,17 +221,21 @@
 -webkit-region-fragment type_name=RegionFragment
 -webkit-rtl-ordering type_name=Order, getter=rtlOrdering, setter=setRTLOrdering, initial=initialRTLOrdering
 -webkit-ruby-position type_name=RubyPosition
+-webkit-shape-inside type_name=ShapeValue*, custom_value
 -webkit-shape-margin apply_type=length
+-webkit-shape-outside type_name=ShapeValue*, custom_value
 -webkit-shape-padding apply_type=length
--webkit-text-align-last type_name=TextAlignLast, condition=CSS3_TEXT
 -webkit-text-combine type_name=TextCombine
 -webkit-text-emphasis-color custom_all
 -webkit-text-emphasis-position type_name=TextEmphasisPosition
+-webkit-text-emphasis-style custom_all
 -webkit-text-fill-color custom_all
 -webkit-text-security
 -webkit-text-stroke-color custom_all
+-webkit-text-underline-position custom_value, condition=CSS3_TEXT
 -webkit-transform-origin-x apply_type=length
 -webkit-transform-origin-y apply_type=length
+-webkit-transform-origin-z type_name=float, custom_value
 -webkit-transform-style name_for_methods=TransformStyle3D
 -webkit-transition-delay custom_all
 -webkit-transition-duration custom_all
diff --git a/Source/core/css/CSSProperty.cpp b/Source/core/css/CSSProperty.cpp
index 57f9439..8f07ff8 100644
--- a/Source/core/css/CSSProperty.cpp
+++ b/Source/core/css/CSSProperty.cpp
@@ -309,6 +309,7 @@
     case CSSPropertyStrokeWidth:
     case CSSPropertyTabSize:
     case CSSPropertyTextAlign:
+    case CSSPropertyTextAlignLast:
     case CSSPropertyTextAnchor:
     case CSSPropertyTextDecoration:
     case CSSPropertyTextDecorationLine:
@@ -344,7 +345,6 @@
     case CSSPropertyWebkitTapHighlightColor:
     case CSSPropertyWebkitTextCombine:
 #if ENABLE(CSS3_TEXT)
-    case CSSPropertyWebkitTextAlignLast:
     case CSSPropertyWebkitTextUnderlinePosition:
 #endif // CSS3_TEXT
     case CSSPropertyWebkitTextDecorationsInEffect:
diff --git a/Source/core/css/CSSPropertyNames.in b/Source/core/css/CSSPropertyNames.in
index 7faa2a5..b88b1a3 100644
--- a/Source/core/css/CSSPropertyNames.in
+++ b/Source/core/css/CSSPropertyNames.in
@@ -8,8 +8,29 @@
 // http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp
 //
 
-// high-priority property names have to be listed first, to simplify the check
-// for applying them first.
+// properties that generate animations must be listed first
+-webkit-animation
+-webkit-animation-delay
+-webkit-animation-direction
+-webkit-animation-duration
+-webkit-animation-fill-mode
+-webkit-animation-iteration-count
+-webkit-animation-name
+-webkit-animation-play-state
+-webkit-animation-timing-function
+-webkit-transition
+-webkit-transition-delay
+-webkit-transition-duration
+-webkit-transition-property
+-webkit-transition-timing-function
+transition
+transition-delay
+transition-duration
+transition-property
+transition-timing-function
+
+// next, high-priority properties (those on which other properties can depend)
+// must be listed
 color
 direction
 display
@@ -155,6 +176,7 @@
 table-layout
 tab-size
 text-align
+text-align-last
 text-decoration
 text-decoration-line
 text-decoration-style
@@ -178,11 +200,6 @@
 text-underline-width
 top
 touch-action
-transition
-transition-delay
-transition-duration
-transition-property
-transition-timing-function
 
 unicode-bidi
 unicode-range
@@ -196,15 +213,6 @@
 word-spacing
 word-wrap
 z-index
--webkit-animation
--webkit-animation-delay
--webkit-animation-direction
--webkit-animation-duration
--webkit-animation-fill-mode
--webkit-animation-iteration-count
--webkit-animation-name
--webkit-animation-play-state
--webkit-animation-timing-function
 -webkit-appearance
 -webkit-aspect-ratio
 -webkit-backface-visibility
@@ -367,7 +375,6 @@
 -webkit-ruby-position
 -webkit-text-combine
 -epub-text-combine alias_for=-webkit-text-combine
--webkit-text-align-last condition=CSS3_TEXT
 -webkit-text-underline-position condition=CSS3_TEXT
 -webkit-text-decorations-in-effect
 -webkit-text-emphasis
@@ -388,11 +395,6 @@
 -webkit-transform-origin-y
 -webkit-transform-origin-z
 -webkit-transform-style
--webkit-transition
--webkit-transition-delay
--webkit-transition-duration
--webkit-transition-property
--webkit-transition-timing-function
 -webkit-user-drag
 -webkit-user-modify
 -webkit-user-select
@@ -414,4 +416,3 @@
 user-zoom
 -webkit-tap-highlight-color
 -webkit-app-region
--webkit-overflow-scrolling condition=ACCELERATED_OVERFLOW_SCROLLING
diff --git a/Source/core/css/CSSPropertySourceData.cpp b/Source/core/css/CSSPropertySourceData.cpp
index 4c0a233..87a77ff 100644
--- a/Source/core/css/CSSPropertySourceData.cpp
+++ b/Source/core/css/CSSPropertySourceData.cpp
@@ -36,9 +36,9 @@
 
 #include "core/css/CSSPropertySourceData.h"
 
-#include <wtf/StaticConstructors.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/StringHash.h>
+#include "wtf/StaticConstructors.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSRule.h b/Source/core/css/CSSRule.h
index 1c8862d..8ccaa71 100644
--- a/Source/core/css/CSSRule.h
+++ b/Source/core/css/CSSRule.h
@@ -24,7 +24,7 @@
 #define CSSRule_h
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSSVGDocumentValue.cpp b/Source/core/css/CSSSVGDocumentValue.cpp
index d372374..3ee53a1 100644
--- a/Source/core/css/CSSSVGDocumentValue.cpp
+++ b/Source/core/css/CSSSVGDocumentValue.cpp
@@ -26,13 +26,13 @@
 
 #include "core/css/CSSSVGDocumentValue.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/CSSParser.h"
 #include "core/dom/Document.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedDocument.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
     if (!m_loadRequested) {
         m_loadRequested = true;
 
-        CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)), cachedResourceRequestInitiators().css);
+        CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)), CachedResourceInitiatorTypeNames::css);
         m_document = loader->requestSVGDocument(request);
     }
 
diff --git a/Source/core/css/CSSSelector.cpp b/Source/core/css/CSSSelector.cpp
index 9d471fb..5abb5e2 100644
--- a/Source/core/css/CSSSelector.cpp
+++ b/Source/core/css/CSSSelector.cpp
@@ -161,6 +161,8 @@
         return BEFORE;
     case PseudoAfter:
         return AFTER;
+    case PseudoBackdrop:
+        return BACKDROP;
     case PseudoScrollbar:
         return SCROLLBAR;
     case PseudoScrollbarButton:
@@ -262,6 +264,7 @@
     DEFINE_STATIC_LOCAL(AtomicString, any, ("-webkit-any(", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, backdrop, ("backdrop", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, before, ("before", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default", AtomicString::ConstructFromLiteral));
@@ -342,6 +345,7 @@
         nameToPseudoType->set(anyLink.impl(), CSSSelector::PseudoAnyLink);
         nameToPseudoType->set(any.impl(), CSSSelector::PseudoAny);
         nameToPseudoType->set(autofill.impl(), CSSSelector::PseudoAutofill);
+        nameToPseudoType->set(backdrop.impl(), CSSSelector::PseudoBackdrop);
         nameToPseudoType->set(before.impl(), CSSSelector::PseudoBefore);
         nameToPseudoType->set(checked.impl(), CSSSelector::PseudoChecked);
         nameToPseudoType->set(defaultString.impl(), CSSSelector::PseudoDefault);
@@ -453,6 +457,7 @@
     case PseudoFirstLetter:
     case PseudoFirstLine:
         compat = true;
+    case PseudoBackdrop:
     case PseudoDistributed:
     case PseudoResizer:
     case PseudoScrollbar:
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index 6a460c8..1eafd5f 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -121,6 +121,7 @@
             PseudoTarget,
             PseudoBefore,
             PseudoAfter,
+            PseudoBackdrop,
             PseudoLang,
             PseudoNot,
             PseudoResizer,
diff --git a/Source/core/css/CSSSelectorList.cpp b/Source/core/css/CSSSelectorList.cpp
index c9c496f..16ee91c 100644
--- a/Source/core/css/CSSSelectorList.cpp
+++ b/Source/core/css/CSSSelectorList.cpp
@@ -29,7 +29,7 @@
 
 #include "core/css/CSSParserValues.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSShaderValue.cpp b/Source/core/css/CSSShaderValue.cpp
index d3db8e1..24ac777 100644
--- a/Source/core/css/CSSShaderValue.cpp
+++ b/Source/core/css/CSSShaderValue.cpp
@@ -31,12 +31,12 @@
 
 #include "core/css/CSSShaderValue.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/CSSParser.h"
 #include "core/dom/Document.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/rendering/style/StyleCachedShader.h"
 #include "core/rendering/style/StylePendingShader.h"
 
@@ -65,7 +65,7 @@
     if (!m_accessedShader) {
         m_accessedShader = true;
 
-        CachedResourceRequest request(ResourceRequest(completeURL(loader)), cachedResourceRequestInitiators().css);
+        CachedResourceRequest request(ResourceRequest(completeURL(loader)), CachedResourceInitiatorTypeNames::css);
         if (CachedResourceHandle<CachedShader> cachedShader = loader->requestShader(request))
             m_shader = StyleCachedShader::create(cachedShader.get());
     }
diff --git a/Source/core/css/CSSStyleDeclaration.h b/Source/core/css/CSSStyleDeclaration.h
index 68405ad..ee81abd 100644
--- a/Source/core/css/CSSStyleDeclaration.h
+++ b/Source/core/css/CSSStyleDeclaration.h
@@ -23,7 +23,7 @@
 
 #include "CSSPropertyNames.h"
 #include "bindings/v8/ScriptWrappable.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSStyleRule.cpp b/Source/core/css/CSSStyleRule.cpp
index ee4049c..b48304f 100644
--- a/Source/core/css/CSSStyleRule.cpp
+++ b/Source/core/css/CSSStyleRule.cpp
@@ -29,7 +29,7 @@
 #include "core/css/StylePropertySet.h"
 #include "core/css/StyleRule.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index b6e9184..735485f 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -21,8 +21,6 @@
 #include "config.h"
 #include "core/css/CSSStyleSheet.h"
 
-#include <wtf/MemoryInstrumentationVector.h>
-#include <wtf/text/StringBuilder.h>
 #include "HTMLNames.h"
 #include "SVGNames.h"
 #include "core/css/CSSCharsetRule.h"
@@ -37,6 +35,8 @@
 #include "core/dom/Node.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "weborigin/SecurityOrigin.h"
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -164,7 +164,7 @@
     Document* owner = ownerDocument();
     if (!owner)
         return;
-    owner->styleResolverChanged(DeferRecalcStyle);
+    owner->modifiedStyleSheet(this);
 }
 
 void CSSStyleSheet::reattachChildRuleCSSOMWrappers()
@@ -271,21 +271,21 @@
 
     ec = 0;
     if (index > length()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
     CSSParser p(m_contents->parserContext(), UseCounter::getFrom(this));
     RefPtr<StyleRuleBase> rule = p.parseRule(m_contents.get(), ruleString);
 
     if (!rule) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
     RuleMutationScope mutationScope(this);
 
     bool success = m_contents->wrapperInsertRule(rule, index);
     if (!success) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return 0;
     }        
     if (!m_childRuleCSSOMWrappers.isEmpty())
@@ -300,7 +300,7 @@
 
     ec = 0;
     if (index >= length()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
     RuleMutationScope mutationScope(this);
diff --git a/Source/core/css/CSSStyleSheet.h b/Source/core/css/CSSStyleSheet.h
index 37f83ab..9cdac7b 100644
--- a/Source/core/css/CSSStyleSheet.h
+++ b/Source/core/css/CSSStyleSheet.h
@@ -73,7 +73,7 @@
     CSSRule* item(unsigned index);
 
     virtual void clearOwnerNode() OVERRIDE { didMutate(); m_ownerNode = 0; }
-    virtual CSSImportRule* ownerRule() const OVERRIDE { return m_ownerRule; }
+    virtual CSSRule* ownerRule() const OVERRIDE { return m_ownerRule; }
     virtual KURL baseURL() const OVERRIDE;
     virtual bool isLoading() const OVERRIDE;
     
@@ -124,7 +124,7 @@
     RefPtr<MediaQuerySet> m_mediaQueries;
 
     Node* m_ownerNode;
-    CSSImportRule* m_ownerRule;
+    CSSRule* m_ownerRule;
 
     TextPosition m_startPosition;
 
diff --git a/Source/core/css/CSSTimingFunctionValue.cpp b/Source/core/css/CSSTimingFunctionValue.cpp
index bad6acf..17ad224 100644
--- a/Source/core/css/CSSTimingFunctionValue.cpp
+++ b/Source/core/css/CSSTimingFunctionValue.cpp
@@ -27,7 +27,7 @@
 #include "core/css/CSSTimingFunctionValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSTimingFunctionValue.h b/Source/core/css/CSSTimingFunctionValue.h
index d0522b5..6540dc3 100644
--- a/Source/core/css/CSSTimingFunctionValue.h
+++ b/Source/core/css/CSSTimingFunctionValue.h
@@ -27,7 +27,7 @@
 #define CSSTimingFunctionValue_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSToStyleMap.cpp b/Source/core/css/CSSToStyleMap.cpp
index 156b4c2..2fb8595 100644
--- a/Source/core/css/CSSToStyleMap.cpp
+++ b/Source/core/css/CSSToStyleMap.cpp
@@ -35,7 +35,7 @@
 #include "core/css/CSSTimingFunctionValue.h"
 #include "core/css/Pair.h"
 #include "core/css/Rect.h"
-#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/StyleResolverState.h"
 #include "core/platform/animation/CSSAnimationData.h"
 #include "core/rendering/style/FillLayer.h"
 
@@ -43,25 +43,25 @@
 
 RenderStyle* CSSToStyleMap::style() const
 {
-    return m_resolver->style();
+    return m_state.style();
 }
     
 RenderStyle* CSSToStyleMap::rootElementStyle() const
 {
-    return m_resolver->rootElementStyle();
+    return m_state.rootElementStyle();
 }
 
 bool CSSToStyleMap::useSVGZoomRules() const
 {
-    return m_resolver->useSVGZoomRules();
+    return m_state.useSVGZoomRules();
 }
     
 PassRefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue* value)
 {
-    return m_resolver->styleImage(propertyId, value);
+    return m_elementStyleResources.styleImage(m_state.document()->textLinkColors(), m_state.style()->visitedDependentColor(CSSPropertyColor), propertyId, value);
 }
 
-void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setAttachment(FillLayer::initialFillAttachment(layer->type()));
@@ -87,7 +87,7 @@
     }
 }
 
-void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setClip(FillLayer::initialFillClip(layer->type()));
@@ -101,7 +101,7 @@
     layer->setClip(*primitiveValue);
 }
 
-void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setComposite(FillLayer::initialFillComposite(layer->type()));
@@ -115,7 +115,7 @@
     layer->setComposite(*primitiveValue);
 }
 
-void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setBlendMode(FillLayer::initialFillBlendMode(layer->type()));
@@ -129,7 +129,7 @@
     layer->setBlendMode(*primitiveValue);
 }
 
-void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setOrigin(FillLayer::initialFillOrigin(layer->type()));
@@ -154,7 +154,7 @@
     layer->setImage(styleImage(property, value));
 }
 
-void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
@@ -168,7 +168,7 @@
     layer->setRepeatX(*primitiveValue);
 }
 
-void CSSToStyleMap::mapFillRepeatY(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillRepeatY(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
@@ -182,7 +182,7 @@
     layer->setRepeatY(*primitiveValue);
 }
 
-void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value) const
 {
     if (!value->isPrimitiveValue()) {
         layer->setSizeType(SizeNone);
@@ -225,7 +225,7 @@
     layer->setSizeLength(b);
 }
 
-void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setXPosition(FillLayer::initialFillXPosition(layer->type()));
@@ -261,7 +261,7 @@
         layer->setBackgroundXOrigin(*(pair->first()));
 }
 
-void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer* layer, CSSValue* value)
+void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setYPosition(FillLayer::initialFillYPosition(layer->type()));
@@ -297,7 +297,7 @@
         layer->setBackgroundYOrigin(*(pair->first()));
 }
 
-void CSSToStyleMap::mapAnimationDelay(CSSAnimationData* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationDelay(CSSAnimationData* animation, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         animation->setDelay(CSSAnimationData::initialAnimationDelay());
@@ -311,7 +311,7 @@
     animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
-void CSSToStyleMap::mapAnimationDirection(CSSAnimationData* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationDirection(CSSAnimationData* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setDirection(CSSAnimationData::initialAnimationDirection());
@@ -340,7 +340,7 @@
     }
 }
 
-void CSSToStyleMap::mapAnimationDuration(CSSAnimationData* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationDuration(CSSAnimationData* animation, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         animation->setDuration(CSSAnimationData::initialAnimationDuration());
@@ -354,7 +354,7 @@
     animation->setDuration(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
-void CSSToStyleMap::mapAnimationFillMode(CSSAnimationData* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationFillMode(CSSAnimationData* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setFillMode(CSSAnimationData::initialAnimationFillMode());
@@ -383,7 +383,7 @@
     }
 }
 
-void CSSToStyleMap::mapAnimationIterationCount(CSSAnimationData* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationIterationCount(CSSAnimationData* animation, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         animation->setIterationCount(CSSAnimationData::initialAnimationIterationCount());
@@ -400,7 +400,7 @@
         animation->setIterationCount(primitiveValue->getFloatValue());
 }
 
-void CSSToStyleMap::mapAnimationName(CSSAnimationData* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationName(CSSAnimationData* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setName(CSSAnimationData::initialAnimationName());
@@ -417,7 +417,7 @@
         layer->setName(primitiveValue->getStringValue());
 }
 
-void CSSToStyleMap::mapAnimationPlayState(CSSAnimationData* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationPlayState(CSSAnimationData* layer, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         layer->setPlayState(CSSAnimationData::initialAnimationPlayState());
@@ -432,7 +432,7 @@
     layer->setPlayState(playState);
 }
 
-void CSSToStyleMap::mapAnimationProperty(CSSAnimationData* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationProperty(CSSAnimationData* animation, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         animation->setAnimationMode(CSSAnimationData::AnimateAll);
@@ -456,7 +456,7 @@
     }
 }
 
-void CSSToStyleMap::mapAnimationTimingFunction(CSSAnimationData* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationTimingFunction(CSSAnimationData* animation, CSSValue* value) const
 {
     if (value->isInitialValue()) {
         animation->setTimingFunction(CSSAnimationData::initialAnimationTimingFunction());
@@ -562,7 +562,7 @@
     }
 }
 
-void CSSToStyleMap::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& image)
+void CSSToStyleMap::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& image) const
 {
     if (!value || !value->isBorderImageSliceValue())
         return;
@@ -595,7 +595,7 @@
     image.setFill(borderImageSlice->m_fill);
 }
 
-LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value)
+LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) const
 {
     if (!value || !value->isPrimitiveValue())
         return LengthBox();
@@ -640,7 +640,7 @@
     return box;
 }
 
-void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& image)
+void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& image) const
 {
     if (!value || !value->isPrimitiveValue())
         return;
diff --git a/Source/core/css/CSSToStyleMap.h b/Source/core/css/CSSToStyleMap.h
index 50e12ac..3c39f83 100644
--- a/Source/core/css/CSSToStyleMap.h
+++ b/Source/core/css/CSSToStyleMap.h
@@ -23,8 +23,9 @@
 #define CSSToStyleMap_h
 
 #include "CSSPropertyNames.h"
+#include "core/css/resolver/ElementStyleResources.h"
 #include "core/platform/LengthBox.h"
-#include <wtf/Noncopyable.h>
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
@@ -33,57 +34,60 @@
 class CSSAnimationData;
 class RenderStyle;
 class StyleImage;
-class StyleResolver;
+class StyleResolverState;
 class NinePieceImage;
 
+// CSSToStyleMap is a short-lived helper object which
+// given the current StyleResolverState can map
+// CSSValue objects into their RenderStyle equivalents.
+
 class CSSToStyleMap {
     WTF_MAKE_NONCOPYABLE(CSSToStyleMap);
-    WTF_MAKE_FAST_ALLOCATED;
-
 public:
-    CSSToStyleMap(StyleResolver* resolver) : m_resolver(resolver) { }
+    // FIXME: This could be const StyleResolverState
+    // except styleImage can include a gradient, which
+    // may resolve a color and may need to flip bits
+    // on StyleResolverState.
+    CSSToStyleMap(const StyleResolverState& state, ElementStyleResources& elementStyleResources) : m_state(state), m_elementStyleResources(elementStyleResources) { }
 
-    void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillBlendMode(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*);
+    void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillBlendMode(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*) const;
     void mapFillImage(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillRepeatY(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillSize(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillXPosition(CSSPropertyID, FillLayer*, CSSValue*);
-    void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*);
+    void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillRepeatY(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillSize(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillXPosition(CSSPropertyID, FillLayer*, CSSValue*) const;
+    void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*) const;
 
-    void mapAnimationDelay(CSSAnimationData*, CSSValue*);
-    void mapAnimationDirection(CSSAnimationData*, CSSValue*);
-    void mapAnimationDuration(CSSAnimationData*, CSSValue*);
-    void mapAnimationFillMode(CSSAnimationData*, CSSValue*);
-    void mapAnimationIterationCount(CSSAnimationData*, CSSValue*);
-    void mapAnimationName(CSSAnimationData*, CSSValue*);
-    void mapAnimationPlayState(CSSAnimationData*, CSSValue*);
-    void mapAnimationProperty(CSSAnimationData*, CSSValue*);
-    void mapAnimationTimingFunction(CSSAnimationData*, CSSValue*);
+    void mapAnimationDelay(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationDirection(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationDuration(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationFillMode(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationIterationCount(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationName(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationPlayState(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationProperty(CSSAnimationData*, CSSValue*) const;
+    void mapAnimationTimingFunction(CSSAnimationData*, CSSValue*) const;
 
     void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
-    void mapNinePieceImageSlice(CSSValue*, NinePieceImage&);
-    LengthBox mapNinePieceImageQuad(CSSValue*);
-    void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&);
+    void mapNinePieceImageSlice(CSSValue*, NinePieceImage&) const;
+    LengthBox mapNinePieceImageQuad(CSSValue*) const;
+    void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&) const;
 
 private:
-    // FIXME: These accessors should be replaced by a ResolveState object
-    // similar to how PaintInfo/LayoutState cache values needed for
-    // the current paint/layout.
     RenderStyle* style() const;
     RenderStyle* rootElementStyle() const;
     bool useSVGZoomRules() const;
 
-    // FIXME: This should be part of some sort of StyleImageCache object which
-    // is held by the StyleResolver, and likely provided to this object
-    // during the resolve.
     PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*);
 
-    StyleResolver* m_resolver;
+    // FIXME: Consider passing a StyleResolverState (or ElementResolveState)
+    // as an argument instead of caching it on this object.
+    const StyleResolverState& m_state;
+    ElementStyleResources& m_elementStyleResources;
 };
 
 }
diff --git a/Source/core/css/CSSUnicodeRangeValue.cpp b/Source/core/css/CSSUnicodeRangeValue.cpp
index 996755f..2be7634 100644
--- a/Source/core/css/CSSUnicodeRangeValue.cpp
+++ b/Source/core/css/CSSUnicodeRangeValue.cpp
@@ -27,7 +27,7 @@
 #include "core/css/CSSUnicodeRangeValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSValueKeywords.in b/Source/core/css/CSSValueKeywords.in
index a7d1e7e..445b11d 100644
--- a/Source/core/css/CSSValueKeywords.in
+++ b/Source/core/css/CSSValueKeywords.in
@@ -843,10 +843,6 @@
 manual
 // auto
 
-// -webkit-overflow-scrolling
-// auto
-touch condition=ACCELERATED_OVERFLOW_SCROLLING
-
 // -webkit-writing-mode
 // SVG compatibility
 lr
diff --git a/Source/core/css/CSSValueList.h b/Source/core/css/CSSValueList.h
index ef47a42..c6cd508 100644
--- a/Source/core/css/CSSValueList.h
+++ b/Source/core/css/CSSValueList.h
@@ -22,8 +22,8 @@
 #define CSSValueList_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/DOMWindowCSS.cpp b/Source/core/css/DOMWindowCSS.cpp
index 4f37fb0..b417c4a 100644
--- a/Source/core/css/DOMWindowCSS.cpp
+++ b/Source/core/css/DOMWindowCSS.cpp
@@ -33,7 +33,7 @@
 #include "core/css/CSSParser.h"
 #include "core/css/StylePropertySet.h"
 #include "core/page/RuntimeCSSEnabled.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/DOMWindowCSS.h b/Source/core/css/DOMWindowCSS.h
index 6116b14..e6c6d19 100644
--- a/Source/core/css/DOMWindowCSS.h
+++ b/Source/core/css/DOMWindowCSS.h
@@ -30,9 +30,9 @@
 #ifndef DOMWindowCSS_h
 #define DOMWindowCSS_h
 
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/DeprecatedStyleBuilder.cpp b/Source/core/css/DeprecatedStyleBuilder.cpp
deleted file mode 100644
index 1553246..0000000
--- a/Source/core/css/DeprecatedStyleBuilder.cpp
+++ /dev/null
@@ -1,1621 +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.
- */
-
-#include "config.h"
-#include "core/css/DeprecatedStyleBuilder.h"
-
-#include "core/css/BasicShapeFunctions.h"
-#include "core/css/CSSAspectRatioValue.h"
-#include "core/css/CSSCalculationValue.h"
-#include "core/css/CSSCursorImageValue.h"
-#include "core/css/CSSPrimitiveValueMappings.h"
-#include "core/css/CSSToStyleMap.h"
-#include "core/css/CSSValueList.h"
-#include "core/css/FontSize.h"
-#include "core/css/Pair.h"
-#include "core/css/Rect.h"
-#include "core/css/resolver/StyleResolver.h"
-#include "core/dom/Document.h"
-#include "core/dom/Element.h"
-#include "core/page/Settings.h"
-#include "core/rendering/ClipPathOperation.h"
-#include "core/rendering/RenderView.h"
-#include "core/rendering/style/BasicShapes.h"
-#include "core/rendering/style/CursorList.h"
-#include "core/rendering/style/RenderStyle.h"
-#include "core/rendering/style/ShapeValue.h"
-#include "wtf/StdLibExtras.h"
-#include "wtf/UnusedParam.h"
-
-using namespace std;
-
-namespace WebCore {
-
-enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
-template <ExpandValueBehavior expandValue, CSSPropertyID one = CSSPropertyInvalid, CSSPropertyID two = CSSPropertyInvalid, CSSPropertyID three = CSSPropertyInvalid, CSSPropertyID four = CSSPropertyInvalid, CSSPropertyID five = CSSPropertyInvalid>
-class ApplyPropertyExpanding {
-public:
-
-    template <CSSPropertyID id>
-    static inline void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        if (id == CSSPropertyInvalid)
-            return;
-
-        const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
-        const PropertyHandler& handler = table.propertyHandler(id);
-        if (handler.isValid())
-            handler.applyInheritValue(propertyID, styleResolver);
-    }
-
-    static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        applyInheritValue<one>(propertyID, styleResolver);
-        applyInheritValue<two>(propertyID, styleResolver);
-        applyInheritValue<three>(propertyID, styleResolver);
-        applyInheritValue<four>(propertyID, styleResolver);
-        applyInheritValue<five>(propertyID, styleResolver);
-    }
-
-    template <CSSPropertyID id>
-    static inline void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        if (id == CSSPropertyInvalid)
-            return;
-
-        const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
-        const PropertyHandler& handler = table.propertyHandler(id);
-        if (handler.isValid())
-            handler.applyInitialValue(propertyID, styleResolver);
-    }
-
-    static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        applyInitialValue<one>(propertyID, styleResolver);
-        applyInitialValue<two>(propertyID, styleResolver);
-        applyInitialValue<three>(propertyID, styleResolver);
-        applyInitialValue<four>(propertyID, styleResolver);
-        applyInitialValue<five>(propertyID, styleResolver);
-    }
-
-    template <CSSPropertyID id>
-    static inline void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (id == CSSPropertyInvalid)
-            return;
-
-        const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
-        const PropertyHandler& handler = table.propertyHandler(id);
-        if (handler.isValid())
-            handler.applyValue(propertyID, styleResolver, value);
-    }
-
-    static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!expandValue)
-            return;
-
-        applyValue<one>(propertyID, styleResolver, value);
-        applyValue<two>(propertyID, styleResolver, value);
-        applyValue<three>(propertyID, styleResolver, value);
-        applyValue<four>(propertyID, styleResolver, value);
-        applyValue<five>(propertyID, styleResolver, value);
-    }
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
-class ApplyPropertyDefaultBase {
-public:
-    static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
-    static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); }
-    static InitialType initial() { return (*initialFunction)(); }
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); }
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); }
-    static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*) { }
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
-class ApplyPropertyDefault {
-public:
-    static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (value->isPrimitiveValue())
-            setValue(styleResolver->style(), *toCSSPrimitiveValue(value));
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFunction, SetterType, setterFunction, InitialType, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction)(), CSSValueID idMapsToMinusOne = CSSValueAuto>
-class ApplyPropertyNumber {
-public:
-    static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        if (primitiveValue->getValueID() == idMapsToMinusOne)
-            setValue(styleResolver->style(), -1);
-        else
-            setValue(styleResolver->style(), primitiveValue->getValue<NumberType>(CSSPrimitiveValue::CSS_NUMBER));
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFunction, NumberType, setterFunction, NumberType, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
-class ApplyPropertyStyleImage {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyClip {
-private:
-    static Length convertToLength(StyleResolver* styleResolver, CSSPrimitiveValue* value)
-    {
-        return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
-    }
-public:
-    static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        RenderStyle* parentStyle = styleResolver->parentStyle();
-        if (!parentStyle->hasClip())
-            return applyInitialValue(propertyID, styleResolver);
-        styleResolver->style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
-        styleResolver->style()->setHasClip(true);
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setClip(Length(), Length(), Length(), Length());
-        styleResolver->style()->setHasClip(false);
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        if (Rect* rect = primitiveValue->getRectValue()) {
-            Length top = convertToLength(styleResolver, rect->top());
-            Length right = convertToLength(styleResolver, rect->right());
-            Length bottom = convertToLength(styleResolver, rect->bottom());
-            Length left = convertToLength(styleResolver, rect->left());
-            styleResolver->style()->setClip(top, right, bottom, left);
-            styleResolver->style()->setHasClip(true);
-        } else if (primitiveValue->getValueID() == CSSValueAuto) {
-            styleResolver->style()->setClip(Length(), Length(), Length(), Length());
-            styleResolver->style()->setHasClip(false);
-        }
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
-class ApplyPropertyDirection {
-public:
-    static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value);
-        Element* element = styleResolver->element();
-        if (element && styleResolver->element() == element->document()->documentElement())
-            element->document()->setDirectionSetOnDocumentElement(true);
-    }
-
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
-class ApplyPropertyBorderRadius {
-public:
-    static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        Pair* pair = primitiveValue->getPairValue();
-        if (!pair || !pair->first() || !pair->second())
-            return;
-
-        Length radiusWidth;
-        Length radiusHeight;
-        if (pair->first()->isPercentage())
-            radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
-        else if (pair->first()->isViewportPercentageLength())
-            radiusWidth = pair->first()->viewportPercentageLength();
-        else if (pair->first()->isCalculatedPercentageWithLength())
-            radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
-        else
-            radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
-        if (pair->second()->isPercentage())
-            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
-        else if (pair->second()->isViewportPercentageLength())
-            radiusHeight = pair->second()->viewportPercentageLength();
-        else if (pair->second()->isCalculatedPercentageWithLength())
-            radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
-        else
-            radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
-        int width = radiusWidth.value();
-        int height = radiusHeight.value();
-        if (width < 0 || height < 0)
-            return;
-        if (!width)
-            radiusHeight = radiusWidth; // Null out the other value.
-        else if (!height)
-            radiusWidth = radiusHeight; // Null out the other value.
-
-        LengthSize size(radiusWidth, radiusHeight);
-        setValue(styleResolver->style(), size);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<LengthSize, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
-enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
-enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
-template <typename T,
-          T (RenderStyle::*getterFunction)() const,
-          void (RenderStyle::*setterFunction)(T),
-          T (*initialFunction)(),
-          ComputeLengthNormal normalEnabled = NormalDisabled,
-          ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
-          ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
-class ApplyPropertyComputeLength {
-public:
-    static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        CSSValueID valueID = primitiveValue->getValueID();
-        T length;
-        if (normalEnabled && valueID == CSSValueNormal) {
-            length = 0;
-        } else if (thicknessEnabled && valueID == CSSValueThin) {
-            length = 1;
-        } else if (thicknessEnabled && valueID == CSSValueMedium) {
-            length = 3;
-        } else if (thicknessEnabled && valueID == CSSValueThick) {
-            length = 5;
-        } else if (valueID == CSSValueInvalid) {
-            float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
-
-            // Any original result that was >= 1 should not be allowed to fall below 1.
-            // This keeps border lines from vanishing.
-            length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);
-            if (zoom < 1.0f && length < 1.0) {
-                T originalLength = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), 1.0);
-                if (originalLength >= 1.0)
-                    length = 1.0;
-            }
-
-        } else {
-            ASSERT_NOT_REACHED();
-            length = 0;
-        }
-
-        setValue(styleResolver->style(), length);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<T, getterFunction, T, setterFunction, T, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-template <typename T, T (FontDescription::*getterFunction)() const, void (FontDescription::*setterFunction)(T), T initialValue>
-class ApplyPropertyFont {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver->fontDescription();
-        (fontDescription.*setterFunction)((styleResolver->parentFontDescription().*getterFunction)());
-        styleResolver->setFontDescription(fontDescription);
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver->fontDescription();
-        (fontDescription.*setterFunction)(initialValue);
-        styleResolver->setFontDescription(fontDescription);
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        FontDescription fontDescription = styleResolver->fontDescription();
-        (fontDescription.*setterFunction)(*primitiveValue);
-        styleResolver->setFontDescription(fontDescription);
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyFontFamily {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver->style()->fontDescription();
-        FontDescription parentFontDescription = styleResolver->parentStyle()->fontDescription();
-        
-        fontDescription.setGenericFamily(parentFontDescription.genericFamily());
-        fontDescription.setFamily(parentFontDescription.firstFamily());
-        fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
-        styleResolver->setFontDescription(fontDescription);
-        return;
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver->style()->fontDescription();
-        FontDescription initialDesc = FontDescription();
-        
-        // We need to adjust the size to account for the generic family change from monospace to non-monospace.
-        if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
-            styleResolver->setFontSize(fontDescription, FontSize::fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, false));
-        fontDescription.setGenericFamily(initialDesc.genericFamily());
-        if (!initialDesc.firstFamily().familyIsEmpty())
-            fontDescription.setFamily(initialDesc.firstFamily());
-
-        styleResolver->setFontDescription(fontDescription);
-        return;
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isValueList())
-            return;
-
-        FontDescription fontDescription = styleResolver->style()->fontDescription();
-        FontFamily& firstFamily = fontDescription.firstFamily();
-        FontFamily* currFamily = 0;
-
-        // Before mapping in a new font-family property, we should reset the generic family.
-        bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
-        fontDescription.setGenericFamily(FontDescription::NoFamily);
-
-        for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
-            CSSValue* item = i.value();
-            if (!item->isPrimitiveValue())
-                continue;
-            CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
-            AtomicString face;
-            Settings* settings = styleResolver->document()->settings();
-            if (contentValue->isString())
-                face = contentValue->getStringValue();
-            else if (settings) {
-                switch (contentValue->getValueID()) {
-                case CSSValueWebkitBody:
-                    face = settings->standardFontFamily();
-                    break;
-                case CSSValueSerif:
-                    face = serifFamily;
-                    fontDescription.setGenericFamily(FontDescription::SerifFamily);
-                    break;
-                case CSSValueSansSerif:
-                    face = sansSerifFamily;
-                    fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
-                    break;
-                case CSSValueCursive:
-                    face = cursiveFamily;
-                    fontDescription.setGenericFamily(FontDescription::CursiveFamily);
-                    break;
-                case CSSValueFantasy:
-                    face = fantasyFamily;
-                    fontDescription.setGenericFamily(FontDescription::FantasyFamily);
-                    break;
-                case CSSValueMonospace:
-                    face = monospaceFamily;
-                    fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
-                    break;
-                case CSSValueWebkitPictograph:
-                    face = pictographFamily;
-                    fontDescription.setGenericFamily(FontDescription::PictographFamily);
-                    break;
-                default:
-                    break;
-                }
-            }
-
-            if (!face.isEmpty()) {
-                if (!currFamily) {
-                    // Filling in the first family.
-                    firstFamily.setFamily(face);
-                    firstFamily.appendFamily(0); // Remove any inherited family-fallback list.
-                    currFamily = &firstFamily;
-                    fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily);
-                } else {
-                    RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
-                    newFamily->setFamily(face);
-                    currFamily->appendFamily(newFamily);
-                    currFamily = newFamily.get();
-                }
-            }
-        }
-
-        // We can't call useFixedDefaultSize() until all new font families have been added
-        // If currFamily is non-zero then we set at least one family on this description.
-        if (currFamily) {
-            if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
-                styleResolver->setFontSize(fontDescription, FontSize::fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize));
-
-            styleResolver->setFontDescription(fontDescription);
-        }
-        return;
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyFontSize {
-private:
-    // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
-    // table, and failing that, will simply multiply by 1.2.
-    static float largerFontSize(float size)
-    {
-        // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
-        // the next size level.
-        return size * 1.2f;
-    }
-
-    // Like the previous function, but for the keyword "smaller".
-    static float smallerFontSize(float size)
-    {
-        // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
-        // the next size level.
-        return size / 1.2f;
-    }
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        float size = styleResolver->parentStyle()->fontDescription().specifiedSize();
-
-        if (size < 0)
-            return;
-
-        FontDescription fontDescription = styleResolver->style()->fontDescription();
-        fontDescription.setKeywordSize(styleResolver->parentStyle()->fontDescription().keywordSize());
-        styleResolver->setFontSize(fontDescription, size);
-        styleResolver->setFontDescription(fontDescription);
-        return;
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver->style()->fontDescription();
-        float size = FontSize::fontSizeForKeyword(styleResolver->document(), CSSValueMedium, fontDescription.useFixedDefaultSize());
-
-        if (size < 0)
-            return;
-
-        fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
-        styleResolver->setFontSize(fontDescription, size);
-        styleResolver->setFontDescription(fontDescription);
-        return;
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        FontDescription fontDescription = styleResolver->style()->fontDescription();
-        fontDescription.setKeywordSize(0);
-        float parentSize = 0;
-        bool parentIsAbsoluteSize = false;
-        float size = 0;
-
-        if (styleResolver->parentStyle()) {
-            parentSize = styleResolver->parentStyle()->fontDescription().specifiedSize();
-            parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription().isAbsoluteSize();
-        }
-
-        if (CSSValueID valueID = primitiveValue->getValueID()) {
-            // Keywords are being used.
-            switch (valueID) {
-            case CSSValueXxSmall:
-            case CSSValueXSmall:
-            case CSSValueSmall:
-            case CSSValueMedium:
-            case CSSValueLarge:
-            case CSSValueXLarge:
-            case CSSValueXxLarge:
-            case CSSValueWebkitXxxLarge:
-                size = FontSize::fontSizeForKeyword(styleResolver->document(), valueID, fontDescription.useFixedDefaultSize());
-                fontDescription.setKeywordSize(valueID - CSSValueXxSmall + 1);
-                break;
-            case CSSValueLarger:
-                size = largerFontSize(parentSize);
-                break;
-            case CSSValueSmaller:
-                size = smallerFontSize(parentSize);
-                break;
-            default:
-                return;
-            }
-
-            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (valueID == CSSValueLarger || valueID == CSSValueSmaller));
-        } else {
-            fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
-                                              || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
-            if (primitiveValue->isLength())
-                size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);
-            else if (primitiveValue->isPercentage())
-                size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
-            else if (primitiveValue->isCalculatedPercentageWithLength())
-                size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
-            else if (primitiveValue->isViewportPercentageLength())
-                size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView());
-            else
-                return;
-        }
-
-        if (size < 0)
-            return;
-
-        // Overly large font sizes will cause crashes on some platforms (such as Windows).
-        // Cap font size here to make sure that doesn't happen.
-        size = min(maximumAllowedFontSize, size);
-
-        styleResolver->setFontSize(fontDescription, size);
-        styleResolver->setFontDescription(fontDescription);
-        return;
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyFontWeight {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        FontDescription fontDescription = styleResolver->fontDescription();
-        switch (primitiveValue->getValueID()) {
-        case CSSValueInvalid:
-            ASSERT_NOT_REACHED();
-            break;
-        case CSSValueBolder:
-            fontDescription.setWeight(fontDescription.bolderWeight());
-            break;
-        case CSSValueLighter:
-            fontDescription.setWeight(fontDescription.lighterWeight());
-            break;
-        default:
-            fontDescription.setWeight(*primitiveValue);
-        }
-        styleResolver->setFontDescription(fontDescription);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyFont<FontWeight, &FontDescription::weight, &FontDescription::setWeight, FontWeightNormal>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyFontVariantLigatures {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        const FontDescription& parentFontDescription = styleResolver->parentFontDescription();
-        FontDescription fontDescription = styleResolver->fontDescription();
-
-        fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
-        fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
-        fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
-
-        styleResolver->setFontDescription(fontDescription);
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        FontDescription fontDescription = styleResolver->fontDescription();
-
-        fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
-        fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
-        fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
-
-        styleResolver->setFontDescription(fontDescription);
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
-        FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
-        FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
-
-        if (value->isValueList()) {
-            CSSValueList* valueList = toCSSValueList(value);
-            for (size_t i = 0; i < valueList->length(); ++i) {
-                CSSValue* item = valueList->itemWithoutBoundsCheck(i);
-                ASSERT(item->isPrimitiveValue());
-                if (item->isPrimitiveValue()) {
-                    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
-                    switch (primitiveValue->getValueID()) {
-                    case CSSValueNoCommonLigatures:
-                        commonLigaturesState = FontDescription::DisabledLigaturesState;
-                        break;
-                    case CSSValueCommonLigatures:
-                        commonLigaturesState = FontDescription::EnabledLigaturesState;
-                        break;
-                    case CSSValueNoDiscretionaryLigatures:
-                        discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
-                        break;
-                    case CSSValueDiscretionaryLigatures:
-                        discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
-                        break;
-                    case CSSValueNoHistoricalLigatures:
-                        historicalLigaturesState = FontDescription::DisabledLigaturesState;
-                        break;
-                    case CSSValueHistoricalLigatures:
-                        historicalLigaturesState = FontDescription::EnabledLigaturesState;
-                        break;
-                    default:
-                        ASSERT_NOT_REACHED();
-                        break;
-                    }
-                }
-            }
-        }
-#if !ASSERT_DISABLED
-        else {
-            ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
-            ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNormal);
-        }
-#endif
-
-        FontDescription fontDescription = styleResolver->fontDescription();
-        fontDescription.setCommonLigaturesState(commonLigaturesState);
-        fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
-        fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
-        styleResolver->setFontDescription(fontDescription);
-    }
-
-    static PropertyHandler createHandler()
-    {
-        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
-    }
-};
-
-enum BorderImageType { BorderImage = 0, BorderMask };
-enum BorderImageModifierType { Outset, Repeat, Slice, Width };
-template <BorderImageType type, BorderImageModifierType modifier>
-class ApplyPropertyBorderImageModifier {
-private:
-    static inline const NinePieceImage& getValue(RenderStyle* style) { return type == BorderImage ? style->borderImage() : style->maskBoxImage(); }
-    static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == BorderImage ? style->setBorderImage(value) : style->setMaskBoxImage(value); }
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        NinePieceImage image(getValue(styleResolver->style()));
-        switch (modifier) {
-        case Outset:
-            image.copyOutsetFrom(getValue(styleResolver->parentStyle()));
-            break;
-        case Repeat:
-            image.copyRepeatFrom(getValue(styleResolver->parentStyle()));
-            break;
-        case Slice:
-            image.copyImageSlicesFrom(getValue(styleResolver->parentStyle()));
-            break;
-        case Width:
-            image.copyBorderSlicesFrom(getValue(styleResolver->parentStyle()));
-            break;
-        }
-        setValue(styleResolver->style(), image);
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        NinePieceImage image(getValue(styleResolver->style()));
-        switch (modifier) {
-        case Outset:
-            image.setOutset(LengthBox(0));
-            break;
-        case Repeat:
-            image.setHorizontalRule(StretchImageRule);
-            image.setVerticalRule(StretchImageRule);
-            break;
-        case Slice:
-            // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
-            image.setImageSlices(type == BorderImage ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox());
-            image.setFill(false);
-            break;
-        case Width:
-            // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border.
-            image.setBorderSlices(type == BorderImage ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox());
-            break;
-        }
-        setValue(styleResolver->style(), image);
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        NinePieceImage image(getValue(styleResolver->style()));
-        switch (modifier) {
-        case Outset:
-            image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(value));
-            break;
-        case Repeat:
-            styleResolver->styleMap()->mapNinePieceImageRepeat(value, image);
-            break;
-        case Slice:
-            styleResolver->styleMap()->mapNinePieceImageSlice(value, image);
-            break;
-        case Width:
-            image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(value));
-            break;
-        }
-        setValue(styleResolver->style(), image);
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-template <CSSPropertyID id, StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)()>
-class ApplyPropertyBorderImageSource {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(id, value)); }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-enum CounterBehavior {Increment = 0, Reset};
-template <CounterBehavior counterBehavior>
-class ApplyPropertyCounter {
-public:
-    static void emptyFunction(CSSPropertyID, StyleResolver*) { }
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
-        CounterDirectiveMap& parentMap = styleResolver->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;
-            if (counterBehavior == Reset) {
-                directives.inheritReset(it->value);
-            } else {
-                directives.inheritIncrement(it->value);
-            }
-        }
-    }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isValueList())
-            return;
-
-        CSSValueList* list = toCSSValueList(value);
-
-        CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
-        typedef CounterDirectiveMap::iterator Iterator;
-
-        Iterator end = map.end();
-        for (Iterator it = map.begin(); it != end; ++it)
-            if (counterBehavior == Reset)
-                it->value.clearReset();
-            else
-                it->value.clearIncrement();
-
-        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 (counterBehavior == Reset) {
-                directives.setResetValue(value);
-            } else {
-                directives.addIncrementValue(value);
-            }
-        }
-    }
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &emptyFunction, &applyValue); }
-};
-
-
-class ApplyPropertyCursor {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setCursor(styleResolver->parentStyle()->cursor());
-        styleResolver->style()->setCursorList(styleResolver->parentStyle()->cursors());
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->clearCursorList();
-        styleResolver->style()->setCursor(RenderStyle::initialCursor());
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        styleResolver->style()->clearCursorList();
-        if (value->isValueList()) {
-            CSSValueList* list = toCSSValueList(value);
-            int len = list->length();
-            styleResolver->style()->setCursor(CURSOR_AUTO);
-            for (int i = 0; i < len; i++) {
-                CSSValue* item = list->itemWithoutBoundsCheck(i);
-                if (item->isCursorImageValue()) {
-                    CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(item);
-                    if (image->updateIfSVGCursorIsUsed(styleResolver->element())) // Elements with SVG cursors are not allowed to share style.
-                        styleResolver->style()->setUnique();
-                    styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, image), image->hotSpot());
-                } else if (item->isPrimitiveValue()) {
-                    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
-                    if (primitiveValue->isValueID())
-                        styleResolver->style()->setCursor(*primitiveValue);
-                }
-            }
-        } else if (value->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-            if (primitiveValue->isValueID() && styleResolver->style()->cursor() != ECursor(*primitiveValue))
-                styleResolver->style()->setCursor(*primitiveValue);
-        }
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyTextAlign {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        if (primitiveValue->getValueID() != CSSValueWebkitMatchParent)
-            styleResolver->style()->setTextAlign(*primitiveValue);
-        else if (styleResolver->parentStyle()->textAlign() == TASTART)
-            styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
-        else if (styleResolver->parentStyle()->textAlign() == TAEND)
-            styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
-        else
-            styleResolver->style()->setTextAlign(styleResolver->parentStyle()->textAlign());
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyTextDecoration {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        TextDecoration t = RenderStyle::initialTextDecoration();
-        for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
-            CSSValue* item = i.value();
-            t |= *toCSSPrimitiveValue(item);
-        }
-        styleResolver->style()->setTextDecoration(t);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<TextDecoration, &RenderStyle::textDecoration, TextDecoration, &RenderStyle::setTextDecoration, TextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyMarqueeSpeed {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        if (CSSValueID valueID = primitiveValue->getValueID()) {
-            switch (valueID) {
-            case CSSValueSlow:
-                styleResolver->style()->setMarqueeSpeed(500); // 500 msec.
-                break;
-            case CSSValueNormal:
-                styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinIE default.
-                break;
-            case CSSValueFast:
-                styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fast.
-                break;
-            default:
-                break;
-            }
-        } else if (primitiveValue->isTime())
-            styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());
-        else if (primitiveValue->isNumber()) // For scrollamount support.
-            styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue());
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpeed>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-#if ENABLE(CSS3_TEXT)
-class ApplyPropertyTextUnderlinePosition {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        // This is true if value is 'auto' or 'alphabetic'.
-        if (value->isPrimitiveValue()) {
-            TextUnderlinePosition t = *toCSSPrimitiveValue(value);
-            styleResolver->style()->setTextUnderlinePosition(t);
-            return;
-        }
-
-        unsigned t = 0;
-        for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
-            CSSValue* item = i.value();
-            TextUnderlinePosition t2 = *toCSSPrimitiveValue(item);
-            t |= t2;
-        }
-        styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<TextUnderlinePosition, &RenderStyle::textUnderlinePosition, TextUnderlinePosition, &RenderStyle::setTextUnderlinePosition, TextUnderlinePosition, &RenderStyle::initialTextUnderlinePosition>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-#endif // CSS3_TEXT
-
-class ApplyPropertyLineHeight {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        Length lineHeight;
-
-        if (primitiveValue->getValueID() == CSSValueNormal)
-            lineHeight = RenderStyle::initialLineHeight();
-        else if (primitiveValue->isLength()) {
-            double multiplier = styleResolver->style()->effectiveZoom();
-            if (Frame* frame = styleResolver->document()->frame())
-                multiplier *= frame->textZoomFactor();
-            lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
-        } else if (primitiveValue->isPercentage()) {
-            // FIXME: percentage should not be restricted to an integer here.
-            lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
-        } else if (primitiveValue->isNumber()) {
-            // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
-            lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
-        } else if (primitiveValue->isViewportPercentageLength())
-            lineHeight = primitiveValue->viewportPercentageLength();
-        else
-            return;
-        styleResolver->style()->setLineHeight(lineHeight);
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<Length, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyPageSize {
-private:
-    static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
-    static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
-    static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
-    {
-        DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
-        DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
-        DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
-        DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
-        DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
-        DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
-        DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
-        DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
-        DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
-        DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
-        DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
-        DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
-        DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
-        DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
-        DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
-        DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
-
-        if (!pageSizeName)
-            return false;
-
-        switch (pageSizeName->getValueID()) {
-        case CSSValueA5:
-            width = a5Width;
-            height = a5Height;
-            break;
-        case CSSValueA4:
-            width = a4Width;
-            height = a4Height;
-            break;
-        case CSSValueA3:
-            width = a3Width;
-            height = a3Height;
-            break;
-        case CSSValueB5:
-            width = b5Width;
-            height = b5Height;
-            break;
-        case CSSValueB4:
-            width = b4Width;
-            height = b4Height;
-            break;
-        case CSSValueLetter:
-            width = letterWidth;
-            height = letterHeight;
-            break;
-        case CSSValueLegal:
-            width = legalWidth;
-            height = legalHeight;
-            break;
-        case CSSValueLedger:
-            width = ledgerWidth;
-            height = ledgerHeight;
-            break;
-        default:
-            return false;
-        }
-
-        if (pageOrientation) {
-            switch (pageOrientation->getValueID()) {
-            case CSSValueLandscape:
-                std::swap(width, height);
-                break;
-            case CSSValuePortrait:
-                // Nothing to do.
-                break;
-            default:
-                return false;
-            }
-        }
-        return true;
-    }
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver*) { }
-    static void applyInitialValue(CSSPropertyID, StyleResolver*) { }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        styleResolver->style()->resetPageSizeType();
-        Length width;
-        Length height;
-        PageSizeType pageSizeType = PAGE_SIZE_AUTO;
-        CSSValueListInspector inspector(value);
-        switch (inspector.length()) {
-        case 2: {
-            // <length>{2} | <page-size> <orientation>
-            if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
-                return;
-            CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first());
-            CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second());
-            if (first->isLength()) {
-                // <length>{2}
-                if (!second->isLength())
-                    return;
-                width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
-                height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
-            } else {
-                // <page-size> <orientation>
-                // The value order is guaranteed. See CSSParser::parseSizeParameter.
-                if (!getPageSizeFromName(first, second, width, height))
-                    return;
-            }
-            pageSizeType = PAGE_SIZE_RESOLVED;
-            break;
-        }
-        case 1: {
-            // <length> | auto | <page-size> | [ portrait | landscape]
-            if (!inspector.first()->isPrimitiveValue())
-                return;
-            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first());
-            if (primitiveValue->isLength()) {
-                // <length>
-                pageSizeType = PAGE_SIZE_RESOLVED;
-                width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
-            } else {
-                switch (primitiveValue->getValueID()) {
-                case 0:
-                    return;
-                case CSSValueAuto:
-                    pageSizeType = PAGE_SIZE_AUTO;
-                    break;
-                case CSSValuePortrait:
-                    pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
-                    break;
-                case CSSValueLandscape:
-                    pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
-                    break;
-                default:
-                    // <page-size>
-                    pageSizeType = PAGE_SIZE_RESOLVED;
-                    if (!getPageSizeFromName(primitiveValue, 0, width, height))
-                        return;
-                }
-            }
-            break;
-        }
-        default:
-            return;
-        }
-        styleResolver->style()->setPageSizeType(pageSizeType);
-        styleResolver->style()->setPageSize(LengthSize(width, height));
-    }
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyTextEmphasisStyle {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setTextEmphasisFill(styleResolver->parentStyle()->textEmphasisFill());
-        styleResolver->style()->setTextEmphasisMark(styleResolver->parentStyle()->textEmphasisMark());
-        styleResolver->style()->setTextEmphasisCustomMark(styleResolver->parentStyle()->textEmphasisCustomMark());
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
-        styleResolver->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
-        styleResolver->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (value->isValueList()) {
-            CSSValueList* list = toCSSValueList(value);
-            ASSERT(list->length() == 2);
-            if (list->length() != 2)
-                return;
-            for (unsigned i = 0; i < 2; ++i) {
-                CSSValue* item = list->itemWithoutBoundsCheck(i);
-                if (!item->isPrimitiveValue())
-                    continue;
-
-                CSSPrimitiveValue* value = toCSSPrimitiveValue(item);
-                if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen)
-                    styleResolver->style()->setTextEmphasisFill(*value);
-                else
-                    styleResolver->style()->setTextEmphasisMark(*value);
-            }
-            styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
-            return;
-        }
-
-        if (!value->isPrimitiveValue())
-            return;
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        if (primitiveValue->isString()) {
-            styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
-            styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
-            styleResolver->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
-            return;
-        }
-
-        styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
-
-        if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getValueID() == CSSValueOpen) {
-            styleResolver->style()->setTextEmphasisFill(*primitiveValue);
-            styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
-        } else {
-            styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
-            styleResolver->style()->setTextEmphasisMark(*primitiveValue);
-        }
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyOutlineStyle {
-public:
-    static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(propertyID, styleResolver);
-        ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(propertyID, styleResolver);
-    }
-
-    static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
-    {
-        ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(propertyID, styleResolver);
-        ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(propertyID, styleResolver);
-    }
-
-    static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(propertyID, styleResolver, value);
-        ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(propertyID, styleResolver, value);
-    }
-
-    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
-class ApplyPropertyResize {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        EResize r = RESIZE_NONE;
-        switch (primitiveValue->getValueID()) {
-        case 0:
-            return;
-        case CSSValueAuto:
-            if (Settings* settings = styleResolver->document()->settings())
-                r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
-            break;
-        default:
-            r = *primitiveValue;
-        }
-        styleResolver->style()->setResize(r);
-    }
-
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyVerticalAlign {
-public:
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-        if (primitiveValue->getValueID())
-            return styleResolver->style()->setVerticalAlign(*primitiveValue);
-
-        styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
-    }
-
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &RenderStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVerticalAlign, &RenderStyle::initialVerticalAlign>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyAspectRatio {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        if (!styleResolver->parentStyle()->hasAspectRatio())
-            return;
-        styleResolver->style()->setHasAspectRatio(true);
-        styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
-        styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
-        styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
-        styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isAspectRatioValue()) {
-            styleResolver->style()->setHasAspectRatio(false);
-            return;
-        }
-        CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value);
-        styleResolver->style()->setHasAspectRatio(true);
-        styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
-        styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
-    }
-
-    static PropertyHandler createHandler()
-    {
-        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
-    }
-};
-
-class ApplyPropertyDisplay {
-private:
-    static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)
-    {
-        if (styleResolver->element() && styleResolver->element()->isSVGElement() && styleResolver->style()->styleType() == NOPSEUDO)
-            return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
-        return true;
-    }
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        EDisplay display = styleResolver->parentStyle()->display();
-        if (!isValidDisplayValue(styleResolver, display))
-            return;
-        styleResolver->style()->setDisplay(display);
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setDisplay(RenderStyle::initialDisplay());
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isPrimitiveValue())
-            return;
-
-        EDisplay display = *toCSSPrimitiveValue(value);
-
-        if (!isValidDisplayValue(styleResolver, display))
-            return;
-
-        styleResolver->style()->setDisplay(display);
-    }
-
-    static PropertyHandler createHandler()
-    {
-        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
-    }
-};
-
-template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*initialFunction)()>
-class ApplyPropertyClipPath {
-public:
-    static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (value->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-            if (primitiveValue->getValueID() == CSSValueNone)
-                setValue(styleResolver->style(), 0);
-            else if (primitiveValue->isShape()) {
-                setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue())));
-            } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
-                String cssURLValue = primitiveValue->getStringValue();
-                KURL url = styleResolver->document()->completeURL(cssURLValue);
-                // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
-                setValue(styleResolver->style(), ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier()));
-            }
-        }
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, getterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation*, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-template <ShapeValue* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ShapeValue>), ShapeValue* (*initialFunction)()>
-class ApplyPropertyShape {
-public:
-    static void setValue(RenderStyle* style, PassRefPtr<ShapeValue> value) { (style->*setterFunction)(value); }
-    static void applyValue(CSSPropertyID property, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (value->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-            if (primitiveValue->getValueID() == CSSValueAuto)
-                setValue(styleResolver->style(), 0);
-            // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented
-            else if (primitiveValue->getValueID() == CSSValueOutsideShape)
-                setValue(styleResolver->style(), ShapeValue::createOutsideValue());
-            else if (primitiveValue->isShape()) {
-                RefPtr<ShapeValue> shape = ShapeValue::createShapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()));
-                setValue(styleResolver->style(), shape.release());
-            }
-        } else if (value->isImageValue()) {
-            RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver->styleImage(property, value));
-            setValue(styleResolver->style(), shape.release());
-        }
-    }
-    static PropertyHandler createHandler()
-    {
-        PropertyHandler handler = ApplyPropertyDefaultBase<ShapeValue*, getterFunction, PassRefPtr<ShapeValue>, setterFunction, ShapeValue*, initialFunction>::createHandler();
-        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
-    }
-};
-
-class ApplyPropertyTextIndent {
-public:
-    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setTextIndent(styleResolver->parentStyle()->textIndent());
-#if ENABLE(CSS3_TEXT)
-        styleResolver->style()->setTextIndentLine(styleResolver->parentStyle()->textIndentLine());
-#endif
-    }
-
-    static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
-    {
-        styleResolver->style()->setTextIndent(RenderStyle::initialTextIndent());
-#if ENABLE(CSS3_TEXT)
-        styleResolver->style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
-#endif
-    }
-
-    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
-    {
-        if (!value->isValueList())
-            return;
-
-        // [ <length> | <percentage> ] -webkit-each-line
-        // The order is guaranteed. See CSSParser::parseTextIndent.
-        // The second value, -webkit-each-line is handled only when CSS3_TEXT is enabled.
-
-        CSSValueList* valueList = toCSSValueList(value);
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWithoutBoundsCheck(0));
-        Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
-        ASSERT(!lengthOrPercentageValue.isUndefined());
-        styleResolver->style()->setTextIndent(lengthOrPercentageValue);
-
-#if ENABLE(CSS3_TEXT)
-        ASSERT(valueList->length() <= 2);
-        CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
-        if (eachLineValue) {
-            ASSERT(eachLineValue->getValueID() == CSSValueWebkitEachLine);
-            styleResolver->style()->setTextIndentLine(TextIndentEachLine);
-        } else
-            styleResolver->style()->setTextIndentLine(TextIndentFirstLine);
-#endif
-    }
-
-    static PropertyHandler createHandler()
-    {
-        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
-    }
-};
-
-const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder()
-{
-    DEFINE_STATIC_LOCAL(DeprecatedStyleBuilder, styleBuilderInstance, ());
-    return styleBuilderInstance;
-}
-
-DeprecatedStyleBuilder::DeprecatedStyleBuilder()
-{
-    for (int i = 0; i < numCSSProperties; ++i)
-        m_propertyMap[i] = PropertyHandler();
-
-    // Please keep CSS property list in alphabetical order.
-    setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
-    setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
-    setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
-    setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<BorderImage, Repeat>::createHandler());
-    setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier<BorderImage, Slice>::createHandler());
-    setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource<CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource, &RenderStyle::initialBorderImageSource>::createHandler());
-    setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<BorderImage, Width>::createHandler());
-    setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
-    setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
-    setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler());
-    setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
-    setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
-    setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
-    setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
-    setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
-    setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
-    setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
-    setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
-    setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
-    setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
-    setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
-    setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
-    setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
-    setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
-    setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
-    setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
-    setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
-    setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
-    setPropertyHandler(CSSPropertyTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
-
-#if ENABLE(CSS3_TEXT)
-    setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
-#endif // CSS3_TEXT
-    setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
-    setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
-    setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
-    setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
-    setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
-    setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
-    setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<BorderMask, Outset>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<BorderMask, Repeat>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier<BorderMask, Slice>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource<CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource, &RenderStyle::initialMaskBoxImageSource>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier<BorderMask, Width>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
-    setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyShape<&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialShapeInside>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
-    setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
-}
-
-
-}
diff --git a/Source/core/css/DeprecatedStyleBuilder.h b/Source/core/css/DeprecatedStyleBuilder.h
deleted file mode 100644
index 4d4d254..0000000
--- a/Source/core/css/DeprecatedStyleBuilder.h
+++ /dev/null
@@ -1,103 +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 DeprecatedStyleBuilder_h
-#define DeprecatedStyleBuilder_h
-
-#include "CSSPropertyNames.h"
-#include "core/css/StylePropertyShorthand.h"
-
-namespace WebCore {
-
-class CSSValue;
-class DeprecatedStyleBuilder;
-class StyleResolver;
-
-class PropertyHandler {
-public:
-    typedef void (*InheritFunction)(CSSPropertyID, StyleResolver*);
-    typedef void (*InitialFunction)(CSSPropertyID, StyleResolver*);
-    typedef void (*ApplyFunction)(CSSPropertyID, StyleResolver*, CSSValue*);
-    PropertyHandler() : m_inherit(0), m_initial(0), m_apply(0) { }
-    PropertyHandler(InheritFunction inherit, InitialFunction initial, ApplyFunction apply) : m_inherit(inherit), m_initial(initial), m_apply(apply) { }
-    void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_inherit); (*m_inherit)(propertyID, styleResolver); }
-    void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver) const { ASSERT(m_initial); (*m_initial)(propertyID, styleResolver); }
-    void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value) const { ASSERT(m_apply); (*m_apply)(propertyID, styleResolver, value); }
-    bool isValid() const { return m_inherit && m_initial && m_apply; }
-    InheritFunction inheritFunction() const { return m_inherit; }
-    InitialFunction initialFunction() { return m_initial; }
-    ApplyFunction applyFunction() { return m_apply; }
-private:
-    InheritFunction m_inherit;
-    InitialFunction m_initial;
-    ApplyFunction m_apply;
-};
-
-class DeprecatedStyleBuilder {
-    WTF_MAKE_NONCOPYABLE(DeprecatedStyleBuilder); WTF_MAKE_FAST_ALLOCATED;
-public:
-    static const DeprecatedStyleBuilder& sharedStyleBuilder();
-
-    const PropertyHandler& propertyHandler(CSSPropertyID property) const
-    {
-        ASSERT(valid(property));
-        return m_propertyMap[index(property)];
-    }
-private:
-    DeprecatedStyleBuilder();
-    static int index(CSSPropertyID property)
-    {
-        return property - firstCSSProperty;
-    }
-
-    static bool valid(CSSPropertyID property)
-    {
-        int i = index(property);
-        return i >= 0 && i < numCSSProperties;
-    }
-
-    void setPropertyHandler(CSSPropertyID property, const PropertyHandler& handler)
-    {
-        ASSERT(valid(property));
-        ASSERT(!propertyHandler(property).isValid());
-        ASSERT_WITH_MESSAGE(!isExpandedShorthand(property), "Shorthand property id = %d shouldn't be inserted into DeprecatedStyleBuilder. Shorthands should be expanded at parsing time.", property);
-        m_propertyMap[index(property)] = handler;
-    }
-
-    void setPropertyHandler(CSSPropertyID newProperty, CSSPropertyID equivalentProperty)
-    {
-        ASSERT(valid(newProperty));
-        ASSERT(valid(equivalentProperty));
-        ASSERT(!propertyHandler(newProperty).isValid());
-        ASSERT_WITH_MESSAGE(!isExpandedShorthand(newProperty), "Shorthand property id = %d shouldn't be inserted into DeprecatedStyleBuilder. Shorthands should be expanded at parsing time.", newProperty);
-        ASSERT_WITH_MESSAGE(!isExpandedShorthand(equivalentProperty), "Shorthand property id = %d shouldn't be inserted into DeprecatedStyleBuilder. Shorthands should be expanded at parsing time.", equivalentProperty);
-        m_propertyMap[index(newProperty)] = m_propertyMap[index(equivalentProperty)];
-    }
-
-    PropertyHandler m_propertyMap[numCSSProperties];
-};
-
-}
-
-#endif // DeprecatedStyleBuilder_h
diff --git a/Source/core/css/DocumentRuleSets.h b/Source/core/css/DocumentRuleSets.h
index dd047ea..c4a8eaa 100644
--- a/Source/core/css/DocumentRuleSets.h
+++ b/Source/core/css/DocumentRuleSets.h
@@ -26,9 +26,9 @@
 #include "core/css/RuleFeature.h"
 #include "core/css/RuleSet.h"
 
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/OwnPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp
index 3f6e411..0e163b7 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -34,11 +34,27 @@
 #include "core/css/SelectorCheckerFastPath.h"
 #include "core/css/SiblingTraversalStrategies.h"
 #include "core/css/StylePropertySet.h"
+#include "core/css/resolver/StyleResolver.h"
 #include "core/rendering/RenderRegion.h"
 
 namespace WebCore {
 
-StyleResolver::MatchResult& ElementRuleCollector::matchedResult()
+ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context,
+    const SelectorFilter& filter, RenderStyle* style, InspectorCSSOMWrappers& inspectorWrappers)
+    : m_context(context)
+    , m_selectorFilter(filter)
+    , m_inspectorCSSOMWrappers(inspectorWrappers)
+    , m_style(style)
+    , 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)
+{ }
+
+MatchResult& ElementRuleCollector::matchedResult()
 {
     return m_result;
 }
@@ -82,17 +98,15 @@
         m_result.isCacheable = false;
 }
 
-void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
+void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     ASSERT(matchRequest.ruleSet);
-    ASSERT(m_state.element());
+    ASSERT(m_context.element());
 
-    const StyleResolverState& state = m_state;
-    Element* element = state.element();
-    const Element* styledElement = state.styledElement();
+    Element* element = m_context.element();
     const AtomicString& pseudoId = element->shadowPseudoId();
     if (!pseudoId.isEmpty()) {
-        ASSERT(styledElement);
+        ASSERT(element->isStyledElement());
         collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId.impl()), matchRequest, ruleRange);
     }
 
@@ -113,9 +127,9 @@
     // then sort the buffer.
     if (element->hasID())
         collectMatchingRulesForList(matchRequest.ruleSet->idRules(element->idForStyleResolution().impl()), matchRequest, ruleRange);
-    if (styledElement && styledElement->hasClass()) {
-        for (size_t i = 0; i < styledElement->classNames().size(); ++i)
-            collectMatchingRulesForList(matchRequest.ruleSet->classRules(styledElement->classNames()[i].impl()), 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()), matchRequest, ruleRange);
     }
 
     if (element->isLink())
@@ -126,7 +140,7 @@
     collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), matchRequest, ruleRange);
 }
 
-void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
+void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (!m_regionForStyling)
         return;
@@ -144,8 +158,6 @@
 
 void ElementRuleCollector::sortAndTransferMatchedRules()
 {
-    const StyleResolverState& state = m_state;
-
     if (!m_matchedRules || m_matchedRules->isEmpty())
         return;
 
@@ -160,29 +172,28 @@
 
     // Now transfer the set of matched rules over to our list of declarations.
     for (unsigned i = 0; i < matchedRules.size(); i++) {
-        if (state.style() && matchedRules[i]->containsUncommonAttributeSelector())
-            state.style()->setUnique();
+        // FIXME: Matching should not modify the style directly.
+        if (m_style && matchedRules[i]->containsUncommonAttributeSelector())
+            m_style->setUnique();
         m_result.addMatchedProperties(matchedRules[i]->rule()->properties(), matchedRules[i]->rule(), matchedRules[i]->linkMatchType(), matchedRules[i]->propertyWhitelistType(m_matchingUARules));
     }
 }
 
 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const ContainerNode* scope, PseudoId& dynamicPseudo)
 {
-    const StyleResolverState& state = m_state;
-
     if (ruleData.hasFastCheckableSelector()) {
         // We know this selector does not include any pseudo elements.
         if (m_pseudoStyleRequest.pseudoId != NOPSEUDO)
             return false;
         // We know a sufficiently simple single part selector matches simply because we found it from the rule hash.
         // This is limited to HTML only so we don't need to check the namespace.
-        if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && state.element()->isHTMLElement()) {
+        if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && m_context.element()->isHTMLElement()) {
             if (!ruleData.hasMultipartSelector())
                 return true;
         }
-        if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(state.element(), ruleData.selector()->tagQName()))
+        if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(m_context.element(), ruleData.selector()->tagQName()))
             return false;
-        SelectorCheckerFastPath selectorCheckerFastPath(ruleData.selector(), state.element());
+        SelectorCheckerFastPath selectorCheckerFastPath(ruleData.selector(), m_context.element());
         if (!selectorCheckerFastPath.matchesRightmostAttributeSelector())
             return false;
 
@@ -191,8 +202,8 @@
 
     // Slow path.
     SelectorChecker selectorChecker(document(), m_mode);
-    SelectorChecker::SelectorCheckingContext context(ruleData.selector(), state.element(), SelectorChecker::VisitedMatchEnabled);
-    context.elementStyle = state.style();
+    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;
@@ -206,7 +217,7 @@
     return true;
 }
 
-void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
+void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (m_canUseFastReject && m_selectorFilter.fastRejectSelector(ruleData.selector()))
         return;
@@ -233,8 +244,9 @@
                 InspectorInstrumentation::didMatchRule(cookie, false);
                 return;
             }
+            // FIXME: Matching should not modify the style directly.
             if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
-                m_state.style()->setHasPseudoStyle(dynamicPseudo);
+                m_style->setHasPseudoStyle(dynamicPseudo);
         } else {
             // Update our first/last rule indices in the matched rules array.
             ++ruleRange.lastRuleIndex;
@@ -250,7 +262,7 @@
     InspectorInstrumentation::didMatchRule(cookie, false);
 }
 
-void ElementRuleCollector::collectMatchingRulesForList(const RuleData* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
+void ElementRuleCollector::collectMatchingRulesForList(const RuleData* rules, const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (!rules)
         return;
@@ -259,7 +271,7 @@
     collectRuleIfMatches(*rules, matchRequest, ruleRange);
 }
 
-void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
+void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (!rules)
         return;
@@ -291,7 +303,7 @@
     // information about "scope".
     m_behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope;
     int firstRuleIndex = -1, lastRuleIndex = -1;
-    StyleResolver::RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
+    RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
     collectMatchingRules(MatchRequest(ruleSet), ruleRange);
 
     return m_matchedRules && !m_matchedRules->isEmpty();
diff --git a/Source/core/css/ElementRuleCollector.h b/Source/core/css/ElementRuleCollector.h
index 5d4328b..234f7fd 100644
--- a/Source/core/css/ElementRuleCollector.h
+++ b/Source/core/css/ElementRuleCollector.h
@@ -22,8 +22,10 @@
 #ifndef ElementRuleCollector_h
 #define ElementRuleCollector_h
 
+#include "core/css/PseudoStyleRequest.h"
 #include "core/css/SelectorChecker.h"
-#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/MatchResult.h"
+#include "core/css/resolver/StyleResolverState.h" // For ElementResolveContext
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 
@@ -31,26 +33,23 @@
 
 class CSSRuleList;
 class DocumentRuleSets;
+class MatchRequest;
 class RenderRegion;
 class RuleData;
 class RuleSet;
-class SelectorFilter;
 class ScopedStyleResolver;
+class SelectorFilter;
 class StaticCSSRuleList;
 
+// ElementRuleCollector is designed to be used as a stack object.
+// Create one, ask what rules the ElementResolveContext matches
+// and then let it go out of scope.
+// FIXME: Currently it modifies the RenderStyle but should not!
 class ElementRuleCollector {
+    WTF_MAKE_NONCOPYABLE(ElementRuleCollector);
 public:
-    ElementRuleCollector(StyleResolver* styleResolver, const StyleResolverState& state)
-        : m_state(state)
-        , m_selectorFilter(styleResolver->selectorFilter())
-        , m_inspectorCSSOMWrappers(styleResolver->inspectorCSSOMWrappers())
-        , m_regionForStyling(0)
-        , m_pseudoStyleRequest(NOPSEUDO)
-        , m_sameOriginOnly(false)
-        , m_mode(SelectorChecker::ResolvingStyle)
-        , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(state.parentNode()))
-        , m_behaviorAtBoundary(SelectorChecker::DoesNotCrossBoundary)
-        , m_matchingUARules(false) { }
+    // FIXME: This should not need an InspectorCSSOMWrappers parameter.
+    ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, RenderStyle*, InspectorCSSOMWrappers&);
 
     void setBehaviorAtBoundary(SelectorChecker::BehaviorAtBoundary boundary) { m_behaviorAtBoundary = boundary; }
     SelectorChecker::BehaviorAtBoundary behaviorAtBoundary() const { return m_behaviorAtBoundary; }
@@ -59,27 +58,27 @@
 
     void setMode(SelectorChecker::Mode mode) { m_mode = mode; }
     void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyleRequest = request; }
-    void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } 
-    void setRegionForStyling(RenderRegion* regionForStyling) { m_regionForStyling = regionForStyling; }
+    void setSameOriginOnly(bool f) { m_sameOriginOnly = f; }
+    void setRegionForStyling(const RenderRegion* regionForStyling) { m_regionForStyling = regionForStyling; }
 
     void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matchingUARules; }
     bool hasAnyMatchingRules(RuleSet*);
 
-    StyleResolver::MatchResult& matchedResult();
+    MatchResult& matchedResult();
     PassRefPtr<CSSRuleList> matchedRuleList();
 
-    void collectMatchingRules(const MatchRequest&, StyleResolver::RuleRange&);
-    void collectMatchingRulesForRegion(const MatchRequest&, StyleResolver::RuleRange&);
+    void collectMatchingRules(const MatchRequest&, RuleRange&);
+    void collectMatchingRulesForRegion(const MatchRequest&, RuleRange&);
     void sortAndTransferMatchedRules();
     void clearMatchedRules();
     void addElementStyleProperties(const StylePropertySet*, bool isCacheable = true);
 
 private:
-    Document* document() { return m_state.document(); }
+    Document* document() { return m_context.document(); }
 
-    void collectRuleIfMatches(const RuleData&, const MatchRequest&, StyleResolver::RuleRange&);
-    void collectMatchingRulesForList(const Vector<RuleData>*, const MatchRequest&, StyleResolver::RuleRange&);
-    void collectMatchingRulesForList(const RuleData*, const MatchRequest&, StyleResolver::RuleRange&);
+    void collectRuleIfMatches(const RuleData&, const MatchRequest&, RuleRange&);
+    void collectMatchingRulesForList(const Vector<RuleData>*, const MatchRequest&, RuleRange&);
+    void collectMatchingRulesForList(const RuleData*, const MatchRequest&, RuleRange&);
     bool ruleMatches(const RuleData&, const ContainerNode* scope, PseudoId&);
 
     void sortMatchedRules();
@@ -87,25 +86,26 @@
     void addMatchedRule(const RuleData*);
 
     StaticCSSRuleList* ensureRuleList();
-        
-private:
-    const StyleResolverState& m_state;
-    SelectorFilter& m_selectorFilter;
-    InspectorCSSOMWrappers& m_inspectorCSSOMWrappers;
 
-    RenderRegion* m_regionForStyling;
+private:
+    const ElementResolveContext& m_context;
+    const SelectorFilter& m_selectorFilter;
+    InspectorCSSOMWrappers& m_inspectorCSSOMWrappers; // This should not be needed.
+    RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching!
+
+    const RenderRegion* m_regionForStyling;
     PseudoStyleRequest m_pseudoStyleRequest;
-    bool m_sameOriginOnly;
     SelectorChecker::Mode m_mode;
-    bool m_canUseFastReject;
     SelectorChecker::BehaviorAtBoundary m_behaviorAtBoundary;
+    bool m_canUseFastReject;
+    bool m_sameOriginOnly;
     bool m_matchingUARules;
 
     OwnPtr<Vector<const RuleData*, 32> > m_matchedRules;
 
     // Output.
     RefPtr<StaticCSSRuleList> m_ruleList;
-    StyleResolver::MatchResult m_result;
+    MatchResult m_result;
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/FontFeatureValue.cpp b/Source/core/css/FontFeatureValue.cpp
index 28e352d..fad8a38 100644
--- a/Source/core/css/FontFeatureValue.cpp
+++ b/Source/core/css/FontFeatureValue.cpp
@@ -27,7 +27,7 @@
 #include "core/css/FontFeatureValue.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/FontFeatureValue.h b/Source/core/css/FontFeatureValue.h
index b1b70c6..4e44ffc 100644
--- a/Source/core/css/FontFeatureValue.h
+++ b/Source/core/css/FontFeatureValue.h
@@ -27,7 +27,7 @@
 #define FontFeatureValue_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/FontLoader.cpp b/Source/core/css/FontLoader.cpp
index 6005643..585da7c 100644
--- a/Source/core/css/FontLoader.cpp
+++ b/Source/core/css/FontLoader.cpp
@@ -228,7 +228,7 @@
     if (!RuntimeEnabledFeatures::fontLoadEventsEnabled())
         return;
     // FIXME: We should report NetworkError in case of timeout, etc.
-    String errorName = (source && source->isDecodeError()) ? "InvalidFontDataError" : DOMException::getErrorName(NOT_FOUND_ERR);
+    String errorName = (source && source->isDecodeError()) ? "InvalidFontDataError" : DOMException::getErrorName(NotFoundError);
     scheduleEvent(CSSFontFaceLoadEvent::createForError(rule, DOMError::create(errorName)));
     queueDoneEvent(rule);
 }
@@ -312,11 +312,6 @@
     return true;
 }
 
-static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropertyID id, const RefPtr<StylePropertySet>& parsedStyle)
-{
-    styleResolver->applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSValue(id).get());
-}
-
 bool FontLoader::resolveFontStyle(const String& fontString, Font& font)
 {
     // Interpret fontString in the same way as the 'font' attribute of CanvasRenderingContext2D.
@@ -344,19 +339,16 @@
     style->font().update(style->font().fontSelector());
 
     // Now map the font property longhands into the style.
+    CSSPropertyValue properties[] = {
+        CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontSize, *parsedStyle),
+        CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle),
+    };
     StyleResolver* styleResolver = m_document->styleResolver();
-    styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getPropertyCSSValue(CSSPropertyFontFamily).get(), style.get());
-    applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontStyle, parsedStyle);
-    applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontVariant, parsedStyle);
-    applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontWeight, parsedStyle);
-
-    // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
-    // which assumes the fontMetrics are available for the affected font, otherwise a crash occurs (see http://trac.webkit.org/changeset/96122).
-    // The updateFont() calls below update the fontMetrics and ensure the proper setting of font-size and line-height.
-    styleResolver->updateFont();
-    applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle);
-    styleResolver->updateFont();
-    applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyle);
+    styleResolver->applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties), style.get());
 
     font = style->font();
     font.update(styleResolver->fontSelector());
diff --git a/Source/core/css/FontLoader.h b/Source/core/css/FontLoader.h
index b8e39d8..a5914d6 100644
--- a/Source/core/css/FontLoader.h
+++ b/Source/core/css/FontLoader.h
@@ -32,9 +32,9 @@
 #include "core/dom/EventTarget.h"
 #include "core/html/VoidCallback.h"
 #include "core/platform/Timer.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/FontLoader.idl b/Source/core/css/FontLoader.idl
index 7e7842a..4e922c1 100644
--- a/Source/core/css/FontLoader.idl
+++ b/Source/core/css/FontLoader.idl
@@ -32,9 +32,8 @@
     NoInterfaceObject,
     EnabledAtRuntime=fontLoadEvents,
     ActiveDOMObject,
-    EventTarget,
     GenerateIsReachable=document
-] interface FontLoader {
+] interface FontLoader : EventTarget {
 
     attribute EventListener onloading;
     attribute EventListener onloadingdone;
@@ -46,12 +45,4 @@
     void loadFont(Dictionary params);
     void notifyWhenFontsReady(VoidCallback callback);
     readonly attribute boolean loading;
-
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
diff --git a/Source/core/css/FontSize.cpp b/Source/core/css/FontSize.cpp
index 88b12b3..d24fd14 100644
--- a/Source/core/css/FontSize.cpp
+++ b/Source/core/css/FontSize.cpp
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-float FontSize::getComputedSizeFromSpecifiedSize(Document* document, float zoomFactor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize useSmartMinimumForFontSize)
+float FontSize::getComputedSizeFromSpecifiedSize(const Document* document, float zoomFactor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize useSmartMinimumForFontSize)
 {
     // Text with a 0px font size should not be visible and therefore needs to be
     // exempt from minimum font size rules. Acid3 relies on this for pixel-perfect
@@ -120,9 +120,9 @@
 // factors for each keyword value.
 static const float fontSizeFactors[totalKeywords] = { 0.60f, 0.75f, 0.89f, 1.0f, 1.2f, 1.5f, 2.0f, 3.0f };
 
-float FontSize::fontSizeForKeyword(Document* document, int keyword, bool shouldUseFixedDefaultSize)
+float FontSize::fontSizeForKeyword(const Document* document, int keyword, bool shouldUseFixedDefaultSize)
 {
-    Settings* settings = document->settings();
+    const Settings* settings = document->settings();
     if (!settings)
         return 1.0f;
 
@@ -153,9 +153,9 @@
     return totalKeywords - 1;
 }
 
-int FontSize::legacyFontSize(Document* document, int pixelFontSize, bool shouldUseFixedDefaultSize)
+int FontSize::legacyFontSize(const Document* document, int pixelFontSize, bool shouldUseFixedDefaultSize)
 {
-    Settings* settings = document->settings();
+    const Settings* settings = document->settings();
     if (!settings)
         return 1;
 
diff --git a/Source/core/css/FontSize.h b/Source/core/css/FontSize.h
index bcc624e..6eea72c 100644
--- a/Source/core/css/FontSize.h
+++ b/Source/core/css/FontSize.h
@@ -35,14 +35,14 @@
     }
 
 public:
-    static float getComputedSizeFromSpecifiedSize(Document*, float zoomFactor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize = UseSmartMinimumForFontFize);
+    static float getComputedSizeFromSpecifiedSize(const Document*, float zoomFactor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize = UseSmartMinimumForFontFize);
 
     // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return
     // the correct font size scaled relative to the user's default (medium).
-    static float fontSizeForKeyword(Document*, int keyword, bool shouldUseFixedDefaultSize);
+    static float fontSizeForKeyword(const Document*, int keyword, bool shouldUseFixedDefaultSize);
 
     // Given a font size in pixel, this function will return legacy font size between 1 and 7.
-    static int legacyFontSize(Document*, int pixelFontSize, bool shouldUseFixedDefaultSize);
+    static int legacyFontSize(const Document*, int pixelFontSize, bool shouldUseFixedDefaultSize);
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/FontValue.cpp b/Source/core/css/FontValue.cpp
index 1ce9271..507c887 100644
--- a/Source/core/css/FontValue.cpp
+++ b/Source/core/css/FontValue.cpp
@@ -23,7 +23,7 @@
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValueList.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/FontValue.h b/Source/core/css/FontValue.h
index b69279c..bc222ee 100644
--- a/Source/core/css/FontValue.h
+++ b/Source/core/css/FontValue.h
@@ -22,8 +22,8 @@
 #define FontValue_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/MediaList.cpp b/Source/core/css/MediaList.cpp
index e746db2..aba8d66 100644
--- a/Source/core/css/MediaList.cpp
+++ b/Source/core/css/MediaList.cpp
@@ -209,7 +209,7 @@
 
     bool success = m_mediaQueries->remove(medium);
     if (!success) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
     if (m_parentStyleSheet)
@@ -222,7 +222,7 @@
 
     bool success = m_mediaQueries->add(medium);
     if (!success) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return;
     }
 
diff --git a/Source/core/css/PageRuleCollector.cpp b/Source/core/css/PageRuleCollector.cpp
index 3caf4c0..daae716 100644
--- a/Source/core/css/PageRuleCollector.cpp
+++ b/Source/core/css/PageRuleCollector.cpp
@@ -31,6 +31,7 @@
 
 #include "core/css/StylePropertySet.h"
 #include "core/css/StyleRule.h"
+#include "core/css/resolver/StyleResolverState.h"
 
 namespace WebCore {
 
@@ -42,7 +43,7 @@
 bool PageRuleCollector::isLeftPage(int pageIndex) const
 {
     bool isFirstPageLeft = false;
-    if (!m_state.rootElementStyle()->isLeftToRightDirection())
+    if (!m_context.rootElementStyle()->isLeftToRightDirection())
         isFirstPageLeft = true;
 
     return (pageIndex + (isFirstPageLeft ? 1 : 0)) % 2;
@@ -60,8 +61,8 @@
     return "";
 }
 
-PageRuleCollector::PageRuleCollector(const StyleResolverState& state, int pageIndex)
-    : m_state(state)
+PageRuleCollector::PageRuleCollector(const ElementResolveContext& context, int pageIndex)
+    : m_context(context)
     , m_isLeftPage(isLeftPage(pageIndex))
     , m_isFirstPage(isFirstPage(pageIndex))
     , m_pageName(pageName(pageIndex)) { }
diff --git a/Source/core/css/PageRuleCollector.h b/Source/core/css/PageRuleCollector.h
index 4fd7dfd..296ee6f 100644
--- a/Source/core/css/PageRuleCollector.h
+++ b/Source/core/css/PageRuleCollector.h
@@ -22,19 +22,20 @@
 #ifndef PageRuleCollector_h
 #define PageRuleCollector_h
 
-#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/MatchResult.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
 
+class ElementResolveContext;
 class StyleRulePage;
 
 class PageRuleCollector {
 public:
-    PageRuleCollector(const StyleResolverState&, int pageIndex);
+    PageRuleCollector(const ElementResolveContext&, int pageIndex);
 
     void matchPageRules(RuleSet* rules);
-    StyleResolver::MatchResult& matchedResult() { return m_result; }
+    MatchResult& matchedResult() { return m_result; }
 
 private:
     bool isLeftPage(int pageIndex) const;
@@ -44,12 +45,12 @@
 
     void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vector<StyleRulePage*>& rules, bool isLeftPage, bool isFirstPage, const String& pageName);
 
-    const StyleResolverState& m_state;
+    const ElementResolveContext& m_context;
     const bool m_isLeftPage;
     const bool m_isFirstPage;
     const String m_pageName;
 
-    StyleResolver::MatchResult m_result;
+    MatchResult m_result;
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/Pair.h b/Source/core/css/Pair.h
index 4d707f5..6c73b76 100644
--- a/Source/core/css/Pair.h
+++ b/Source/core/css/Pair.h
@@ -22,9 +22,9 @@
 #define Pair_h
 
 #include "core/css/CSSPrimitiveValue.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
index e941cec..d54fab4 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.cpp
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -31,7 +31,7 @@
 #include "core/dom/MutationRecord.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include <wtf/MemoryInstrumentationHashMap.h>
+#include "wtf/MemoryInstrumentationHashMap.h"
 
 using namespace std;
 
@@ -230,7 +230,7 @@
     didMutate(changed ? PropertyChanged : NoChanges);
 
     if (changed) {
-        // CSS DOM requires raising SYNTAX_ERR of parsing failed, but this is too dangerous for compatibility,
+        // CSS DOM requires raising SyntaxError of parsing failed, but this is too dangerous for compatibility,
         // see <http://bugs.webkit.org/show_bug.cgi?id=7296>.
         mutationScope.enqueueMutationRecord();
     }
@@ -390,7 +390,7 @@
     if (!m_parentElement)
         return;
 
-    m_parentElement->setNeedsStyleRecalc(InlineStyleChange);
+    m_parentElement->setNeedsStyleRecalc(LocalStyleChange);
     m_parentElement->invalidateStyleAttribute();
     StyleAttributeMutationScope(this).didInvalidateStyleAttr();
 }
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.h b/Source/core/css/PropertySetCSSStyleDeclaration.h
index 96fabbe..9803653 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.h
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.h
@@ -27,7 +27,7 @@
 #define PropertySetCSSStyleDeclaration_h
 
 #include "core/css/CSSStyleDeclaration.h"
-#include <wtf/HashMap.h>
+#include "wtf/HashMap.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/PseudoStyleRequest.h b/Source/core/css/PseudoStyleRequest.h
index 97ff599..c07cb2f 100644
--- a/Source/core/css/PseudoStyleRequest.h
+++ b/Source/core/css/PseudoStyleRequest.h
@@ -28,6 +28,7 @@
 namespace WebCore {
 
 class RenderScrollbar;
+class RenderStyle;
 
 class PseudoStyleRequest {
 public:
@@ -38,6 +39,12 @@
     {
     }
 
+    // The spec disallows inheritance for ::backdrop.
+    bool allowsInheritance(const RenderStyle* parentStyle) const
+    {
+        return parentStyle && pseudoId != BACKDROP;
+    }
+
     PseudoId pseudoId;
     ScrollbarPart scrollbarPart;
     RenderScrollbar* scrollbar;
diff --git a/Source/core/css/RGBColor.h b/Source/core/css/RGBColor.h
index 91739e5..5cc591c 100644
--- a/Source/core/css/RGBColor.h
+++ b/Source/core/css/RGBColor.h
@@ -28,7 +28,7 @@
 #define RGBColor_h
 
 #include "core/platform/graphics/Color.h"
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/Rect.h b/Source/core/css/Rect.h
index 29e0c73..0b6490b 100644
--- a/Source/core/css/Rect.h
+++ b/Source/core/css/Rect.h
@@ -22,8 +22,8 @@
 #define Rect_h
 
 #include "core/css/CSSPrimitiveValue.h"
-#include <wtf/RefPtr.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/RefPtr.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/SVGCSSStyleSelector.cpp b/Source/core/css/SVGCSSStyleSelector.cpp
deleted file mode 100644
index 3fb1bc7..0000000
--- a/Source/core/css/SVGCSSStyleSelector.cpp
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
-    Copyright (C) 2005 Apple Computer, Inc.
-    Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
-                  2004, 2005, 2008 Rob Buis <buis@kde.org>
-    Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
-
-    Based on khtml css code by:
-    Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org)
-             (C) 2003 Apple Computer, Inc.
-             (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com)
-             (C) 2004 Germain Garand(germain@ebooksfrance.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/css/resolver/StyleResolver.h"
-
-#include "CSSPropertyNames.h"
-#include "core/css/CSSPrimitiveValueMappings.h"
-#include "core/css/CSSValueList.h"
-#include "core/css/ShadowValue.h"
-#include "core/rendering/style/SVGRenderStyle.h"
-#include "core/rendering/style/SVGRenderStyleDefs.h"
-#include "core/svg/SVGColor.h"
-#include "core/svg/SVGPaint.h"
-#include "core/svg/SVGURIReference.h"
-#include "wtf/MathExtras.h"
-
-#define HANDLE_INHERIT(prop, Prop) \
-if (isInherit) \
-{ \
-    svgstyle->set##Prop(state.parentStyle()->svgStyle()->prop()); \
-    return; \
-}
-
-#define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
-HANDLE_INHERIT(prop, Prop) \
-if (isInitial) { \
-    svgstyle->set##Prop(SVGRenderStyle::initial##Prop()); \
-    return; \
-}
-
-namespace WebCore {
-
-static float roundToNearestGlyphOrientationAngle(float angle)
-{
-    angle = fabsf(fmodf(angle, 360.0f));
-
-    if (angle <= 45.0f || angle > 315.0f)
-        return 0.0f;
-    else if (angle > 45.0f && angle <= 135.0f)
-        return 90.0f;
-    else if (angle > 135.0f && angle <= 225.0f)
-        return 180.0f;
-
-    return 270.0f;
-}
-
-static int angleToGlyphOrientation(float angle)
-{
-    angle = roundToNearestGlyphOrientationAngle(angle);
-
-    if (angle == 0.0f)
-        return GO_0DEG;
-    else if (angle == 90.0f)
-        return GO_90DEG;
-    else if (angle == 180.0f)
-        return GO_180DEG;
-    else if (angle == 270.0f)
-        return GO_270DEG;
-
-    return -1;
-}
-
-static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor)
-{
-    Color color;
-    if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
-        color = fgColor;
-    else
-        color = svgColor->color();
-    return color;
-}
-
-void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
-{
-    ASSERT(value);
-    CSSPrimitiveValue* primitiveValue = 0;
-    if (value->isPrimitiveValue())
-        primitiveValue = toCSSPrimitiveValue(value);
-
-    const StyleResolverState& state = m_state;
-    SVGRenderStyle* svgstyle = state.style()->accessSVGStyle();
-
-    bool isInherit = state.parentNode() && value->isInheritedValue();
-    bool isInitial = value->isInitialValue() || (!state.parentNode() && value->isInheritedValue());
-
-    // What follows is a list that maps the CSS properties into their
-    // corresponding front-end RenderStyle values. Shorthands(e.g. border,
-    // background) occur in this list as well and are only hit when mapping
-    // "inherit" or "initial" into front-end values.
-    switch (id)
-    {
-        // ident only properties
-        case CSSPropertyAlignmentBaseline:
-        {
-            HANDLE_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline)
-            if (!primitiveValue)
-                break;
-
-            svgstyle->setAlignmentBaseline(*primitiveValue);
-            break;
-        }
-        case CSSPropertyBaselineShift:
-        {
-            HANDLE_INHERIT_AND_INITIAL(baselineShift, BaselineShift);
-            if (!primitiveValue)
-                break;
-
-            if (primitiveValue->getValueID()) {
-                switch (primitiveValue->getValueID()) {
-                case CSSValueBaseline:
-                    svgstyle->setBaselineShift(BS_BASELINE);
-                    break;
-                case CSSValueSub:
-                    svgstyle->setBaselineShift(BS_SUB);
-                    break;
-                case CSSValueSuper:
-                    svgstyle->setBaselineShift(BS_SUPER);
-                    break;
-                default:
-                    break;
-                }
-            } else {
-                svgstyle->setBaselineShift(BS_LENGTH);
-                svgstyle->setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue));
-            }
-
-            break;
-        }
-        case CSSPropertyKerning:
-        {
-            HANDLE_INHERIT_AND_INITIAL(kerning, Kerning);
-            if (primitiveValue)
-                svgstyle->setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue));
-            break;
-        }
-        case CSSPropertyDominantBaseline:
-        {
-            HANDLE_INHERIT_AND_INITIAL(dominantBaseline, DominantBaseline)
-            if (primitiveValue)
-                svgstyle->setDominantBaseline(*primitiveValue);
-            break;
-        }
-        case CSSPropertyColorInterpolation:
-        {
-            HANDLE_INHERIT_AND_INITIAL(colorInterpolation, ColorInterpolation)
-            if (primitiveValue)
-                svgstyle->setColorInterpolation(*primitiveValue);
-            break;
-        }
-        case CSSPropertyColorInterpolationFilters:
-        {
-            HANDLE_INHERIT_AND_INITIAL(colorInterpolationFilters, ColorInterpolationFilters)
-            if (primitiveValue)
-                svgstyle->setColorInterpolationFilters(*primitiveValue);
-            break;
-        }
-        case CSSPropertyColorProfile:
-        {
-            // Not implemented.
-            break;
-        }
-        case CSSPropertyColorRendering:
-        {
-            HANDLE_INHERIT_AND_INITIAL(colorRendering, ColorRendering)
-            if (primitiveValue)
-                svgstyle->setColorRendering(*primitiveValue);
-            break;
-        }
-        case CSSPropertyClipRule:
-        {
-            HANDLE_INHERIT_AND_INITIAL(clipRule, ClipRule)
-            if (primitiveValue)
-                svgstyle->setClipRule(*primitiveValue);
-            break;
-        }
-        case CSSPropertyFillRule:
-        {
-            HANDLE_INHERIT_AND_INITIAL(fillRule, FillRule)
-            if (primitiveValue)
-                svgstyle->setFillRule(*primitiveValue);
-            break;
-        }
-        case CSSPropertyStrokeLinejoin:
-        {
-            HANDLE_INHERIT_AND_INITIAL(joinStyle, JoinStyle)
-            if (primitiveValue)
-                svgstyle->setJoinStyle(*primitiveValue);
-            break;
-        }
-        case CSSPropertyShapeRendering:
-        {
-            HANDLE_INHERIT_AND_INITIAL(shapeRendering, ShapeRendering)
-            if (primitiveValue)
-                svgstyle->setShapeRendering(*primitiveValue);
-            break;
-        }
-        // end of ident only properties
-        case CSSPropertyFill:
-        {
-            if (isInherit) {
-                const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle();
-                svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
-                return;
-            }
-            if (isInitial) {
-                svgstyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
-                return;
-            }
-            if (value->isSVGPaint()) {
-                SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
-                svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
-            }
-            break;
-        }
-        case CSSPropertyStroke:
-        {
-            if (isInherit) {
-                const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle();
-                svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
-                return;
-            }
-            if (isInitial) {
-                svgstyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
-                return;
-            }
-            if (value->isSVGPaint()) {
-                SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
-                svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
-            }
-            break;
-        }
-        case CSSPropertyStrokeWidth:
-        {
-            HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)
-            if (primitiveValue)
-                svgstyle->setStrokeWidth(SVGLength::fromCSSPrimitiveValue(primitiveValue));
-            break;
-        }
-        case CSSPropertyStrokeDasharray:
-        {
-            HANDLE_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
-            if (!value->isValueList()) {
-                svgstyle->setStrokeDashArray(SVGRenderStyle::initialStrokeDashArray());
-                break;
-            }
-
-            CSSValueList* dashes = toCSSValueList(value);
-
-            Vector<SVGLength> array;
-            size_t length = dashes->length();
-            for (size_t i = 0; i < length; ++i) {
-                CSSValue* currValue = dashes->itemWithoutBoundsCheck(i);
-                if (!currValue->isPrimitiveValue())
-                    continue;
-
-                CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBoundsCheck(i));
-                array.append(SVGLength::fromCSSPrimitiveValue(dash));
-            }
-
-            svgstyle->setStrokeDashArray(array);
-            break;
-        }
-        case CSSPropertyStrokeDashoffset:
-        {
-            HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)
-            if (primitiveValue)
-                svgstyle->setStrokeDashOffset(SVGLength::fromCSSPrimitiveValue(primitiveValue));
-            break;
-        }
-        case CSSPropertyFillOpacity:
-        {
-            HANDLE_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)
-            if (!primitiveValue)
-                return;
-
-            float f = 0.0f;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
-                f = primitiveValue->getFloatValue() / 100.0f;
-            else if (type == CSSPrimitiveValue::CSS_NUMBER)
-                f = primitiveValue->getFloatValue();
-            else
-                return;
-
-            svgstyle->setFillOpacity(f);
-            break;
-        }
-        case CSSPropertyStrokeOpacity:
-        {
-            HANDLE_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)
-            if (!primitiveValue)
-                return;
-
-            float f = 0.0f;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
-                f = primitiveValue->getFloatValue() / 100.0f;
-            else if (type == CSSPrimitiveValue::CSS_NUMBER)
-                f = primitiveValue->getFloatValue();
-            else
-                return;
-
-            svgstyle->setStrokeOpacity(f);
-            break;
-        }
-        case CSSPropertyStopOpacity:
-        {
-            HANDLE_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)
-            if (!primitiveValue)
-                return;
-
-            float f = 0.0f;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
-                f = primitiveValue->getFloatValue() / 100.0f;
-            else if (type == CSSPrimitiveValue::CSS_NUMBER)
-                f = primitiveValue->getFloatValue();
-            else
-                return;
-
-            svgstyle->setStopOpacity(f);
-            break;
-        }
-        case CSSPropertyMarkerStart:
-        {
-            HANDLE_INHERIT_AND_INITIAL(markerStartResource, MarkerStartResource)
-            if (!primitiveValue)
-                return;
-
-            String s;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_URI)
-                s = primitiveValue->getStringValue();
-
-            svgstyle->setMarkerStartResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
-            break;
-        }
-        case CSSPropertyMarkerMid:
-        {
-            HANDLE_INHERIT_AND_INITIAL(markerMidResource, MarkerMidResource)
-            if (!primitiveValue)
-                return;
-
-            String s;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_URI)
-                s = primitiveValue->getStringValue();
-
-            svgstyle->setMarkerMidResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
-            break;
-        }
-        case CSSPropertyMarkerEnd:
-        {
-            HANDLE_INHERIT_AND_INITIAL(markerEndResource, MarkerEndResource)
-            if (!primitiveValue)
-                return;
-
-            String s;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_URI)
-                s = primitiveValue->getStringValue();
-
-            svgstyle->setMarkerEndResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
-            break;
-        }
-        case CSSPropertyStrokeLinecap:
-        {
-            HANDLE_INHERIT_AND_INITIAL(capStyle, CapStyle)
-            if (primitiveValue)
-                svgstyle->setCapStyle(*primitiveValue);
-            break;
-        }
-        case CSSPropertyStrokeMiterlimit:
-        {
-            HANDLE_INHERIT_AND_INITIAL(strokeMiterLimit, StrokeMiterLimit)
-            if (!primitiveValue)
-                return;
-
-            float f = 0.0f;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_NUMBER)
-                f = primitiveValue->getFloatValue();
-            else
-                return;
-
-            svgstyle->setStrokeMiterLimit(f);
-            break;
-        }
-        case CSSPropertyFilter:
-        {
-            HANDLE_INHERIT_AND_INITIAL(filterResource, FilterResource)
-            if (!primitiveValue)
-                return;
-
-            String s;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_URI)
-                s = primitiveValue->getStringValue();
-
-            svgstyle->setFilterResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
-            break;
-        }
-        case CSSPropertyMask:
-        {
-            HANDLE_INHERIT_AND_INITIAL(maskerResource, MaskerResource)
-            if (!primitiveValue)
-                return;
-
-            String s;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_URI)
-                s = primitiveValue->getStringValue();
-
-            svgstyle->setMaskerResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
-            break;
-        }
-        case CSSPropertyClipPath:
-        {
-            HANDLE_INHERIT_AND_INITIAL(clipperResource, ClipperResource)
-            if (!primitiveValue)
-                return;
-
-            String s;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_URI)
-                s = primitiveValue->getStringValue();
-
-            svgstyle->setClipperResource(SVGURIReference::fragmentIdentifierFromIRIString(s, state.document()));
-            break;
-        }
-        case CSSPropertyTextAnchor:
-        {
-            HANDLE_INHERIT_AND_INITIAL(textAnchor, TextAnchor)
-            if (primitiveValue)
-                svgstyle->setTextAnchor(*primitiveValue);
-            break;
-        }
-        case CSSPropertyWritingMode:
-        {
-            HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode)
-            if (primitiveValue)
-                svgstyle->setWritingMode(*primitiveValue);
-            break;
-        }
-        case CSSPropertyStopColor:
-        {
-            HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor);
-            if (value->isSVGColor())
-                svgstyle->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
-            break;
-        }
-       case CSSPropertyLightingColor:
-        {
-            HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor);
-            if (value->isSVGColor())
-                svgstyle->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
-            break;
-        }
-        case CSSPropertyFloodOpacity:
-        {
-            HANDLE_INHERIT_AND_INITIAL(floodOpacity, FloodOpacity)
-            if (!primitiveValue)
-                return;
-
-            float f = 0.0f;
-            int type = primitiveValue->primitiveType();
-            if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
-                f = primitiveValue->getFloatValue() / 100.0f;
-            else if (type == CSSPrimitiveValue::CSS_NUMBER)
-                f = primitiveValue->getFloatValue();
-            else
-                return;
-
-            svgstyle->setFloodOpacity(f);
-            break;
-        }
-        case CSSPropertyFloodColor:
-        {
-            HANDLE_INHERIT_AND_INITIAL(floodColor, FloodColor);
-            if (value->isSVGColor())
-                svgstyle->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
-            break;
-        }
-        case CSSPropertyGlyphOrientationHorizontal:
-        {
-            HANDLE_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientationHorizontal)
-            if (!primitiveValue)
-                return;
-
-            if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {
-                int orientation = angleToGlyphOrientation(primitiveValue->getFloatValue());
-                ASSERT(orientation != -1);
-
-                svgstyle->setGlyphOrientationHorizontal((EGlyphOrientation) orientation);
-            }
-
-            break;
-        }
-        case CSSPropertyGlyphOrientationVertical:
-        {
-            HANDLE_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientationVertical)
-            if (!primitiveValue)
-                return;
-
-            if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {
-                int orientation = angleToGlyphOrientation(primitiveValue->getFloatValue());
-                ASSERT(orientation != -1);
-
-                svgstyle->setGlyphOrientationVertical((EGlyphOrientation) orientation);
-            } else if (primitiveValue->getValueID() == CSSValueAuto)
-                svgstyle->setGlyphOrientationVertical(GO_AUTO);
-
-            break;
-        }
-        case CSSPropertyEnableBackground:
-            // Silently ignoring this property for now
-            // http://bugs.webkit.org/show_bug.cgi?id=6022
-            break;
-        case CSSPropertyWebkitSvgShadow: {
-            if (isInherit)
-                return svgstyle->setShadow(adoptPtr(state.parentStyle()->svgStyle()->shadow() ? new ShadowData(*state.parentStyle()->svgStyle()->shadow()) : 0));
-            if (isInitial || primitiveValue) // initial | none
-                return svgstyle->setShadow(nullptr);
-
-            if (!value->isValueList())
-                return;
-
-            CSSValueList* list = toCSSValueList(value);
-            if (!list->length())
-                return;
-
-            CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
-            if (!firstValue->isShadowValue())
-                return;
-            ShadowValue* item = static_cast<ShadowValue*>(firstValue);
-            IntPoint location(item->x->computeLength<int>(state.style(), state.rootElementStyle()),
-                item->y->computeLength<int>(state.style(), state.rootElementStyle()));
-            int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle()) : 0;
-            Color color;
-            if (item->color)
-                color = resolveColorFromPrimitiveValue(item->color.get());
-
-            // -webkit-svg-shadow does should not have a spread or style
-            ASSERT(!item->spread);
-            ASSERT(!item->style);
-
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(location, blur, 0, Normal, color.isValid() ? color : Color::transparent));
-            svgstyle->setShadow(shadowData.release());
-            return;
-        }
-        case CSSPropertyVectorEffect: {
-            HANDLE_INHERIT_AND_INITIAL(vectorEffect, VectorEffect)
-            if (!primitiveValue)
-                break;
-
-            svgstyle->setVectorEffect(*primitiveValue);
-            break;
-        }
-        case CSSPropertyBufferedRendering: {
-            HANDLE_INHERIT_AND_INITIAL(bufferedRendering, BufferedRendering)
-            if (!primitiveValue)
-                break;
-
-            svgstyle->setBufferedRendering(*primitiveValue);
-            break;
-        }
-        case CSSPropertyMaskType: {
-            HANDLE_INHERIT_AND_INITIAL(maskType, MaskType)
-            if (!primitiveValue)
-                break;
-
-            svgstyle->setMaskType(*primitiveValue);
-            break;
-        }
-        default:
-            // If you crash here, it's because you added a css property and are not handling it
-            // in either this switch statement or the one in StyleResolver::applyProperty
-            ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id);
-            return;
-    }
-}
-
-}
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 56757a9..fbdace1 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -40,9 +40,11 @@
 #include "core/dom/shadow/InsertionPoint.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
+#include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLFrameElementBase.h"
 #include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLOptGroupElement.h"
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/inspector/InspectorInstrumentation.h"
@@ -590,7 +592,7 @@
         case CSSSelector::PseudoHover:
             // If we're in quirks mode, then hover should never match anchors with no
             // href and *:hover should not match anything. This is important for sites like wsj.com.
-            if (m_strictParsing || context.isSubSelector || (selector->m_match == CSSSelector::Tag && selector->tagQName() != anyQName() && !element->hasTagName(aTag)) || element->isLink()) {
+            if (m_strictParsing || context.isSubSelector || (selector->m_match == CSSSelector::Tag && selector->tagQName() != anyQName() && !isHTMLAnchorElement(element)) || element->isLink()) {
                 if (m_mode == ResolvingStyle) {
                     if (context.elementStyle)
                         context.elementStyle->setAffectedByHover();
@@ -604,7 +606,7 @@
         case CSSSelector::PseudoActive:
             // If we're in quirks mode, then :active should never match anchors with no
             // href and *:active should not match anything.
-            if (m_strictParsing || context.isSubSelector || (selector->m_match == CSSSelector::Tag && selector->tagQName() != anyQName() && !element->hasTagName(aTag)) || element->isLink()) {
+            if (m_strictParsing || context.isSubSelector || (selector->m_match == CSSSelector::Tag && selector->tagQName() != anyQName() && !isHTMLAnchorElement(element)) || element->isLink()) {
                 if (m_mode == ResolvingStyle) {
                     if (context.elementStyle)
                         context.elementStyle->setAffectedByActive();
@@ -616,7 +618,7 @@
             }
             break;
         case CSSSelector::PseudoEnabled:
-            if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || element->hasTagName(optgroupTag)))
+            if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || isHTMLOptGroupElement(element)))
                 return !element->isDisabledFormControl();
             break;
         case CSSSelector::PseudoFullPageMedia:
@@ -625,7 +627,7 @@
         case CSSSelector::PseudoDefault:
             return element && element->isDefaultButtonForForm();
         case CSSSelector::PseudoDisabled:
-            if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || element->hasTagName(optgroupTag)))
+            if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || isHTMLOptGroupElement(element)))
                 return element->isDisabledFormControl();
             break;
         case CSSSelector::PseudoReadOnly:
diff --git a/Source/core/css/SelectorFilter.h b/Source/core/css/SelectorFilter.h
index 2e44252..44c976b 100644
--- a/Source/core/css/SelectorFilter.h
+++ b/Source/core/css/SelectorFilter.h
@@ -30,8 +30,8 @@
 #define SelectorFilter_h
 
 #include "core/dom/Element.h"
-#include <wtf/BloomFilter.h>
-#include <wtf/Vector.h>
+#include "wtf/BloomFilter.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/ShadowValue.cpp b/Source/core/css/ShadowValue.cpp
index c06ff9b..bf51a89 100644
--- a/Source/core/css/ShadowValue.cpp
+++ b/Source/core/css/ShadowValue.cpp
@@ -22,8 +22,8 @@
 
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/ShadowValue.h b/Source/core/css/ShadowValue.h
index cb9ce30..5645881 100644
--- a/Source/core/css/ShadowValue.h
+++ b/Source/core/css/ShadowValue.h
@@ -22,8 +22,8 @@
 #define ShadowValue_h
 
 #include "core/css/CSSValue.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/SiblingTraversalStrategies.h b/Source/core/css/SiblingTraversalStrategies.h
index 660a6c5..55b78d0 100644
--- a/Source/core/css/SiblingTraversalStrategies.h
+++ b/Source/core/css/SiblingTraversalStrategies.h
@@ -31,8 +31,7 @@
 
 #include "core/dom/Element.h"
 #include "core/rendering/style/RenderStyle.h"
-
-#include <wtf/UnusedParam.h>
+#include "wtf/UnusedParam.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/StyleMedia.h b/Source/core/css/StyleMedia.h
index f9e16ca..fdf620d 100644
--- a/Source/core/css/StyleMedia.h
+++ b/Source/core/css/StyleMedia.h
@@ -28,8 +28,8 @@
 #define StyleMedia_h
 
 #include "core/page/DOMWindowProperty.h"
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp
index 3e2135c..f8bb3fd 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -26,8 +26,8 @@
 #include "CSSValueKeywords.h"
 #include "core/css/StylePropertyShorthand.h"
 #include "core/page/RuntimeCSSEnabled.h"
-#include <wtf/BitArray.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/BitArray.h"
+#include "wtf/text/StringBuilder.h"
 
 using namespace std;
 
@@ -602,6 +602,11 @@
                     if (value->isImplicitInitialValue() || yValue->isImplicitInitialValue())
                         continue;
 
+                    // FIXME: At some point we need to fix this code to avoid returning an invalid shorthand,
+                    // since some longhand combinations are not serializable into a single shorthand.
+                    if (!value->isPrimitiveValue() || !yValue->isPrimitiveValue())
+                        continue;
+
                     CSSValueID xId = toCSSPrimitiveValue(value.get())->getValueID();
                     CSSValueID yId = toCSSPrimitiveValue(yValue.get())->getValueID();
                     if (xId != yId) {
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
index 8146755..491dee8 100644
--- a/Source/core/css/StylePropertySet.cpp
+++ b/Source/core/css/StylePropertySet.cpp
@@ -42,13 +42,6 @@
 
 namespace WebCore {
 
-typedef HashMap<MutableStylePropertySet*, OwnPtr<PropertySetCSSStyleDeclaration> > PropertySetCSSOMWrapperMap;
-static PropertySetCSSOMWrapperMap& propertySetCSSOMWrapperMap()
-{
-    DEFINE_STATIC_LOCAL(PropertySetCSSOMWrapperMap, propertySetCSSOMWrapperMapInstance, ());
-    return propertySetCSSOMWrapperMapInstance;
-}
-
 static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count)
 {
     return sizeof(ImmutableStylePropertySet) - sizeof(void*) + sizeof(CSSValue*) * count + sizeof(StylePropertyMetadata) * count;
@@ -68,6 +61,11 @@
     return ImmutableStylePropertySet::create(mutableThis->m_propertyVector.data(), mutableThis->m_propertyVector.size(), cssParserMode());
 }
 
+MutableStylePropertySet::MutableStylePropertySet(CSSParserMode cssParserMode)
+    : StylePropertySet(cssParserMode)
+{
+}
+
 MutableStylePropertySet::MutableStylePropertySet(const CSSProperty* properties, unsigned length)
     : StylePropertySet(CSSStrictMode)
 {
@@ -107,13 +105,6 @@
     }
 }
 
-MutableStylePropertySet::~MutableStylePropertySet()
-{
-    ASSERT(!m_ownsCSSOMWrapper || propertySetCSSOMWrapperMap().contains(this));
-    if (m_ownsCSSOMWrapper)
-        propertySetCSSOMWrapperMap().remove(this);
-}
-
 String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const
 {
     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
@@ -328,6 +319,11 @@
     return StylePropertySerializer(*this).asText();
 }
 
+bool StylePropertySet::hasCSSOMWrapper() const
+{
+    return m_isMutable && static_cast<const MutableStylePropertySet*>(this)->m_cssomWrapper;
+}
+
 void MutableStylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet* other)
 {
     ASSERT(isMutable());
@@ -381,9 +377,7 @@
     CSSPropertyWebkitRegionBreakBefore,
     CSSPropertyWebkitRegionBreakInside,
     CSSPropertyTextAlign,
-#if ENABLE(CSS3_TEXT)
-    CSSPropertyWebkitTextAlignLast,
-#endif // CSS3_TEXT
+    CSSPropertyTextAlignLast,
     CSSPropertyTextIndent,
     CSSPropertyWidows
 };
@@ -515,34 +509,28 @@
 
 PropertySetCSSStyleDeclaration* MutableStylePropertySet::cssStyleDeclaration()
 {
-    if (!m_ownsCSSOMWrapper)
-        return 0;
-    return propertySetCSSOMWrapperMap().get(this);
+    return m_cssomWrapper.get();
 }
 
 CSSStyleDeclaration* MutableStylePropertySet::ensureCSSStyleDeclaration()
 {
-    if (m_ownsCSSOMWrapper) {
-        ASSERT(!static_cast<CSSStyleDeclaration*>(propertySetCSSOMWrapperMap().get(this))->parentRule());
-        ASSERT(!propertySetCSSOMWrapperMap().get(this)->parentElement());
-        return propertySetCSSOMWrapperMap().get(this);
+    if (m_cssomWrapper) {
+        ASSERT(!static_cast<CSSStyleDeclaration*>(m_cssomWrapper.get())->parentRule());
+        ASSERT(!m_cssomWrapper->parentElement());
+        return m_cssomWrapper.get();
     }
-    m_ownsCSSOMWrapper = true;
-    PropertySetCSSStyleDeclaration* cssomWrapper = new PropertySetCSSStyleDeclaration(this);
-    propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
-    return cssomWrapper;
+    m_cssomWrapper = adoptPtr(new PropertySetCSSStyleDeclaration(this));
+    return m_cssomWrapper.get();
 }
 
 CSSStyleDeclaration* MutableStylePropertySet::ensureInlineCSSStyleDeclaration(Element* parentElement)
 {
-    if (m_ownsCSSOMWrapper) {
-        ASSERT(propertySetCSSOMWrapperMap().get(this)->parentElement() == parentElement);
-        return propertySetCSSOMWrapperMap().get(this);
+    if (m_cssomWrapper) {
+        ASSERT(m_cssomWrapper->parentElement() == parentElement);
+        return m_cssomWrapper.get();
     }
-    m_ownsCSSOMWrapper = true;
-    PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(this, parentElement);
-    propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
-    return cssomWrapper;
+    m_cssomWrapper = adoptPtr(new InlineCSSStyleDeclaration(this, parentElement));
+    return m_cssomWrapper.get();
 }
 
 unsigned StylePropertySet::averageSizeInBytes()
diff --git a/Source/core/css/StylePropertySet.h b/Source/core/css/StylePropertySet.h
index 3fed430..3f0e3f8 100644
--- a/Source/core/css/StylePropertySet.h
+++ b/Source/core/css/StylePropertySet.h
@@ -25,9 +25,10 @@
 #include "core/css/CSSParserMode.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSProperty.h"
-#include <wtf/ListHashSet.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "core/css/PropertySetCSSStyleDeclaration.h"
+#include "wtf/ListHashSet.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -37,7 +38,6 @@
 class ImmutableStylePropertySet;
 class KURL;
 class MutableStylePropertySet;
-class PropertySetCSSStyleDeclaration;
 class StylePropertyShorthand;
 class StyleSheetContents;
 
@@ -106,7 +106,7 @@
     String asText() const;
 
     bool isMutable() const { return m_isMutable; }
-    bool hasCSSOMWrapper() const { return m_ownsCSSOMWrapper; }
+    bool hasCSSOMWrapper() const;
 
     bool hasFailedOrCanceledSubresources() const;
 
@@ -122,22 +122,19 @@
 protected:
     StylePropertySet(CSSParserMode cssParserMode)
         : m_cssParserMode(cssParserMode)
-        , m_ownsCSSOMWrapper(false)
         , m_isMutable(true)
         , m_arraySize(0)
     { }
 
     StylePropertySet(CSSParserMode cssParserMode, unsigned immutableArraySize)
         : m_cssParserMode(cssParserMode)
-        , m_ownsCSSOMWrapper(false)
         , m_isMutable(false)
         , m_arraySize(immutableArraySize)
     { }
 
     unsigned m_cssParserMode : 2;
-    mutable unsigned m_ownsCSSOMWrapper : 1;
     mutable unsigned m_isMutable : 1;
-    unsigned m_arraySize : 28;
+    unsigned m_arraySize : 29;
 
     friend class PropertySetCSSStyleDeclaration;
 };
@@ -174,13 +171,9 @@
 
 class MutableStylePropertySet : public StylePropertySet {
 public:
-    ~MutableStylePropertySet();
-
     static PassRefPtr<MutableStylePropertySet> create(CSSParserMode = CSSQuirksMode);
     static PassRefPtr<MutableStylePropertySet> create(const CSSProperty* properties, unsigned count);
 
-    MutableStylePropertySet(const StylePropertySet&);
-
     unsigned propertyCount() const { return m_propertyVector.size(); }
     PropertySetCSSStyleDeclaration* cssStyleDeclaration();
 
@@ -216,14 +209,15 @@
     Vector<CSSProperty, 4> m_propertyVector;
 
 private:
-    MutableStylePropertySet(CSSParserMode cssParserMode)
-        : StylePropertySet(cssParserMode)
-    { }
-
+    explicit MutableStylePropertySet(CSSParserMode);
+    explicit MutableStylePropertySet(const StylePropertySet&);
     MutableStylePropertySet(const CSSProperty* properties, unsigned count);
 
     bool removeShorthandProperty(CSSPropertyID);
     CSSProperty* findCSSPropertyWithID(CSSPropertyID);
+    OwnPtr<PropertySetCSSStyleDeclaration> m_cssomWrapper;
+
+    friend class StylePropertySet;
 };
 
 inline StylePropertyMetadata StylePropertySet::PropertyReference::propertyMetadata() const
diff --git a/Source/core/css/StyleRule.h b/Source/core/css/StyleRule.h
index f242baa..a4ac186 100644
--- a/Source/core/css/StyleRule.h
+++ b/Source/core/css/StyleRule.h
@@ -24,7 +24,7 @@
 
 #include "core/css/CSSSelectorList.h"
 #include "core/css/MediaList.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/StyleRuleImport.cpp b/Source/core/css/StyleRuleImport.cpp
index d3808d3..e207dd2 100644
--- a/Source/core/css/StyleRuleImport.cpp
+++ b/Source/core/css/StyleRuleImport.cpp
@@ -22,12 +22,12 @@
 #include "config.h"
 #include "core/css/StyleRuleImport.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/Document.h"
 #include "core/loader/cache/CachedCSSStyleSheet.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 
 namespace WebCore {
 
@@ -114,7 +114,7 @@
         rootSheet = sheet;
     }
 
-    CachedResourceRequest request(ResourceRequest(absURL), cachedResourceRequestInitiators().css, m_parentStyleSheet->charset());
+    CachedResourceRequest request(ResourceRequest(absURL), CachedResourceInitiatorTypeNames::css, m_parentStyleSheet->charset());
     if (m_parentStyleSheet->isUserStyleSheet())
         m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request);
     else
diff --git a/Source/core/css/StyleSheet.h b/Source/core/css/StyleSheet.h
index 8c513ef..6ca572e 100644
--- a/Source/core/css/StyleSheet.h
+++ b/Source/core/css/StyleSheet.h
@@ -27,7 +27,7 @@
 
 namespace WebCore {
 
-class CSSImportRule;
+class CSSRule;
 class KURL;
 class MediaList;
 class Node;
@@ -46,7 +46,7 @@
     virtual MediaList* media() const { return 0; }
     virtual String type() const = 0;
 
-    virtual CSSImportRule* ownerRule() const { return 0; }
+    virtual CSSRule* ownerRule() const { return 0; }
     virtual void clearOwnerNode() = 0;
     virtual KURL baseURL() const = 0;
     virtual bool isLoading() const = 0;
diff --git a/Source/core/css/StyleSheetContents.cpp b/Source/core/css/StyleSheetContents.cpp
index f7786ce..e585dfd 100644
--- a/Source/core/css/StyleSheetContents.cpp
+++ b/Source/core/css/StyleSheetContents.cpp
@@ -21,9 +21,6 @@
 #include "config.h"
 #include "core/css/StyleSheetContents.h"
 
-#include <wtf/Deque.h>
-#include <wtf/MemoryInstrumentationHashMap.h>
-#include <wtf/MemoryInstrumentationVector.h>
 #include "core/css/CSSParser.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/MediaList.h"
@@ -34,6 +31,9 @@
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/cache/CachedCSSStyleSheet.h"
 #include "weborigin/SecurityOrigin.h"
+#include "wtf/Deque.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryInstrumentationVector.h"
 
 namespace WebCore {
 
@@ -279,7 +279,7 @@
     String sheetText = cachedStyleSheet->sheetText(enforceMIMEType, &hasValidMIMEType);
 
     CSSParser p(parserContext(), UseCounter::getFrom(this));
-    p.parseSheet(this, sheetText, 0, 0, true);
+    p.parseSheet(this, sheetText, TextPosition::minimumPosition(), 0, true);
 
     // If we're loading a stylesheet cross-origin, and the MIME type is not standard, require the CSS
     // to at least start with a syntactically valid CSS rule.
@@ -304,13 +304,13 @@
 
 bool StyleSheetContents::parseString(const String& sheetText)
 {
-    return parseStringAtLine(sheetText, 0, false);
+    return parseStringAtPosition(sheetText, TextPosition::minimumPosition(), false);
 }
 
-bool StyleSheetContents::parseStringAtLine(const String& sheetText, int startLineNumber, bool createdByParser)
+bool StyleSheetContents::parseStringAtPosition(const String& sheetText, const TextPosition& startPosition, bool createdByParser)
 {
     CSSParser p(parserContext(), UseCounter::getFrom(this));
-    p.parseSheet(this, sheetText, startLineNumber, 0, createdByParser);
+    p.parseSheet(this, sheetText, startPosition, 0, createdByParser);
 
     return true;
 }
diff --git a/Source/core/css/StyleSheetContents.h b/Source/core/css/StyleSheetContents.h
index bc4d272..b5be40a 100644
--- a/Source/core/css/StyleSheetContents.h
+++ b/Source/core/css/StyleSheetContents.h
@@ -28,6 +28,8 @@
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
 #include "wtf/text/AtomicStringHash.h"
+#include "wtf/text/TextPosition.h"
+
 
 namespace WebCore {
 
@@ -62,7 +64,7 @@
 
     void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*);
     bool parseString(const String&);
-    bool parseStringAtLine(const String&, int startLineNumber, bool);
+    bool parseStringAtPosition(const String&, const TextPosition&, bool);
 
     bool isCacheable() const;
 
diff --git a/Source/core/css/StyleSheetList.cpp b/Source/core/css/StyleSheetList.cpp
index bd00038..ec2e712 100644
--- a/Source/core/css/StyleSheetList.cpp
+++ b/Source/core/css/StyleSheetList.cpp
@@ -25,7 +25,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/DocumentStyleSheetCollection.h"
 #include "core/html/HTMLStyleElement.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/StyleSheetList.h b/Source/core/css/StyleSheetList.h
index 9963e30..e340f04 100644
--- a/Source/core/css/StyleSheetList.h
+++ b/Source/core/css/StyleSheetList.h
@@ -22,10 +22,10 @@
 #define StyleSheetList_h
 
 #include "core/css/CSSStyleSheet.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/html.css b/Source/core/css/html.css
index 057d693..28bc5ca 100644
--- a/Source/core/css/html.css
+++ b/Source/core/css/html.css
@@ -469,42 +469,10 @@
 }
 
 #if defined(ENABLE_INPUT_MULTIPLE_FIELDS_UI) && ENABLE_INPUT_MULTIPLE_FIELDS_UI
-input[type="date"] {
-    -webkit-align-items: center;
-    display: -webkit-inline-flex;
-    font-family: monospace;
-    overflow: hidden;
-    padding: 0;
-    -webkit-padding-start: 1px;
-}
-
-input[type="datetime-local"] {
-    -webkit-align-items: center;
-    display: -webkit-inline-flex;
-    font-family: monospace;
-    overflow: hidden;
-    padding: 0;
-    -webkit-padding-start: 1px;
-}
-
-input[type="month"] {
-    -webkit-align-items: center;
-    display: -webkit-inline-flex;
-    font-family: monospace;
-    overflow: hidden;
-    padding: 0;
-    -webkit-padding-start: 1px;
-}
-
-input[type="time"] {
-    -webkit-align-items: center;
-    display: -webkit-inline-flex;
-    font-family: monospace;
-    overflow: hidden;
-    padding: 0;
-    -webkit-padding-start: 1px;
-}
-
+input[type="date"],
+input[type="datetime-local"],
+input[type="month"],
+input[type="time"],
 input[type="week"] {
     -webkit-align-items: center;
     display: -webkit-inline-flex;
@@ -593,48 +561,10 @@
 }
 
 #else
-input[type="date"] {
-    -webkit-align-items: center;
-    -webkit-appearance: menulist-button;
-    display: -webkit-inline-flex;
-    overflow: hidden;
-    width: 10em;
-}
-
-#if defined(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) && ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE
-input[type="datetime"] {
-    -webkit-align-items: center;
-    -webkit-appearance: menulist-button;
-    display: -webkit-inline-flex;
-    overflow: hidden;
-    width: 10em;
-}
-#endif
-
-input[type="datetime-local"] {
-    -webkit-align-items: center;
-    -webkit-appearance: menulist-button;
-    display: -webkit-inline-flex;
-    overflow: hidden;
-    width: 10em;
-}
-
-input[type="month"] {
-    -webkit-align-items: center;
-    -webkit-appearance: menulist-button;
-    display: -webkit-inline-flex;
-    overflow: hidden;
-    width: 10em;
-}
-
-input[type="time"] {
-    -webkit-align-items: center;
-    -webkit-appearance: menulist-button;
-    display: -webkit-inline-flex;
-    overflow: hidden;
-    width: 10em;
-}
-
+input[type="date"],
+input[type="datetime-local"],
+input[type="month"],
+input[type="time"],
 input[type="week"] {
     -webkit-align-items: center;
     -webkit-appearance: menulist-button;
diff --git a/Source/core/css/mediaControls.css b/Source/core/css/mediaControls.css
index 872f595..1e3b928 100644
--- a/Source/core/css/mediaControls.css
+++ b/Source/core/css/mediaControls.css
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2009, 2010, 2011 Apple Inc.  All rights reserved.
+ * 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
@@ -19,43 +20,66 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* media controls */
+/* Chromium default media controls */
 
 body:-webkit-full-page-media {
-    background-color: rgb(38, 38, 38);
+    background-color: rgb(0, 0, 0);
 }
 
 audio {
-    width: 200px;
-    height: 16px;
+    width: 300px;
+    height: 30px;
 }
 
 ::-webkit-media-controls {
     width: inherit;
     height: inherit;
     position: relative;
-    display: -webkit-flex;
     direction: ltr;
-    -webkit-align-items: flex-start;
-    -webkit-justify-content: flex-end;
+    display: -webkit-flex;
     -webkit-flex-direction: column;
+    -webkit-justify-content: flex-end;
+    -webkit-align-items: center;
+}
+
+audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure {
+    width: 100%;
+    max-width: 800px;
+    height: 30px;
+    -webkit-flex-shrink: 0;
+    bottom: 0;
+    text-indent: 0;
+    padding: 0;
+    box-sizing: border-box;
+}
+
+video::-webkit-media-controls-enclosure {
+    padding: 0px 5px 5px 5px;
+    height: 35px;
+    -webkit-flex-shrink: 0;
 }
 
 audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
     display: -webkit-flex;
     -webkit-flex-direction: row;
     -webkit-align-items: center;
+    /* We use flex-start here to ensure that the play button is visible even
+     * if we are too small to show all controls.
+     */
+    -webkit-justify-content: flex-start;
     -webkit-user-select: none;
     position: relative;
-    bottom: 0;
     width: 100%;
     z-index: 0;
     overflow: hidden;
-    height: 16px;
     text-align: right;
+    bottom: auto;
+    height: 30px;
+    background-color: rgba(20, 20, 20, 0.8);
+    border-radius: 5px;
 }
 
 video:-webkit-full-page-media {
@@ -67,6 +91,12 @@
     left: 0;
 }
 
+audio:-webkit-full-page-media, video:-webkit-full-page-media {
+    max-height: 100%;
+    max-width: 100%;
+}
+
+audio:-webkit-full-page-media::-webkit-media-controls-panel,
 video:-webkit-full-page-media::-webkit-media-controls-panel {
     bottom: 0px;
 }
@@ -74,10 +104,15 @@
 audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
     -webkit-appearance: media-mute-button;
     display: -webkit-flex;
-    width: 16px;
-    height: 16px;
+    -webkit-flex: none;
+    border: none;
+    box-sizing: border-box;
+    width: 35px;
+    height: 30px;
+    line-height: 30px;
+    margin: 0 6px 0 0;
+    padding: 0;
     background-color: initial;
-    border: initial;
     color: inherit;
 }
 
@@ -88,10 +123,16 @@
 audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
     -webkit-appearance: media-play-button;
     display: -webkit-flex;
-    width: 16px;
-    height: 16px;
+    -webkit-flex: none;
+    border: none;
+    box-sizing: border-box;
+    width: 30px;
+    height: 30px;
+    line-height: 30px;
+    margin-left: 9px;
+    margin-right: 9px;
+    padding: 0;
     background-color: initial;
-    border: initial;
     color: inherit;
 }
 
@@ -107,32 +148,88 @@
     min-width: 0;
 }
 
-audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display {
-    display: none;
-}
-
+audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display,
 audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
-    display: none;
+    -webkit-appearance: media-current-time-display;
+    -webkit-user-select: none;
+    -webkit-flex: none;
+    display: -webkit-flex;
+    border: none;
+    cursor: default;
+
+    height: 30px;
+    margin: 0 9px 0 0;
+    padding: 0;
+
+    line-height: 30px;
+    font-family: Arial, Helvetica, sans-serif;
+    font-size: 13px;
+    font-weight: bold;
+    font-style: normal;
+    color: white;
+
+    letter-spacing: normal;
+    word-spacing: normal;
+    text-transform: none;
+    text-indent: 0;
+    text-shadow: none;
+    text-decoration: none;
 }
 
 audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
     -webkit-appearance: media-slider;
     display: -webkit-flex;
-    -webkit-flex: 1 1;
-    height: 16px;
-    padding: 0px 2px;
-    background-color: initial;
+    -webkit-flex: 1 1 auto;
+    height: 8px;
+    margin: 0 15px 0 0;
+    padding: 0;
+    background-color: transparent;
+    min-width: 25px;
     border: initial;
     color: inherit;
-    margin: initial;
-    min-width: 0;
 }
 
 audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
-    background-color: initial;
+    -webkit-appearance: media-volume-slider;
+    display: -webkit-flex;
+    /* The 1.9 value was empirically chosen to match old-flexbox behaviour
+     * and be aesthetically pleasing.
+     */
+    -webkit-flex: 1 1.9 auto;
+    height: 8px;
+    max-width: 70px;
+    margin: 0 15px 0 0;
+    padding: 0;
+    background-color: transparent;
+    min-width: 15px;
     border: initial;
     color: inherit;
-    margin: initial;
+}
+
+/* FIXME these shouldn't use special pseudoShadowIds, but nicer rules.
+   https://code.google.com/p/chromium/issues/detail?id=112508
+   https://bugs.webkit.org/show_bug.cgi?id=62218
+*/
+input[type="range"]::-webkit-media-slider-container {
+    display: -webkit-flex;
+    -webkit-align-items: center;
+    -webkit-flex-direction: row; /* This property is updated by C++ code. */
+    box-sizing: border-box;
+    height: 100%;
+    width: 100%;
+    border: 1px solid rgba(230, 230, 230, 0.35);
+    border-radius: 4px;
+    background-color: transparent; /* Background drawing is managed by C++ code to draw ranges. */
+}
+
+/* The negative right margin causes the track to overflow its container. */
+input[type="range"]::-webkit-media-slider-container > div {
+    margin-right: -14px;
+}
+
+input[type="range"]::-webkit-media-slider-thumb {
+    margin-left: -7px;
+    margin-right: -7px;
 }
 
 audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
@@ -158,10 +255,16 @@
 audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
     -webkit-appearance: media-enter-fullscreen-button;
     display: -webkit-flex;
-    width: 16px;
-    height: 16px;
+    -webkit-flex: none;
+    border: none;
+    box-sizing: border-box;
+    width: 30px;
+    height: 30px;
+    line-height: 30px;
+    margin-left: -5px;
+    margin-right: 9px;
+    padding: 0;
     background-color: initial;
-    border: initial;
     color: inherit;
 }
 
@@ -182,10 +285,16 @@
 audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button {
     -webkit-appearance: media-toggle-closed-captions-button;
     display: -webkit-flex;
-    width: 16px;
-    height: 16px;
+    -webkit-flex: none;
+    border: none;
+    box-sizing: border-box;
+    width: 30px;
+    height: 30px;
+    line-height: 30px;
+    margin-left: -5px;
+    margin-right: 9px;
+    padding: 0;
     background-color: initial;
-    border: initial;
     color: inherit;
 }
 
diff --git a/Source/core/css/mediaControlsAndroid.css b/Source/core/css/mediaControlsAndroid.css
new file mode 100644
index 0000000..1849402
--- /dev/null
+++ b/Source/core/css/mediaControlsAndroid.css
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 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,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Media controls for Chromium on Android */
+
+audio {
+    height: 35px;
+}
+
+audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure {
+    height: 35px;
+}
+
+audio::-webkit-media-controls-overlay-enclosure {
+    display: none;
+}
+
+video::-webkit-media-controls-overlay-enclosure {
+    display: -webkit-flex;
+    position: relative;
+    -webkit-flex-direction: column;
+    -webkit-justify-content: flex-end;
+    -webkit-align-items: center;
+    -webkit-flex: 1 1;
+    width: 100%;
+    max-width: 800px;
+    text-indent: 0;
+    box-sizing: border-box;
+    overflow: hidden;
+}
+
+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 {
+    display: none;
+}
+
+video::-webkit-media-controls-overlay-play-button {
+    -webkit-appearance: media-overlay-play-button;
+    display: -webkit-flex;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    margin-left: -40px;
+    margin-top: -40px;
+    border: none;
+    box-sizing: border-box;
+    background-color: transparent;
+    width: 80px;
+    height: 80px;
+    padding: 0;
+}
+
+audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
+    width: 35px;
+    height: 35px;
+    line-height: 35px;
+}
+
+audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display,
+audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
+    height: 35px;
+    line-height: 35px;
+    font-size: 18px;
+}
+
+audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
+    display: none;
+}
+
+video::-webkit-media-controls-fullscreen-button {
+    width: 35px;
+    height: 35px;
+    line-height: 35px;
+}
+
+audio::-webkit-media-controls-fullscreen-button {
+    display: none;
+}
+
+audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button {
+    width: 35px;
+    height: 35px;
+    line-height: 35px;
+}
diff --git a/Source/core/css/mediaControlsChromium.css b/Source/core/css/mediaControlsChromium.css
deleted file mode 100644
index 8509436..0000000
--- a/Source/core/css/mediaControlsChromium.css
+++ /dev/null
@@ -1,218 +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,
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Chromium default media controls */
-
-body:-webkit-full-page-media {
-    background-color: rgb(0, 0, 0);
-}
-
-audio {
-    width: 300px;
-    height: 30px;
-}
-
-audio:-webkit-full-page-media, video:-webkit-full-page-media {
-    max-height: 100%;
-    max-width: 100%;
-}
-
-audio:-webkit-full-page-media::-webkit-media-controls-panel,
-video:-webkit-full-page-media::-webkit-media-controls-panel {
-    bottom: 0px;
-}
-
-::-webkit-media-controls {
-    display: -webkit-flex;
-    -webkit-flex-direction: column;
-    -webkit-justify-content: flex-end;
-    -webkit-align-items: center;
-}
-
-audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure {
-    width: 100%;
-    max-width: 800px;
-    height: 30px;
-    -webkit-flex-shrink: 0;
-    bottom: 0;
-    text-indent: 0;
-    padding: 0;
-    box-sizing: border-box;
-}
-
-video::-webkit-media-controls-enclosure {
-    padding: 0px 5px 5px 5px;
-    height: 35px;
-    -webkit-flex-shrink: 0;
-}
-
-audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
-    display: -webkit-flex;
-    -webkit-flex-direction: row;
-    -webkit-align-items: center;
-    /* We use flex-start here to ensure that the play button is visible even
-     * if we are too small to show all controls.
-     */
-    -webkit-justify-content: flex-start;
-    bottom: auto;
-    height: 30px;
-    background-color: rgba(20, 20, 20, 0.8);
-    border-radius: 5px;
-}
-
-audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
-    -webkit-appearance: media-mute-button;
-    display: -webkit-flex;
-    -webkit-flex: none;
-    border: none;
-    box-sizing: border-box;
-    width: 35px;
-    height: 30px;
-    line-height: 30px;
-    margin: 0 6px 0 0;
-    padding: 0;
-}
-
-audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
-    -webkit-appearance: media-play-button;
-    display: -webkit-flex;
-    -webkit-flex: none;
-    border: none;
-    box-sizing: border-box;
-    width: 30px;
-    height: 30px;
-    line-height: 30px;
-    margin-left: 9px;
-    margin-right: 9px;
-    padding: 0;
-}
-
-audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display,
-audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
-    -webkit-appearance: media-current-time-display;
-    -webkit-user-select: none;
-    -webkit-flex: none;
-    display: -webkit-flex;
-    border: none;
-    cursor: default;
-
-    height: 30px;
-    margin: 0 9px 0 0;
-    padding: 0;
-
-    line-height: 30px;
-    font-family: Arial, Helvetica, sans-serif;
-    font-size: 13px;
-    font-weight: bold;
-    font-style: normal;
-    color: white;
-
-    letter-spacing: normal;
-    word-spacing: normal;
-    text-transform: none;
-    text-indent: 0;
-    text-shadow: none;
-    text-decoration: none;
-}
-
-audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
-    -webkit-appearance: media-slider;
-    display: -webkit-flex;
-    -webkit-flex: 1 1 auto;
-    height: 8px;
-    margin: 0 15px 0 0;
-    padding: 0;
-    background-color: transparent;
-    min-width: 25px;
-}
-
-audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
-    -webkit-appearance: media-volume-slider;
-    display: -webkit-flex;
-    /* The 1.9 value was empirically chosen to match old-flexbox behaviour
-     * and be aesthetically pleasing.
-     */
-    -webkit-flex: 1 1.9 auto;
-    height: 8px;
-    max-width: 70px;
-    margin: 0 15px 0 0;
-    padding: 0;
-    background-color: transparent;
-    min-width: 15px;
-}
-
-/* FIXME these shouldn't use special pseudoShadowIds, but nicer rules.
-   https://code.google.com/p/chromium/issues/detail?id=112508
-   https://bugs.webkit.org/show_bug.cgi?id=62218
-*/
-input[type="range"]::-webkit-media-slider-container {
-    display: -webkit-flex;
-    -webkit-align-items: center;
-    -webkit-flex-direction: row; /* This property is updated by C++ code. */
-    box-sizing: border-box;
-    height: 100%;
-    width: 100%;
-    border: 1px solid rgba(230, 230, 230, 0.35);
-    border-radius: 4px;
-    background-color: transparent; /* Background drawing is managed by C++ code to draw ranges. */
-}
-
-/* The negative right margin causes the track to overflow its container. */
-input[type="range"]::-webkit-media-slider-container > div {
-    margin-right: -14px;
-}
-
-input[type="range"]::-webkit-media-slider-thumb {
-    margin-left: -7px;
-    margin-right: -7px;
-}
-
-audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button {
-    -webkit-appearance: media-toggle-closed-captions-button;
-    display: -webkit-flex;
-    -webkit-flex: none;
-    border: none;
-    box-sizing: border-box;
-    width: 30px;
-    height: 30px;
-    line-height: 30px;
-    margin-left: -5px;
-    margin-right: 9px;
-    padding: 0;
-}
-
-audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
-    -webkit-appearance: media-enter-fullscreen-button;
-    display: -webkit-flex;
-    -webkit-flex: none;
-    border: none;
-    box-sizing: border-box;
-    width: 30px;
-    height: 30px;
-    line-height: 30px;
-    margin-left: -5px;
-    margin-right: 9px;
-    padding: 0;
-}
diff --git a/Source/core/css/mediaControlsChromiumAndroid.css b/Source/core/css/mediaControlsChromiumAndroid.css
deleted file mode 100644
index 93623c3..0000000
--- a/Source/core/css/mediaControlsChromiumAndroid.css
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 2012 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,
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Media controls for Chromium on Android*/
-
-body:-webkit-full-page-media {
-    background-color: rgb(0, 0, 0);
-}
-
-audio {
-    width: 300px;
-    height: 35px;
-}
-
-audio:-webkit-full-page-media, video:-webkit-full-page-media {
-    max-height: 100%;
-    max-width: 100%;
-}
-
-audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
-    display: -webkit-flex;
-    -webkit-flex-direction: row;
-    -webkit-align-items: center;
-    -webkit-justify-content: center;
-    bottom: auto;
-    height: 35px;
-    background-color: rgba(20, 20, 20, 0.8);
-}
-
-audio:-webkit-full-page-media::-webkit-media-controls-panel,
-video:-webkit-full-page-media::-webkit-media-controls-panel {
-    bottom: 0px;
-}
-
-::-webkit-media-controls {
-    display: -webkit-flex;
-    -webkit-flex-direction: column;
-    -webkit-justify-content: flex-end;
-    -webkit-align-items: center;
-}
-
-audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure {
-    width: 100%;
-    max-width: 800px;
-    height: 35px;
-    bottom: 0;
-    text-indent: 0;
-    padding: 0;
-    box-sizing: border-box;
-}
-
-video::-webkit-media-controls-enclosure {
-    padding: 0px 5px 5px 5px;
-    height: 35px;
-}
-
-audio::-webkit-media-controls-overlay-enclosure {
-    display: none;
-}
-
-video::-webkit-media-controls-overlay-enclosure {
-    display: -webkit-flex;
-    position: relative;
-    -webkit-flex-direction: column;
-    -webkit-justify-content: flex-end;
-    -webkit-align-items: center;
-    -webkit-flex: 1 1;
-    width: 100%;
-    max-width: 800px;
-    text-indent: 0;
-    box-sizing: border-box;
-    overflow: hidden;
-}
-
-audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
-    display: none;
-}
-
-audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
-    -webkit-appearance: media-play-button;
-    display: inline;
-    border: none;
-    box-sizing: border-box;
-    width: 35px;
-    height: 35px;
-    line-height: 35px;
-    margin-left: 9px;
-    margin-right: 9px;
-    padding: 0;
-}
-
-video::-webkit-media-controls-overlay-play-button {
-    -webkit-appearance: media-overlay-play-button;
-    display: -webkit-flex;
-    position: absolute;
-    top: 50%;
-    left: 50%;
-    margin-left: -40px;
-    margin-top: -40px;
-    border: none;
-    box-sizing: border-box;
-    background-color: transparent;
-    width: 80px;
-    height: 80px;
-    padding: 0;
-}
-
-audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display,
-audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
-    -webkit-appearance: media-current-time-display;
-    -webkit-user-select: none;
-    display: block;
-    border: none;
-    cursor: default;
-
-    height: 35px;
-    margin: 0 9px 0 0;
-    padding: 0;
-
-    line-height: 35px;
-    font-family: Arial, Helvetica, sans-serif;
-    font-size: 18px;
-    font-weight: bold;
-    color: white;
-
-    letter-spacing: normal;
-    word-spacing: normal;
-    text-transform: none;
-    text-indent: 0;
-    text-shadow: none;
-    text-decoration: none;
-}
-
-audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
-    -webkit-appearance: media-slider;
-    display: -webkit-flex;
-    -webkit-flex: 1 1;
-    height: 8px;
-    margin: 0 15px 0 0;
-    padding: 0;
-    background-color: transparent;
-    min-width: 25px;
-}
-
-
-video::-webkit-media-controls-fullscreen-button {
-    -webkit-appearance: media-enter-fullscreen-button;
-    display: -webkit-flex;
-    border: none;
-    box-sizing: border-box;
-    width: 35px;
-    height: 35px;
-    line-height: 35px;
-    margin-left: -5px;
-    margin-right: 9px;
-    padding: 0;
-}
-
-audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button {
-    -webkit-appearance: media-toggle-closed-captions-button;
-    display: -webkit-flex;
-    border: none;
-    box-sizing: border-box;
-    width: 35px;
-    height: 35px;
-    line-height: 35px;
-    margin-left: -5px;
-    margin-right: 9px;
-    padding: 0;
-}
-
-input[type="range"]::-webkit-media-slider-container {
-    display: -webkit-flex;
-    -webkit-align-items: center;
-    -webkit-flex-direction: row;
-    box-sizing: border-box;
-    height: 100%;
-    width: 100%;
-    border: 1px solid rgba(230, 230, 230, 0.35);
-    border-radius: 4px;
-    background-color: transparent;
-}
-
-/* The negative right margin causes the track to overflow its container. */
-input[type="range"]::-webkit-media-slider-container > div {
-    margin-right: -14px;
-}
-
-input[type="range"]::-webkit-media-slider-thumb {
-    margin-left: -7px;
-    margin-right: -7px;
-}
-
-audio::-webkit-media-controls-fullscreen-button {
-    display: none;
-}
-
-audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
-    display: none;
-}
diff --git a/Source/core/css/resolver/ElementStyleResources.cpp b/Source/core/css/resolver/ElementStyleResources.cpp
index 6efe8e0..f99919a 100644
--- a/Source/core/css/resolver/ElementStyleResources.cpp
+++ b/Source/core/css/resolver/ElementStyleResources.cpp
@@ -23,7 +23,12 @@
 #include "config.h"
 #include "core/css/resolver/ElementStyleResources.h"
 
+#include "core/css/CSSGradientValue.h"
+#include "core/css/CSSSVGDocumentValue.h"
 #include "core/platform/graphics/filters/FilterOperation.h"
+#include "core/rendering/style/StyleGeneratedImage.h"
+#include "core/rendering/style/StyleImage.h"
+#include "core/rendering/style/StylePendingImage.h"
 
 namespace WebCore {
 
@@ -33,9 +38,57 @@
 {
 }
 
-void ElementStyleResources::addPendingImageProperty(const CSSPropertyID& property, CSSValue* value)
+PassRefPtr<StyleImage> ElementStyleResources::styleImage(const TextLinkColors& textLinkColors, Color currentColor, CSSPropertyID property, CSSValue* value)
 {
-    m_pendingImageProperties.set(property, value);
+    if (value->isImageValue())
+        return cachedOrPendingFromValue(property, toCSSImageValue(value));
+
+    if (value->isImageGeneratorValue()) {
+        if (value->isGradientValue())
+            return generatedOrPendingFromValue(property, static_cast<CSSGradientValue*>(value)->gradientWithStylesResolved(textLinkColors, currentColor).get());
+        return generatedOrPendingFromValue(property, static_cast<CSSImageGeneratorValue*>(value));
+    }
+
+    if (value->isImageSetValue())
+        return setOrPendingFromValue(property, static_cast<CSSImageSetValue*>(value));
+
+    if (value->isCursorImageValue())
+        return cursorOrPendingFromValue(property, static_cast<CSSCursorImageValue*>(value));
+
+    return 0;
+}
+
+PassRefPtr<StyleImage> ElementStyleResources::generatedOrPendingFromValue(CSSPropertyID property, CSSImageGeneratorValue* value)
+{
+    if (value->isPending()) {
+        m_pendingImageProperties.set(property, value);
+        return StylePendingImage::create(value);
+    }
+    return StyleGeneratedImage::create(value);
+}
+
+PassRefPtr<StyleImage> ElementStyleResources::setOrPendingFromValue(CSSPropertyID property, CSSImageSetValue* value)
+{
+    RefPtr<StyleImage> image = value->cachedOrPendingImageSet(m_deviceScaleFactor);
+    if (image && image->isPendingImage())
+        m_pendingImageProperties.set(property, value);
+    return image.release();
+}
+
+PassRefPtr<StyleImage> ElementStyleResources::cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue* value)
+{
+    RefPtr<StyleImage> image = value->cachedOrPendingImage();
+    if (image && image->isPendingImage())
+        m_pendingImageProperties.set(property, value);
+    return image.release();
+}
+
+PassRefPtr<StyleImage> ElementStyleResources::cursorOrPendingFromValue(CSSPropertyID property, CSSCursorImageValue* value)
+{
+    RefPtr<StyleImage> image = value->cachedOrPendingImage(m_deviceScaleFactor);
+    if (image && image->isPendingImage())
+        m_pendingImageProperties.set(property, value);
+    return image.release();
 }
 
 void ElementStyleResources::addPendingSVGDocument(FilterOperation* filterOperation, CSSSVGDocumentValue* cssSVGDocumentValue)
diff --git a/Source/core/css/resolver/ElementStyleResources.h b/Source/core/css/resolver/ElementStyleResources.h
index 94c1599..08aaede 100644
--- a/Source/core/css/resolver/ElementStyleResources.h
+++ b/Source/core/css/resolver/ElementStyleResources.h
@@ -24,13 +24,21 @@
 #define ElementStyleResources_h
 
 #include "CSSPropertyNames.h"
-#include "core/css/CSSSVGDocumentValue.h"
-#include "core/css/CSSValue.h"
+#include "core/platform/graphics/Color.h"
 #include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
+class CSSCursorImageValue;
+class CSSImageValue;
+class CSSImageGeneratorValue;
+class CSSImageSetValue;
+class CSSSVGDocumentValue;
+class CSSValue;
 class FilterOperation;
+class StyleImage;
+class TextLinkColors;
 
 typedef HashMap<FilterOperation*, RefPtr<CSSSVGDocumentValue> > PendingSVGDocumentMap;
 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;
@@ -45,6 +53,13 @@
 public:
     ElementStyleResources();
 
+    PassRefPtr<StyleImage> styleImage(const TextLinkColors&, Color currentColor, CSSPropertyID, CSSValue*);
+
+    PassRefPtr<StyleImage> generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue*);
+    PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
+    PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue*);
+    PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*);
+
     const PendingImagePropertyMap& pendingImageProperties() const { return m_pendingImageProperties; }
     const PendingSVGDocumentMap& pendingSVGDocuments() const { return m_pendingSVGDocuments; }
 
@@ -54,7 +69,6 @@
     float deviceScaleFactor() const { return m_deviceScaleFactor; }
     void setDeviceScaleFactor(float deviceScaleFactor) { m_deviceScaleFactor = deviceScaleFactor; }
 
-    void addPendingImageProperty(const CSSPropertyID&, CSSValue*);
     void addPendingSVGDocument(FilterOperation*, CSSSVGDocumentValue*);
 
     void clear();
diff --git a/Source/core/css/resolver/FilterOperationResolver.cpp b/Source/core/css/resolver/FilterOperationResolver.cpp
index bde228b..70991ba 100644
--- a/Source/core/css/resolver/FilterOperationResolver.cpp
+++ b/Source/core/css/resolver/FilterOperationResolver.cpp
@@ -378,7 +378,7 @@
     if (!inValue->isValueList())
         return false;
 
-    float zoomFactor = style ? style->effectiveZoom() : 1;
+    float zoomFactor = (style ? style->effectiveZoom() : 1) * state.elementStyleResources().deviceScaleFactor();
     FilterOperations operations;
     for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
         CSSValue* currValue = i.value();
@@ -497,7 +497,7 @@
             int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, zoomFactor) : 0;
             Color color;
             if (item->color)
-                color = state.resolveColorFromPrimitiveValue(item->color.get());
+                color = state.document()->textLinkColors().colorFromPrimitiveValue(item->color.get(), state.style()->visitedDependentColor(CSSPropertyColor));
 
             operations.operations().append(DropShadowFilterOperation::create(location, blur, color.isValid() ? color : Color::transparent, operationType));
             break;
diff --git a/Source/core/css/resolver/MatchResult.cpp b/Source/core/css/resolver/MatchResult.cpp
new file mode 100644
index 0000000..128f073
--- /dev/null
+++ b/Source/core/css/resolver/MatchResult.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * 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.
+ */
+
+#include "config.h"
+#include "core/css/resolver/MatchResult.h"
+
+#include "core/css/StylePropertySet.h"
+#include "core/css/StyleRule.h"
+#include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryInstrumentationVector.h"
+
+namespace WebCore {
+
+MatchedProperties::MatchedProperties()
+    : possiblyPaddedMember(0)
+{
+}
+
+MatchedProperties::~MatchedProperties()
+{
+}
+
+void MatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    info.addMember(properties, "properties");
+}
+
+void MatchResult::addMatchedProperties(const StylePropertySet* properties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propertyWhitelistType)
+{
+    matchedProperties.grow(matchedProperties.size() + 1);
+    MatchedProperties& newProperties = matchedProperties.last();
+    newProperties.properties = const_cast<StylePropertySet*>(properties);
+    newProperties.linkMatchType = linkMatchType;
+    newProperties.whitelistType = propertyWhitelistType;
+    matchedRules.append(rule);
+}
+
+} // namespace WebCore
diff --git a/Source/core/css/resolver/MatchResult.h b/Source/core/css/resolver/MatchResult.h
new file mode 100644
index 0000000..220a43e
--- /dev/null
+++ b/Source/core/css/resolver/MatchResult.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * 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 MatchResult_h
+#define MatchResult_h
+
+#include "core/css/RuleSet.h"
+#include "core/css/SelectorChecker.h"
+#include "wtf/MemoryObjectInfo.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class StylePropertySet;
+class StyleRule;
+
+struct RuleRange {
+    RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRuleIndex), lastRuleIndex(lastRuleIndex) { }
+    int& firstRuleIndex;
+    int& lastRuleIndex;
+};
+
+struct MatchRanges {
+    MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1), firstUserRule(-1), lastUserRule(-1) { }
+    int firstUARule;
+    int lastUARule;
+    int firstAuthorRule;
+    int lastAuthorRule;
+    int firstUserRule;
+    int lastUserRule;
+    RuleRange UARuleRange() { return RuleRange(firstUARule, lastUARule); }
+    RuleRange authorRuleRange() { return RuleRange(firstAuthorRule, lastAuthorRule); }
+    RuleRange userRuleRange() { return RuleRange(firstUserRule, lastUserRule); }
+};
+
+struct MatchedProperties {
+    MatchedProperties();
+    ~MatchedProperties();
+    void reportMemoryUsage(WTF::MemoryObjectInfo*) const;
+
+    RefPtr<StylePropertySet> properties;
+    union {
+        struct {
+            unsigned linkMatchType : 2;
+            unsigned whitelistType : 2;
+        };
+        // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object.
+        void* possiblyPaddedMember;
+    };
+};
+
+struct MatchResult {
+    MatchResult() : isCacheable(true) { }
+    Vector<MatchedProperties, 64> matchedProperties;
+    Vector<StyleRule*, 64> matchedRules;
+    MatchRanges ranges;
+    bool isCacheable;
+
+    void addMatchedProperties(const StylePropertySet* properties, StyleRule* = 0, unsigned linkMatchType = SelectorChecker::MatchAll, PropertyWhitelistType = PropertyWhitelistNone);
+};
+
+inline bool operator==(const MatchRanges& a, const MatchRanges& b)
+{
+    return a.firstUARule == b.firstUARule
+        && a.lastUARule == b.lastUARule
+        && a.firstAuthorRule == b.firstAuthorRule
+        && a.lastAuthorRule == b.lastAuthorRule
+        && a.firstUserRule == b.firstUserRule
+        && a.lastUserRule == b.lastUserRule;
+}
+
+inline bool operator!=(const MatchRanges& a, const MatchRanges& b)
+{
+    return !(a == b);
+}
+
+inline bool operator==(const MatchedProperties& a, const MatchedProperties& b)
+{
+    return a.properties == b.properties && a.linkMatchType == b.linkMatchType;
+}
+
+inline bool operator!=(const MatchedProperties& a, const MatchedProperties& b)
+{
+    return !(a == b);
+}
+
+} // namespace WebCore
+
+#endif // MatchResult_h
diff --git a/Source/core/css/resolver/MatchedPropertiesCache.cpp b/Source/core/css/resolver/MatchedPropertiesCache.cpp
new file mode 100644
index 0000000..90c78ec
--- /dev/null
+++ b/Source/core/css/resolver/MatchedPropertiesCache.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * 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.
+ */
+
+#include "config.h"
+#include "core/css/resolver/MatchedPropertiesCache.h"
+
+#include "core/css/StylePropertySet.h"
+#include "core/css/resolver/StyleResolverState.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryInstrumentationVector.h"
+
+namespace WebCore {
+
+MatchedPropertiesCache::MatchedPropertiesCache()
+    : m_additionsSinceLastSweep(0)
+    , m_sweepTimer(this, &MatchedPropertiesCache::sweep)
+{
+}
+
+const CachedMatchedProperties* MatchedPropertiesCache::find(unsigned hash, const StyleResolverState& styleResolverState, const MatchResult& matchResult)
+{
+    ASSERT(hash);
+
+    Cache::iterator it = m_cache.find(hash);
+    if (it == m_cache.end())
+        return 0;
+    CachedMatchedProperties& cacheItem = it->value;
+
+    size_t size = matchResult.matchedProperties.size();
+    if (size != cacheItem.matchedProperties.size())
+        return 0;
+    if (cacheItem.renderStyle->insideLink() != styleResolverState.style()->insideLink())
+        return 0;
+    for (size_t i = 0; i < size; ++i) {
+        if (matchResult.matchedProperties[i] != cacheItem.matchedProperties[i])
+            return 0;
+    }
+    if (cacheItem.ranges != matchResult.ranges)
+        return 0;
+    return &cacheItem;
+}
+
+void MatchedPropertiesCache::add(const RenderStyle* style, const RenderStyle* parentStyle, unsigned hash, const MatchResult& matchResult)
+{
+    static const unsigned maxAdditionsBetweenSweeps = 100;
+    if (++m_additionsSinceLastSweep >= maxAdditionsBetweenSweeps
+        && !m_sweepTimer.isActive()) {
+        static const unsigned sweepTimeInSeconds = 60;
+        m_sweepTimer.startOneShot(sweepTimeInSeconds);
+    }
+
+    ASSERT(hash);
+    CachedMatchedProperties cacheItem;
+    cacheItem.matchedProperties.append(matchResult.matchedProperties);
+    cacheItem.ranges = matchResult.ranges;
+    // Note that we don't cache the original RenderStyle instance. It may be further modified.
+    // The RenderStyle in the cache is really just a holder for the substructures and never used as-is.
+    cacheItem.renderStyle = RenderStyle::clone(style);
+    cacheItem.parentRenderStyle = RenderStyle::clone(parentStyle);
+    m_cache.add(hash, cacheItem);
+}
+
+void MatchedPropertiesCache::clear()
+{
+    m_cache.clear();
+}
+
+void MatchedPropertiesCache::sweep(Timer<MatchedPropertiesCache>*)
+{
+    // Look for cache entries containing a style declaration with a single ref and remove them.
+    // This may happen when an element attribute mutation causes it to generate a new inlineStyle()
+    // or presentationAttributeStyle(), potentially leaving this cache with the last ref on the old one.
+    Vector<unsigned, 16> toRemove;
+    Cache::iterator it = m_cache.begin();
+    Cache::iterator end = m_cache.end();
+    for (; it != end; ++it) {
+        Vector<MatchedProperties>& matchedProperties = it->value.matchedProperties;
+        for (size_t i = 0; i < matchedProperties.size(); ++i) {
+            if (matchedProperties[i].properties->hasOneRef()) {
+                toRemove.append(it->key);
+                break;
+            }
+        }
+    }
+    for (size_t i = 0; i < toRemove.size(); ++i)
+        m_cache.remove(toRemove[i]);
+
+    m_additionsSinceLastSweep = 0;
+}
+
+bool MatchedPropertiesCache::isCacheable(const Element* element, const RenderStyle* style, const RenderStyle* parentStyle)
+{
+    // FIXME: CSSPropertyWebkitWritingMode modifies state when applying to document element. We can't skip the applying by caching.
+    if (element == element->document()->documentElement() && element->document()->writingModeSetOnDocumentElement())
+        return false;
+    if (style->unique() || (style->styleType() != NOPSEUDO && parentStyle->unique()))
+        return false;
+    if (style->hasAppearance())
+        return false;
+    if (style->zoom() != RenderStyle::initialZoom())
+        return false;
+    if (style->writingMode() != RenderStyle::initialWritingMode())
+        return false;
+    if (style->hasCurrentColor())
+        return false;
+    // The cache assumes static knowledge about which properties are inherited.
+    if (parentStyle->hasExplicitlyInheritedProperties())
+        return false;
+    return true;
+}
+
+void CachedMatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    info.addMember(matchedProperties, "matchedProperties");
+    info.addMember(ranges, "ranges");
+    info.addMember(renderStyle, "renderStyle");
+    info.addMember(parentRenderStyle, "parentRenderStyle");
+}
+
+}
diff --git a/Source/core/css/resolver/MatchedPropertiesCache.h b/Source/core/css/resolver/MatchedPropertiesCache.h
new file mode 100644
index 0000000..ffc453d
--- /dev/null
+++ b/Source/core/css/resolver/MatchedPropertiesCache.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * 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 MatchedPropertiesCache_h
+#define MatchedPropertiesCache_h
+
+#include "core/css/resolver/MatchResult.h"
+
+#include "core/platform/Timer.h"
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class RenderStyle;
+class StyleResolverState;
+
+struct CachedMatchedProperties {
+    void reportMemoryUsage(MemoryObjectInfo*) const;
+    Vector<MatchedProperties> matchedProperties;
+    MatchRanges ranges;
+    RefPtr<RenderStyle> renderStyle;
+    RefPtr<RenderStyle> parentRenderStyle;
+};
+
+class MatchedPropertiesCache {
+    WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache);
+public:
+    MatchedPropertiesCache();
+
+    const CachedMatchedProperties* find(unsigned hash, const StyleResolverState&, const MatchResult&);
+    void add(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash, const MatchResult&);
+
+    void clear();
+
+    static bool isCacheable(const Element*, const RenderStyle*, const RenderStyle* parentStyle);
+
+private:
+    // Every N additions to the matched declaration cache trigger a sweep where entries holding
+    // the last reference to a style declaration are garbage collected.
+    void sweep(Timer<MatchedPropertiesCache>*);
+
+    unsigned m_additionsSinceLastSweep;
+
+    typedef HashMap<unsigned, CachedMatchedProperties> Cache;
+    Cache m_cache;
+
+    Timer<MatchedPropertiesCache> m_sweepTimer;
+};
+
+}
+
+#endif
diff --git a/Source/core/css/resolver/MediaQueryResult.cpp b/Source/core/css/resolver/MediaQueryResult.cpp
new file mode 100644
index 0000000..85fed65
--- /dev/null
+++ b/Source/core/css/resolver/MediaQueryResult.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * 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.
+ */
+
+#include "config.h"
+#include "core/css/resolver/MediaQueryResult.h"
+
+#include "core/dom/WebCoreMemoryInstrumentation.h"
+
+namespace WebCore {
+
+void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
+    info.addMember(m_expression, "expression");
+}
+
+}
diff --git a/Source/core/css/resolver/MediaQueryResult.h b/Source/core/css/resolver/MediaQueryResult.h
new file mode 100644
index 0000000..d8dff68
--- /dev/null
+++ b/Source/core/css/resolver/MediaQueryResult.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * 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 MediaQueryResult_h
+#define MediaQueryResult_h
+
+#include "core/css/MediaQueryExp.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class MediaQueryResult {
+    WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;
+public:
+    MediaQueryResult(const MediaQueryExp& expr, bool result)
+        : m_expression(expr)
+        , m_result(result)
+    {
+    }
+    void reportMemoryUsage(MemoryObjectInfo*) const;
+
+    MediaQueryExp m_expression;
+    bool m_result;
+};
+
+}
+
+#endif
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp
index 35a4110..8c6bd83 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -34,6 +34,7 @@
 #include "core/css/RuleFeature.h"
 #include "core/css/RuleSet.h"
 #include "core/css/StyleRule.h"
+#include "core/css/resolver/StyleResolver.h" // For MatchRequest.
 #include "core/dom/Document.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/dom/shadow/ContentDistributor.h"
@@ -329,7 +330,7 @@
     if (!shadowRoot)
         shadowRoot = shadow->oldestShadowRoot();
 
-    StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
+    RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
     collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
     for (; shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot()) {
         if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot))
@@ -347,7 +348,7 @@
 
         // Match author rules.
         MatchRequest matchRequest(m_authorStyle.get(), includeEmptyRules, m_scopingNode);
-        StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
+        RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
         collector.setBehaviorAtBoundary(applyAuthorStyles ? SelectorChecker::DoesNotCrossBoundary : static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
         collector.collectMatchingRules(matchRequest, ruleRange);
         collector.collectMatchingRulesForRegion(matchRequest, ruleRange);
diff --git a/Source/core/css/resolver/SharedStyleFinder.cpp b/Source/core/css/resolver/SharedStyleFinder.cpp
new file mode 100644
index 0000000..2ecdf7f
--- /dev/null
+++ b/Source/core/css/resolver/SharedStyleFinder.cpp
@@ -0,0 +1,430 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * 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.
+ */
+
+#include "config.h"
+#include "core/css/resolver/SharedStyleFinder.h"
+
+// FIXME: This include list is way more than we need!
+#include "CSSPropertyNames.h"
+#include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "SVGNames.h"
+#include "XMLNames.h"
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/Animation.h"
+#include "core/css/CSSCalculationValue.h"
+#include "core/css/CSSCursorImageValue.h"
+#include "core/css/CSSDefaultStyleSheets.h"
+#include "core/css/CSSFontSelector.h"
+#include "core/css/CSSImageSetValue.h"
+#include "core/css/CSSKeyframeRule.h"
+#include "core/css/CSSKeyframesRule.h"
+#include "core/css/CSSLineBoxContainValue.h"
+#include "core/css/CSSParser.h"
+#include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/css/CSSReflectValue.h"
+#include "core/css/CSSSVGDocumentValue.h"
+#include "core/css/CSSSelector.h"
+#include "core/css/CSSSelectorList.h"
+#include "core/css/CSSStyleRule.h"
+#include "core/css/CSSValueList.h"
+#include "core/css/CSSVariableValue.h"
+#include "core/css/MediaQueryEvaluator.h"
+#include "core/css/PageRuleCollector.h"
+#include "core/css/Pair.h"
+#include "core/css/RuleSet.h"
+#include "core/css/StylePropertySet.h"
+#include "core/css/StylePropertyShorthand.h"
+#include "core/css/StyleSheetContents.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/DocumentStyleSheetCollection.h"
+#include "core/dom/FullscreenController.h"
+#include "core/dom/NodeRenderStyle.h"
+#include "core/dom/NodeRenderingContext.h"
+#include "core/dom/Text.h"
+#include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLOptGroupElement.h"
+#include "core/html/HTMLTableElement.h"
+#include "core/html/track/WebVTTElement.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/page/Frame.h"
+#include "core/page/FrameView.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/platform/LinkHash.h"
+#include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
+#include "core/platform/text/LocaleToScriptMapping.h"
+#include "core/rendering/RenderTheme.h"
+#include "core/rendering/RenderView.h"
+#include "core/rendering/style/ContentData.h"
+#include "core/rendering/style/CursorList.h"
+#include "core/rendering/style/KeyframeList.h"
+#include "core/rendering/style/RenderStyleConstants.h"
+#include "core/rendering/style/StyleCachedImage.h"
+#include "core/rendering/style/StyleCachedImageSet.h"
+#include "core/rendering/style/StyleCustomFilterProgramCache.h"
+#include "core/rendering/style/StyleGeneratedImage.h"
+#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGElement.h"
+#include "core/svg/SVGFontFaceElement.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/Vector.h"
+
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+static const unsigned cStyleSearchThreshold = 10;
+static const unsigned cStyleSearchLevelThreshold = 10;
+
+static inline bool parentElementPreventsSharing(const Element* parentElement)
+{
+    if (!parentElement)
+        return false;
+    return parentElement->hasFlagsSetDuringStylingOfChildren();
+}
+
+Node* SharedStyleFinder::locateCousinList(Element* parent, unsigned& visitedNodeCount) const
+{
+    if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold)
+        return 0;
+    if (!parent || !parent->isStyledElement())
+        return 0;
+    if (parent->hasScopedHTMLStyleChild())
+        return 0;
+    if (parent->inlineStyle())
+        return 0;
+    if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStyleProperties())
+        return 0;
+    if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyleResolution().impl()))
+        return 0;
+
+    RenderStyle* parentStyle = parent->renderStyle();
+    unsigned subcount = 0;
+    Node* thisCousin = parent;
+    Node* currentNode = parent->previousSibling();
+
+    // Reserve the tries for this level. This effectively makes sure that the algorithm
+    // will never go deeper than cStyleSearchLevelThreshold levels into recursion.
+    visitedNodeCount += cStyleSearchThreshold;
+    while (thisCousin) {
+        while (currentNode) {
+            ++subcount;
+            if (!currentNode->hasScopedHTMLStyleChild() && currentNode->renderStyle() == parentStyle && currentNode->lastChild()
+                && currentNode->isElementNode() && !parentElementPreventsSharing(toElement(currentNode))
+                && !toElement(currentNode)->shadow()
+                ) {
+                // Adjust for unused reserved tries.
+                visitedNodeCount -= cStyleSearchThreshold - subcount;
+                return currentNode->lastChild();
+            }
+            if (subcount >= cStyleSearchThreshold)
+                return 0;
+            currentNode = currentNode->previousSibling();
+        }
+        currentNode = locateCousinList(thisCousin->parentElement(), visitedNodeCount);
+        thisCousin = currentNode;
+    }
+
+    return 0;
+}
+
+
+bool SharedStyleFinder::canShareStyleWithControl(const ElementResolveContext& context, Element* element) const
+{
+    if (!element->hasTagName(inputTag) || !context.element()->hasTagName(inputTag))
+        return false;
+
+    HTMLInputElement* thisInputElement = toHTMLInputElement(element);
+    HTMLInputElement* otherInputElement = toHTMLInputElement(context.element());
+    if (thisInputElement->elementData() != otherInputElement->elementData()) {
+        if (thisInputElement->fastGetAttribute(typeAttr) != otherInputElement->fastGetAttribute(typeAttr))
+            return false;
+        if (thisInputElement->fastGetAttribute(readonlyAttr) != otherInputElement->fastGetAttribute(readonlyAttr))
+            return false;
+    }
+
+    if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled())
+        return false;
+    if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked())
+        return false;
+    if (thisInputElement->shouldAppearIndeterminate() != otherInputElement->shouldAppearIndeterminate())
+        return false;
+    if (thisInputElement->isRequired() != otherInputElement->isRequired())
+        return false;
+
+    if (element->isDisabledFormControl() != context.element()->isDisabledFormControl())
+        return false;
+
+    if (element->isDefaultButtonForForm() != context.element()->isDefaultButtonForForm())
+        return false;
+
+    if (context.document()->containsValidityStyleRules()) {
+        bool willValidate = element->willValidate();
+
+        if (willValidate != context.element()->willValidate())
+            return false;
+
+        if (willValidate && (element->isValidFormControlElement() != context.element()->isValidFormControlElement()))
+            return false;
+
+        if (element->isInRange() != context.element()->isInRange())
+            return false;
+
+        if (element->isOutOfRange() != context.element()->isOutOfRange())
+            return false;
+    }
+
+    return true;
+}
+
+bool SharedStyleFinder::classNamesAffectedByRules(const SpaceSplitString& classNames) const
+{
+    for (unsigned i = 0; i < classNames.size(); ++i) {
+        if (m_features.classesInRules.contains(classNames[i].impl()))
+            return true;
+    }
+    return false;
+}
+
+static inline bool elementHasDirectionAuto(Element* element)
+{
+    // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
+    return element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto();
+}
+
+bool SharedStyleFinder::sharingCandidateHasIdenticalStyleAffectingAttributes(const ElementResolveContext& context, Element* sharingCandidate) const
+{
+    if (context.element()->elementData() == sharingCandidate->elementData())
+        return true;
+    if (context.element()->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr))
+        return false;
+    if (context.element()->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr))
+        return false;
+
+    if (!m_elementAffectedByClassRules) {
+        if (sharingCandidate->hasClass() && classNamesAffectedByRules(sharingCandidate->classNames()))
+            return false;
+    } else if (sharingCandidate->hasClass()) {
+        // SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG.
+        if (context.element()->isSVGElement()) {
+            if (context.element()->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr))
+                return false;
+        } else if (context.element()->classNames() != sharingCandidate->classNames()) {
+            return false;
+        }
+    } else {
+        return false;
+    }
+
+    if (context.element()->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle())
+        return false;
+
+    if (context.element()->hasTagName(progressTag)) {
+        if (context.element()->shouldAppearIndeterminate() != sharingCandidate->shouldAppearIndeterminate())
+            return false;
+    }
+
+    return true;
+}
+
+bool SharedStyleFinder::canShareStyleWithElement(const ElementResolveContext& context, Element* element) const
+{
+    RenderStyle* style = element->renderStyle();
+    if (!style)
+        return false;
+    if (style->unique())
+        return false;
+    if (style->hasUniquePseudoStyle())
+        return false;
+    if (element->tagQName() != context.element()->tagQName())
+        return false;
+    if (element->inlineStyle())
+        return false;
+    if (element->needsStyleRecalc())
+        return false;
+    if (element->isSVGElement() && toSVGElement(element)->animatedSMILStyleProperties())
+        return false;
+    if (element->isLink() != context.element()->isLink())
+        return false;
+    if (element->hovered() != context.element()->hovered())
+        return false;
+    if (element->active() != context.element()->active())
+        return false;
+    if (element->focused() != context.element()->focused())
+        return false;
+    if (element->shadowPseudoId() != context.element()->shadowPseudoId())
+        return false;
+    if (element == element->document()->cssTarget())
+        return false;
+    if (!sharingCandidateHasIdenticalStyleAffectingAttributes(context, element))
+        return false;
+    if (element->additionalPresentationAttributeStyle() != context.element()->additionalPresentationAttributeStyle())
+        return false;
+
+    if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl()))
+        return false;
+    if (element->hasScopedHTMLStyleChild())
+        return false;
+
+    // FIXME: We should share style for option and optgroup whenever possible.
+    // Before doing so, we need to resolve issues in HTMLSelectElement::recalcListItems
+    // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cgi?id=88405
+    if (element->hasTagName(optionTag) || isHTMLOptGroupElement(element))
+        return false;
+
+    bool isControl = element->isFormControlElement();
+
+    if (isControl != context.element()->isFormControlElement())
+        return false;
+
+    if (isControl && !canShareStyleWithControl(context, element))
+        return false;
+
+    if (style->transitions() || style->animations())
+        return false;
+
+    // Turn off style sharing for elements that can gain layers for reasons outside of the style system.
+    // See comments in RenderObject::setStyle().
+    if (element->hasTagName(iframeTag) || element->hasTagName(frameTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag) || element->hasTagName(canvasTag))
+        return false;
+
+    if (elementHasDirectionAuto(element))
+        return false;
+
+    if (element->isLink() && context.elementLinkState() != style->insideLink())
+        return false;
+
+    if (element->isUnresolvedCustomElement() != context.element()->isUnresolvedCustomElement())
+        return false;
+
+    // Deny sharing styles between WebVTT and non-WebVTT nodes.
+    if (element->isWebVTTElement() != context.element()->isWebVTTElement())
+        return false;
+
+    if (element->isWebVTTElement() && context.element()->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(context.element())->isPastNode())
+        return false;
+
+    if (FullscreenController* fullscreen = FullscreenController::fromIfExists(context.document())) {
+        if (element == fullscreen->webkitCurrentFullScreenElement() || context.element() == fullscreen->webkitCurrentFullScreenElement())
+            return false;
+    }
+
+    return true;
+}
+
+inline Element* SharedStyleFinder::findSiblingForStyleSharing(const ElementResolveContext& context, Node* node, unsigned& count) const
+{
+    for (; node; node = node->previousSibling()) {
+        if (!node->isStyledElement())
+            continue;
+        if (canShareStyleWithElement(context, toElement(node)))
+            break;
+        if (count++ == cStyleSearchThreshold)
+            return 0;
+    }
+    return toElement(node);
+}
+
+RenderStyle* SharedStyleFinder::locateSharedStyle(const ElementResolveContext& context)
+{
+    if (!context.element() || !context.element()->isStyledElement())
+        return 0;
+
+    // If the element has inline style it is probably unique.
+    if (context.element()->inlineStyle())
+        return 0;
+    if (context.element()->isSVGElement() && toSVGElement(context.element())->animatedSMILStyleProperties())
+        return 0;
+    // Ids stop style sharing if they show up in the stylesheets.
+    if (context.element()->hasID() && m_features.idsInRules.contains(context.element()->idForStyleResolution().impl()))
+        return 0;
+    // Active and hovered elements always make a chain towards the document node
+    // and no siblings or cousins will have the same state.
+    if (context.element()->hovered())
+        return 0;
+    if (context.element()->active())
+        return 0;
+    // There is always only one focused element.
+    if (context.element()->focused())
+        return 0;
+    if (parentElementPreventsSharing(context.element()->parentElement()))
+        return 0;
+    if (context.element()->hasScopedHTMLStyleChild())
+        return 0;
+    if (context.element() == context.document()->cssTarget())
+        return 0;
+    if (elementHasDirectionAuto(context.element()))
+        return 0;
+    if (context.element()->hasActiveAnimations())
+        return 0;
+    // When a dialog is first shown, its style is mutated to center it in the
+    // viewport. So the styles can't be shared since the viewport position and
+    // size may be different each time a dialog is opened.
+    if (context.element()->hasTagName(dialogTag))
+        return 0;
+
+    // Cache whether context.element() is affected by any known class selectors.
+    // FIXME: This should be an explicit out parameter, instead of a member variable.
+    m_elementAffectedByClassRules = context.element() && context.element()->hasClass() && classNamesAffectedByRules(context.element()->classNames());
+
+    // Check previous siblings and their cousins.
+    unsigned count = 0;
+    unsigned visitedNodeCount = 0;
+    Element* shareElement = 0;
+    Node* cousinList = context.element()->previousSibling();
+    while (cousinList) {
+        shareElement = findSiblingForStyleSharing(context, cousinList, count);
+        if (shareElement)
+            break;
+        cousinList = locateCousinList(cousinList->parentElement(), visitedNodeCount);
+    }
+
+    // If we have exhausted all our budget or our cousins.
+    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, m_siblingRuleSet))
+        return 0;
+    // Can't share if attribute rules apply.
+    if (m_styleResolver->styleSharingCandidateMatchesRuleSet(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()))
+        return 0;
+    return shareElement->renderStyle();
+}
+
+}
diff --git a/Source/core/css/resolver/SharedStyleFinder.h b/Source/core/css/resolver/SharedStyleFinder.h
new file mode 100644
index 0000000..bed6369
--- /dev/null
+++ b/Source/core/css/resolver/SharedStyleFinder.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013 Google, Inc.
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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 SharedStyleFinder_h
+#define SharedStyleFinder_h
+
+namespace WebCore {
+
+class Element;
+class ElementResolveContext;
+class Node;
+class RenderStyle;
+class RuleFeatureSet;
+class RuleSet;
+class SpaceSplitString;
+class StyleResolver;
+
+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,
+        RuleSet* uncommonAttributeRuleSet, StyleResolver* styleResolver)
+        : m_elementAffectedByClassRules(false)
+        , m_features(features)
+        , m_siblingRuleSet(siblingRuleSet)
+        , m_uncommonAttributeRuleSet(uncommonAttributeRuleSet)
+        , m_styleResolver(styleResolver)
+    { }
+
+    // FIXME: It is not necessarily safe to call this method more than once.
+    RenderStyle* locateSharedStyle(const ElementResolveContext&);
+
+private:
+    Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
+    Element* findSiblingForStyleSharing(const ElementResolveContext&, Node*, unsigned& count) const;
+
+    bool classNamesAffectedByRules(const SpaceSplitString&) const;
+
+    bool canShareStyleWithElement(const ElementResolveContext&, Element*) const;
+    bool canShareStyleWithControl(const ElementResolveContext&, Element*) const;
+    bool sharingCandidateHasIdenticalStyleAffectingAttributes(const ElementResolveContext&, Element*) const;
+
+    bool m_elementAffectedByClassRules;
+    const RuleFeatureSet& m_features;
+    RuleSet* m_siblingRuleSet;
+    RuleSet* m_uncommonAttributeRuleSet;
+    StyleResolver* m_styleResolver;
+};
+
+} // namespace WebCore
+
+#endif // SharedStyleFinder_h
diff --git a/Source/core/css/resolver/StyleAdjuster.cpp b/Source/core/css/resolver/StyleAdjuster.cpp
new file mode 100644
index 0000000..5be48db
--- /dev/null
+++ b/Source/core/css/resolver/StyleAdjuster.cpp
@@ -0,0 +1,454 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * 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.
+ */
+
+#include "config.h"
+#include "core/css/resolver/StyleAdjuster.h"
+
+// FIXME: This include list is way more than we need!
+#include "CSSPropertyNames.h"
+#include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "SVGNames.h"
+#include "XMLNames.h"
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/Animation.h"
+#include "core/css/CSSCalculationValue.h"
+#include "core/css/CSSCursorImageValue.h"
+#include "core/css/CSSDefaultStyleSheets.h"
+#include "core/css/CSSFontSelector.h"
+#include "core/css/CSSImageSetValue.h"
+#include "core/css/CSSKeyframeRule.h"
+#include "core/css/CSSKeyframesRule.h"
+#include "core/css/CSSLineBoxContainValue.h"
+#include "core/css/CSSParser.h"
+#include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/css/CSSReflectValue.h"
+#include "core/css/CSSSVGDocumentValue.h"
+#include "core/css/CSSSelector.h"
+#include "core/css/CSSSelectorList.h"
+#include "core/css/CSSStyleRule.h"
+#include "core/css/CSSValueList.h"
+#include "core/css/CSSVariableValue.h"
+#include "core/css/Pair.h"
+#include "core/css/RuleSet.h"
+#include "core/css/StylePropertySet.h"
+#include "core/css/StylePropertyShorthand.h"
+#include "core/css/StyleSheetContents.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/DocumentStyleSheetCollection.h"
+#include "core/dom/FullscreenController.h"
+#include "core/dom/NodeRenderStyle.h"
+#include "core/dom/NodeRenderingContext.h"
+#include "core/dom/Text.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLOptGroupElement.h"
+#include "core/html/HTMLTableElement.h"
+#include "core/html/HTMLTextAreaElement.h"
+#include "core/html/track/WebVTTElement.h"
+#include "core/page/Frame.h"
+#include "core/page/FrameView.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/platform/LinkHash.h"
+#include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
+#include "core/rendering/RenderTheme.h"
+#include "core/rendering/RenderView.h"
+#include "core/rendering/style/ContentData.h"
+#include "core/rendering/style/CursorList.h"
+#include "core/rendering/style/KeyframeList.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/style/RenderStyleConstants.h"
+#include "core/rendering/style/StyleCachedImage.h"
+#include "core/rendering/style/StyleCachedImageSet.h"
+#include "core/rendering/style/StyleCustomFilterProgramCache.h"
+#include "core/rendering/style/StyleGeneratedImage.h"
+#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGElement.h"
+#include "core/svg/SVGFontFaceElement.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/Vector.h"
+
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+// FIXME: This is duplicated with StyleResolver.cpp
+// Perhaps this should move onto ElementResolveContext or even Element?
+static inline bool isAtShadowBoundary(const Element* element)
+{
+    if (!element)
+        return false;
+    ContainerNode* parentNode = element->parentNode();
+    return parentNode && parentNode->isShadowRoot();
+}
+
+
+static void addIntrinsicMargins(RenderStyle* style)
+{
+    // Intrinsic margin value.
+    const int intrinsicMargin = 2 * style->effectiveZoom();
+
+    // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed.
+    // FIXME: Using "quirk" to decide the margin wasn't set is kind of lame.
+    if (style->width().isIntrinsicOrAuto()) {
+        if (style->marginLeft().quirk())
+            style->setMarginLeft(Length(intrinsicMargin, Fixed));
+        if (style->marginRight().quirk())
+            style->setMarginRight(Length(intrinsicMargin, Fixed));
+    }
+
+    if (style->height().isAuto()) {
+        if (style->marginTop().quirk())
+            style->setMarginTop(Length(intrinsicMargin, Fixed));
+        if (style->marginBottom().quirk())
+            style->setMarginBottom(Length(intrinsicMargin, Fixed));
+    }
+}
+
+static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool strictParsing)
+{
+    switch (display) {
+    case BLOCK:
+    case TABLE:
+    case BOX:
+    case FLEX:
+    case GRID:
+    case LAZY_BLOCK:
+        return display;
+
+    case LIST_ITEM:
+        // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk, but only in quirks mode.
+        if (!strictParsing && isFloating)
+            return BLOCK;
+        return display;
+    case INLINE_TABLE:
+        return TABLE;
+    case INLINE_BOX:
+        return BOX;
+    case INLINE_FLEX:
+        return FLEX;
+    case INLINE_GRID:
+        return GRID;
+
+    case INLINE:
+    case RUN_IN:
+    case COMPACT:
+    case INLINE_BLOCK:
+    case TABLE_ROW_GROUP:
+    case TABLE_HEADER_GROUP:
+    case TABLE_FOOTER_GROUP:
+    case TABLE_ROW:
+    case TABLE_COLUMN_GROUP:
+    case TABLE_COLUMN:
+    case TABLE_CELL:
+    case TABLE_CAPTION:
+        return BLOCK;
+    case NONE:
+        ASSERT_NOT_REACHED();
+        return NONE;
+    }
+    ASSERT_NOT_REACHED();
+    return BLOCK;
+}
+
+// CSS requires text-decoration to be reset at each DOM element for tables,
+// inline blocks, inline tables, run-ins, shadow DOM crossings, floating elements,
+// and absolute or relatively positioned elements.
+static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element* e)
+{
+    return style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN
+        || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)
+        || style->isFloating() || style->hasOutOfFlowPosition();
+}
+
+// FIXME: This helper is only needed because pseudoStyleForElement passes a null
+// element to adjustRenderStyle, so we can't just use element->isInTopLayer().
+static bool isInTopLayer(const Element* element, const RenderStyle* style)
+{
+    return (element && element->isInTopLayer()) || (style && style->styleType() == BACKDROP);
+}
+
+static bool isDisplayFlexibleBox(EDisplay display)
+{
+    return display == FLEX || display == INLINE_FLEX;
+}
+
+static bool isDisplayGridBox(EDisplay display)
+{
+    return display == GRID || display == INLINE_GRID;
+}
+
+void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
+{
+    ASSERT(parentStyle);
+
+    // Cache our original display.
+    style->setOriginalDisplay(style->display());
+
+    if (style->display() != NONE) {
+        // If we have a <td> that specifies a float property, in quirks mode we just drop the float
+        // property.
+        // Sites also commonly use display:inline/block on <td>s and <table>s. In quirks mode we force
+        // these tags to retain their display types.
+        if (m_useQuirksModeStyles && e) {
+            if (e->hasTagName(tdTag)) {
+                style->setDisplay(TABLE_CELL);
+                style->setFloating(NoFloat);
+            } else if (isHTMLTableElement(e)) {
+                style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
+            }
+        }
+
+        if (e && (e->hasTagName(tdTag) || e->hasTagName(thTag))) {
+            if (style->whiteSpace() == KHTML_NOWRAP) {
+                // Figure out if we are really nowrapping or if we should just
+                // use normal instead. If the width of the cell is fixed, then
+                // we don't actually use NOWRAP.
+                if (style->width().isFixed())
+                    style->setWhiteSpace(NORMAL);
+                else
+                    style->setWhiteSpace(NOWRAP);
+            }
+        }
+
+        // Tables never support the -webkit-* values for text-align and will reset back to the default.
+        if (e && isHTMLTableElement(e) && (style->textAlign() == WEBKIT_LEFT || style->textAlign() == WEBKIT_CENTER || style->textAlign() == WEBKIT_RIGHT))
+            style->setTextAlign(TASTART);
+
+        // Frames and framesets never honor position:relative or position:absolute. This is necessary to
+        // fix a crash where a site tries to position these objects. They also never honor display.
+        if (e && (e->hasTagName(frameTag) || e->hasTagName(framesetTag))) {
+            style->setPosition(StaticPosition);
+            style->setDisplay(BLOCK);
+        }
+
+        // Ruby text does not support float or position. This might change with evolution of the specification.
+        if (e && e->hasTagName(rtTag)) {
+            style->setPosition(StaticPosition);
+            style->setFloating(NoFloat);
+        }
+
+        // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead.
+        // Table headers with a text-align of -webkit-auto will change the text-align to center.
+        if (e && e->hasTagName(thTag) && style->textAlign() == TASTART)
+            style->setTextAlign(CENTER);
+
+        if (e && e->hasTagName(legendTag))
+            style->setDisplay(BLOCK);
+
+        // Per the spec, position 'static' and 'relative' in the top layer compute to 'absolute'.
+        if (isInTopLayer(e, style) && (style->position() == StaticPosition || style->position() == RelativePosition))
+            style->setPosition(AbsolutePosition);
+
+        // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
+        if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->document()->documentElement() == e))
+            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !m_useQuirksModeStyles));
+
+        // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
+        // clear how that should work.
+        if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->writingMode() != parentStyle->writingMode())
+            style->setDisplay(INLINE_BLOCK);
+
+        // After performing the display mutation, check table rows. We do not honor position:relative or position:sticky on
+        // table rows or cells. This has been established for position:relative in CSS2.1 (and caused a crash in containingBlock()
+        // on some sites).
+        if ((style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP
+            || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW)
+            && style->hasInFlowPosition())
+            style->setPosition(StaticPosition);
+
+        // writing-mode does not apply to table row groups, table column groups, table rows, and table columns.
+        // FIXME: Table cells should be allowed to be perpendicular or flipped with respect to the table, though.
+        if (style->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_FOOTER_GROUP
+            || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_ROW_GROUP
+            || style->display() == TABLE_CELL)
+            style->setWritingMode(parentStyle->writingMode());
+
+        // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting
+        // of block-flow to anything other than TopToBottomWritingMode.
+        // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support.
+        if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
+            style->setWritingMode(TopToBottomWritingMode);
+
+        if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentStyle->display())) {
+            style->setFloating(NoFloat);
+            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !m_useQuirksModeStyles));
+        }
+    }
+
+    // Make sure our z-index value is only applied if the object is positioned.
+    if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle->display()))
+        style->setHasAutoZIndex();
+
+    // Auto z-index becomes 0 for the root element and transparent objects. This prevents
+    // cases where objects that should be blended as a single unit end up with a non-transparent
+    // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
+    if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e)
+        || style->opacity() < 1.0f
+        || style->hasTransformRelatedProperty()
+        || style->hasMask()
+        || style->clipPath()
+        || style->boxReflect()
+        || style->hasFilter()
+        || style->hasBlendMode()
+        || style->position() == StickyPosition
+        || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
+        || isInTopLayer(e, style)
+        ))
+        style->setZIndex(0);
+
+    // Textarea considers overflow visible as auto.
+    if (e && isHTMLTextAreaElement(e)) {
+        style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX());
+        style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY());
+    }
+
+    // For now, <marquee> requires an overflow clip to work properly.
+    if (e && e->hasTagName(marqueeTag)) {
+        style->setOverflowX(OHIDDEN);
+        style->setOverflowY(OHIDDEN);
+    }
+
+    if (doesNotInheritTextDecoration(style, e))
+        style->setTextDecorationsInEffect(style->textDecoration());
+    else
+        style->addToTextDecorationsInEffect(style->textDecoration());
+
+    // If either overflow value is not visible, change to auto.
+    if (style->overflowX() == OVISIBLE && style->overflowY() != OVISIBLE) {
+        // FIXME: Once we implement pagination controls, overflow-x should default to hidden
+        // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it
+        // default to auto so we can at least scroll through the pages.
+        style->setOverflowX(OAUTO);
+    } else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE) {
+        style->setOverflowY(OAUTO);
+    }
+
+    // Call setStylesForPaginationMode() if a pagination mode is set for any non-root elements. If these
+    // styles are specified on a root element, then they will be incorporated in
+    // StyleAdjuster::styleForDocument().
+    if ((style->overflowY() == OPAGEDX || style->overflowY() == OPAGEDY) && !(e && (isHTMLHtmlElement(e) || e->hasTagName(bodyTag))))
+        Pagination::setStylesForPaginationMode(WebCore::paginationModeForRenderStyle(style), style);
+
+    // Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto.
+    // FIXME: Eventually table sections will support auto and scroll.
+    if (style->display() == TABLE || style->display() == INLINE_TABLE
+        || style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW) {
+        if (style->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)
+            style->setOverflowX(OVISIBLE);
+        if (style->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)
+            style->setOverflowY(OVISIBLE);
+    }
+
+    // Menulists should have visible overflow
+    if (style->appearance() == MenulistPart) {
+        style->setOverflowX(OVISIBLE);
+        style->setOverflowY(OVISIBLE);
+    }
+
+    // Cull out any useless layers and also repeat patterns into additional layers.
+    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) {
+        // Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
+        // so we have to treat all image buttons as though they were explicitly sized.
+        if (!e->hasTagName(inputTag) || !toHTMLInputElement(e)->isImageButton())
+            addIntrinsicMargins(style);
+    }
+
+    // Let the theme also have a crack at adjusting the style.
+    if (style->hasAppearance())
+        RenderTheme::defaultTheme()->adjustStyle(style, e, m_cachedUAStyle);
+
+    // If we have first-letter pseudo style, do not share this style.
+    if (style->hasPseudoStyle(FIRST_LETTER))
+        style->setUnique();
+
+    // FIXME: when dropping the -webkit prefix on transform-style, we should also have opacity < 1 cause flattening.
+    if (style->preserves3D() && (style->overflowX() != OVISIBLE
+        || style->overflowY() != OVISIBLE
+        || style->hasFilter()))
+        style->setTransformStyle3D(TransformStyle3DFlat);
+
+    // Seamless iframes behave like blocks. Map their display to inline-block when marked inline.
+    if (e && e->hasTagName(iframeTag) && style->display() == INLINE && toHTMLIFrameElement(e)->shouldDisplaySeamlessly())
+        style->setDisplay(INLINE_BLOCK);
+
+    adjustGridItemPosition(style);
+
+    if (e && e->isSVGElement()) {
+        // Spec: http://www.w3.org/TR/SVG/masking.html#OverflowProperty
+        if (style->overflowY() == OSCROLL)
+            style->setOverflowY(OHIDDEN);
+        else if (style->overflowY() == OAUTO)
+            style->setOverflowY(OVISIBLE);
+
+        if (style->overflowX() == OSCROLL)
+            style->setOverflowX(OHIDDEN);
+        else if (style->overflowX() == OAUTO)
+            style->setOverflowX(OVISIBLE);
+
+        // Only the root <svg> element in an SVG document fragment tree honors css position
+        if (!(e->hasTagName(SVGNames::svgTag) && e->parentNode() && !e->parentNode()->isSVGElement()))
+            style->setPosition(RenderStyle::initialPosition());
+
+        // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignObject content should
+        // not be scaled again.
+        if (e->hasTagName(SVGNames::foreignObjectTag))
+            style->setEffectiveZoom(RenderStyle::initialZoom());
+    }
+}
+
+void StyleAdjuster::adjustGridItemPosition(RenderStyle* style) const
+{
+    // If opposing grid-placement properties both specify a grid span, they both compute to ‘auto’.
+    if (style->gridColumnStart().isSpan() && style->gridColumnEnd().isSpan()) {
+        style->setGridColumnStart(GridPosition());
+        style->setGridColumnEnd(GridPosition());
+    }
+
+    if (style->gridRowStart().isSpan() && style->gridRowEnd().isSpan()) {
+        style->setGridRowStart(GridPosition());
+        style->setGridRowEnd(GridPosition());
+    }
+}
+
+
+
+}
diff --git a/Source/core/css/resolver/StyleAdjuster.h b/Source/core/css/resolver/StyleAdjuster.h
new file mode 100644
index 0000000..e9fba10
--- /dev/null
+++ b/Source/core/css/resolver/StyleAdjuster.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Google, Inc.
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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 StyleAdjuster_h
+#define StyleAdjuster_h
+
+namespace WebCore {
+
+class CachedUAStyle;
+class Document;
+class Element;
+class RenderStyle;
+
+// Certain CSS Properties/Values do not apply to certain elements
+// and the web expects that we expose "adjusted" values when
+// for those property/element pairs.
+class StyleAdjuster {
+public:
+    StyleAdjuster(const CachedUAStyle& cachedUAStyle, bool useQuirksModeStyles)
+        : m_cachedUAStyle(cachedUAStyle)
+        , m_useQuirksModeStyles(useQuirksModeStyles)
+    { }
+
+    void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*);
+
+private:
+    void adjustGridItemPosition(RenderStyle*) const;
+
+    const CachedUAStyle& m_cachedUAStyle;
+    bool m_useQuirksModeStyles;
+};
+
+} // namespace WebCore
+
+#endif // StyleAdjuster_h
diff --git a/Source/core/css/resolver/StyleBuilder.h b/Source/core/css/resolver/StyleBuilder.h
index ca5e575..5a2eb10 100644
--- a/Source/core/css/resolver/StyleBuilder.h
+++ b/Source/core/css/resolver/StyleBuilder.h
@@ -36,13 +36,27 @@
 namespace WebCore {
 
 class CSSValue;
+class Document;
+class RenderStyle;
 class StyleResolver;
+class StyleResolverState;
 
 class StyleBuilder {
 public:
-    static bool applyProperty(CSSPropertyID, StyleResolver*, CSSValue*, bool isInitial, bool isInherit);
+    static bool applyProperty(CSSPropertyID, StyleResolver*, StyleResolverState&, CSSValue*, bool isInitial, bool isInherit);
+
+    // This function contains the gigantic old switch-statement of properties inherited from
+    // StyleResolver. Each property should be migrated over to a new StyleBuilder templated
+    // function and removed from this code. Once they're all moved, this function can die.
+    static void oldApplyProperty(CSSPropertyID, StyleResolver*, StyleResolverState&, CSSValue*, bool isInitial, bool isInherit);
+
 };
 
+// Used by both StyleResolver and StyleBuilder.
+// FIXME: Font logic should be removed from StyleResolver then this
+// can live closer to where it's used.
+float getComputedSizeFromSpecifiedSize(const Document*, const RenderStyle*, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules);
+
 }
 
 #endif
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index b09f8e5..acc47b3 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -1,6 +1,14 @@
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
- *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
  * met:
@@ -29,54 +37,2553 @@
  */
 
 #include "config.h"
+#include "core/css/resolver/StyleBuilder.h"
 
+// FIXME: This is way more than we need to include!
+#include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "StyleBuilderFunctions.h"
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/Animation.h"
+#include "core/css/BasicShapeFunctions.h"
+#include "core/css/CSSAspectRatioValue.h"
+#include "core/css/CSSCalculationValue.h"
+#include "core/css/CSSCursorImageValue.h"
+#include "core/css/CSSDefaultStyleSheets.h"
+#include "core/css/CSSFontSelector.h"
+#include "core/css/CSSImageSetValue.h"
+#include "core/css/CSSKeyframeRule.h"
+#include "core/css/CSSKeyframesRule.h"
+#include "core/css/CSSLineBoxContainValue.h"
+#include "core/css/CSSParser.h"
+#include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/css/CSSReflectValue.h"
+#include "core/css/CSSSVGDocumentValue.h"
+#include "core/css/CSSSelector.h"
+#include "core/css/CSSSelectorList.h"
+#include "core/css/CSSStyleRule.h"
+#include "core/css/CSSValueList.h"
+#include "core/css/CSSVariableValue.h"
+#include "core/css/Counter.h"
+#include "core/css/ElementRuleCollector.h"
+#include "core/css/FontFeatureValue.h"
+#include "core/css/FontSize.h"
+#include "core/css/FontValue.h"
+#include "core/css/MediaQueryEvaluator.h"
+#include "core/css/PageRuleCollector.h"
+#include "core/css/Pair.h"
+#include "core/css/Rect.h"
+#include "core/css/RuleSet.h"
+#include "core/css/ShadowValue.h"
+#include "core/css/StylePropertySet.h"
+#include "core/css/StylePropertyShorthand.h"
+#include "core/css/StyleSheetContents.h"
+#include "core/css/resolver/ElementStyleResources.h"
+#include "core/css/resolver/FilterOperationResolver.h"
 #include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/StyleResolverState.h"
+#include "core/css/resolver/TransformBuilder.h"
+#include "core/css/resolver/ViewportStyleResolver.h"
+#include "core/dom/DocumentStyleSheetCollection.h"
+#include "core/dom/Text.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/page/Frame.h"
+#include "core/page/FrameView.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/platform/LinkHash.h"
+#include "core/platform/graphics/FontDescription.h"
+#include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
+#include "core/platform/text/LocaleToScriptMapping.h"
+#include "core/rendering/RenderTheme.h"
+#include "core/rendering/RenderView.h"
+#include "core/rendering/style/ContentData.h"
+#include "core/rendering/style/CounterContent.h"
+#include "core/rendering/style/CursorList.h"
+#include "core/rendering/style/KeyframeList.h"
+#include "core/rendering/style/QuotesData.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/style/RenderStyleConstants.h"
+#include "core/rendering/style/SVGRenderStyle.h"
+#include "core/rendering/style/SVGRenderStyleDefs.h"
+#include "core/rendering/style/ShadowData.h"
+#include "core/rendering/style/StyleCachedImage.h"
+#include "core/rendering/style/StyleCachedImageSet.h"
+#include "core/rendering/style/StyleCustomFilterProgramCache.h"
+#include "core/rendering/style/StyleGeneratedImage.h"
+#include "core/rendering/style/StylePendingImage.h"
+#include "core/rendering/style/StylePendingShader.h"
+#include "core/rendering/style/StyleShader.h"
+#include "core/svg/SVGColor.h"
+#include "core/svg/SVGPaint.h"
+#include "core/svg/SVGURIReference.h"
+#include "wtf/MathExtras.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/Vector.h"
+
 
 namespace WebCore {
 
-static void resetEffectiveZoom(StyleResolver* styleResolver)
+static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue* value)
+{
+    return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyClip(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setClip(Length(), Length(), Length(), Length());
+    state.style()->setHasClip(false);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyClip(StyleResolver* styleResolver, StyleResolverState& state)
+{
+    RenderStyle* parentStyle = state.parentStyle();
+    if (!parentStyle->hasClip())
+        return applyInitialCSSPropertyClip(styleResolver, state);
+    state.style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
+    state.style()->setHasClip(true);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyClip(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+    if (Rect* rect = primitiveValue->getRectValue()) {
+        Length top = clipConvertToLength(state, rect->top());
+        Length right = clipConvertToLength(state, rect->right());
+        Length bottom = clipConvertToLength(state, rect->bottom());
+        Length left = clipConvertToLength(state, rect->left());
+        state.style()->setClip(top, right, bottom, left);
+        state.style()->setHasClip(true);
+    } else if (primitiveValue->getValueID() == CSSValueAuto) {
+        state.style()->setClip(Length(), Length(), Length(), Length());
+        state.style()->setHasClip(false);
+    }
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->clearCursorList();
+    state.style()->setCursor(RenderStyle::initialCursor());
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setCursor(state.parentStyle()->cursor());
+    state.style()->setCursorList(state.parentStyle()->cursors());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    state.style()->clearCursorList();
+    if (value->isValueList()) {
+        CSSValueList* list = toCSSValueList(value);
+        int len = list->length();
+        state.style()->setCursor(CURSOR_AUTO);
+        for (int i = 0; i < len; i++) {
+            CSSValue* item = list->itemWithoutBoundsCheck(i);
+            if (item->isCursorImageValue()) {
+                CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(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());
+            } else if (item->isPrimitiveValue()) {
+                CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
+                if (primitiveValue->isValueID())
+                    state.style()->setCursor(*primitiveValue);
+            }
+        }
+    } else if (value->isPrimitiveValue()) {
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+        if (primitiveValue->isValueID() && state.style()->cursor() != ECursor(*primitiveValue))
+            state.style()->setCursor(*primitiveValue);
+    }
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    state.style()->setDirection(*toCSSPrimitiveValue(value));
+    Element* element = state.element();
+    if (element && element == element->document()->documentElement())
+        element->document()->setDirectionSetOnDocumentElement(true);
+}
+
+static inline bool isValidDisplayValue(StyleResolverState& state, EDisplay displayPropertyValue)
+{
+    if (state.element() && state.element()->isSVGElement() && state.style()->styleType() == NOPSEUDO)
+        return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
+    return true;
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyDisplay(StyleResolver*, StyleResolverState& state)
+{
+    EDisplay display = state.parentStyle()->display();
+    if (!isValidDisplayValue(state, display))
+        return;
+    state.style()->setDisplay(display);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyDisplay(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    EDisplay display = *toCSSPrimitiveValue(value);
+
+    if (!isValidDisplayValue(state, display))
+        return;
+
+    state.style()->setDisplay(display);
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyFontFamily(StyleResolver* styleResolver, StyleResolverState& state)
+{
+    FontDescription fontDescription = state.style()->fontDescription();
+    FontDescription initialDesc = FontDescription();
+
+    // We need to adjust the size to account for the generic family change from monospace to non-monospace.
+    if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
+        styleResolver->setFontSize(fontDescription, FontSize::fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, false));
+    fontDescription.setGenericFamily(initialDesc.genericFamily());
+    if (!initialDesc.firstFamily().familyIsEmpty())
+        fontDescription.setFamily(initialDesc.firstFamily());
+
+    state.setFontDescription(fontDescription);
+    return;
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyFontFamily(StyleResolver*, StyleResolverState& state)
+{
+    FontDescription fontDescription = state.style()->fontDescription();
+    FontDescription parentFontDescription = state.parentStyle()->fontDescription();
+
+    fontDescription.setGenericFamily(parentFontDescription.genericFamily());
+    fontDescription.setFamily(parentFontDescription.firstFamily());
+    fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
+    state.setFontDescription(fontDescription);
+    return;
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyFontFamily(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isValueList())
+        return;
+
+    FontDescription fontDescription = state.style()->fontDescription();
+    FontFamily& firstFamily = fontDescription.firstFamily();
+    FontFamily* currFamily = 0;
+
+    // Before mapping in a new font-family property, we should reset the generic family.
+    bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
+    fontDescription.setGenericFamily(FontDescription::NoFamily);
+
+    for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
+        CSSValue* item = i.value();
+        if (!item->isPrimitiveValue())
+            continue;
+        CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
+        AtomicString face;
+        Settings* settings = styleResolver->document()->settings();
+        if (contentValue->isString()) {
+            face = contentValue->getStringValue();
+        } else if (settings) {
+            switch (contentValue->getValueID()) {
+            case CSSValueWebkitBody:
+                face = settings->standardFontFamily();
+                break;
+            case CSSValueSerif:
+                face = serifFamily;
+                fontDescription.setGenericFamily(FontDescription::SerifFamily);
+                break;
+            case CSSValueSansSerif:
+                face = sansSerifFamily;
+                fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
+                break;
+            case CSSValueCursive:
+                face = cursiveFamily;
+                fontDescription.setGenericFamily(FontDescription::CursiveFamily);
+                break;
+            case CSSValueFantasy:
+                face = fantasyFamily;
+                fontDescription.setGenericFamily(FontDescription::FantasyFamily);
+                break;
+            case CSSValueMonospace:
+                face = monospaceFamily;
+                fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
+                break;
+            case CSSValueWebkitPictograph:
+                face = pictographFamily;
+                fontDescription.setGenericFamily(FontDescription::PictographFamily);
+                break;
+            default:
+                break;
+            }
+        }
+
+        if (!face.isEmpty()) {
+            if (!currFamily) {
+                // Filling in the first family.
+                firstFamily.setFamily(face);
+                firstFamily.appendFamily(0); // Remove any inherited family-fallback list.
+                currFamily = &firstFamily;
+                fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily);
+            } else {
+                RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
+                newFamily->setFamily(face);
+                currFamily->appendFamily(newFamily);
+                currFamily = newFamily.get();
+            }
+        }
+    }
+
+    // We can't call useFixedDefaultSize() until all new font families have been added
+    // If currFamily is non-zero then we set at least one family on this description.
+    if (currFamily) {
+        if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
+            styleResolver->setFontSize(fontDescription, FontSize::fontSizeForKeyword(styleResolver->document(), CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize));
+
+        state.setFontDescription(fontDescription);
+    }
+    return;
+}
+
+// FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large)
+// and scale down/up to the next size level.
+static float largerFontSize(float size)
+{
+    return size * 1.2f;
+}
+
+static float smallerFontSize(float size)
+{
+    return size / 1.2f;
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyFontSize(StyleResolver* styleResolver, StyleResolverState& state)
+{
+    FontDescription fontDescription = state.style()->fontDescription();
+    float size = FontSize::fontSizeForKeyword(styleResolver->document(), CSSValueMedium, fontDescription.useFixedDefaultSize());
+
+    if (size < 0)
+        return;
+
+    fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
+    styleResolver->setFontSize(fontDescription, size);
+    state.setFontDescription(fontDescription);
+    return;
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyFontSize(StyleResolver* styleResolver, StyleResolverState& state)
+{
+    float size = state.parentStyle()->fontDescription().specifiedSize();
+
+    if (size < 0)
+        return;
+
+    FontDescription fontDescription = state.style()->fontDescription();
+    fontDescription.setKeywordSize(state.parentStyle()->fontDescription().keywordSize());
+    styleResolver->setFontSize(fontDescription, size);
+    state.setFontDescription(fontDescription);
+    return;
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyFontSize(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+    FontDescription fontDescription = state.style()->fontDescription();
+    fontDescription.setKeywordSize(0);
+    float parentSize = 0;
+    bool parentIsAbsoluteSize = false;
+    float size = 0;
+
+    if (state.parentStyle()) {
+        parentSize = state.parentStyle()->fontDescription().specifiedSize();
+        parentIsAbsoluteSize = state.parentStyle()->fontDescription().isAbsoluteSize();
+    }
+
+    if (CSSValueID valueID = primitiveValue->getValueID()) {
+        // Keywords are being used.
+        switch (valueID) {
+        case CSSValueXxSmall:
+        case CSSValueXSmall:
+        case CSSValueSmall:
+        case CSSValueMedium:
+        case CSSValueLarge:
+        case CSSValueXLarge:
+        case CSSValueXxLarge:
+        case CSSValueWebkitXxxLarge:
+            size = FontSize::fontSizeForKeyword(styleResolver->document(), valueID, fontDescription.useFixedDefaultSize());
+            fontDescription.setKeywordSize(valueID - CSSValueXxSmall + 1);
+            break;
+        case CSSValueLarger:
+            size = largerFontSize(parentSize);
+            break;
+        case CSSValueSmaller:
+            size = smallerFontSize(parentSize);
+            break;
+        default:
+            return;
+        }
+
+        fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (valueID == CSSValueLarger || valueID == CSSValueSmaller));
+    } else {
+        fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
+        if (primitiveValue->isLength())
+            size = primitiveValue->computeLength<float>(state.parentStyle(), state.rootElementStyle(), 1.0, true);
+        else if (primitiveValue->isPercentage())
+            size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
+        else if (primitiveValue->isCalculatedPercentageWithLength())
+            size = primitiveValue->cssCalcValue()->toCalcValue(state.parentStyle(), state.rootElementStyle())->evaluate(parentSize);
+        else if (primitiveValue->isViewportPercentageLength())
+            size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView());
+        else
+            return;
+    }
+
+    if (size < 0)
+        return;
+
+    // Overly large font sizes will cause crashes on some platforms (such as Windows).
+    // Cap font size here to make sure that doesn't happen.
+    size = std::min(maximumAllowedFontSize, size);
+
+    styleResolver->setFontSize(fontDescription, size);
+    state.setFontDescription(fontDescription);
+    return;
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyFontWeight(StyleResolver*, StyleResolverState& state)
+{
+    FontDescription fontDescription = state.fontDescription();
+    fontDescription.setWeight(FontWeightNormal);
+    state.setFontDescription(fontDescription);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyFontWeight(StyleResolver*, StyleResolverState& state)
+{
+    FontDescription fontDescription = state.fontDescription();
+    fontDescription.setWeight(state.parentFontDescription().weight());
+    state.setFontDescription(fontDescription);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyFontWeight(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    FontDescription fontDescription = state.fontDescription();
+    switch (primitiveValue->getValueID()) {
+    case CSSValueInvalid:
+        ASSERT_NOT_REACHED();
+        break;
+    case CSSValueBolder:
+        fontDescription.setWeight(fontDescription.bolderWeight());
+        break;
+    case CSSValueLighter:
+        fontDescription.setWeight(fontDescription.lighterWeight());
+        break;
+    default:
+        fontDescription.setWeight(*primitiveValue);
+    }
+    state.setFontDescription(fontDescription);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyLineHeight(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    Length lineHeight;
+
+    if (primitiveValue->getValueID() == CSSValueNormal) {
+        lineHeight = RenderStyle::initialLineHeight();
+    } else if (primitiveValue->isLength()) {
+        double multiplier = state.style()->effectiveZoom();
+        if (Frame* frame = styleResolver->document()->frame())
+            multiplier *= frame->textZoomFactor();
+        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);
+    } else if (primitiveValue->isNumber()) {
+        // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
+        lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
+    } else if (primitiveValue->isViewportPercentageLength()) {
+        lineHeight = primitiveValue->viewportPercentageLength();
+    } else {
+        return;
+    }
+    state.style()->setLineHeight(lineHeight);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    state.style()->setListStyleImage(state.styleImage(CSSPropertyListStyleImage, value));
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyOutlineStyle(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setOutlineStyleIsAuto(RenderStyle::initialOutlineStyleIsAuto());
+    state.style()->setOutlineStyle(RenderStyle::initialBorderStyle());
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto());
+    state.style()->setOutlineStyle(state.parentStyle()->outlineStyle());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    state.style()->setOutlineStyleIsAuto(*primitiveValue);
+    state.style()->setOutlineStyle(*primitiveValue);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+    EResize r = RESIZE_NONE;
+    switch (primitiveValue->getValueID()) {
+    case 0:
+        return;
+    case CSSValueAuto:
+        if (Settings* settings = styleResolver->document()->settings())
+            r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
+        break;
+    default:
+        r = *primitiveValue;
+    }
+    state.style()->setResize(r);
+}
+
+static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
+static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
+static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
+{
+    DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
+    DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
+    DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
+    DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
+    DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
+    DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
+    DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
+    DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
+    DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
+    DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
+    DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
+    DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
+    DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
+    DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
+    DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
+    DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
+
+    if (!pageSizeName)
+        return false;
+
+    switch (pageSizeName->getValueID()) {
+    case CSSValueA5:
+        width = a5Width;
+        height = a5Height;
+        break;
+    case CSSValueA4:
+        width = a4Width;
+        height = a4Height;
+        break;
+    case CSSValueA3:
+        width = a3Width;
+        height = a3Height;
+        break;
+    case CSSValueB5:
+        width = b5Width;
+        height = b5Height;
+        break;
+    case CSSValueB4:
+        width = b4Width;
+        height = b4Height;
+        break;
+    case CSSValueLetter:
+        width = letterWidth;
+        height = letterHeight;
+        break;
+    case CSSValueLegal:
+        width = legalWidth;
+        height = legalHeight;
+        break;
+    case CSSValueLedger:
+        width = ledgerWidth;
+        height = ledgerHeight;
+        break;
+    default:
+        return false;
+    }
+
+    if (pageOrientation) {
+        switch (pageOrientation->getValueID()) {
+        case CSSValueLandscape:
+            std::swap(width, height);
+            break;
+        case CSSValuePortrait:
+            // Nothing to do.
+            break;
+        default:
+            return false;
+        }
+    }
+    return true;
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolver*, StyleResolverState&) { }
+void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolver*, StyleResolverState&) { }
+void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    state.style()->resetPageSizeType();
+    Length width;
+    Length height;
+    PageSizeType pageSizeType = PAGE_SIZE_AUTO;
+    CSSValueListInspector inspector(value);
+    switch (inspector.length()) {
+    case 2: {
+        // <length>{2} | <page-size> <orientation>
+        if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
+            return;
+        CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first());
+        CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second());
+        if (first->isLength()) {
+            // <length>{2}
+            if (!second->isLength())
+                return;
+            width = first->computeLength<Length>(state.style(), state.rootElementStyle());
+            height = second->computeLength<Length>(state.style(), state.rootElementStyle());
+        } else {
+            // <page-size> <orientation>
+            // The value order is guaranteed. See CSSParser::parseSizeParameter.
+            if (!getPageSizeFromName(first, second, width, height))
+                return;
+        }
+        pageSizeType = PAGE_SIZE_RESOLVED;
+        break;
+    }
+    case 1: {
+        // <length> | auto | <page-size> | [ portrait | landscape]
+        if (!inspector.first()->isPrimitiveValue())
+            return;
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first());
+        if (primitiveValue->isLength()) {
+            // <length>
+            pageSizeType = PAGE_SIZE_RESOLVED;
+            width = height = primitiveValue->computeLength<Length>(state.style(), state.rootElementStyle());
+        } else {
+            switch (primitiveValue->getValueID()) {
+            case 0:
+                return;
+            case CSSValueAuto:
+                pageSizeType = PAGE_SIZE_AUTO;
+                break;
+            case CSSValuePortrait:
+                pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
+                break;
+            case CSSValueLandscape:
+                pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
+                break;
+            default:
+                // <page-size>
+                pageSizeType = PAGE_SIZE_RESOLVED;
+                if (!getPageSizeFromName(primitiveValue, 0, width, height))
+                    return;
+            }
+        }
+        break;
+    }
+    default:
+        return;
+    }
+    state.style()->setPageSizeType(pageSizeType);
+    state.style()->setPageSize(LengthSize(width, height));
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+    if (primitiveValue->getValueID() != CSSValueWebkitMatchParent)
+        state.style()->setTextAlign(*primitiveValue);
+    else if (state.parentStyle()->textAlign() == TASTART)
+        state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
+    else if (state.parentStyle()->textAlign() == TAEND)
+        state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
+    else
+        state.style()->setTextAlign(state.parentStyle()->textAlign());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyTextDecoration(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    TextDecoration t = RenderStyle::initialTextDecoration();
+    for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
+        CSSValue* item = i.value();
+        t |= *toCSSPrimitiveValue(item);
+    }
+    state.style()->setTextDecoration(t);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setTextIndent(state.parentStyle()->textIndent());
+#if ENABLE(CSS3_TEXT)
+    state.style()->setTextIndentLine(state.parentStyle()->textIndentLine());
+#endif
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setTextIndent(RenderStyle::initialTextIndent());
+#if ENABLE(CSS3_TEXT)
+    state.style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
+#endif
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isValueList())
+        return;
+
+    // [ <length> | <percentage> ] -webkit-each-line
+    // The order is guaranteed. See CSSParser::parseTextIndent.
+    // The second value, -webkit-each-line is handled only when CSS3_TEXT is enabled.
+
+    CSSValueList* valueList = toCSSValueList(value);
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWithoutBoundsCheck(0));
+    Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
+    ASSERT(!lengthOrPercentageValue.isUndefined());
+    state.style()->setTextIndent(lengthOrPercentageValue);
+
+#if ENABLE(CSS3_TEXT)
+    ASSERT(valueList->length() <= 2);
+    CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
+    if (eachLineValue) {
+        ASSERT(eachLineValue->getValueID() == CSSValueWebkitEachLine);
+        state.style()->setTextIndentLine(TextIndentEachLine);
+    } else {
+        state.style()->setTextIndentLine(TextIndentFirstLine);
+    }
+#endif
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+    if (primitiveValue->getValueID())
+        return state.style()->setVerticalAlign(*primitiveValue);
+
+    state.style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom()));
+}
+
+static void resetEffectiveZoom(StyleResolverState& state)
 {
     // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
-    styleResolver->setEffectiveZoom(styleResolver->parentStyle() ? styleResolver->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
+    state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
 }
 
-void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolver* styleResolver)
+void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolver*, StyleResolverState& state)
 {
-    resetEffectiveZoom(styleResolver);
-    styleResolver->setZoom(RenderStyle::initialZoom());
+    resetEffectiveZoom(state);
+    state.setZoom(RenderStyle::initialZoom());
 }
 
-void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolver* styleResolver)
+void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolver*, StyleResolverState& state)
 {
-    resetEffectiveZoom(styleResolver);
-    styleResolver->setZoom(styleResolver->parentStyle()->zoom());
+    resetEffectiveZoom(state);
+    state.setZoom(state.parentStyle()->zoom());
 }
 
-void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolver* styleResolver, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolver*, StyleResolverState& state, CSSValue* value)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
 
     if (primitiveValue->getValueID() == CSSValueNormal) {
-        resetEffectiveZoom(styleResolver);
-        styleResolver->setZoom(RenderStyle::initialZoom());
+        resetEffectiveZoom(state);
+        state.setZoom(RenderStyle::initialZoom());
     } else if (primitiveValue->getValueID() == CSSValueReset) {
-        styleResolver->setEffectiveZoom(RenderStyle::initialZoom());
-        styleResolver->setZoom(RenderStyle::initialZoom());
+        state.setEffectiveZoom(RenderStyle::initialZoom());
+        state.setZoom(RenderStyle::initialZoom());
     } else if (primitiveValue->getValueID() == CSSValueDocument) {
-        float docZoom = styleResolver->rootElementStyle() ? styleResolver->rootElementStyle()->zoom() : RenderStyle::initialZoom();
-        styleResolver->setEffectiveZoom(docZoom);
-        styleResolver->setZoom(docZoom);
+        float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoom() : RenderStyle::initialZoom();
+        state.setEffectiveZoom(docZoom);
+        state.setZoom(docZoom);
     } else if (primitiveValue->isPercentage()) {
-        resetEffectiveZoom(styleResolver);
+        resetEffectiveZoom(state);
         if (float percent = primitiveValue->getFloatValue())
-            styleResolver->setZoom(percent / 100.0f);
+            state.setZoom(percent / 100.0f);
     } else if (primitiveValue->isNumber()) {
-        resetEffectiveZoom(styleResolver);
+        resetEffectiveZoom(state);
         if (float number = primitiveValue->getFloatValue())
-            styleResolver->setZoom(number);
+            state.setZoom(number);
+    }
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAspectRatio(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
+    state.style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
+    state.style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAspectRatio(StyleResolver*, StyleResolverState& state)
+{
+    if (!state.parentStyle()->hasAspectRatio())
+        return;
+    state.style()->setHasAspectRatio(true);
+    state.style()->setAspectRatioDenominator(state.parentStyle()->aspectRatioDenominator());
+    state.style()->setAspectRatioNumerator(state.parentStyle()->aspectRatioNumerator());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitAspectRatio(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isAspectRatioValue()) {
+        state.style()->setHasAspectRatio(false);
+        return;
+    }
+    CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value);
+    state.style()->setHasAspectRatio(true);
+    state.style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
+    state.style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
+{
+    if (value->isPrimitiveValue()) {
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+        if (primitiveValue->getValueID() == CSSValueNone) {
+            state.style()->setClipPath(0);
+        } else if (primitiveValue->isShape()) {
+            state.style()->setClipPath(ShapeClipPathOperation::create(basicShapeForValue(state, primitiveValue->getShapeValue())));
+        } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
+            String cssURLValue = primitiveValue->getStringValue();
+            KURL url = styleResolver->document()->completeURL(cssURLValue);
+            // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
+            state.style()->setClipPath(ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier()));
+        }
+    }
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyWebkitFontVariantLigatures(StyleResolver*, StyleResolverState& state)
+{
+    FontDescription fontDescription = state.fontDescription();
+
+    fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
+    fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
+    fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
+
+    state.setFontDescription(fontDescription);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyWebkitFontVariantLigatures(StyleResolver*, StyleResolverState& state)
+{
+    const FontDescription& parentFontDescription = state.parentFontDescription();
+    FontDescription fontDescription = state.fontDescription();
+
+    fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
+    fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
+    fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
+
+    state.setFontDescription(fontDescription);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitFontVariantLigatures(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
+    FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
+    FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
+
+    if (value->isValueList()) {
+        CSSValueList* valueList = toCSSValueList(value);
+        for (size_t i = 0; i < valueList->length(); ++i) {
+            CSSValue* item = valueList->itemWithoutBoundsCheck(i);
+            ASSERT(item->isPrimitiveValue());
+            if (item->isPrimitiveValue()) {
+                CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
+                switch (primitiveValue->getValueID()) {
+                case CSSValueNoCommonLigatures:
+                    commonLigaturesState = FontDescription::DisabledLigaturesState;
+                    break;
+                case CSSValueCommonLigatures:
+                    commonLigaturesState = FontDescription::EnabledLigaturesState;
+                    break;
+                case CSSValueNoDiscretionaryLigatures:
+                    discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
+                    break;
+                case CSSValueDiscretionaryLigatures:
+                    discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
+                    break;
+                case CSSValueNoHistoricalLigatures:
+                    historicalLigaturesState = FontDescription::DisabledLigaturesState;
+                    break;
+                case CSSValueHistoricalLigatures:
+                    historicalLigaturesState = FontDescription::EnabledLigaturesState;
+                    break;
+                default:
+                    ASSERT_NOT_REACHED();
+                    break;
+                }
+            }
+        }
+    }
+#if !ASSERT_DISABLED
+    else {
+        ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
+        ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNormal);
+    }
+#endif
+
+    FontDescription fontDescription = state.fontDescription();
+    fontDescription.setCommonLigaturesState(commonLigaturesState);
+    fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
+    fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
+    state.setFontDescription(fontDescription);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitMarqueeIncrement(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    if (primitiveValue->getValueID()) {
+        switch (primitiveValue->getValueID()) {
+        case CSSValueSmall:
+            state.style()->setMarqueeIncrement(Length(1, Fixed)); // 1px.
+            break;
+        case CSSValueNormal:
+            state.style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.
+            break;
+        case CSSValueLarge:
+            state.style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.
+            break;
+        default:
+            break;
+        }
+    } else {
+        Length marqueeLength = primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle()) : Length(Undefined);
+        if (!marqueeLength.isUndefined())
+            state.style()->setMarqueeIncrement(marqueeLength);
+    }
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitMarqueeSpeed(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    if (CSSValueID valueID = primitiveValue->getValueID()) {
+        switch (valueID) {
+        case CSSValueSlow:
+            state.style()->setMarqueeSpeed(500); // 500 msec.
+            break;
+        case CSSValueNormal:
+            state.style()->setMarqueeSpeed(85); // 85msec. The WinIE default.
+            break;
+        case CSSValueFast:
+            state.style()->setMarqueeSpeed(10); // 10msec. Super fast.
+            break;
+        default:
+            break;
+        }
+    } else if (primitiveValue->isTime()) {
+        state.style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());
+    } else if (primitiveValue->isNumber()) { // For scrollamount support.
+        state.style()->setMarqueeSpeed(primitiveValue->getIntValue());
+    }
+}
+
+// FIXME: We should use the same system for this as the rest of the pseudo-shorthands (e.g. background-position)
+void StyleBuilderFunctions::applyInitialCSSPropertyWebkitPerspectiveOrigin(StyleResolver* styleResolver, StyleResolverState& state)
+{
+    applyInitialCSSPropertyWebkitPerspectiveOriginX(styleResolver, state);
+    applyInitialCSSPropertyWebkitPerspectiveOriginY(styleResolver, state);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyWebkitPerspectiveOrigin(StyleResolver* styleResolver, StyleResolverState& state)
+{
+    applyInheritCSSPropertyWebkitPerspectiveOriginX(styleResolver, state);
+    applyInheritCSSPropertyWebkitPerspectiveOriginY(styleResolver, state);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitPerspectiveOrigin(StyleResolver*, StyleResolverState&, CSSValue* value)
+{
+    // This is expanded in the parser
+    ASSERT_NOT_REACHED();
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyWebkitTextEmphasisStyle(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
+    state.style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
+    state.style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyWebkitTextEmphasisStyle(StyleResolver*, StyleResolverState& state)
+{
+    state.style()->setTextEmphasisFill(state.parentStyle()->textEmphasisFill());
+    state.style()->setTextEmphasisMark(state.parentStyle()->textEmphasisMark());
+    state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCustomMark());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    if (value->isValueList()) {
+        CSSValueList* list = toCSSValueList(value);
+        ASSERT(list->length() == 2);
+        if (list->length() != 2)
+            return;
+        for (unsigned i = 0; i < 2; ++i) {
+            CSSValue* item = list->itemWithoutBoundsCheck(i);
+            if (!item->isPrimitiveValue())
+                continue;
+
+            CSSPrimitiveValue* value = toCSSPrimitiveValue(item);
+            if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen)
+                state.style()->setTextEmphasisFill(*value);
+            else
+                state.style()->setTextEmphasisMark(*value);
+        }
+        state.style()->setTextEmphasisCustomMark(nullAtom);
+        return;
+    }
+
+    if (!value->isPrimitiveValue())
+        return;
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+
+    if (primitiveValue->isString()) {
+        state.style()->setTextEmphasisFill(TextEmphasisFillFilled);
+        state.style()->setTextEmphasisMark(TextEmphasisMarkCustom);
+        state.style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
+        return;
+    }
+
+    state.style()->setTextEmphasisCustomMark(nullAtom);
+
+    if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getValueID() == CSSValueOpen) {
+        state.style()->setTextEmphasisFill(*primitiveValue);
+        state.style()->setTextEmphasisMark(TextEmphasisMarkAuto);
+    } else {
+        state.style()->setTextEmphasisFill(TextEmphasisFillFilled);
+        state.style()->setTextEmphasisMark(*primitiveValue);
+    }
+}
+
+#if ENABLE(CSS3_TEXT)
+void StyleBuilderFunctions::applyValueCSSPropetyWebkitTextUnderlinePosition(StyleResolver*, StyleResolverState& state, CSSValue* value)
+{
+    // This is true if value is 'auto' or 'alphabetic'.
+    if (value->isPrimitiveValue()) {
+        TextUnderlinePosition t = *toCSSPrimitiveValue(value);
+        state.style()->setTextUnderlinePosition(t);
+        return;
+    }
+
+    unsigned t = 0;
+    for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
+        CSSValue* item = i.value();
+        TextUnderlinePosition t2 = *toCSSPrimitiveValue(item);
+        t |= t2;
+    }
+    state.style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
+}
+#endif // CSS3_TEXT
+
+
+// Everything below this line is from the old StyleResolver::applyProperty
+// and eventually needs to move into new StyleBuilderFunctions calls intead.
+
+#define HANDLE_INHERIT(prop, Prop) \
+if (isInherit) { \
+    state.style()->set##Prop(state.parentStyle()->prop()); \
+    return; \
+}
+
+#define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
+HANDLE_INHERIT(prop, Prop) \
+if (isInitial) { \
+    state.style()->set##Prop(RenderStyle::initial##Prop()); \
+    return; \
+}
+
+#define HANDLE_SVG_INHERIT(prop, Prop) \
+if (isInherit) { \
+    state.style()->accessSVGStyle()->set##Prop(state.parentStyle()->svgStyle()->prop()); \
+    return; \
+}
+
+#define HANDLE_SVG_INHERIT_AND_INITIAL(prop, Prop) \
+HANDLE_SVG_INHERIT(prop, Prop) \
+if (isInitial) { \
+    state.style()->accessSVGStyle()->set##Prop(SVGRenderStyle::initial##Prop()); \
+    return; \
+}
+
+float getComputedSizeFromSpecifiedSize(const Document* document, const RenderStyle* style, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules)
+{
+    float zoomFactor = 1.0f;
+    if (!useSVGZoomRules) {
+        zoomFactor = style->effectiveZoom();
+        if (Frame* frame = document->frame())
+            zoomFactor *= frame->textZoomFactor();
+    }
+
+    return FontSize::getComputedSizeFromSpecifiedSize(document, zoomFactor, isAbsoluteSize, specifiedSize);
+}
+
+static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const StyleResolverState& state, GridLength& workingLength)
+{
+    if (primitiveValue->getValueID() == CSSValueMinContent) {
+        workingLength = Length(MinContent);
+        return true;
+    }
+
+    if (primitiveValue->getValueID() == CSSValueMaxContent) {
+        workingLength = Length(MaxContent);
+        return true;
+    }
+
+    if (primitiveValue->isFlex()) {
+        // Fractional unit.
+        workingLength.setFlex(primitiveValue->getFloatValue());
+        return true;
+    }
+
+    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
+    if (workingLength.length().isUndefined())
+        return false;
+
+    if (primitiveValue->isLength())
+        workingLength.length().setQuirk(primitiveValue->isQuirkValue());
+
+    return true;
+}
+
+static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const StyleResolverState& state)
+{
+    if (!value->isPrimitiveValue())
+        return false;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    Pair* minMaxTrackBreadth = primitiveValue->getPairValue();
+    if (!minMaxTrackBreadth) {
+        GridLength workingLength;
+        if (!createGridTrackBreadth(primitiveValue, state, workingLength))
+            return false;
+
+        trackSize.setLength(workingLength);
+        return true;
+    }
+
+    GridLength minTrackBreadth;
+    GridLength maxTrackBreadth;
+    if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBreadth))
+        return false;
+
+    trackSize.setMinMax(minTrackBreadth, maxTrackBreadth);
+    return true;
+}
+
+static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, NamedGridLinesMap& namedGridLines, const StyleResolverState& state)
+{
+    // Handle 'none'.
+    if (value->isPrimitiveValue()) {
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+        return primitiveValue->getValueID() == CSSValueNone;
+    }
+
+    if (!value->isValueList())
+        return false;
+
+    size_t currentNamedGridLine = 0;
+    for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
+        CSSValue* currValue = i.value();
+        if (currValue->isPrimitiveValue()) {
+            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(currValue);
+            if (primitiveValue->isString()) {
+                NamedGridLinesMap::AddResult result = namedGridLines.add(primitiveValue->getStringValue(), Vector<size_t>());
+                result.iterator->value.append(currentNamedGridLine);
+                continue;
+            }
+        }
+
+        ++currentNamedGridLine;
+        GridTrackSize trackSize;
+        if (!createGridTrackSize(currValue, trackSize, state))
+            return false;
+
+        trackSizes.append(trackSize);
+    }
+
+    // The parser should have rejected any <track-list> without any <track-size> as
+    // this is not conformant to the syntax.
+    ASSERT(!trackSizes.isEmpty());
+    return true;
+}
+
+static bool createGridPosition(CSSValue* value, GridPosition& position)
+{
+    // For now, we only accept: 'auto' | [ <integer> || <string> ] | span && <integer>?
+
+    if (value->isPrimitiveValue()) {
+        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+        ASSERT(primitiveValue->getValueID() == CSSValueAuto);
+        return true;
+    }
+
+    CSSValueList* values = toCSSValueList(value);
+    ASSERT(values->length());
+
+    bool isSpanPosition = false;
+    // The specification makes the <integer> optional, in which case it default to '1'.
+    int gridLineNumber = 1;
+    String gridLineName;
+
+    CSSValueListIterator it = values;
+    CSSPrimitiveValue* currentValue = toCSSPrimitiveValue(it.value());
+    if (currentValue->getValueID() == CSSValueSpan) {
+        isSpanPosition = true;
+        it.advance();
+        currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
+    }
+
+    if (currentValue && currentValue->isNumber()) {
+        gridLineNumber = currentValue->getIntValue();
+        it.advance();
+        currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
+    }
+
+    if (currentValue && currentValue->isString()) {
+        gridLineName = currentValue->getStringValue();
+        it.advance();
+    }
+
+    ASSERT(!it.hasMore());
+    if (isSpanPosition)
+        position.setSpanPosition(gridLineNumber, gridLineName);
+    else
+        position.setExplicitPosition(gridLineNumber, gridLineName);
+
+    return true;
+}
+
+static bool degreeToGlyphOrientation(CSSPrimitiveValue* primitiveValue, EGlyphOrientation& orientation)
+{
+    if (!primitiveValue)
+        return false;
+
+    if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_DEG)
+        return false;
+
+    float angle = fabsf(fmodf(primitiveValue->getFloatValue(), 360.0f));
+
+    if (angle <= 45.0f || angle > 315.0f) {
+        orientation = GO_0DEG;
+        return true;
+    }
+    if (angle > 45.0f && angle <= 135.0f) {
+        orientation = GO_90DEG;
+        return true;
+    }
+    if (angle > 135.0f && angle <= 225.0f) {
+        orientation = GO_180DEG;
+        return true;
+    }
+    orientation = GO_270DEG;
+    return true;
+}
+
+static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor)
+{
+    Color color;
+    if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
+        color = fgColor;
+    else
+        color = svgColor->color();
+    return color;
+}
+
+static bool numberToFloat(const CSSPrimitiveValue* primitiveValue, float& out)
+{
+    if (!primitiveValue)
+        return false;
+    if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
+        return false;
+    out = primitiveValue->getFloatValue();
+    return true;
+}
+
+static bool percentageOrNumberToFloat(const CSSPrimitiveValue* primitiveValue, float& out)
+{
+    if (!primitiveValue)
+        return false;
+    int type = primitiveValue->primitiveType();
+    if (type == CSSPrimitiveValue::CSS_PERCENTAGE) {
+        out = primitiveValue->getFloatValue() / 100.0f;
+        return true;
+    }
+    return numberToFloat(primitiveValue, out);
+}
+
+static String fragmentIdentifier(const CSSPrimitiveValue* primitiveValue, Document* document)
+{
+    if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_URI)
+        return String();
+    return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue->getStringValue(), document);
+}
+
+
+// FIXME: Every use of "styleResolver" in this function is a layering
+// violation and should be removed.
+void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value, bool isInitial, bool isInherit)
+{
+    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value) : 0;
+
+    float zoomFactor = state.style()->effectiveZoom();
+
+    // What follows is a list that maps the CSS properties into their corresponding front-end
+    // RenderStyle values.
+    switch (id) {
+    case CSSPropertyContent:
+        // list of string, uri, counter, attr, i
+        {
+            // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not. This
+            // note is a reminder that eventually "inherit" needs to be supported.
+
+            if (isInitial) {
+                state.style()->clearContent();
+                return;
+            }
+
+            if (!value->isValueList())
+                return;
+
+            bool didSet = false;
+            for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
+                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);
+                    else
+                        state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet);
+                    didSet = true;
+                } else if (item->isImageSetValue()) {
+                    state.style()->setContent(state.elementStyleResources().setOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), didSet);
+                    didSet = true;
+                }
+
+                if (item->isImageValue()) {
+                    state.style()->setContent(state.elementStyleResources().cachedOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet);
+                    didSet = true;
+                    continue;
+                }
+
+                if (!item->isPrimitiveValue())
+                    continue;
+
+                CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
+
+                if (contentValue->isString()) {
+                    state.style()->setContent(contentValue->getStringValue().impl(), didSet);
+                    didSet = true;
+                } else if (contentValue->isAttr()) {
+                    // FIXME: Can a namespace be specified for an attr(foo)?
+                    if (state.style()->styleType() == NOPSEUDO)
+                        state.style()->setUnique();
+                    else
+                        state.parentStyle()->setUnique();
+                    QualifiedName attr(nullAtom, contentValue->getStringValue().impl(), nullAtom);
+                    const AtomicString& value = state.element()->getAttribute(attr);
+                    state.style()->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);
+                    didSet = true;
+                    // register the fact that the attribute value affects the style
+                    styleResolver->m_features.attrsInRules.add(attr.localName().impl());
+                } else if (contentValue->isCounter()) {
+                    Counter* counterValue = contentValue->getCounterValue();
+                    EListStyleType listStyleType = NoneListStyle;
+                    CSSValueID listStyleIdent = counterValue->listStyleIdent();
+                    if (listStyleIdent != CSSValueNone)
+                        listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc);
+                    OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(counterValue->identifier(), listStyleType, counterValue->separator()));
+                    state.style()->setContent(counter.release(), didSet);
+                    didSet = true;
+                } else {
+                    switch (contentValue->getValueID()) {
+                    case CSSValueOpenQuote:
+                        state.style()->setContent(OPEN_QUOTE, didSet);
+                        didSet = true;
+                        break;
+                    case CSSValueCloseQuote:
+                        state.style()->setContent(CLOSE_QUOTE, didSet);
+                        didSet = true;
+                        break;
+                    case CSSValueNoOpenQuote:
+                        state.style()->setContent(NO_OPEN_QUOTE, didSet);
+                        didSet = true;
+                        break;
+                    case CSSValueNoCloseQuote:
+                        state.style()->setContent(NO_CLOSE_QUOTE, didSet);
+                        didSet = true;
+                        break;
+                    default:
+                        // normal and none do not have any effect.
+                        { }
+                    }
+                }
+            }
+            if (!didSet)
+                state.style()->clearContent();
+            return;
+        }
+    case CSSPropertyQuotes:
+        HANDLE_INHERIT_AND_INITIAL(quotes, Quotes);
+        if (value->isValueList()) {
+            CSSValueList* list = toCSSValueList(value);
+            RefPtr<QuotesData> quotes = QuotesData::create();
+            for (size_t i = 0; i < list->length(); i += 2) {
+                CSSValue* first = list->itemWithoutBoundsCheck(i);
+                // item() returns null if out of bounds so this is safe.
+                CSSValue* second = list->item(i + 1);
+                if (!second)
+                    continue;
+                String startQuote = toCSSPrimitiveValue(first)->getStringValue();
+                String endQuote = toCSSPrimitiveValue(second)->getStringValue();
+                quotes->addPair(std::make_pair(startQuote, endQuote));
+            }
+            state.style()->setQuotes(quotes);
+            return;
+        }
+        if (primitiveValue) {
+            if (primitiveValue->getValueID() == CSSValueNone)
+                state.style()->setQuotes(QuotesData::create());
+        }
+        return;
+    // Shorthand properties.
+    case CSSPropertyFont:
+        if (isInherit) {
+            FontDescription fontDescription = state.parentStyle()->fontDescription();
+            state.style()->setLineHeight(state.parentStyle()->specifiedLineHeight());
+            state.setLineHeightValue(0);
+            state.setFontDescription(fontDescription);
+        } else if (isInitial) {
+            const Settings* settings = state.document()->settings();
+            ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
+            if (!settings)
+                return;
+            styleResolver->initializeFontStyle(settings);
+        } else if (primitiveValue) {
+            state.style()->setLineHeight(RenderStyle::initialLineHeight());
+            state.setLineHeightValue(0);
+
+            FontDescription fontDescription;
+            RenderTheme::defaultTheme()->systemFont(primitiveValue->getValueID(), fontDescription);
+
+            // Double-check and see if the theme did anything. If not, don't bother updating the font.
+            if (fontDescription.isAbsoluteSize()) {
+                // Make sure the rendering mode and printer font settings are updated.
+                const Document* document = state.document();
+                const Settings* settings = document->settings();
+                ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
+                if (!settings)
+                    return;
+                fontDescription.setUsePrinterFont(document->printing());
+
+                // Handle the zoom factor.
+                fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document, state.style(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), state.useSVGZoomRules()));
+                state.setFontDescription(fontDescription);
+            }
+        } else if (value->isFontValue()) {
+            FontValue* font = static_cast<FontValue*>(value);
+            if (!font->style || !font->variant || !font->weight
+                || !font->size || !font->lineHeight || !font->family)
+                return;
+            styleResolver->applyProperty(CSSPropertyFontStyle, font->style.get());
+            styleResolver->applyProperty(CSSPropertyFontVariant, font->variant.get());
+            styleResolver->applyProperty(CSSPropertyFontWeight, font->weight.get());
+            // The previous properties can dirty our font but they don't try to read the font's
+            // properties back, which is safe. However if font-size is using the 'ex' unit, it will
+            // need query the dirtied font's x-height to get the computed size. To be safe in this
+            // case, let's just update the font now.
+            styleResolver->updateFont();
+            styleResolver->applyProperty(CSSPropertyFontSize, font->size.get());
+
+            state.setLineHeightValue(font->lineHeight.get());
+
+            styleResolver->applyProperty(CSSPropertyFontFamily, font->family.get());
+        }
+        return;
+
+    case CSSPropertyBackground:
+    case CSSPropertyBackgroundPosition:
+    case CSSPropertyBackgroundRepeat:
+    case CSSPropertyBorder:
+    case CSSPropertyBorderBottom:
+    case CSSPropertyBorderColor:
+    case CSSPropertyBorderImage:
+    case CSSPropertyBorderLeft:
+    case CSSPropertyBorderRadius:
+    case CSSPropertyBorderRight:
+    case CSSPropertyBorderSpacing:
+    case CSSPropertyBorderStyle:
+    case CSSPropertyBorderTop:
+    case CSSPropertyBorderWidth:
+    case CSSPropertyListStyle:
+    case CSSPropertyMargin:
+    case CSSPropertyOutline:
+    case CSSPropertyOverflow:
+    case CSSPropertyPadding:
+    case CSSPropertyTransition:
+    case CSSPropertyWebkitAnimation:
+    case CSSPropertyWebkitBorderAfter:
+    case CSSPropertyWebkitBorderBefore:
+    case CSSPropertyWebkitBorderEnd:
+    case CSSPropertyWebkitBorderStart:
+    case CSSPropertyWebkitBorderRadius:
+    case CSSPropertyWebkitColumns:
+    case CSSPropertyWebkitColumnRule:
+    case CSSPropertyFlex:
+    case CSSPropertyFlexFlow:
+    case CSSPropertyGridColumn:
+    case CSSPropertyGridRow:
+    case CSSPropertyGridArea:
+    case CSSPropertyWebkitMarginCollapse:
+    case CSSPropertyWebkitMarquee:
+    case CSSPropertyWebkitMask:
+    case CSSPropertyWebkitMaskPosition:
+    case CSSPropertyWebkitMaskRepeat:
+    case CSSPropertyWebkitTextEmphasis:
+    case CSSPropertyWebkitTextStroke:
+    case CSSPropertyWebkitTransition:
+    case CSSPropertyWebkitTransformOrigin:
+        ASSERT(isExpandedShorthand(id));
+        ASSERT_NOT_REACHED();
+        break;
+
+    // CSS3 Properties
+    case CSSPropertyTextShadow:
+    case CSSPropertyBoxShadow:
+    case CSSPropertyWebkitBoxShadow: {
+        if (isInherit) {
+            if (id == CSSPropertyTextShadow)
+                return state.style()->setTextShadow(cloneShadow(state.parentStyle()->textShadow()));
+            return state.style()->setBoxShadow(cloneShadow(state.parentStyle()->boxShadow()));
+        }
+        if (isInitial || primitiveValue) // initial | none
+            return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nullptr) : state.style()->setBoxShadow(nullptr);
+
+        if (!value->isValueList())
+            return;
+
+        for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
+            CSSValue* currValue = i.value();
+            if (!currValue->isShadowValue())
+                continue;
+            ShadowValue* item = static_cast<ShadowValue*>(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;
+            int spread = item->spread ? item->spread->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0;
+            ShadowStyle shadowStyle = item->style && item->style->getValueID() == CSSValueInset ? Inset : Normal;
+            Color color;
+            if (item->color)
+                color = state.document()->textLinkColors().colorFromPrimitiveValue(item->color.get(), state.style()->visitedDependentColor(CSSPropertyColor));
+            else if (state.style())
+                color = state.style()->color();
+
+            if (!color.isValid())
+                color = Color::transparent;
+            OwnPtr<ShadowData> shadow = ShadowData::create(IntPoint(x, y), blur, spread, shadowStyle, color);
+            if (id == CSSPropertyTextShadow)
+                state.style()->setTextShadow(shadow.release(), i.index()); // add to the list if this is not the first entry
+            else
+                state.style()->setBoxShadow(shadow.release(), i.index()); // add to the list if this is not the first entry
+        }
+        return;
+    }
+    case CSSPropertyWebkitBoxReflect: {
+        HANDLE_INHERIT_AND_INITIAL(boxReflect, BoxReflect)
+        if (primitiveValue) {
+            state.style()->setBoxReflect(RenderStyle::initialBoxReflect());
+            return;
+        }
+
+        if (!value->isReflectValue())
+            return;
+
+        CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value);
+        RefPtr<StyleReflection> reflection = StyleReflection::create();
+        reflection->setDirection(*reflectValue->direction());
+        if (reflectValue->offset())
+            reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(state.style(), state.rootElementStyle(), zoomFactor));
+        NinePieceImage mask;
+        mask.setMaskDefaults();
+        state.styleMap().mapNinePieceImage(id, reflectValue->mask(), mask);
+        reflection->setMask(mask);
+
+        state.style()->setBoxReflect(reflection.release());
+        return;
+    }
+    case CSSPropertySrc: // Only used in @font-face rules.
+        return;
+    case CSSPropertyUnicodeRange: // Only used in @font-face rules.
+        return;
+    case CSSPropertyWebkitLocale: {
+        HANDLE_INHERIT_AND_INITIAL(locale, Locale);
+        if (!primitiveValue)
+            return;
+        if (primitiveValue->getValueID() == CSSValueAuto)
+            state.style()->setLocale(nullAtom);
+        else
+            state.style()->setLocale(primitiveValue->getStringValue());
+        FontDescription fontDescription = state.style()->fontDescription();
+        fontDescription.setScript(localeToScriptCodeForFontSelection(state.style()->locale()));
+        state.setFontDescription(fontDescription);
+        return;
+    }
+    case CSSPropertyWebkitAppRegion: {
+        if (!primitiveValue || !primitiveValue->getValueID())
+            return;
+        state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);
+        state.document()->setHasAnnotatedRegions(true);
+        return;
+    }
+    case CSSPropertyWebkitTextStrokeWidth: {
+        HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth)
+        float width = 0;
+        switch (primitiveValue->getValueID()) {
+        case CSSValueThin:
+        case CSSValueMedium:
+        case CSSValueThick: {
+            double result = 1.0 / 48;
+            if (primitiveValue->getValueID() == CSSValueMedium)
+                result *= 3;
+            else if (primitiveValue->getValueID() == CSSValueThick)
+                result *= 5;
+            width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
+            break;
+        }
+        default:
+            width = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
+            break;
+        }
+        state.style()->setTextStrokeWidth(width);
+        return;
+    }
+    case CSSPropertyWebkitTransform: {
+        HANDLE_INHERIT_AND_INITIAL(transform, Transform);
+        TransformOperations operations;
+        TransformBuilder::createTransformOperations(value, state.style(), state.rootElementStyle(), operations);
+        state.style()->setTransform(operations);
+        return;
+    }
+    case CSSPropertyWebkitPerspective: {
+        HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
+
+        if (!primitiveValue)
+            return;
+
+        if (primitiveValue->getValueID() == CSSValueNone) {
+            state.style()->setPerspective(0);
+            return;
+        }
+
+        float perspectiveValue;
+        if (primitiveValue->isLength()) {
+            perspectiveValue = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
+        } else if (primitiveValue->isNumber()) {
+            // For backward compatibility, treat valueless numbers as px.
+            perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
+        } else {
+            return;
+        }
+
+        if (perspectiveValue >= 0.0f)
+            state.style()->setPerspective(perspectiveValue);
+        return;
+    }
+    case CSSPropertyWebkitTapHighlightColor: {
+        HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor);
+        if (!primitiveValue)
+            break;
+
+        Color col = state.document()->textLinkColors().colorFromPrimitiveValue(primitiveValue, state.style()->visitedDependentColor(CSSPropertyColor));
+        state.style()->setTapHighlightColor(col);
+        return;
+    }
+    case CSSPropertyInvalid:
+        return;
+    // Directional properties are resolved by resolveDirectionAwareProperty() before the switch.
+    case CSSPropertyWebkitBorderEndColor:
+    case CSSPropertyWebkitBorderEndStyle:
+    case CSSPropertyWebkitBorderEndWidth:
+    case CSSPropertyWebkitBorderStartColor:
+    case CSSPropertyWebkitBorderStartStyle:
+    case CSSPropertyWebkitBorderStartWidth:
+    case CSSPropertyWebkitBorderBeforeColor:
+    case CSSPropertyWebkitBorderBeforeStyle:
+    case CSSPropertyWebkitBorderBeforeWidth:
+    case CSSPropertyWebkitBorderAfterColor:
+    case CSSPropertyWebkitBorderAfterStyle:
+    case CSSPropertyWebkitBorderAfterWidth:
+    case CSSPropertyWebkitMarginEnd:
+    case CSSPropertyWebkitMarginStart:
+    case CSSPropertyWebkitMarginBefore:
+    case CSSPropertyWebkitMarginAfter:
+    case CSSPropertyWebkitMarginBeforeCollapse:
+    case CSSPropertyWebkitMarginTopCollapse:
+    case CSSPropertyWebkitMarginAfterCollapse:
+    case CSSPropertyWebkitMarginBottomCollapse:
+    case CSSPropertyWebkitPaddingEnd:
+    case CSSPropertyWebkitPaddingStart:
+    case CSSPropertyWebkitPaddingBefore:
+    case CSSPropertyWebkitPaddingAfter:
+    case CSSPropertyWebkitLogicalWidth:
+    case CSSPropertyWebkitLogicalHeight:
+    case CSSPropertyWebkitMinLogicalWidth:
+    case CSSPropertyWebkitMinLogicalHeight:
+    case CSSPropertyWebkitMaxLogicalWidth:
+    case CSSPropertyWebkitMaxLogicalHeight:
+    {
+        CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style()->direction(), state.style()->writingMode());
+        ASSERT(newId != id);
+        return styleResolver->applyProperty(newId, value);
+    }
+    case CSSPropertyFontStretch:
+    case CSSPropertyPage:
+    case CSSPropertyTextLineThroughColor:
+    case CSSPropertyTextLineThroughMode:
+    case CSSPropertyTextLineThroughStyle:
+    case CSSPropertyTextLineThroughWidth:
+    case CSSPropertyTextOverlineColor:
+    case CSSPropertyTextOverlineMode:
+    case CSSPropertyTextOverlineStyle:
+    case CSSPropertyTextOverlineWidth:
+    case CSSPropertyTextUnderlineColor:
+    case CSSPropertyTextUnderlineMode:
+    case CSSPropertyTextUnderlineStyle:
+    case CSSPropertyTextUnderlineWidth:
+    case CSSPropertyWebkitFontSizeDelta:
+    case CSSPropertyWebkitTextDecorationsInEffect:
+        return;
+
+    // CSS Text Layout Module Level 3: Vertical writing support
+    case CSSPropertyWebkitWritingMode: {
+        HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode);
+
+        if (primitiveValue)
+            state.setWritingMode(*primitiveValue);
+
+        // FIXME: It is not ok to modify document state while applying style.
+        if (state.element() && state.element() == state.document()->documentElement())
+            state.document()->setWritingModeSetOnDocumentElement(true);
+        return;
+    }
+
+    case CSSPropertyWebkitTextOrientation: {
+        HANDLE_INHERIT_AND_INITIAL(textOrientation, TextOrientation);
+
+        if (primitiveValue)
+            state.setTextOrientation(*primitiveValue);
+
+        return;
+    }
+
+    case CSSPropertyWebkitLineBoxContain: {
+        HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
+        if (primitiveValue && primitiveValue->getValueID() == CSSValueNone) {
+            state.style()->setLineBoxContain(LineBoxContainNone);
+            return;
+        }
+
+        if (!value->isCSSLineBoxContainValue())
+            return;
+
+        CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value);
+        state.style()->setLineBoxContain(lineBoxContainValue->value());
+        return;
+    }
+
+    // CSS Fonts Module Level 3
+    case CSSPropertyWebkitFontFeatureSettings: {
+        if (primitiveValue && primitiveValue->getValueID() == CSSValueNormal) {
+            state.setFontDescription(state.style()->fontDescription().makeNormalFeatureSettings());
+            return;
+        }
+
+        if (!value->isValueList())
+            return;
+
+        FontDescription fontDescription = state.style()->fontDescription();
+        CSSValueList* list = toCSSValueList(value);
+        RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
+        int len = list->length();
+        for (int i = 0; i < len; ++i) {
+            CSSValue* item = list->itemWithoutBoundsCheck(i);
+            if (!item->isFontFeatureValue())
+                continue;
+            FontFeatureValue* feature = static_cast<FontFeatureValue*>(item);
+            settings->append(FontFeature(feature->tag(), feature->value()));
+        }
+        fontDescription.setFeatureSettings(settings.release());
+        state.setFontDescription(fontDescription);
+        return;
+    }
+
+    case CSSPropertyWebkitFilter: {
+        HANDLE_INHERIT_AND_INITIAL(filter, Filter);
+        FilterOperations operations;
+        if (FilterOperationResolver::createFilterOperations(value, state.style(), state.rootElementStyle(), operations, styleResolver->m_styleResourceLoader.customFilterProgramCache(), state))
+            state.style()->setFilter(operations);
+        return;
+    }
+    case CSSPropertyGridAutoColumns: {
+        HANDLE_INHERIT_AND_INITIAL(gridAutoColumns, GridAutoColumns);
+        GridTrackSize trackSize;
+        if (!createGridTrackSize(value, trackSize, state))
+            return;
+        state.style()->setGridAutoColumns(trackSize);
+        return;
+    }
+    case CSSPropertyGridAutoRows: {
+        HANDLE_INHERIT_AND_INITIAL(gridAutoRows, GridAutoRows);
+        GridTrackSize trackSize;
+        if (!createGridTrackSize(value, trackSize, state))
+            return;
+        state.style()->setGridAutoRows(trackSize);
+        return;
+    }
+    case CSSPropertyGridDefinitionColumns: {
+        if (isInherit) {
+            state.style()->setGridDefinitionColumns(state.parentStyle()->gridDefinitionColumns());
+            state.style()->setNamedGridColumnLines(state.parentStyle()->namedGridColumnLines());
+            return;
+        }
+        if (isInitial) {
+            state.style()->setGridDefinitionColumns(RenderStyle::initialGridDefinitionColumns());
+            state.style()->setNamedGridColumnLines(RenderStyle::initialNamedGridColumnLines());
+            return;
+        }
+
+        Vector<GridTrackSize> trackSizes;
+        NamedGridLinesMap namedGridLines;
+        if (!createGridTrackList(value, trackSizes, namedGridLines, state))
+            return;
+        state.style()->setGridDefinitionColumns(trackSizes);
+        state.style()->setNamedGridColumnLines(namedGridLines);
+        return;
+    }
+    case CSSPropertyGridDefinitionRows: {
+        if (isInherit) {
+            state.style()->setGridDefinitionRows(state.parentStyle()->gridDefinitionRows());
+            state.style()->setNamedGridRowLines(state.parentStyle()->namedGridRowLines());
+            return;
+        }
+        if (isInitial) {
+            state.style()->setGridDefinitionRows(RenderStyle::initialGridDefinitionRows());
+            state.style()->setNamedGridRowLines(RenderStyle::initialNamedGridRowLines());
+            return;
+        }
+
+        Vector<GridTrackSize> trackSizes;
+        NamedGridLinesMap namedGridLines;
+        if (!createGridTrackList(value, trackSizes, namedGridLines, state))
+            return;
+        state.style()->setGridDefinitionRows(trackSizes);
+        state.style()->setNamedGridRowLines(namedGridLines);
+        return;
+    }
+
+    case CSSPropertyGridColumnStart: {
+        HANDLE_INHERIT_AND_INITIAL(gridColumnStart, GridColumnStart);
+        GridPosition startPosition;
+        if (!createGridPosition(value, startPosition))
+            return;
+        state.style()->setGridColumnStart(startPosition);
+        return;
+    }
+    case CSSPropertyGridColumnEnd: {
+        HANDLE_INHERIT_AND_INITIAL(gridColumnEnd, GridColumnEnd);
+        GridPosition endPosition;
+        if (!createGridPosition(value, endPosition))
+            return;
+        state.style()->setGridColumnEnd(endPosition);
+        return;
+    }
+
+    case CSSPropertyGridRowStart: {
+        HANDLE_INHERIT_AND_INITIAL(gridRowStart, GridRowStart);
+        GridPosition beforePosition;
+        if (!createGridPosition(value, beforePosition))
+            return;
+        state.style()->setGridRowStart(beforePosition);
+        return;
+    }
+    case CSSPropertyGridRowEnd: {
+        HANDLE_INHERIT_AND_INITIAL(gridRowEnd, GridRowEnd);
+        GridPosition afterPosition;
+        if (!createGridPosition(value, afterPosition))
+            return;
+        state.style()->setGridRowEnd(afterPosition);
+        return;
+    }
+
+    // These properties are aliased and we already applied the property on the prefixed version.
+    case CSSPropertyTransitionDelay:
+    case CSSPropertyTransitionDuration:
+    case CSSPropertyTransitionProperty:
+    case CSSPropertyTransitionTimingFunction:
+        return;
+    // These properties are implemented in StyleBuilder::applyProperty.
+    case CSSPropertyBackgroundAttachment:
+    case CSSPropertyBackgroundBlendMode:
+    case CSSPropertyBackgroundClip:
+    case CSSPropertyBackgroundColor:
+    case CSSPropertyBackgroundImage:
+    case CSSPropertyBackgroundOrigin:
+    case CSSPropertyBackgroundPositionX:
+    case CSSPropertyBackgroundPositionY:
+    case CSSPropertyBackgroundRepeatX:
+    case CSSPropertyBackgroundRepeatY:
+    case CSSPropertyBackgroundSize:
+    case CSSPropertyBorderBottomColor:
+    case CSSPropertyBorderBottomLeftRadius:
+    case CSSPropertyBorderBottomRightRadius:
+    case CSSPropertyBorderBottomStyle:
+    case CSSPropertyBorderBottomWidth:
+    case CSSPropertyBorderCollapse:
+    case CSSPropertyBorderImageOutset:
+    case CSSPropertyBorderImageRepeat:
+    case CSSPropertyBorderImageSlice:
+    case CSSPropertyBorderImageSource:
+    case CSSPropertyBorderImageWidth:
+    case CSSPropertyBorderLeftColor:
+    case CSSPropertyBorderLeftStyle:
+    case CSSPropertyBorderLeftWidth:
+    case CSSPropertyBorderRightColor:
+    case CSSPropertyBorderRightStyle:
+    case CSSPropertyBorderRightWidth:
+    case CSSPropertyBorderTopColor:
+    case CSSPropertyBorderTopLeftRadius:
+    case CSSPropertyBorderTopRightRadius:
+    case CSSPropertyBorderTopStyle:
+    case CSSPropertyBorderTopWidth:
+    case CSSPropertyBottom:
+    case CSSPropertyBoxSizing:
+    case CSSPropertyCaptionSide:
+    case CSSPropertyClear:
+    case CSSPropertyClip:
+    case CSSPropertyColor:
+    case CSSPropertyCounterIncrement:
+    case CSSPropertyCounterReset:
+    case CSSPropertyCursor:
+    case CSSPropertyDirection:
+    case CSSPropertyDisplay:
+    case CSSPropertyEmptyCells:
+    case CSSPropertyFloat:
+    case CSSPropertyFontSize:
+    case CSSPropertyFontStyle:
+    case CSSPropertyFontVariant:
+    case CSSPropertyFontWeight:
+    case CSSPropertyHeight:
+    case CSSPropertyImageRendering:
+    case CSSPropertyLeft:
+    case CSSPropertyLetterSpacing:
+    case CSSPropertyLineHeight:
+    case CSSPropertyListStyleImage:
+    case CSSPropertyListStylePosition:
+    case CSSPropertyListStyleType:
+    case CSSPropertyMarginBottom:
+    case CSSPropertyMarginLeft:
+    case CSSPropertyMarginRight:
+    case CSSPropertyMarginTop:
+    case CSSPropertyMaxHeight:
+    case CSSPropertyMaxWidth:
+    case CSSPropertyMinHeight:
+    case CSSPropertyMixBlendMode:
+    case CSSPropertyMinWidth:
+    case CSSPropertyOpacity:
+    case CSSPropertyOrphans:
+    case CSSPropertyOutlineColor:
+    case CSSPropertyOutlineOffset:
+    case CSSPropertyOutlineStyle:
+    case CSSPropertyOutlineWidth:
+    case CSSPropertyOverflowWrap:
+    case CSSPropertyOverflowX:
+    case CSSPropertyOverflowY:
+    case CSSPropertyPaddingBottom:
+    case CSSPropertyPaddingLeft:
+    case CSSPropertyPaddingRight:
+    case CSSPropertyPaddingTop:
+    case CSSPropertyPageBreakAfter:
+    case CSSPropertyPageBreakBefore:
+    case CSSPropertyPageBreakInside:
+    case CSSPropertyPointerEvents:
+    case CSSPropertyPosition:
+    case CSSPropertyResize:
+    case CSSPropertyRight:
+    case CSSPropertySize:
+    case CSSPropertySpeak:
+    case CSSPropertyTabSize:
+    case CSSPropertyTableLayout:
+    case CSSPropertyTextAlign:
+    case CSSPropertyTextAlignLast:
+    case CSSPropertyTextDecoration:
+    case CSSPropertyTextDecorationLine:
+    case CSSPropertyTextDecorationStyle:
+    case CSSPropertyTextDecorationColor:
+    case CSSPropertyTextIndent:
+    case CSSPropertyTextOverflow:
+    case CSSPropertyTextRendering:
+    case CSSPropertyTextTransform:
+    case CSSPropertyTop:
+    case CSSPropertyTouchAction:
+    case CSSPropertyUnicodeBidi:
+    case CSSPropertyVariable:
+    case CSSPropertyVerticalAlign:
+    case CSSPropertyVisibility:
+    case CSSPropertyWebkitAnimationDelay:
+    case CSSPropertyWebkitAnimationDirection:
+    case CSSPropertyWebkitAnimationDuration:
+    case CSSPropertyWebkitAnimationFillMode:
+    case CSSPropertyWebkitAnimationIterationCount:
+    case CSSPropertyWebkitAnimationName:
+    case CSSPropertyWebkitAnimationPlayState:
+    case CSSPropertyWebkitAnimationTimingFunction:
+    case CSSPropertyWebkitAppearance:
+    case CSSPropertyWebkitAspectRatio:
+    case CSSPropertyWebkitBackfaceVisibility:
+    case CSSPropertyWebkitBackgroundClip:
+    case CSSPropertyWebkitBackgroundComposite:
+    case CSSPropertyWebkitBackgroundOrigin:
+    case CSSPropertyWebkitBackgroundSize:
+    case CSSPropertyWebkitBorderFit:
+    case CSSPropertyWebkitBorderHorizontalSpacing:
+    case CSSPropertyWebkitBorderImage:
+    case CSSPropertyWebkitBorderVerticalSpacing:
+    case CSSPropertyWebkitBoxAlign:
+    case CSSPropertyWebkitBoxDecorationBreak:
+    case CSSPropertyWebkitBoxDirection:
+    case CSSPropertyWebkitBoxFlex:
+    case CSSPropertyWebkitBoxFlexGroup:
+    case CSSPropertyWebkitBoxLines:
+    case CSSPropertyWebkitBoxOrdinalGroup:
+    case CSSPropertyWebkitBoxOrient:
+    case CSSPropertyWebkitBoxPack:
+    case CSSPropertyWebkitColumnAxis:
+    case CSSPropertyWebkitColumnBreakAfter:
+    case CSSPropertyWebkitColumnBreakBefore:
+    case CSSPropertyWebkitColumnBreakInside:
+    case CSSPropertyWebkitColumnCount:
+    case CSSPropertyWebkitColumnGap:
+    case CSSPropertyWebkitColumnProgression:
+    case CSSPropertyWebkitColumnRuleColor:
+    case CSSPropertyWebkitColumnRuleStyle:
+    case CSSPropertyWebkitColumnRuleWidth:
+    case CSSPropertyWebkitColumnSpan:
+    case CSSPropertyWebkitColumnWidth:
+    case CSSPropertyAlignContent:
+    case CSSPropertyAlignItems:
+    case CSSPropertyAlignSelf:
+    case CSSPropertyFlexBasis:
+    case CSSPropertyFlexDirection:
+    case CSSPropertyFlexGrow:
+    case CSSPropertyFlexShrink:
+    case CSSPropertyFlexWrap:
+    case CSSPropertyJustifyContent:
+    case CSSPropertyOrder:
+    case CSSPropertyWebkitFlowFrom:
+    case CSSPropertyWebkitFlowInto:
+    case CSSPropertyWebkitFontKerning:
+    case CSSPropertyWebkitFontSmoothing:
+    case CSSPropertyWebkitFontVariantLigatures:
+    case CSSPropertyWebkitHighlight:
+    case CSSPropertyWebkitHyphenateCharacter:
+    case CSSPropertyWebkitHyphenateLimitAfter:
+    case CSSPropertyWebkitHyphenateLimitBefore:
+    case CSSPropertyWebkitHyphenateLimitLines:
+    case CSSPropertyWebkitHyphens:
+    case CSSPropertyWebkitLineAlign:
+    case CSSPropertyWebkitLineBreak:
+    case CSSPropertyWebkitLineClamp:
+    case CSSPropertyWebkitLineGrid:
+    case CSSPropertyWebkitLineSnap:
+    case CSSPropertyWebkitMarqueeDirection:
+    case CSSPropertyWebkitMarqueeIncrement:
+    case CSSPropertyWebkitMarqueeRepetition:
+    case CSSPropertyWebkitMarqueeSpeed:
+    case CSSPropertyWebkitMarqueeStyle:
+    case CSSPropertyWebkitMaskBoxImage:
+    case CSSPropertyWebkitMaskBoxImageOutset:
+    case CSSPropertyWebkitMaskBoxImageRepeat:
+    case CSSPropertyWebkitMaskBoxImageSlice:
+    case CSSPropertyWebkitMaskBoxImageSource:
+    case CSSPropertyWebkitMaskBoxImageWidth:
+    case CSSPropertyWebkitMaskClip:
+    case CSSPropertyWebkitMaskComposite:
+    case CSSPropertyWebkitMaskImage:
+    case CSSPropertyWebkitMaskOrigin:
+    case CSSPropertyWebkitMaskPositionX:
+    case CSSPropertyWebkitMaskPositionY:
+    case CSSPropertyWebkitMaskRepeatX:
+    case CSSPropertyWebkitMaskRepeatY:
+    case CSSPropertyWebkitMaskSize:
+    case CSSPropertyWebkitPerspectiveOrigin:
+    case CSSPropertyWebkitPerspectiveOriginX:
+    case CSSPropertyWebkitPerspectiveOriginY:
+    case CSSPropertyWebkitPrintColorAdjust:
+    case CSSPropertyWebkitRegionBreakAfter:
+    case CSSPropertyWebkitRegionBreakBefore:
+    case CSSPropertyWebkitRegionBreakInside:
+    case CSSPropertyWebkitRegionFragment:
+    case CSSPropertyWebkitRtlOrdering:
+    case CSSPropertyWebkitRubyPosition:
+    case CSSPropertyWebkitTextCombine:
+#if ENABLE(CSS3_TEXT)
+    case CSSPropertyWebkitTextUnderlinePosition:
+#endif // CSS3_TEXT
+    case CSSPropertyWebkitTextEmphasisColor:
+    case CSSPropertyWebkitTextEmphasisPosition:
+    case CSSPropertyWebkitTextEmphasisStyle:
+    case CSSPropertyWebkitTextFillColor:
+    case CSSPropertyWebkitTextSecurity:
+    case CSSPropertyWebkitTextStrokeColor:
+    case CSSPropertyWebkitTransformOriginX:
+    case CSSPropertyWebkitTransformOriginY:
+    case CSSPropertyWebkitTransformOriginZ:
+    case CSSPropertyWebkitTransformStyle:
+    case CSSPropertyWebkitTransitionDelay:
+    case CSSPropertyWebkitTransitionDuration:
+    case CSSPropertyWebkitTransitionProperty:
+    case CSSPropertyWebkitTransitionTimingFunction:
+    case CSSPropertyWebkitUserDrag:
+    case CSSPropertyWebkitUserModify:
+    case CSSPropertyWebkitUserSelect:
+    case CSSPropertyWebkitClipPath:
+    case CSSPropertyWebkitWrapFlow:
+    case CSSPropertyWebkitShapeMargin:
+    case CSSPropertyWebkitShapePadding:
+    case CSSPropertyWebkitWrapThrough:
+    case CSSPropertyWebkitShapeInside:
+    case CSSPropertyWebkitShapeOutside:
+    case CSSPropertyWhiteSpace:
+    case CSSPropertyWidows:
+    case CSSPropertyWidth:
+    case CSSPropertyWordBreak:
+    case CSSPropertyWordSpacing:
+    case CSSPropertyWordWrap:
+    case CSSPropertyZIndex:
+    case CSSPropertyZoom:
+    case CSSPropertyMaxZoom:
+    case CSSPropertyMinZoom:
+    case CSSPropertyOrientation:
+    case CSSPropertyUserZoom:
+    case CSSPropertyFontFamily:
+    case CSSPropertyGridAutoFlow:
+    case CSSPropertyMarker:
+        ASSERT_NOT_REACHED();
+        return;
+
+    case CSSPropertyAlignmentBaseline:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setAlignmentBaseline(*primitiveValue);
+        break;
+    }
+    case CSSPropertyBaselineShift:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(baselineShift, BaselineShift);
+        if (!primitiveValue)
+            break;
+
+        SVGRenderStyle* svgStyle = state.style()->accessSVGStyle();
+        if (primitiveValue->getValueID()) {
+            switch (primitiveValue->getValueID()) {
+            case CSSValueBaseline:
+                svgStyle->setBaselineShift(BS_BASELINE);
+                break;
+            case CSSValueSub:
+                svgStyle->setBaselineShift(BS_SUB);
+                break;
+            case CSSValueSuper:
+                svgStyle->setBaselineShift(BS_SUPER);
+                break;
+            default:
+                break;
+            }
+        } else {
+            svgStyle->setBaselineShift(BS_LENGTH);
+            svgStyle->setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+        }
+
+        break;
+    }
+    case CSSPropertyKerning:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(kerning, Kerning);
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+        break;
+    }
+    case CSSPropertyDominantBaseline:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(dominantBaseline, DominantBaseline)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setDominantBaseline(*primitiveValue);
+        break;
+    }
+    case CSSPropertyColorInterpolation:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(colorInterpolation, ColorInterpolation)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setColorInterpolation(*primitiveValue);
+        break;
+    }
+    case CSSPropertyColorInterpolationFilters:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(colorInterpolationFilters, ColorInterpolationFilters)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setColorInterpolationFilters(*primitiveValue);
+        break;
+    }
+    case CSSPropertyColorProfile:
+    {
+        // Not implemented.
+        break;
+    }
+    case CSSPropertyColorRendering:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(colorRendering, ColorRendering)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setColorRendering(*primitiveValue);
+        break;
+    }
+    case CSSPropertyClipRule:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(clipRule, ClipRule)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setClipRule(*primitiveValue);
+        break;
+    }
+    case CSSPropertyFillRule:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(fillRule, FillRule)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setFillRule(*primitiveValue);
+        break;
+    }
+    case CSSPropertyStrokeLinejoin:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(joinStyle, JoinStyle)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setJoinStyle(*primitiveValue);
+        break;
+    }
+    case CSSPropertyShapeRendering:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(shapeRendering, ShapeRendering)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setShapeRendering(*primitiveValue);
+        break;
+    }
+    // end of ident only properties
+    case CSSPropertyFill:
+    {
+        SVGRenderStyle* svgStyle = state.style()->accessSVGStyle();
+        if (isInherit) {
+            const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle();
+            svgStyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
+            return;
+        }
+        if (isInitial) {
+            svgStyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
+            return;
+        }
+        if (value->isSVGPaint()) {
+            SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
+            svgStyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
+        }
+        break;
+    }
+    case CSSPropertyStroke:
+    {
+        SVGRenderStyle* svgStyle = state.style()->accessSVGStyle();
+        if (isInherit) {
+            const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle();
+            svgStyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
+            return;
+        }
+        if (isInitial) {
+            svgStyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
+            return;
+        }
+        if (value->isSVGPaint()) {
+            SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
+            svgStyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
+        }
+        break;
+    }
+    case CSSPropertyStrokeWidth:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setStrokeWidth(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+        break;
+    }
+    case CSSPropertyStrokeDasharray:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
+        if (!value->isValueList()) {
+            state.style()->accessSVGStyle()->setStrokeDashArray(SVGRenderStyle::initialStrokeDashArray());
+            break;
+        }
+
+        CSSValueList* dashes = toCSSValueList(value);
+
+        Vector<SVGLength> array;
+        size_t length = dashes->length();
+        for (size_t i = 0; i < length; ++i) {
+            CSSValue* currValue = dashes->itemWithoutBoundsCheck(i);
+            if (!currValue->isPrimitiveValue())
+                continue;
+
+            CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBoundsCheck(i));
+            array.append(SVGLength::fromCSSPrimitiveValue(dash));
+        }
+
+        state.style()->accessSVGStyle()->setStrokeDashArray(array);
+        break;
+    }
+    case CSSPropertyStrokeDashoffset:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setStrokeDashOffset(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+        break;
+    }
+    case CSSPropertyFillOpacity:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)
+        float f = 0.0f;
+        if (percentageOrNumberToFloat(primitiveValue, f))
+            state.style()->accessSVGStyle()->setFillOpacity(f);
+        break;
+    }
+    case CSSPropertyStrokeOpacity:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)
+        float f = 0.0f;
+        if (percentageOrNumberToFloat(primitiveValue, f))
+            state.style()->accessSVGStyle()->setStrokeOpacity(f);
+        break;
+    }
+    case CSSPropertyStopOpacity:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)
+        float f = 0.0f;
+        if (percentageOrNumberToFloat(primitiveValue, f))
+            state.style()->accessSVGStyle()->setStopOpacity(f);
+        break;
+    }
+    case CSSPropertyMarkerStart:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(markerStartResource, MarkerStartResource)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setMarkerStartResource(fragmentIdentifier(primitiveValue, state.document()));
+        break;
+    }
+    case CSSPropertyMarkerMid:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(markerMidResource, MarkerMidResource)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setMarkerMidResource(fragmentIdentifier(primitiveValue, state.document()));
+        break;
+    }
+    case CSSPropertyMarkerEnd:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(markerEndResource, MarkerEndResource)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setMarkerEndResource(fragmentIdentifier(primitiveValue, state.document()));
+        break;
+    }
+    case CSSPropertyStrokeLinecap:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(capStyle, CapStyle)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setCapStyle(*primitiveValue);
+        break;
+    }
+    case CSSPropertyStrokeMiterlimit:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(strokeMiterLimit, StrokeMiterLimit)
+        float f = 0.0f;
+        if (numberToFloat(primitiveValue, f))
+            state.style()->accessSVGStyle()->setStrokeMiterLimit(f);
+        break;
+    }
+    case CSSPropertyFilter:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(filterResource, FilterResource)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setFilterResource(fragmentIdentifier(primitiveValue, state.document()));
+        break;
+    }
+    case CSSPropertyMask:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(maskerResource, MaskerResource)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setMaskerResource(fragmentIdentifier(primitiveValue, state.document()));
+        break;
+    }
+    case CSSPropertyClipPath:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(clipperResource, ClipperResource)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setClipperResource(fragmentIdentifier(primitiveValue, state.document()));
+        break;
+    }
+    case CSSPropertyTextAnchor:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(textAnchor, TextAnchor)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setTextAnchor(*primitiveValue);
+        break;
+    }
+    case CSSPropertyWritingMode:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(writingMode, WritingMode)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setWritingMode(*primitiveValue);
+        break;
+    }
+    case CSSPropertyStopColor:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(stopColor, StopColor);
+        if (value->isSVGColor())
+            state.style()->accessSVGStyle()->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(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()));
+        break;
+    }
+    case CSSPropertyFloodOpacity:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(floodOpacity, FloodOpacity)
+        float f = 0.0f;
+        if (percentageOrNumberToFloat(primitiveValue, f))
+            state.style()->accessSVGStyle()->setFloodOpacity(f);
+        break;
+    }
+    case CSSPropertyFloodColor:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(floodColor, FloodColor);
+        if (value->isSVGColor())
+            state.style()->accessSVGStyle()->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
+        break;
+    }
+    case CSSPropertyGlyphOrientationHorizontal:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientationHorizontal)
+        EGlyphOrientation orientation;
+        if (degreeToGlyphOrientation(primitiveValue, orientation))
+            state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orientation);
+        break;
+    }
+    case CSSPropertyGlyphOrientationVertical:
+    {
+        HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientationVertical)
+        if (primitiveValue->getValueID() == CSSValueAuto) {
+            state.style()->accessSVGStyle()->setGlyphOrientationVertical(GO_AUTO);
+            break;
+        }
+        EGlyphOrientation orientation;
+        if (degreeToGlyphOrientation(primitiveValue, orientation))
+            state.style()->accessSVGStyle()->setGlyphOrientationVertical(orientation);
+        break;
+    }
+    case CSSPropertyEnableBackground:
+        // Silently ignoring this property for now
+        // http://bugs.webkit.org/show_bug.cgi?id=6022
+        break;
+    case CSSPropertyWebkitSvgShadow: {
+        if (isInherit)
+            return state.style()->accessSVGStyle()->setShadow(cloneShadow(state.parentStyle()->svgStyle()->shadow()));
+        if (isInitial || primitiveValue) // initial | none
+            return state.style()->accessSVGStyle()->setShadow(nullptr);
+
+        if (!value->isValueList())
+            return;
+
+        CSSValueList* list = toCSSValueList(value);
+        if (!list->length())
+            return;
+
+        CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
+        if (!firstValue->isShadowValue())
+            return;
+        ShadowValue* item = static_cast<ShadowValue*>(firstValue);
+        IntPoint location(item->x->computeLength<int>(state.style(), state.rootElementStyle()),
+            item->y->computeLength<int>(state.style(), state.rootElementStyle()));
+        int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle()) : 0;
+        Color color;
+        if (item->color)
+            color = state.document()->textLinkColors().colorFromPrimitiveValue(item->color.get(), state.style()->visitedDependentColor(CSSPropertyColor));
+
+        // -webkit-svg-shadow does should not have a spread or style
+        ASSERT(!item->spread);
+        ASSERT(!item->style);
+
+        if (!color.isValid())
+            color = Color::transparent;
+        state.style()->accessSVGStyle()->setShadow(ShadowData::create(location, blur, 0, Normal, color));
+        return;
+    }
+    case CSSPropertyVectorEffect: {
+        HANDLE_SVG_INHERIT_AND_INITIAL(vectorEffect, VectorEffect)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setVectorEffect(*primitiveValue);
+        break;
+    }
+    case CSSPropertyBufferedRendering: {
+        HANDLE_SVG_INHERIT_AND_INITIAL(bufferedRendering, BufferedRendering)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setBufferedRendering(*primitiveValue);
+        break;
+    }
+    case CSSPropertyMaskType: {
+        HANDLE_SVG_INHERIT_AND_INITIAL(maskType, MaskType)
+        if (primitiveValue)
+            state.style()->accessSVGStyle()->setMaskType(*primitiveValue);
+        break;
+    }
     }
 }
 
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index d06cf9b..6f54424 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "core/css/resolver/StyleResolver.h"
 
+// FIXME: This include list is way more than we need!
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
@@ -53,24 +54,23 @@
 #include "core/css/CSSStyleRule.h"
 #include "core/css/CSSValueList.h"
 #include "core/css/CSSVariableValue.h"
-#include "core/css/Counter.h"
-#include "core/css/DeprecatedStyleBuilder.h"
 #include "core/css/ElementRuleCollector.h"
 #include "core/css/FontFeatureValue.h"
 #include "core/css/FontSize.h"
-#include "core/css/FontValue.h"
 #include "core/css/MediaQueryEvaluator.h"
 #include "core/css/PageRuleCollector.h"
 #include "core/css/Pair.h"
 #include "core/css/RuleSet.h"
-#include "core/css/ShadowValue.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/StylePropertyShorthand.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/css/resolver/ElementStyleResources.h"
 #include "core/css/resolver/FilterOperationResolver.h"
+#include "core/css/resolver/MatchResult.h"
+#include "core/css/resolver/MediaQueryResult.h"
+#include "core/css/resolver/SharedStyleFinder.h"
+#include "core/css/resolver/StyleAdjuster.h"
 #include "core/css/resolver/StyleBuilder.h"
-#include "core/css/resolver/TransformBuilder.h"
 #include "core/css/resolver/ViewportStyleResolver.h"
 #include "core/dom/DocumentStyleSheetCollection.h"
 #include "core/dom/FullscreenController.h"
@@ -79,9 +79,8 @@
 #include "core/dom/Text.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLIFrameElement.h"
-#include "core/html/HTMLInputElement.h"
-#include "core/html/track/WebVTTElement.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/cache/CachedDocument.h"
 #include "core/loader/cache/CachedSVGDocumentReference.h"
@@ -89,25 +88,11 @@
 #include "core/page/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/LinkHash.h"
 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
 #include "core/platform/text/LocaleToScriptMapping.h"
-#include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
-#include "core/rendering/style/ContentData.h"
-#include "core/rendering/style/CounterContent.h"
-#include "core/rendering/style/CursorList.h"
 #include "core/rendering/style/KeyframeList.h"
-#include "core/rendering/style/QuotesData.h"
-#include "core/rendering/style/RenderStyleConstants.h"
-#include "core/rendering/style/ShadowData.h"
-#include "core/rendering/style/StyleCachedImage.h"
-#include "core/rendering/style/StyleCachedImageSet.h"
 #include "core/rendering/style/StyleCustomFilterProgramCache.h"
-#include "core/rendering/style/StyleGeneratedImage.h"
-#include "core/rendering/style/StylePendingImage.h"
-#include "core/rendering/style/StylePendingShader.h"
-#include "core/rendering/style/StyleShader.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGFontFaceElement.h"
@@ -130,19 +115,6 @@
 
 using namespace HTMLNames;
 
-#define HANDLE_INHERIT(prop, Prop) \
-if (isInherit) { \
-    m_state.style()->set##Prop(m_state.parentStyle()->prop()); \
-    return; \
-}
-
-#define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
-HANDLE_INHERIT(prop, Prop) \
-if (isInitial) { \
-    m_state.style()->set##Prop(RenderStyle::initial##Prop()); \
-    return; \
-}
-
 RenderStyle* StyleResolver::s_styleNotYetAvailable;
 
 static StylePropertySet* leftToRightDeclaration()
@@ -161,26 +133,11 @@
     return rightToLeftDecl.get();
 }
 
-
-void StyleResolver::MatchResult::addMatchedProperties(const StylePropertySet* properties, StyleRule* rule, unsigned linkMatchType, PropertyWhitelistType propertyWhitelistType)
-{
-    matchedProperties.grow(matchedProperties.size() + 1);
-    StyleResolver::MatchedProperties& newProperties = matchedProperties.last();
-    newProperties.properties = const_cast<StylePropertySet*>(properties);
-    newProperties.linkMatchType = linkMatchType;
-    newProperties.whitelistType = propertyWhitelistType;
-    matchedRules.append(rule);
-}
-
 StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
-    : m_matchedPropertiesCacheAdditionsSinceLastSweep(0)
-    , m_matchedPropertiesCacheSweepTimer(this, &StyleResolver::sweepMatchedPropertiesCache)
-    , m_document(document)
+    : m_document(document)
     , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles)
     , m_fontSelector(CSSFontSelector::create(document))
     , m_viewportStyleResolver(ViewportStyleResolver::create(document))
-    , m_styleBuilder(DeprecatedStyleBuilder::sharedStyleBuilder())
-    , m_styleMap(this)
     , m_styleResourceLoader(document->cachedResourceLoader())
 {
     Element* root = document->documentElement();
@@ -363,38 +320,6 @@
     m_viewportStyleResolver->clearDocument();
 }
 
-void StyleResolver::sweepMatchedPropertiesCache(Timer<StyleResolver>*)
-{
-    // Look for cache entries containing a style declaration with a single ref and remove them.
-    // This may happen when an element attribute mutation causes it to generate a new inlineStyle()
-    // or presentationAttributeStyle(), potentially leaving this cache with the last ref on the old one.
-    Vector<unsigned, 16> toRemove;
-    MatchedPropertiesCache::iterator it = m_matchedPropertiesCache.begin();
-    MatchedPropertiesCache::iterator end = m_matchedPropertiesCache.end();
-    for (; it != end; ++it) {
-        Vector<MatchedProperties>& matchedProperties = it->value.matchedProperties;
-        for (size_t i = 0; i < matchedProperties.size(); ++i) {
-            if (matchedProperties[i].properties->hasOneRef()) {
-                toRemove.append(it->key);
-                break;
-            }
-        }
-    }
-    for (size_t i = 0; i < toRemove.size(); ++i)
-        m_matchedPropertiesCache.remove(toRemove[i]);
-
-    m_matchedPropertiesCacheAdditionsSinceLastSweep = 0;
-}
-
-bool StyleResolver::classNamesAffectedByRules(const SpaceSplitString& classNames) const
-{
-    for (unsigned i = 0; i < classNames.size(); ++i) {
-        if (m_features.classesInRules.contains(classNames[i].impl()))
-            return true;
-    }
-    return false;
-}
-
 inline void StyleResolver::matchShadowDistributedRules(ElementRuleCollector& collector, bool includeEmptyRules)
 {
     if (m_ruleSets.shadowDistributedRules().isEmpty())
@@ -511,17 +436,17 @@
         matchUserRules(collector, false);
 
     // Now check author rules, beginning first with presentational attributes mapped from HTML.
-    if (m_state.styledElement()) {
-        collector.addElementStyleProperties(m_state.styledElement()->presentationAttributeStyle());
+    if (m_state.element()->isStyledElement()) {
+        collector.addElementStyleProperties(m_state.element()->presentationAttributeStyle());
 
         // Now we check additional mapped declarations.
         // Tables and table cells share an additional mapped rule that must be applied
         // after all attributes, since their mapped style depends on the values of multiple attributes.
-        collector.addElementStyleProperties(m_state.styledElement()->additionalPresentationAttributeStyle());
+        collector.addElementStyleProperties(m_state.element()->additionalPresentationAttributeStyle());
 
-        if (m_state.styledElement()->isHTMLElement()) {
+        if (m_state.element()->isHTMLElement()) {
             bool isAuto;
-            TextDirection textDirection = toHTMLElement(m_state.styledElement())->directionalityIfhasDirAutoAttribute(isAuto);
+            TextDirection textDirection = toHTMLElement(m_state.element())->directionalityIfhasDirAutoAttribute(isAuto);
             if (isAuto)
                 collector.matchedResult().addMatchedProperties(textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration());
         }
@@ -531,381 +456,34 @@
     if (matchAuthorAndUserStyles)
         matchAuthorRules(collector, false);
 
-    // Now check our inline style attribute.
-    if (matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->inlineStyle()) {
-        // Inline style is immutable as long as there is no CSSOM wrapper.
-        // FIXME: Media control shadow trees seem to have problems with caching.
-        bool isInlineStyleCacheable = !m_state.styledElement()->inlineStyle()->isMutable() && !m_state.styledElement()->isInShadowTree();
-        // FIXME: Constify.
-        collector.addElementStyleProperties(m_state.styledElement()->inlineStyle(), isInlineStyleCacheable);
-    }
-
-    // Now check SMIL animation override style.
-    if (includeSMILProperties && matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->isSVGElement())
-        collector.addElementStyleProperties(toSVGElement(m_state.styledElement())->animatedSMILStyleProperties(), false /* isCacheable */);
-
-    if (m_state.styledElement() && m_state.styledElement()->hasActiveAnimations())
-        collector.matchedResult().isCacheable = false;
-}
-
-static const unsigned cStyleSearchThreshold = 10;
-static const unsigned cStyleSearchLevelThreshold = 10;
-
-static inline bool parentElementPreventsSharing(const Element* parentElement)
-{
-    if (!parentElement)
-        return false;
-    return parentElement->hasFlagsSetDuringStylingOfChildren();
-}
-
-Node* StyleResolver::locateCousinList(Element* parent, unsigned& visitedNodeCount) const
-{
-    if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold)
-        return 0;
-    if (!parent || !parent->isStyledElement())
-        return 0;
-    if (parent->hasScopedHTMLStyleChild())
-        return 0;
-    if (parent->inlineStyle())
-        return 0;
-    if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStyleProperties())
-        return 0;
-    if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyleResolution().impl()))
-        return 0;
-
-    RenderStyle* parentStyle = parent->renderStyle();
-    unsigned subcount = 0;
-    Node* thisCousin = parent;
-    Node* currentNode = parent->previousSibling();
-
-    // Reserve the tries for this level. This effectively makes sure that the algorithm
-    // will never go deeper than cStyleSearchLevelThreshold levels into recursion.
-    visitedNodeCount += cStyleSearchThreshold;
-    while (thisCousin) {
-        while (currentNode) {
-            ++subcount;
-            if (!currentNode->hasScopedHTMLStyleChild() && currentNode->renderStyle() == parentStyle && currentNode->lastChild()
-                && currentNode->isElementNode() && !parentElementPreventsSharing(toElement(currentNode))
-                && !toElement(currentNode)->shadow()
-                ) {
-                // Adjust for unused reserved tries.
-                visitedNodeCount -= cStyleSearchThreshold - subcount;
-                return currentNode->lastChild();
-            }
-            if (subcount >= cStyleSearchThreshold)
-                return 0;
-            currentNode = currentNode->previousSibling();
+    if (m_state.element()->isStyledElement()) {
+        // Now check our inline style attribute.
+        if (matchAuthorAndUserStyles && m_state.element()->inlineStyle()) {
+            // Inline style is immutable as long as there is no CSSOM wrapper.
+            // FIXME: Media control shadow trees seem to have problems with caching.
+            bool isInlineStyleCacheable = !m_state.element()->inlineStyle()->isMutable() && !m_state.element()->isInShadowTree();
+            // FIXME: Constify.
+            collector.addElementStyleProperties(m_state.element()->inlineStyle(), isInlineStyleCacheable);
         }
-        currentNode = locateCousinList(thisCousin->parentElement(), visitedNodeCount);
-        thisCousin = currentNode;
-    }
 
-    return 0;
+        // Now check SMIL animation override style.
+        if (includeSMILProperties && matchAuthorAndUserStyles && m_state.element()->isSVGElement())
+            collector.addElementStyleProperties(toSVGElement(m_state.element())->animatedSMILStyleProperties(), false /* isCacheable */);
+
+        if (m_state.element()->hasActiveAnimations())
+            collector.matchedResult().isCacheable = false;
+    }
 }
 
-bool StyleResolver::styleSharingCandidateMatchesRuleSet(RuleSet* ruleSet)
+bool StyleResolver::styleSharingCandidateMatchesRuleSet(const ElementResolveContext& context, RuleSet* ruleSet)
 {
     if (!ruleSet)
         return false;
 
-    ElementRuleCollector collector(this, m_state);
+    ElementRuleCollector collector(context, m_selectorFilter, m_state.style(), m_inspectorCSSOMWrappers);
     return collector.hasAnyMatchingRules(ruleSet);
 }
 
-bool StyleResolver::canShareStyleWithControl(Element* element) const
-{
-    const StyleResolverState& state = m_state;
-
-    if (!element->hasTagName(inputTag) || !state.element()->hasTagName(inputTag))
-        return false;
-
-    HTMLInputElement* thisInputElement = toHTMLInputElement(element);
-    HTMLInputElement* otherInputElement = toHTMLInputElement(state.element());
-    if (thisInputElement->elementData() != otherInputElement->elementData()) {
-        if (thisInputElement->fastGetAttribute(typeAttr) != otherInputElement->fastGetAttribute(typeAttr))
-            return false;
-        if (thisInputElement->fastGetAttribute(readonlyAttr) != otherInputElement->fastGetAttribute(readonlyAttr))
-            return false;
-    }
-
-    if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled())
-        return false;
-    if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked())
-        return false;
-    if (thisInputElement->shouldAppearIndeterminate() != otherInputElement->shouldAppearIndeterminate())
-        return false;
-    if (thisInputElement->isRequired() != otherInputElement->isRequired())
-        return false;
-
-    if (element->isDisabledFormControl() != state.element()->isDisabledFormControl())
-        return false;
-
-    if (element->isDefaultButtonForForm() != state.element()->isDefaultButtonForForm())
-        return false;
-
-    if (state.document()->containsValidityStyleRules()) {
-        bool willValidate = element->willValidate();
-
-        if (willValidate != state.element()->willValidate())
-            return false;
-
-        if (willValidate && (element->isValidFormControlElement() != state.element()->isValidFormControlElement()))
-            return false;
-
-        if (element->isInRange() != state.element()->isInRange())
-            return false;
-
-        if (element->isOutOfRange() != state.element()->isOutOfRange())
-            return false;
-    }
-
-    return true;
-}
-
-static inline bool elementHasDirectionAuto(Element* element)
-{
-    // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
-    return element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto();
-}
-
-bool StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(Element* sharingCandidate) const
-{
-    const StyleResolverState& state = m_state;
-    if (state.element()->elementData() == sharingCandidate->elementData())
-        return true;
-    if (state.element()->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr))
-        return false;
-    if (state.element()->fastGetAttribute(langAttr) != sharingCandidate->fastGetAttribute(langAttr))
-        return false;
-
-    if (!state.elementAffectedByClassRules()) {
-        if (sharingCandidate->hasClass() && classNamesAffectedByRules(sharingCandidate->classNames()))
-            return false;
-    } else if (sharingCandidate->hasClass()) {
-        // SVG elements require a (slow!) getAttribute comparision because "class" is an animatable attribute for SVG.
-        if (state.element()->isSVGElement()) {
-            if (state.element()->getAttribute(classAttr) != sharingCandidate->getAttribute(classAttr))
-                return false;
-        } else if (state.element()->classNames() != sharingCandidate->classNames()) {
-            return false;
-        }
-    } else {
-        return false;
-    }
-
-    if (state.styledElement()->presentationAttributeStyle() != sharingCandidate->presentationAttributeStyle())
-        return false;
-
-    if (state.element()->hasTagName(progressTag)) {
-        if (state.element()->shouldAppearIndeterminate() != sharingCandidate->shouldAppearIndeterminate())
-            return false;
-    }
-
-    return true;
-}
-
-bool StyleResolver::canShareStyleWithElement(Element* element) const
-{
-    RenderStyle* style = element->renderStyle();
-    const StyleResolverState& state = m_state;
-
-    if (!style)
-        return false;
-    if (style->unique())
-        return false;
-    if (style->hasUniquePseudoStyle())
-        return false;
-    if (element->tagQName() != state.element()->tagQName())
-        return false;
-    if (element->inlineStyle())
-        return false;
-    if (element->needsStyleRecalc())
-        return false;
-    if (element->isSVGElement() && toSVGElement(element)->animatedSMILStyleProperties())
-        return false;
-    if (element->isLink() != state.element()->isLink())
-        return false;
-    if (element->hovered() != state.element()->hovered())
-        return false;
-    if (element->active() != state.element()->active())
-        return false;
-    if (element->focused() != state.element()->focused())
-        return false;
-    if (element->shadowPseudoId() != state.element()->shadowPseudoId())
-        return false;
-    if (element == element->document()->cssTarget())
-        return false;
-    if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element))
-        return false;
-    if (element->additionalPresentationAttributeStyle() != state.styledElement()->additionalPresentationAttributeStyle())
-        return false;
-
-    if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl()))
-        return false;
-    if (element->hasScopedHTMLStyleChild())
-        return false;
-
-    // FIXME: We should share style for option and optgroup whenever possible.
-    // Before doing so, we need to resolve issues in HTMLSelectElement::recalcListItems
-    // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cgi?id=88405
-    if (element->hasTagName(optionTag) || element->hasTagName(optgroupTag))
-        return false;
-
-    bool isControl = element->isFormControlElement();
-
-    if (isControl != state.element()->isFormControlElement())
-        return false;
-
-    if (isControl && !canShareStyleWithControl(element))
-        return false;
-
-    if (style->transitions() || style->animations())
-        return false;
-
-    // Turn off style sharing for elements that can gain layers for reasons outside of the style system.
-    // See comments in RenderObject::setStyle().
-    if (element->hasTagName(iframeTag) || element->hasTagName(frameTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag) || element->hasTagName(canvasTag))
-        return false;
-
-    if (elementHasDirectionAuto(element))
-        return false;
-
-    if (element->isLink() && state.elementLinkState() != style->insideLink())
-        return false;
-
-    if (element->isUnresolvedCustomElement() != state.element()->isUnresolvedCustomElement())
-        return false;
-
-    // Deny sharing styles between WebVTT and non-WebVTT nodes.
-    if (element->isWebVTTElement() != state.element()->isWebVTTElement())
-        return false;
-
-    if (element->isWebVTTElement() && state.element()->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(state.element())->isPastNode())
-        return false;
-
-    if (FullscreenController* fullscreen = FullscreenController::fromIfExists(state.document())) {
-        if (element == fullscreen->webkitCurrentFullScreenElement() || state.element() == fullscreen->webkitCurrentFullScreenElement())
-            return false;
-    }
-
-    return true;
-}
-
-inline Element* StyleResolver::findSiblingForStyleSharing(Node* node, unsigned& count) const
-{
-    for (; node; node = node->previousSibling()) {
-        if (!node->isStyledElement())
-            continue;
-        if (canShareStyleWithElement(toElement(node)))
-            break;
-        if (count++ == cStyleSearchThreshold)
-            return 0;
-    }
-    return toElement(node);
-}
-
-RenderStyle* StyleResolver::locateSharedStyle()
-{
-    StyleResolverState& state = m_state;
-    if (!state.styledElement() || !state.parentStyle())
-        return 0;
-
-    // If the element has inline style it is probably unique.
-    if (state.styledElement()->inlineStyle())
-        return 0;
-    if (state.styledElement()->isSVGElement() && toSVGElement(state.styledElement())->animatedSMILStyleProperties())
-        return 0;
-    // Ids stop style sharing if they show up in the stylesheets.
-    if (state.styledElement()->hasID() && m_features.idsInRules.contains(state.styledElement()->idForStyleResolution().impl()))
-        return 0;
-    if (parentElementPreventsSharing(state.element()->parentElement()))
-        return 0;
-    if (state.styledElement()->hasScopedHTMLStyleChild())
-        return 0;
-    if (state.element() == state.document()->cssTarget())
-        return 0;
-    if (elementHasDirectionAuto(state.element()))
-        return 0;
-    if (state.element()->hasActiveAnimations())
-        return 0;
-    // When a dialog is first shown, its style is mutated to center it in the
-    // viewport. So the styles can't be shared since the viewport position and
-    // size may be different each time a dialog is opened.
-    if (state.element()->hasTagName(dialogTag))
-        return 0;
-
-    // Cache whether state.element is affected by any known class selectors.
-    // FIXME: This shouldn't be a member variable. The style sharing code could be factored out of StyleResolver.
-    state.setElementAffectedByClassRules(state.element() && state.element()->hasClass() && classNamesAffectedByRules(state.element()->classNames()));
-
-    // Check previous siblings and their cousins.
-    unsigned count = 0;
-    unsigned visitedNodeCount = 0;
-    Element* shareElement = 0;
-    Node* cousinList = state.styledElement()->previousSibling();
-    while (cousinList) {
-        shareElement = findSiblingForStyleSharing(cousinList, count);
-        if (shareElement)
-            break;
-        cousinList = locateCousinList(cousinList->parentElement(), visitedNodeCount);
-    }
-
-    // If we have exhausted all our budget or our cousins.
-    if (!shareElement)
-        return 0;
-
-    // Can't share if sibling rules apply. This is checked at the end as it should rarely fail.
-    if (styleSharingCandidateMatchesRuleSet(m_siblingRuleSet.get()))
-        return 0;
-    // Can't share if attribute rules apply.
-    if (styleSharingCandidateMatchesRuleSet(m_uncommonAttributeRuleSet.get()))
-        return 0;
-    // Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
-    if (parentElementPreventsSharing(state.element()->parentElement()))
-        return 0;
-    return shareElement->renderStyle();
-}
-
-static void setStylesForPaginationMode(Pagination::Mode paginationMode, RenderStyle* style)
-{
-    if (paginationMode == Pagination::Unpaginated)
-        return;
-
-    switch (paginationMode) {
-    case Pagination::LeftToRightPaginated:
-        style->setColumnAxis(HorizontalColumnAxis);
-        if (style->isHorizontalWritingMode())
-            style->setColumnProgression(style->isLeftToRightDirection() ? NormalColumnProgression : ReverseColumnProgression);
-        else
-            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? ReverseColumnProgression : NormalColumnProgression);
-        break;
-    case Pagination::RightToLeftPaginated:
-        style->setColumnAxis(HorizontalColumnAxis);
-        if (style->isHorizontalWritingMode())
-            style->setColumnProgression(style->isLeftToRightDirection() ? ReverseColumnProgression : NormalColumnProgression);
-        else
-            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? NormalColumnProgression : ReverseColumnProgression);
-        break;
-    case Pagination::TopToBottomPaginated:
-        style->setColumnAxis(VerticalColumnAxis);
-        if (style->isHorizontalWritingMode())
-            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? ReverseColumnProgression : NormalColumnProgression);
-        else
-            style->setColumnProgression(style->isLeftToRightDirection() ? NormalColumnProgression : ReverseColumnProgression);
-        break;
-    case Pagination::BottomToTopPaginated:
-        style->setColumnAxis(VerticalColumnAxis);
-        if (style->isHorizontalWritingMode())
-            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? NormalColumnProgression : ReverseColumnProgression);
-        else
-            style->setColumnProgression(style->isLeftToRightDirection() ? ReverseColumnProgression : NormalColumnProgression);
-        break;
-    case Pagination::Unpaginated:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-}
-
 static void getFontAndGlyphOrientation(const RenderStyle* style, FontOrientation& fontOrientation, NonCJKGlyphOrientation& glyphOrientation)
 {
     if (style->isHorizontalWritingMode()) {
@@ -945,21 +523,9 @@
     }
 }
 
-static float getComputedSizeFromSpecifiedSize(Document* document, RenderStyle* style, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules)
+PassRefPtr<RenderStyle> StyleResolver::styleForDocument(const Document* document, CSSFontSelector* fontSelector)
 {
-    float zoomFactor = 1.0f;
-    if (!useSVGZoomRules) {
-        zoomFactor = style->effectiveZoom();
-        if (Frame* frame = document->frame())
-            zoomFactor *= frame->textZoomFactor();
-    }
-
-    return FontSize::getComputedSizeFromSpecifiedSize(document, zoomFactor, isAbsoluteSize, specifiedSize);
-}
-
-PassRefPtr<RenderStyle> StyleResolver::styleForDocument(Document* document, CSSFontSelector* fontSelector)
-{
-    Frame* frame = document->frame();
+    const Frame* frame = document->frame();
 
     // HTML5 states that seamless iframes should replace default CSS values
     // with values inherited from the containing iframe element. However,
@@ -1004,7 +570,7 @@
         if (FrameView* frameView = frame->view()) {
             const Pagination& pagination = frameView->pagination();
             if (pagination.mode != Pagination::Unpaginated) {
-                setStylesForPaginationMode(pagination.mode, documentStyle.get());
+                Pagination::setStylesForPaginationMode(pagination.mode, documentStyle.get());
                 documentStyle->setColumnGap(pagination.gap);
                 if (RenderView* view = document->renderView()) {
                     if (view->hasColumns())
@@ -1022,7 +588,6 @@
     fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale()));
     if (Settings* settings = document->settings()) {
         fontDescription.setUsePrinterFont(document->printing());
-        fontDescription.setRenderingMode(settings->fontRenderingMode());
         const AtomicString& standardFont = settings->standardFontFamily(fontDescription.script());
         if (!standardFont.isEmpty()) {
             fontDescription.setGenericFamily(FontDescription::StandardFamily);
@@ -1049,6 +614,8 @@
     return documentStyle.release();
 }
 
+// FIXME: This is duplicated with StyleAdjuster.cpp
+// Perhaps this should move onto ElementResolveContext or even Element?
 static inline bool isAtShadowBoundary(const Element* element)
 {
     if (!element)
@@ -1057,8 +624,15 @@
     return parentNode && parentNode->isShadowRoot();
 }
 
-PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderStyle* defaultParent,
-    StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling)
+static inline void resetDirectionAndWritingModeOnDocument(Document* document)
+{
+    document->setDirectionSetOnDocumentElement(false);
+    document->setWritingModeSetOnDocumentElement(false);
+}
+
+
+PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderStyle* defaultParent, StyleSharingBehavior sharingBehavior,
+    RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling)
 {
     // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer
     // will vanish if a style recalc happens during loading.
@@ -1072,14 +646,16 @@
         return s_styleNotYetAvailable;
     }
 
+    if (element == document()->documentElement())
+        resetDirectionAndWritingModeOnDocument(document());
     StyleResolverState& state = m_state;
-    state.initForStyleResolve(document(), element, defaultParent, regionForStyling);
-    if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint()) {
-        RenderStyle* sharedStyle = locateSharedStyle();
-        if (sharedStyle) {
-            state.clear();
-            return sharedStyle;
-        }
+    StyleResolveScope resolveScope(&state, document(), element, defaultParent, regionForStyling);
+
+    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());
+        if (sharedStyle)
+            return sharedStyle.release();
     }
 
     if (state.parentStyle()) {
@@ -1116,36 +692,43 @@
         m_inspectorCSSOMWrappers.reset();
     }
 
-    ElementRuleCollector collector(this, state);
-    collector.setRegionForStyling(regionForStyling);
+    {
+        ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style(), m_inspectorCSSOMWrappers);
+        collector.setRegionForStyling(regionForStyling);
 
-    if (matchingBehavior == MatchOnlyUserAgentRules)
-        matchUARules(collector);
-    else
-        matchAllRules(collector, m_matchAuthorAndUserStyles, matchingBehavior != MatchAllRulesExcludingSMIL);
+        if (matchingBehavior == MatchOnlyUserAgentRules)
+            matchUARules(collector);
+        else
+            matchAllRules(collector, m_matchAuthorAndUserStyles, matchingBehavior != MatchAllRulesExcludingSMIL);
 
-    applyMatchedProperties(collector.matchedResult(), element);
-
-    // Clean up our style object's display and text decorations (among other fixups).
-    adjustRenderStyle(state.style(), state.parentStyle(), element);
-
-    state.clear(); // Clear out for the next resolve.
-
+        applyMatchedProperties(collector.matchedResult(), element);
+    }
+    {
+        StyleAdjuster adjuster(m_state.cachedUAStyle(), m_document->inQuirksMode());
+        adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element);
+    }
     document()->didAccessStyleResolver();
 
+    // FIXME: Shouldn't this be on RenderBody::styleDidChange?
+    if (element->hasTagName(bodyTag))
+        document()->textLinkColors().setTextColor(state.style()->visitedDependentColor(CSSPropertyColor));
+
     // Now return the style.
     return state.takeStyle();
 }
 
-PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(const RenderStyle* elementStyle, const StyleKeyframe* keyframe, KeyframeValue& keyframeValue)
+PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* e, const RenderStyle* elementStyle, const StyleKeyframe* keyframe, KeyframeValue& keyframeValue)
 {
+    if (e == document()->documentElement())
+        resetDirectionAndWritingModeOnDocument(document());
+    StyleResolveScope resolveScope(&m_state, document(), e);
+
     MatchResult result;
     if (keyframe->properties())
         result.addMatchedProperties(keyframe->properties());
 
-    ASSERT(!m_state.style());
-
     StyleResolverState& state = m_state;
+    ASSERT(!state.style());
 
     // Create the style
     state.setStyle(RenderStyle::clone(elementStyle));
@@ -1154,8 +737,11 @@
     // We don't need to bother with !important. Since there is only ever one
     // decl, there's nothing to override. So just add the first properties.
     bool inheritedOnly = false;
-    if (keyframe->properties())
+    if (keyframe->properties()) {
+        // FIXME: Can't keyframes contain variables?
+        applyMatchedProperties<AnimationProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
         applyMatchedProperties<HighPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
+    }
 
     // If our font got dirtied, go ahead and update it now.
     updateFont();
@@ -1173,7 +759,7 @@
     updateFont();
 
     // Start loading resources referenced by this style.
-    m_styleResourceLoader.loadPendingResources(m_state.style(), m_state.elementStyleResources());
+    m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources());
 
     // Add all the animating properties to the keyframe.
     if (const StylePropertySet* styleDeclaration = keyframe->properties()) {
@@ -1212,12 +798,10 @@
     const Vector<RefPtr<StyleKeyframe> >& keyframes = keyframesRule->keyframes();
     for (unsigned i = 0; i < keyframes.size(); ++i) {
         // Apply the declaration to the style. This is a simplified version of the logic in styleForElement
-        m_state.initForStyleResolve(document(), e);
-
         const StyleKeyframe* keyframe = keyframes[i].get();
 
         KeyframeValue keyframeValue(0, 0);
-        keyframeValue.setStyle(styleForKeyframe(elementStyle, keyframe, keyframeValue));
+        keyframeValue.setStyle(styleForKeyframe(e, elementStyle, keyframe, keyframeValue));
 
         // Add this keyframe style to all the indicated key times
         Vector<float> keys;
@@ -1237,7 +821,7 @@
             zeroPercentKeyframe->setKeyText("0%");
         }
         KeyframeValue keyframeValue(0, 0);
-        keyframeValue.setStyle(styleForKeyframe(elementStyle, zeroPercentKeyframe, keyframeValue));
+        keyframeValue.setStyle(styleForKeyframe(e, elementStyle, zeroPercentKeyframe, keyframeValue));
         list.insert(keyframeValue);
     }
 
@@ -1249,7 +833,7 @@
             hundredPercentKeyframe->setKeyText("100%");
         }
         KeyframeValue keyframeValue(1, 0);
-        keyframeValue.setStyle(styleForKeyframe(elementStyle, hundredPercentKeyframe, keyframeValue));
+        keyframeValue.setStyle(styleForKeyframe(e, elementStyle, hundredPercentKeyframe, keyframeValue));
         list.insert(keyframeValue);
     }
 }
@@ -1260,43 +844,49 @@
     if (!e)
         return 0;
 
+    if (e == document()->documentElement())
+        resetDirectionAndWritingModeOnDocument(document());
     StyleResolverState& state = m_state;
+    StyleResolveScope resolveScope(&state, document(), e, parentStyle);
 
-    state.initForStyleResolve(document(), e, parentStyle);
-
-    if (m_state.parentStyle()) {
+    if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) {
         state.setStyle(RenderStyle::create());
-        state.style()->inheritFrom(m_state.parentStyle());
+        state.style()->inheritFrom(state.parentStyle());
     } else {
         state.setStyle(defaultStyleForElement());
         state.setParentStyle(RenderStyle::clone(state.style()));
     }
 
-    // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
-    // those rules.
+    // Since we don't use pseudo-elements in any of our quirk/print
+    // user agent rules, don't waste time walking those rules.
 
-    // Check UA, user and author rules.
-    ElementRuleCollector collector(this, state);
-    collector.setPseudoStyleRequest(pseudoStyleRequest);
-    matchUARules(collector);
+    {
+        // Check UA, user and author rules.
+    ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style(), m_inspectorCSSOMWrappers);
+        collector.setPseudoStyleRequest(pseudoStyleRequest);
 
-    if (m_matchAuthorAndUserStyles) {
-        matchUserRules(collector, false);
-        matchAuthorRules(collector, false);
+        matchUARules(collector);
+        if (m_matchAuthorAndUserStyles) {
+            matchUserRules(collector, false);
+            matchAuthorRules(collector, false);
+        }
+
+        if (collector.matchedResult().matchedProperties.isEmpty())
+            return 0;
+
+        state.style()->setStyleType(pseudoStyleRequest.pseudoId);
+
+        applyMatchedProperties(collector.matchedResult(), e);
+    }
+    {
+        StyleAdjuster adjuster(m_state.cachedUAStyle(), m_document->inQuirksMode());
+        // FIXME: Passing 0 as the Element* introduces a lot of complexity
+        // in the adjustRenderStyle code.
+        adjuster.adjustRenderStyle(state.style(), state.parentStyle(), 0);
     }
 
-    if (collector.matchedResult().matchedProperties.isEmpty())
-        return 0;
-
-    state.style()->setStyleType(pseudoStyleRequest.pseudoId);
-
-    applyMatchedProperties(collector.matchedResult(), e);
-
-    // Clean up our style object's display and text decorations (among other fixups).
-    adjustRenderStyle(state.style(), m_state.parentStyle(), 0);
-
     // Start loading resources referenced by this style.
-    m_styleResourceLoader.loadPendingResources(m_state.style(), m_state.elementStyleResources());
+    m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources());
 
     document()->didAccessStyleResolver();
 
@@ -1306,12 +896,14 @@
 
 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex)
 {
-    m_state.initForStyleResolve(document(), document()->documentElement()); // m_rootElementStyle will be set to the document style.
+    resetDirectionAndWritingModeOnDocument(document());
+    StyleResolverState& state = m_state;
+    StyleResolveScope resolveScope(&state, document(), document()->documentElement()); // m_rootElementStyle will be set to the document style.
 
-    m_state.setStyle(RenderStyle::create());
-    m_state.style()->inheritFrom(m_state.rootElementStyle());
+    state.setStyle(RenderStyle::create());
+    state.style()->inheritFrom(state.rootElementStyle());
 
-    PageRuleCollector collector(m_state, pageIndex);
+    PageRuleCollector collector(state.elementContext(), pageIndex);
 
     collector.matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle);
     collector.matchPageRules(m_ruleSets.userStyle());
@@ -1319,7 +911,7 @@
     if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument())
         scopedResolver->matchPageRules(collector);
 
-    m_state.setLineHeightValue(0);
+    state.setLineHeightValue(0);
     bool inheritedOnly = false;
 
     MatchResult& result = collector.matchedResult();
@@ -1330,25 +922,25 @@
     updateFont();
 
     // Line-height is set when we are sure we decided on the font-size.
-    if (m_state.lineHeightValue())
-        applyProperty(CSSPropertyLineHeight, m_state.lineHeightValue());
+    if (state.lineHeightValue())
+        applyProperty(CSSPropertyLineHeight, state.lineHeightValue());
 
     applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
 
     // Start loading resources referenced by this style.
-    m_styleResourceLoader.loadPendingResources(m_state.style(), m_state.elementStyleResources());
+    m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources());
 
     document()->didAccessStyleResolver();
 
     // Now return the style.
-    return m_state.takeStyle();
+    return state.takeStyle();
 }
 
 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement()
 {
     m_state.setStyle(RenderStyle::create());
     // Make sure our fonts are initialized if we don't inherit them from our parent style.
-    if (Settings* settings = documentSettings()) {
+    if (const Settings* settings = documentSettings()) {
         initializeFontStyle(settings);
         m_state.style()->font().update(fontSelector());
     } else
@@ -1367,334 +959,6 @@
         defaultStyleForElement() : parentNode->renderStyle();
 }
 
-static void addIntrinsicMargins(RenderStyle* style)
-{
-    // Intrinsic margin value.
-    const int intrinsicMargin = 2 * style->effectiveZoom();
-
-    // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed.
-    // FIXME: Using "quirk" to decide the margin wasn't set is kind of lame.
-    if (style->width().isIntrinsicOrAuto()) {
-        if (style->marginLeft().quirk())
-            style->setMarginLeft(Length(intrinsicMargin, Fixed));
-        if (style->marginRight().quirk())
-            style->setMarginRight(Length(intrinsicMargin, Fixed));
-    }
-
-    if (style->height().isAuto()) {
-        if (style->marginTop().quirk())
-            style->setMarginTop(Length(intrinsicMargin, Fixed));
-        if (style->marginBottom().quirk())
-            style->setMarginBottom(Length(intrinsicMargin, Fixed));
-    }
-}
-
-static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool strictParsing)
-{
-    switch (display) {
-    case BLOCK:
-    case TABLE:
-    case BOX:
-    case FLEX:
-    case GRID:
-    case LAZY_BLOCK:
-        return display;
-
-    case LIST_ITEM:
-        // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk, but only in quirks mode.
-        if (!strictParsing && isFloating)
-            return BLOCK;
-        return display;
-    case INLINE_TABLE:
-        return TABLE;
-    case INLINE_BOX:
-        return BOX;
-    case INLINE_FLEX:
-        return FLEX;
-    case INLINE_GRID:
-        return GRID;
-
-    case INLINE:
-    case RUN_IN:
-    case COMPACT:
-    case INLINE_BLOCK:
-    case TABLE_ROW_GROUP:
-    case TABLE_HEADER_GROUP:
-    case TABLE_FOOTER_GROUP:
-    case TABLE_ROW:
-    case TABLE_COLUMN_GROUP:
-    case TABLE_COLUMN:
-    case TABLE_CELL:
-    case TABLE_CAPTION:
-        return BLOCK;
-    case NONE:
-        ASSERT_NOT_REACHED();
-        return NONE;
-    }
-    ASSERT_NOT_REACHED();
-    return BLOCK;
-}
-
-// CSS requires text-decoration to be reset at each DOM element for tables,
-// inline blocks, inline tables, run-ins, shadow DOM crossings, floating elements,
-// and absolute or relatively positioned elements.
-static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e)
-{
-    return style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN
-        || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)
-        || style->isFloating() || style->hasOutOfFlowPosition();
-}
-
-static bool isDisplayFlexibleBox(EDisplay display)
-{
-    return display == FLEX || display == INLINE_FLEX;
-}
-
-static bool isDisplayGridBox(EDisplay display)
-{
-    return display == GRID || display == INLINE_GRID;
-}
-
-void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
-{
-    ASSERT(parentStyle);
-
-    // Cache our original display.
-    style->setOriginalDisplay(style->display());
-
-    if (style->display() != NONE) {
-        // If we have a <td> that specifies a float property, in quirks mode we just drop the float
-        // property.
-        // Sites also commonly use display:inline/block on <td>s and <table>s. In quirks mode we force
-        // these tags to retain their display types.
-        if (document()->inQuirksMode() && e) {
-            if (e->hasTagName(tdTag)) {
-                style->setDisplay(TABLE_CELL);
-                style->setFloating(NoFloat);
-            } else if (e->hasTagName(tableTag))
-                style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
-        }
-
-        if (e && (e->hasTagName(tdTag) || e->hasTagName(thTag))) {
-            if (style->whiteSpace() == KHTML_NOWRAP) {
-                // Figure out if we are really nowrapping or if we should just
-                // use normal instead. If the width of the cell is fixed, then
-                // we don't actually use NOWRAP.
-                if (style->width().isFixed())
-                    style->setWhiteSpace(NORMAL);
-                else
-                    style->setWhiteSpace(NOWRAP);
-            }
-        }
-
-        // Tables never support the -webkit-* values for text-align and will reset back to the default.
-        if (e && e->hasTagName(tableTag) && (style->textAlign() == WEBKIT_LEFT || style->textAlign() == WEBKIT_CENTER || style->textAlign() == WEBKIT_RIGHT))
-            style->setTextAlign(TASTART);
-
-        // Frames and framesets never honor position:relative or position:absolute. This is necessary to
-        // fix a crash where a site tries to position these objects. They also never honor display.
-        if (e && (e->hasTagName(frameTag) || e->hasTagName(framesetTag))) {
-            style->setPosition(StaticPosition);
-            style->setDisplay(BLOCK);
-        }
-
-        // Ruby text does not support float or position. This might change with evolution of the specification.
-        if (e && e->hasTagName(rtTag)) {
-            style->setPosition(StaticPosition);
-            style->setFloating(NoFloat);
-        }
-
-        // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead.
-        // Table headers with a text-align of -webkit-auto will change the text-align to center.
-        if (e && e->hasTagName(thTag) && style->textAlign() == TASTART)
-            style->setTextAlign(CENTER);
-
-        if (e && e->hasTagName(legendTag))
-            style->setDisplay(BLOCK);
-
-        // Per the spec, position 'static' and 'relative' in the top layer compute to 'absolute'.
-        if (e && e->isInTopLayer() && (style->position() == StaticPosition || style->position() == RelativePosition))
-            style->setPosition(AbsolutePosition);
-
-        // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
-        if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->document()->documentElement() == e))
-            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document()->inQuirksMode()));
-
-        // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
-        // clear how that should work.
-        if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->writingMode() != parentStyle->writingMode())
-            style->setDisplay(INLINE_BLOCK);
-
-        // After performing the display mutation, check table rows. We do not honor position:relative or position:sticky on
-        // table rows or cells. This has been established for position:relative in CSS2.1 (and caused a crash in containingBlock()
-        // on some sites).
-        if ((style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW_GROUP
-            || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_ROW)
-            && style->hasInFlowPosition())
-            style->setPosition(StaticPosition);
-
-        // writing-mode does not apply to table row groups, table column groups, table rows, and table columns.
-        // FIXME: Table cells should be allowed to be perpendicular or flipped with respect to the table, though.
-        if (style->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_FOOTER_GROUP
-            || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW || style->display() == TABLE_ROW_GROUP
-            || style->display() == TABLE_CELL)
-            style->setWritingMode(parentStyle->writingMode());
-
-        // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting
-        // of block-flow to anything other than TopToBottomWritingMode.
-        // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support.
-        if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
-            style->setWritingMode(TopToBottomWritingMode);
-
-        if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentStyle->display())) {
-            style->setFloating(NoFloat);
-            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document()->inQuirksMode()));
-        }
-    }
-
-    // Make sure our z-index value is only applied if the object is positioned.
-    if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle->display()))
-        style->setHasAutoZIndex();
-
-    // Auto z-index becomes 0 for the root element and transparent objects. This prevents
-    // cases where objects that should be blended as a single unit end up with a non-transparent
-    // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
-    if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e)
-        || style->opacity() < 1.0f
-        || style->hasTransformRelatedProperty()
-        || style->hasMask()
-        || style->clipPath()
-        || style->boxReflect()
-        || style->hasFilter()
-        || style->hasBlendMode()
-        || style->position() == StickyPosition
-        || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
-        || (e && e->isInTopLayer())
-        ))
-        style->setZIndex(0);
-
-    // Textarea considers overflow visible as auto.
-    if (e && e->hasTagName(textareaTag)) {
-        style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX());
-        style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY());
-    }
-
-    // For now, <marquee> requires an overflow clip to work properly.
-    if (e && e->hasTagName(marqueeTag)) {
-        style->setOverflowX(OHIDDEN);
-        style->setOverflowY(OHIDDEN);
-    }
-
-    if (doesNotInheritTextDecoration(style, e))
-        style->setTextDecorationsInEffect(style->textDecoration());
-    else
-        style->addToTextDecorationsInEffect(style->textDecoration());
-
-    // If either overflow value is not visible, change to auto.
-    if (style->overflowX() == OVISIBLE && style->overflowY() != OVISIBLE) {
-        // FIXME: Once we implement pagination controls, overflow-x should default to hidden
-        // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it
-        // default to auto so we can at least scroll through the pages.
-        style->setOverflowX(OAUTO);
-    } else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE)
-        style->setOverflowY(OAUTO);
-
-    // Call setStylesForPaginationMode() if a pagination mode is set for any non-root elements. If these
-    // styles are specified on a root element, then they will be incorporated in
-    // StyleResolver::styleForDocument().
-    if ((style->overflowY() == OPAGEDX || style->overflowY() == OPAGEDY) && !(e && (e->hasTagName(htmlTag) || e->hasTagName(bodyTag))))
-        setStylesForPaginationMode(WebCore::paginationModeForRenderStyle(style), style);
-
-    // Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto.
-    // FIXME: Eventually table sections will support auto and scroll.
-    if (style->display() == TABLE || style->display() == INLINE_TABLE
-        || style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW) {
-        if (style->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)
-            style->setOverflowX(OVISIBLE);
-        if (style->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)
-            style->setOverflowY(OVISIBLE);
-    }
-
-    // Menulists should have visible overflow
-    if (style->appearance() == MenulistPart) {
-        style->setOverflowX(OVISIBLE);
-        style->setOverflowY(OVISIBLE);
-    }
-
-    // Cull out any useless layers and also repeat patterns into additional layers.
-    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) {
-        // Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
-        // so we have to treat all image buttons as though they were explicitly sized.
-        if (!e->hasTagName(inputTag) || !toHTMLInputElement(e)->isImageButton())
-            addIntrinsicMargins(style);
-    }
-
-    // Let the theme also have a crack at adjusting the style.
-    if (style->hasAppearance())
-        RenderTheme::defaultTheme()->adjustStyle(style, e, m_state.hasUAAppearance(), m_state.borderData(), m_state.backgroundData(), m_state.backgroundColor());
-
-    // If we have first-letter pseudo style, do not share this style.
-    if (style->hasPseudoStyle(FIRST_LETTER))
-        style->setUnique();
-
-    // FIXME: when dropping the -webkit prefix on transform-style, we should also have opacity < 1 cause flattening.
-    if (style->preserves3D() && (style->overflowX() != OVISIBLE
-        || style->overflowY() != OVISIBLE
-        || style->hasFilter()))
-        style->setTransformStyle3D(TransformStyle3DFlat);
-
-    // Seamless iframes behave like blocks. Map their display to inline-block when marked inline.
-    if (e && e->hasTagName(iframeTag) && style->display() == INLINE && static_cast<HTMLIFrameElement*>(e)->shouldDisplaySeamlessly())
-        style->setDisplay(INLINE_BLOCK);
-
-    adjustGridItemPosition(style);
-
-    if (e && e->isSVGElement()) {
-        // Spec: http://www.w3.org/TR/SVG/masking.html#OverflowProperty
-        if (style->overflowY() == OSCROLL)
-            style->setOverflowY(OHIDDEN);
-        else if (style->overflowY() == OAUTO)
-            style->setOverflowY(OVISIBLE);
-
-        if (style->overflowX() == OSCROLL)
-            style->setOverflowX(OHIDDEN);
-        else if (style->overflowX() == OAUTO)
-            style->setOverflowX(OVISIBLE);
-
-        // Only the root <svg> element in an SVG document fragment tree honors css position
-        if (!(e->hasTagName(SVGNames::svgTag) && e->parentNode() && !e->parentNode()->isSVGElement()))
-            style->setPosition(RenderStyle::initialPosition());
-
-        // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignObject content should
-        // not be scaled again.
-        if (e->hasTagName(SVGNames::foreignObjectTag))
-            style->setEffectiveZoom(RenderStyle::initialZoom());
-    }
-}
-
-void StyleResolver::adjustGridItemPosition(RenderStyle* style) const
-{
-    // If opposing grid-placement properties both specify a grid span, they both compute to ‘auto’.
-    if (style->gridColumnStart().isSpan() && style->gridColumnEnd().isSpan()) {
-        style->setGridColumnStart(GridPosition());
-        style->setGridColumnEnd(GridPosition());
-    }
-
-    if (style->gridRowStart().isSpan() && style->gridRowEnd().isSpan()) {
-        style->setGridRowStart(GridPosition());
-        style->setGridRowEnd(GridPosition());
-    }
-}
-
 bool StyleResolver::checkRegionStyle(Element* regionElement)
 {
     // FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment,
@@ -1755,9 +1019,11 @@
     if (!e || !e->document()->haveStylesheetsLoaded())
         return 0;
 
-    m_state.initForStyleResolve(document(), e, 0);
+    if (e == document()->documentElement())
+        resetDirectionAndWritingModeOnDocument(document());
+    StyleResolveScope resolveScope(&m_state, document(), e);
 
-    ElementRuleCollector collector(this, m_state);
+    ElementRuleCollector collector(m_state.elementContext(), m_selectorFilter, m_state.style(), m_inspectorCSSOMWrappers);
     collector.setMode(SelectorChecker::CollectingRules);
     collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
 
@@ -1783,19 +1049,11 @@
 // -------------------------------------------------------------------------------------
 // this is mostly boring stuff on how to apply a certain rule to the renderstyle...
 
-Length StyleResolver::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
-{
-    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined);
-}
-
-Length StyleResolver::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
-{
-    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | CalculatedConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined);
-}
-
 template <StyleResolver::StyleApplicationPass pass>
 void StyleResolver::applyAnimatedProperties(const Element* target)
 {
+    ASSERT(pass != VariableDefinitions);
+    ASSERT(pass != AnimationProperties);
     if (!target->hasActiveAnimations())
         return;
 
@@ -1806,23 +1064,13 @@
         const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
         for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
             CSSPropertyID property = iter->key;
-            // FIXME: Composite onto the underlying value.
-            RefPtr<CSSValue> value = iter->value->composite(AnimatableValue()).toCSSValue();
-            switch (pass) {
-            case VariableDefinitions:
-                ASSERT_NOT_REACHED();
+            if (!isPropertyForPass<pass>(property))
                 continue;
-            case HighPriorityProperties:
-                if (property < CSSPropertyLineHeight)
-                    applyProperty(property, value.get());
-                else if (property == CSSPropertyLineHeight)
-                    m_state.setLineHeightValue(value.get());
-                continue;
-            case LowPriorityProperties:
-                if (property > CSSPropertyLineHeight)
-                    applyProperty(property, value.get());
-                continue;
-            }
+            RefPtr<CSSValue> value = iter->value->compositeOnto(AnimatableValue::neutralValue())->toCSSValue();
+            if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
+                m_state.setLineHeightValue(value.get());
+            else
+                applyProperty(property, value.get());
         }
     }
 }
@@ -1910,6 +1158,32 @@
 }
 
 template <StyleResolver::StyleApplicationPass pass>
+bool StyleResolver::isPropertyForPass(CSSPropertyID property)
+{
+    COMPILE_ASSERT(CSSPropertyVariable < firstCSSProperty, CSS_variable_is_before_first_property);
+    const CSSPropertyID firstAnimationProperty = CSSPropertyWebkitAnimation;
+    const CSSPropertyID lastAnimationProperty = CSSPropertyTransitionTimingFunction;
+    COMPILE_ASSERT(firstCSSProperty == firstAnimationProperty, CSS_first_animation_property_should_be_first_property);
+    const CSSPropertyID firstHighPriorityProperty = CSSPropertyColor;
+    const CSSPropertyID lastHighPriorityProperty = CSSPropertyLineHeight;
+    COMPILE_ASSERT(lastAnimationProperty + 1 == firstHighPriorityProperty, CSS_color_is_first_high_priority_property);
+    COMPILE_ASSERT(CSSPropertyLineHeight == firstHighPriorityProperty + 18, CSS_line_height_is_end_of_high_prioity_property_range);
+    COMPILE_ASSERT(CSSPropertyZoom == lastHighPriorityProperty - 1, CSS_zoom_is_before_line_height);
+    switch (pass) {
+    case VariableDefinitions:
+        return property == CSSPropertyVariable;
+    case AnimationProperties:
+        return property >= firstAnimationProperty && property <= lastAnimationProperty;
+    case HighPriorityProperties:
+        return property >= firstHighPriorityProperty && property <= lastHighPriorityProperty;
+    case LowPriorityProperties:
+        return property > lastHighPriorityProperty;
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+template <StyleResolver::StyleApplicationPass pass>
 void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
 {
     ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionForStyling());
@@ -1933,29 +1207,12 @@
             continue;
         if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStyleProperty(property))
             continue;
-        switch (pass) {
-        case VariableDefinitions:
-            COMPILE_ASSERT(CSSPropertyVariable < firstCSSProperty, CSS_variable_is_before_first_property);
-            if (property == CSSPropertyVariable)
-                applyProperty(current.id(), current.value());
-            break;
-        case HighPriorityProperties:
-            COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
-            COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 17, CSS_zoom_is_end_of_first_prop_range);
-            COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
-            if (property == CSSPropertyVariable)
-                continue;
-            // give special priority to font-xxx, color properties, etc
-            if (property < CSSPropertyLineHeight)
-                applyProperty(current.id(), current.value());
-            // we apply line-height later
-            else if (property == CSSPropertyLineHeight)
-                m_state.setLineHeightValue(current.value());
-            break;
-        case LowPriorityProperties:
-            if (property > CSSPropertyLineHeight)
-                applyProperty(current.id(), current.value());
-        }
+        if (!isPropertyForPass<pass>(property))
+            continue;
+        if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
+            m_state.setLineHeightValue(current.value());
+        else
+            applyProperty(current.id(), current.value());
     }
     InspectorInstrumentation::didProcessRule(cookie);
 }
@@ -1987,77 +1244,9 @@
     }
 }
 
-static unsigned computeMatchedPropertiesHash(const StyleResolver::MatchedProperties* properties, unsigned size)
+static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties, unsigned size)
 {
-    return StringHasher::hashMemory(properties, sizeof(StyleResolver::MatchedProperties) * size);
-}
-
-bool operator==(const StyleResolver::MatchRanges& a, const StyleResolver::MatchRanges& b)
-{
-    return a.firstUARule == b.firstUARule
-        && a.lastUARule == b.lastUARule
-        && a.firstAuthorRule == b.firstAuthorRule
-        && a.lastAuthorRule == b.lastAuthorRule
-        && a.firstUserRule == b.firstUserRule
-        && a.lastUserRule == b.lastUserRule;
-}
-
-bool operator!=(const StyleResolver::MatchRanges& a, const StyleResolver::MatchRanges& b)
-{
-    return !(a == b);
-}
-
-bool operator==(const StyleResolver::MatchedProperties& a, const StyleResolver::MatchedProperties& b)
-{
-    return a.properties == b.properties && a.linkMatchType == b.linkMatchType;
-}
-
-bool operator!=(const StyleResolver::MatchedProperties& a, const StyleResolver::MatchedProperties& b)
-{
-    return !(a == b);
-}
-
-const StyleResolver::MatchedPropertiesCacheItem* StyleResolver::findFromMatchedPropertiesCache(unsigned hash, const MatchResult& matchResult)
-{
-    ASSERT(hash);
-
-    MatchedPropertiesCache::iterator it = m_matchedPropertiesCache.find(hash);
-    if (it == m_matchedPropertiesCache.end())
-        return 0;
-    MatchedPropertiesCacheItem& cacheItem = it->value;
-
-    size_t size = matchResult.matchedProperties.size();
-    if (size != cacheItem.matchedProperties.size())
-        return 0;
-    if (cacheItem.renderStyle->insideLink() != m_state.style()->insideLink())
-        return 0;
-    for (size_t i = 0; i < size; ++i) {
-        if (matchResult.matchedProperties[i] != cacheItem.matchedProperties[i])
-            return 0;
-    }
-    if (cacheItem.ranges != matchResult.ranges)
-        return 0;
-    return &cacheItem;
-}
-
-void StyleResolver::addToMatchedPropertiesCache(const RenderStyle* style, const RenderStyle* parentStyle, unsigned hash, const MatchResult& matchResult)
-{
-    static const unsigned matchedDeclarationCacheAdditionsBetweenSweeps = 100;
-    if (++m_matchedPropertiesCacheAdditionsSinceLastSweep >= matchedDeclarationCacheAdditionsBetweenSweeps
-        && !m_matchedPropertiesCacheSweepTimer.isActive()) {
-        static const unsigned matchedDeclarationCacheSweepTimeInSeconds = 60;
-        m_matchedPropertiesCacheSweepTimer.startOneShot(matchedDeclarationCacheSweepTimeInSeconds);
-    }
-
-    ASSERT(hash);
-    MatchedPropertiesCacheItem cacheItem;
-    cacheItem.matchedProperties.append(matchResult.matchedProperties);
-    cacheItem.ranges = matchResult.ranges;
-    // Note that we don't cache the original RenderStyle instance. It may be further modified.
-    // The RenderStyle in the cache is really just a holder for the substructures and never used as-is.
-    cacheItem.renderStyle = RenderStyle::clone(style);
-    cacheItem.parentRenderStyle = RenderStyle::clone(parentStyle);
-    m_matchedPropertiesCache.add(hash, cacheItem);
+    return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size);
 }
 
 void StyleResolver::invalidateMatchedPropertiesCache()
@@ -2065,42 +1254,23 @@
     m_matchedPropertiesCache.clear();
 }
 
-static bool isCacheableInMatchedPropertiesCache(const Element* element, const RenderStyle* style, const RenderStyle* parentStyle)
-{
-    // FIXME: CSSPropertyWebkitWritingMode modifies state when applying to document element. We can't skip the applying by caching.
-    if (element == element->document()->documentElement() && element->document()->writingModeSetOnDocumentElement())
-        return false;
-    if (style->unique() || (style->styleType() != NOPSEUDO && parentStyle->unique()))
-        return false;
-    if (style->hasAppearance())
-        return false;
-    if (style->zoom() != RenderStyle::initialZoom())
-        return false;
-    if (style->writingMode() != RenderStyle::initialWritingMode())
-        return false;
-    // The cache assumes static knowledge about which properties are inherited.
-    if (parentStyle->hasExplicitlyInheritedProperties())
-        return false;
-    return true;
-}
-
 void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const Element* element)
 {
     ASSERT(element);
     StyleResolverState& state = m_state;
     unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
     bool applyInheritedOnly = false;
-    const MatchedPropertiesCacheItem* cacheItem = 0;
-    if (cacheHash && (cacheItem = findFromMatchedPropertiesCache(cacheHash, matchResult))) {
+    const CachedMatchedProperties* cachedMatchedProperties = 0;
+    if (cacheHash && (cachedMatchedProperties = m_matchedPropertiesCache.find(cacheHash, m_state, matchResult))) {
         // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
         // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the
         // element context. This is fast and saves memory by reusing the style data structures.
-        state.style()->copyNonInheritedFrom(cacheItem->renderStyle.get());
-        if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(element)) {
+        state.style()->copyNonInheritedFrom(cachedMatchedProperties->renderStyle.get());
+        if (state.parentStyle()->inheritedDataShared(cachedMatchedProperties->parentRenderStyle.get()) && !isAtShadowBoundary(element)) {
             EInsideLink linkStatus = state.style()->insideLink();
             // If the cache item parent style has identical inherited properties to the current parent style then the
             // resulting style will be identical too. We copy the inherited properties over from the cache and are done.
-            state.style()->inheritFrom(cacheItem->renderStyle.get());
+            state.style()->inheritFrom(cachedMatchedProperties->renderStyle.get());
 
             // Unfortunately the link status is treated like an inherited property. We need to explicitly restore it.
             state.style()->setInsideLink(linkStatus);
@@ -2115,6 +1285,13 @@
     applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
     applyMatchedProperties<VariableDefinitions>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
 
+    // Apply animation properties in order to apply animation results and trigger transitions below.
+    applyMatchedProperties<AnimationProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
+    applyMatchedProperties<AnimationProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
+    applyMatchedProperties<AnimationProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
+    applyMatchedProperties<AnimationProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
+    // FIXME: animations should be triggered here
+
     // 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
@@ -2128,7 +1305,7 @@
     applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
     applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
 
-    if (cacheItem && cacheItem->renderStyle->effectiveZoom() != state.style()->effectiveZoom()) {
+    if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effectiveZoom() != state.style()->effectiveZoom()) {
         state.setFontDirty(true);
         applyInheritedOnly = false;
     }
@@ -2141,14 +1318,14 @@
         applyProperty(CSSPropertyLineHeight, state.lineHeightValue());
 
     // Many properties depend on the font. If it changes we just apply all properties.
-    if (cacheItem && cacheItem->renderStyle->fontDescription() != state.style()->fontDescription())
+    if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDescription() != state.style()->fontDescription())
         applyInheritedOnly = false;
 
     // Now do the normal priority UA properties.
     applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
 
-    // Cache our border and background so that we can examine them later.
-    state.cacheBorderAndBackground();
+    // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle.
+    state.cacheUserAgentBorderAndBackground();
 
     // Now do the author and user normal priority properties and all the !important properties.
     applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
@@ -2159,172 +1336,41 @@
     applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
 
     // Start loading resources referenced by this style.
-    m_styleResourceLoader.loadPendingResources(m_state.style(), m_state.elementStyleResources());
+    m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources());
 
     ASSERT(!state.fontDirty());
 
-    if (cacheItem || !cacheHash)
+    if (cachedMatchedProperties || !cacheHash)
         return;
-    if (!state.isMatchedPropertiesCacheable())
+    if (!MatchedPropertiesCache::isCacheable(state.element(), state.style(), state.parentStyle()))
         return;
-    if (!isCacheableInMatchedPropertiesCache(state.element(), state.style(), state.parentStyle()))
-        return;
-    addToMatchedPropertiesCache(state.style(), state.parentStyle(), cacheHash, matchResult);
+    m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHash, matchResult);
 }
 
-void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, RenderStyle* style)
+CSSPropertyValue::CSSPropertyValue(CSSPropertyID id, const StylePropertySet& propertySet)
+    : property(id), value(propertySet.getPropertyCSSValue(id).get())
+{ }
+
+void StyleResolver::applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count, RenderStyle* style)
 {
-    m_state.initForStyleResolve(document(), 0, style);
+    StyleResolveScope resolveScope(&m_state, document(), 0, style);
     m_state.setStyle(style);
-    applyPropertyToCurrentStyle(id, value);
-}
-
-void StyleResolver::applyPropertyToCurrentStyle(CSSPropertyID id, CSSValue* value)
-{
-    if (value)
-        applyProperty(id, value);
-}
-
-bool StyleResolver::useSVGZoomRules()
-{
-    return m_state.useSVGZoomRules();
-}
-
-static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const StyleResolverState& state, GridLength& workingLength)
-{
-    if (primitiveValue->getValueID() == CSSValueMinContent) {
-        workingLength = Length(MinContent);
-        return true;
-    }
-
-    if (primitiveValue->getValueID() == CSSValueMaxContent) {
-        workingLength = Length(MaxContent);
-        return true;
-    }
-
-    if (primitiveValue->isFlex()) {
-        // Fractional unit.
-        workingLength.setFlex(primitiveValue->getFloatValue());
-        return true;
-    }
-
-    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
-    if (workingLength.length().isUndefined())
-        return false;
-
-    if (primitiveValue->isLength())
-        workingLength.length().setQuirk(primitiveValue->isQuirkValue());
-
-    return true;
-}
-
-static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const StyleResolverState& state)
-{
-    if (!value->isPrimitiveValue())
-        return false;
-
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    Pair* minMaxTrackBreadth = primitiveValue->getPairValue();
-    if (!minMaxTrackBreadth) {
-        GridLength workingLength;
-        if (!createGridTrackBreadth(primitiveValue, state, workingLength))
-            return false;
-
-        trackSize.setLength(workingLength);
-        return true;
-    }
-
-    GridLength minTrackBreadth;
-    GridLength maxTrackBreadth;
-    if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBreadth))
-        return false;
-
-    trackSize.setMinMax(minTrackBreadth, maxTrackBreadth);
-    return true;
-}
-
-static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, NamedGridLinesMap& namedGridLines, const StyleResolverState& state)
-{
-    // Handle 'none'.
-    if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        return primitiveValue->getValueID() == CSSValueNone;
-    }
-
-    if (!value->isValueList())
-        return false;
-
-    size_t currentNamedGridLine = 0;
-    for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
-        CSSValue* currValue = i.value();
-        if (currValue->isPrimitiveValue()) {
-            CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(currValue);
-            if (primitiveValue->isString()) {
-                NamedGridLinesMap::AddResult result = namedGridLines.add(primitiveValue->getStringValue(), Vector<size_t>());
-                result.iterator->value.append(currentNamedGridLine);
-                continue;
+    for (size_t i = 0; i < count; ++i) {
+        if (properties[i].value) {
+            // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
+            // which assumes the fontMetrics are available for the affected font, otherwise a crash occurs (see http://trac.webkit.org/changeset/96122).
+            // The updateFont() call below updates the fontMetrics and ensure the proper setting of font-size and line-height.
+            switch (properties[i].property) {
+            case CSSPropertyFontSize:
+            case CSSPropertyLineHeight:
+                updateFont();
+                break;
+            default:
+                break;
             }
+            applyProperty(properties[i].property, properties[i].value);
         }
-
-        ++currentNamedGridLine;
-        GridTrackSize trackSize;
-        if (!createGridTrackSize(currValue, trackSize, state))
-            return false;
-
-        trackSizes.append(trackSize);
     }
-
-    // The parser should have rejected any <track-list> without any <track-size> as
-    // this is not conformant to the syntax.
-    ASSERT(!trackSizes.isEmpty());
-    return true;
-}
-
-
-static bool createGridPosition(CSSValue* value, GridPosition& position)
-{
-    // For now, we only accept: 'auto' | [ <integer> || <string> ] | span && <integer>?
-
-    if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        ASSERT(primitiveValue->getValueID() == CSSValueAuto);
-        return true;
-    }
-
-    CSSValueList* values = toCSSValueList(value);
-    ASSERT(values->length());
-
-    bool isSpanPosition = false;
-    // The specification makes the <integer> optional, in which case it default to '1'.
-    int gridLineNumber = 1;
-    String gridLineName;
-
-    CSSValueListIterator it = values;
-    CSSPrimitiveValue* currentValue = toCSSPrimitiveValue(it.value());
-    if (currentValue->getValueID() == CSSValueSpan) {
-        isSpanPosition = true;
-        it.advance();
-        currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
-    }
-
-    if (currentValue && currentValue->isNumber()) {
-        gridLineNumber = currentValue->getIntValue();
-        it.advance();
-        currentValue = it.hasMore() ? toCSSPrimitiveValue(it.value()) : 0;
-    }
-
-    if (currentValue && currentValue->isString()) {
-        gridLineName = currentValue->getStringValue();
-        it.advance();
-    }
-
-    ASSERT(!it.hasMore());
-    if (isSpanPosition)
-        position.setSpanPosition(gridLineNumber, gridLineName);
-    else
-        position.setExplicitPosition(gridLineNumber, gridLineName);
-
-    return true;
 }
 
 static bool hasVariableReference(CSSValue* value)
@@ -2399,6 +1445,10 @@
         return;
     }
 
+    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value) : 0;
+    if (primitiveValue && primitiveValue->getValueID() == CSSValueCurrentcolor)
+        state.style()->setHasCurrentColor();
+
     if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id))
         state.parentStyle()->setHasExplicitlyInheritedProperties();
 
@@ -2411,927 +1461,11 @@
         return;
     }
 
-    // Check lookup table for implementations and use when available.
-    const PropertyHandler& handler = m_styleBuilder.propertyHandler(id);
-    if (handler.isValid()) {
-        if (isInherit)
-            handler.applyInheritValue(id, this);
-        else if (isInitial)
-            handler.applyInitialValue(id, this);
-        else
-            handler.applyValue(id, this, value);
-        return;
-    }
-
-    // Use the new StyleBuilder.
-    if (StyleBuilder::applyProperty(id, this, value, isInitial, isInherit))
+    if (StyleBuilder::applyProperty(id, this, state, value, isInitial, isInherit))
         return;
 
-    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value) : 0;
-
-    float zoomFactor = state.style()->effectiveZoom();
-
-    // What follows is a list that maps the CSS properties into their corresponding front-end
-    // RenderStyle values.
-    switch (id) {
-    // lists
-    case CSSPropertyContent:
-        // list of string, uri, counter, attr, i
-        {
-            // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not. This
-            // note is a reminder that eventually "inherit" needs to be supported.
-
-            if (isInitial) {
-                state.style()->clearContent();
-                return;
-            }
-
-            if (!value->isValueList())
-                return;
-
-            bool didSet = false;
-            for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
-                CSSValue* item = i.value();
-                if (item->isImageGeneratorValue()) {
-                    if (item->isGradientValue())
-                        state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(m_state).get()), didSet);
-                    else
-                        state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet);
-                    didSet = true;
-                } else if (item->isImageSetValue()) {
-                    state.style()->setContent(setOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), didSet);
-                    didSet = true;
-                }
-
-                if (item->isImageValue()) {
-                    state.style()->setContent(cachedOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet);
-                    didSet = true;
-                    continue;
-                }
-
-                if (!item->isPrimitiveValue())
-                    continue;
-
-                CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
-
-                if (contentValue->isString()) {
-                    state.style()->setContent(contentValue->getStringValue().impl(), didSet);
-                    didSet = true;
-                } else if (contentValue->isAttr()) {
-                    // FIXME: Can a namespace be specified for an attr(foo)?
-                    if (state.style()->styleType() == NOPSEUDO)
-                        state.style()->setUnique();
-                    else
-                        state.parentStyle()->setUnique();
-                    QualifiedName attr(nullAtom, contentValue->getStringValue().impl(), nullAtom);
-                    const AtomicString& value = state.element()->getAttribute(attr);
-                    state.style()->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);
-                    didSet = true;
-                    // register the fact that the attribute value affects the style
-                    m_features.attrsInRules.add(attr.localName().impl());
-                } else if (contentValue->isCounter()) {
-                    Counter* counterValue = contentValue->getCounterValue();
-                    EListStyleType listStyleType = NoneListStyle;
-                    CSSValueID listStyleIdent = counterValue->listStyleIdent();
-                    if (listStyleIdent != CSSValueNone)
-                        listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc);
-                    OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(counterValue->identifier(), listStyleType, counterValue->separator()));
-                    state.style()->setContent(counter.release(), didSet);
-                    didSet = true;
-                } else {
-                    switch (contentValue->getValueID()) {
-                    case CSSValueOpenQuote:
-                        state.style()->setContent(OPEN_QUOTE, didSet);
-                        didSet = true;
-                        break;
-                    case CSSValueCloseQuote:
-                        state.style()->setContent(CLOSE_QUOTE, didSet);
-                        didSet = true;
-                        break;
-                    case CSSValueNoOpenQuote:
-                        state.style()->setContent(NO_OPEN_QUOTE, didSet);
-                        didSet = true;
-                        break;
-                    case CSSValueNoCloseQuote:
-                        state.style()->setContent(NO_CLOSE_QUOTE, didSet);
-                        didSet = true;
-                        break;
-                    default:
-                        // normal and none do not have any effect.
-                        { }
-                    }
-                }
-            }
-            if (!didSet)
-                state.style()->clearContent();
-            return;
-        }
-    case CSSPropertyQuotes:
-        if (isInherit) {
-            state.style()->setQuotes(state.parentStyle()->quotes());
-            return;
-        }
-        if (isInitial) {
-            state.style()->setQuotes(0);
-            return;
-        }
-        if (value->isValueList()) {
-            CSSValueList* list = toCSSValueList(value);
-            RefPtr<QuotesData> quotes = QuotesData::create();
-            for (size_t i = 0; i < list->length(); i += 2) {
-                CSSValue* first = list->itemWithoutBoundsCheck(i);
-                // item() returns null if out of bounds so this is safe.
-                CSSValue* second = list->item(i + 1);
-                if (!second)
-                    continue;
-                String startQuote = toCSSPrimitiveValue(first)->getStringValue();
-                String endQuote = toCSSPrimitiveValue(second)->getStringValue();
-                quotes->addPair(std::make_pair(startQuote, endQuote));
-            }
-            state.style()->setQuotes(quotes);
-            return;
-        }
-        if (primitiveValue) {
-            if (primitiveValue->getValueID() == CSSValueNone)
-                state.style()->setQuotes(QuotesData::create());
-        }
-        return;
-    // Shorthand properties.
-    case CSSPropertyFont:
-        if (isInherit) {
-            FontDescription fontDescription = state.parentStyle()->fontDescription();
-            state.style()->setLineHeight(state.parentStyle()->specifiedLineHeight());
-            state.setLineHeightValue(0);
-            setFontDescription(fontDescription);
-        } else if (isInitial) {
-            Settings* settings = documentSettings();
-            ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
-            if (!settings)
-                return;
-            initializeFontStyle(settings);
-        } else if (primitiveValue) {
-            state.style()->setLineHeight(RenderStyle::initialLineHeight());
-            state.setLineHeightValue(0);
-
-            FontDescription fontDescription;
-            RenderTheme::defaultTheme()->systemFont(primitiveValue->getValueID(), fontDescription);
-
-            // Double-check and see if the theme did anything. If not, don't bother updating the font.
-            if (fontDescription.isAbsoluteSize()) {
-                // Make sure the rendering mode and printer font settings are updated.
-                Settings* settings = documentSettings();
-                ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
-                if (!settings)
-                    return;
-                fontDescription.setRenderingMode(settings->fontRenderingMode());
-                fontDescription.setUsePrinterFont(document()->printing());
-
-                // Handle the zoom factor.
-                fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(document(), state.style(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), m_state.useSVGZoomRules()));
-                setFontDescription(fontDescription);
-            }
-        } else if (value->isFontValue()) {
-            FontValue* font = static_cast<FontValue*>(value);
-            if (!font->style || !font->variant || !font->weight
-                || !font->size || !font->lineHeight || !font->family)
-                return;
-            applyProperty(CSSPropertyFontStyle, font->style.get());
-            applyProperty(CSSPropertyFontVariant, font->variant.get());
-            applyProperty(CSSPropertyFontWeight, font->weight.get());
-            // The previous properties can dirty our font but they don't try to read the font's
-            // properties back, which is safe. However if font-size is using the 'ex' unit, it will
-            // need query the dirtied font's x-height to get the computed size. To be safe in this
-            // case, let's just update the font now.
-            updateFont();
-            applyProperty(CSSPropertyFontSize, font->size.get());
-
-            state.setLineHeightValue(font->lineHeight.get());
-
-            applyProperty(CSSPropertyFontFamily, font->family.get());
-        }
-        return;
-
-    case CSSPropertyBackground:
-    case CSSPropertyBackgroundPosition:
-    case CSSPropertyBackgroundRepeat:
-    case CSSPropertyBorder:
-    case CSSPropertyBorderBottom:
-    case CSSPropertyBorderColor:
-    case CSSPropertyBorderImage:
-    case CSSPropertyBorderLeft:
-    case CSSPropertyBorderRadius:
-    case CSSPropertyBorderRight:
-    case CSSPropertyBorderSpacing:
-    case CSSPropertyBorderStyle:
-    case CSSPropertyBorderTop:
-    case CSSPropertyBorderWidth:
-    case CSSPropertyListStyle:
-    case CSSPropertyMargin:
-    case CSSPropertyOutline:
-    case CSSPropertyOverflow:
-    case CSSPropertyPadding:
-    case CSSPropertyTransition:
-    case CSSPropertyWebkitAnimation:
-    case CSSPropertyWebkitBorderAfter:
-    case CSSPropertyWebkitBorderBefore:
-    case CSSPropertyWebkitBorderEnd:
-    case CSSPropertyWebkitBorderStart:
-    case CSSPropertyWebkitBorderRadius:
-    case CSSPropertyWebkitColumns:
-    case CSSPropertyWebkitColumnRule:
-    case CSSPropertyFlex:
-    case CSSPropertyFlexFlow:
-    case CSSPropertyGridColumn:
-    case CSSPropertyGridRow:
-    case CSSPropertyGridArea:
-    case CSSPropertyWebkitMarginCollapse:
-    case CSSPropertyWebkitMarquee:
-    case CSSPropertyWebkitMask:
-    case CSSPropertyWebkitMaskPosition:
-    case CSSPropertyWebkitMaskRepeat:
-    case CSSPropertyWebkitTextEmphasis:
-    case CSSPropertyWebkitTextStroke:
-    case CSSPropertyWebkitTransition:
-    case CSSPropertyWebkitTransformOrigin:
-        ASSERT(isExpandedShorthand(id));
-        ASSERT_NOT_REACHED();
-        break;
-
-    // CSS3 Properties
-    case CSSPropertyTextShadow:
-    case CSSPropertyBoxShadow:
-    case CSSPropertyWebkitBoxShadow: {
-        if (isInherit) {
-            if (id == CSSPropertyTextShadow)
-                return state.style()->setTextShadow(state.parentStyle()->textShadow() ? adoptPtr(new ShadowData(*state.parentStyle()->textShadow())) : nullptr);
-            return state.style()->setBoxShadow(state.parentStyle()->boxShadow() ? adoptPtr(new ShadowData(*state.parentStyle()->boxShadow())) : nullptr);
-        }
-        if (isInitial || primitiveValue) // initial | none
-            return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nullptr) : state.style()->setBoxShadow(nullptr);
-
-        if (!value->isValueList())
-            return;
-
-        for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
-            CSSValue* currValue = i.value();
-            if (!currValue->isShadowValue())
-                continue;
-            ShadowValue* item = static_cast<ShadowValue*>(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;
-            int spread = item->spread ? item->spread->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0;
-            ShadowStyle shadowStyle = item->style && item->style->getValueID() == CSSValueInset ? Inset : Normal;
-            Color color;
-            if (item->color)
-                color = m_state.resolveColorFromPrimitiveValue(item->color.get());
-            else if (state.style())
-                color = state.style()->color();
-
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, color.isValid() ? color : Color::transparent));
-            if (id == CSSPropertyTextShadow)
-                state.style()->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry
-            else
-                state.style()->setBoxShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry
-        }
-        return;
-    }
-    case CSSPropertyWebkitBoxReflect: {
-        HANDLE_INHERIT_AND_INITIAL(boxReflect, BoxReflect)
-        if (primitiveValue) {
-            state.style()->setBoxReflect(RenderStyle::initialBoxReflect());
-            return;
-        }
-
-        if (!value->isReflectValue())
-            return;
-
-        CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value);
-        RefPtr<StyleReflection> reflection = StyleReflection::create();
-        reflection->setDirection(*reflectValue->direction());
-        if (reflectValue->offset())
-            reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(state.style(), state.rootElementStyle(), zoomFactor));
-        NinePieceImage mask;
-        mask.setMaskDefaults();
-        m_styleMap.mapNinePieceImage(id, reflectValue->mask(), mask);
-        reflection->setMask(mask);
-
-        state.style()->setBoxReflect(reflection.release());
-        return;
-    }
-    case CSSPropertySrc: // Only used in @font-face rules.
-        return;
-    case CSSPropertyUnicodeRange: // Only used in @font-face rules.
-        return;
-    case CSSPropertyWebkitLocale: {
-        HANDLE_INHERIT_AND_INITIAL(locale, Locale);
-        if (!primitiveValue)
-            return;
-        if (primitiveValue->getValueID() == CSSValueAuto)
-            state.style()->setLocale(nullAtom);
-        else
-            state.style()->setLocale(primitiveValue->getStringValue());
-        FontDescription fontDescription = state.style()->fontDescription();
-        fontDescription.setScript(localeToScriptCodeForFontSelection(state.style()->locale()));
-        setFontDescription(fontDescription);
-        return;
-    }
-    case CSSPropertyWebkitAppRegion: {
-        if (!primitiveValue || !primitiveValue->getValueID())
-            return;
-        state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);
-        state.document()->setHasAnnotatedRegions(true);
-        return;
-    }
-    case CSSPropertyWebkitTextStrokeWidth: {
-        HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth)
-        float width = 0;
-        switch (primitiveValue->getValueID()) {
-        case CSSValueThin:
-        case CSSValueMedium:
-        case CSSValueThick: {
-            double result = 1.0 / 48;
-            if (primitiveValue->getValueID() == CSSValueMedium)
-                result *= 3;
-            else if (primitiveValue->getValueID() == CSSValueThick)
-                result *= 5;
-            width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
-            break;
-        }
-        default:
-            width = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
-            break;
-        }
-        state.style()->setTextStrokeWidth(width);
-        return;
-    }
-    case CSSPropertyWebkitTransform: {
-        HANDLE_INHERIT_AND_INITIAL(transform, Transform);
-        TransformOperations operations;
-        TransformBuilder::createTransformOperations(value, state.style(), state.rootElementStyle(), operations);
-        state.style()->setTransform(operations);
-        return;
-    }
-    case CSSPropertyWebkitPerspective: {
-        HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
-
-        if (!primitiveValue)
-            return;
-
-        if (primitiveValue->getValueID() == CSSValueNone) {
-            state.style()->setPerspective(0);
-            return;
-        }
-
-        float perspectiveValue;
-        if (primitiveValue->isLength())
-            perspectiveValue = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
-        else if (primitiveValue->isNumber()) {
-            // For backward compatibility, treat valueless numbers as px.
-            perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
-        } else
-            return;
-
-        if (perspectiveValue >= 0.0f)
-            state.style()->setPerspective(perspectiveValue);
-        return;
-    }
-    case CSSPropertyWebkitTapHighlightColor: {
-        HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor);
-        if (!primitiveValue)
-            break;
-
-        Color col = m_state.resolveColorFromPrimitiveValue(primitiveValue);
-        state.style()->setTapHighlightColor(col);
-        return;
-    }
-    case CSSPropertyInvalid:
-        return;
-    // Directional properties are resolved by resolveDirectionAwareProperty() before the switch.
-    case CSSPropertyWebkitBorderEndColor:
-    case CSSPropertyWebkitBorderEndStyle:
-    case CSSPropertyWebkitBorderEndWidth:
-    case CSSPropertyWebkitBorderStartColor:
-    case CSSPropertyWebkitBorderStartStyle:
-    case CSSPropertyWebkitBorderStartWidth:
-    case CSSPropertyWebkitBorderBeforeColor:
-    case CSSPropertyWebkitBorderBeforeStyle:
-    case CSSPropertyWebkitBorderBeforeWidth:
-    case CSSPropertyWebkitBorderAfterColor:
-    case CSSPropertyWebkitBorderAfterStyle:
-    case CSSPropertyWebkitBorderAfterWidth:
-    case CSSPropertyWebkitMarginEnd:
-    case CSSPropertyWebkitMarginStart:
-    case CSSPropertyWebkitMarginBefore:
-    case CSSPropertyWebkitMarginAfter:
-    case CSSPropertyWebkitMarginBeforeCollapse:
-    case CSSPropertyWebkitMarginTopCollapse:
-    case CSSPropertyWebkitMarginAfterCollapse:
-    case CSSPropertyWebkitMarginBottomCollapse:
-    case CSSPropertyWebkitPaddingEnd:
-    case CSSPropertyWebkitPaddingStart:
-    case CSSPropertyWebkitPaddingBefore:
-    case CSSPropertyWebkitPaddingAfter:
-    case CSSPropertyWebkitLogicalWidth:
-    case CSSPropertyWebkitLogicalHeight:
-    case CSSPropertyWebkitMinLogicalWidth:
-    case CSSPropertyWebkitMinLogicalHeight:
-    case CSSPropertyWebkitMaxLogicalWidth:
-    case CSSPropertyWebkitMaxLogicalHeight:
-    {
-        CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style()->direction(), state.style()->writingMode());
-        ASSERT(newId != id);
-        return applyProperty(newId, value);
-    }
-    case CSSPropertyFontStretch:
-    case CSSPropertyPage:
-    case CSSPropertyTextLineThroughColor:
-    case CSSPropertyTextLineThroughMode:
-    case CSSPropertyTextLineThroughStyle:
-    case CSSPropertyTextLineThroughWidth:
-    case CSSPropertyTextOverlineColor:
-    case CSSPropertyTextOverlineMode:
-    case CSSPropertyTextOverlineStyle:
-    case CSSPropertyTextOverlineWidth:
-    case CSSPropertyTextUnderlineColor:
-    case CSSPropertyTextUnderlineMode:
-    case CSSPropertyTextUnderlineStyle:
-    case CSSPropertyTextUnderlineWidth:
-    case CSSPropertyWebkitFontSizeDelta:
-    case CSSPropertyWebkitTextDecorationsInEffect:
-        return;
-
-    // CSS Text Layout Module Level 3: Vertical writing support
-    case CSSPropertyWebkitWritingMode: {
-        HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode);
-
-        if (primitiveValue)
-            setWritingMode(*primitiveValue);
-
-        // FIXME: It is not ok to modify document state while applying style.
-        if (state.element() && state.element() == state.document()->documentElement())
-            state.document()->setWritingModeSetOnDocumentElement(true);
-        return;
-    }
-
-    case CSSPropertyWebkitTextOrientation: {
-        HANDLE_INHERIT_AND_INITIAL(textOrientation, TextOrientation);
-
-        if (primitiveValue)
-            setTextOrientation(*primitiveValue);
-
-        return;
-    }
-
-    case CSSPropertyWebkitLineBoxContain: {
-        HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
-        if (primitiveValue && primitiveValue->getValueID() == CSSValueNone) {
-            state.style()->setLineBoxContain(LineBoxContainNone);
-            return;
-        }
-
-        if (!value->isCSSLineBoxContainValue())
-            return;
-
-        CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value);
-        state.style()->setLineBoxContain(lineBoxContainValue->value());
-        return;
-    }
-
-    // CSS Fonts Module Level 3
-    case CSSPropertyWebkitFontFeatureSettings: {
-        if (primitiveValue && primitiveValue->getValueID() == CSSValueNormal) {
-            setFontDescription(state.style()->fontDescription().makeNormalFeatureSettings());
-            return;
-        }
-
-        if (!value->isValueList())
-            return;
-
-        FontDescription fontDescription = state.style()->fontDescription();
-        CSSValueList* list = toCSSValueList(value);
-        RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
-        int len = list->length();
-        for (int i = 0; i < len; ++i) {
-            CSSValue* item = list->itemWithoutBoundsCheck(i);
-            if (!item->isFontFeatureValue())
-                continue;
-            FontFeatureValue* feature = static_cast<FontFeatureValue*>(item);
-            settings->append(FontFeature(feature->tag(), feature->value()));
-        }
-        fontDescription.setFeatureSettings(settings.release());
-        setFontDescription(fontDescription);
-        return;
-    }
-
-    case CSSPropertyWebkitFilter: {
-        HANDLE_INHERIT_AND_INITIAL(filter, Filter);
-        FilterOperations operations;
-        if (FilterOperationResolver::createFilterOperations(value, state.style(), state.rootElementStyle(), operations, m_styleResourceLoader.customFilterProgramCache(), m_state))
-            state.style()->setFilter(operations);
-        return;
-    }
-    case CSSPropertyGridAutoColumns: {
-        HANDLE_INHERIT_AND_INITIAL(gridAutoColumns, GridAutoColumns);
-        GridTrackSize trackSize;
-        if (!createGridTrackSize(value, trackSize, state))
-            return;
-        state.style()->setGridAutoColumns(trackSize);
-        return;
-    }
-    case CSSPropertyGridAutoRows: {
-        HANDLE_INHERIT_AND_INITIAL(gridAutoRows, GridAutoRows);
-        GridTrackSize trackSize;
-        if (!createGridTrackSize(value, trackSize, state))
-            return;
-        state.style()->setGridAutoRows(trackSize);
-        return;
-    }
-    case CSSPropertyGridDefinitionColumns: {
-        if (isInherit) {
-            m_state.style()->setGridDefinitionColumns(m_state.parentStyle()->gridDefinitionColumns());
-            m_state.style()->setNamedGridColumnLines(m_state.parentStyle()->namedGridColumnLines());
-            return;
-        }
-        if (isInitial) {
-            m_state.style()->setGridDefinitionColumns(RenderStyle::initialGridDefinitionColumns());
-            m_state.style()->setNamedGridColumnLines(RenderStyle::initialNamedGridColumnLines());
-            return;
-        }
-
-        Vector<GridTrackSize> trackSizes;
-        NamedGridLinesMap namedGridLines;
-        if (!createGridTrackList(value, trackSizes, namedGridLines, state))
-            return;
-        state.style()->setGridDefinitionColumns(trackSizes);
-        state.style()->setNamedGridColumnLines(namedGridLines);
-        return;
-    }
-    case CSSPropertyGridDefinitionRows: {
-        if (isInherit) {
-            m_state.style()->setGridDefinitionRows(m_state.parentStyle()->gridDefinitionRows());
-            m_state.style()->setNamedGridRowLines(m_state.parentStyle()->namedGridRowLines());
-            return;
-        }
-        if (isInitial) {
-            m_state.style()->setGridDefinitionRows(RenderStyle::initialGridDefinitionRows());
-            m_state.style()->setNamedGridRowLines(RenderStyle::initialNamedGridRowLines());
-            return;
-        }
-
-        Vector<GridTrackSize> trackSizes;
-        NamedGridLinesMap namedGridLines;
-        if (!createGridTrackList(value, trackSizes, namedGridLines, state))
-            return;
-        state.style()->setGridDefinitionRows(trackSizes);
-        state.style()->setNamedGridRowLines(namedGridLines);
-        return;
-    }
-
-    case CSSPropertyGridColumnStart: {
-        HANDLE_INHERIT_AND_INITIAL(gridColumnStart, GridColumnStart);
-        GridPosition startPosition;
-        if (!createGridPosition(value, startPosition))
-            return;
-        state.style()->setGridColumnStart(startPosition);
-        return;
-    }
-    case CSSPropertyGridColumnEnd: {
-        HANDLE_INHERIT_AND_INITIAL(gridColumnEnd, GridColumnEnd);
-        GridPosition endPosition;
-        if (!createGridPosition(value, endPosition))
-            return;
-        state.style()->setGridColumnEnd(endPosition);
-        return;
-    }
-
-    case CSSPropertyGridRowStart: {
-        HANDLE_INHERIT_AND_INITIAL(gridRowStart, GridRowStart);
-        GridPosition beforePosition;
-        if (!createGridPosition(value, beforePosition))
-            return;
-        state.style()->setGridRowStart(beforePosition);
-        return;
-    }
-    case CSSPropertyGridRowEnd: {
-        HANDLE_INHERIT_AND_INITIAL(gridRowEnd, GridRowEnd);
-        GridPosition afterPosition;
-        if (!createGridPosition(value, afterPosition))
-            return;
-        state.style()->setGridRowEnd(afterPosition);
-        return;
-    }
-
-    // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version.
-    case CSSPropertyTransitionDelay:
-    case CSSPropertyTransitionDuration:
-    case CSSPropertyTransitionProperty:
-    case CSSPropertyTransitionTimingFunction:
-        return;
-    // These properties are implemented in the DeprecatedStyleBuilder lookup table or in the new StyleBuilder.
-    case CSSPropertyBackgroundAttachment:
-    case CSSPropertyBackgroundBlendMode:
-    case CSSPropertyBackgroundClip:
-    case CSSPropertyBackgroundColor:
-    case CSSPropertyBackgroundImage:
-    case CSSPropertyBackgroundOrigin:
-    case CSSPropertyBackgroundPositionX:
-    case CSSPropertyBackgroundPositionY:
-    case CSSPropertyBackgroundRepeatX:
-    case CSSPropertyBackgroundRepeatY:
-    case CSSPropertyBackgroundSize:
-    case CSSPropertyBorderBottomColor:
-    case CSSPropertyBorderBottomLeftRadius:
-    case CSSPropertyBorderBottomRightRadius:
-    case CSSPropertyBorderBottomStyle:
-    case CSSPropertyBorderBottomWidth:
-    case CSSPropertyBorderCollapse:
-    case CSSPropertyBorderImageOutset:
-    case CSSPropertyBorderImageRepeat:
-    case CSSPropertyBorderImageSlice:
-    case CSSPropertyBorderImageSource:
-    case CSSPropertyBorderImageWidth:
-    case CSSPropertyBorderLeftColor:
-    case CSSPropertyBorderLeftStyle:
-    case CSSPropertyBorderLeftWidth:
-    case CSSPropertyBorderRightColor:
-    case CSSPropertyBorderRightStyle:
-    case CSSPropertyBorderRightWidth:
-    case CSSPropertyBorderTopColor:
-    case CSSPropertyBorderTopLeftRadius:
-    case CSSPropertyBorderTopRightRadius:
-    case CSSPropertyBorderTopStyle:
-    case CSSPropertyBorderTopWidth:
-    case CSSPropertyBottom:
-    case CSSPropertyBoxSizing:
-    case CSSPropertyCaptionSide:
-    case CSSPropertyClear:
-    case CSSPropertyClip:
-    case CSSPropertyColor:
-    case CSSPropertyCounterIncrement:
-    case CSSPropertyCounterReset:
-    case CSSPropertyCursor:
-    case CSSPropertyDirection:
-    case CSSPropertyDisplay:
-    case CSSPropertyEmptyCells:
-    case CSSPropertyFloat:
-    case CSSPropertyFontSize:
-    case CSSPropertyFontStyle:
-    case CSSPropertyFontVariant:
-    case CSSPropertyFontWeight:
-    case CSSPropertyHeight:
-    case CSSPropertyImageRendering:
-    case CSSPropertyLeft:
-    case CSSPropertyLetterSpacing:
-    case CSSPropertyLineHeight:
-    case CSSPropertyListStyleImage:
-    case CSSPropertyListStylePosition:
-    case CSSPropertyListStyleType:
-    case CSSPropertyMarginBottom:
-    case CSSPropertyMarginLeft:
-    case CSSPropertyMarginRight:
-    case CSSPropertyMarginTop:
-    case CSSPropertyMaxHeight:
-    case CSSPropertyMaxWidth:
-    case CSSPropertyMinHeight:
-    case CSSPropertyMixBlendMode:
-    case CSSPropertyMinWidth:
-    case CSSPropertyOpacity:
-    case CSSPropertyOrphans:
-    case CSSPropertyOutlineColor:
-    case CSSPropertyOutlineOffset:
-    case CSSPropertyOutlineStyle:
-    case CSSPropertyOutlineWidth:
-    case CSSPropertyOverflowWrap:
-    case CSSPropertyOverflowX:
-    case CSSPropertyOverflowY:
-    case CSSPropertyPaddingBottom:
-    case CSSPropertyPaddingLeft:
-    case CSSPropertyPaddingRight:
-    case CSSPropertyPaddingTop:
-    case CSSPropertyPageBreakAfter:
-    case CSSPropertyPageBreakBefore:
-    case CSSPropertyPageBreakInside:
-    case CSSPropertyPointerEvents:
-    case CSSPropertyPosition:
-    case CSSPropertyResize:
-    case CSSPropertyRight:
-    case CSSPropertySize:
-    case CSSPropertySpeak:
-    case CSSPropertyTabSize:
-    case CSSPropertyTableLayout:
-    case CSSPropertyTextAlign:
-    case CSSPropertyTextDecoration:
-    case CSSPropertyTextDecorationLine:
-    case CSSPropertyTextDecorationStyle:
-    case CSSPropertyTextDecorationColor:
-    case CSSPropertyTextIndent:
-    case CSSPropertyTextOverflow:
-    case CSSPropertyTextRendering:
-    case CSSPropertyTextTransform:
-    case CSSPropertyTop:
-    case CSSPropertyTouchAction:
-    case CSSPropertyUnicodeBidi:
-    case CSSPropertyVariable:
-    case CSSPropertyVerticalAlign:
-    case CSSPropertyVisibility:
-    case CSSPropertyWebkitAnimationDelay:
-    case CSSPropertyWebkitAnimationDirection:
-    case CSSPropertyWebkitAnimationDuration:
-    case CSSPropertyWebkitAnimationFillMode:
-    case CSSPropertyWebkitAnimationIterationCount:
-    case CSSPropertyWebkitAnimationName:
-    case CSSPropertyWebkitAnimationPlayState:
-    case CSSPropertyWebkitAnimationTimingFunction:
-    case CSSPropertyWebkitAppearance:
-    case CSSPropertyWebkitAspectRatio:
-    case CSSPropertyWebkitBackfaceVisibility:
-    case CSSPropertyWebkitBackgroundClip:
-    case CSSPropertyWebkitBackgroundComposite:
-    case CSSPropertyWebkitBackgroundOrigin:
-    case CSSPropertyWebkitBackgroundSize:
-    case CSSPropertyWebkitBorderFit:
-    case CSSPropertyWebkitBorderHorizontalSpacing:
-    case CSSPropertyWebkitBorderImage:
-    case CSSPropertyWebkitBorderVerticalSpacing:
-    case CSSPropertyWebkitBoxAlign:
-    case CSSPropertyWebkitBoxDecorationBreak:
-    case CSSPropertyWebkitBoxDirection:
-    case CSSPropertyWebkitBoxFlex:
-    case CSSPropertyWebkitBoxFlexGroup:
-    case CSSPropertyWebkitBoxLines:
-    case CSSPropertyWebkitBoxOrdinalGroup:
-    case CSSPropertyWebkitBoxOrient:
-    case CSSPropertyWebkitBoxPack:
-    case CSSPropertyWebkitColumnAxis:
-    case CSSPropertyWebkitColumnBreakAfter:
-    case CSSPropertyWebkitColumnBreakBefore:
-    case CSSPropertyWebkitColumnBreakInside:
-    case CSSPropertyWebkitColumnCount:
-    case CSSPropertyWebkitColumnGap:
-    case CSSPropertyWebkitColumnProgression:
-    case CSSPropertyWebkitColumnRuleColor:
-    case CSSPropertyWebkitColumnRuleStyle:
-    case CSSPropertyWebkitColumnRuleWidth:
-    case CSSPropertyWebkitColumnSpan:
-    case CSSPropertyWebkitColumnWidth:
-    case CSSPropertyAlignContent:
-    case CSSPropertyAlignItems:
-    case CSSPropertyAlignSelf:
-    case CSSPropertyFlexBasis:
-    case CSSPropertyFlexDirection:
-    case CSSPropertyFlexGrow:
-    case CSSPropertyFlexShrink:
-    case CSSPropertyFlexWrap:
-    case CSSPropertyJustifyContent:
-    case CSSPropertyOrder:
-    case CSSPropertyWebkitFlowFrom:
-    case CSSPropertyWebkitFlowInto:
-    case CSSPropertyWebkitFontKerning:
-    case CSSPropertyWebkitFontSmoothing:
-    case CSSPropertyWebkitFontVariantLigatures:
-    case CSSPropertyWebkitHighlight:
-    case CSSPropertyWebkitHyphenateCharacter:
-    case CSSPropertyWebkitHyphenateLimitAfter:
-    case CSSPropertyWebkitHyphenateLimitBefore:
-    case CSSPropertyWebkitHyphenateLimitLines:
-    case CSSPropertyWebkitHyphens:
-    case CSSPropertyWebkitLineAlign:
-    case CSSPropertyWebkitLineBreak:
-    case CSSPropertyWebkitLineClamp:
-    case CSSPropertyWebkitLineGrid:
-    case CSSPropertyWebkitLineSnap:
-    case CSSPropertyWebkitMarqueeDirection:
-    case CSSPropertyWebkitMarqueeIncrement:
-    case CSSPropertyWebkitMarqueeRepetition:
-    case CSSPropertyWebkitMarqueeSpeed:
-    case CSSPropertyWebkitMarqueeStyle:
-    case CSSPropertyWebkitMaskBoxImage:
-    case CSSPropertyWebkitMaskBoxImageOutset:
-    case CSSPropertyWebkitMaskBoxImageRepeat:
-    case CSSPropertyWebkitMaskBoxImageSlice:
-    case CSSPropertyWebkitMaskBoxImageSource:
-    case CSSPropertyWebkitMaskBoxImageWidth:
-    case CSSPropertyWebkitMaskClip:
-    case CSSPropertyWebkitMaskComposite:
-    case CSSPropertyWebkitMaskImage:
-    case CSSPropertyWebkitMaskOrigin:
-    case CSSPropertyWebkitMaskPositionX:
-    case CSSPropertyWebkitMaskPositionY:
-    case CSSPropertyWebkitMaskRepeatX:
-    case CSSPropertyWebkitMaskRepeatY:
-    case CSSPropertyWebkitMaskSize:
-    case CSSPropertyWebkitPerspectiveOrigin:
-    case CSSPropertyWebkitPerspectiveOriginX:
-    case CSSPropertyWebkitPerspectiveOriginY:
-    case CSSPropertyWebkitPrintColorAdjust:
-    case CSSPropertyWebkitRegionBreakAfter:
-    case CSSPropertyWebkitRegionBreakBefore:
-    case CSSPropertyWebkitRegionBreakInside:
-    case CSSPropertyWebkitRegionFragment:
-    case CSSPropertyWebkitRtlOrdering:
-    case CSSPropertyWebkitRubyPosition:
-    case CSSPropertyWebkitTextCombine:
-#if ENABLE(CSS3_TEXT)
-    case CSSPropertyWebkitTextAlignLast:
-    case CSSPropertyWebkitTextUnderlinePosition:
-#endif // CSS3_TEXT
-    case CSSPropertyWebkitTextEmphasisColor:
-    case CSSPropertyWebkitTextEmphasisPosition:
-    case CSSPropertyWebkitTextEmphasisStyle:
-    case CSSPropertyWebkitTextFillColor:
-    case CSSPropertyWebkitTextSecurity:
-    case CSSPropertyWebkitTextStrokeColor:
-    case CSSPropertyWebkitTransformOriginX:
-    case CSSPropertyWebkitTransformOriginY:
-    case CSSPropertyWebkitTransformOriginZ:
-    case CSSPropertyWebkitTransformStyle:
-    case CSSPropertyWebkitTransitionDelay:
-    case CSSPropertyWebkitTransitionDuration:
-    case CSSPropertyWebkitTransitionProperty:
-    case CSSPropertyWebkitTransitionTimingFunction:
-    case CSSPropertyWebkitUserDrag:
-    case CSSPropertyWebkitUserModify:
-    case CSSPropertyWebkitUserSelect:
-    case CSSPropertyWebkitClipPath:
-    case CSSPropertyWebkitWrapFlow:
-    case CSSPropertyWebkitShapeMargin:
-    case CSSPropertyWebkitShapePadding:
-    case CSSPropertyWebkitWrapThrough:
-    case CSSPropertyWebkitShapeInside:
-    case CSSPropertyWebkitShapeOutside:
-    case CSSPropertyWhiteSpace:
-    case CSSPropertyWidows:
-    case CSSPropertyWidth:
-    case CSSPropertyWordBreak:
-    case CSSPropertyWordSpacing:
-    case CSSPropertyWordWrap:
-    case CSSPropertyZIndex:
-    case CSSPropertyZoom:
-    case CSSPropertyMaxZoom:
-    case CSSPropertyMinZoom:
-    case CSSPropertyOrientation:
-    case CSSPropertyUserZoom:
-        ASSERT_NOT_REACHED();
-        return;
-    default:
-        // Try the SVG properties
-        applySVGProperty(id, value);
-        return;
-    }
-}
-
-PassRefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue* value)
-{
-    if (value->isImageValue())
-        return cachedOrPendingFromValue(property, toCSSImageValue(value));
-
-    if (value->isImageGeneratorValue()) {
-        if (value->isGradientValue())
-            return generatedOrPendingFromValue(property, static_cast<CSSGradientValue*>(value)->gradientWithStylesResolved(m_state).get());
-        return generatedOrPendingFromValue(property, static_cast<CSSImageGeneratorValue*>(value));
-    }
-
-    if (value->isImageSetValue())
-        return setOrPendingFromValue(property, static_cast<CSSImageSetValue*>(value));
-
-    if (value->isCursorImageValue())
-        return cursorOrPendingFromValue(property, static_cast<CSSCursorImageValue*>(value));
-
-    return 0;
-}
-
-PassRefPtr<StyleImage> StyleResolver::cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue* value)
-{
-    RefPtr<StyleImage> image = value->cachedOrPendingImage();
-    if (image && image->isPendingImage())
-        m_state.elementStyleResources().addPendingImageProperty(property, value);
-    return image.release();
-}
-
-PassRefPtr<StyleImage> StyleResolver::generatedOrPendingFromValue(CSSPropertyID property, CSSImageGeneratorValue* value)
-{
-    if (value->isPending()) {
-        m_state.elementStyleResources().addPendingImageProperty(property, value);
-        return StylePendingImage::create(value);
-    }
-    return StyleGeneratedImage::create(value);
-}
-
-PassRefPtr<StyleImage> StyleResolver::setOrPendingFromValue(CSSPropertyID property, CSSImageSetValue* value)
-{
-    RefPtr<StyleImage> image = value->cachedOrPendingImageSet(m_state.elementStyleResources().deviceScaleFactor());
-    if (image && image->isPendingImage())
-        m_state.elementStyleResources().addPendingImageProperty(property, value);
-    return image.release();
-}
-
-PassRefPtr<StyleImage> StyleResolver::cursorOrPendingFromValue(CSSPropertyID property, CSSCursorImageValue* value)
-{
-    RefPtr<StyleImage> image = value->cachedOrPendingImage(m_state.elementStyleResources().deviceScaleFactor());
-    if (image && image->isPendingImage())
-        m_state.elementStyleResources().addPendingImageProperty(property, value);
-    return image.release();
+    // Fall back to the old switch statement, which is now in StyleBuilderCustom.cpp
+    StyleBuilder::oldApplyProperty(id, this, state, value, isInitial, isInherit);
 }
 
 void StyleResolver::checkForZoomChange(RenderStyle* style, RenderStyle* parentStyle)
@@ -3383,11 +1517,10 @@
     style->setFontDescription(newFontDescription);
 }
 
-void StyleResolver::initializeFontStyle(Settings* settings)
+void StyleResolver::initializeFontStyle(const Settings* settings)
 {
     FontDescription fontDescription;
     fontDescription.setGenericFamily(FontDescription::StandardFamily);
-    fontDescription.setRenderingMode(settings->fontRenderingMode());
     fontDescription.setUsePrinterFont(document()->printing());
     const AtomicString& standardFontFamily = documentSettings()->standardFontFamily();
     if (!standardFontFamily.isEmpty()) {
@@ -3398,7 +1531,7 @@
     setFontSize(fontDescription, FontSize::fontSizeForKeyword(document(), CSSValueMedium, false));
     m_state.style()->setLineHeight(RenderStyle::initialLineHeight());
     m_state.setLineHeightValue(0);
-    setFontDescription(fontDescription);
+    m_state.setFontDescription(fontDescription);
 }
 
 void StyleResolver::setFontSize(FontDescription& fontDescription, float size)
@@ -3422,42 +1555,11 @@
     return false;
 }
 
-inline StyleResolver::MatchedProperties::MatchedProperties()
-    : possiblyPaddedMember(0)
-{
-}
-
-inline StyleResolver::MatchedProperties::~MatchedProperties()
-{
-}
-
-void StyleResolver::MatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-{
-    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addMember(properties, "properties");
-}
-
-void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-{
-    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addMember(matchedProperties, "matchedProperties");
-    info.addMember(ranges, "ranges");
-    info.addMember(renderStyle, "renderStyle");
-    info.addMember(parentRenderStyle, "parentRenderStyle");
-}
-
-void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-{
-    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addMember(m_expression, "expression");
-}
-
 void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(m_ruleSets, "ruleSets");
     info.addMember(m_matchedPropertiesCache, "matchedPropertiesCache");
-    info.addMember(m_matchedPropertiesCacheSweepTimer, "matchedPropertiesCacheSweepTimer");
 
     info.addMember(m_medium, "medium");
     info.addMember(m_rootDefaultStyle, "rootDefaultStyle");
@@ -3465,7 +1567,6 @@
 
     info.addMember(m_fontSelector, "fontSelector");
     info.addMember(m_viewportDependentMediaQueryResults, "viewportDependentMediaQueryResults");
-    info.ignoreMember(m_styleBuilder);
     info.addMember(m_inspectorCSSOMWrappers);
 
     info.addMember(m_styleTree, "scopedStyleTree");
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index ff1a28b..daccac4 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -27,14 +27,15 @@
 #include "core/css/CSSToStyleMap.h"
 #include "core/css/DocumentRuleSets.h"
 #include "core/css/InspectorCSSOMWrappers.h"
-#include "core/css/MediaQueryExp.h"
 #include "core/css/PseudoStyleRequest.h"
 #include "core/css/RuleFeature.h"
 #include "core/css/RuleSet.h"
 #include "core/css/SelectorChecker.h"
 #include "core/css/SelectorFilter.h"
 #include "core/css/SiblingTraversalStrategies.h"
+#include "core/css/resolver/MatchedPropertiesCache.h"
 #include "core/css/resolver/ScopedStyleResolver.h"
+#include "core/css/resolver/StyleBuilder.h"
 #include "core/css/resolver/StyleResolverState.h"
 #include "core/css/resolver/StyleResourceLoader.h"
 #include "core/css/resolver/ViewportStyleResolver.h"
@@ -59,7 +60,6 @@
 class CSSStyleSheet;
 class CSSValue;
 class ContainerNode;
-class DeprecatedStyleBuilder;
 class Document;
 class Element;
 class ElementRuleCollector;
@@ -68,6 +68,8 @@
 class KeyframeList;
 class KeyframeValue;
 class MediaQueryEvaluator;
+class MediaQueryExp;
+class MediaQueryResult;
 class Node;
 class RenderRegion;
 class RuleData;
@@ -86,19 +88,7 @@
 class StyleSheet;
 class StyleSheetList;
 
-class MediaQueryResult {
-    WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;
-public:
-    MediaQueryResult(const MediaQueryExp& expr, bool result)
-        : m_expression(expr)
-        , m_result(result)
-    {
-    }
-    void reportMemoryUsage(MemoryObjectInfo*) const;
-
-    MediaQueryExp m_expression;
-    bool m_result;
-};
+struct MatchResult;
 
 enum StyleSharingBehavior {
     AllowStyleSharing,
@@ -108,13 +98,13 @@
 // MatchOnlyUserAgentRules is used in media queries, where relative units
 // are interpreted according to the document root element style, and styled only
 // from the User Agent Stylesheet rules.
-
 enum RuleMatchingBehavior {
     MatchAllRules,
     MatchAllRulesExcludingSMIL,
     MatchOnlyUserAgentRules,
 };
 
+// FIXME: Move to separate file.
 class MatchRequest {
 public:
     MatchRequest(RuleSet* ruleSet, bool includeEmptyRules = false, const ContainerNode* scope = 0)
@@ -132,6 +122,14 @@
     const ContainerNode* scope;
 };
 
+struct CSSPropertyValue {
+    CSSPropertyValue(CSSPropertyID property, CSSValue* value)
+        : property(property), value(value) { }
+    // Stores value=propertySet.getPropertyCSSValue(id).get().
+    CSSPropertyValue(CSSPropertyID, const StylePropertySet&);
+    CSSPropertyID property;
+    CSSValue* value;
+};
 
 // This class selects a RenderStyle for a given element based on a collection of stylesheets.
 class StyleResolver {
@@ -157,18 +155,9 @@
     PassRefPtr<RenderStyle> defaultStyleForElement();
     PassRefPtr<RenderStyle> styleForText(Text*);
 
-    static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector* = 0);
+    static PassRefPtr<RenderStyle> styleForDocument(const Document*, CSSFontSelector* = 0);
 
-    Color resolveColorFromPrimitiveValue(CSSPrimitiveValue* value, bool forVisitedLink = false)
-    {
-        return m_state.resolveColorFromPrimitiveValue(value, forVisitedLink);
-    }
-    RenderStyle* style() const { return m_state.style(); }
-    RenderStyle* parentStyle() const { return m_state.parentStyle(); }
-    RenderStyle* rootElementStyle() const { return m_state.rootElementStyle(); }
-    Element* element() { return m_state.element(); }
     Document* document() { return m_document; }
-    bool hasParentNode() const { return m_state.parentNode(); }
 
     // FIXME: It could be better to call m_ruleSets.appendAuthorStyleSheets() directly after we factor StyleRsolver further.
     // https://bugs.webkit.org/show_bug.cgi?id=108890
@@ -190,14 +179,10 @@
         return m_styleTree.ensureScopedStyleResolver(scope ? scope : document());
     }
 
-private:
-    RenderStyle* locateSharedStyle();
-    bool styleSharingCandidateMatchesRuleSet(RuleSet*);
-    Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
-    Element* findSiblingForStyleSharing(Node*, unsigned& count) const;
-    bool canShareStyleWithElement(Element*) const;
+    // FIXME: Used by SharingStyleFinder, but should be removed.
+    bool styleSharingCandidateMatchesRuleSet(const ElementResolveContext&, RuleSet*);
 
-    PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&);
+    PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle*, const StyleKeyframe*, KeyframeValue&);
 
 public:
     // These methods will give back the set of rules that matched for a given element (or a pseudo-element).
@@ -213,17 +198,14 @@
     PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, unsigned rulesToInclude = AllButEmptyCSSRules);
 
 public:
-    void applyPropertyToStyle(CSSPropertyID, CSSValue*, RenderStyle*);
-
-    void applyPropertyToCurrentStyle(CSSPropertyID, CSSValue*);
+    // |properties| is an array with |count| elements.
+    void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count, RenderStyle*);
 
     void updateFont();
-    void initializeFontStyle(Settings*);
+    void initializeFontStyle(const Settings*);
     void setFontSize(FontDescription&, float size);
 
 public:
-    bool useSVGZoomRules();
-
     bool hasSelectorForId(const AtomicString&) const;
     bool hasSelectorForClass(const AtomicString&) const;
     bool hasSelectorForAttribute(const AtomicString&) const;
@@ -243,53 +225,9 @@
     bool usesFirstLineRules() const { return m_features.usesFirstLineRules; }
     bool usesBeforeAfterRules() const { return m_features.usesBeforeAfterRules; }
 
+    // FIXME: Rename to reflect the purpose, like didChangeFontSize or something.
     void invalidateMatchedPropertiesCache();
 
-    struct RuleRange {
-        RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRuleIndex), lastRuleIndex(lastRuleIndex) { }
-        int& firstRuleIndex;
-        int& lastRuleIndex;
-    };
-
-    struct MatchRanges {
-        MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1), firstUserRule(-1), lastUserRule(-1) { }
-        int firstUARule;
-        int lastUARule;
-        int firstAuthorRule;
-        int lastAuthorRule;
-        int firstUserRule;
-        int lastUserRule;
-        RuleRange UARuleRange() { return RuleRange(firstUARule, lastUARule); }
-        RuleRange authorRuleRange() { return RuleRange(firstAuthorRule, lastAuthorRule); }
-        RuleRange userRuleRange() { return RuleRange(firstUserRule, lastUserRule); }
-    };
-
-    struct MatchedProperties {
-        MatchedProperties();
-        ~MatchedProperties();
-        void reportMemoryUsage(MemoryObjectInfo*) const;
-
-        RefPtr<StylePropertySet> properties;
-        union {
-            struct {
-                unsigned linkMatchType : 2;
-                unsigned whitelistType : 2;
-            };
-            // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object.
-            void* possiblyPaddedMember;
-        };
-    };
-
-    struct MatchResult {
-        MatchResult() : isCacheable(true) { }
-        Vector<MatchedProperties, 64> matchedProperties;
-        Vector<StyleRule*, 64> matchedRules;
-        MatchRanges ranges;
-        bool isCacheable;
-
-        void addMatchedProperties(const StylePropertySet* properties, StyleRule* = 0, unsigned linkMatchType = SelectorChecker::MatchAll, PropertyWhitelistType = PropertyWhitelistNone);
-    };
-
 private:
     void matchUARules(ElementRuleCollector&, RuleSet*);
     void matchAuthorRules(ElementRuleCollector&, bool includeEmptyRules);
@@ -306,18 +244,18 @@
     void checkForGenericFamilyChange(RenderStyle*, RenderStyle* parentStyle);
     void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle);
 
-    void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*);
-    void adjustGridItemPosition(RenderStyle* styleToAdjust) const;
-
     bool fastRejectSelector(const RuleData&) const;
 
     void applyMatchedProperties(const MatchResult&, const Element*);
 
     enum StyleApplicationPass {
         VariableDefinitions,
+        AnimationProperties,
         HighPriorityProperties,
         LowPriorityProperties
     };
+    template <StyleResolver::StyleApplicationPass pass>
+    static inline bool isPropertyForPass(CSSPropertyID);
     template <StyleApplicationPass pass>
     void applyMatchedProperties(const MatchResult&, bool important, int startIndex, int endIndex, bool inheritedOnly);
     template <StyleApplicationPass pass>
@@ -342,27 +280,7 @@
 public:
     static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; }
 
-    PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*);
-    PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
-    PassRefPtr<StyleImage> generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue*);
-    PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue*);
-    PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*);
-
-    bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle(); }
-    bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle(); }
-
-    static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
-    static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
-
-    CSSToStyleMap* styleMap() { return &m_styleMap; }
     InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
-    const FontDescription& fontDescription() { return m_state.fontDescription(); }
-    const FontDescription& parentFontDescription() { return m_state.parentFontDescription(); }
-    void setFontDescription(const FontDescription& fontDescription) { m_state.setFontDescription(fontDescription); }
-    void setZoom(float f) { m_state.setZoom(f); }
-    void setEffectiveZoom(float f) { m_state.setEffectiveZoom(f); }
-    void setWritingMode(WritingMode writingMode) { m_state.setWritingMode(writingMode); }
-    void setTextOrientation(TextOrientation textOrientation) { m_state.setTextOrientation(textOrientation); }
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
@@ -372,36 +290,10 @@
     void cacheBorderAndBackground();
 
 private:
-    bool canShareStyleWithControl(Element*) const;
-
     void applyProperty(CSSPropertyID, CSSValue*);
 
-    void applySVGProperty(CSSPropertyID, CSSValue*);
-
-    struct MatchedPropertiesCacheItem {
-        void reportMemoryUsage(MemoryObjectInfo*) const;
-        Vector<MatchedProperties> matchedProperties;
-        MatchRanges ranges;
-        RefPtr<RenderStyle> renderStyle;
-        RefPtr<RenderStyle> parentRenderStyle;
-    };
-    const MatchedPropertiesCacheItem* findFromMatchedPropertiesCache(unsigned hash, const MatchResult&);
-    void addToMatchedPropertiesCache(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash, const MatchResult&);
-
-    // Every N additions to the matched declaration cache trigger a sweep where entries holding
-    // the last reference to a style declaration are garbage collected.
-    void sweepMatchedPropertiesCache(Timer<StyleResolver>*);
-
-    bool classNamesAffectedByRules(const SpaceSplitString&) const;
-    bool sharingCandidateHasIdenticalStyleAffectingAttributes(Element*) const;
-
-    unsigned m_matchedPropertiesCacheAdditionsSinceLastSweep;
-
-    typedef HashMap<unsigned, MatchedPropertiesCacheItem> MatchedPropertiesCache;
     MatchedPropertiesCache m_matchedPropertiesCache;
 
-    Timer<StyleResolver> m_matchedPropertiesCacheSweepTimer;
-
     OwnPtr<MediaQueryEvaluator> m_medium;
     RefPtr<RenderStyle> m_rootDefaultStyle;
 
@@ -415,24 +307,19 @@
 
     RefPtr<ViewportStyleResolver> m_viewportStyleResolver;
 
-    const DeprecatedStyleBuilder& m_styleBuilder;
     ScopedStyleTree m_styleTree;
 
     RuleFeatureSet m_features;
     OwnPtr<RuleSet> m_siblingRuleSet;
     OwnPtr<RuleSet> m_uncommonAttributeRuleSet;
 
-    CSSToStyleMap m_styleMap;
     InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
 
     StyleResolverState m_state;
     StyleResourceLoader m_styleResourceLoader;
 
-    friend class DeprecatedStyleBuilder;
-    friend bool operator==(const MatchedProperties&, const MatchedProperties&);
-    friend bool operator!=(const MatchedProperties&, const MatchedProperties&);
-    friend bool operator==(const MatchRanges&, const MatchRanges&);
-    friend bool operator!=(const MatchRanges&, const MatchRanges&);
+    friend void StyleBuilder::oldApplyProperty(CSSPropertyID, StyleResolver*, StyleResolverState&, CSSValue*, bool isInitial, bool isInherit);
+
 };
 
 inline bool StyleResolver::hasSelectorForAttribute(const AtomicString &attributeName) const
diff --git a/Source/core/css/resolver/StyleResolverState.cpp b/Source/core/css/resolver/StyleResolverState.cpp
index a355f8e..0283d74 100644
--- a/Source/core/css/resolver/StyleResolverState.cpp
+++ b/Source/core/css/resolver/StyleResolverState.cpp
@@ -28,138 +28,73 @@
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/VisitedLinkState.h"
 #include "core/page/Page.h"
-#include "core/rendering/RenderTheme.h"
 
 namespace WebCore {
 
-void StyleResolverState::cacheBorderAndBackground()
+ElementResolveContext::ElementResolveContext(Element* element)
+    : m_element(element)
+    , m_elementLinkState(element ? element->document()->visitedLinkState()->determineLinkState(element) : NotInsideLink)
+    , m_distributedToInsertionPoint(false)
+    , m_resetStyleInheritance(false)
 {
-    m_hasUAAppearance = m_style->hasAppearance();
-    if (m_hasUAAppearance) {
-        m_borderData = m_style->border();
-        m_backgroundData = *m_style->backgroundLayers();
-        m_backgroundColor = m_style->backgroundColor();
-    }
+    NodeRenderingContext context(element);
+    m_parentNode = context.parentNodeForRenderingAndStyle();
+    m_distributedToInsertionPoint = context.insertionPoint();
+    m_resetStyleInheritance = context.resetStyleInheritance();
+
+    Node* documentElement = document()->documentElement();
+    RenderStyle* documentStyle = document()->renderStyle();
+    m_rootElementStyle = documentElement && element != documentElement ? documentElement->renderStyle() : documentStyle;
+}
+
+StyleResolveScope::StyleResolveScope(StyleResolverState* state, const Document* document, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling)
+    : m_state(state)
+{
+    m_state->initForStyleResolve(document, e, parentStyle, regionForStyling);
+}
+
+StyleResolveScope::~StyleResolveScope()
+{
+    m_state->clear();
 }
 
 void StyleResolverState::clear()
 {
-    m_element = 0;
-    m_styledElement = 0;
+    m_elementContext = ElementResolveContext();
+    m_style = 0;
     m_parentStyle = 0;
-    m_parentNode = 0;
     m_regionForStyling = 0;
     m_elementStyleResources.clear();
 }
 
-void StyleResolverState::initElement(Element* element)
+void StyleResolverState::initForStyleResolve(const Document* newDocument, Element* newElement, RenderStyle* parentStyle, RenderRegion* regionForStyling)
 {
-    if (m_element == element)
-        return;
-
-    m_element = element;
-    m_styledElement = element && element->isStyledElement() ? element : 0;
-    m_elementLinkState = element ? element->document()->visitedLinkState()->determineLinkState(element) : NotInsideLink;
-
-    if (!element || element != element->document()->documentElement())
-        return;
-
-    element->document()->setDirectionSetOnDocumentElement(false);
-    element->document()->setWritingModeSetOnDocumentElement(false);
-}
-
-void StyleResolverState::initForStyleResolve(Document* document, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling)
-{
-    initElement(e);
+    ASSERT(!element() || document() == newDocument);
+    if (newElement)
+        m_elementContext = ElementResolveContext(newElement);
+    else
+        m_elementContext = ElementResolveContext();
 
     m_regionForStyling = regionForStyling;
 
-    if (e) {
-        NodeRenderingContext context(e);
-        m_parentNode = context.parentNodeForRenderingAndStyle();
-        m_parentStyle = context.resetStyleInheritance() ? 0 :
-            parentStyle ? parentStyle :
-            m_parentNode ? m_parentNode->renderStyle() : 0;
-        m_distributedToInsertionPoint = context.insertionPoint();
-    } else {
-        m_parentNode = 0;
+    if (m_elementContext.resetStyleInheritance())
+        m_parentStyle = 0;
+    else if (parentStyle)
         m_parentStyle = parentStyle;
-        m_distributedToInsertionPoint = false;
-    }
-
-    Node* docElement = e ? e->document()->documentElement() : 0;
-    RenderStyle* docStyle = document->renderStyle();
-    m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle;
+    else if (m_elementContext.parentNode())
+        m_parentStyle = m_elementContext.parentNode()->renderStyle();
+    else
+        m_parentStyle = 0;
 
     m_style = 0;
     m_elementStyleResources.clear();
     m_fontDirty = false;
 
-    if (Page* page = document->page())
+    // FIXME: StyleResolverState is never passed between documents
+    // so we should be able to do this initialization at StyleResolverState
+    // createion time instead of now, correct?
+    if (Page* page = newDocument->page())
         m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor());
 }
 
-
-static Color colorForCSSValue(CSSValueID cssValueId)
-{
-    struct ColorValue {
-        CSSValueID cssValueId;
-        RGBA32 color;
-    };
-
-    static const ColorValue colorValues[] = {
-        { CSSValueAqua, 0xFF00FFFF },
-        { CSSValueBlack, 0xFF000000 },
-        { CSSValueBlue, 0xFF0000FF },
-        { CSSValueFuchsia, 0xFFFF00FF },
-        { CSSValueGray, 0xFF808080 },
-        { CSSValueGreen, 0xFF008000  },
-        { CSSValueGrey, 0xFF808080 },
-        { CSSValueLime, 0xFF00FF00 },
-        { CSSValueMaroon, 0xFF800000 },
-        { CSSValueNavy, 0xFF000080 },
-        { CSSValueOlive, 0xFF808000  },
-        { CSSValueOrange, 0xFFFFA500 },
-        { CSSValuePurple, 0xFF800080 },
-        { CSSValueRed, 0xFFFF0000 },
-        { CSSValueSilver, 0xFFC0C0C0 },
-        { CSSValueTeal, 0xFF008080  },
-        { CSSValueTransparent, 0x00000000 },
-        { CSSValueWhite, 0xFFFFFFFF },
-        { CSSValueYellow, 0xFFFFFF00 },
-        { CSSValueInvalid, CSSValueInvalid }
-    };
-
-    for (const ColorValue* col = colorValues; col->cssValueId; ++col) {
-        if (col->cssValueId == cssValueId)
-            return col->color;
-    }
-    return RenderTheme::defaultTheme()->systemColor(cssValueId);
-}
-
-Color StyleResolverState::resolveColorFromPrimitiveValue(CSSPrimitiveValue* value, bool forVisitedLink)
-{
-    if (value->isRGBColor())
-        return Color(value->getRGBA32Value());
-
-    CSSValueID valueID = value->getValueID();
-    switch (valueID) {
-    case 0:
-        return Color();
-    case CSSValueWebkitText:
-        return document()->textColor();
-    case CSSValueWebkitLink:
-        return (element()->isLink() && forVisitedLink) ? document()->visitedLinkColor() : document()->linkColor();
-    case CSSValueWebkitActivelink:
-        return document()->activeLinkColor();
-    case CSSValueWebkitFocusRingColor:
-        return RenderTheme::focusRingColor();
-    case CSSValueCurrentcolor:
-        m_isMatchedPropertiesCacheable = false;
-        return style()->color();
-    default:
-        return colorForCSSValue(valueID);
-    }
-}
-
 } // namespace WebCore
diff --git a/Source/core/css/resolver/StyleResolverState.h b/Source/core/css/resolver/StyleResolverState.h
index c181b57..4f91eb1 100644
--- a/Source/core/css/resolver/StyleResolverState.h
+++ b/Source/core/css/resolver/StyleResolverState.h
@@ -25,85 +25,127 @@
 #include "CSSPropertyNames.h"
 
 #include "core/css/CSSSVGDocumentValue.h"
+#include "core/css/CSSToStyleMap.h"
 #include "core/css/resolver/ElementStyleResources.h"
 #include "core/dom/Element.h"
 #include "core/platform/graphics/Color.h"
-#include "core/rendering/style/BorderData.h"
-#include "core/rendering/style/FillLayer.h"
+#include "core/rendering/style/CachedUAStyle.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/style/StyleInheritedData.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
 
-class FillLayer;
 class FontDescription;
 class RenderRegion;
 
+// ElementResolveContext is immutable and serves as an input to the style resolve process.
+class ElementResolveContext {
+public:
+    ElementResolveContext()
+        : m_element(0)
+        , m_parentNode(0)
+        , m_rootElementStyle(0)
+        , m_elementLinkState(NotInsideLink)
+        , m_distributedToInsertionPoint(false)
+        , m_resetStyleInheritance(false)
+    {
+    }
+
+    explicit ElementResolveContext(Element*);
+
+    Document* document() const { return m_element->document(); }
+    bool isDocumentElement() const { return m_element && m_element == m_element->document()->documentElement(); }
+
+    Element* element() const { return m_element; }
+    const ContainerNode* parentNode() const { return m_parentNode; }
+    RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
+    EInsideLink elementLinkState() const { return m_elementLinkState; }
+    bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; }
+    bool resetStyleInheritance() const { return m_resetStyleInheritance; }
+
+private:
+    Element* m_element;
+    ContainerNode* m_parentNode;
+    RenderStyle* m_rootElementStyle;
+    EInsideLink m_elementLinkState;
+    bool m_distributedToInsertionPoint;
+    bool m_resetStyleInheritance;
+};
+
+// Initializes a StyleResolverState within a scope.
+class StyleResolveScope {
+public:
+    StyleResolveScope(StyleResolverState*, const Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
+    ~StyleResolveScope();
+private:
+    StyleResolverState* m_state;
+};
+
 class StyleResolverState {
 WTF_MAKE_NONCOPYABLE(StyleResolverState);
 public:
     StyleResolverState()
-    : m_element(0)
-    , m_styledElement(0)
-    , m_parentNode(0)
-    , m_parentStyle(0)
-    , m_rootElementStyle(0)
-    , m_regionForStyling(0)
-    , m_elementLinkState(NotInsideLink)
-    , m_distributedToInsertionPoint(false)
-    , m_elementAffectedByClassRules(false)
+    : m_regionForStyling(0)
     , m_applyPropertyToRegularStyle(true)
     , m_applyPropertyToVisitedLinkStyle(false)
-    , m_isMatchedPropertiesCacheable(true)
     , m_lineHeightValue(0)
     , m_fontDirty(false)
-    , m_hasUAAppearance(false)
-    , m_backgroundData(BackgroundFillLayer) { }
+    , m_styleMap(*this, m_elementStyleResources)
+    { }
 
-public:
-    void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
-    void clear();
+    // These are all just pass-through methods to ElementResolveContext.
+    Document* document() const { return m_elementContext.document(); }
+    Element* element() const { return m_elementContext.element(); }
+    const ContainerNode* parentNode() const { return m_elementContext.parentNode(); }
+    RenderStyle* rootElementStyle() const { return m_elementContext.rootElementStyle(); }
+    EInsideLink elementLinkState() const { return m_elementContext.elementLinkState(); }
+    bool distributedToInsertionPoint() const { return m_elementContext.distributedToInsertionPoint(); }
 
-    // This method might change an internal state, i.e. m_isMatchedPropertiesCachable.
-    Color resolveColorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = false);
+    const ElementResolveContext& elementContext() const { return m_elementContext; }
 
-    Document* document() const { return m_element->document(); }
-    Element* element() const { return m_element; }
-    Element* styledElement() const { return m_styledElement; }
     void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
     RenderStyle* style() const { return m_style.get(); }
     PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); }
 
-    const ContainerNode* parentNode() const { return m_parentNode; }
     void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = parentStyle; }
     RenderStyle* parentStyle() const { return m_parentStyle.get(); }
-    RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
 
     const RenderRegion* regionForStyling() const { return m_regionForStyling; }
-    EInsideLink elementLinkState() const { return m_elementLinkState; }
-    bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; }
-    void setElementAffectedByClassRules(bool isAffected) { m_elementAffectedByClassRules = isAffected; }
-    bool elementAffectedByClassRules() const { return m_elementAffectedByClassRules; }
 
+    // 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).
+    // We need to move this data off of StyleResolverState and closer to the
+    // objects it applies to. Possibly separating (immutable) inputs from (mutable) outputs.
     void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegularStyle = isApply; }
     void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVisitedLinkStyle = isApply; }
     bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
     bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
-    bool isMatchedPropertiesCacheable() const { return m_isMatchedPropertiesCacheable; }
 
     void setLineHeightValue(CSSValue* value) { m_lineHeightValue = value; }
     CSSValue* lineHeightValue() { return m_lineHeightValue; }
-    void setFontDirty(bool isDirty) { m_fontDirty = isDirty; }
-    bool fontDirty() const { return m_fontDirty; }
 
-    void cacheBorderAndBackground();
-    bool hasUAAppearance() const { return m_hasUAAppearance; }
-    BorderData borderData() const { return m_borderData; }
-    FillLayer backgroundData() const { return m_backgroundData; }
-    Color backgroundColor() const { return m_backgroundColor; }
+    void cacheUserAgentBorderAndBackground() { m_cachedUAStyle = CachedUAStyle(style()); }
+    const CachedUAStyle& cachedUAStyle() const { return m_cachedUAStyle; }
+
     ElementStyleResources& elementStyleResources() { return m_elementStyleResources; }
+    const CSSToStyleMap& styleMap() const { return m_styleMap; }
+    CSSToStyleMap& styleMap() { return m_styleMap; }
 
+    // FIXME: Once styleImage can be made to not take a StyleResolverState
+    // this convenience function should be removed. As-is, without this, call
+    // sites are extremely verbose.
+    PassRefPtr<StyleImage> styleImage(CSSPropertyID propertyId, CSSValue* value)
+    {
+        return m_elementStyleResources.styleImage(document()->textLinkColors(), style()->visitedDependentColor(CSSPropertyColor), propertyId, value);
+    }
+
+    // FIXME: These exist as a primitive way to track mutations to font-related properties
+    // on a RenderStyle. As designed, these are very error-prone, as some callers
+    // set these directly on the RenderStyle w/o telling us. Presumably we'll
+    // want to design a better wrapper around RenderStyle for tracking these mutations
+    // and separate it from StyleResolverState.
     const FontDescription& fontDescription() { return m_style->fontDescription(); }
     const FontDescription& parentFontDescription() { return m_parentStyle->fontDescription(); }
     void setFontDescription(const FontDescription& fontDescription) { m_fontDirty |= m_style->setFontDescription(fontDescription); }
@@ -111,6 +153,8 @@
     void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f); }
     void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWritingMode(writingMode); }
     void setTextOrientation(TextOrientation textOrientation) { m_fontDirty |= m_style->setTextOrientation(textOrientation); }
+    void setFontDirty(bool isDirty) { m_fontDirty = isDirty; }
+    bool fontDirty() const { return m_fontDirty; }
 
     // SVG handles zooming in a different way compared to CSS. The whole document is scaled instead
     // of each individual length value in the render style / tree. CSSPrimitiveValue::computeLength*()
@@ -120,39 +164,48 @@
     // width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale,
     // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific
     // properties that are NOT allowed to scale within a zoomed SVG document (letter/word-spacing/font-size).
-    bool useSVGZoomRules() const { return m_element && m_element->isSVGElement(); }
+    bool useSVGZoomRules() const { return element() && element()->isSVGElement(); }
 
 private:
+    friend class StyleResolveScope;
+
+    void initForStyleResolve(const Document*, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
+    void clear();
+
     void initElement(Element*);
 
-    Element* m_element;
+    ElementResolveContext m_elementContext;
+
+    // m_style is the primary output for each element's style resolve.
     RefPtr<RenderStyle> m_style;
-    Element* m_styledElement;
-    ContainerNode* m_parentNode;
+
+    // m_parentStyle is not always just element->parentNode()->style()
+    // so we keep it separate from m_elementContext.
     RefPtr<RenderStyle> m_parentStyle;
-    RenderStyle* m_rootElementStyle;
 
     // Required to ASSERT in applyProperties.
+    // FIXME: Regions should not need special state on StyleResolverState
+    // no other @rule does.
     RenderRegion* m_regionForStyling;
 
-    EInsideLink m_elementLinkState;
-
-    bool m_distributedToInsertionPoint;
-
-    bool m_elementAffectedByClassRules;
-
     bool m_applyPropertyToRegularStyle;
     bool m_applyPropertyToVisitedLinkStyle;
-    bool m_isMatchedPropertiesCacheable;
 
     CSSValue* m_lineHeightValue;
+
+    // StyleResolver is responsbile for creating the Font()
+    // object on RenderStyle from various other font-related
+    // properties on RenderStyle. Whenever one of those
+    // is changed, StyleResolver tracks the need to update
+    // style->font() with this bool.
     bool m_fontDirty;
 
-    bool m_hasUAAppearance;
-    BorderData m_borderData;
-    FillLayer m_backgroundData;
-    Color m_backgroundColor;
+    CachedUAStyle m_cachedUAStyle;
+
     ElementStyleResources m_elementStyleResources;
+    // CSSToStyleMap is a pure-logic class and only contains
+    // a back-pointer to this object.
+    CSSToStyleMap m_styleMap;
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
index cc22bcf..539cb0e 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -116,18 +116,16 @@
         return primitiveValue->getFloatValue();
 
     if (primitiveValue->isFontRelativeLength())
-        return primitiveValue->getFloatValue() * m_document->documentElement()->renderStyle()->fontDescription().computedSize();
+        return primitiveValue->getFloatValue() * m_document->renderStyle()->fontDescription().computedSize();
 
     if (primitiveValue->isPercentage()) {
         float percentValue = primitiveValue->getFloatValue() / 100.0f;
         switch (id) {
         case CSSPropertyMaxHeight:
         case CSSPropertyMinHeight:
-            ASSERT(m_document->initialViewportSize().height() > 0);
             return percentValue * m_document->initialViewportSize().height();
         case CSSPropertyMaxWidth:
         case CSSPropertyMinWidth:
-            ASSERT(m_document->initialViewportSize().width() > 0);
             return percentValue * m_document->initialViewportSize().width();
         case CSSPropertyMaxZoom:
         case CSSPropertyMinZoom:
diff --git a/Source/core/css/themeChromiumLinux.css b/Source/core/css/themeChromiumLinux.css
index 7d15d64..f41a476 100644
--- a/Source/core/css/themeChromiumLinux.css
+++ b/Source/core/css/themeChromiumLinux.css
@@ -37,6 +37,10 @@
     background-color: ButtonFace;
 }
 
+select:disabled option:checked, option:disabled:checked {
+    color: GrayText;
+}
+
 input[type=range] {
     color: #9d968E;
 }
diff --git a/Source/core/dom/ActiveDOMObject.h b/Source/core/dom/ActiveDOMObject.h
index bfb47db..f047cea 100644
--- a/Source/core/dom/ActiveDOMObject.h
+++ b/Source/core/dom/ActiveDOMObject.h
@@ -28,8 +28,8 @@
 #define ActiveDOMObject_h
 
 #include "core/dom/ContextLifecycleObserver.h"
-#include <wtf/Assertions.h>
-#include <wtf/Forward.h>
+#include "wtf/Assertions.h"
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 2d56cb2..70afc51 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -98,7 +98,7 @@
 
     if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI)
         || static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return;
     }
 
@@ -135,9 +135,9 @@
         m_element->didModifyAttribute(qualifiedName(), value);
 }
 
-void Attr::setNodeValue(const String& v, ExceptionCode& ec)
+void Attr::setNodeValue(const String& v)
 {
-    setValue(v, ec);
+    setValue(v, IGNORE_EXCEPTION);
 }
 
 PassRefPtr<Node> Attr::cloneNode(bool /*deep*/)
diff --git a/Source/core/dom/Attr.h b/Source/core/dom/Attr.h
index 5f6004e..82a7e13 100644
--- a/Source/core/dom/Attr.h
+++ b/Source/core/dom/Attr.h
@@ -78,8 +78,8 @@
     virtual void setPrefix(const AtomicString&, ExceptionCode&);
 
     virtual String nodeValue() const OVERRIDE { return value(); }
-    virtual void setNodeValue(const String&, ExceptionCode&);
-    virtual PassRefPtr<Node> cloneNode(bool deep);
+    virtual void setNodeValue(const String&);
+    virtual PassRefPtr<Node> cloneNode(bool deep = true);
 
     virtual bool isAttributeNode() const { return true; }
     virtual bool childTypeAllowed(NodeType) const;
diff --git a/Source/core/dom/CharacterData.cpp b/Source/core/dom/CharacterData.cpp
index e57d138..1a25e91 100644
--- a/Source/core/dom/CharacterData.cpp
+++ b/Source/core/dom/CharacterData.cpp
@@ -82,8 +82,8 @@
     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 (!isTextBreak(it, characterLengthLimit))
-            characterLengthLimit = textBreakPreceding(it, characterLengthLimit);
+        if (!it.isBreak(characterLengthLimit))
+            characterLengthLimit = it.preceding(characterLengthLimit);
     }
 
     if (!characterLengthLimit)
@@ -191,7 +191,7 @@
     return m_data.containsOnlyWhitespace();
 }
 
-void CharacterData::setNodeValue(const String& nodeValue, ExceptionCode&)
+void CharacterData::setNodeValue(const String& nodeValue)
 {
     setData(nodeValue);
 }
@@ -236,10 +236,10 @@
 {
     ec = 0;
 
-    // INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit
+    // IndexSizeError: Raised if the specified offset is negative or greater than the number of 16-bit
     // units in data.
     if (offset > length()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 }
diff --git a/Source/core/dom/CharacterData.h b/Source/core/dom/CharacterData.h
index f8862ba..a985c81 100644
--- a/Source/core/dom/CharacterData.h
+++ b/Source/core/dom/CharacterData.h
@@ -24,7 +24,7 @@
 #define CharacterData_h
 
 #include "core/dom/Node.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -68,7 +68,7 @@
 
 private:
     virtual String nodeValue() const OVERRIDE FINAL;
-    virtual void setNodeValue(const String&, ExceptionCode&) OVERRIDE FINAL;
+    virtual void setNodeValue(const String&) OVERRIDE FINAL;
     virtual bool isCharacterDataNode() const OVERRIDE FINAL { return true; }
     virtual int maxCharacterOffset() const OVERRIDE FINAL;
     virtual bool offsetInCharacters() const OVERRIDE FINAL;
diff --git a/Source/core/dom/CheckedRadioButtons.cpp b/Source/core/dom/CheckedRadioButtons.cpp
index c377b7a..a628b43 100644
--- a/Source/core/dom/CheckedRadioButtons.cpp
+++ b/Source/core/dom/CheckedRadioButtons.cpp
@@ -22,7 +22,7 @@
 #include "core/dom/CheckedRadioButtons.h"
 
 #include "core/html/HTMLInputElement.h"
-#include <wtf/HashSet.h>
+#include "wtf/HashSet.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/CheckedRadioButtons.h b/Source/core/dom/CheckedRadioButtons.h
index f050faa..32bb5fe 100644
--- a/Source/core/dom/CheckedRadioButtons.h
+++ b/Source/core/dom/CheckedRadioButtons.h
@@ -21,9 +21,9 @@
 #ifndef CheckedRadioButtons_h
 #define CheckedRadioButtons_h
 
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ChildListMutationScope.cpp b/Source/core/dom/ChildListMutationScope.cpp
index 835bed7..6acb5b1 100644
--- a/Source/core/dom/ChildListMutationScope.cpp
+++ b/Source/core/dom/ChildListMutationScope.cpp
@@ -29,16 +29,15 @@
  */
 
 #include "config.h"
-
 #include "core/dom/ChildListMutationScope.h"
 
 #include "core/dom/MutationObserverInterestGroup.h"
 #include "core/dom/MutationRecord.h"
 #include "core/dom/Node.h"
 #include "core/dom/StaticNodeList.h"
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/StdLibExtras.h>
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/StdLibExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ChildNode.idl b/Source/core/dom/ChildNode.idl
index b37f05f..c5fdbba 100644
--- a/Source/core/dom/ChildNode.idl
+++ b/Source/core/dom/ChildNode.idl
@@ -24,6 +24,6 @@
 interface ChildNode {
     [PerWorldBindings] readonly attribute Element previousElementSibling;
     [PerWorldBindings] readonly attribute Element nextElementSibling;
-    [RaisesException] void remove();
+    [RaisesException, DeliverCustomElementCallbacks] void remove();
 };
 
diff --git a/Source/core/dom/ChildNodeList.h b/Source/core/dom/ChildNodeList.h
index 34b4040..af70df3 100644
--- a/Source/core/dom/ChildNodeList.h
+++ b/Source/core/dom/ChildNodeList.h
@@ -25,7 +25,7 @@
 #define ChildNodeList_h
 
 #include "core/dom/LiveNodeList.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ClientRect.h b/Source/core/dom/ClientRect.h
index 329f34c..9177a3f 100644
--- a/Source/core/dom/ClientRect.h
+++ b/Source/core/dom/ClientRect.h
@@ -29,8 +29,8 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/platform/graphics/FloatRect.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ClientRectList.cpp b/Source/core/dom/ClientRectList.cpp
index 9d3ee0a..d87b696 100644
--- a/Source/core/dom/ClientRectList.cpp
+++ b/Source/core/dom/ClientRectList.cpp
@@ -57,7 +57,7 @@
 {
     if (index >= m_list.size()) {
         // FIXME: this should throw an exception.
-        // ec = INDEX_SIZE_ERR;
+        // ec = IndexSizeError;
         return 0;
     }
 
diff --git a/Source/core/dom/Comment.h b/Source/core/dom/Comment.h
index 5ef2285..6d4b768 100644
--- a/Source/core/dom/Comment.h
+++ b/Source/core/dom/Comment.h
@@ -39,7 +39,7 @@
 
     virtual String nodeName() const;
     virtual NodeType nodeType() const;
-    virtual PassRefPtr<Node> cloneNode(bool deep);
+    virtual PassRefPtr<Node> cloneNode(bool deep = true);
     virtual bool childTypeAllowed(NodeType) const;
 };
 
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 1f9b351..9983a2a 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -147,34 +147,35 @@
 
 static inline ExceptionCode checkAcceptChild(ContainerNode* newParent, Node* newChild, Node* oldChild)
 {
-    // Not mentioned in spec: throw NOT_FOUND_ERR if newChild is null
+    // Not mentioned in spec: throw NotFoundError if newChild is null
     if (!newChild)
-        return NOT_FOUND_ERR;
+        return NotFoundError;
 
     // Use common case fast path if possible.
     if ((newChild->isElementNode() || newChild->isTextNode()) && newParent->isElementNode()) {
         ASSERT(!newParent->isDocumentTypeNode());
         ASSERT(isChildTypeAllowed(newParent, newChild));
         if (containsConsideringHostElements(newChild, newParent))
-            return HIERARCHY_REQUEST_ERR;
+            return HierarchyRequestError;
         return 0;
     }
 
     // This should never happen, but also protect release builds from tree corruption.
     ASSERT(!newChild->isPseudoElement());
     if (newChild->isPseudoElement())
-        return HIERARCHY_REQUEST_ERR;
+        return HierarchyRequestError;
 
     if (newChild->inDocument() && newChild->isDocumentTypeNode())
-        return HIERARCHY_REQUEST_ERR;
+        return HierarchyRequestError;
     if (containsConsideringHostElements(newChild, newParent))
-        return HIERARCHY_REQUEST_ERR;
+        return HierarchyRequestError;
 
     if (oldChild && newParent->isDocumentNode()) {
         if (!toDocument(newParent)->canReplaceChild(newChild, oldChild))
-            return HIERARCHY_REQUEST_ERR;
-    } else if (!isChildTypeAllowed(newParent, newChild))
-        return HIERARCHY_REQUEST_ERR;
+            return HierarchyRequestError;
+    } else if (!isChildTypeAllowed(newParent, newChild)) {
+        return HierarchyRequestError;
+    }
 
     return 0;
 }
@@ -184,7 +185,7 @@
     ASSERT(!newParent->isDocumentTypeNode());
     ASSERT(isChildTypeAllowed(newParent, newChild));
     if (newChild->contains(newParent)) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return false;
     }
 
@@ -209,7 +210,7 @@
     return true;
 }
 
-bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior)
 {
     // Check that this node is not "floating".
     // If it is, it can be deleted as a side effect of sending mutation events.
@@ -220,34 +221,36 @@
     ec = 0;
 
     // insertBefore(node, 0) is equivalent to appendChild(node)
-    if (!refChild)
-        return appendChild(newChild, ec, attachBehavior);
+    if (!refChild) {
+        appendChild(newChild, ec, attachBehavior);
+        return;
+    }
 
     // Make sure adding the new child is OK.
     if (!checkAddChild(this, newChild.get(), ec))
-        return false;
+        return;
 
-    // NOT_FOUND_ERR: Raised if refChild is not a child of this node
+    // NotFoundError: Raised if refChild is not a child of this node
     if (refChild->parentNode() != this) {
-        ec = NOT_FOUND_ERR;
-        return false;
+        ec = NotFoundError;
+        return;
     }
 
     if (refChild->previousSibling() == newChild || refChild == newChild) // nothing to do
-        return true;
+        return;
 
     RefPtr<Node> next = refChild;
 
     NodeVector targets;
     collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec);
     if (ec)
-        return false;
+        return;
     if (targets.isEmpty())
-        return true;
+        return;
 
     // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events.
     if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec))
-        return false;
+        return;
 
     InspectorInstrumentation::willInsertDOMNode(document(), this);
 
@@ -272,7 +275,6 @@
     }
 
     dispatchSubtreeModifiedEvent();
-    return true;
 }
 
 void ContainerNode::insertBeforeCommon(Node* nextChild, Node* newChild)
@@ -325,7 +327,7 @@
     ChildNodeInsertionNotifier(this).notify(newChild.get());
 }
 
-bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior)
 {
     // Check that this node is not "floating".
     // If it is, it can be deleted as a side effect of sending mutation events.
@@ -336,21 +338,21 @@
     ec = 0;
 
     if (oldChild == newChild) // nothing to do
-        return true;
+        return;
 
     if (!oldChild) {
-        ec = NOT_FOUND_ERR;
-        return false;
+        ec = NotFoundError;
+        return;
     }
 
     // Make sure replacing the old child with the new is ok
     if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
-        return false;
+        return;
 
-    // NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
+    // NotFoundError: Raised if oldChild is not a child of this node.
     if (oldChild->parentNode() != this) {
-        ec = NOT_FOUND_ERR;
-        return false;
+        ec = NotFoundError;
+        return;
     }
 
     ChildListMutationScope mutation(this);
@@ -361,23 +363,23 @@
     RefPtr<Node> removedChild = oldChild;
     removeChild(oldChild, ec);
     if (ec)
-        return false;
+        return;
 
     if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do
-        return true;
+        return;
 
     // Does this one more time because removeChild() fires a MutationEvent.
     if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
-        return false;
+        return;
 
     NodeVector targets;
     collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec);
     if (ec)
-        return false;
+        return;
 
     // Does this yet another check because collectChildrenAndRemoveFromOldParent() fires a MutationEvent.
     if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
-        return false;
+        return;
 
     InspectorInstrumentation::willInsertDOMNode(document(), this);
 
@@ -409,7 +411,6 @@
     }
 
     dispatchSubtreeModifiedEvent();
-    return true;
 }
 
 static void willRemoveChild(Node* child)
@@ -447,7 +448,7 @@
     ChildFrameDisconnector(this).disconnect();
 }
 
-bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
+void ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
 {
     // Check that this node is not "floating".
     // If it is, it can be deleted as a side effect of sending mutation events.
@@ -457,10 +458,10 @@
 
     ec = 0;
 
-    // NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
+    // NotFoundError: Raised if oldChild is not a child of this node.
     if (!oldChild || oldChild->parentNode() != this) {
-        ec = NOT_FOUND_ERR;
-        return false;
+        ec = NotFoundError;
+        return;
     }
 
     RefPtr<Node> child = oldChild;
@@ -473,16 +474,16 @@
     // Events fired when blurring currently focused node might have moved this
     // child into a different parent.
     if (child->parentNode() != this) {
-        ec = NOT_FOUND_ERR;
-        return false;
+        ec = NotFoundError;
+        return;
     }
 
     willRemoveChild(child.get());
 
     // Mutation events might have moved this child into a different parent.
     if (child->parentNode() != this) {
-        ec = NOT_FOUND_ERR;
-        return false;
+        ec = NotFoundError;
+        return;
     }
 
     {
@@ -495,8 +496,6 @@
         ChildNodeRemovalNotifier(this).notify(child.get());
     }
     dispatchSubtreeModifiedEvent();
-
-    return child;
 }
 
 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* oldChild)
@@ -590,7 +589,7 @@
     dispatchSubtreeModifiedEvent();
 }
 
-bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior)
 {
     RefPtr<ContainerNode> protect(this);
 
@@ -602,22 +601,22 @@
 
     // Make sure adding the new child is ok
     if (!checkAddChild(this, newChild.get(), ec))
-        return false;
+        return;
 
     if (newChild == m_lastChild) // nothing to do
-        return newChild;
+        return;
 
     NodeVector targets;
     collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec);
     if (ec)
-        return false;
+        return;
 
     if (targets.isEmpty())
-        return true;
+        return;
 
     // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events.
     if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec))
-        return false;
+        return;
 
     InspectorInstrumentation::willInsertDOMNode(document(), this);
 
@@ -644,7 +643,6 @@
     }
 
     dispatchSubtreeModifiedEvent();
-    return true;
 }
 
 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild)
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index 28dea40..377cff5 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -26,9 +26,8 @@
 
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Node.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/OwnPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -96,10 +95,10 @@
     unsigned childNodeCount() const;
     Node* childNode(unsigned index) const;
 
-    bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
-    bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
-    bool removeChild(Node* child, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    bool appendChild(PassRefPtr<Node> newChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
+    void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
+    void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
+    void removeChild(Node* child, ExceptionCode& = ASSERT_NO_EXCEPTION);
+    void appendChild(PassRefPtr<Node> newChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
 
     // These methods are only used during parsing.
     // They don't send DOM mutation events or handle reparenting.
diff --git a/Source/core/dom/CrossThreadTask.h b/Source/core/dom/CrossThreadTask.h
index 0ab979d..3418b31 100644
--- a/Source/core/dom/CrossThreadTask.h
+++ b/Source/core/dom/CrossThreadTask.h
@@ -34,9 +34,9 @@
 #include <memory>
 #include "core/dom/ScriptExecutionContext.h"
 #include "core/platform/CrossThreadCopier.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/TypeTraits.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/TypeTraits.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/CustomElementCallbackDispatcher.cpp b/Source/core/dom/CustomElementCallbackDispatcher.cpp
index 667c6c2..10db728 100644
--- a/Source/core/dom/CustomElementCallbackDispatcher.cpp
+++ b/Source/core/dom/CustomElementCallbackDispatcher.cpp
@@ -29,46 +29,155 @@
  */
 
 #include "config.h"
-#include "CustomElementCallbackDispatcher.h"
+#include "core/dom/CustomElementCallbackDispatcher.h"
 
-#include "CustomElementCallback.h"
+#include "core/dom/CustomElementCallbackInvocation.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 = 1;
+
 CustomElementCallbackDispatcher& CustomElementCallbackDispatcher::instance()
 {
     DEFINE_STATIC_LOCAL(CustomElementCallbackDispatcher, instance, ());
     return instance;
 }
 
-CustomElementCallbackDispatcher::ReadyInvocation::ReadyInvocation(PassRefPtr<CustomElementCallback> callback, PassRefPtr<Element> element)
-    : m_callback(callback)
-    , m_element(element)
+void CustomElementCallbackDispatcher::enqueueAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
 {
-}
-
-bool CustomElementCallbackDispatcher::dispatch()
-{
-    if (m_invocations.isEmpty())
-        return false;
-
-    do  {
-        Vector<ReadyInvocation> invocations;
-        m_invocations.swap(invocations);
-
-        for (Vector<ReadyInvocation>::iterator it = invocations.begin(); it != invocations.end(); ++it)
-            it->invoke();
-    } while (!m_invocations.isEmpty());
-
-    return true;
-}
-
-void CustomElementCallbackDispatcher::enqueueReadyCallback(CustomElementCallback* callback, Element* element)
-{
-    if (!callback->hasReady())
+    if (!callbacks->hasAttributeChangedCallback())
         return;
 
-    m_invocations.append(ReadyInvocation(callback, element));
+    CustomElementCallbackQueue* queue = scheduleInCurrentElementQueue(element);
+    queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocation(callbacks, name, oldValue, newValue));
+}
+
+void CustomElementCallbackDispatcher::enqueueCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
+{
+    if (!callbacks->hasCreatedCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = createCallbackQueue(element);
+    queue->setOwner(currentElementQueue());
+
+    // The created callback is unique in being prepended to the front
+    // of the element queue
+    m_flattenedProcessingStack.insert(inCallbackDeliveryScope() ? s_elementQueueStart : /* skip null sentinel */ 1, queue);
+    ++s_elementQueueEnd;
+
+    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::Created));
+}
+
+void CustomElementCallbackDispatcher::enqueueEnteredDocumentCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
+{
+    if (!callbacks->hasEnteredDocumentCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = scheduleInCurrentElementQueue(element);
+    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::EnteredDocument));
+}
+
+void CustomElementCallbackDispatcher::enqueueLeftDocumentCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
+{
+    if (!callbacks->hasLeftDocumentCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = scheduleInCurrentElementQueue(element);
+    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::LeftDocument));
+}
+
+// Dispatches callbacks at microtask checkpoint.
+bool CustomElementCallbackDispatcher::dispatch()
+{
+    ASSERT(isMainThread());
+    if (inCallbackDeliveryScope())
+        return false;
+
+    size_t start = 1; // skip null sentinel
+    size_t end = s_elementQueueEnd;
+
+    for (size_t i = start; i < end; i++) {
+        m_flattenedProcessingStack[i]->processInElementQueue(currentElementQueue());
+
+        // new callbacks as a result of recursion must be scheduled in
+        // a CallbackDeliveryScope which restore this queue on completion
+        ASSERT(!s_elementQueueStart);
+        ASSERT(s_elementQueueEnd == end);
+    }
+
+    s_elementQueueEnd = 1;
+    m_flattenedProcessingStack.resize(s_elementQueueEnd);
+    m_elementCallbackQueueMap.clear();
+
+    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());
+
+    for (size_t i = start; i < end; i++) {
+        m_flattenedProcessingStack[i]->processInElementQueue(currentElementQueue());
+
+        // process() may run script which grows and shrinks the
+        // processing stack above this entry, but the processing stack
+        // should always drop back to having this entry at the
+        // top-of-stack on exit
+        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 == /* allow sentinel */ 1)
+        m_elementCallbackQueueMap.clear();
+}
+
+CustomElementCallbackQueue* CustomElementCallbackDispatcher::createCallbackQueue(PassRefPtr<Element> element)
+{
+    Element* key = element.get();
+    ElementCallbackQueueMap::AddResult result = m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::create(element));
+    ASSERT(result.isNewEntry);
+    return result.iterator->value.get();
+}
+
+CustomElementCallbackQueue* CustomElementCallbackDispatcher::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();
+}
+
+// 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* CustomElementCallbackDispatcher::scheduleInCurrentElementQueue(PassRefPtr<Element> element)
+{
+    CustomElementCallbackQueue* queue = ensureCallbackQueue(element);
+    bool isInCurrentQueue = queue->owner() == currentElementQueue();
+    if (!isInCurrentQueue) {
+        queue->setOwner(currentElementQueue());
+        m_flattenedProcessingStack.append(queue);
+        ++s_elementQueueEnd;
+    }
+    return queue;
 }
 
 } // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallbackDispatcher.h b/Source/core/dom/CustomElementCallbackDispatcher.h
index 46a4f76..9b6f10d 100644
--- a/Source/core/dom/CustomElementCallbackDispatcher.h
+++ b/Source/core/dom/CustomElementCallbackDispatcher.h
@@ -31,10 +31,12 @@
 #ifndef CustomElementCallbackDispatcher_h
 #define CustomElementCallbackDispatcher_h
 
-#include "core/dom/CustomElementCallback.h"
+#include "core/dom/CustomElementCallbackQueue.h"
+#include "core/dom/CustomElementLifecycleCallbacks.h"
 #include "core/dom/Element.h"
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
 #include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
@@ -44,18 +46,30 @@
 public:
     static CustomElementCallbackDispatcher& instance();
 
+    // This is stack allocated in many DOM callbacks. Make it cheap.
     class CallbackDeliveryScope {
     public:
-        CallbackDeliveryScope() { }
+        CallbackDeliveryScope()
+            : m_savedElementQueueStart(s_elementQueueStart)
+        {
+            s_elementQueueStart = s_elementQueueEnd;
+        }
+
         ~CallbackDeliveryScope()
         {
-            CustomElementCallbackDispatcher& dispatcher = CustomElementCallbackDispatcher::instance();
-            if (dispatcher.hasQueuedCallbacks())
-                dispatcher.dispatch();
+            if (s_elementQueueStart != s_elementQueueEnd)
+                processElementQueueAndPop();
+            s_elementQueueStart = m_savedElementQueueStart;
         }
+
+    private:
+        size_t m_savedElementQueueStart;
     };
 
-    void enqueueReadyCallback(CustomElementCallback*, Element*);
+    void enqueueAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
+    void enqueueCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
+    void enqueueEnteredDocumentCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
+    void enqueueLeftDocumentCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
 
     // Returns true if more work may have to be performed at the
     // checkpoint by this or other workers (for example, this work
@@ -63,22 +77,45 @@
     bool dispatch();
 
 private:
-    explicit CustomElementCallbackDispatcher() { }
+    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;
+        m_flattenedProcessingStack.append(sentinel);
+        ASSERT(s_elementQueueEnd == m_flattenedProcessingStack.size());
+    }
 
-    bool hasQueuedCallbacks() { return !m_invocations.isEmpty(); }
+    // The start of the element queue on the top of the processing
+    // stack. An offset into instance().m_flattenedProcessingStack.
+    static size_t s_elementQueueStart;
 
-    class ReadyInvocation {
-    public:
-        ReadyInvocation(PassRefPtr<CustomElementCallback>, PassRefPtr<Element>);
-        virtual ~ReadyInvocation() { }
-        void invoke() { m_callback->ready(m_element.get()); }
+    // 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;
 
-    private:
-        RefPtr<CustomElementCallback> m_callback;
-        RefPtr<Element> m_element;
-    };
+    static bool inCallbackDeliveryScope() { return s_elementQueueStart; }
 
-    Vector<ReadyInvocation> m_invocations;
+    typedef int ElementQueue;
+    static ElementQueue currentElementQueue() { return ElementQueue(s_elementQueueStart); }
+
+    static void processElementQueueAndPop();
+    void processElementQueueAndPop(size_t start, size_t end);
+
+    CustomElementCallbackQueue* createCallbackQueue(PassRefPtr<Element>);
+    CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>);
+    CustomElementCallbackQueue* scheduleInCurrentElementQueue(PassRefPtr<Element>);
+
+    // 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.
+    Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack;
+
+    typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallbackQueueMap;
+    ElementCallbackQueueMap m_elementCallbackQueueMap;
 };
 
 }
diff --git a/Source/core/dom/CustomElementCallbackInvocation.cpp b/Source/core/dom/CustomElementCallbackInvocation.cpp
new file mode 100644
index 0000000..2d81c89
--- /dev/null
+++ b/Source/core/dom/CustomElementCallbackInvocation.cpp
@@ -0,0 +1,133 @@
+/*
+ * 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/CustomElementCallbackDispatcher.h"
+
+namespace WebCore {
+
+class CreatedInvocation : public CustomElementCallbackInvocation {
+public:
+    CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
+        : CustomElementCallbackInvocation(callbacks)
+    {
+    }
+
+private:
+    virtual void dispatch(Element*) OVERRIDE;
+};
+
+void CreatedInvocation::dispatch(Element* element)
+{
+    if (element->inDocument())
+        CustomElementCallbackDispatcher::instance().enqueueEnteredDocumentCallback(callbacks(), element);
+    callbacks()->created(element);
+}
+
+class EnteredLeftDocumentInvocation : public CustomElementCallbackInvocation {
+public:
+    EnteredLeftDocumentInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, CustomElementLifecycleCallbacks::CallbackType which);
+
+private:
+    virtual void dispatch(Element*) OVERRIDE;
+
+    CustomElementLifecycleCallbacks::CallbackType m_which;
+};
+
+EnteredLeftDocumentInvocation::EnteredLeftDocumentInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType which)
+    : CustomElementCallbackInvocation(callbacks)
+    , m_which(which)
+{
+    ASSERT(m_which == CustomElementLifecycleCallbacks::EnteredDocument || m_which == CustomElementLifecycleCallbacks::LeftDocument);
+}
+
+void EnteredLeftDocumentInvocation::dispatch(Element* element)
+{
+    switch (m_which) {
+    case CustomElementLifecycleCallbacks::EnteredDocument:
+        callbacks()->enteredDocument(element);
+        break;
+    case CustomElementLifecycleCallbacks::LeftDocument:
+        callbacks()->leftDocument(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::EnteredDocument:
+    case CustomElementLifecycleCallbacks::LeftDocument:
+        return adoptPtr(new EnteredLeftDocumentInvocation(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
new file mode 100644
index 0000000..c6f0818
--- /dev/null
+++ b/Source/core/dom/CustomElementCallbackInvocation.h
@@ -0,0 +1,67 @@
+/*
+ * 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;
+
+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
new file mode 100644
index 0000000..d5641bd
--- /dev/null
+++ b/Source/core/dom/CustomElementCallbackQueue.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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"
+
+#include "core/dom/Element.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)
+{
+}
+
+void CustomElementCallbackQueue::processInElementQueue(ElementQueue caller)
+{
+    while (m_index < m_queue.size() && owner() == caller) {
+        // 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());
+    }
+
+    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
new file mode 100644
index 0000000..7e39486
--- /dev/null
+++ b/Source/core/dom/CustomElementCallbackQueue.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 CustomElementCallbackQueue_h
+#define CustomElementCallbackQueue_h
+
+#include "core/dom/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);
+
+private:
+    CustomElementCallbackQueue(PassRefPtr<Element>);
+
+    RefPtr<Element> m_element;
+    Vector<OwnPtr<CustomElementCallbackInvocation> > m_queue;
+    ElementQueue m_owner;
+    size_t m_index;
+};
+
+}
+
+#endif // CustomElementCallbackQueue_h
diff --git a/Source/core/dom/CustomElementDefinition.cpp b/Source/core/dom/CustomElementDefinition.cpp
index 827383b..5f29910 100644
--- a/Source/core/dom/CustomElementDefinition.cpp
+++ b/Source/core/dom/CustomElementDefinition.cpp
@@ -29,20 +29,18 @@
  */
 
 #include "config.h"
-
 #include "core/dom/CustomElementDefinition.h"
 
 namespace WebCore {
 
-PassRefPtr<CustomElementDefinition> CustomElementDefinition::create(const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, PassRefPtr<CustomElementCallback> callback)
+PassRefPtr<CustomElementDefinition> CustomElementDefinition::create(const CustomElementDescriptor& descriptor, PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
 {
-    return adoptRef(new CustomElementDefinition(type, name, namespaceURI, callback));
+    return adoptRef(new CustomElementDefinition(descriptor, callbacks));
 }
 
-CustomElementDefinition::CustomElementDefinition(const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, PassRefPtr<CustomElementCallback> callback)
-    : m_type(type)
-    , m_tag(QualifiedName(nullAtom, name, namespaceURI))
-    , m_callback(callback)
+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
index a3a7134..96aa3dc 100644
--- a/Source/core/dom/CustomElementDefinition.h
+++ b/Source/core/dom/CustomElementDefinition.h
@@ -31,8 +31,8 @@
 #ifndef CustomElementDefinition_h
 #define CustomElementDefinition_h
 
-#include "core/dom/CustomElementCallback.h"
-#include "core/dom/QualifiedName.h"
+#include "core/dom/CustomElementDescriptor.h"
+#include "core/dom/CustomElementLifecycleCallbacks.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -41,43 +41,18 @@
 
 class CustomElementDefinition : public RefCounted<CustomElementDefinition> {
 public:
-    static PassRefPtr<CustomElementDefinition> create(const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, PassRefPtr<CustomElementCallback>);
+    static PassRefPtr<CustomElementDefinition> create(const CustomElementDescriptor&, PassRefPtr<CustomElementLifecycleCallbacks>);
 
     virtual ~CustomElementDefinition() {}
 
-    enum CustomElementKind {
-        CustomTag,
-        TypeExtension
-    };
-
-    // This specifies whether the custom element is in the HTML or SVG
-    // namespace.
-    const AtomicString& namespaceURI() const { return m_tag.namespaceURI(); }
-
-    // This uniquely identifies the Custom Element. For custom tags, this
-    // is the tag name and the same as "name". For type extensions, this
-    // is the value of the "is" attribute.
-    const AtomicString& type() const { return m_type; }
-
-    // This is the tag name of the Custom Element.
-    const AtomicString& name() const { return m_tag.localName(); }
-
-    // This is a convenience property derived from "namespaceURI" and
-    // "name". Custom Elements of this kind will have this tag
-    // name. This does not have a prefix.
-    const QualifiedName& tagQName() const { return m_tag; }
-
-    CustomElementKind kind() const { return isTypeExtension() ? TypeExtension : CustomTag; }
-    bool isTypeExtension() const { return type() != name(); }
-
-    CustomElementCallback* callback() const { return m_callback.get(); }
+    const CustomElementDescriptor& descriptor() const { return m_descriptor; }
+    CustomElementLifecycleCallbacks* callbacks() const { return m_callbacks.get(); }
 
 private:
-    CustomElementDefinition(const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, PassRefPtr<CustomElementCallback>);
+    CustomElementDefinition(const CustomElementDescriptor&, PassRefPtr<CustomElementLifecycleCallbacks>);
 
-    AtomicString m_type;
-    QualifiedName m_tag;
-    RefPtr<CustomElementCallback> m_callback;
+    CustomElementDescriptor m_descriptor;
+    RefPtr<CustomElementLifecycleCallbacks> m_callbacks;
 };
 
 }
diff --git a/Source/core/dom/CustomElementDescriptor.h b/Source/core/dom/CustomElementDescriptor.h
new file mode 100644
index 0000000..307cb43
--- /dev/null
+++ b/Source/core/dom/CustomElementDescriptor.h
@@ -0,0 +1,99 @@
+/*
+ * 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 CustomElementDescriptor_h
+#define CustomElementDescriptor_h
+
+#include "wtf/RefPtr.h" // for HashTableDeletedValueType
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+struct CustomElementDescriptorHash;
+
+// A Custom Element descriptor is everything necessary to match a
+// Custom Element instance to a definition.
+class CustomElementDescriptor {
+public:
+    CustomElementDescriptor(const AtomicString& type, const AtomicString& namespaceURI, const AtomicString& localName)
+        : m_type(type)
+        , m_namespaceURI(namespaceURI)
+        , m_localName(localName)
+    {
+    }
+
+    ~CustomElementDescriptor() { }
+
+    // Specifies whether the custom element is in the HTML or SVG
+    // namespace.
+    const AtomicString& namespaceURI() const { return m_namespaceURI; }
+
+    // The tag name.
+    const AtomicString& localName() const { return m_localName; }
+
+    // The name of the definition. For custom tags, this is the tag
+    // name and the same as "localName". For type extensions, this is
+    // the value of the "is" attribute.
+    const AtomicString& type() const { return m_type; }
+
+    bool isTypeExtension() const { return m_type != m_localName; }
+
+    // Stuff for hashing.
+
+    CustomElementDescriptor() { }
+    explicit CustomElementDescriptor(WTF::HashTableDeletedValueType value)
+        : m_type(value) { }
+    bool isHashTableDeletedValue() const { return m_type.isHashTableDeletedValue(); }
+
+    bool operator==(const CustomElementDescriptor& other) const
+    {
+        return m_type == other.m_type
+            && m_localName == other.m_localName
+            && m_namespaceURI == other.m_namespaceURI;
+    }
+
+private:
+    AtomicString m_type;
+    AtomicString m_namespaceURI;
+    AtomicString m_localName;
+};
+
+} // namespace WebCore
+
+namespace WTF {
+
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<WebCore::CustomElementDescriptor> {
+    typedef WebCore::CustomElementDescriptorHash Hash;
+};
+
+} // namespace WTF
+
+#endif // CustomElementDescriptor_h
diff --git a/Source/core/dom/CustomElementCallback.h b/Source/core/dom/CustomElementDescriptorHash.h
similarity index 60%
copy from Source/core/dom/CustomElementCallback.h
copy to Source/core/dom/CustomElementDescriptorHash.h
index d71e35a..81c51de 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/dom/CustomElementDescriptorHash.h
@@ -28,34 +28,39 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
+#ifndef CustomElementDescriptorHash_h
+#define CustomElementDescriptorHash_h
 
-#include "wtf/RefCounted.h"
+#include "core/dom/CustomElementDescriptor.h"
+#include "wtf/HashFunctions.h"
+#include "wtf/HashTraits.h"
+#include "wtf/text/AtomicStringHash.h"
 
 namespace WebCore {
 
-class Element;
+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())));
+    }
 
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
-public:
-    virtual ~CustomElementCallback() { }
+    static bool equal(const CustomElementDescriptor& a, const CustomElementDescriptor& b)
+    {
+        return a == b;
+    }
 
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
-
-protected:
-    enum CallbackType {
-        None,
-        Ready
-    };
-
-    CustomElementCallback(CallbackType which) : m_which(which) { }
-
-private:
-    CallbackType m_which;
+    static const bool safeToCompareToEmptyOrDeleted = true;
 };
 
-}
+} // namespace WebCore
 
-#endif // CustomElementCallback_h
+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/CustomElementCallback.h b/Source/core/dom/CustomElementLifecycleCallbacks.h
similarity index 60%
copy from Source/core/dom/CustomElementCallback.h
copy to Source/core/dom/CustomElementLifecycleCallbacks.h
index d71e35a..e48628d 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/dom/CustomElementLifecycleCallbacks.h
@@ -28,29 +28,42 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
+#ifndef CustomElementLifecycleCallbacks_h
+#define CustomElementLifecycleCallbacks_h
 
 #include "wtf/RefCounted.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
 class Element;
 
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
+class CustomElementLifecycleCallbacks : public RefCounted<CustomElementLifecycleCallbacks> {
 public:
-    virtual ~CustomElementCallback() { }
+    virtual ~CustomElementLifecycleCallbacks() { }
 
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
+    bool hasCreatedCallback() const { return m_which & Created; }
+    virtual void created(Element*) = 0;
 
-protected:
+    bool hasEnteredDocumentCallback() const { return m_which & EnteredDocument; }
+    virtual void enteredDocument(Element*) = 0;
+
+    bool hasLeftDocumentCallback() const { return m_which & LeftDocument; }
+    virtual void leftDocument(Element*) = 0;
+
+    bool hasAttributeChangedCallback() const { return m_which & AttributeChanged; }
+    virtual void attributeChanged(Element*, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) = 0;
+
     enum CallbackType {
-        None,
-        Ready
+        None             = 0,
+        Created          = 1 << 0,
+        EnteredDocument  = 1 << 1,
+        LeftDocument     = 1 << 2,
+        AttributeChanged = 1 << 3
     };
 
-    CustomElementCallback(CallbackType which) : m_which(which) { }
+protected:
+    CustomElementLifecycleCallbacks(CallbackType which) : m_which(which) { }
 
 private:
     CallbackType m_which;
@@ -58,4 +71,4 @@
 
 }
 
-#endif // CustomElementCallback_h
+#endif // CustomElementLifecycleCallbacks_h
diff --git a/Source/core/dom/CustomElementRegistrationContext.cpp b/Source/core/dom/CustomElementRegistrationContext.cpp
new file mode 100644
index 0000000..75844c3
--- /dev/null
+++ b/Source/core/dom/CustomElementRegistrationContext.cpp
@@ -0,0 +1,282 @@
+/*
+ * 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 "core/dom/CustomElementCallbackDispatcher.h"
+#include "core/dom/CustomElementDefinition.h"
+#include "core/dom/CustomElementRegistry.h"
+#include "core/dom/CustomElementUpgradeCandidateMap.h"
+#include "core/dom/Element.h"
+#include "core/html/HTMLElement.h"
+#include "core/html/HTMLUnknownElement.h"
+#include "core/svg/SVGElement.h"
+
+namespace WebCore {
+
+// The null registration context is used by documents that do not
+// process custom elements. All of its operations are no-ops.
+class NullRegistrationContext : public CustomElementRegistrationContext {
+public:
+    NullRegistrationContext() { }
+    virtual ~NullRegistrationContext() { }
+
+    virtual CustomElementDescriptor describe(Element*) const OVERRIDE { return CustomElementDescriptor(); }
+
+    virtual void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString&, ExceptionCode& ec) OVERRIDE { ec = NotSupportedError; }
+
+    virtual PassRefPtr<Element> createCustomTagElement(Document*, const QualifiedName&) OVERRIDE;
+    virtual void didGiveTypeExtension(Element*, const AtomicString&) OVERRIDE { }
+
+    virtual void customElementAttributeDidChange(Element*, const AtomicString&, const AtomicString&, const AtomicString&) OVERRIDE { }
+    virtual void customElementDidEnterDocument(Element*) OVERRIDE { }
+    virtual void customElementDidLeaveDocument(Element*) OVERRIDE { }
+    virtual void customElementIsBeingDestroyed(Element*) OVERRIDE { }
+};
+
+PassRefPtr<Element> NullRegistrationContext::createCustomTagElement(Document* document, const QualifiedName& tagName)
+{
+    ASSERT(isCustomTagName(tagName.localName()));
+
+    if (!document)
+        return 0;
+
+    if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI())
+        return HTMLUnknownElement::create(tagName, document);
+    if (SVGNames::svgNamespaceURI == tagName.namespaceURI())
+        return SVGElement::create(tagName, document);
+    return Element::create(tagName, document);
+}
+
+PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::nullRegistrationContext()
+{
+    DEFINE_STATIC_LOCAL(RefPtr<NullRegistrationContext>, instance, ());
+    if (!instance)
+        instance = adoptRef(new NullRegistrationContext());
+    return instance.get();
+}
+
+// An active registration context is used by documents that are
+// processing custom elements.
+class ActiveRegistrationContext : public CustomElementRegistrationContext {
+public:
+    ActiveRegistrationContext() { }
+    virtual ~ActiveRegistrationContext() { }
+
+    virtual CustomElementDescriptor describe(Element*) const OVERRIDE;
+
+    virtual void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& type, ExceptionCode&) OVERRIDE;
+
+    virtual PassRefPtr<Element> createCustomTagElement(Document*, const QualifiedName&) OVERRIDE;
+    virtual void didGiveTypeExtension(Element*, const AtomicString&) OVERRIDE;
+
+    virtual void customElementAttributeDidChange(Element*, const AtomicString&, const AtomicString&, const AtomicString&) OVERRIDE;
+    virtual void customElementDidEnterDocument(Element*) OVERRIDE;
+    virtual void customElementDidLeaveDocument(Element*) OVERRIDE;
+    virtual void customElementIsBeingDestroyed(Element*) OVERRIDE;
+
+private:
+    CustomElementDefinition* definitionFor(Element*) const;
+
+    void didCreateUnresolvedElement(const CustomElementDescriptor&, Element*);
+    void didResolveElement(CustomElementDefinition*, Element*) const;
+
+    CustomElementRegistry m_registry;
+
+    // Element creation
+    typedef HashMap<Element*, AtomicString> ElementTypeMap;
+    ElementTypeMap m_elementTypeMap; // Creation-time "is" attribute value.
+    CustomElementUpgradeCandidateMap m_candidates;
+};
+
+CustomElementDescriptor ActiveRegistrationContext::describe(Element* element) const
+{
+    ASSERT(element->isCustomElement());
+
+    // If an element has a custom tag name it takes precedence over
+    // the "is" attribute (if any).
+    const AtomicString& type = isCustomTagName(element->localName())
+        ? element->localName()
+        : m_elementTypeMap.get(element);
+
+    ASSERT(!type.isNull()); // Element must be in this registry
+    return CustomElementDescriptor(type, element->namespaceURI(), element->localName());
+}
+
+void ActiveRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, ExceptionCode& ec)
+{
+    CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, ec);
+
+    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);
+}
+
+CustomElementDefinition* ActiveRegistrationContext::definitionFor(Element* element) const
+{
+    ASSERT(element->document()->registrationContext() == this);
+    const CustomElementDescriptor& descriptor = describe(element);
+    return m_registry.find(descriptor);
+}
+
+PassRefPtr<Element> ActiveRegistrationContext::createCustomTagElement(Document* document, const QualifiedName& tagName)
+{
+    ASSERT(isCustomTagName(tagName.localName()));
+
+    if (!document)
+        return 0;
+
+    RefPtr<Element> element;
+
+    if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) {
+        element = HTMLElement::create(tagName, document);
+    } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) {
+        element = SVGElement::create(tagName, document);
+    } else {
+        // XML elements are not custom elements, so return early.
+        return Element::create(tagName, document);
+    }
+
+    element->setIsCustomElement();
+
+    const CustomElementDescriptor& descriptor = describe(element.get());
+    CustomElementDefinition* definition = m_registry.find(descriptor);
+    if (definition)
+        didResolveElement(definition, element.get());
+    else
+        didCreateUnresolvedElement(descriptor, element.get());
+
+    return element.release();
+}
+
+void ActiveRegistrationContext::didCreateUnresolvedElement(const CustomElementDescriptor& descriptor, Element* element)
+{
+    m_candidates.add(descriptor, element);
+}
+
+void ActiveRegistrationContext::didResolveElement(CustomElementDefinition* definition, Element* element) const
+{
+    CustomElementCallbackDispatcher::instance().enqueueCreatedCallback(definition->callbacks(), element);
+}
+
+void ActiveRegistrationContext::didGiveTypeExtension(Element* element, const AtomicString& type)
+{
+    if (!element->isHTMLElement() && !element->isSVGElement())
+        return;
+    if (element->isCustomElement())
+        return; // A custom tag, which takes precedence over type extensions
+    element->setIsCustomElement();
+    m_elementTypeMap.add(element, type);
+    const CustomElementDescriptor& descriptor = describe(element);
+    CustomElementDefinition* definition = m_registry.find(descriptor);
+    if (definition)
+        didResolveElement(definition, element);
+    else
+        didCreateUnresolvedElement(descriptor, element);
+}
+
+void ActiveRegistrationContext::customElementAttributeDidChange(Element* element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
+{
+    ASSERT(element->isUpgradedCustomElement());
+    CustomElementDefinition* definition = definitionFor(element);
+    CustomElementCallbackDispatcher::instance().enqueueAttributeChangedCallback(definition->callbacks(), element, name, oldValue, newValue);
+}
+
+void ActiveRegistrationContext::customElementDidEnterDocument(Element* element)
+{
+    ASSERT(element->isUpgradedCustomElement());
+    CustomElementDefinition* definition = definitionFor(element);
+    CustomElementCallbackDispatcher::instance().enqueueEnteredDocumentCallback(definition->callbacks(), element);
+}
+
+void ActiveRegistrationContext::customElementDidLeaveDocument(Element* element)
+{
+    ASSERT(element->isUpgradedCustomElement());
+    CustomElementDefinition* definition = definitionFor(element);
+    CustomElementCallbackDispatcher::instance().enqueueLeftDocumentCallback(definition->callbacks(), element);
+}
+
+void ActiveRegistrationContext::customElementIsBeingDestroyed(Element* element)
+{
+    ASSERT(element->isCustomElement());
+    m_candidates.remove(element);
+    m_elementTypeMap.remove(element);
+}
+
+PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::create()
+{
+    return adoptRef(new ActiveRegistrationContext());
+}
+
+bool CustomElementRegistrationContext::isValidTypeName(const AtomicString& name)
+{
+    if (notFound == name.find('-'))
+        return false;
+
+    // FIXME: Add annotation-xml.
+    DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
+    if (reservedNames.isEmpty()) {
+        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 (notFound != reservedNames.find(name))
+        return false;
+
+    return Document::isValidName(name.string());
+}
+
+bool CustomElementRegistrationContext::isCustomTagName(const AtomicString& localName)
+{
+    return isValidTypeName(localName);
+}
+
+void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type)
+{
+    ASSERT(element);
+    if (!type.isEmpty())
+        element->setAttribute(HTMLNames::isAttr, type);
+
+    didGiveTypeExtension(element, type);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/CustomElementRegistrationContext.h b/Source/core/dom/CustomElementRegistrationContext.h
new file mode 100644
index 0000000..b675300
--- /dev/null
+++ b/Source/core/dom/CustomElementRegistrationContext.h
@@ -0,0 +1,80 @@
+/*
+ * 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/ExceptionCode.h"
+#include "core/dom/QualifiedName.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+class CustomElementConstructorBuilder;
+class Document;
+class Element;
+
+class CustomElementRegistrationContext : public RefCounted<CustomElementRegistrationContext> {
+public:
+    static PassRefPtr<CustomElementRegistrationContext> nullRegistrationContext();
+    static PassRefPtr<CustomElementRegistrationContext> create();
+
+    virtual ~CustomElementRegistrationContext() { }
+
+    // Model
+    static bool isValidTypeName(const AtomicString& type);
+    static bool isCustomTagName(const AtomicString& localName);
+    virtual CustomElementDescriptor describe(Element*) const = 0;
+
+    // Definitions
+    virtual void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& type, ExceptionCode&) = 0;
+
+    // Instance creation
+    virtual PassRefPtr<Element> createCustomTagElement(Document*, const QualifiedName&) = 0;
+    void setTypeExtension(Element*, const AtomicString& type);
+    virtual void didGiveTypeExtension(Element*, const AtomicString& type) = 0;
+
+    // Instance lifecycle
+    virtual void customElementAttributeDidChange(Element*, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) = 0;
+    virtual void customElementDidEnterDocument(Element*) = 0;
+    virtual void customElementDidLeaveDocument(Element*) = 0;
+    virtual void customElementIsBeingDestroyed(Element*) = 0;
+
+protected:
+    CustomElementRegistrationContext() { }
+};
+
+}
+
+#endif // CustomElementRegistrationContext_h
+
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp
index 3eeb0df..3bbd23f 100644
--- a/Source/core/dom/CustomElementRegistry.cpp
+++ b/Source/core/dom/CustomElementRegistry.cpp
@@ -34,221 +34,95 @@
 #include "HTMLNames.h"
 #include "SVGNames.h"
 #include "bindings/v8/CustomElementConstructorBuilder.h"
-#include "core/dom/CustomElementCallbackDispatcher.h"
 #include "core/dom/CustomElementDefinition.h"
-#include "core/dom/Document.h"
-#include "core/dom/Element.h"
-#include "core/html/HTMLElement.h"
-#include "core/svg/SVGElement.h"
+#include "core/dom/CustomElementRegistrationContext.h"
+#include "core/dom/DocumentLifecycleObserver.h"
 
 namespace WebCore {
 
-void setTypeExtension(Element* element, const AtomicString& typeExtension)
-{
-    ASSERT(element);
-    if (!typeExtension.isEmpty())
-        element->setAttribute(HTMLNames::isAttr, typeExtension);
-}
-
-CustomElementRegistry::CustomElementRegistry(Document* document)
-    : ContextLifecycleObserver(document)
-{
-}
-
-static inline bool nameIncludesHyphen(const AtomicString& name)
-{
-    size_t hyphenPosition = name.find('-');
-    return (hyphenPosition != notFound);
-}
-
-bool CustomElementRegistry::isValidName(const AtomicString& name)
-{
-    if (!nameIncludesHyphen(name))
-        return false;
-
-    DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
-    if (reservedNames.isEmpty()) {
-        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());
+class RegistrationContextObserver : public DocumentLifecycleObserver {
+public:
+    explicit RegistrationContextObserver(Document* document)
+        : DocumentLifecycleObserver(document)
+        , m_wentAway(!document)
+    {
     }
 
-    if (notFound != reservedNames.find(name))
-        return false;
+    bool registrationContextWentAway() { return m_wentAway; }
 
-    return Document::isValidName(name.string());
-}
+private:
+    virtual void documentWasDisposed() OVERRIDE { m_wentAway = true; }
 
-void CustomElementRegistry::registerElement(CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, ExceptionCode& ec)
+    bool m_wentAway;
+};
+
+CustomElementDefinition* CustomElementRegistry::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, ExceptionCode& ec)
 {
-    RefPtr<CustomElementRegistry> protect(this);
+    // 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);
 
     if (!constructorBuilder->isFeatureAllowed())
-        return;
+        return 0;
 
     AtomicString type = userSuppliedName.lower();
-    if (!isValidName(type)) {
-        ec = INVALID_CHARACTER_ERR;
-        return;
+    if (!CustomElementRegistrationContext::isValidTypeName(type)) {
+        ec = InvalidCharacterError;
+        return 0;
     }
 
     if (!constructorBuilder->validateOptions()) {
-        ec = INVALID_STATE_ERR;
-        return;
+        ec = InvalidStateError;
+        return 0;
     }
 
     QualifiedName tagName = nullQName();
     if (!constructorBuilder->findTagName(type, tagName)) {
-        ec = NAMESPACE_ERR;
-        return;
+        ec = NamespaceError;
+        return 0;
     }
     ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
 
-    if (m_definitions.contains(type)) {
-        ec = INVALID_STATE_ERR;
-        return;
+    if (m_registeredTypeNames.contains(type)) {
+        ec = InvalidStateError;
+        return 0;
     }
 
-    RefPtr<CustomElementCallback> lifecycleCallbacks = constructorBuilder->createCallback(document());
+    ASSERT(!observer.registrationContextWentAway());
+
+    RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuilder->createCallbacks(document);
 
     // Consulting the constructor builder could execute script and
     // kill the document.
-    if (!document()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
-
-    RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(type, tagName.localName(), tagName.namespaceURI(), lifecycleCallbacks);
-
-    if (!constructorBuilder->createConstructor(document(), definition.get())) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    m_definitions.add(definition->type(), definition);
-
-    // Upgrade elements that were waiting for this definition.
-    CustomElementUpgradeCandidateMap::ElementSet upgradeCandidates = m_candidates.takeUpgradeCandidatesFor(definition.get());
-    if (!constructorBuilder->didRegisterDefinition(definition.get(), upgradeCandidates)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    for (CustomElementUpgradeCandidateMap::ElementSet::iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it) {
-        (*it)->setNeedsStyleRecalc(); // :unresolved has changed
-
-        CustomElementCallbackDispatcher::instance().enqueueReadyCallback(lifecycleCallbacks.get(), *it);
-    }
-}
-
-bool CustomElementRegistry::isUnresolved(Element* element) const
-{
-    return m_candidates.contains(element);
-}
-
-PassRefPtr<CustomElementDefinition> CustomElementRegistry::findFor(Element* element) const
-{
-    ASSERT(element->document()->registry() == this);
-
-    if (!element->isCustomElement())
+    if (observer.registrationContextWentAway()) {
+        ec = InvalidStateError;
         return 0;
-
-    // When a custom tag and a type extension are provided as element
-    // names at the same time, the custom tag takes precedence.
-    if (isCustomTagName(element->localName())) {
-        if (RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(element->localName(), element->namespaceURI()))
-            return definition->isTypeExtension() ? 0 : definition.release();
     }
 
-    // FIXME: Casually consulting the "is" attribute is dangerous if
-    // it could have changed since element creation.
-    const AtomicString& isValue = element->getAttribute(HTMLNames::isAttr);
-    if (RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(isValue, element->namespaceURI()))
-        return definition->isTypeExtension() && definition->name() == element->localName() ? definition.release() : 0;
+    const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagName.localName());
+    RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks);
 
-    return 0;
-}
-
-PassRefPtr<CustomElementDefinition> CustomElementRegistry::findAndCheckNamespace(const AtomicString& type, const AtomicString& namespaceURI) const
-{
-    if (type.isNull())
+    if (!constructorBuilder->createConstructor(document, definition.get())) {
+        ec = NotSupportedError;
         return 0;
-    DefinitionMap::const_iterator it = m_definitions.find(type);
-    if (it == m_definitions.end())
-        return 0;
-    if (it->value->namespaceURI() != namespaceURI)
-        return 0;
-    return it->value;
-}
-
-PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const QualifiedName& tagName)
-{
-    if (!document())
-        return 0;
-
-    ASSERT(isCustomTagName(tagName.localName()));
-
-    RefPtr<Element> element;
-
-    if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI())
-        element = HTMLElement::create(tagName, document());
-    else if (SVGNames::svgNamespaceURI == tagName.namespaceURI())
-        element = SVGElement::create(tagName, document());
-    else
-        return Element::create(tagName, document());
-
-    element->setIsCustomElement();
-
-    RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(tagName.localName(), tagName.namespaceURI());
-    if (!definition || definition->isTypeExtension()) {
-        // If a definition for a type extension was available, this
-        // custom tag element will be unresolved in perpetuity.
-        didCreateUnresolvedElement(CustomElementDefinition::CustomTag, tagName.localName(), element.get());
-    } else {
-        didCreateCustomTagElement(definition.get(), element.get());
     }
 
-    return element.release();
-}
+    m_definitions.add(descriptor, definition);
+    m_registeredTypeNames.add(descriptor.type());
 
-void CustomElementRegistry::didGiveTypeExtension(Element* element, const AtomicString& type)
-{
-    if (!element->isHTMLElement() && !element->isSVGElement())
-        return;
-    element->setIsCustomElement();
-    RefPtr<CustomElementDefinition> definition = findFor(element);
-    if (!definition || !definition->isTypeExtension()) {
-        // If a definition for a custom tag was available, this type
-        // extension element will be unresolved in perpetuity.
-        didCreateUnresolvedElement(CustomElementDefinition::TypeExtension, type, element);
-    } else {
-        CustomElementCallbackDispatcher::instance().enqueueReadyCallback(definition->callback(), element);
+    if (!constructorBuilder->didRegisterDefinition(definition.get())) {
+        ec = NotSupportedError;
+        return 0;
     }
+
+    return definition.get();
 }
 
-void CustomElementRegistry::didCreateCustomTagElement(CustomElementDefinition* definition, Element* element)
+CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescriptor& descriptor) const
 {
-    CustomElementCallbackDispatcher::instance().enqueueReadyCallback(definition->callback(), element);
+    return m_definitions.get(descriptor);
 }
 
-void CustomElementRegistry::didCreateUnresolvedElement(CustomElementDefinition::CustomElementKind kind, const AtomicString& type, Element* element)
-{
-    m_candidates.add(kind, type, element);
-}
-
-void CustomElementRegistry::customElementWasDestroyed(Element* element)
-{
-    ASSERT(element->isCustomElement());
-    m_candidates.remove(element);
-}
-
-inline Document* CustomElementRegistry::document() const
-{
-    return toDocument(m_scriptExecutionContext);
-}
-
-}
+} // namespace WebCore
diff --git a/Source/core/dom/CustomElementRegistry.h b/Source/core/dom/CustomElementRegistry.h
index 525618a..f4195a7 100644
--- a/Source/core/dom/CustomElementRegistry.h
+++ b/Source/core/dom/CustomElementRegistry.h
@@ -31,12 +31,12 @@
 #ifndef CustomElementRegistry_h
 #define CustomElementRegistry_h
 
-#include "core/dom/ContextLifecycleObserver.h"
-#include "core/dom/CustomElementUpgradeCandidateMap.h"
+#include "core/dom/CustomElementDefinition.h"
+#include "core/dom/CustomElementDescriptor.h"
+#include "core/dom/CustomElementDescriptorHash.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/QualifiedName.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
 #include "wtf/RefPtr.h"
 #include "wtf/text/AtomicString.h"
 #include "wtf/text/AtomicStringHash.h"
@@ -44,43 +44,23 @@
 namespace WebCore {
 
 class CustomElementConstructorBuilder;
-class CustomElementDefinition;
 class Document;
-class Element;
 
-void setTypeExtension(Element*, const AtomicString& typeExtension);
+class CustomElementRegistry {
+    WTF_MAKE_NONCOPYABLE(CustomElementRegistry);
+protected:
+    friend class ActiveRegistrationContext;
 
-class CustomElementRegistry : public RefCounted<CustomElementRegistry>, public ContextLifecycleObserver {
-    WTF_MAKE_NONCOPYABLE(CustomElementRegistry); WTF_MAKE_FAST_ALLOCATED;
-public:
-    explicit CustomElementRegistry(Document*);
+    CustomElementRegistry() { }
     virtual ~CustomElementRegistry() { }
 
-    void registerElement(CustomElementConstructorBuilder*, const AtomicString& name, ExceptionCode&);
-
-    bool isUnresolved(Element*) const;
-    PassRefPtr<CustomElementDefinition> findFor(Element*) const;
-
-    PassRefPtr<Element> createCustomTagElement(const QualifiedName& localName);
-
-    Document* document() const;
-
-    void didGiveTypeExtension(Element*, const AtomicString&);
-    void customElementWasDestroyed(Element*);
-
-    static bool isCustomTagName(const AtomicString& name) { return isValidName(name); }
+    CustomElementDefinition* registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& name, ExceptionCode&);
+    CustomElementDefinition* find(const CustomElementDescriptor&) const;
 
 private:
-    typedef HashMap<AtomicString, RefPtr<CustomElementDefinition> > DefinitionMap;
-    static bool isValidName(const AtomicString&);
-
-    PassRefPtr<CustomElementDefinition> findAndCheckNamespace(const AtomicString& type, const AtomicString& namespaceURI) const;
-
-    void didCreateCustomTagElement(CustomElementDefinition*, Element*);
-    void didCreateUnresolvedElement(CustomElementDefinition::CustomElementKind, const AtomicString& type, Element*);
-
+    typedef HashMap<CustomElementDescriptor, RefPtr<CustomElementDefinition> > DefinitionMap;
     DefinitionMap m_definitions;
-    CustomElementUpgradeCandidateMap m_candidates;
+    HashSet<AtomicString> m_registeredTypeNames;
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/CustomElementUpgradeCandidateMap.cpp b/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
index 6b9c543..0c3049a 100644
--- a/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
+++ b/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
@@ -29,63 +29,39 @@
  */
 
 #include "config.h"
-
 #include "core/dom/CustomElementUpgradeCandidateMap.h"
 
 namespace WebCore {
 
-void CustomElementUpgradeCandidateMap::add(CustomElementDefinition::CustomElementKind kind, const AtomicString& type, Element* element)
+void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descriptor, Element* element)
 {
-    m_unresolvedElements.add(element, RequiredDefinition(kind, type));
+    m_upgradeCandidates.add(element, descriptor);
 
-    UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(type);
+    UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descriptor);
     if (it == m_unresolvedDefinitions.end())
-        it = m_unresolvedDefinitions.add(type, ElementSet()).iterator;
+        it = m_unresolvedDefinitions.add(descriptor, ElementSet()).iterator;
     it->value.add(element);
 }
 
-bool CustomElementUpgradeCandidateMap::contains(Element* element) const
-{
-    return m_unresolvedElements.contains(element);
-}
-
 void CustomElementUpgradeCandidateMap::remove(Element* element)
 {
-    UnresolvedElementMap::iterator it = m_unresolvedElements.find(element);
-    if (it == m_unresolvedElements.end())
+    UpgradeCandidateMap::iterator it = m_upgradeCandidates.find(element);
+    if (it == m_upgradeCandidates.end())
         return;
 
-    const AtomicString& type = it->value.second;
-    m_unresolvedDefinitions.get(type).remove(element);
-    m_unresolvedElements.remove(it);
+    const CustomElementDescriptor& descriptor = it->value;
+    m_unresolvedDefinitions.get(descriptor).remove(element);
+    m_upgradeCandidates.remove(it);
 }
 
-CustomElementUpgradeCandidateMap::ElementSet CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor(CustomElementDefinition* definition)
+ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor(const CustomElementDescriptor& descriptor)
 {
-    UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(definition->type());
-    if (it == m_unresolvedDefinitions.end())
-        return ElementSet();
+    const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descriptor);
 
-    const ElementSet& candidatesForThisType = it->value;
-    ElementSet matchingCandidates;
+    for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate)
+        m_upgradeCandidates.remove(*candidate);
 
-    // Filter the set based on whether the definition matches
-    for (ElementSet::const_iterator candidate = candidatesForThisType.begin(); candidate != candidatesForThisType.end(); ++candidate) {
-        if (matches(definition, *candidate)) {
-            matchingCandidates.add(*candidate);
-            m_unresolvedElements.remove(*candidate);
-        }
-    }
-
-    m_unresolvedDefinitions.remove(it);
-    return matchingCandidates;
-}
-
-bool CustomElementUpgradeCandidateMap::matches(CustomElementDefinition* definition, Element* element)
-{
-    ASSERT(m_unresolvedElements.contains(element));
-    const RequiredDefinition& requirement = m_unresolvedElements.get(element);
-    return definition->kind() == requirement.first && definition->type() == requirement.second && definition->namespaceURI() == element->namespaceURI() && definition->name() == element->localName();
+    return candidates;
 }
 
 }
diff --git a/Source/core/dom/CustomElementUpgradeCandidateMap.h b/Source/core/dom/CustomElementUpgradeCandidateMap.h
index 84d3d91..bf22e7d 100644
--- a/Source/core/dom/CustomElementUpgradeCandidateMap.h
+++ b/Source/core/dom/CustomElementUpgradeCandidateMap.h
@@ -31,40 +31,35 @@
 #ifndef CustomElementUpgradeCandidateMap_h
 #define CustomElementUpgradeCandidateMap_h
 
-#include "core/dom/CustomElementDefinition.h"
-#include "core/dom/Element.h"
+#include "core/dom/CustomElementDescriptor.h"
+#include "core/dom/CustomElementDescriptorHash.h"
 #include "wtf/HashMap.h"
-#include "wtf/HashSet.h"
+#include "wtf/ListHashSet.h"
 #include "wtf/Noncopyable.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/AtomicStringHash.h"
 
 namespace WebCore {
 
+class Element;
+
 class CustomElementUpgradeCandidateMap {
     WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap);
 public:
     CustomElementUpgradeCandidateMap() { }
 
-    typedef HashSet<Element*> ElementSet;
-
-    void add(CustomElementDefinition::CustomElementKind, const AtomicString& type, Element*);
-    bool contains(Element*) const;
+    void add(const CustomElementDescriptor&, Element*);
     void remove(Element*);
-    ElementSet takeUpgradeCandidatesFor(CustomElementDefinition*);
+
+    typedef ListHashSet<Element*> ElementSet;
+    ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&);
 
 private:
-    typedef std::pair<CustomElementDefinition::CustomElementKind, AtomicString> RequiredDefinition;
-    typedef HashMap<Element*, RequiredDefinition> UnresolvedElementMap;
-    typedef HashMap<AtomicString, ElementSet> UnresolvedDefinitionMap;
+    typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap;
+    UpgradeCandidateMap m_upgradeCandidates;
 
-    bool matches(CustomElementDefinition*, Element*);
-
-    UnresolvedElementMap m_unresolvedElements;
+    typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap;
     UnresolvedDefinitionMap m_unresolvedDefinitions;
 };
 
 }
 
 #endif // CustomElementUpgradeCandidateMap_h
-
diff --git a/Source/core/dom/CustomEvent.cpp b/Source/core/dom/CustomEvent.cpp
index c7e67b3..bad25d2 100644
--- a/Source/core/dom/CustomEvent.cpp
+++ b/Source/core/dom/CustomEvent.cpp
@@ -30,10 +30,6 @@
 
 namespace WebCore {
 
-CustomEventInit::CustomEventInit()
-{
-}
-
 CustomEvent::CustomEvent()
 {
     ScriptWrappable::init(this);
@@ -41,7 +37,6 @@
 
 CustomEvent::CustomEvent(const AtomicString& type, const CustomEventInit& initializer)
     : Event(type, initializer)
-    , m_detail(initializer.detail)
 {
     ScriptWrappable::init(this);
 }
@@ -50,20 +45,8 @@
 {
 }
 
-void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& detail)
-{
-    ASSERT(!m_serializedScriptValue.get());
-    if (dispatched())
-        return;
-
-    initEvent(type, canBubble, cancelable);
-
-    m_detail = detail;
-}
-
 void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> serializedScriptValue)
 {
-    ASSERT(m_detail.hasNoValue());
     if (dispatched())
         return;
 
diff --git a/Source/core/dom/CustomEvent.h b/Source/core/dom/CustomEvent.h
index 6afc0ae..22466bf 100644
--- a/Source/core/dom/CustomEvent.h
+++ b/Source/core/dom/CustomEvent.h
@@ -32,11 +32,7 @@
 
 namespace WebCore {
 
-struct CustomEventInit : public EventInit {
-    CustomEventInit();
-
-    ScriptValue detail;
-};
+typedef EventInit CustomEventInit;
 
 class CustomEvent : public Event {
 public:
@@ -52,19 +48,16 @@
         return adoptRef(new CustomEvent(type, initializer));
     }
 
-    void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& detail);
     void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue>);
 
     virtual const AtomicString& interfaceName() const;
 
-    const ScriptValue& detail() const { return m_detail; }
-    PassRefPtr<SerializedScriptValue> serializedScriptValue() { return m_serializedScriptValue; }
+    SerializedScriptValue* serializedScriptValue() { return m_serializedScriptValue.get(); }
 
 private:
     CustomEvent();
     CustomEvent(const AtomicString& type, const CustomEventInit& initializer);
 
-    ScriptValue m_detail;
     RefPtr<SerializedScriptValue> m_serializedScriptValue;
 };
 
diff --git a/Source/core/dom/CustomEvent.idl b/Source/core/dom/CustomEvent.idl
index f4a67e4..ed86fda 100644
--- a/Source/core/dom/CustomEvent.idl
+++ b/Source/core/dom/CustomEvent.idl
@@ -28,8 +28,8 @@
 ] interface CustomEvent : Event {
     [InitializedByEventConstructor, Custom] readonly attribute any detail;
 
-    void initCustomEvent([Default=Undefined] optional DOMString typeArg, 
-                         [Default=Undefined] optional boolean canBubbleArg, 
-                         [Default=Undefined] optional boolean cancelableArg, 
-                         [Default=Undefined] optional any detailArg);
+    [Custom] void initCustomEvent([Default=Undefined] optional DOMString typeArg,
+                                  [Default=Undefined] optional boolean canBubbleArg,
+                                  [Default=Undefined] optional boolean cancelableArg,
+                                  [Default=Undefined] optional any detailArg);
 };
diff --git a/Source/core/dom/DOMError.cpp b/Source/core/dom/DOMError.cpp
index a8f316c..e77d271 100644
--- a/Source/core/dom/DOMError.cpp
+++ b/Source/core/dom/DOMError.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/dom/DOMError.h"
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DOMException.cpp b/Source/core/dom/DOMException.cpp
index ff41cd3..b1dc214 100644
--- a/Source/core/dom/DOMException.cpp
+++ b/Source/core/dom/DOMException.cpp
@@ -48,7 +48,7 @@
     { "InUseAttributeError", "An attempt was made to add an attribute that is already in use elsewhere.", 10 },
     { "InvalidStateError", "An attempt was made to use an object that is not, or is no longer, usable.", 11 },
     { "SyntaxError", "An invalid or illegal string was specified.", 12 },
-    { "InvalidModificationError", "An attempt was made to modify the type of the underlying object.", 13 },
+    { "InvalidModificationError", "The object can not be modified in this way.", 13 },
     { "NamespaceError", "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces.", 14 },
     { "InvalidAccessError", "A parameter or an operation was not supported by the underlying object.", 15 },
     { "TypeMismatchError", "The type of an object was incompatible with the expected type of the parameter associated to the object.", 17 },
@@ -61,12 +61,7 @@
     { "InvalidNodeTypeError", "The supplied node is invalid or has an invalid ancestor for this operation.", 24 },
     { "DataCloneError", "An object could not be cloned.", 25 },
 
-    // These are IDB-specific errors.
-    // FIXME: NotFoundError is duplicated to have a more specific error message.
-    // https://code.google.com/p/chromium/issues/detail?id=252233
-    { "NotFoundError", "An operation failed because the requested database object could not be found.", 8 },
-
-    // More IDB-specific errors.
+    // Indexed DB
     { "UnknownError", "An unknown error occurred within Indexed Database.", 0 },
     { "ConstraintError", "A mutation operation in the transaction failed because a constraint was not satisfied.", 0 },
     { "DataError", "The data provided does not meet requirements.", 0 },
@@ -83,53 +78,36 @@
     { "NoModificationAllowedError", "An attempt was made to write to a file or directory which could not be modified due to the state of the underlying filesystem.", 7 },
     { "InvalidStateError", "An operation that depends on state cached in an interface object was made but the state had changed since it was read from disk.", 11 },
     { "SyntaxError", "An invalid or unsupported argument was given, like an invalid line ending specifier.", 12 },
-    { "InvalidModificationError", "The modification request was illegal.", 13 },
     { "QuotaExceededError", "The operation failed because it would cause the application to exceed its storage quota.", 22 },
     { "TypeMismatchError", "The path supplied exists, but was not an entry of requested type.", 17 },
     { "PathExistsError", "An attempt was made to create a file or directory where an element already exists.", 0 },
 
     // SQL
-    { "UnknownError", "The operation failed for reasons unrelated to the database.", 0 },
     { "DatabaseError", "The operation failed for some reason related to the database.", 0 },
-    { "VersionError", "The actual database version did not match the expected version.", 0 },
-    { "TooLargeError", "Data returned from the database is too large.", 0 },
-    { "QuotaExceededError", "Quota was exceeded.", 22 },
-    { "SyntaxError", "Invalid or unauthorized statement; or the number of arguments did not match the number of ? placeholders.", 12 },
-    { "ConstraintError", "A constraint was violated.", 0 },
-    { "TimeoutError", "A transaction lock could not be acquired in a reasonable time.", 23 },
 };
 
 static const CoreException* getErrorEntry(ExceptionCode ec)
 {
     size_t tableSize = WTF_ARRAY_LENGTH(coreExceptions);
-    size_t tableIndex = ec - INDEX_SIZE_ERR;
+    size_t tableIndex = ec - IndexSizeError;
 
     return tableIndex < tableSize ? &coreExceptions[tableIndex] : 0;
 }
 
-DOMException::DOMException(ExceptionCode ec)
+DOMException::DOMException(unsigned short code, const char* name, const char * message)
 {
-    const CoreException* entry = getErrorEntry(ec);
-    ASSERT(entry);
-    if (!entry) {
-        m_code = 0;
-        m_name = "UnknownError";
-        m_message = "Unknown Error";
-    } else {
-        m_code = entry->code;
-        if (entry->name)
-            m_name = entry->name;
-        else
-            m_name = "Error";
-        m_message = entry->message;
-    }
-
+    ASSERT(name);
+    m_code = code;
+    m_name = name;
+    m_message = message;
     ScriptWrappable::init(this);
 }
 
-PassRefPtr<DOMException> DOMException::create(ExceptionCode ec)
+PassRefPtr<DOMException> DOMException::create(ExceptionCode ec, const char* message)
 {
-    return adoptRef(new DOMException(ec));
+    const CoreException* entry = getErrorEntry(ec);
+    ASSERT(entry);
+    return adoptRef(new DOMException(entry->code, entry->name ? entry->name : "Error", message ? message : entry->message));
 }
 
 String DOMException::toString() const
diff --git a/Source/core/dom/DOMException.h b/Source/core/dom/DOMException.h
index 88fbebb..06e4cbd 100644
--- a/Source/core/dom/DOMException.h
+++ b/Source/core/dom/DOMException.h
@@ -39,7 +39,7 @@
 
 class DOMException : public RefCounted<DOMException>, public ScriptWrappable {
 public:
-    static PassRefPtr<DOMException> create(ExceptionCode);
+    static PassRefPtr<DOMException> create(ExceptionCode, const char* message = 0);
 
     unsigned short code() const { return m_code; }
     String name() const { return m_name; }
@@ -52,7 +52,7 @@
     static unsigned short getLegacyErrorCode(ExceptionCode);
 
 private:
-    explicit DOMException(ExceptionCode);
+    DOMException(unsigned short m_code, const char* name, const char* message);
 
     unsigned short m_code;
     String m_name;
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index d9e8989..9edaf7a 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -255,11 +255,11 @@
 {
     RefPtr<Document> doc;
     if (namespaceURI == SVGNames::svgNamespaceURI)
-        doc = SVGDocument::create(0, KURL());
+        doc = SVGDocument::create();
     else if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
-        doc = Document::createXHTML(0, KURL());
+        doc = Document::createXHTML();
     else
-        doc = Document::create(0, KURL());
+        doc = Document::create();
 
     doc->setSecurityOrigin(m_document->securityOrigin());
     doc->setContextFeatures(m_document->contextFeatures());
@@ -271,13 +271,13 @@
             return 0;
     }
 
-    // WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was
+    // WrongDocumentError: Raised if doctype has already been used with a different document or was
     // created from a different implementation.
     // Hixie's interpretation of the DOM Core spec suggests we should prefer
-    // other exceptions to WRONG_DOCUMENT_ERR (based on order mentioned in spec),
+    // other exceptions to WrongDocumentError (based on order mentioned in spec),
     // but this matches the new DOM Core spec (http://www.w3.org/TR/domcore/).
     if (doctype && doctype->document()) {
-        ec = WRONG_DOCUMENT_ERR;
+        ec = WrongDocumentError;
         return 0;
     }
 
@@ -372,7 +372,7 @@
 
 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
 {
-    RefPtr<HTMLDocument> d = HTMLDocument::create(0, KURL());
+    RefPtr<HTMLDocument> d = HTMLDocument::create();
     d->open();
     d->write("<!doctype html><html><body></body></html>");
     if (!title.isNull())
@@ -385,13 +385,13 @@
 PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame* frame, const KURL& url, bool inViewSourceMode)
 {
     if (inViewSourceMode)
-        return HTMLViewSourceDocument::create(frame, url, type);
+        return HTMLViewSourceDocument::create(DocumentInit(url, frame), type);
 
     // Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those.
     if (type == "text/html")
-        return HTMLDocument::create(frame, url);
+        return HTMLDocument::create(DocumentInit(url, frame));
     if (type == "application/xhtml+xml")
-        return Document::createXHTML(frame, url);
+        return Document::createXHTML(DocumentInit(url, frame));
 
     PluginData* pluginData = 0;
     if (frame && frame->page() && frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
@@ -400,27 +400,27 @@
     // PDF is one image type for which a plugin can override built-in support.
     // We do not want QuickTime to take over all image types, obviously.
     if ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type))
-        return PluginDocument::create(frame, url);
+        return PluginDocument::create(DocumentInit(url, frame));
     if (Image::supportsType(type))
-        return ImageDocument::create(frame, url);
+        return ImageDocument::create(DocumentInit(url, frame));
 
     // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
     if (HTMLMediaElement::supportsType(ContentType(type)))
-        return MediaDocument::create(frame, url);
+        return MediaDocument::create(DocumentInit(url, frame));
 
     // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed.
     // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle,
     // and also serves as an optimization to prevent loading the plug-in database in the common case.
     if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type)) 
-        return PluginDocument::create(frame, url);
+        return PluginDocument::create(DocumentInit(url, frame));
     if (isTextMIMEType(type))
-        return TextDocument::create(frame, url);
+        return TextDocument::create(DocumentInit(url, frame));
     if (type == "image/svg+xml")
-        return SVGDocument::create(frame, url);
+        return SVGDocument::create(DocumentInit(url, frame));
     if (isXMLMIMEType(type))
-        return Document::create(frame, url);
+        return Document::create(DocumentInit(url, frame));
 
-    return HTMLDocument::create(frame, url);
+    return HTMLDocument::create(DocumentInit(url, frame));
 }
 
 }
diff --git a/Source/core/dom/DOMNamedFlowCollection.h b/Source/core/dom/DOMNamedFlowCollection.h
index 0a87b2b..c7e6a6c 100644
--- a/Source/core/dom/DOMNamedFlowCollection.h
+++ b/Source/core/dom/DOMNamedFlowCollection.h
@@ -31,10 +31,10 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/NamedFlowCollection.h"
-#include <wtf/ListHashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/ListHashSet.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DOMStringList.h b/Source/core/dom/DOMStringList.h
index f4dddd3..44de344 100644
--- a/Source/core/dom/DOMStringList.h
+++ b/Source/core/dom/DOMStringList.h
@@ -27,10 +27,10 @@
 #define DOMStringList_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DOMStringMap.h b/Source/core/dom/DOMStringMap.h
index 90a6019..3408945 100644
--- a/Source/core/dom/DOMStringMap.h
+++ b/Source/core/dom/DOMStringMap.h
@@ -27,9 +27,9 @@
 #define DOMStringMap_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DatasetDOMStringMap.cpp b/Source/core/dom/DatasetDOMStringMap.cpp
index d1db9f1..b959ec0 100644
--- a/Source/core/dom/DatasetDOMStringMap.cpp
+++ b/Source/core/dom/DatasetDOMStringMap.cpp
@@ -29,8 +29,8 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCode.h"
-#include <wtf/ASCIICType.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/ASCIICType.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -179,7 +179,7 @@
 void DatasetDOMStringMap::setItem(const String& name, const String& value, ExceptionCode& ec)
 {
     if (!isValidPropertyName(name)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
@@ -189,7 +189,7 @@
 void DatasetDOMStringMap::deleteItem(const String& name, ExceptionCode& ec)
 {
     if (!isValidPropertyName(name)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
diff --git a/Source/core/dom/DatasetDOMStringMap.h b/Source/core/dom/DatasetDOMStringMap.h
index 8788b6e..c716181 100644
--- a/Source/core/dom/DatasetDOMStringMap.h
+++ b/Source/core/dom/DatasetDOMStringMap.h
@@ -27,7 +27,7 @@
 #define DatasetDOMStringMap_h
 
 #include "core/dom/DOMStringMap.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DeviceOrientationData.h b/Source/core/dom/DeviceOrientationData.h
index 1df9b65..2c37a13 100644
--- a/Source/core/dom/DeviceOrientationData.h
+++ b/Source/core/dom/DeviceOrientationData.h
@@ -26,8 +26,8 @@
 #ifndef DeviceOrientationData_h
 #define DeviceOrientationData_h
 
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index b296bc1..7b3cad2 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -52,7 +52,7 @@
 #include "core/dom/CDATASection.h"
 #include "core/dom/Comment.h"
 #include "core/dom/ContextFeatures.h"
-#include "core/dom/CustomElementRegistry.h"
+#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/DOMNamedFlowCollection.h"
 #include "core/dom/DocumentEventQueue.h"
@@ -104,8 +104,9 @@
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLIFrameElement.h"
-#include "core/html/HTMLImportsController.h"
+#include "core/html/HTMLImport.h"
 #include "core/html/HTMLLinkElement.h"
 #include "core/html/HTMLNameCollection.h"
 #include "core/html/HTMLScriptElement.h"
@@ -160,10 +161,6 @@
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGStyleElement.h"
 #include "core/workers/SharedWorkerRepository.h"
-#include "core/xml/XPathEvaluator.h"
-#include "core/xml/XPathExpression.h"
-#include "core/xml/XPathNSResolver.h"
-#include "core/xml/XPathResult.h"
 #include "core/xml/XSLTProcessor.h"
 #include "core/xml/parser/XMLDocumentParser.h"
 #include "weborigin/SchemeRegistry.h"
@@ -188,8 +185,6 @@
 
 using namespace HTMLNames;
 
-// #define INSTRUMENT_LAYOUT_SCHEDULING 1
-
 static const double cDefaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
 
 static const unsigned cMaxWriteRecursionDepth = 21;
@@ -369,11 +364,11 @@
         if (document->focusedNode()->renderer() && document->focusedNode()->renderer()->needsLayout())
             return;
         if (!document->focusedNode()->isFocusable())
-            document->setFocusedNode(0);
+            document->setFocusedElement(0);
     }
 };
 
-Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentClasses)
+Document::Document(const DocumentInit& initializer, DocumentClassFlags documentClasses)
     : ContainerNode(0, CreateDocument)
     , TreeScope(this)
     , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired)
@@ -383,8 +378,9 @@
     , m_needsNotifyRemoveAllPendingStylesheet(false)
     , m_hasNodesWithPlaceholderStyle(false)
     , m_pendingSheetLayout(NoLayoutWithPendingSheets)
-    , m_frame(frame)
+    , m_frame(initializer.frame())
     , m_domWindow(0)
+    , m_import(initializer.import())
     , m_activeParserCount(0)
     , m_contextFeatures(ContextFeatures::defaultSwitch())
     , m_wellFormed(false)
@@ -393,7 +389,6 @@
     , m_ignoreAutofocus(false)
     , m_compatibilityMode(NoQuirksMode)
     , m_compatibilityModeLocked(false)
-    , m_textColor(Color::black)
     , m_didPostCheckFocusedNodeTask(false)
     , m_domTreeVersion(++s_globalTreeVersion)
     , m_listenerTypes(0)
@@ -426,7 +421,6 @@
     , m_designMode(inherit)
     , m_hasAnnotatedRegions(false)
     , m_annotatedRegionsDirty(false)
-    , m_accessKeyMapValid(false)
     , m_useSecureKeyboardEntryWhenActive(false)
     , m_documentClasses(documentClasses)
     , m_isViewSource(false)
@@ -476,20 +470,23 @@
     // See fast/dom/early-frame-url.html
     // and fast/dom/location-new-window-no-crash.html, respectively.
     // FIXME: Can/should we unify this behavior?
-    if ((m_frame && m_frame->ownerElement()) || !url.isEmpty())
-        setURL(url);
+    if (initializer.shouldSetURL())
+        setURL(initializer.url());
 
-    resetLinkColor();
-    resetVisitedLinkColor();
-    resetActiveLinkColor();
-
-    initSecurityContext();
+    initSecurityContext(initializer);
     initDNSPrefetch();
 
     for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++)
         m_nodeListCounts[i] = 0;
 
     InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
+
+    bool shouldProcessCustomElements =
+        (isHTMLDocument() || isXHTMLDocument())
+        && RuntimeEnabledFeatures::customDOMElementsEnabled();
+    m_registrationContext = shouldProcessCustomElements
+        ? CustomElementRegistrationContext::create()
+        : CustomElementRegistrationContext::nullRegistrationContext();
 }
 
 static void histogramMutationEventUsage(const unsigned short& listenerTypes)
@@ -552,6 +549,11 @@
     if (m_styleSheetList)
         m_styleSheetList->detachFromDocument();
 
+    if (m_import) {
+        m_import->wasDetachedFromDocument();
+        m_import = 0;
+    }
+
     m_styleSheetCollection.clear();
 
     if (m_elemSheet)
@@ -596,8 +598,12 @@
 
     detachParser();
 
-    m_registry.clear();
-    m_imports.clear();
+    m_registrationContext.clear();
+
+    if (m_import) {
+        m_import->wasDetachedFromDocument();
+        m_import = 0;
+    }
 
     // removeDetachedChildren() doesn't always unregister IDs,
     // so tear down scope information upfront to avoid having stale references in the map.
@@ -623,37 +629,6 @@
     return TreeScope::getElementById(id);
 }
 
-Element* Document::getElementByAccessKey(const String& key)
-{
-    if (key.isEmpty())
-        return 0;
-    if (!m_accessKeyMapValid) {
-        buildAccessKeyMap(this);
-        m_accessKeyMapValid = true;
-    }
-    return m_elementsByAccessKey.get(key.impl());
-}
-
-void Document::buildAccessKeyMap(TreeScope* scope)
-{
-    ASSERT(scope);
-    Node* rootNode = scope->rootNode();
-    for (Element* element = ElementTraversal::firstWithin(rootNode); element; element = ElementTraversal::next(element, rootNode)) {
-        const AtomicString& accessKey = element->getAttribute(accesskeyAttr);
-        if (!accessKey.isEmpty())
-            m_elementsByAccessKey.set(accessKey.impl(), element);
-
-        for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root->olderShadowRoot())
-            buildAccessKeyMap(root);
-    }
-}
-
-void Document::invalidateAccessKeyMap()
-{
-    m_accessKeyMapValid = false;
-    m_elementsByAccessKey.clear();
-}
-
 SelectorQueryCache* Document::selectorQueryCache()
 {
     if (!m_selectorQueryCache)
@@ -687,21 +662,6 @@
     return inQuirksMode() ? "BackCompat" : "CSS1Compat";
 }
 
-void Document::resetLinkColor()
-{
-    m_linkColor = Color(0, 0, 238);
-}
-
-void Document::resetVisitedLinkColor()
-{
-    m_visitedLinkColor = Color(85, 26, 139);
-}
-
-void Document::resetActiveLinkColor()
-{
-    m_activeLinkColor.setNamedColor("red");
-}
-
 void Document::setDocType(PassRefPtr<DocumentType> docType)
 {
     // This should never be called more than once.
@@ -725,7 +685,7 @@
 
 bool Document::hasManifest() const
 {
-    return documentElement() && documentElement()->hasTagName(htmlTag) && documentElement()->hasAttribute(manifestAttr);
+    return documentElement() && isHTMLHtmlElement(documentElement()) && documentElement()->hasAttribute(manifestAttr);
 }
 
 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
@@ -743,7 +703,7 @@
 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionCode& ec)
 {
     if (!isValidName(name)) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return 0;
     }
 
@@ -756,21 +716,19 @@
 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionCode& ec)
 {
     if (!isValidName(localName)) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return 0;
     }
 
     RefPtr<Element> element;
 
-    if (CustomElementRegistry::isCustomTagName(localName))
-        element = ensureCustomElementRegistry()->createCustomTagElement(QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
+    if (CustomElementRegistrationContext::isCustomTagName(localName))
+        element = registrationContext()->createCustomTagElement(this, QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
     else
         element = createElement(localName, ec);
 
-    if (!typeExtension.isNull()) {
-        setTypeExtension(element.get(), typeExtension);
-        ensureCustomElementRegistry()->didGiveTypeExtension(element.get(), typeExtension);
-    }
+    if (!typeExtension.isNull())
+        registrationContext()->setTypeExtension(element.get(), typeExtension);
 
     return element;
 }
@@ -783,20 +741,18 @@
 
     QualifiedName qName(prefix, localName, namespaceURI);
     if (!hasValidNamespaceForElements(qName)) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return 0;
     }
 
     RefPtr<Element> element;
-    if (CustomElementRegistry::isCustomTagName(qName.localName()))
-        element = ensureCustomElementRegistry()->createCustomTagElement(qName);
+    if (CustomElementRegistrationContext::isCustomTagName(qName.localName()))
+        element = registrationContext()->createCustomTagElement(this, qName);
     else
         element = createElementNS(namespaceURI, qualifiedName, ec);
 
-    if (!typeExtension.isNull()) {
-        setTypeExtension(element.get(), typeExtension);
-        ensureCustomElementRegistry()->didGiveTypeExtension(element.get(), typeExtension);
-    }
+    if (!typeExtension.isNull())
+        registrationContext()->setTypeExtension(element.get(), typeExtension);
 
     return element;
 }
@@ -808,29 +764,15 @@
 
 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionCode& ec)
 {
-    if (!isHTMLDocument() && !isXHTMLDocument()) {
-        ec = NOT_SUPPORTED_ERR;
-        return ScriptValue();
-    }
-
     CustomElementConstructorBuilder constructorBuilder(state, &options);
-    ensureCustomElementRegistry()->registerElement(&constructorBuilder, name, ec);
+    registrationContext()->registerElement(this, &constructorBuilder, name, ec);
     return constructorBuilder.bindingsReturnValue();
 }
 
-CustomElementRegistry* Document::ensureCustomElementRegistry()
+void Document::setImport(HTMLImport* import)
 {
-    if (!m_registry) {
-        ASSERT(isHTMLDocument() || isXHTMLDocument());
-        m_registry = adoptRef(new CustomElementRegistry(this));
-    }
-    return m_registry.get();
-}
-
-void Document::setImports(PassRefPtr<HTMLImportsController> imports)
-{
-    ASSERT(!m_imports);
-    m_imports = imports;
+    ASSERT(!m_import || !import);
+    m_import = import;
 }
 
 void Document::didLoadAllImports()
@@ -840,7 +782,7 @@
 
 bool Document::haveImportsLoaded() const
 {
-    return !m_imports || m_imports->haveLoaded();
+    return !m_import || m_import->haveChildrenLoaded();
 }
 
 PassRefPtr<DocumentFragment> Document::createDocumentFragment()
@@ -861,7 +803,7 @@
 PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionCode& ec)
 {
     if (isHTMLDocument()) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return CDATASection::create(this, data);
@@ -870,11 +812,11 @@
 PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionCode& ec)
 {
     if (!isValidName(target)) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return 0;
     }
     if (isHTMLDocument()) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return ProcessingInstruction::create(this, target, data);
@@ -895,7 +837,7 @@
     ec = 0;
 
     if (!importedNode) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -913,7 +855,7 @@
         // FIXME: The following check might be unnecessary. Is it possible that
         // oldElement has mismatched prefix/namespace?
         if (!hasValidNamespaceForElements(oldElement->tagQName())) {
-            ec = NAMESPACE_ERR;
+            ec = NamespaceError;
             return 0;
         }
         RefPtr<Element> newElement = createElement(oldElement->tagQName(), false);
@@ -965,15 +907,14 @@
     case XPATH_NAMESPACE_NODE:
         break;
     }
-    ec = NOT_SUPPORTED_ERR;
+    ec = NotSupportedError;
     return 0;
 }
 
-
 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
 {
     if (!source) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -985,7 +926,7 @@
     case DOCUMENT_NODE:
     case DOCUMENT_TYPE_NODE:
     case XPATH_NAMESPACE_NODE:
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     case ATTRIBUTE_NODE: {
         Attr* attr = toAttr(source.get());
@@ -997,14 +938,14 @@
     default:
         if (source->isShadowRoot()) {
             // ShadowRoot cannot disconnect itself from the host node.
-            ec = HIERARCHY_REQUEST_ERR;
+            ec = HierarchyRequestError;
             return 0;
         }
 
         if (source->isFrameOwnerElement()) {
             HTMLFrameOwnerElement* frameOwnerElement = toFrameOwnerElement(source.get());
             if (frame() && frame()->tree()->isDescendantOf(frameOwnerElement->contentFrame())) {
-                ec = HIERARCHY_REQUEST_ERR;
+                ec = HierarchyRequestError;
                 return 0;
             }
         }
@@ -1112,7 +1053,7 @@
 
     QualifiedName qName(prefix, localName, namespaceURI);
     if (!hasValidNamespaceForElements(qName)) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return 0;
     }
 
@@ -1189,19 +1130,19 @@
         return;
     m_contentLanguage = language;
 
-    // Recalculate style so language is used when selecting the initial font.
-    styleResolverChanged(DeferRecalcStyle);
+    // Document's style depends on the content language.
+    scheduleForcedStyleRecalc();
 }
 
 void Document::setXMLVersion(const String& version, ExceptionCode& ec)
 {
     if (!implementation()->hasFeature("XML", String())) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
     if (!XMLDocumentParser::supportsXMLVersion(version)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
@@ -1211,7 +1152,7 @@
 void Document::setXMLStandalone(bool standalone, ExceptionCode& ec)
 {
     if (!implementation()->hasFeature("XML", String())) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
@@ -1382,9 +1323,9 @@
     updateTitle(StringWithDirection(title, LTR));
 
     if (m_titleElement) {
-        ASSERT(m_titleElement->hasTagName(titleTag));
-        if (m_titleElement->hasTagName(titleTag))
-            static_cast<HTMLTitleElement*>(m_titleElement.get())->setText(title);
+        ASSERT(isHTMLTitleElement(m_titleElement.get()));
+        if (isHTMLTitleElement(m_titleElement.get()))
+            toHTMLTitleElement(m_titleElement.get())->setText(title);
     }
 }
 
@@ -1410,12 +1351,13 @@
 
     // Update title based on first title element in the head, if one exists.
     if (HTMLElement* headElement = head()) {
-        for (Node* e = headElement->firstChild(); e; e = e->nextSibling())
-            if (e->hasTagName(titleTag)) {
-                HTMLTitleElement* titleElement = static_cast<HTMLTitleElement*>(e);
+        for (Node* e = headElement->firstChild(); e; e = e->nextSibling()) {
+            if (isHTMLTitleElement(e)) {
+                HTMLTitleElement* titleElement = toHTMLTitleElement(e);
                 setTitleElement(titleElement->textWithDirection(), titleElement);
                 break;
             }
+        }
     }
 
     if (!m_titleElement)
@@ -1510,7 +1452,7 @@
 {
     // FIXME: Probably this should be handled within the bindings layer and TypeError should be thrown.
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
@@ -1519,7 +1461,7 @@
 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionCode& ec)
 {
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     // FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in
@@ -1530,7 +1472,7 @@
 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionCode& ec)
 {
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     // FIXME: Ditto.
@@ -1540,7 +1482,7 @@
 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionCode& ec)
 {
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     // FIXME: Warn if |expandEntityReferences| is specified. This optional argument is deprecated in DOM4.
@@ -1551,7 +1493,7 @@
 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionCode& ec)
 {
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
@@ -1560,7 +1502,7 @@
 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionCode& ec)
 {
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>());
@@ -1569,7 +1511,7 @@
 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionCode& ec)
 {
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return TreeWalker::create(root, whatToShow, filter);
@@ -1579,7 +1521,7 @@
 {
     UNUSED_PARAM(expandEntityReferences);
     if (!root) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
     return TreeWalker::create(root, whatToShow, filter);
@@ -1605,9 +1547,6 @@
 
     ASSERT(childNeedsStyleRecalc() || m_pendingStyleRecalcShouldForce);
 
-    // FIXME: Why on earth is this here? This is clearly misplaced.
-    invalidateAccessKeyMap();
-
     m_styleRecalcTimer.startOneShot(0);
 
     InspectorInstrumentation::didScheduleStyleRecalculation(this);
@@ -1652,7 +1591,7 @@
         return; // Guard against re-entrancy. -dwh
 
     TRACE_EVENT0("webkit", "Document::recalcStyle");
-    TraceEvent::SamplingState0Scope("Blink\0Blink-RecalcStyle");
+    TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "RecalcStyle");
 
     // 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
@@ -1759,8 +1698,8 @@
         return;
 
     bool needsStyleRecalc = hasPendingForcedStyleRecalc();
-    for (Node* n = node; n && !needsStyleRecalc; n = n->parentNode())
-        needsStyleRecalc = n->needsStyleRecalc();
+    for (Node* ancestor = node; ancestor && !needsStyleRecalc; ancestor = ancestor->parentOrShadowHostNode())
+        needsStyleRecalc = ancestor->needsStyleRecalc();
     if (needsStyleRecalc)
         updateStyleIfNeeded();
 }
@@ -1831,24 +1770,18 @@
 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Element* element)
 {
     ASSERT_ARG(element, element->document() == this);
-
-    bool oldIgnore = m_ignorePendingStylesheets;
-    m_ignorePendingStylesheets = true;
-    RefPtr<RenderStyle> style = styleResolver()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
-    m_ignorePendingStylesheets = oldIgnore;
-    return style.release();
+    TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
+    return styleResolver()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
 }
 
 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
 {
-    RefPtr<RenderStyle> style = styleResolver()->styleForPage(pageIndex);
-    return style.release();
+    return styleResolver()->styleForPage(pageIndex);
 }
 
 bool Document::isPageBoxVisible(int pageIndex)
 {
-    RefPtr<RenderStyle> style = styleForPage(pageIndex);
-    return style->visibility() != HIDDEN; // display property doesn't apply to @page.
+    return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page.
 }
 
 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
@@ -2176,45 +2109,39 @@
 
 HTMLElement* Document::body() const
 {
-    Node* de = documentElement();
-    if (!de)
+    if (!documentElement())
         return 0;
 
-    // try to prefer a FRAMESET element over BODY
-    Node* body = 0;
-    for (Node* i = de->firstChild(); i; i = i->nextSibling()) {
-        if (i->hasTagName(framesetTag))
-            return toHTMLElement(i);
-
-        if (i->hasTagName(bodyTag) && !body)
-            body = i;
+    for (Node* child = documentElement()->firstChild(); child; child = child->nextSibling()) {
+        if (child->hasTagName(framesetTag) || child->hasTagName(bodyTag))
+            return toHTMLElement(child);
     }
-    return toHTMLElement(body);
+
+    return 0;
 }
 
 void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionCode& ec)
 {
     RefPtr<HTMLElement> newBody = prpNewBody;
 
-    if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) {
-        ec = HIERARCHY_REQUEST_ERR;
+    if (!newBody || !documentElement()) {
+        ec = HierarchyRequestError;
         return;
     }
 
-    if (newBody->document() && newBody->document() != this) {
-        ec = 0;
-        RefPtr<Node> node = importNode(newBody.get(), true, ec);
-        if (ec)
-            return;
-
-        newBody = toHTMLElement(node.get());
+    if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) {
+        ec = HierarchyRequestError;
+        return;
     }
 
-    HTMLElement* b = body();
-    if (!b)
-        documentElement()->appendChild(newBody.release(), ec);
+    HTMLElement* oldBody = body();
+    if (oldBody == newBody)
+        return;
+
+    if (oldBody)
+        documentElement()->replaceChild(newBody.release(), oldBody, ec, AttachLazily);
     else
-        documentElement()->replaceChild(newBody.release(), b, ec);
+        documentElement()->appendChild(newBody.release(), ec, AttachLazily);
 }
 
 HTMLHeadElement* Document::head()
@@ -2285,7 +2212,7 @@
     detachParser();
 
     Frame* f = frame();
-    if (f)
+    if (f && !RuntimeEnabledFeatures::webAnimationsCSSEnabled())
         f->animation()->resumeAnimationsForDocument(this);
 
     if (f && f->script()->canExecuteScripts(NotAboutToExecuteScript)) {
@@ -2309,10 +2236,6 @@
 
     if (f)
         f->loader()->handledOnloadEvents();
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement())
-        printf("onload fired at %d\n", elapsedTime());
-#endif
 
     // An event handler may have removed the frame
     if (!frame()) {
@@ -2379,11 +2302,6 @@
 
     if (!m_bParsing && view())
         view()->scheduleRelayout();
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement() && !m_bParsing)
-        printf("Parsing finished at %d\n", elapsedTime());
-#endif
 }
 
 bool Document::shouldScheduleLayout()
@@ -2395,7 +2313,7 @@
     //    (b) Only schedule layout once we have a body element.
 
     return (haveStylesheetsLoaded() && body())
-        || (documentElement() && !documentElement()->hasTagName(htmlTag));
+        || (documentElement() && !isHTMLHtmlElement(documentElement()));
 }
 
 bool Document::isLayoutTimerActive()
@@ -2430,11 +2348,6 @@
     if (m_writeRecursionIsTooDeep)
        return;
 
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement())
-        printf("Beginning a document.write at %d\n", elapsedTime());
-#endif
-
     bool hasInsertionPoint = m_parser && m_parser->hasInsertionPoint();
     if (!hasInsertionPoint && m_ignoreDestructiveWriteCount)
         return;
@@ -2444,11 +2357,6 @@
 
     ASSERT(m_parser);
     m_parser->insert(text);
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement())
-        printf("Ending a document.write at %d\n", elapsedTime());
-#endif
 }
 
 void Document::write(const String& text, Document* ownerDocument)
@@ -2537,8 +2445,8 @@
         // Base URL change changes any relative visited links.
         // FIXME: There are other URLs in the tree that would need to be re-evaluated on dynamic base URL change. Style should be invalidated too.
         for (Element* element = ElementTraversal::firstWithin(this); element; element = ElementTraversal::next(element)) {
-            if (element->hasTagName(aTag))
-                static_cast<HTMLAnchorElement*>(element)->invalidateCachedVisitedLinkHash();
+            if (isHTMLAnchorElement(element))
+                toHTMLAnchorElement(element)->invalidateCachedVisitedLinkHash();
         }
     }
 }
@@ -2706,75 +2614,23 @@
     return m_elemSheet.get();
 }
 
-int Document::nodeAbsIndex(Node *node)
-{
-    ASSERT(node->document() == this);
-
-    int absIndex = 0;
-    for (Node* n = node; n && n != this; n = NodeTraversal::previous(n))
-        absIndex++;
-    return absIndex;
-}
-
-Node* Document::nodeWithAbsIndex(int absIndex)
-{
-    Node* n = this;
-    for (int i = 0; n && (i < absIndex); i++)
-        n = NodeTraversal::next(n);
-    return n;
-}
-
 void Document::processHttpEquiv(const String& equiv, const String& content)
 {
     ASSERT(!equiv.isNull() && !content.isNull());
 
-    Frame* frame = this->frame();
-
-    if (equalIgnoringCase(equiv, "default-style")) {
-        // The preferred style set has been overridden as per section
-        // 14.3.2 of the HTML4.0 specification.  We need to update the
-        // sheet used variable and then update our style selector.
-        // For more info, see the test at:
-        // http://www.hixie.ch/tests/evil/css/import/main/preferred.html
-        // -dwh
-        m_styleSheetCollection->setSelectedStylesheetSetName(content);
-        m_styleSheetCollection->setPreferredStylesheetSetName(content);
-        styleResolverChanged(DeferRecalcStyle);
-    } else if (equalIgnoringCase(equiv, "refresh")) {
-        double delay;
-        String url;
-        if (frame && parseHTTPRefresh(content, true, delay, url)) {
-            if (url.isEmpty())
-                url = m_url.string();
-            else
-                url = completeURL(url).string();
-            frame->navigationScheduler()->scheduleRedirect(delay, url);
-        }
-    } else if (equalIgnoringCase(equiv, "set-cookie")) {
-        // FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
-        if (isHTMLDocument()) {
-            // Exception (for sandboxed documents) ignored.
-            toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION);
-        }
-    } else if (equalIgnoringCase(equiv, "content-language"))
+    if (equalIgnoringCase(equiv, "default-style"))
+        processHttpEquivDefaultStyle(content);
+    else if (equalIgnoringCase(equiv, "refresh"))
+        processHttpEquivRefresh(content);
+    else if (equalIgnoringCase(equiv, "set-cookie"))
+        processHttpEquivSetCookie(content);
+    else if (equalIgnoringCase(equiv, "content-language"))
         setContentLanguage(content);
     else if (equalIgnoringCase(equiv, "x-dns-prefetch-control"))
         parseDNSPrefetchControlHeader(content);
-    else if (equalIgnoringCase(equiv, "x-frame-options")) {
-        if (frame) {
-            FrameLoader* frameLoader = frame->loader();
-            unsigned long requestIdentifier = loader()->mainResourceIdentifier();
-            if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url(), requestIdentifier)) {
-                String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
-                frameLoader->stopAllLoaders();
-                // Stopping the loader isn't enough, as we're already parsing the document; to honor the header's
-                // intent, we must navigate away from the possibly partially-rendered document to a location that
-                // doesn't inherit the parent's SecurityOrigin.
-                frame->navigationScheduler()->scheduleLocationChange(securityOrigin(), SecurityOrigin::urlWithUniqueSecurityOrigin(), String());
-                addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, requestIdentifier);
-            }
-        }
-    } else if (equalIgnoringCase(equiv, "content-security-policy"))
+    else if (equalIgnoringCase(equiv, "x-frame-options"))
+        processHttpEquivXFrameOptions(content);
+    else if (equalIgnoringCase(equiv, "content-security-policy"))
         contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy::Enforce);
     else if (equalIgnoringCase(equiv, "content-security-policy-report-only"))
         contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy::Report);
@@ -2784,6 +2640,70 @@
         contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy::PrefixedReport);
 }
 
+void Document::processHttpEquivDefaultStyle(const String& content)
+{
+    // The preferred style set has been overridden as per section
+    // 14.3.2 of the HTML4.0 specification. We need to update the
+    // sheet used variable and then update our style selector.
+    // For more info, see the test at:
+    // http://www.hixie.ch/tests/evil/css/import/main/preferred.html
+    // -dwh
+    m_styleSheetCollection->setSelectedStylesheetSetName(content);
+    m_styleSheetCollection->setPreferredStylesheetSetName(content);
+    styleResolverChanged(DeferRecalcStyle);
+}
+
+void Document::processHttpEquivRefresh(const String& content)
+{
+    Frame* frame = this->frame();
+    if (!frame)
+        return;
+
+    double delay;
+    String refreshUrl;
+    if (parseHTTPRefresh(content, true, delay, refreshUrl)) {
+        if (refreshUrl.isEmpty())
+            refreshUrl = m_url.string();
+        else
+            refreshUrl = completeURL(refreshUrl).string();
+        if (!protocolIsJavaScript(refreshUrl)) {
+            frame->navigationScheduler()->scheduleRedirect(delay, refreshUrl);
+        } else {
+            String message = "Refused to refresh " + m_url.elidedString() + " to a javascript: URL";
+            addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+        }
+    }
+}
+
+void Document::processHttpEquivSetCookie(const String& content)
+{
+    // FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
+    if (!isHTMLDocument())
+        return;
+
+    // Exception (for sandboxed documents) ignored.
+    toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION);
+}
+
+void Document::processHttpEquivXFrameOptions(const String& content)
+{
+    Frame* frame = this->frame();
+    if (!frame)
+        return;
+
+    FrameLoader* frameLoader = frame->loader();
+    unsigned long requestIdentifier = loader()->mainResourceIdentifier();
+    if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url(), requestIdentifier)) {
+        String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
+        frameLoader->stopAllLoaders();
+        // Stopping the loader isn't enough, as we're already parsing the document; to honor the header's
+        // intent, we must navigate away from the possibly partially-rendered document to a location that
+        // doesn't inherit the parent's SecurityOrigin.
+        frame->navigationScheduler()->scheduleLocationChange(securityOrigin(), SecurityOrigin::urlWithUniqueSecurityOrigin(), String());
+        addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, requestIdentifier);
+    }
+}
+
 // Though isspace() considers \t and \v to be whitespace, Win IE doesn't.
 static bool isSeparator(UChar c)
 {
@@ -2895,7 +2815,7 @@
     renderView()->hitTest(request, result);
 
     if (!request.readOnly())
-        updateHoverActiveState(request, result.innerElement());
+        updateHoverActiveState(request, result.innerElement(), &event);
 
     return MouseEventWithHitTestResults(event, result);
 }
@@ -2931,7 +2851,7 @@
 bool Document::canReplaceChild(Node* newChild, Node* oldChild)
 {
     if (!oldChild)
-        // ContainerNode::replaceChild will raise a NOT_FOUND_ERR.
+        // ContainerNode::replaceChild will raise a NotFoundError.
         return true;
 
     if (oldChild->nodeType() == newChild->nodeType())
@@ -3057,11 +2977,6 @@
     }
     m_didCalculateStyleResolver = true;
 
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement())
-        printf("Beginning update of style selector at time %d.\n", elapsedTime());
-#endif
-
     bool needsRecalc = m_styleSheetCollection->updateActiveStyleSheets(updateMode);
 
     if (updateType >= DeferRecalcStyle) {
@@ -3085,11 +3000,6 @@
         recalcStyle(Force);
     }
 
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement())
-        printf("Finished update of style selector at time %d\n", elapsedTime());
-#endif
-
     if (renderer()) {
         renderer()->setNeedsLayoutAndPrefWidthsRecalc();
         if (view())
@@ -3135,18 +3045,18 @@
     if (!m_focusedNode)
         return;
 
-    Node* focusedNode = node->treeScope()->focusedNode();
-    if (!focusedNode)
+    Element* focusedElement = node->treeScope()->adjustedFocusedElement();
+    if (!focusedElement)
         return;
 
     bool nodeInSubtree = false;
     if (amongChildrenOnly)
-        nodeInSubtree = focusedNode->isDescendantOf(node);
+        nodeInSubtree = focusedElement->isDescendantOf(node);
     else
-        nodeInSubtree = (focusedNode == node) || focusedNode->isDescendantOf(node);
+        nodeInSubtree = (focusedElement == node) || focusedElement->isDescendantOf(node);
 
     if (nodeInSubtree)
-        setFocusedNode(0);
+        setFocusedElement(0);
 }
 
 void Document::hoveredNodeDetached(Node* node)
@@ -3196,7 +3106,7 @@
     setAnnotatedRegionsDirty(false);
 }
 
-bool Document::setFocusedNode(PassRefPtr<Node> prpNewFocusedNode, FocusDirection direction)
+bool Document::setFocusedElement(PassRefPtr<Element> prpNewFocusedNode, FocusDirection direction)
 {
     RefPtr<Node> newFocusedNode = prpNewFocusedNode;
 
@@ -3336,16 +3246,6 @@
     return !focusChangeBlocked;
 }
 
-void Document::getFocusableNodes(Vector<RefPtr<Node> >& nodes)
-{
-    updateLayout();
-
-    for (Node* node = firstChild(); node; node = NodeTraversal::next(node)) {
-        if (node->isFocusable())
-            nodes.append(node);
-    }
-}
-
 void Document::setCSSTarget(Element* n)
 {
     if (m_cssTarget)
@@ -3541,7 +3441,7 @@
     if (event)
         return event.release();
 
-    ec = NOT_SUPPORTED_ERR;
+    ec = NotSupportedError;
     return 0;
 }
 
@@ -3609,11 +3509,11 @@
         return String();
 
     // FIXME: The HTML5 DOM spec states that this attribute can raise an
-    // INVALID_STATE_ERR exception on getting if the Document has no
+    // InvalidStateError exception on getting if the Document has no
     // browsing context.
 
     if (!securityOrigin()->canAccessCookies()) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return String();
     }
 
@@ -3630,11 +3530,11 @@
         return;
 
     // FIXME: The HTML5 DOM spec states that this attribute can raise an
-    // INVALID_STATE_ERR exception on setting if the Document has no
+    // InvalidStateError exception on setting if the Document has no
     // browsing context.
 
     if (!securityOrigin()->canAccessCookies()) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
@@ -3660,7 +3560,7 @@
 void Document::setDomain(const String& newDomain, ExceptionCode& ec)
 {
     if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(securityOrigin()->protocol())) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
@@ -3686,14 +3586,14 @@
     int newLength = newDomain.length();
     // e.g. newDomain = webkit.org (10) and domain() = www.webkit.org (14)
     if (newLength >= oldLength) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
     String test = domain();
     // Check that it's a subdomain, not e.g. "ebkit.org"
     if (test[oldLength - newLength - 1] != '.') {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
@@ -3701,7 +3601,7 @@
     // and we check that it's the same thing as newDomain
     test.remove(0, oldLength - newLength);
     if (test != newDomain) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
@@ -3802,26 +3702,19 @@
     return isValidNameNonASCII(characters, length);
 }
 
-bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode& ec)
+template<typename CharType>
+static bool parseQualifiedNameInternal(const String& qualifiedName, const CharType* characters, unsigned length, String& prefix, String& localName, ExceptionCode& ec)
 {
-    unsigned length = qualifiedName.length();
-
-    if (!length) {
-        ec = INVALID_CHARACTER_ERR;
-        return false;
-    }
-
     bool nameStart = true;
     bool sawColon = false;
     int colonPos = 0;
 
-    const UChar* s = qualifiedName.bloatedCharacters();
     for (unsigned i = 0; i < length;) {
         UChar32 c;
-        U16_NEXT(s, i, length, c)
+        U16_NEXT(characters, i, length, c)
         if (c == ':') {
             if (sawColon) {
-                ec = NAMESPACE_ERR;
+                ec = NamespaceError;
                 return false; // multiple colons: not allowed
             }
             nameStart = true;
@@ -3829,13 +3722,13 @@
             colonPos = i - 1;
         } else if (nameStart) {
             if (!isValidNameStart(c)) {
-                ec = INVALID_CHARACTER_ERR;
+                ec = InvalidCharacterError;
                 return false;
             }
             nameStart = false;
         } else {
             if (!isValidNamePart(c)) {
-                ec = INVALID_CHARACTER_ERR;
+                ec = InvalidCharacterError;
                 return false;
             }
         }
@@ -3847,20 +3740,34 @@
     } else {
         prefix = qualifiedName.substring(0, colonPos);
         if (prefix.isEmpty()) {
-            ec = NAMESPACE_ERR;
+            ec = NamespaceError;
             return false;
         }
         localName = qualifiedName.substring(colonPos + 1);
     }
 
     if (localName.isEmpty()) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return false;
     }
 
     return true;
 }
 
+bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode& ec)
+{
+    unsigned length = qualifiedName.length();
+
+    if (!length) {
+        ec = InvalidCharacterError;
+        return false;
+    }
+
+    if (qualifiedName.is8Bit())
+        return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters8(), length, prefix, localName, ec);
+    return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters16(), length, prefix, localName, ec);
+}
+
 void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder)
 {
     m_decoder = decoder;
@@ -3954,7 +3861,7 @@
     for (unsigned i = 0; Node* child = children->item(i); i++) {
         if (!child->hasTagName(linkTag))
             continue;
-        HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(child);
+        HTMLLinkElement* linkElement = toHTMLLinkElement(child);
         if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equalIgnoringCase(linkElement->rel(), openSearchRelation))
             continue;
         if (linkElement->href().isEmpty())
@@ -4053,7 +3960,7 @@
     QualifiedName qName(prefix, localName, namespaceURI);
 
     if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return 0;
     }
 
@@ -4205,34 +4112,6 @@
     clearStyleResolver();
 }
 
-PassRefPtr<XPathExpression> Document::createExpression(const String& expression,
-                                                       XPathNSResolver* resolver,
-                                                       ExceptionCode& ec)
-{
-    if (!m_xpathEvaluator)
-        m_xpathEvaluator = XPathEvaluator::create();
-    return m_xpathEvaluator->createExpression(expression, resolver, ec);
-}
-
-PassRefPtr<XPathNSResolver> Document::createNSResolver(Node* nodeResolver)
-{
-    if (!m_xpathEvaluator)
-        m_xpathEvaluator = XPathEvaluator::create();
-    return m_xpathEvaluator->createNSResolver(nodeResolver);
-}
-
-PassRefPtr<XPathResult> Document::evaluate(const String& expression,
-                                           Node* contextNode,
-                                           XPathNSResolver* resolver,
-                                           unsigned short type,
-                                           XPathResult* result,
-                                           ExceptionCode& ec)
-{
-    if (!m_xpathEvaluator)
-        m_xpathEvaluator = XPathEvaluator::create();
-    return m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, ec);
-}
-
 const Vector<IconURL>& Document::shortcutIconURLs()
 {
     // Include any icons where type = link, rel = "shortcut icon".
@@ -4252,7 +4131,7 @@
         Node* child = children->item(i);
         if (!child->hasTagName(linkTag))
             continue;
-        HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(child);
+        HTMLLinkElement* linkElement = toHTMLLinkElement(child);
         if (!(linkElement->iconType() & iconTypesMask))
             continue;
         if (linkElement->href().isEmpty())
@@ -4296,12 +4175,17 @@
 
 void Document::initSecurityContext()
 {
+    initSecurityContext(DocumentInit(m_url, m_frame, m_import));
+}
+
+void Document::initSecurityContext(const DocumentInit& initializer)
+{
     if (haveInitializedSecurityOrigin()) {
         ASSERT(securityOrigin());
         return;
     }
 
-    if (!m_frame) {
+    if (!initializer.frame()) {
         // No source for a security context.
         // This can occur via document.implementation.createDocument().
         m_cookieURL = KURL(ParsedURLString, emptyString());
@@ -4313,11 +4197,11 @@
     // In the common case, create the security context from the currently
     // loading URL with a fresh content security policy.
     m_cookieURL = m_url;
-    enforceSandboxFlags(m_frame->loader()->effectiveSandboxFlags());
+    enforceSandboxFlags(initializer.sandboxFlags());
     setSecurityOrigin(isSandboxed(SandboxOrigin) ? SecurityOrigin::createUnique() : SecurityOrigin::create(m_url));
     setContentSecurityPolicy(ContentSecurityPolicy::create(this));
 
-    if (Settings* settings = this->settings()) {
+    if (Settings* settings = initializer.settings()) {
         if (!settings->webSecurityEnabled()) {
             // Web security is turned off. We should let this document access every other document. This is used primary by testing
             // harnesses for web sites.
@@ -4336,7 +4220,7 @@
     }
 
     Document* parentDocument = ownerElement() ? ownerElement()->document() : 0;
-    if (parentDocument && m_frame->loader()->shouldTreatURLAsSrcdocDocument(url())) {
+    if (parentDocument && initializer.shouldTreatURLAsSrcdocDocument()) {
         m_isSrcdocDocument = true;
         setBaseURLOverride(parentDocument->baseURL());
     }
@@ -4351,10 +4235,7 @@
     // If we do not obtain a meaningful origin from the URL, then we try to
     // find one via the frame hierarchy.
 
-    Frame* ownerFrame = m_frame->tree()->parent();
-    if (!ownerFrame)
-        ownerFrame = m_frame->loader()->opener();
-
+    Frame* ownerFrame = initializer.ownerFrame();
     if (!ownerFrame) {
         didFailToInitializeSecurityOrigin();
         return;
@@ -4666,12 +4547,19 @@
     dispatchWindowEvent(PopStateEvent::create(stateObject, domWindow() ? domWindow()->history() : 0));
 }
 
-void Document::addToTopLayer(Element* element)
+void Document::addToTopLayer(Element* element, const Element* before)
 {
     if (element->isInTopLayer())
         return;
+
     ASSERT(!m_topLayerElements.contains(element));
-    m_topLayerElements.append(element);
+    ASSERT(!before || m_topLayerElements.contains(before));
+    if (before) {
+        size_t beforePosition = m_topLayerElements.find(before);
+        m_topLayerElements.insert(beforePosition, element);
+    } else {
+        m_topLayerElements.append(element);
+    }
     element->setIsInTopLayer(true);
 }
 
@@ -4857,9 +4745,7 @@
     if (!shouldDisplaySeamlesslyWithParent())
         return 0;
 
-    HTMLFrameOwnerElement* ownerElement = this->ownerElement();
-    ASSERT(ownerElement->hasTagName(iframeTag));
-    return static_cast<HTMLIFrameElement*>(ownerElement);
+    return toHTMLIFrameElement(this->ownerElement());
 }
 
 bool Document::shouldDisplaySeamlesslyWithParent() const
@@ -4976,13 +4862,13 @@
     return 0;
 }
 
-void Document::updateHoverActiveState(const HitTestRequest& request, Element* innerElement)
+void Document::updateHoverActiveState(const HitTestRequest& request, Element* innerElement, const PlatformMouseEvent* event)
 {
     ASSERT(!request.readOnly());
 
     Element* innerElementInDocument = innerElement;
     while (innerElementInDocument && innerElementInDocument->document() != this) {
-        innerElementInDocument->document()->updateHoverActiveState(request, innerElementInDocument);
+        innerElementInDocument->document()->updateHoverActiveState(request, innerElementInDocument, event);
         innerElementInDocument = innerElementInDocument->document()->ownerElement();
     }
 
@@ -5070,15 +4956,52 @@
             nodesToAddToChain.append(curr->node());
     }
 
-    size_t removeCount = nodesToRemoveFromChain.size();
-    for (size_t i = 0; i < removeCount; ++i)
-        nodesToRemoveFromChain[i]->setHovered(false);
+    // mouseenter and mouseleave events do not bubble, so they are dispatched iff there is a capturing
+    // event handler on an ancestor or a normal event handler on the element itself. This special
+    // handling is necessary to avoid O(n^2) capturing event handler checks. We'll check the previously
+    // hovered node's ancestor tree for 'mouseleave' handlers here, then check the newly hovered node's
+    // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave' events (as the handler
+    // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that might be).
+    bool ancestorHasCapturingMouseleaveListener = false;
+    if (event && newHoverNode != oldHoverNode.get()) {
+        for (Node* node = oldHoverNode.get(); node; node = node->parentOrShadowHostNode()) {
+            if (node->hasCapturingEventListeners(eventNames().mouseleaveEvent)) {
+                ancestorHasCapturingMouseleaveListener = true;
+                break;
+            }
+        }
+    }
 
+    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);
+    }
+
+    bool ancestorHasCapturingMouseenterListener = false;
+    if (event && newHoverNode != oldHoverNode.get()) {
+        for (Node* node = newHoverNode; node; node = node->parentOrShadowHostNode()) {
+            if (node->hasCapturingEventListeners(eventNames().mouseenterEvent)) {
+                ancestorHasCapturingMouseenterListener = true;
+                break;
+            }
+        }
+    }
+
+    bool sawCommonAncestor = false;
     size_t addCount = nodesToAddToChain.size();
     for (size_t i = 0; i < addCount; ++i) {
+        // Elements past the common ancestor do not change hover state, but might change active state.
+        if (ancestor && nodesToAddToChain[i] == ancestor->node())
+            sawCommonAncestor = true;
         if (allowActiveChanges)
             nodesToAddToChain[i]->setActive(true);
-        nodesToAddToChain[i]->setHovered(true);
+        if (!sawCommonAncestor) {
+            nodesToAddToChain[i]->setHovered(true);
+            if (event && (ancestorHasCapturingMouseenterListener || nodesToAddToChain[i]->hasEventListeners(eventNames().mouseenterEvent)))
+                nodesToAddToChain[i]->dispatchMouseEvent(*event, eventNames().mouseenterEvent, 0, oldHoverNode.get());
+        }
     }
 
     updateStyleIfNeeded();
@@ -5117,7 +5040,6 @@
     info.addMember(m_annotatedRegions, "annotatedRegions");
     info.addMember(m_cssCanvasElements, "cssCanvasElements");
     info.addMember(m_iconURLs, "iconURLs");
-    info.addMember(m_elementsByAccessKey, "elementsByAccessKey");
     info.addMember(m_eventQueue, "eventQueue");
     info.addMember(m_pendingTasks, "pendingTasks");
     info.addMember(m_prerenderer, "prerenderer");
@@ -5141,7 +5063,6 @@
     info.addMember(m_transformSource, "transformSource");
     info.addMember(m_transformSourceDocument, "transformSourceDocument");
     info.addMember(m_decoder, "decoder");
-    info.addMember(m_xpathEvaluator, "xpathEvaluator");
     info.addMember(m_svgExtensions, "svgExtensions");
     info.addMember(m_selectorQueryCache, "selectorQueryCache");
     info.addMember(m_renderer, "renderer");
@@ -5188,9 +5109,9 @@
         return const_cast<Document*>(document);
 
     if (isHTMLDocument())
-        m_templateDocument = HTMLDocument::create(0, blankURL());
+        m_templateDocument = HTMLDocument::create(DocumentInit(blankURL()));
     else
-        m_templateDocument = Document::create(0, blankURL());
+        m_templateDocument = Document::create(DocumentInit(blankURL()));
 
     m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor.
 
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index e77c623..3299ae2 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -32,11 +32,13 @@
 #include "core/dom/ContainerNode.h"
 #include "core/dom/DOMTimeStamp.h"
 #include "core/dom/DocumentEventQueue.h"
+#include "core/dom/DocumentInit.h"
 #include "core/dom/DocumentTiming.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"
@@ -45,7 +47,6 @@
 #include "core/page/PageVisibilityState.h"
 #include "weborigin/ReferrerPolicy.h"
 #include "core/platform/Timer.h"
-#include "core/platform/graphics/Color.h"
 #include "core/platform/text/StringWithDirection.h"
 #include "core/rendering/HitTestRequest.h"
 #include "wtf/Deque.h"
@@ -69,7 +70,7 @@
 class CharacterData;
 class Comment;
 class ContextFeatures;
-class CustomElementRegistry;
+class CustomElementRegistrationContext;
 class DOMImplementation;
 class DOMNamedFlowCollection;
 class DOMSecurityPolicy;
@@ -102,7 +103,7 @@
 class HTMLElement;
 class HTMLFrameOwnerElement;
 class HTMLHeadElement;
-class HTMLImportsController;
+class HTMLImport;
 class HTMLIFrameElement;
 class HTMLMapElement;
 class HTMLNameCollection;
@@ -154,10 +155,6 @@
 class TreeWalker;
 class VisitedLinkState;
 class XMLHttpRequest;
-class XPathEvaluator;
-class XPathExpression;
-class XPathNSResolver;
-class XPathResult;
 
 struct AnnotatedRegionValue;
 
@@ -210,13 +207,13 @@
 
 class Document : public ContainerNode, public TreeScope, public ScriptExecutionContext {
 public:
-    static PassRefPtr<Document> create(Frame* frame, const KURL& url)
+    static PassRefPtr<Document> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new Document(frame, url));
+        return adoptRef(new Document(initializer));
     }
-    static PassRefPtr<Document> createXHTML(Frame* frame, const KURL& url)
+    static PassRefPtr<Document> createXHTML(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new Document(frame, url, XHTMLDocumentClass));
+        return adoptRef(new Document(initializer, XHTMLDocumentClass));
     }
     virtual ~Document();
 
@@ -229,9 +226,6 @@
 
     virtual bool canContainRangeEndPoint() const { return true; }
 
-    Element* getElementByAccessKey(const String& key);
-    void invalidateAccessKeyMap();
-
     SelectorQueryCache* selectorQueryCache();
 
     // DOM methods & attributes for Document
@@ -254,6 +248,8 @@
     DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup);
     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);
@@ -449,6 +445,12 @@
     // Called when one or more stylesheets in the document may have been added, removed, or changed.
     void styleResolverChanged(StyleResolverUpdateType, StyleResolverUpdateMode = FullStyleUpdate);
 
+    // FIXME: Switch all callers of styleResolverChanged to these or better ones and then make them
+    // do something smarter.
+    void removedStyleSheet(StyleSheet*, StyleResolverUpdateType type = DeferRecalcStyle) { styleResolverChanged(type); }
+    void addedStyleSheet(StyleSheet*, StyleResolverUpdateType type = DeferRecalcStyle) { styleResolverChanged(type); }
+    void modifiedStyleSheet(StyleSheet*, StyleResolverUpdateType type = DeferRecalcStyle) { styleResolverChanged(type); }
+
     void didAccessStyleResolver();
 
     void evaluateMediaQueryList();
@@ -612,19 +614,8 @@
     bool shouldScheduleLayout();
     bool isLayoutTimerActive();
     int elapsedTime() const;
-    
-    void setTextColor(const Color& color) { m_textColor = color; }
-    Color textColor() const { return m_textColor; }
 
-    const Color& linkColor() const { return m_linkColor; }
-    const Color& visitedLinkColor() const { return m_visitedLinkColor; }
-    const Color& activeLinkColor() const { return m_activeLinkColor; }
-    void setLinkColor(const Color& c) { m_linkColor = c; }
-    void setVisitedLinkColor(const Color& c) { m_visitedLinkColor = c; }
-    void setActiveLinkColor(const Color& c) { m_activeLinkColor = c; }
-    void resetLinkColor();
-    void resetVisitedLinkColor();
-    void resetActiveLinkColor();
+    TextLinkColors& textLinkColors() { return m_textLinkColors; }
     VisitedLinkState* visitedLinkState() const { return m_visitedLinkState.get(); }
 
     MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const LayoutPoint&, const PlatformMouseEvent&);
@@ -637,13 +628,12 @@
     String selectedStylesheetSet() const;
     void setSelectedStylesheetSet(const String&);
 
-    bool setFocusedNode(PassRefPtr<Node>, FocusDirection = FocusDirectionNone);
+    bool setFocusedElement(PassRefPtr<Element>, FocusDirection = FocusDirectionNone);
     Node* focusedNode() const { return m_focusedNode.get(); }
     UserActionElementSet& userActionElements()  { return m_userActionElements; }
     const UserActionElementSet& userActionElements() const { return m_userActionElements; }
     void didRunCheckFocusedNodeTask() { m_didPostCheckFocusedNodeTask = false; }
-    void getFocusableNodes(Vector<RefPtr<Node> >&);
-    
+
     // 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; };
@@ -659,7 +649,7 @@
     void hoveredNodeDetached(Node*);
     void activeChainNodeDetached(Node*);
 
-    void updateHoverActiveState(const HitTestRequest&, Element*);
+    void updateHoverActiveState(const HitTestRequest&, Element*, const PlatformMouseEvent* = 0);
 
     // Updates for :target (CSS3 selector).
     void setCSSTarget(Element*);
@@ -739,9 +729,6 @@
 
     CSSStyleDeclaration* getOverrideStyle(Element*, const String& pseudoElt);
 
-    int nodeAbsIndex(Node*);
-    Node* nodeWithAbsIndex(int absIndex);
-
     /**
      * Handles a HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called
      * when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta
@@ -868,18 +855,6 @@
 
     void setDocType(PassRefPtr<DocumentType>);
 
-    // XPathEvaluator methods
-    PassRefPtr<XPathExpression> createExpression(const String& expression,
-                                                 XPathNSResolver* resolver,
-                                                 ExceptionCode& ec);
-    PassRefPtr<XPathNSResolver> createNSResolver(Node *nodeResolver);
-    PassRefPtr<XPathResult> evaluate(const String& expression,
-                                     Node* contextNode,
-                                     XPathNSResolver* resolver,
-                                     unsigned short type,
-                                     XPathResult* result,
-                                     ExceptionCode& ec);
-
     enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
 
     bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
@@ -939,6 +914,7 @@
     SVGDocumentExtensions* accessSVGExtensions();
 
     void initSecurityContext();
+    void initSecurityContext(const DocumentInit&);
     void initContentSecurityPolicy();
 
     void updateURLForPushOrReplaceState(const KURL&);
@@ -1018,11 +994,10 @@
     PassRefPtr<Element> createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode&);
     ScriptValue registerElement(WebCore::ScriptState*, const AtomicString& name, ExceptionCode&);
     ScriptValue registerElement(WebCore::ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionCode&);
-    CustomElementRegistry* registry() const { return m_registry.get(); }
-    CustomElementRegistry* ensureCustomElementRegistry();
+    CustomElementRegistrationContext* registrationContext() { return m_registrationContext.get(); }
 
-    void setImports(PassRefPtr<HTMLImportsController>);
-    HTMLImportsController* imports() const { return m_imports.get(); }
+    void setImport(HTMLImport*);
+    HTMLImport* import() const { return m_import; }
     bool haveImportsLoaded() const;
     void didLoadAllImports();
 
@@ -1053,7 +1028,7 @@
 
     DocumentTimeline* timeline() { return m_timeline.get(); }
 
-    void addToTopLayer(Element*);
+    void addToTopLayer(Element*, const Element* before = 0);
     void removeFromTopLayer(Element*);
     const Vector<RefPtr<Element> >& topLayerElements() const { return m_topLayerElements; }
     Element* activeModalDialog() const { return !m_topLayerElements.isEmpty() ? m_topLayerElements.last().get() : 0; }
@@ -1073,18 +1048,18 @@
     DocumentLifecycleNotifier* lifecycleNotifier();
 
 protected:
-    Document(Frame*, const KURL&, DocumentClassFlags = DefaultDocumentClass);
+    Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass);
 
     virtual void didUpdateSecurityOrigin() OVERRIDE;
 
     void clearXMLVersion() { m_xmlVersion = String(); }
 
+    virtual void dispose() OVERRIDE;
+
 private:
     friend class Node;
     friend class IgnoreDestructiveWriteCountIncrementer;
 
-    virtual void dispose() OVERRIDE;
-
     void detachParser();
 
     typedef void (*ArgumentsCallback)(const String& keyString, const String& valueString, Document*, void* data);
@@ -1097,7 +1072,7 @@
     virtual String nodeName() const;
     virtual NodeType nodeType() const;
     virtual bool childTypeAllowed(NodeType) const;
-    virtual PassRefPtr<Node> cloneNode(bool deep);
+    virtual PassRefPtr<Node> cloneNode(bool deep = true);
 
     virtual void refScriptExecutionContext() { ref(); }
     virtual void derefScriptExecutionContext() { deref(); }
@@ -1114,8 +1089,6 @@
     void updateFocusAppearanceTimerFired(Timer<Document>*);
     void updateBaseURL();
 
-    void buildAccessKeyMap(TreeScope* root);
-
     void createStyleResolver();
 
     void executeScriptsWaitingForResourcesIfNeeded();
@@ -1129,7 +1102,7 @@
     void pendingTasksTimerFired(Timer<Document>*);
 
     static void didReceiveTask(void*);
-    
+
     template <typename CharacterType>
     void displayBufferModifiedByEncodingInternal(CharacterType*, unsigned) const;
 
@@ -1146,8 +1119,13 @@
     void addMutationEventListenerTypeIfEnabled(ListenerType);
 
     void didAssociateFormControlsTimerFired(Timer<Document>*);
-
     void styleResolverThrowawayTimerFired(Timer<Document>*);
+
+    void processHttpEquivDefaultStyle(const String& content);
+    void processHttpEquivRefresh(const String& content);
+    void processHttpEquivSetCookie(const String& content);
+    void processHttpEquivXFrameOptions(const String& content);
+
     Timer<Document> m_styleResolverThrowawayTimer;
     double m_lastStyleResolverAccessTime;
 
@@ -1166,6 +1144,7 @@
 
     Frame* m_frame;
     DOMWindow* m_domWindow;
+    HTMLImport* m_import;
 
     RefPtr<CachedResourceLoader> m_cachedResourceLoader;
     RefPtr<DocumentParser> m_parser;
@@ -1204,8 +1183,6 @@
     CompatibilityMode m_compatibilityMode;
     bool m_compatibilityModeLocked; // This is cheaper than making setCompatibilityMode virtual.
 
-    Color m_textColor;
-
     bool m_didPostCheckFocusedNodeTask;
     RefPtr<Node> m_focusedNode;
     RefPtr<Node> m_hoverNode;
@@ -1228,9 +1205,7 @@
 
     OwnPtr<FormController> m_formController;
 
-    Color m_linkColor;
-    Color m_visitedLinkColor;
-    Color m_activeLinkColor;
+    TextLinkColors m_textLinkColors;
     OwnPtr<VisitedLinkState> m_visitedLinkState;
 
     bool m_loadingSheet;
@@ -1298,8 +1273,6 @@
     HashSet<LiveNodeListBase*> m_listsInvalidatedAtDocument;
     unsigned m_nodeListCounts[numNodeListInvalidationTypes];
 
-    RefPtr<XPathEvaluator> m_xpathEvaluator;
-
     OwnPtr<SVGDocumentExtensions> m_svgExtensions;
 
     Vector<AnnotatedRegionValue> m_annotatedRegions;
@@ -1310,9 +1283,6 @@
 
     Vector<IconURL> m_iconURLs;
 
-    HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey;
-    bool m_accessKeyMapValid;
-
     OwnPtr<SelectorQueryCache> m_selectorQueryCache;
 
     bool m_useSecureKeyboardEntryWhenActive;
@@ -1363,8 +1333,7 @@
 
     OwnPtr<TextAutosizer> m_textAutosizer;
 
-    RefPtr<CustomElementRegistry> m_registry;
-    RefPtr<HTMLImportsController> m_imports;
+    RefPtr<CustomElementRegistrationContext> m_registrationContext;
 
     bool m_scheduledTasksAreSuspended;
     
diff --git a/Source/core/dom/Document.idl b/Source/core/dom/Document.idl
index 7afd390..effc829 100644
--- a/Source/core/dom/Document.idl
+++ b/Source/core/dom/Document.idl
@@ -97,16 +97,6 @@
      CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
                                                         [Default=Undefined] optional DOMString pseudoElement);
 
-    // DOM Level 3 XPath (XPathEvaluator interface)
-     [RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression,
-                                                    [Default=Undefined] optional XPathNSResolver resolver);
-    XPathNSResolver    createNSResolver(Node nodeResolver);
-    [Custom, RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString expression,
-                                                  [Default=Undefined] optional Node contextNode,
-                                                  [Default=Undefined] optional XPathNSResolver resolver,
-                                                  [Default=Undefined] optional unsigned short type,
-                                                  [Default=Undefined] optional XPathResult inResult);
-
     // Common extensions
     [DeliverCustomElementCallbacks]
     boolean            execCommand([Default=Undefined] optional DOMString command,
@@ -203,6 +193,8 @@
     [NotEnumerable] attribute EventListener onkeyup;
     [NotEnumerable] attribute EventListener onload;
     [NotEnumerable] attribute EventListener onmousedown;
+    [NotEnumerable] attribute EventListener onmouseenter;
+    [NotEnumerable] attribute EventListener onmouseleave;
     [NotEnumerable] attribute EventListener onmousemove;
     [NotEnumerable] attribute EventListener onmouseout;
     [NotEnumerable] attribute EventListener onmouseover;
diff --git a/Source/core/dom/DocumentFragment.h b/Source/core/dom/DocumentFragment.h
index 08ede54..1b763a1 100644
--- a/Source/core/dom/DocumentFragment.h
+++ b/Source/core/dom/DocumentFragment.h
@@ -48,7 +48,7 @@
 
 private:
     virtual NodeType nodeType() const;
-    virtual PassRefPtr<Node> cloneNode(bool deep);
+    virtual PassRefPtr<Node> cloneNode(bool deep = true);
     virtual bool childTypeAllowed(NodeType) const;
 };
 
diff --git a/Source/core/dom/DocumentInit.cpp b/Source/core/dom/DocumentInit.cpp
new file mode 100644
index 0000000..adf48c2
--- /dev/null
+++ b/Source/core/dom/DocumentInit.cpp
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ */
+
+#include "config.h"
+#include "core/dom/DocumentInit.h"
+
+#include "core/html/HTMLImportsController.h"
+#include "core/page/Frame.h"
+
+namespace WebCore {
+
+bool DocumentInit::shouldSetURL() const
+{
+    return (m_frame && m_frame->ownerElement()) || !m_url.isEmpty();
+}
+
+bool DocumentInit::shouldTreatURLAsSrcdocDocument() const
+{
+    return m_frame->loader()->shouldTreatURLAsSrcdocDocument(m_url);
+}
+
+SandboxFlags DocumentInit::sandboxFlags() const
+{
+    return m_frame->loader()->effectiveSandboxFlags();
+}
+
+Settings* DocumentInit::settings() const
+{
+    return m_frame->settings();
+}
+
+Frame* DocumentInit::ownerFrame() const
+{
+    Frame* ownerFrame = m_frame->tree()->parent();
+    if (!ownerFrame)
+        ownerFrame = m_frame->loader()->opener();
+    return ownerFrame;
+}
+
+} // namespace WebCore
+
diff --git a/Source/core/dom/DocumentInit.h b/Source/core/dom/DocumentInit.h
new file mode 100644
index 0000000..893662f
--- /dev/null
+++ b/Source/core/dom/DocumentInit.h
@@ -0,0 +1,67 @@
+/*
+ * 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 DocumentInit_h
+#define DocumentInit_h
+
+#include "core/dom/SecurityContext.h"
+#include "weborigin/KURL.h"
+
+namespace WebCore {
+
+class Frame;
+class HTMLImport;
+class Settings;
+
+class DocumentInit {
+public:
+    explicit DocumentInit(const KURL& url = KURL(), Frame* frame = 0, HTMLImport* import = 0)
+        : m_url(url)
+        , m_frame(frame)
+        , m_import(import)
+    { }
+
+    const KURL& url() const { return m_url; }
+    Frame* frame() const { return m_frame; }
+    HTMLImport* import() const { return m_import; }
+
+    bool shouldTreatURLAsSrcdocDocument() const;
+    bool shouldSetURL() const;
+    SandboxFlags sandboxFlags() const;
+
+    Frame* ownerFrame() const;
+    Settings* settings() const;
+
+private:
+    KURL m_url;
+    Frame* m_frame;
+    HTMLImport* m_import;
+};
+
+} // namespace WebCore
+
+#endif // DocumentInit_h
diff --git a/Source/core/dom/DocumentMarker.h b/Source/core/dom/DocumentMarker.h
index e8e6d9f..b6072b9 100644
--- a/Source/core/dom/DocumentMarker.h
+++ b/Source/core/dom/DocumentMarker.h
@@ -23,10 +23,10 @@
 #ifndef DocumentMarker_h
 #define DocumentMarker_h
 
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentMarkerController.h b/Source/core/dom/DocumentMarkerController.h
index b73bcd1..59fca3e 100644
--- a/Source/core/dom/DocumentMarkerController.h
+++ b/Source/core/dom/DocumentMarkerController.h
@@ -29,8 +29,8 @@
 
 #include "core/dom/DocumentMarker.h"
 #include "core/platform/graphics/IntRect.h"
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
+#include "wtf/HashMap.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentOrderedMap.cpp b/Source/core/dom/DocumentOrderedMap.cpp
index 5c41c8d..980917f 100644
--- a/Source/core/dom/DocumentOrderedMap.cpp
+++ b/Source/core/dom/DocumentOrderedMap.cpp
@@ -36,9 +36,10 @@
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/TreeScope.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/html/HTMLLabelElement.h"
 #include "core/html/HTMLMapElement.h"
-#include <wtf/MemoryInstrumentationHashCountedSet.h>
-#include <wtf/MemoryInstrumentationHashMap.h>
+#include "wtf/MemoryInstrumentationHashCountedSet.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
 
 namespace WebCore {
 
@@ -51,17 +52,17 @@
 
 inline bool keyMatchesMapName(AtomicStringImpl* key, Element* element)
 {
-    return element->hasTagName(mapTag) && static_cast<HTMLMapElement*>(element)->getName().impl() == key;
+    return element->hasTagName(mapTag) && toHTMLMapElement(element)->getName().impl() == key;
 }
 
 inline bool keyMatchesLowercasedMapName(AtomicStringImpl* key, Element* element)
 {
-    return element->hasTagName(mapTag) && static_cast<HTMLMapElement*>(element)->getName().lower().impl() == key;
+    return element->hasTagName(mapTag) && toHTMLMapElement(element)->getName().lower().impl() == key;
 }
 
 inline bool keyMatchesLabelForAttribute(AtomicStringImpl* key, Element* element)
 {
-    return element->hasTagName(labelTag) && element->getAttribute(forAttr).impl() == key;
+    return isHTMLLabelElement(element) && element->getAttribute(forAttr).impl() == key;
 }
 
 void DocumentOrderedMap::clear()
diff --git a/Source/core/dom/DocumentOrderedMap.h b/Source/core/dom/DocumentOrderedMap.h
index f7deb3b..78ccd90 100644
--- a/Source/core/dom/DocumentOrderedMap.h
+++ b/Source/core/dom/DocumentOrderedMap.h
@@ -31,9 +31,9 @@
 #ifndef DocumentOrderedMap_h
 #define DocumentOrderedMap_h
 
-#include <wtf/HashCountedSet.h>
-#include <wtf/HashMap.h>
-#include <wtf/text/AtomicStringImpl.h>
+#include "wtf/HashCountedSet.h"
+#include "wtf/HashMap.h"
+#include "wtf/text/AtomicStringImpl.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentParser.cpp b/Source/core/dom/DocumentParser.cpp
index 9a834eb..dcafb09 100644
--- a/Source/core/dom/DocumentParser.cpp
+++ b/Source/core/dom/DocumentParser.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/dom/DocumentParser.h"
 
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentParser.h b/Source/core/dom/DocumentParser.h
index 98a473b..587fa2f 100644
--- a/Source/core/dom/DocumentParser.h
+++ b/Source/core/dom/DocumentParser.h
@@ -24,8 +24,8 @@
 #ifndef DocumentParser_h
 #define DocumentParser_h
 
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentSharedObjectPool.h b/Source/core/dom/DocumentSharedObjectPool.h
index a3b24d7..2f827db 100644
--- a/Source/core/dom/DocumentSharedObjectPool.h
+++ b/Source/core/dom/DocumentSharedObjectPool.h
@@ -27,9 +27,9 @@
 #ifndef DocumentSharedObjectPool_h
 #define DocumentSharedObjectPool_h
 
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/StringHash.h>
+#include "wtf/HashMap.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentStyleSheetCollection.cpp b/Source/core/dom/DocumentStyleSheetCollection.cpp
index 35b41b4..8bb4caf 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.cpp
+++ b/Source/core/dom/DocumentStyleSheetCollection.cpp
@@ -46,8 +46,8 @@
 #include "core/page/Settings.h"
 #include "core/page/UserContentURLPattern.h"
 #include "core/svg/SVGStyleElement.h"
-#include <wtf/MemoryInstrumentationListHashSet.h>
-#include <wtf/MemoryInstrumentationVector.h>
+#include "wtf/MemoryInstrumentationListHashSet.h"
+#include "wtf/MemoryInstrumentationVector.h"
 
 namespace WebCore {
 
@@ -57,7 +57,6 @@
     : m_document(document)
     , m_pendingStylesheets(0)
     , m_injectedStyleSheetCacheValid(false)
-    , m_hadActiveLoadingStylesheet(false)
     , m_needsUpdateActiveStylesheetsOnStyleRecalc(false)
     , m_usesSiblingRules(false)
     , m_usesSiblingRulesOverride(false)
@@ -66,6 +65,7 @@
     , m_usesBeforeAfterRules(false)
     , m_usesBeforeAfterRulesOverride(false)
     , m_usesRemUnits(false)
+    , m_collectionForDocument(document)
 {
 }
 
@@ -83,6 +83,16 @@
         m_authorStyleSheets[i]->clearOwnerNode();
 }
 
+const Vector<RefPtr<StyleSheet> >& DocumentStyleSheetCollection::styleSheetsForStyleSheetList()
+{
+    return m_collectionForDocument.styleSheetsForStyleSheetList();
+}
+
+const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::activeAuthorStyleSheets() const
+{
+    return m_collectionForDocument.activeAuthorStyleSheets();
+}
+
 void DocumentStyleSheetCollection::combineCSSFeatureFlags()
 {
     // Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/after).
@@ -123,16 +133,18 @@
 void DocumentStyleSheetCollection::clearPageUserSheet()
 {
     if (m_pageUserSheet) {
+        RefPtr<StyleSheet> removedSheet = m_pageUserSheet;
         m_pageUserSheet = 0;
-        m_document->styleResolverChanged(DeferRecalcStyle);
+        m_document->removedStyleSheet(removedSheet.get());
     }
 }
 
 void DocumentStyleSheetCollection::updatePageUserSheet()
 {
     clearPageUserSheet();
-    if (pageUserSheet())
-        m_document->styleResolverChanged(RecalcStyleImmediately);
+    // FIXME: Why is this immediately and not defer?
+    if (StyleSheet* addedSheet = pageUserSheet())
+        m_document->addedStyleSheet(addedSheet, RecalcStyleImmediately);
 }
 
 const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::injectedUserStyleSheets() const
@@ -181,6 +193,8 @@
 void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
 {
     m_injectedStyleSheetCacheValid = false;
+    // FIXME: updateInjectedStyleSheetCache is called inside StyleSheetCollection::updateActiveStyleSheets
+    // and batch updates lots of sheets so we can't call addedStyleSheet() or removedStyleSheet().
     m_document->styleResolverChanged(DeferRecalcStyle);
 }
 
@@ -188,14 +202,14 @@
 {
     ASSERT(!authorSheet->isUserStyleSheet());
     m_authorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_document));
-    m_document->styleResolverChanged(RecalcStyleImmediately);
+    m_document->addedStyleSheet(m_authorStyleSheets.last().get(), RecalcStyleImmediately);
 }
 
 void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
 {
     ASSERT(userSheet->isUserStyleSheet());
     m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document));
-    m_document->styleResolverChanged(RecalcStyleImmediately);
+    m_document->addedStyleSheet(m_userStyleSheets.last().get(), RecalcStyleImmediately);
 }
 
 // This method is called whenever a top-level stylesheet has finished loading.
@@ -205,11 +219,6 @@
     ASSERT(m_pendingStylesheets > 0);
 
     m_pendingStylesheets--;
-    
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!ownerElement())
-        printf("Stylesheet loaded at time %d. %d stylesheets still remain.\n", elapsedTime(), m_pendingStylesheets);
-#endif
 
     if (m_pendingStylesheets)
         return;
@@ -218,174 +227,20 @@
         m_document->setNeedsNotifyRemoveAllPendingStylesheet();
         return;
     }
-    
+
+    // FIXME: We can't call addedStyleSheet or removedStyleSheet here because we don't know
+    // what's new. We should track that to tell the style system what changed.
     m_document->didRemoveAllPendingStylesheet();
 }
 
 void DocumentStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool createdByParser)
 {
-    if (!node->inDocument())
-        return;
-
-    // Until the <body> exists, we have no choice but to compare document positions,
-    // since styles outside of the body and head continue to be shunted into the head
-    // (and thus can shift to end up before dynamically added DOM content that is also
-    // outside the body).
-    if (createdByParser && m_document->body()) {
-        m_styleSheetCandidateNodes.parserAdd(node);
-        return;
-    }
-
-    m_styleSheetCandidateNodes.add(node);
+    m_collectionForDocument.addStyleSheetCandidateNode(node, createdByParser);
 }
 
 void DocumentStyleSheetCollection::removeStyleSheetCandidateNode(Node* node)
 {
-    m_styleSheetCandidateNodes.remove(node);
-}
-
-void DocumentStyleSheetCollection::collectStyleSheets(Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
-{
-    if (m_document->settings() && !m_document->settings()->authorAndUserStylesEnabled())
-        return;
-
-    DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
-    DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
-    for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
-        Node* n = *it;
-        StyleSheet* sheet = 0;
-        CSSStyleSheet* activeSheet = 0;
-        if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) {
-            // Processing instruction (XML documents only).
-            // We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
-            ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n);
-            // Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
-            if (pi->isXSL() && !m_document->transformSourceDocument()) {
-                // Don't apply XSL transforms until loading is finished.
-                if (!m_document->parsing())
-                    m_document->applyXSLTransform(pi);
-                return;
-            }
-            sheet = pi->sheet();
-            if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
-                activeSheet = static_cast<CSSStyleSheet*>(sheet);
-        } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) {
-            Element* e = toElement(n);
-            AtomicString title = e->getAttribute(titleAttr);
-            bool enabledViaScript = false;
-            if (e->hasLocalName(linkTag)) {
-                // <LINK> element
-                HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
-                enabledViaScript = linkElement->isEnabledViaScript();
-                if (!linkElement->isDisabled() && linkElement->styleSheetIsLoading()) {
-                    // it is loading but we should still decide which style sheet set to use
-                    if (!enabledViaScript && !title.isEmpty() && m_preferredStylesheetSetName.isEmpty()) {
-                        const AtomicString& rel = e->getAttribute(relAttr);
-                        if (!rel.contains("alternate")) {
-                            m_preferredStylesheetSetName = title;
-                            m_selectedStylesheetSetName = title;
-                        }
-                    }
-
-                    continue;
-                }
-                sheet = linkElement->sheet();
-                if (!sheet)
-                    title = nullAtom;
-            } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) {
-                sheet = static_cast<SVGStyleElement*>(n)->sheet();
-            } else {
-                sheet = static_cast<HTMLStyleElement*>(n)->sheet();
-            }
-
-            if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
-                activeSheet = static_cast<CSSStyleSheet*>(sheet);
-
-            // Check to see if this sheet belongs to a styleset
-            // (thus making it PREFERRED or ALTERNATE rather than
-            // PERSISTENT).
-            AtomicString rel = e->getAttribute(relAttr);
-            if (!enabledViaScript && sheet && !title.isEmpty()) {
-                // Yes, we have a title.
-                if (m_preferredStylesheetSetName.isEmpty()) {
-                    // No preferred set has been established. If
-                    // we are NOT an alternate sheet, then establish
-                    // us as the preferred set. Otherwise, just ignore
-                    // this sheet.
-                    if (e->hasLocalName(styleTag) || !rel.contains("alternate"))
-                        m_preferredStylesheetSetName = m_selectedStylesheetSetName = title;
-                }
-                if (title != m_preferredStylesheetSetName)
-                    activeSheet = 0;
-            }
-
-            if (rel.contains("alternate") && title.isEmpty())
-                activeSheet = 0;
-        }
-        if (sheet)
-            styleSheets.append(sheet);
-        if (activeSheet)
-            activeSheets.append(activeSheet);
-    }
-}
-
-void DocumentStyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc)
-{
-    styleResolverUpdateType = Reconstruct;
-    requiresFullStyleRecalc = true;
-
-    // Stylesheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
-    bool hasActiveLoadingStylesheet = false;
-    unsigned newStylesheetCount = newStylesheets.size();
-    for (unsigned i = 0; i < newStylesheetCount; ++i) {
-        if (newStylesheets[i]->isLoading())
-            hasActiveLoadingStylesheet = true;
-    }
-    if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
-        m_hadActiveLoadingStylesheet = false;
-        return;
-    }
-    m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
-
-    if (updateMode != AnalyzedStyleUpdate)
-        return;
-    if (!m_document->styleResolverIfExists())
-        return;
-
-    // Find out which stylesheets are new.
-    unsigned oldStylesheetCount = m_activeAuthorStyleSheets.size();
-    if (newStylesheetCount < oldStylesheetCount)
-        return;
-    Vector<StyleSheetContents*> addedSheets;
-    unsigned newIndex = 0;
-    for (unsigned oldIndex = 0; oldIndex < oldStylesheetCount; ++oldIndex) {
-        if (newIndex >= newStylesheetCount)
-            return;
-        while (m_activeAuthorStyleSheets[oldIndex] != newStylesheets[newIndex]) {
-            addedSheets.append(newStylesheets[newIndex]->contents());
-            ++newIndex;
-            if (newIndex == newStylesheetCount)
-                return;
-        }
-        ++newIndex;
-    }
-    bool hasInsertions = !addedSheets.isEmpty();
-    while (newIndex < newStylesheetCount) {
-        addedSheets.append(newStylesheets[newIndex]->contents());
-        ++newIndex;
-    }
-    // If all new sheets were added at the end of the list we can just add them to existing StyleResolver.
-    // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly.
-    styleResolverUpdateType = hasInsertions ? Reset : Additive;
-
-    // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
-    if (!m_document->body() || m_document->hasNodesWithPlaceholderStyle())
-        return;
-    StyleInvalidationAnalysis invalidationAnalysis(addedSheets);
-    if (invalidationAnalysis.dirtiesAllStyle())
-        return;
-    invalidationAnalysis.invalidateStyle(m_document);
-    requiresFullStyleRecalc = false;
+    m_collectionForDocument.removeStyleSheetCandidateNode(node);
 }
 
 static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets)
@@ -397,14 +252,6 @@
     return false;
 }
 
-static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyleSheet> >& sheets, Document* document)
-{
-    HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
-    if (!seamlessParentIFrame)
-        return;
-    sheets.append(seamlessParentIFrame->document()->styleSheetCollection()->activeAuthorStyleSheets());
-}
-
 bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
 {
     if (m_document->inStyleRecalc()) {
@@ -419,37 +266,15 @@
     if (!m_document->renderer() || !m_document->attached())
         return false;
 
-    Vector<RefPtr<StyleSheet> > styleSheets;
-    Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
-    activeCSSStyleSheets.append(injectedAuthorStyleSheets());
-    activeCSSStyleSheets.append(documentAuthorStyleSheets());
-    collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_document);
-    collectStyleSheets(styleSheets, activeCSSStyleSheets);
-
-    StyleResolverUpdateType styleResolverUpdateType;
-    bool requiresFullStyleRecalc;
-    analyzeStyleSheetChange(updateMode, activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
-
-    if (styleResolverUpdateType == Reconstruct)
-        m_document->clearStyleResolver();
-    else {
-        StyleResolver* styleResolver = m_document->styleResolver();
-        if (styleResolverUpdateType == Reset) {
-            styleResolver->resetAuthorStyle();
-            styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets);
-        } else {
-            ASSERT(styleResolverUpdateType == Additive);
-            styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets);
-        }
-        resetCSSFeatureFlags();
-    }
-    m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
-    InspectorInstrumentation::activeStyleSheetsUpdated(m_document, styleSheets);
-    m_styleSheetsForStyleSheetList.swap(styleSheets);
-
-    m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
+    StyleSheetCollection::StyleResolverUpdateType styleResolverUpdateType;
+    bool requiresFullStyleRecalc = m_collectionForDocument.updateActiveStyleSheets(this, updateMode, styleResolverUpdateType);
     m_needsUpdateActiveStylesheetsOnStyleRecalc = false;
 
+    if (styleResolverUpdateType != StyleSheetCollection::Reconstruct)
+        resetCSSFeatureFlags();
+
+    InspectorInstrumentation::activeStyleSheetsUpdated(m_document, m_collectionForDocument.styleSheetsForStyleSheetList());
+    m_usesRemUnits = styleSheetsUseRemUnits(m_collectionForDocument.activeAuthorStyleSheets());
     m_document->notifySeamlessChildDocumentsOfStylesheetUpdate();
 
     return requiresFullStyleRecalc;
@@ -463,9 +288,7 @@
     info.addMember(m_injectedAuthorStyleSheets, "injectedAuthorStyleSheets");
     info.addMember(m_userStyleSheets, "userStyleSheets");
     info.addMember(m_authorStyleSheets, "authorStyleSheets");
-    info.addMember(m_activeAuthorStyleSheets, "activeAuthorStyleSheets");
-    info.addMember(m_styleSheetsForStyleSheetList, "styleSheetsForStyleSheetList");
-    info.addMember(m_styleSheetCandidateNodes, "styleSheetCandidateNodes");
+    info.addMember(m_collectionForDocument, "styleSheetCollectionForDocument");
     info.addMember(m_preferredStylesheetSetName, "preferredStylesheetSetName");
     info.addMember(m_selectedStylesheetSetName, "selectedStylesheetSetName");
     info.addMember(m_document, "document");
diff --git a/Source/core/dom/DocumentStyleSheetCollection.h b/Source/core/dom/DocumentStyleSheetCollection.h
index 1a67e28..7b4cc03 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.h
+++ b/Source/core/dom/DocumentStyleSheetCollection.h
@@ -30,6 +30,7 @@
 
 #include "core/dom/Document.h"
 #include "core/dom/DocumentOrderedList.h"
+#include "core/dom/StyleSheetCollection.h"
 #include "wtf/FastAllocBase.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/RefPtr.h"
@@ -51,9 +52,8 @@
 
     ~DocumentStyleSheetCollection();
 
-    const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() const { return m_styleSheetsForStyleSheetList; }
-
-    const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { return m_activeAuthorStyleSheets; }
+    const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList();
+    const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const;
 
     CSSStyleSheet* pageUserSheet();
     const Vector<RefPtr<CSSStyleSheet> >& documentUserStyleSheets() const { return m_userStyleSheets; }
@@ -108,19 +108,8 @@
 private:
     DocumentStyleSheetCollection(Document*);
 
-    void collectStyleSheets(Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
-    enum StyleResolverUpdateType {
-        Reconstruct,
-        Reset,
-        Additive
-    };
-    void analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc);
-
     Document* m_document;
 
-    Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList;
-    Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets;
-
     // Track the number of currently loading top-level stylesheets needed for rendering.
     // Sheets loaded using the @import directive are not included in this count.
     // We use this count of pending sheets to detect when we can begin attaching
@@ -139,7 +128,7 @@
     bool m_hadActiveLoadingStylesheet;
     bool m_needsUpdateActiveStylesheetsOnStyleRecalc;
 
-    DocumentOrderedList m_styleSheetCandidateNodes;
+    StyleSheetCollection m_collectionForDocument;
 
     String m_preferredStylesheetSetName;
     String m_selectedStylesheetSetName;
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index ab2f94d..ab7a395 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -42,7 +42,7 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/ClientRect.h"
 #include "core/dom/ClientRectList.h"
-#include "core/dom/CustomElementRegistry.h"
+#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/DatasetDOMStringMap.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentSharedObjectPool.h"
@@ -205,12 +205,12 @@
         ElementRareData* data = elementRareData();
         data->setPseudoElement(BEFORE, 0);
         data->setPseudoElement(AFTER, 0);
+        data->setPseudoElement(BACKDROP, 0);
         data->clearShadow();
     }
 
-    if (isCustomElement() && document() && document()->registry()) {
-        document()->registry()->customElementWasDestroyed(this);
-    }
+    if (isCustomElement() && document() && document()->registrationContext())
+        document()->registrationContext()->customElementIsBeingDestroyed(this);
 
     if (hasSyntheticAttrChildNodes())
         detachAllAttrNodesFromElement();
@@ -266,7 +266,7 @@
     }
 
     // FIXME: These asserts should be in Node::isFocusable, but there are some
-    // callsites like Document::setFocusedNode that would currently fail on
+    // callsites like Document::setFocusedElement that would currently fail on
     // them. See crbug.com/251163
     if (renderer()) {
         ASSERT(!renderer()->needsLayout());
@@ -823,7 +823,7 @@
 void Element::setAttribute(const AtomicString& localName, const AtomicString& value, ExceptionCode& ec)
 {
     if (!Document::isValidName(localName)) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return;
     }
 
@@ -907,14 +907,14 @@
     document()->incDOMTreeVersion();
 
     StyleResolver* styleResolver = document()->styleResolverIfExists();
-    bool testShouldInvalidateStyle = attached() && styleResolver && styleChangeType() < FullStyleChange;
+    bool testShouldInvalidateStyle = attached() && styleResolver && styleChangeType() < SubtreeStyleChange;
     bool shouldInvalidateStyle = false;
 
     if (isStyledElement() && name == styleAttr) {
         styleAttributeChanged(newValue, reason);
     } else if (isStyledElement() && isPresentationAttribute(name)) {
         elementData()->m_presentationAttributeStyleIsDirty = true;
-        setNeedsStyleRecalc(InlineStyleChange);
+        setNeedsStyleRecalc(LocalStyleChange);
     }
 
     if (isIdAttributeName(name)) {
@@ -946,9 +946,8 @@
 
 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason)
 {
-    if (RuntimeEnabledFeatures::customDOMElementsEnabled() && name == isAttr) {
-        document()->ensureCustomElementRegistry()->didGiveTypeExtension(this, newValue);
-    }
+    if (name == isAttr)
+        document()->registrationContext()->didGiveTypeExtension(this, newValue);
     attributeChanged(name, newValue, reason);
 }
 
@@ -1023,7 +1022,7 @@
 void Element::classAttributeChanged(const AtomicString& newClassString)
 {
     StyleResolver* styleResolver = document()->styleResolverIfExists();
-    bool testShouldInvalidateStyle = attached() && styleResolver && styleChangeType() < FullStyleChange;
+    bool testShouldInvalidateStyle = attached() && styleResolver && styleChangeType() < SubtreeStyleChange;
     bool shouldInvalidateStyle = false;
 
     if (classStringHasClassName(newClassString)) {
@@ -1266,6 +1265,9 @@
     if (scope != treeScope())
         return InsertionDone;
 
+    if (isUpgradedCustomElement())
+        document()->registrationContext()->customElementDidEnterDocument(this);
+
     const AtomicString& idValue = getIdAttribute();
     if (!idValue.isNull())
         updateId(scope, nullAtom, idValue);
@@ -1292,7 +1294,10 @@
     if (Element* after = pseudoElement(AFTER))
         after->removedFrom(insertionPoint);
 
+    if (Element* backdrop = pseudoElement(BACKDROP))
+        backdrop->removedFrom(insertionPoint);
     document()->removeFromTopLayer(this);
+
     if (containsFullScreenElement())
         setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
 
@@ -1318,8 +1323,13 @@
     }
 
     ContainerNode::removedFrom(insertionPoint);
-    if (wasInDocument && hasPendingResources())
-        document()->accessSVGExtensions()->removeElementFromPendingResources(this);
+    if (wasInDocument) {
+        if (hasPendingResources())
+            document()->accessSVGExtensions()->removeElementFromPendingResources(this);
+
+        if (isUpgradedCustomElement() && document()->registrationContext())
+            document()->registrationContext()->customElementDidLeaveDocument(this);
+    }
 }
 
 void Element::createRendererIfNeeded(const AttachContext& context)
@@ -1350,6 +1360,7 @@
     ContainerNode::attach(context);
 
     createPseudoElementIfNeeded(AFTER);
+    createPseudoElementIfNeeded(BACKDROP);
 
     if (hasRareData()) {
         ElementRareData* data = elementRareData();
@@ -1382,6 +1393,7 @@
         ElementRareData* data = elementRareData();
         data->setPseudoElement(BEFORE, 0);
         data->setPseudoElement(AFTER, 0);
+        data->setPseudoElement(BACKDROP, 0);
         data->setIsInCanvasSubtree(false);
         data->resetComputedStyle();
         data->resetDynamicRestyleObservations();
@@ -1445,7 +1457,7 @@
     return document()->styleResolver()->styleForElement(this);
 }
 
-void Element::recalcStyle(StyleChange change)
+bool Element::recalcStyle(StyleChange change)
 {
     ASSERT(document()->inStyleRecalc());
 
@@ -1487,13 +1499,13 @@
 
             if (hasCustomStyleCallbacks())
                 didRecalcStyle(change);
-            return;
+            return true;
         }
 
         InspectorInstrumentation::didRecalculateStyleForElement(this);
 
         if (RenderObject* renderer = this->renderer()) {
-            if (localChange != NoChange || pseudoStyleCacheIsInvalid(currentStyle.get(), newStyle.get()) || (change == Force && renderer->requiresForcedStyleRecalcPropagation()) || needsLayerUpdate())
+            if (localChange != NoChange || pseudoStyleCacheIsInvalid(currentStyle.get(), newStyle.get()) || (change == Force && renderer->requiresForcedStyleRecalcPropagation()) || shouldNotifyRendererWithIdenticalStyles())
                 renderer->setAnimatableStyle(newStyle.get());
             else if (needsStyleRecalc()) {
                 // Although no change occurred, we use the new style so that the cousin style sharing code won't get
@@ -1510,7 +1522,7 @@
             change = Force;
         }
 
-        if (styleChangeType() == FullStyleChange)
+        if (styleChangeType() == SubtreeStyleChange)
             change = Force;
         else if (change != Force)
             change = localChange;
@@ -1533,23 +1545,35 @@
     // without doing way too much re-resolution.
     bool forceCheckOfNextElementSibling = false;
     bool forceCheckOfAnyElementSibling = false;
-    for (Node *n = firstChild(); n; n = n->nextSibling()) {
-        if (n->isTextNode()) {
-            toText(n)->recalcTextStyle(change);
-            continue;
+    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()) {
+            Element* element = toElement(child);
+
+            if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling)
+                element->setNeedsStyleRecalc();
+
+            bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() == SubtreeStyleChange;
+            forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
+            forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
+
+            if (shouldRecalcStyle(change, element)) {
+                parentPusher.push();
+                didReattach = element->recalcStyle(change);
+            }
         }
-        if (!n->isElementNode())
-            continue;
-        Element* element = toElement(n);
-        bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() == FullStyleChange;
-        if ((forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling))
-            element->setNeedsStyleRecalc();
-        if (shouldRecalcStyle(change, element)) {
-            parentPusher.push();
-            element->recalcStyle(change);
-        }
-        forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
-        forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
+
+        forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyWhitespaceSibling;
     }
 
     if (shouldRecalcStyle(change, this))
@@ -1560,6 +1584,7 @@
 
     if (hasCustomStyleCallbacks())
         didRecalcStyle(change);
+    return false;
 }
 
 ElementShadow* Element::shadow() const
@@ -1591,7 +1616,7 @@
     // subtrees won't work well in that element. Until they are fixed, we disable
     // adding author shadow root for them.
     if (!areAuthorShadowsAllowed()) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return 0;
     }
     return ensureShadow()->addShadowRoot(this, ShadowRoot::AuthorShadowRoot);
@@ -1810,7 +1835,7 @@
 PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionCode& ec)
 {
     if (!attrNode) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return 0;
     }
 
@@ -1818,10 +1843,10 @@
     if (oldAttrNode.get() == attrNode)
         return attrNode; // This Attr is already attached to the element.
 
-    // INUSE_ATTRIBUTE_ERR: Raised if node is an Attr that is already an attribute of another Element object.
+    // InUseAttributeError: Raised if node is an Attr that is already an attribute of another Element object.
     // The DOM user must explicitly clone Attr nodes to re-use them in other elements.
     if (attrNode->ownerElement()) {
-        ec = INUSE_ATTRIBUTE_ERR;
+        ec = InUseAttributeError;
         return 0;
     }
 
@@ -1853,11 +1878,11 @@
 PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionCode& ec)
 {
     if (!attr) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return 0;
     }
     if (attr->ownerElement() != this) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
 
@@ -1867,7 +1892,7 @@
 
     size_t index = elementData()->getAttrIndex(attr);
     if (index == notFound) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
 
@@ -1886,7 +1911,7 @@
     QualifiedName qName(prefix, localName, namespaceURI);
 
     if (!Document::hasValidNamespaceForAttributes(qName)) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return false;
     }
 
@@ -2022,7 +2047,7 @@
         // If a focus event handler changes the focus to a different node it
         // does not make sense to continue and update appearence.
         protect = this;
-        if (!page->focusController()->setFocusedNode(this, doc->frame(), direction))
+        if (!page->focusController()->setFocusedElement(this, doc->frame(), direction))
             return;
     }
 
@@ -2063,12 +2088,12 @@
 void Element::blur()
 {
     cancelFocusAppearanceUpdate();
-    Document* doc = document();
-    if (treeScope()->focusedNode() == this) {
+    if (treeScope()->adjustedFocusedElement() == this) {
+        Document* doc = document();
         if (doc->frame())
-            doc->frame()->page()->focusController()->setFocusedNode(0, doc->frame());
+            doc->frame()->page()->focusController()->setFocusedElement(0, doc->frame());
         else
-            doc->setFocusedNode(0);
+            doc->setFocusedElement(0);
     }
 }
 
@@ -2327,11 +2352,6 @@
     return hasRareData() && elementRareData()->isInCanvasSubtree();
 }
 
-bool Element::isUnresolvedCustomElement()
-{
-    return isCustomElement() && document()->registry()->isUnresolved(this);
-}
-
 void Element::setIsInsideRegion(bool value)
 {
     if (value == isInsideRegion())
@@ -2423,7 +2443,10 @@
 
 void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
 {
-    if (!document()->styleSheetCollection()->usesBeforeAfterRules())
+    if ((pseudoId == BEFORE || pseudoId == AFTER) && !document()->styleSheetCollection()->usesBeforeAfterRules())
+        return;
+
+    if (pseudoId == BACKDROP && !isInTopLayer())
         return;
 
     if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId)))
@@ -2434,7 +2457,10 @@
 
     ASSERT(!isPseudoElement());
     RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId);
+    if (pseudoId == BACKDROP)
+        document()->addToTopLayer(element.get(), this);
     element->attach();
+
     ensureElementRareData()->setPseudoElement(pseudoId, element.release());
 }
 
@@ -2463,7 +2489,7 @@
 bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec)
 {
     if (selector.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return false;
     }
 
@@ -2568,7 +2594,7 @@
 void Element::setContainsFullScreenElement(bool flag)
 {
     ensureElementRareData()->setContainsFullScreenElement(flag);
-    setNeedsStyleRecalc(SyntheticStyleChange);
+    setNeedsStyleRecalc(SubtreeStyleChange);
 }
 
 static Element* parentCrossingFrameBoundaries(Element* element)
@@ -2770,9 +2796,9 @@
         return;
 
     if (!oldForAttributeValue.isEmpty())
-        scope->removeLabel(oldForAttributeValue, static_cast<HTMLLabelElement*>(this));
+        scope->removeLabel(oldForAttributeValue, toHTMLLabelElement(this));
     if (!newForAttributeValue.isEmpty())
-        scope->addLabel(newForAttributeValue, static_cast<HTMLLabelElement*>(this));
+        scope->addLabel(newForAttributeValue, toHTMLLabelElement(this));
 }
 
 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
@@ -2790,6 +2816,9 @@
     if (oldValue != newValue) {
         if (attached() && document()->styleResolver() && document()->styleResolver()->hasSelectorForAttribute(name.localName()))
            setNeedsStyleRecalc();
+
+        if (isUpgradedCustomElement())
+            document()->registrationContext()->customElementAttributeDidChange(this, name.localName(), oldValue, newValue);
     }
 
     if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(this, name))
@@ -2819,6 +2848,20 @@
     dispatchSubtreeModifiedEvent();
 }
 
+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 (hasID())
+            setIdAttribute(getIdAttribute());
+        if (hasClass())
+            setAttribute(HTMLNames::classAttr, getClassAttribute());
+    }
+}
 
 void Element::updateNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName)
 {
@@ -2865,7 +2908,9 @@
 
 static void scheduleLayerUpdateCallback(Node* node)
 {
-    node->setNeedsLayerUpdate();
+    // Notify the renderer even is the styles are identical since it may need to
+    // create or destroy a RenderLayer.
+    node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
 }
 
 void Element::scheduleLayerUpdate()
@@ -2873,7 +2918,7 @@
     if (postAttachCallbacksAreSuspended())
         queuePostAttachCallback(scheduleLayerUpdateCallback, this);
     else
-        setNeedsLayerUpdate();
+        scheduleLayerUpdateCallback(this);
 }
 
 HTMLCollection* Element::cachedHTMLCollection(CollectionType type)
@@ -2983,14 +3028,22 @@
     if (!oldName.isNull() || !newName.isNull())
         updateName(oldName, newName);
 
+    // Quirks mode makes class and id not case sensitive. We can't share the ElementData
+    // if the idForStyleResolution and the className need different casing.
+    bool ownerDocumentsHaveDifferentCaseSensitivity = false;
+    if (other.hasClass() || other.hasID())
+        ownerDocumentsHaveDifferentCaseSensitivity = other.document()->inQuirksMode() != document()->inQuirksMode();
+
     // If 'other' has a mutable ElementData, convert it to an immutable one so we can share it between both elements.
-    // We can only do this if there is no CSSOM wrapper for other's inline style, and there are no presentation attributes.
+    // We can only do this if there is no CSSOM wrapper for other's inline style, and there are no presentation attributes,
+    // and sharing the data won't result in different case sensitivity of class or id.
     if (other.m_elementData->isUnique()
+        && !ownerDocumentsHaveDifferentCaseSensitivity
         && !other.m_elementData->presentationAttributeStyle()
         && (!other.m_elementData->inlineStyle() || !other.m_elementData->inlineStyle()->hasCSSOMWrapper()))
         const_cast<Element&>(other).m_elementData = static_cast<const UniqueElementData*>(other.m_elementData.get())->makeShareableCopy();
 
-    if (!other.m_elementData->isUnique())
+    if (!other.m_elementData->isUnique() && !ownerDocumentsHaveDifferentCaseSensitivity)
         m_elementData = other.m_elementData;
     else
         m_elementData = other.m_elementData->makeUniqueCopy();
@@ -3196,14 +3249,14 @@
 
     elementData()->m_styleAttributeIsDirty = false;
 
-    setNeedsStyleRecalc(InlineStyleChange);
+    setNeedsStyleRecalc(LocalStyleChange);
     InspectorInstrumentation::didInvalidateStyleAttr(document(), this);
 }
 
 void Element::inlineStyleChanged()
 {
     ASSERT(isStyledElement());
-    setNeedsStyleRecalc(InlineStyleChange);
+    setNeedsStyleRecalc(LocalStyleChange);
     ASSERT(elementData());
     elementData()->m_styleAttributeIsDirty = true;
     InspectorInstrumentation::didInvalidateStyleAttr(document(), this);
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index 2aa1745..4f71560 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -208,6 +208,8 @@
     DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup);
     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);
@@ -334,6 +336,8 @@
     // Returns the absolute bounding box translated into screen coordinates:
     IntRect screenRect() const;
 
+    virtual void didMoveToNewDocument(Document*) OVERRIDE;
+
     void removeAttribute(const AtomicString& name);
     void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
 
@@ -432,7 +436,7 @@
     virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
     virtual RenderObject* createRenderer(RenderStyle*);
     virtual bool rendererIsNeeded(const NodeRenderingContext&);
-    void recalcStyle(StyleChange = NoChange);
+    bool recalcStyle(StyleChange = NoChange);
     void didAffectSelector(AffectedSelectorMask);
 
     ElementShadow* shadow() const;
@@ -479,7 +483,7 @@
     void setIsInCanvasSubtree(bool);
     bool isInCanvasSubtree() const;
 
-    bool isUnresolvedCustomElement();
+    bool isUnresolvedCustomElement() { return isCustomElement() && !isUpgradedCustomElement(); }
 
     void setIsInsideRegion(bool);
     bool isInsideRegion() const;
@@ -560,7 +564,7 @@
     virtual bool isInRange() const { return false; }
     virtual bool isOutOfRange() const { return false; }
     virtual bool isFrameElementBase() const { return false; }
-    virtual bool isTextFieldDecoration() const { return false; }
+    virtual bool isPasswordGeneratorButtonElement() const { return false; }
     virtual bool isClearButtonElement() const;
 
     virtual bool canContainRangeEndPoint() const { return true; }
diff --git a/Source/core/dom/Element.idl b/Source/core/dom/Element.idl
index 543a8a1..2dd8467 100644
--- a/Source/core/dom/Element.idl
+++ b/Source/core/dom/Element.idl
@@ -27,12 +27,12 @@
     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName;
 
     [TreatReturnedNullStringAs=Null] DOMString getAttribute([Default=Undefined] optional DOMString name);
-    [RaisesException] void setAttribute([Default=Undefined] optional DOMString name,
+    [RaisesException, DeliverCustomElementCallbacks] void setAttribute([Default=Undefined] optional DOMString name,
                                      [Default=Undefined] optional DOMString value);
-    void removeAttribute([Default=Undefined] optional DOMString name);
+    [DeliverCustomElementCallbacks] void removeAttribute([Default=Undefined] optional DOMString name);
     Attr getAttributeNode([Default=Undefined] optional DOMString name);
-    [RaisesException] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
-    [RaisesException] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr);
+    [RaisesException, DeliverCustomElementCallbacks] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
+    [RaisesException, DeliverCustomElementCallbacks] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr);
     [PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
 
     // For ObjC this is defined on Node for legacy support.
@@ -43,10 +43,10 @@
 
      DOMString getAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                             [Default=Undefined] optional DOMString localName);
-     [RaisesException] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+     [RaisesException, DeliverCustomElementCallbacks] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                        [Default=Undefined] optional DOMString qualifiedName,
                                        [Default=Undefined] optional DOMString value);
-     void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI,
+     [DeliverCustomElementCallbacks] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI,
                                           DOMString localName);
      NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                    [Default=Undefined] optional DOMString localName);
@@ -145,6 +145,8 @@
     [NotEnumerable, PerWorldBindings] attribute EventListener onkeyup;
     [NotEnumerable, PerWorldBindings] attribute EventListener onload;
     [NotEnumerable, PerWorldBindings] attribute EventListener onmousedown;
+    [NotEnumerable, PerWorldBindings] attribute EventListener onmouseenter;
+    [NotEnumerable, PerWorldBindings] attribute EventListener onmouseleave;
     [NotEnumerable, PerWorldBindings] attribute EventListener onmousemove;
     [NotEnumerable, PerWorldBindings] attribute EventListener onmouseout;
     [NotEnumerable, PerWorldBindings] attribute EventListener onmouseover;
diff --git a/Source/core/dom/ElementRareData.cpp b/Source/core/dom/ElementRareData.cpp
index dd404bf..c6510d5 100644
--- a/Source/core/dom/ElementRareData.cpp
+++ b/Source/core/dom/ElementRareData.cpp
@@ -43,7 +43,7 @@
     RegionOversetState regionOversetState;
     LayoutSize sizeForResizing;
     IntSize scrollOffset;
-    void* pointers[9];
+    void* pointers[10];
 };
 
 COMPILE_ASSERT(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), ElementRareDataShouldStaySmall);
diff --git a/Source/core/dom/ElementRareData.h b/Source/core/dom/ElementRareData.h
index 440df8e..77244da 100644
--- a/Source/core/dom/ElementRareData.h
+++ b/Source/core/dom/ElementRareData.h
@@ -186,6 +186,7 @@
 
     RefPtr<PseudoElement> m_generatedBefore;
     RefPtr<PseudoElement> m_generatedAfter;
+    RefPtr<PseudoElement> m_backdrop;
 
     ElementRareData(RenderObject*);
     void releasePseudoElement(PseudoElement*);
@@ -226,6 +227,7 @@
     ASSERT(!m_shadow);
     ASSERT(!m_generatedBefore);
     ASSERT(!m_generatedAfter);
+    ASSERT(!m_backdrop);
 }
 
 inline void ElementRareData::setPseudoElement(PseudoId pseudoId, PassRefPtr<PseudoElement> element)
@@ -239,6 +241,10 @@
         releasePseudoElement(m_generatedAfter.get());
         m_generatedAfter = element;
         break;
+    case BACKDROP:
+        releasePseudoElement(m_backdrop.get());
+        m_backdrop = element;
+        break;
     default:
         ASSERT_NOT_REACHED();
     }
@@ -251,6 +257,8 @@
         return m_generatedBefore.get();
     case AFTER:
         return m_generatedAfter.get();
+    case BACKDROP:
+        return m_backdrop.get();
     default:
         return 0;
     }
@@ -267,6 +275,7 @@
     ASSERT(!element->nextSibling());
     ASSERT(!element->previousSibling());
 
+    element->document()->removeFromTopLayer(element);
     element->setParentOrShadowHostNode(0);
 }
 
diff --git a/Source/core/dom/ErrorEvent.h b/Source/core/dom/ErrorEvent.h
index 7992ec3..0c2a453 100644
--- a/Source/core/dom/ErrorEvent.h
+++ b/Source/core/dom/ErrorEvent.h
@@ -32,7 +32,7 @@
 #define ErrorEvent_h
 
 #include "core/dom/Event.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Event.cpp b/Source/core/dom/Event.cpp
index 770e175..74a795f 100644
--- a/Source/core/dom/Event.cpp
+++ b/Source/core/dom/Event.cpp
@@ -27,8 +27,8 @@
 #include "core/dom/EventTarget.h"
 #include "core/dom/StaticNodeList.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventContext.h b/Source/core/dom/EventContext.h
index 5e4f136..ea8961b 100644
--- a/Source/core/dom/EventContext.h
+++ b/Source/core/dom/EventContext.h
@@ -31,7 +31,7 @@
 #include "core/dom/Node.h"
 #include "core/dom/StaticNodeList.h"
 #include "core/dom/TreeScope.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventDispatchMediator.h b/Source/core/dom/EventDispatchMediator.h
index c334348..00ab327 100644
--- a/Source/core/dom/EventDispatchMediator.h
+++ b/Source/core/dom/EventDispatchMediator.h
@@ -31,9 +31,9 @@
 #ifndef EventDispatchMediator_h
 #define EventDispatchMediator_h
 
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventFactory.h b/Source/core/dom/EventFactory.h
index adfcfb5..2436e3f 100644
--- a/Source/core/dom/EventFactory.h
+++ b/Source/core/dom/EventFactory.h
@@ -26,8 +26,8 @@
 #ifndef EventFactory_h
 #define EventFactory_h
 
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventListener.h b/Source/core/dom/EventListener.h
index a1add8c..768a0c3 100644
--- a/Source/core/dom/EventListener.h
+++ b/Source/core/dom/EventListener.h
@@ -21,7 +21,7 @@
 #ifndef EventListener_h
 #define EventListener_h
 
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventListenerMap.cpp b/Source/core/dom/EventListenerMap.cpp
index 1bc8690..ad0b72b 100644
--- a/Source/core/dom/EventListenerMap.cpp
+++ b/Source/core/dom/EventListenerMap.cpp
@@ -75,6 +75,20 @@
     return false;
 }
 
+bool EventListenerMap::containsCapturing(const AtomicString& eventType) const
+{
+    for (unsigned i = 0; i < m_entries.size(); ++i) {
+        if (m_entries[i].first == eventType) {
+            const EventListenerVector* vector = m_entries[i].second.get();
+            for (unsigned j = 0; j < vector->size(); ++j) {
+                if (vector->at(j).useCapture)
+                    return true;
+            }
+        }
+    }
+    return false;
+}
+
 void EventListenerMap::clear()
 {
     assertNoActiveIterators();
diff --git a/Source/core/dom/EventListenerMap.h b/Source/core/dom/EventListenerMap.h
index 052018a..4889d94 100644
--- a/Source/core/dom/EventListenerMap.h
+++ b/Source/core/dom/EventListenerMap.h
@@ -34,9 +34,9 @@
 #define EventListenerMap_h
 
 #include "core/dom/RegisteredEventListener.h"
-#include <wtf/Forward.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/AtomicStringHash.h>
+#include "wtf/Forward.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/AtomicStringHash.h"
 
 namespace WebCore {
 
@@ -50,6 +50,7 @@
 
     bool isEmpty() const { return m_entries.isEmpty(); }
     bool contains(const AtomicString& eventType) const;
+    bool containsCapturing(const AtomicString& eventType) const;
 
     void clear();
     bool add(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
diff --git a/Source/core/dom/EventNames.h b/Source/core/dom/EventNames.h
index 69796a9..0c01af9 100644
--- a/Source/core/dom/EventNames.h
+++ b/Source/core/dom/EventNames.h
@@ -25,7 +25,7 @@
 #include "EventInterfaces.h"
 #include "EventTargetInterfaces.h"
 #include "core/platform/ThreadGlobalData.h"
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
@@ -92,6 +92,8 @@
     macro(message) \
     macro(midimessage) \
     macro(mousedown) \
+    macro(mouseenter) \
+    macro(mouseleave) \
     macro(mousemove) \
     macro(mouseout) \
     macro(mouseover) \
diff --git a/Source/core/dom/EventQueue.h b/Source/core/dom/EventQueue.h
index 56ce153..513bf36 100644
--- a/Source/core/dom/EventQueue.h
+++ b/Source/core/dom/EventQueue.h
@@ -27,9 +27,9 @@
 #ifndef EventQueue_h
 #define EventQueue_h
 
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/PassOwnPtr.h>
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventRetargeter.cpp b/Source/core/dom/EventRetargeter.cpp
index 415a3fc..153ada7 100644
--- a/Source/core/dom/EventRetargeter.cpp
+++ b/Source/core/dom/EventRetargeter.cpp
@@ -32,9 +32,9 @@
 #include "core/dom/TouchList.h"
 #include "core/dom/TreeScope.h"
 #include "core/dom/shadow/ShadowRoot.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventSender.h b/Source/core/dom/EventSender.h
index 40d8175..d738901 100644
--- a/Source/core/dom/EventSender.h
+++ b/Source/core/dom/EventSender.h
@@ -27,8 +27,8 @@
 #define EventSender_h
 
 #include "core/platform/Timer.h"
-#include <wtf/text/AtomicString.h>
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/EventTarget.cpp b/Source/core/dom/EventTarget.cpp
index 15fb804..f2aa211 100644
--- a/Source/core/dom/EventTarget.cpp
+++ b/Source/core/dom/EventTarget.cpp
@@ -143,7 +143,7 @@
 bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
 {
     if (!event || event->type().isEmpty() || event->isBeingDispatched()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return false;
     }
 
diff --git a/Source/core/dom/EventTarget.h b/Source/core/dom/EventTarget.h
index 2d8a0a9..5b736ed 100644
--- a/Source/core/dom/EventTarget.h
+++ b/Source/core/dom/EventTarget.h
@@ -121,6 +121,7 @@
 
         bool hasEventListeners();
         bool hasEventListeners(const AtomicString& eventType);
+        bool hasCapturingEventListeners(const AtomicString& eventType);
         const EventListenerVector& getEventListeners(const AtomicString& eventType);
 
         bool fireEventListeners(Event*);
@@ -165,9 +166,13 @@
         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); } \
 
-    #define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \
-        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return recipient ? recipient->getAttributeEventListener(eventNames().attribute##Event, isolatedWorld) : 0; } \
-        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { if (recipient) recipient->setAttributeEventListener(eventNames().attribute##Event, 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); }
 
     inline bool EventTarget::isFiringEventListeners()
     {
@@ -193,6 +198,14 @@
         return d->eventListenerMap.contains(eventType);
     }
 
+    inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventType)
+    {
+        EventTargetData* d = eventTargetData();
+        if (!d)
+            return false;
+        return d->eventListenerMap.containsCapturing(eventType);
+    }
+
 } // namespace WebCore
 
 #endif // EventTarget_h
diff --git a/Source/core/dom/EventTarget.idl b/Source/core/dom/EventTarget.idl
index 32af401..d711cd7 100644
--- a/Source/core/dom/EventTarget.idl
+++ b/Source/core/dom/EventTarget.idl
@@ -19,17 +19,14 @@
  */
 
 [
-    NoInterfaceObject,
     CustomToV8,
-    DoNotGenerateWrap,
-    EventTarget
+    DoNotGenerateWrap
 ] interface EventTarget {
     void addEventListener(DOMString type, 
-                                         EventListener listener, 
-                                         optional boolean useCapture);
+                          EventListener listener,
+                          optional boolean useCapture);
     void removeEventListener(DOMString type, 
-                                         EventListener listener, 
-                                         optional boolean useCapture);
+                             EventListener listener,
+                             optional boolean useCapture);
     [RaisesException] boolean dispatchEvent(Event event);
 };
-
diff --git a/Source/core/dom/ExceptionCode.h b/Source/core/dom/ExceptionCode.h
index cf6dc69..93fbdc0 100644
--- a/Source/core/dom/ExceptionCode.h
+++ b/Source/core/dom/ExceptionCode.h
@@ -31,40 +31,39 @@
     // Some of these are considered historical since they have been
     // changed or removed from the specifications.
     enum {
-        // FIXME: Rename these to use CamelCase matching the exception name.
-        INDEX_SIZE_ERR = 1,
-        HIERARCHY_REQUEST_ERR,
-        WRONG_DOCUMENT_ERR,
-        INVALID_CHARACTER_ERR,
-        NO_MODIFICATION_ALLOWED_ERR,
-        NOT_FOUND_ERR,
-        NOT_SUPPORTED_ERR,
-        INUSE_ATTRIBUTE_ERR, // Historical. Only used in setAttributeNode etc which have been removed from the DOM specs.
+        IndexSizeError = 1,
+        HierarchyRequestError,
+        WrongDocumentError,
+        InvalidCharacterError,
+        NoModificationAllowedError,
+        NotFoundError,
+        NotSupportedError,
+        InUseAttributeError, // Historical. Only used in setAttributeNode etc which have been removed from the DOM specs.
 
+        // FIXME: Rename these to use CamelCase matching the exception name.
         // Introduced in DOM Level 2:
-        INVALID_STATE_ERR,
-        SYNTAX_ERR,
-        INVALID_MODIFICATION_ERR,
-        NAMESPACE_ERR,
-        INVALID_ACCESS_ERR,
+        InvalidStateError,
+        SyntaxError,
+        InvalidModificationError,
+        NamespaceError,
+        InvalidAccessError,
 
         // Introduced in DOM Level 3:
-        TYPE_MISMATCH_ERR, // Historical; use TypeError instead
+        TypeMismatchError, // Historical; use TypeError instead
 
         // XMLHttpRequest extension:
-        SECURITY_ERR,
+        SecurityError,
 
         // Others introduced in HTML5:
-        NETWORK_ERR,
-        ABORT_ERR,
-        URL_MISMATCH_ERR,
-        QUOTA_EXCEEDED_ERR,
-        TIMEOUT_ERR,
-        INVALID_NODE_TYPE_ERR,
-        DATA_CLONE_ERR,
+        NetworkError,
+        AbortError,
+        URLMismatchError,
+        QuotaExceededError,
+        TimeoutError,
+        InvalidNodeTypeError,
+        DataCloneError,
 
         // These are IDB-specific.
-        IDBNotFoundError,
         UnknownError,
         ConstraintError,
         DataError,
@@ -78,25 +77,16 @@
         FSSecurityError,
         FSAbortError,
         FSNotReadableError,
-        FSEncodingError,
+        EncodingError,
         FSNoModificationAllowedError,
         FSInvalidStateError,
         FSSyntaxError,
-        FSInvalidModificationError,
         FSQuotaExceededError,
         FSTypeMismatchError,
-        FSPathExistsError,
+        PathExistsError,
 
         // SQL
-        // FIXME: Consolidate these once https://crbug.com/252233 is fixed.
-        SQLUnknownError,
-        SQLDatabaseError,
-        SQLVersionError,
-        SQLTooLargeError,
-        SQLQuotaExceededError,
-        SQLSyntaxError,
-        SQLConstraintError,
-        SQLTimeoutError,
+        SQLDatabaseError, // Naming conflict with DatabaseError class.
 
         // WebIDL exception types, handled by the binding layer.
         // FIXME: Add GeneralError, EvalError, etc. when implemented in the bindings.
diff --git a/Source/core/dom/ExceptionCodePlaceholder.h b/Source/core/dom/ExceptionCodePlaceholder.h
index 5d19eb3..e6a4fe6 100644
--- a/Source/core/dom/ExceptionCodePlaceholder.h
+++ b/Source/core/dom/ExceptionCodePlaceholder.h
@@ -31,8 +31,8 @@
 #ifndef ExceptionCodePlaceholder_h
 #define ExceptionCodePlaceholder_h
 
-#include <wtf/Assertions.h>
-#include <wtf/Noncopyable.h>
+#include "wtf/Assertions.h"
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/GenericEventQueue.h b/Source/core/dom/GenericEventQueue.h
index 5900a72..5f4e426 100644
--- a/Source/core/dom/GenericEventQueue.h
+++ b/Source/core/dom/GenericEventQueue.h
@@ -29,9 +29,9 @@
 #include "core/dom/EventQueue.h"
 #include "core/dom/EventTarget.h"
 #include "core/platform/Timer.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/GestureEvent.cpp b/Source/core/dom/GestureEvent.cpp
index 5b1be80..a4f5cf8 100644
--- a/Source/core/dom/GestureEvent.cpp
+++ b/Source/core/dom/GestureEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/dom/Element.h"
 #include "core/dom/GestureEvent.h"
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
@@ -84,8 +84,10 @@
 
 const AtomicString& GestureEvent::interfaceName() const
 {
-    DEFINE_STATIC_LOCAL(AtomicString, name, ("TBDInterface"));
-    return name;
+    // FIXME: when a GestureEvent.idl interface is defined, return the string "GestureEvent".
+    // Until that happens, do not advertise an interface that does not exist, since it will
+    // trip up the bindings integrity checks.
+    return UIEvent::interfaceName();
 }
 
 GestureEvent::GestureEvent()
diff --git a/Source/core/dom/IdTargetObserver.h b/Source/core/dom/IdTargetObserver.h
index f9007c4..e76b8a5 100644
--- a/Source/core/dom/IdTargetObserver.h
+++ b/Source/core/dom/IdTargetObserver.h
@@ -26,7 +26,7 @@
 #ifndef IdTargetObserver_h
 #define IdTargetObserver_h
 
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/IdTargetObserverRegistry.h b/Source/core/dom/IdTargetObserverRegistry.h
index ef5d662..fb04ff5 100644
--- a/Source/core/dom/IdTargetObserverRegistry.h
+++ b/Source/core/dom/IdTargetObserverRegistry.h
@@ -26,11 +26,11 @@
 #ifndef IdTargetObserverRegistry_h
 #define IdTargetObserverRegistry_h
 
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/LiveNodeList.h b/Source/core/dom/LiveNodeList.h
index 7ed7300..c4aa5cb 100644
--- a/Source/core/dom/LiveNodeList.h
+++ b/Source/core/dom/LiveNodeList.h
@@ -28,8 +28,8 @@
 #include "core/dom/Document.h"
 #include "core/dom/NodeList.h"
 #include "core/html/CollectionType.h"
-#include <wtf/Forward.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Forward.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/MessageEvent.cpp b/Source/core/dom/MessageEvent.cpp
index 0e269d7..bec2624 100644
--- a/Source/core/dom/MessageEvent.cpp
+++ b/Source/core/dom/MessageEvent.cpp
@@ -46,7 +46,6 @@
 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)
     : Event(type, initializer)
     , m_dataType(DataTypeScriptValue)
-    , m_dataAsScriptValue(initializer.data)
     , m_origin(initializer.origin)
     , m_lastEventId(initializer.lastEventId)
     , m_source(initializer.source)
@@ -55,10 +54,9 @@
     ScriptWrappable::init(this);
 }
 
-MessageEvent::MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
+MessageEvent::MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
     : Event(eventNames().messageEvent, false, false)
     , m_dataType(DataTypeScriptValue)
-    , m_dataAsScriptValue(data)
     , m_origin(origin)
     , m_lastEventId(lastEventId)
     , m_source(source)
@@ -115,7 +113,7 @@
 {
 }
 
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
+void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
 {
     if (dispatched())
         return;
@@ -123,7 +121,6 @@
     initEvent(type, canBubble, cancelable);
 
     m_dataType = DataTypeScriptValue;
-    m_dataAsScriptValue = data;
     m_origin = origin;
     m_lastEventId = lastEventId;
     m_source = source;
diff --git a/Source/core/dom/MessageEvent.h b/Source/core/dom/MessageEvent.h
index 5912f8f..80965bf 100644
--- a/Source/core/dom/MessageEvent.h
+++ b/Source/core/dom/MessageEvent.h
@@ -28,13 +28,12 @@
 #ifndef MessageEvent_h
 #define MessageEvent_h
 
-#include "bindings/v8/ScriptValue.h"
 #include "bindings/v8/SerializedScriptValue.h"
 #include "core/dom/Event.h"
 #include "core/dom/MessagePort.h"
 #include "core/fileapi/Blob.h"
 #include "core/page/DOMWindow.h"
-#include <wtf/ArrayBuffer.h>
+#include "wtf/ArrayBuffer.h"
 
 namespace WebCore {
 
@@ -43,7 +42,6 @@
 struct MessageEventInit : public EventInit {
     MessageEventInit();
 
-    ScriptValue data;
     String origin;
     String lastEventId;
     RefPtr<DOMWindow> source;
@@ -56,9 +54,9 @@
     {
         return adoptRef(new MessageEvent);
     }
-    static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const ScriptValue& data = ScriptValue(), const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
+    static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
     {
-        return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
+        return adoptRef(new MessageEvent(origin, lastEventId, source, ports));
     }
     static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
     {
@@ -82,7 +80,7 @@
     }
     virtual ~MessageEvent();
 
-    void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
+    void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
     void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
 
     const String& origin() const { return m_origin; }
@@ -100,8 +98,7 @@
         DataTypeArrayBuffer
     };
     DataType dataType() const { return m_dataType; }
-    const ScriptValue& dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }
-    PassRefPtr<SerializedScriptValue> dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue; }
+    SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); }
     String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; }
     Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); }
     ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); }
@@ -109,7 +106,7 @@
 private:
     MessageEvent();
     MessageEvent(const AtomicString&, const MessageEventInit&);
-    MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
+    MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
     MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
 
     explicit MessageEvent(const String& data, const String& origin);
@@ -117,7 +114,6 @@
     explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin);
 
     DataType m_dataType;
-    ScriptValue m_dataAsScriptValue;
     RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
     String m_dataAsString;
     RefPtr<Blob> m_dataAsBlob;
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index 37181e2..c83921e 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -67,7 +67,7 @@
         for (unsigned int i = 0; i < ports->size(); ++i) {
             MessagePort* dataPort = (*ports)[i].get();
             if (dataPort == this || m_entangledChannel->isConnectedTo(dataPort)) {
-                ec = INVALID_STATE_ERR;
+                ec = InvalidStateError;
                 return;
             }
         }
@@ -200,7 +200,7 @@
     for (unsigned int i = 0; i < ports->size(); ++i) {
         MessagePort* port = (*ports)[i].get();
         if (!port || port->isNeutered() || portSet.contains(port)) {
-            ec = DATA_CLONE_ERR;
+            ec = DataCloneError;
             return nullptr;
         }
         portSet.add(port);
diff --git a/Source/core/dom/MessagePort.idl b/Source/core/dom/MessagePort.idl
index 85514c2..18e7284 100644
--- a/Source/core/dom/MessagePort.idl
+++ b/Source/core/dom/MessagePort.idl
@@ -26,9 +26,8 @@
  */
 
 [
-    ActiveDOMObject,
-    EventTarget
-] interface MessagePort {
+    ActiveDOMObject
+] interface MessagePort : EventTarget {
 // We need to have something as an ObjC binding, because MessagePort is used in MessageEvent, which already has one,
 // but we don't want to actually expose the API while it is in flux.
     [Custom, RaisesException] void postMessage(any message, optional Array messagePorts);
@@ -38,14 +37,5 @@
 
     // event handler attributes
     attribute EventListener onmessage;
-
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
 
diff --git a/Source/core/dom/MouseEvent.cpp b/Source/core/dom/MouseEvent.cpp
index c0a6cbe..e11d1d8 100644
--- a/Source/core/dom/MouseEvent.cpp
+++ b/Source/core/dom/MouseEvent.cpp
@@ -57,9 +57,11 @@
 {
     ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);
 
-    bool isCancelable = eventType != eventNames().mousemoveEvent;
+    bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent;
+    bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave;
+    bool isBubbling = !isMouseEnterOrLeave;
 
-    return MouseEvent::create(eventType, true, isCancelable, view,
+    return MouseEvent::create(eventType, isBubbling, isCancelable, view,
         detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
         event.movementDelta().x(), event.movementDelta().y(),
         event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
@@ -189,18 +191,18 @@
 Node* MouseEvent::toElement() const
 {
     // MSIE extension - "the object toward which the user is moving the mouse pointer"
-    if (type() == eventNames().mouseoutEvent) 
+    if (type() == eventNames().mouseoutEvent || type() == eventNames().mouseleaveEvent)
         return relatedTarget() ? relatedTarget()->toNode() : 0;
-    
+
     return target() ? target()->toNode() : 0;
 }
 
 Node* MouseEvent::fromElement() const
 {
     // MSIE extension - "object from which activation or the mouse pointer is exiting during the event" (huh?)
-    if (type() != eventNames().mouseoutEvent)
+    if (type() != eventNames().mouseoutEvent && type() != eventNames().mouseleaveEvent)
         return relatedTarget() ? relatedTarget()->toNode() : 0;
-    
+
     return target() ? target()->toNode() : 0;
 }
 
diff --git a/Source/core/dom/MutationCallback.h b/Source/core/dom/MutationCallback.h
index a60ce8b..af904e2 100644
--- a/Source/core/dom/MutationCallback.h
+++ b/Source/core/dom/MutationCallback.h
@@ -31,9 +31,9 @@
 #ifndef MutationCallback_h
 #define MutationCallback_h
 
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index 4c46b09..a2e4084 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -40,9 +40,9 @@
 #include "core/dom/MutationObserverRegistration.h"
 #include "core/dom/MutationRecord.h"
 #include "core/dom/Node.h"
-#include <wtf/HashSet.h>
-#include <wtf/MainThread.h>
-#include <wtf/Vector.h>
+#include "wtf/HashSet.h"
+#include "wtf/MainThread.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -84,7 +84,7 @@
 void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionCode& ec)
 {
     if (!node) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -111,7 +111,7 @@
         options |= AttributeFilter;
 
     if (!validateOptions(options)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
diff --git a/Source/core/dom/MutationObserverInterestGroup.h b/Source/core/dom/MutationObserverInterestGroup.h
index 981c6e1..2de1070 100644
--- a/Source/core/dom/MutationObserverInterestGroup.h
+++ b/Source/core/dom/MutationObserverInterestGroup.h
@@ -35,8 +35,8 @@
 #include "core/dom/MutationObserver.h"
 #include "core/dom/Node.h"
 #include "core/dom/QualifiedName.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
+#include "wtf/HashMap.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/MutationObserverRegistration.h b/Source/core/dom/MutationObserverRegistration.h
index b17d95a..7c0fb52 100644
--- a/Source/core/dom/MutationObserverRegistration.h
+++ b/Source/core/dom/MutationObserverRegistration.h
@@ -32,9 +32,9 @@
 #define MutationObserverRegistration_h
 
 #include "core/dom/MutationObserver.h"
-#include <wtf/HashSet.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/AtomicStringHash.h>
+#include "wtf/HashSet.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/AtomicStringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NameNodeList.cpp b/Source/core/dom/NameNodeList.cpp
index 19aadbb..c4648c0 100644
--- a/Source/core/dom/NameNodeList.cpp
+++ b/Source/core/dom/NameNodeList.cpp
@@ -25,7 +25,7 @@
 
 #include "core/dom/Element.h"
 #include "core/dom/NodeRareData.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NameNodeList.h b/Source/core/dom/NameNodeList.h
index 32c1eff..96bcac4 100644
--- a/Source/core/dom/NameNodeList.h
+++ b/Source/core/dom/NameNodeList.h
@@ -25,8 +25,8 @@
 #define NameNodeList_h
 
 #include "core/dom/LiveNodeList.h"
-#include <wtf/Forward.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/Forward.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NamedFlowCollection.cpp b/Source/core/dom/NamedFlowCollection.cpp
index 8672d6d..ef35fa9 100644
--- a/Source/core/dom/NamedFlowCollection.cpp
+++ b/Source/core/dom/NamedFlowCollection.cpp
@@ -35,9 +35,8 @@
 #include "core/dom/Document.h"
 #include "core/dom/NamedFlow.h"
 #include "core/inspector/InspectorInstrumentation.h"
-
-#include <wtf/text/StringHash.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/text/StringHash.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NamedFlowCollection.h b/Source/core/dom/NamedFlowCollection.h
index 47107e0..8d8d32c 100644
--- a/Source/core/dom/NamedFlowCollection.h
+++ b/Source/core/dom/NamedFlowCollection.h
@@ -32,11 +32,11 @@
 
 #include "core/dom/ContextLifecycleObserver.h"
 #include "core/dom/NamedFlow.h"
-#include <wtf/Forward.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/ListHashSet.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NamedNodeMap.cpp b/Source/core/dom/NamedNodeMap.cpp
index 05f194f..0f93b6d 100644
--- a/Source/core/dom/NamedNodeMap.cpp
+++ b/Source/core/dom/NamedNodeMap.cpp
@@ -63,7 +63,7 @@
 {
     size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(name, shouldIgnoreAttributeCase(m_element)) : notFound;
     if (index == notFound) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
     return m_element->detachAttribute(index);
@@ -73,7 +73,7 @@
 {
     size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(QualifiedName(nullAtom, localName, namespaceURI)) : notFound;
     if (index == notFound) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
     return m_element->detachAttribute(index);
@@ -82,13 +82,13 @@
 PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
 
     // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
     if (!node->isAttributeNode()) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return 0;
     }
 
diff --git a/Source/core/dom/NamedNodeMap.h b/Source/core/dom/NamedNodeMap.h
index 609b3b5..cbb12b4 100644
--- a/Source/core/dom/NamedNodeMap.h
+++ b/Source/core/dom/NamedNodeMap.h
@@ -26,9 +26,9 @@
 #define NamedNodeMap_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NamedNodeMap.idl b/Source/core/dom/NamedNodeMap.idl
index 6a8e4e0..d0bd9bd 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] Node setNamedItem([Default=Undefined] optional Node node);
+    [RaisesException, DeliverCustomElementCallbacks] Node setNamedItem([Default=Undefined] optional Node node);
 
-    [RaisesException] Node removeNamedItem([Default=Undefined] optional DOMString name);
+    [RaisesException, DeliverCustomElementCallbacks] 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] Node setNamedItemNS([Default=Undefined] optional Node node);
+    [RaisesException, DeliverCustomElementCallbacks] Node setNamedItemNS([Default=Undefined] optional Node node);
 
-     [RaisesException] Node removeNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, 
+    [RaisesException, DeliverCustomElementCallbacks] Node removeNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                           [Default=Undefined] optional DOMString localName);
 
 };
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 3f107e9..567f730 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -98,7 +98,6 @@
 
 using namespace HTMLNames;
 
-#if ENABLE(PARTITION_ALLOC)
 void* Node::operator new(size_t size)
 {
     return partitionAlloc(Partitions::getObjectModelPartition(), size);
@@ -108,7 +107,6 @@
 {
     partitionFree(ptr);
 }
-#endif // ENABLE(PARTITION_ALLOC)
 
 bool Node::isSupported(const String& feature, const String& version)
 {
@@ -261,25 +259,6 @@
 }
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, nodeCounter, ("WebCoreNode"));
-DEFINE_DEBUG_ONLY_GLOBAL(HashSet<Node*>, ignoreSet, );
-
-#ifndef NDEBUG
-static bool shouldIgnoreLeaks = false;
-#endif
-
-void Node::startIgnoringLeaks()
-{
-#ifndef NDEBUG
-    shouldIgnoreLeaks = true;
-#endif
-}
-
-void Node::stopIgnoringLeaks()
-{
-#ifndef NDEBUG
-    shouldIgnoreLeaks = false;
-#endif
-}
 
 Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2, Document* doc)
 {
@@ -346,10 +325,7 @@
 void Node::trackForDebugging()
 {
 #ifndef NDEBUG
-    if (shouldIgnoreLeaks)
-        ignoreSet.add(this);
-    else
-        nodeCounter.increment();
+    nodeCounter.increment();
 #endif
 
 #if DUMP_NODE_STATISTICS
@@ -360,11 +336,7 @@
 Node::~Node()
 {
 #ifndef NDEBUG
-    HashSet<Node*>::iterator it = ignoreSet.find(this);
-    if (it != ignoreSet.end())
-        ignoreSet.remove(it);
-    else
-        nodeCounter.decrement();
+    nodeCounter.decrement();
 #endif
 
 #if DUMP_NODE_STATISTICS
@@ -458,7 +430,7 @@
     return String();
 }
 
-void Node::setNodeValue(const String& /*nodeValue*/, ExceptionCode& ec)
+void Node::setNodeValue(const String&)
 {
     // By default, setting nodeValue has no effect.
 }
@@ -540,40 +512,36 @@
     return lastChild();
 }
 
-bool Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior)
 {
-    if (!isContainerNode()) {
-        ec = HIERARCHY_REQUEST_ERR;
-        return false;
-    }
-    return toContainerNode(this)->insertBefore(newChild, refChild, ec, attachBehavior);
+    if (isContainerNode())
+        toContainerNode(this)->insertBefore(newChild, refChild, ec, attachBehavior);
+    else
+        ec = HierarchyRequestError;
 }
 
-bool Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior)
 {
-    if (!isContainerNode()) {
-        ec = HIERARCHY_REQUEST_ERR;
-        return false;
-    }
-    return toContainerNode(this)->replaceChild(newChild, oldChild, ec, attachBehavior);
+    if (isContainerNode())
+        toContainerNode(this)->replaceChild(newChild, oldChild, ec, attachBehavior);
+    else
+        ec = HierarchyRequestError;
 }
 
-bool Node::removeChild(Node* oldChild, ExceptionCode& ec)
+void Node::removeChild(Node* oldChild, ExceptionCode& ec)
 {
-    if (!isContainerNode()) {
-        ec = NOT_FOUND_ERR;
-        return false;
-    }
-    return toContainerNode(this)->removeChild(oldChild, ec);
+    if (isContainerNode())
+        toContainerNode(this)->removeChild(oldChild, ec);
+    else
+        ec = NotFoundError;
 }
 
-bool Node::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void Node::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior)
 {
-    if (!isContainerNode()) {
-        ec = HIERARCHY_REQUEST_ERR;
-        return false;
-    }
-    return toContainerNode(this)->appendChild(newChild, ec, attachBehavior);
+    if (isContainerNode())
+        toContainerNode(this)->appendChild(newChild, ec, attachBehavior);
+    else
+        ec = HierarchyRequestError;
 }
 
 void Node::remove(ExceptionCode& ec)
@@ -646,8 +614,8 @@
 {
     // 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 NAMESPACE_ERR exception.
-    ec = NAMESPACE_ERR;
+    // node, however Mozilla throws a NamespaceError exception.
+    ec = NamespaceError;
 }
 
 const AtomicString& Node::localName() const
@@ -683,14 +651,10 @@
 
     for (const Node* node = this; node; node = node->parentNode()) {
         if ((node->isHTMLElement() || node->isDocumentNode()) && node->renderer()) {
-#if ENABLE(USERSELECT_ALL)
             // Elements with user-select: all style are considered atomic
             // therefore non editable.
             if (node->renderer()->style()->userSelect() == SELECT_ALL && treatment == UserSelectAllIsAlwaysNonEditable)
                 return false;
-#else
-            UNUSED_PARAM(treatment);
-#endif
             switch (node->renderer()->style()->userModify()) {
             case READ_ONLY:
                 return false;
@@ -821,17 +785,14 @@
     deref();
 }
 
-void Node::setNeedsStyleRecalc(StyleChangeType changeType)
+void Node::setNeedsStyleRecalc(StyleChangeType changeType, StyleChangeSource source)
 {
     ASSERT(changeType != NoStyleChange);
     if (!attached()) // changed compared to what?
         return;
 
-    // FIXME: Switch all callers to use setNeedsLayerUpdate and get rid of SyntheticStyleChange.
-    if (changeType == SyntheticStyleChange) {
-        setNeedsLayerUpdate();
-        return;
-    }
+    if (source == StyleChangeFromRenderer)
+        setFlag(NotifyRendererWithIdenticalStyles);
 
     StyleChangeType existingChangeType = styleChangeType();
     if (changeType > existingChangeType)
@@ -841,12 +802,6 @@
         markAncestorsWithChildNeedsStyleRecalc();
 }
 
-void Node::setNeedsLayerUpdate()
-{
-    setFlag(NeedsLayerUpdate);
-    setNeedsStyleRecalc(InlineStyleChange);
-}
-
 void Node::lazyAttach(ShouldSetAttached shouldSetAttached)
 {
     // It's safe to synchronously attach here because we're in the middle of style recalc
@@ -859,7 +814,7 @@
         attach();
         return;
     }
-    setStyleChange(FullStyleChange);
+    setStyleChange(SubtreeStyleChange);
     markAncestorsWithChildNeedsStyleRecalc();
     if (shouldSetAttached == DoNotSetAttached)
         return;
@@ -986,16 +941,16 @@
     // Element::setPrefix() and Attr::setPrefix()
 
     if (!prefix.isEmpty() && !Document::isValidName(prefix)) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return;
     }
 
-    // FIXME: Raise NAMESPACE_ERR if prefix is malformed per the Namespaces in XML specification.
+    // FIXME: Raise NamespaceError if prefix is malformed per the Namespaces in XML specification.
 
     const AtomicString& nodeNamespaceURI = namespaceURI();
     if ((nodeNamespaceURI.isEmpty() && !prefix.isEmpty())
         || (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI)) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return;
     }
     // Attribute-specific checks are in Attr::setPrefix().
@@ -1046,6 +1001,18 @@
     return false;
 }
 
+void Node::reattach(const AttachContext& context)
+{
+    // FIXME: Text::updateTextRenderer calls reattach outside a style recalc.
+    ASSERT(document()->inStyleRecalc() || isTextNode());
+    AttachContext reattachContext(context);
+    reattachContext.performingReattach = true;
+
+    if (attached())
+        detach(reattachContext);
+    attach(reattachContext);
+}
+
 void Node::attach(const AttachContext&)
 {
     ASSERT(!attached());
@@ -1053,7 +1020,8 @@
 
     // If this node got a renderer it may be the previousRenderer() of sibling text nodes and thus affect the
     // result of Text::textRendererIsNeeded() for those nodes.
-    if (renderer()) {
+    // FIXME: This loop is no longer required once we lazy attach all the time.
+    if (renderer() && !document()->inStyleRecalc()) {
         for (Node* next = nextSibling(); next; next = next->nextSibling()) {
             if (next->renderer())
                 break;
@@ -1364,7 +1332,7 @@
 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionCode& ec)
 {
     if (selectors.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -1377,7 +1345,7 @@
 PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, ExceptionCode& ec)
 {
     if (selectors.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -1679,7 +1647,7 @@
         case CDATA_SECTION_NODE:
         case COMMENT_NODE:
         case PROCESSING_INSTRUCTION_NODE:
-            setNodeValue(text, ec);
+            setNodeValue(text);
             return;
         case ELEMENT_NODE:
         case ATTRIBUTE_NODE:
@@ -2091,11 +2059,6 @@
         it->value->invalidateCache();
 }
 
-void Node::getSubresourceURLs(ListHashSet<KURL>& urls) const
-{
-    addSubresourceAttributeURLs(urls);
-}
-
 Node* Node::enclosingLinkEventParentOrSelf()
 {
     for (Node* node = this; node; node = node->parentOrShadowHostNode()) {
@@ -2311,6 +2274,10 @@
     if (index == notFound)
         return;
 
+    // Deleting the registration may cause this node to be derefed, so we must make sure the Vector operation completes
+    // before that, in case |this| is destroyed (see MutationObserverRegistration::m_registrationNodeKeepAlive).
+    // FIXME: Simplify the registration/transient registration logic to make this understandable by humans.
+    RefPtr<Node> protect(this);
     registry->remove(index);
 }
 
@@ -2504,7 +2471,7 @@
         if (event->hasInterface(eventNames().interfaceForTextEvent))
             if (Frame* frame = document()->frame())
                 frame->eventHandler()->defaultTextInputEventHandler(static_cast<TextEvent*>(event));
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     } else if (eventType == eventNames().mousedownEvent && event->isMouseEvent()) {
         MouseEvent* mouseEvent = toMouseEvent(event);
         if (mouseEvent->button() == MiddleButton) {
@@ -2738,6 +2705,13 @@
     setFlag(IsCustomElement);
 }
 
+void Node::setIsUpgradedCustomElement()
+{
+    ASSERT(isCustomElement());
+    setFlag(IsUpgradedCustomElement);
+    setNeedsStyleRecalc(); // :unresolved has changed
+}
+
 } // namespace WebCore
 
 #ifndef NDEBUG
diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h
index 6df001f..9d9ac54 100644
--- a/Source/core/dom/Node.h
+++ b/Source/core/dom/Node.h
@@ -37,9 +37,9 @@
 #include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/style/RenderStyleConstants.h"
 #include "weborigin/KURLHash.h"
-#include <wtf/Forward.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/Forward.h"
+#include "wtf/ListHashSet.h"
+#include "wtf/text/AtomicString.h"
 
 // This needs to be here because Document.h also depends on it.
 #define DUMP_NODE_STATISTICS 0
@@ -85,15 +85,19 @@
 
 typedef int ExceptionCode;
 
-const int nodeStyleChangeShift = 15;
+const int nodeStyleChangeShift = 14;
 
 enum StyleChangeType {
     NoStyleChange = 0,
-    InlineStyleChange = 1 << nodeStyleChangeShift,
-    FullStyleChange = 2 << nodeStyleChangeShift,
+    LocalStyleChange = 1 << nodeStyleChangeShift,
+    SubtreeStyleChange = 2 << nodeStyleChangeShift,
+};
 
-    // FIXME: SyntheticStyleChange is deprecated, instead you should use setNeedsLayerUpdate().
-    SyntheticStyleChange = 3 << nodeStyleChangeShift,
+// If the style change is from the renderer then we'll call setStyle on the
+// renderer even if the style computed from CSS is identical.
+enum StyleChangeSource {
+    StyleChangeFromCSS,
+    StyleChangeFromRenderer
 };
 
 class NodeRareDataBase {
@@ -154,18 +158,12 @@
         DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20,
     };
 
-#if ENABLE(PARTITION_ALLOC)
     // All Nodes are placed in their own heap partition for security.
     // See http://crbug.com/246860 for detail.
     void* operator new(size_t);
     void operator delete(void*);
-#endif
 
     static bool isSupported(const String& feature, const String& version);
-
-    static void startIgnoringLeaks();
-    static void stopIgnoringLeaks();
-
     static void dumpStatistics();
 
     enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force };    
@@ -180,7 +178,7 @@
     bool hasLocalName(const AtomicString&) const;
     virtual String nodeName() const = 0;
     virtual String nodeValue() const;
-    virtual void setNodeValue(const String&, ExceptionCode&);
+    virtual void setNodeValue(const String&);
     virtual NodeType nodeType() const = 0;
     ContainerNode* parentNode() const;
     Element* parentElement() const;
@@ -203,19 +201,17 @@
     Node* pseudoAwareLastChild() const;
 
     virtual KURL baseURI() const;
-    
-    void getSubresourceURLs(ListHashSet<KURL>&) 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
-    bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, AttachBehavior = AttachNow);
-    bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, AttachBehavior = AttachNow);
-    bool removeChild(Node* child, ExceptionCode&);
-    bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, AttachBehavior = AttachNow);
+    void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, AttachBehavior = AttachNow);
+    void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, AttachBehavior = AttachNow);
+    void removeChild(Node* child, ExceptionCode&);
+    void appendChild(PassRefPtr<Node> newChild, ExceptionCode&, AttachBehavior = AttachNow);
 
     bool hasChildNodes() const { return firstChild(); }
-    virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
+    virtual PassRefPtr<Node> cloneNode(bool deep = true) = 0;
     virtual const AtomicString& localName() const;
     virtual const AtomicString& namespaceURI() const;
     virtual const AtomicString& prefix() const;
@@ -250,16 +246,27 @@
 
     bool isCustomElement() const { return getFlag(IsCustomElement); }
     void setIsCustomElement();
+    bool isUpgradedCustomElement() const { return getFlag(IsUpgradedCustomElement); }
+    void setIsUpgradedCustomElement();
 
     virtual bool isMediaControlElement() const { return false; }
     virtual bool isMediaControls() const { return false; }
     virtual bool isWebVTTElement() const { return false; }
-    bool isStyledElement() const { return getFlag(IsStyledElementFlag); }
     virtual bool isAttributeNode() const { return false; }
     virtual bool isCharacterDataNode() const { return false; }
     virtual bool isFrameOwnerElement() const { return false; }
     virtual bool isPluginElement() const { return false; }
 
+    // StyledElements allow inline style (style="border: 1px"), presentational attributes (ex. color),
+    // class names (ex. class="foo bar") and other non-basic styling features. They and also control
+    // if this element can participate in style sharing.
+    //
+    // FIXME: The only things that ever go through StyleResolver that aren't StyledElements are
+    // PseudoElements and WebVTTElements. It's possible we can just eliminate all the checks
+    // since those elements will never have class names, inline style, or other things that
+    // this apparently guards against.
+    bool isStyledElement() const { return isHTMLElement() || isSVGElement(); }
+
     bool isDocumentNode() const;
     bool isTreeScope() const { return treeScope()->rootNode() == this; }
     bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
@@ -373,15 +380,14 @@
     void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
     void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
 
-    void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange);
+    void setNeedsStyleRecalc(StyleChangeType = SubtreeStyleChange, StyleChangeSource = StyleChangeFromCSS);
     void clearNeedsStyleRecalc()
     {
         m_nodeFlags &= ~StyleChangeMask;
-        clearFlag(NeedsLayerUpdate);
+        clearFlag(NotifyRendererWithIdenticalStyles);
     }
 
-    void setNeedsLayerUpdate();
-    bool needsLayerUpdate() const { return getFlag(NeedsLayerUpdate); }
+    bool shouldNotifyRendererWithIdenticalStyles() const { return getFlag(NotifyRendererWithIdenticalStyles); }
 
     void setIsLink(bool f) { setFlag(f, IsLinkFlag); }
     void setIsLink() { setFlag(IsLinkFlag); }
@@ -560,7 +566,7 @@
     void reattach(const AttachContext& = AttachContext());
     void lazyReattachIfAttached();
     ContainerNode* parentNodeForRenderingAndStyle();
-    
+
     // Wrapper for nodes that don't have a renderer, but still cache the style (like HTMLOptionElement).
     RenderStyle* renderStyle() const;
 
@@ -711,39 +717,40 @@
         IsTextFlag = 1,
         IsContainerFlag = 1 << 1,
         IsElementFlag = 1 << 2,
-        IsStyledElementFlag = 1 << 3,
-        IsHTMLFlag = 1 << 4,
-        IsSVGFlag = 1 << 5,
-        IsAttachedFlag = 1 << 6,
-        ChildNeedsStyleRecalcFlag = 1 << 7,
-        InDocumentFlag = 1 << 8,
-        IsLinkFlag = 1 << 9,
-        IsUserActionElement = 1 << 10,
-        HasRareDataFlag = 1 << 11,
-        IsDocumentFragmentFlag = 1 << 12,
+        IsHTMLFlag = 1 << 3,
+        IsSVGFlag = 1 << 4,
+        IsAttachedFlag = 1 << 5,
+        ChildNeedsStyleRecalcFlag = 1 << 6,
+        InDocumentFlag = 1 << 7,
+        IsLinkFlag = 1 << 8,
+        IsUserActionElement = 1 << 9,
+        HasRareDataFlag = 1 << 10,
+        IsDocumentFragmentFlag = 1 << 11,
 
         // These bits are used by derived classes, pulled up here so they can
         // be stored in the same memory word as the Node bits above.
-        IsParsingChildrenFinishedFlag = 1 << 13, // Element
-        HasSVGRareDataFlag = 1 << 14, // SVGElement
+        IsParsingChildrenFinishedFlag = 1 << 12, // Element
+        HasSVGRareDataFlag = 1 << 13, // SVGElement
 
         StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
 
-        SelfOrAncestorHasDirAutoFlag = 1 << 17,
+        SelfOrAncestorHasDirAutoFlag = 1 << 16,
 
-        HasNameOrIsEditingTextFlag = 1 << 18,
+        HasNameOrIsEditingTextFlag = 1 << 17,
 
-        InNamedFlowFlag = 1 << 19,
-        HasSyntheticAttrChildNodesFlag = 1 << 20,
-        HasCustomStyleCallbacksFlag = 1 << 21,
-        HasScopedHTMLStyleChildFlag = 1 << 22,
-        HasEventTargetDataFlag = 1 << 23,
-        V8CollectableDuringMinorGCFlag = 1 << 24,
-        IsInsertionPointFlag = 1 << 25,
-        IsInShadowTreeFlag = 1 << 26,
-        IsCustomElement = 1 << 27,
+        InNamedFlowFlag = 1 << 18,
+        HasSyntheticAttrChildNodesFlag = 1 << 19,
+        HasCustomStyleCallbacksFlag = 1 << 20,
+        HasScopedHTMLStyleChildFlag = 1 << 21,
+        HasEventTargetDataFlag = 1 << 22,
+        V8CollectableDuringMinorGCFlag = 1 << 23,
+        IsInsertionPointFlag = 1 << 24,
+        IsInShadowTreeFlag = 1 << 25,
+        IsCustomElement = 1 << 26,
 
-        NeedsLayerUpdate = 1 << 28,
+        NotifyRendererWithIdenticalStyles = 1 << 27,
+
+        IsUpgradedCustomElement = 1 << 28,
 
         DefaultNodeFlags = IsParsingChildrenFinishedFlag
     };
@@ -764,9 +771,8 @@
         CreatePseudoElement =  CreateElement | InDocumentFlag,
         CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadowTreeFlag,
         CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag,
-        CreateStyledElement = CreateElement | IsStyledElementFlag, 
-        CreateHTMLElement = CreateStyledElement | IsHTMLFlag,
-        CreateSVGElement = CreateStyledElement | IsSVGFlag,
+        CreateHTMLElement = CreateElement | IsHTMLFlag,
+        CreateSVGElement = CreateElement | IsSVGFlag,
         CreateDocument = CreateContainer | InDocumentFlag,
         CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag,
         CreateEditingText = CreateText | HasNameOrIsEditingTextFlag,
@@ -906,16 +912,6 @@
     return parentOrShadowHostNode();
 }
 
-inline void Node::reattach(const AttachContext& context)
-{
-    AttachContext reattachContext(context);
-    reattachContext.performingReattach = true;
-
-    if (attached())
-        detach(reattachContext);
-    attach(reattachContext);
-}
-
 inline void Node::lazyReattachIfAttached()
 {
     if (attached())
diff --git a/Source/core/dom/Node.idl b/Source/core/dom/Node.idl
index ba0eb17..4ecd1d6 100644
--- a/Source/core/dom/Node.idl
+++ b/Source/core/dom/Node.idl
@@ -18,12 +18,10 @@
  * Boston, MA 02110-1301, USA.
  */
 
-// FIXME: Node should inherit EventTarget.
 [
     CustomToV8,
-    EventTarget,
     DependentLifetime
-] interface Node {
+] interface Node : EventTarget {
     // NodeType
     const unsigned short      ELEMENT_NODE                   = 1;
     const unsigned short      ATTRIBUTE_NODE                 = 2;
@@ -41,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, SetterRaisesException] attribute DOMString        nodeValue;
+             [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings] attribute DOMString        nodeValue;
 
     [PerWorldBindings] readonly attribute unsigned short   nodeType;
     [PerWorldBindings] readonly attribute Node             parentNode;
@@ -59,7 +57,7 @@
 
     boolean            hasChildNodes();
     [DeliverCustomElementCallbacks, PerWorldBindings]
-    Node               cloneNode([Default=Undefined] optional boolean deep);
+    Node               cloneNode(optional boolean deep);
     void               normalize();
 
     // Introduced in DOM Level 2:
@@ -74,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] attribute DOMString       textContent;
+             [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, DeliverCustomElementCallbacks] attribute DOMString       textContent;
 
     boolean            isSameNode([Default=Undefined] optional Node other);
     boolean            isEqualNode([Default=Undefined] optional Node other);
@@ -97,12 +95,4 @@
 
     // IE extensions
     [PerWorldBindings] readonly attribute Element          parentElement;
-
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event event);
 };
diff --git a/Source/core/dom/NodeFilterCondition.h b/Source/core/dom/NodeFilterCondition.h
index 9608fcb..4c838e9 100644
--- a/Source/core/dom/NodeFilterCondition.h
+++ b/Source/core/dom/NodeFilterCondition.h
@@ -26,7 +26,7 @@
 #define NodeFilterCondition_h
 
 #include "bindings/v8/ScriptState.h"
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NodeIterator.cpp b/Source/core/dom/NodeIterator.cpp
index 3d685d2..c23346f 100644
--- a/Source/core/dom/NodeIterator.cpp
+++ b/Source/core/dom/NodeIterator.cpp
@@ -93,7 +93,7 @@
 PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionCode& ec)
 {
     if (m_detached) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -122,7 +122,7 @@
 PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionCode& ec)
 {
     if (m_detached) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
diff --git a/Source/core/dom/NodeIterator.h b/Source/core/dom/NodeIterator.h
index 53f3d20..5aafc13 100644
--- a/Source/core/dom/NodeIterator.h
+++ b/Source/core/dom/NodeIterator.h
@@ -28,8 +28,8 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/NodeFilter.h"
 #include "core/dom/Traversal.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/NodeList.h b/Source/core/dom/NodeList.h
index c47182c..d6ddf17 100644
--- a/Source/core/dom/NodeList.h
+++ b/Source/core/dom/NodeList.h
@@ -25,8 +25,8 @@
 #define NodeList_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Notation.h b/Source/core/dom/Notation.h
index 7cbac50..0d59e02 100644
--- a/Source/core/dom/Notation.h
+++ b/Source/core/dom/Notation.h
@@ -38,7 +38,7 @@
 
     virtual String nodeName() const;
     virtual NodeType nodeType() const;
-    virtual PassRefPtr<Node> cloneNode(bool deep);
+    virtual PassRefPtr<Node> cloneNode(bool deep = true);
     virtual bool childTypeAllowed(NodeType) const;
 
     String m_name;
diff --git a/Source/core/dom/PendingScript.h b/Source/core/dom/PendingScript.h
index ee183a2..6794959 100644
--- a/Source/core/dom/PendingScript.h
+++ b/Source/core/dom/PendingScript.h
@@ -28,9 +28,9 @@
 
 #include "core/loader/cache/CachedResourceClient.h"
 #include "core/loader/cache/CachedResourceHandle.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/TextPosition.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/TextPosition.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/PopStateEvent.cpp b/Source/core/dom/PopStateEvent.cpp
index 072d28b..78456c8 100644
--- a/Source/core/dom/PopStateEvent.cpp
+++ b/Source/core/dom/PopStateEvent.cpp
@@ -33,10 +33,6 @@
 
 namespace WebCore {
 
-PopStateEventInit::PopStateEventInit()
-{
-}
-
 PopStateEvent::PopStateEvent()
     : Event(eventNames().popstateEvent, false, true)
     , m_serializedState(0)
@@ -47,7 +43,6 @@
 
 PopStateEvent::PopStateEvent(const AtomicString& type, const PopStateEventInit& initializer)
     : Event(type, initializer)
-    , m_state(initializer.state)
     , m_serializedState(0)
     , m_history(0)
 {
diff --git a/Source/core/dom/PopStateEvent.h b/Source/core/dom/PopStateEvent.h
index 1c59d0f..cbe4627 100644
--- a/Source/core/dom/PopStateEvent.h
+++ b/Source/core/dom/PopStateEvent.h
@@ -27,16 +27,11 @@
 #ifndef PopStateEvent_h
 #define PopStateEvent_h
 
-#include "bindings/v8/ScriptValue.h"
 #include "core/dom/Event.h"
 
 namespace WebCore {
 
-struct PopStateEventInit : public EventInit {
-    PopStateEventInit();
-
-    ScriptValue state;
-};
+typedef EventInit PopStateEventInit;
 
 class History;
 class SerializedScriptValue;
@@ -48,8 +43,7 @@
     static PassRefPtr<PopStateEvent> create(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
     static PassRefPtr<PopStateEvent> create(const AtomicString&, const PopStateEventInit&);
 
-    PassRefPtr<SerializedScriptValue> serializedState() const { return m_serializedState; }
-    const ScriptValue& state() const { return m_state; }
+    SerializedScriptValue* serializedState() const { return m_serializedState.get(); }
     History* history() const { return m_history.get(); }
 
     virtual const AtomicString& interfaceName() const;
@@ -59,7 +53,6 @@
     PopStateEvent(const AtomicString&, const PopStateEventInit&);
     explicit PopStateEvent(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);
 
-    ScriptValue m_state;
     RefPtr<SerializedScriptValue> m_serializedState;
     RefPtr<History> m_history;
 };
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp
index 627bfa1..b1d7f07 100644
--- a/Source/core/dom/Position.cpp
+++ b/Source/core/dom/Position.cpp
@@ -35,6 +35,8 @@
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/platform/Logging.h"
 #include "core/rendering/InlineIterator.h"
 #include "core/rendering/InlineTextBox.h"
@@ -548,7 +550,7 @@
         return true;
 
     // Don't include inline tables.
-    if (node->hasTagName(tableTag))
+    if (isHTMLTableElement(node))
         return false;
 
     // There is a VisiblePosition inside an empty inline-block container.
@@ -850,7 +852,6 @@
     return node->parentNode();
 }
 
-#if ENABLE(USERSELECT_ALL)
 bool Position::nodeIsUserSelectAll(const Node* node)
 {
     return node && node->renderer() && node->renderer()->style()->userSelect() == SELECT_ALL;
@@ -877,7 +878,6 @@
     }
     return candidateRoot;
 }
-#endif
 
 bool Position::isCandidate() const
 {
@@ -901,7 +901,7 @@
     if (isTableElement(deprecatedNode()) || editingIgnoresContent(deprecatedNode()))
         return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
 
-    if (m_anchorNode->hasTagName(htmlTag))
+    if (isHTMLHtmlElement(m_anchorNode.get()))
         return false;
 
     if (renderer->isBlockFlow()) {
diff --git a/Source/core/dom/Position.h b/Source/core/dom/Position.h
index 9cb00f4..5d4fd32 100644
--- a/Source/core/dom/Position.h
+++ b/Source/core/dom/Position.h
@@ -30,9 +30,9 @@
 #include "core/editing/EditingBoundary.h"
 #include "core/editing/TextAffinity.h"
 #include "core/platform/text/TextDirection.h"
-#include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Assertions.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
@@ -189,10 +189,8 @@
 
     static bool hasRenderedNonAnonymousDescendantsWithHeight(RenderObject*);
     static bool nodeIsUserSelectNone(Node*);
-#if ENABLE(USERSELECT_ALL)
     static bool nodeIsUserSelectAll(const Node*);
     static Node* rootUserSelectAllForNode(Node*);
-#endif
     static ContainerNode* findParent(const Node*);
     
     void debugPosition(const char* msg = "") const;
diff --git a/Source/core/dom/PositionIterator.cpp b/Source/core/dom/PositionIterator.cpp
index c9b2ef0..2156894 100644
--- a/Source/core/dom/PositionIterator.cpp
+++ b/Source/core/dom/PositionIterator.cpp
@@ -29,6 +29,7 @@
 #include "HTMLNames.h"
 #include "core/dom/Node.h"
 #include "core/editing/htmlediting.h"
+#include "core/html/HTMLHtmlElement.h"
 #include "core/rendering/RenderBlock.h"
 
 namespace WebCore {
@@ -159,7 +160,7 @@
     if (isTableElement(m_anchorNode) || editingIgnoresContent(m_anchorNode))
         return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelectNone(m_anchorNode->parentNode());
 
-    if (!m_anchorNode->hasTagName(htmlTag) && renderer->isBlockFlow()) {
+    if (!isHTMLHtmlElement(m_anchorNode) && renderer->isBlockFlow()) {
         if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName(bodyTag)) {
             if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer))
                 return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anchorNode);
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index 7e5d25e..cbd329b 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "core/dom/ProcessingInstruction.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/MediaList.h"
 #include "core/css/StyleSheetContents.h"
@@ -29,7 +30,6 @@
 #include "core/loader/cache/CachedCSSStyleSheet.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/loader/cache/CachedXSLStyleSheet.h"
 #include "core/xml/XSLStyleSheet.h"
 #include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes()
@@ -90,7 +90,7 @@
     return m_data;
 }
 
-void ProcessingInstruction::setNodeValue(const String& nodeValue, ExceptionCode& ec)
+void ProcessingInstruction::setNodeValue(const String& nodeValue)
 {
     setData(nodeValue);
 }
@@ -154,7 +154,7 @@
             m_loading = true;
             document()->styleSheetCollection()->addPendingSheet();
             
-            CachedResourceRequest request(ResourceRequest(document()->completeURL(href)), cachedResourceRequestInitiators().processinginstruction);
+            CachedResourceRequest request(ResourceRequest(document()->completeURL(href)), CachedResourceInitiatorTypeNames::processinginstruction);
             if (m_isXSL)
                 m_cachedSheet = document()->cachedResourceLoader()->requestXSLStyleSheet(request);
             else
@@ -291,6 +291,8 @@
     
     document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
 
+    RefPtr<StyleSheet> removedSheet = m_sheet;
+
     if (m_sheet) {
         ASSERT(m_sheet->ownerNode() == this);
         m_sheet->clearOwnerNode();
@@ -299,7 +301,7 @@
 
     // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
     if (document()->renderer())
-        document()->styleResolverChanged(DeferRecalcStyle);
+        document()->removedStyleSheet(removedSheet.get());
 }
 
 void ProcessingInstruction::finishParsingChildren()
diff --git a/Source/core/dom/ProcessingInstruction.h b/Source/core/dom/ProcessingInstruction.h
index b24b4ef..b1e0c2b 100644
--- a/Source/core/dom/ProcessingInstruction.h
+++ b/Source/core/dom/ProcessingInstruction.h
@@ -57,8 +57,8 @@
     virtual String nodeName() const;
     virtual NodeType nodeType() const;
     virtual String nodeValue() const;
-    virtual void setNodeValue(const String&, ExceptionCode&);
-    virtual PassRefPtr<Node> cloneNode(bool deep);
+    virtual void setNodeValue(const String&);
+    virtual PassRefPtr<Node> cloneNode(bool deep = true);
     virtual bool offsetInCharacters() const;
     virtual int maxCharacterOffset() const;
 
diff --git a/Source/core/dom/Promise.idl b/Source/core/dom/Promise.idl
index 893b8ee..fe9edf0 100644
--- a/Source/core/dom/Promise.idl
+++ b/Source/core/dom/Promise.idl
@@ -28,8 +28,20 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+callback PromiseInit = void (PromiseResolver resolver);
+callback AnyCallback = any (optional any value);
 [
-   CustomConstructor(any init),
+   CustomConstructor(PromiseInit init),
    EnabledAtRuntime=promise
 ] interface Promise {
+   [Custom] Promise then(optional AnyCallback fulfillCallback, optional AnyCallback rejectCallback);
+   [Custom] Promise catch(optional AnyCallback rejectCallback);
+
+   [Custom] static Promise fulfill(any value);
+   [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 some(any... values);
 };
diff --git a/Source/core/dom/PseudoElement.cpp b/Source/core/dom/PseudoElement.cpp
index 468883b..ebcc455 100644
--- a/Source/core/dom/PseudoElement.cpp
+++ b/Source/core/dom/PseudoElement.cpp
@@ -81,10 +81,13 @@
     Element::attach(context);
 
     RenderObject* renderer = this->renderer();
-    if (!renderer || !renderer->style()->regionThread().isEmpty())
+    if (!renderer)
         return;
-
     RenderStyle* style = renderer->style();
+    if (!style->regionThread().isEmpty())
+        return;
+    if (style->styleType() != BEFORE && style->styleType() != AFTER)
+        return;
     ASSERT(style->contentData());
 
     for (const ContentData* content = style->contentData(); content; content = content->next()) {
diff --git a/Source/core/dom/PseudoElement.h b/Source/core/dom/PseudoElement.h
index 0575704..0f2ad66 100644
--- a/Source/core/dom/PseudoElement.h
+++ b/Source/core/dom/PseudoElement.h
@@ -67,7 +67,7 @@
 
 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style)
 {
-    return style && style->display() != NONE && (style->contentData() || !style->regionThread().isEmpty());
+    return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData() || !style->regionThread().isEmpty());
 }
 
 } // namespace
diff --git a/Source/core/dom/QualifiedName.cpp b/Source/core/dom/QualifiedName.cpp
index 6edcf87..79fad2d 100644
--- a/Source/core/dom/QualifiedName.cpp
+++ b/Source/core/dom/QualifiedName.cpp
@@ -32,9 +32,9 @@
 #include "XMLNames.h"
 #include "core/dom/QualifiedName.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/Assertions.h>
-#include <wtf/HashSet.h>
-#include <wtf/StaticConstructors.h>
+#include "wtf/Assertions.h"
+#include "wtf/HashSet.h"
+#include "wtf/StaticConstructors.h"
 
 namespace WebCore {
 
@@ -156,12 +156,12 @@
 
 void createQualifiedName(void* targetAddress, StringImpl* name, const AtomicString& nameNamespace)
 {
-    new (reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nameNamespace);
+    new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespace);
 }
 
 void createQualifiedName(void* targetAddress, StringImpl* name)
 {
-    new (reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nullAtom);
+    new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom);
 }
 
 }
diff --git a/Source/core/dom/QualifiedName.h b/Source/core/dom/QualifiedName.h
index 3867315..5933fe7 100644
--- a/Source/core/dom/QualifiedName.h
+++ b/Source/core/dom/QualifiedName.h
@@ -21,10 +21,10 @@
 #ifndef QualifiedName_h
 #define QualifiedName_h
 
-#include <wtf/Forward.h>
-#include <wtf/HashTraits.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/Forward.h"
+#include "wtf/HashTraits.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 15a10d0..f0c4659 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -44,10 +44,10 @@
 #include "core/platform/graphics/FloatQuad.h"
 #include "core/rendering/RenderBoxModelObject.h"
 #include "core/rendering/RenderText.h"
-#include <wtf/RefCountedLeakCounter.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/Vector.h>
+#include "wtf/RefCountedLeakCounter.h"
+#include "wtf/Vector.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -131,7 +131,7 @@
 Node* Range::startContainer(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -141,7 +141,7 @@
 int Range::startOffset(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -151,7 +151,7 @@
 Node* Range::endContainer(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -161,7 +161,7 @@
 int Range::endOffset(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -171,7 +171,7 @@
 Node* Range::commonAncestorContainer(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -192,7 +192,7 @@
 bool Range::collapsed(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -214,12 +214,12 @@
 void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -243,12 +243,12 @@
 void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -284,7 +284,7 @@
 void Range::collapse(bool toStart, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -297,12 +297,12 @@
 bool Range::isPointInRange(Node* refNode, int offset, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return false;
     }
 
     if (!refNode) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return false;
     }
 
@@ -326,17 +326,17 @@
     // refNode node and an offset within the node is before, same as, or after the range respectively.
 
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
     if (!refNode) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return 0;
     }
 
     if (!refNode->attached() || refNode->document() != m_ownerDocument) {
-        ec = WRONG_DOCUMENT_ERR;
+        ec = WrongDocumentError;
         return 0;
     }
 
@@ -367,12 +367,12 @@
     // before and after(surrounds), or inside the range, respectively
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return NODE_BEFORE;
     }
     
     if (!m_start.container() && refNode->attached()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return NODE_BEFORE;
     }
 
@@ -392,7 +392,7 @@
     if (!parentNode) {
         // if the node is the top document we should return NODE_BEFORE_AND_AFTER
         // but we throw to match firefox behavior
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return NODE_BEFORE;
     }
 
@@ -410,12 +410,12 @@
 short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
     if (!sourceRange) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
 
@@ -428,7 +428,7 @@
         return 0;
 
     if (thisCont->document() != sourceCont->document()) {
-        ec = WRONG_DOCUMENT_ERR;
+        ec = WrongDocumentError;
         return 0;
     }
 
@@ -439,7 +439,7 @@
     while (sourceTop->parentNode())
         sourceTop = sourceTop->parentNode();
     if (thisTop != sourceTop) { // in different DocumentFragments
-        ec = WRONG_DOCUMENT_ERR;
+        ec = WrongDocumentError;
         return 0;
     }
 
@@ -454,7 +454,7 @@
             return compareBoundaryPoints(m_start, sourceRange->m_end, ec);
     }
 
-    ec = SYNTAX_ERR;
+    ec = SyntaxError;
     return 0;
 }
 
@@ -520,7 +520,7 @@
     // ### we need to do a traversal here instead
     Node* commonAncestor = commonAncestorContainer(containerA, containerB);
     if (!commonAncestor) {
-        ec = WRONG_DOCUMENT_ERR;
+        ec = WrongDocumentError;
         return 0;
     }
     Node* childA = containerA;
@@ -578,11 +578,11 @@
 
     // Throw exception if the range is already detached.
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return false;
     }
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -597,7 +597,7 @@
     if (!parentNode) {
         // if the node is the top document we should return NODE_BEFORE_AND_AFTER
         // but we throw to match firefox behavior
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -937,7 +937,7 @@
 PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -951,22 +951,22 @@
     ec = 0;
 
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!newNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
-    // HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is of a type that
+    // HierarchyRequestError: Raised if the container of the start of the Range is of a type that
     // does not allow children of the type of newNode or if newNode is an ancestor of the container.
 
     // an extra one here - if a text node is going to split, it must have a parent to insert into
     bool startIsText = m_start.container()->isTextNode();
     if (startIsText && !m_start.container()->parentNode()) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return;
     }
 
@@ -985,7 +985,7 @@
         numNewChildren = 0;
         for (Node* c = newNode->firstChild(); c; c = c->nextSibling()) {
             if (!checkAgainst->childTypeAllowed(c->nodeType())) {
-                ec = HIERARCHY_REQUEST_ERR;
+                ec = HierarchyRequestError;
                 return;
             }
             ++numNewChildren;
@@ -993,29 +993,29 @@
     } else {
         numNewChildren = 1;
         if (!checkAgainst->childTypeAllowed(newNodeType)) {
-            ec = HIERARCHY_REQUEST_ERR;
+            ec = HierarchyRequestError;
             return;
         }
     }
 
     for (Node* n = m_start.container(); n; n = n->parentNode()) {
         if (n == newNode) {
-            ec = HIERARCHY_REQUEST_ERR;
+            ec = HierarchyRequestError;
             return;
         }
     }
 
-    // INVALID_NODE_TYPE_ERR: Raised if newNode is an Attr, Entity, Notation, ShadowRoot or Document node.
+    // InvalidNodeTypeError: Raised if newNode is an Attr, Entity, Notation, ShadowRoot or Document node.
     switch (newNodeType) {
     case Node::ATTRIBUTE_NODE:
     case Node::ENTITY_NODE:
     case Node::NOTATION_NODE:
     case Node::DOCUMENT_NODE:
-        ec = INVALID_NODE_TYPE_ERR;
+        ec = InvalidNodeTypeError;
         return;
     default:
         if (newNode->isShadowRoot()) {
-            ec = INVALID_NODE_TYPE_ERR;
+            ec = InvalidNodeTypeError;
             return;
         }
         break;
@@ -1056,7 +1056,7 @@
 String Range::toString(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return String();
     }
 
@@ -1096,13 +1096,13 @@
 PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
     Node* element = m_start.container()->isElementNode() ? m_start.container() : m_start.container()->parentNode();
     if (!element || !element->isHTMLElement()) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -1118,7 +1118,7 @@
 {
     // Check first to see if we've already detached:
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -1134,17 +1134,17 @@
         case Node::DOCUMENT_TYPE_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = INVALID_NODE_TYPE_ERR;
+            ec = InvalidNodeTypeError;
             return 0;
         case Node::CDATA_SECTION_NODE:
         case Node::COMMENT_NODE:
         case Node::TEXT_NODE:
             if (static_cast<unsigned>(offset) > static_cast<CharacterData*>(n)->length())
-                ec = INDEX_SIZE_ERR;
+                ec = IndexSizeError;
             return 0;
         case Node::PROCESSING_INSTRUCTION_NODE:
             if (static_cast<unsigned>(offset) > static_cast<ProcessingInstruction*>(n)->data().length())
-                ec = INDEX_SIZE_ERR;
+                ec = IndexSizeError;
             return 0;
         case Node::ATTRIBUTE_NODE:
         case Node::DOCUMENT_FRAGMENT_NODE:
@@ -1155,7 +1155,7 @@
                 return 0;
             Node* childBefore = n->childNode(offset - 1);
             if (!childBefore)
-                ec = INDEX_SIZE_ERR;
+                ec = IndexSizeError;
             return childBefore;
         }
     }
@@ -1165,7 +1165,7 @@
 
 void Range::checkNodeBA(Node* n, ExceptionCode& ec) const
 {
-    // INVALID_NODE_TYPE_ERR: Raised if the root container of refNode is not an
+    // InvalidNodeTypeError: Raised if the root container of refNode is not an
     // Attr, Document, DocumentFragment or ShadowRoot node, or part of a SVG shadow DOM tree,
     // or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity, or Notation node.
 
@@ -1175,7 +1175,7 @@
         case Node::DOCUMENT_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = INVALID_NODE_TYPE_ERR;
+            ec = InvalidNodeTypeError;
             return;
         case Node::CDATA_SECTION_NODE:
         case Node::COMMENT_NODE:
@@ -1205,7 +1205,7 @@
         case Node::PROCESSING_INSTRUCTION_NODE:
         case Node::TEXT_NODE:
         case Node::XPATH_NAMESPACE_NODE:
-            ec = INVALID_NODE_TYPE_ERR;
+            ec = InvalidNodeTypeError;
             return;
     }
 }
@@ -1213,7 +1213,7 @@
 PassRefPtr<Range> Range::cloneRange(ExceptionCode& ec) const
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -1223,12 +1223,12 @@
 void Range::setStartAfter(Node* refNode, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -1243,12 +1243,12 @@
 void Range::setEndBefore(Node* refNode, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -1263,12 +1263,12 @@
 void Range::setEndAfter(Node* refNode, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -1283,16 +1283,16 @@
 void Range::selectNode(Node* refNode, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
-    // INVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode is an Entity, Notation or
+    // InvalidNodeTypeError: Raised if an ancestor of refNode is an Entity, Notation or
     // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity, or Notation
     // node.
     for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode()) {
@@ -1310,7 +1310,7 @@
             case Node::DOCUMENT_TYPE_NODE:
             case Node::ENTITY_NODE:
             case Node::NOTATION_NODE:
-                ec = INVALID_NODE_TYPE_ERR;
+                ec = InvalidNodeTypeError;
                 return;
         }
     }
@@ -1329,7 +1329,7 @@
         case Node::DOCUMENT_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = INVALID_NODE_TYPE_ERR;
+            ec = InvalidNodeTypeError;
             return;
     }
 
@@ -1346,16 +1346,16 @@
 void Range::selectNodeContents(Node* refNode, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
-    // INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an Entity, Notation
+    // InvalidNodeTypeError: Raised if refNode or an ancestor of refNode is an Entity, Notation
     // or DocumentType node.
     for (Node* n = refNode; n; n = n->parentNode()) {
         switch (n->nodeType()) {
@@ -1372,7 +1372,7 @@
             case Node::DOCUMENT_TYPE_NODE:
             case Node::ENTITY_NODE:
             case Node::NOTATION_NODE:
-                ec = INVALID_NODE_TYPE_ERR;
+                ec = InvalidNodeTypeError;
                 return;
         }
     }
@@ -1389,16 +1389,16 @@
     RefPtr<Node> newParent = passNewParent;
 
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!newParent) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
-    // INVALID_NODE_TYPE_ERR: Raised if node is an Attr, Entity, DocumentType, Notation,
+    // InvalidNodeTypeError: Raised if node is an Attr, Entity, DocumentType, Notation,
     // Document, or DocumentFragment node.
     switch (newParent->nodeType()) {
         case Node::ATTRIBUTE_NODE:
@@ -1407,7 +1407,7 @@
         case Node::DOCUMENT_TYPE_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = INVALID_NODE_TYPE_ERR;
+            ec = InvalidNodeTypeError;
             return;
         case Node::CDATA_SECTION_NODE:
         case Node::COMMENT_NODE:
@@ -1418,7 +1418,7 @@
             break;
     }
 
-    // Raise a HIERARCHY_REQUEST_ERR if m_start.container() doesn't accept children like newParent.
+    // Raise a HierarchyRequestError if m_start.container() doesn't accept children like newParent.
     Node* parentOfNewParent = m_start.container();
 
     // If m_start.container() is a character data node, it will be split and it will be its parent that will 
@@ -1427,12 +1427,12 @@
     if (parentOfNewParent->isCharacterDataNode())
         parentOfNewParent = parentOfNewParent->parentNode();
     if (!parentOfNewParent || !parentOfNewParent->childTypeAllowed(newParent->nodeType())) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return;
     }
     
     if (newParent->contains(m_start.container())) {
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
         return;
     }
 
@@ -1447,7 +1447,7 @@
     if (endNonTextContainer->nodeType() == Node::TEXT_NODE)
         endNonTextContainer = endNonTextContainer->parentNode();
     if (startNonTextContainer != endNonTextContainer) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -1472,12 +1472,12 @@
 void Range::setStartBefore(Node* refNode, ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!refNode) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
@@ -1492,7 +1492,7 @@
 void Range::checkDeleteExtract(ExceptionCode& ec)
 {
     if (!m_start.container()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -1503,7 +1503,7 @@
     Node* pastLast = pastLastNode();
     for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) {
         if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) {
-            ec = HIERARCHY_REQUEST_ERR;
+            ec = HierarchyRequestError;
             return;
         }
     }
diff --git a/Source/core/dom/RegisteredEventListener.h b/Source/core/dom/RegisteredEventListener.h
index 1da01e6..23a718a 100644
--- a/Source/core/dom/RegisteredEventListener.h
+++ b/Source/core/dom/RegisteredEventListener.h
@@ -25,7 +25,7 @@
 #define RegisteredEventListener_h
 
 #include "core/dom/EventListener.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/RequestAnimationFrameCallback.h b/Source/core/dom/RequestAnimationFrameCallback.h
index 52580dc..768e4a1 100644
--- a/Source/core/dom/RequestAnimationFrameCallback.h
+++ b/Source/core/dom/RequestAnimationFrameCallback.h
@@ -31,7 +31,7 @@
 #ifndef RequestAnimationFrameCallback_h
 #define RequestAnimationFrameCallback_h
 
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ScopedEventQueue.cpp b/Source/core/dom/ScopedEventQueue.cpp
index 3889936..8072c59 100644
--- a/Source/core/dom/ScopedEventQueue.cpp
+++ b/Source/core/dom/ScopedEventQueue.cpp
@@ -35,8 +35,8 @@
 #include "core/dom/EventDispatchMediator.h"
 #include "core/dom/EventDispatcher.h"
 #include "core/dom/EventTarget.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/OwnPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ScopedEventQueue.h b/Source/core/dom/ScopedEventQueue.h
index 262f6a9..4f3c928 100644
--- a/Source/core/dom/ScopedEventQueue.h
+++ b/Source/core/dom/ScopedEventQueue.h
@@ -31,10 +31,10 @@
 #ifndef ScopedEventQueue_h
 #define ScopedEventQueue_h
 
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ScriptElement.cpp b/Source/core/dom/ScriptLoader.cpp
similarity index 73%
rename from Source/core/dom/ScriptElement.cpp
rename to Source/core/dom/ScriptLoader.cpp
index 94018c1..e42b6c3 100644
--- a/Source/core/dom/ScriptElement.cpp
+++ b/Source/core/dom/ScriptLoader.cpp
@@ -22,7 +22,7 @@
  */
 
 #include "config.h"
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoader.h"
 
 #include "HTMLNames.h"
 #include "SVGNames.h"
@@ -31,6 +31,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Event.h"
 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
+#include "core/dom/ScriptLoaderClient.h"
 #include "core/dom/ScriptRunner.h"
 #include "core/dom/ScriptableDocumentParser.h"
 #include "core/dom/Text.h"
@@ -51,7 +52,7 @@
 
 namespace WebCore {
 
-ScriptElement::ScriptElement(Element* element, bool parserInserted, bool alreadyStarted)
+ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadyStarted)
     : m_element(element)
     , m_cachedScript(0)
     , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
@@ -66,28 +67,28 @@
     , m_willExecuteInOrder(false)
 {
     ASSERT(m_element);
-    if (parserInserted && m_element->document()->scriptableDocumentParser() && !m_element->document()->isInDocumentWrite())
-        m_startLineNumber = m_element->document()->scriptableDocumentParser()->lineNumber();
+    if (parserInserted && element->document()->scriptableDocumentParser() && !element->document()->isInDocumentWrite())
+        m_startLineNumber = element->document()->scriptableDocumentParser()->lineNumber();
 }
 
-ScriptElement::~ScriptElement()
+ScriptLoader::~ScriptLoader()
 {
     stopLoadRequest();
 }
 
-void ScriptElement::insertedInto(ContainerNode* insertionPoint)
+void ScriptLoader::insertedInto(ContainerNode* insertionPoint)
 {
     if (insertionPoint->inDocument() && !m_parserInserted)
         prepareScript(); // FIXME: Provide a real starting line number here.
 }
 
-void ScriptElement::childrenChanged()
+void ScriptLoader::childrenChanged()
 {
     if (!m_parserInserted && m_element->inDocument())
         prepareScript(); // FIXME: Provide a real starting line number here.
 }
 
-void ScriptElement::handleSourceAttribute(const String& sourceUrl)
+void ScriptLoader::handleSourceAttribute(const String& sourceUrl)
 {
     if (ignoresLoadRequest() || sourceUrl.isEmpty())
         return;
@@ -95,7 +96,7 @@
     prepareScript(); // FIXME: Provide a real starting line number here.
 }
 
-void ScriptElement::handleAsyncAttribute()
+void ScriptLoader::handleAsyncAttribute()
 {
     m_forceAsync = false;
 }
@@ -131,48 +132,60 @@
     return languages.contains(language);
 }
 
-void ScriptElement::dispatchErrorEvent()
+void ScriptLoader::dispatchErrorEvent()
 {
     m_element->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
 }
 
-bool ScriptElement::isScriptTypeSupported(LegacyTypeSupport supportLegacyTypes) const
+void ScriptLoader::dispatchLoadEvent()
+{
+    if (ScriptLoaderClient* client = this->client())
+        client->dispatchLoadEvent();
+    setHaveFiredLoadEvent(true);
+}
+
+bool ScriptLoader::isScriptTypeSupported(LegacyTypeSupport supportLegacyTypes) const
 {
     // FIXME: isLegacySupportedJavaScriptLanguage() is not valid HTML5. It is used here to maintain backwards compatibility with existing layout tests. The specific violations are:
     // - Allowing type=javascript. type= should only support MIME types, such as text/javascript.
     // - Allowing a different set of languages for language= and type=. language= supports Javascript 1.1 and 1.4-1.6, but type= does not.
 
-    String type = typeAttributeValue();
-    String language = languageAttributeValue();
+    String type = client()->typeAttributeValue();
+    String language = client()->languageAttributeValue();
     if (type.isEmpty() && language.isEmpty())
         return true; // Assume text/javascript.
     if (type.isEmpty()) {
         type = "text/" + language.lower();
         if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySupportedJavaScriptLanguage(language))
             return true;
-    } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace().lower()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySupportedJavaScriptLanguage(type)))
+    } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace().lower()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySupportedJavaScriptLanguage(type))) {
         return true;
+    }
+
     return false;
 }
 
 // http://dev.w3.org/html5/spec/Overview.html#prepare-a-script
-bool ScriptElement::prepareScript(const TextPosition& scriptStartPosition, LegacyTypeSupport supportLegacyTypes)
+bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, LegacyTypeSupport supportLegacyTypes)
 {
     if (m_alreadyStarted)
         return false;
 
+    ScriptLoaderClient* client = this->client();
+
     bool wasParserInserted;
     if (m_parserInserted) {
         wasParserInserted = true;
         m_parserInserted = false;
-    } else
+    } else {
         wasParserInserted = false;
+    }
 
-    if (wasParserInserted && !asyncAttributeValue())
+    if (wasParserInserted && !client->asyncAttributeValue())
         m_forceAsync = true;
 
     // FIXME: HTML5 spec says we should check that all children are either comments or empty text nodes.
-    if (!hasSourceAttribute() && !m_element->firstChild())
+    if (!client->hasSourceAttribute() && !m_element->firstChild())
         return false;
 
     if (!m_element->inDocument())
@@ -203,29 +216,30 @@
     if (!isScriptForEventSupported())
         return false;
 
-    if (!charsetAttributeValue().isEmpty())
-        m_characterEncoding = charsetAttributeValue();
+    if (!client->charsetAttributeValue().isEmpty())
+        m_characterEncoding = client->charsetAttributeValue();
     else
         m_characterEncoding = document->charset();
 
-    if (hasSourceAttribute())
-        if (!requestScript(sourceAttributeValue()))
+    if (client->hasSourceAttribute()) {
+        if (!requestScript(client->sourceAttributeValue()))
             return false;
+    }
 
-    if (hasSourceAttribute() && deferAttributeValue() && m_parserInserted && !asyncAttributeValue()) {
+    if (client->hasSourceAttribute() && client->deferAttributeValue() && m_parserInserted && !client->asyncAttributeValue()) {
         m_willExecuteWhenDocumentFinishedParsing = true;
         m_willBeParserExecuted = true;
-    } else if (hasSourceAttribute() && m_parserInserted && !asyncAttributeValue())
+    } else if (client->hasSourceAttribute() && m_parserInserted && !client->asyncAttributeValue()) {
         m_willBeParserExecuted = true;
-    else if (!hasSourceAttribute() && m_parserInserted && !document->haveStylesheetsAndImportsLoaded()) {
+    } else if (!client->hasSourceAttribute() && m_parserInserted && !document->haveStylesheetsAndImportsLoaded()) {
         m_willBeParserExecuted = true;
         m_readyToBeParserExecuted = true;
-    } else if (hasSourceAttribute() && !asyncAttributeValue() && !m_forceAsync) {
+    } else if (client->hasSourceAttribute() && !client->asyncAttributeValue() && !m_forceAsync) {
         m_willExecuteInOrder = true;
         document->scriptRunner()->queueScriptForExecution(this, m_cachedScript, ScriptRunner::IN_ORDER_EXECUTION);
         m_cachedScript->addClient(this);
-    } else if (hasSourceAttribute()) {
-        m_element->document()->scriptRunner()->queueScriptForExecution(this, m_cachedScript, ScriptRunner::ASYNC_EXECUTION);
+    } else if (client->hasSourceAttribute()) {
+        document->scriptRunner()->queueScriptForExecution(this, m_cachedScript, ScriptRunner::ASYNC_EXECUTION);
         m_cachedScript->addClient(this);
     } else {
         // Reset line numbering for nested writes.
@@ -237,8 +251,10 @@
     return true;
 }
 
-bool ScriptElement::requestScript(const String& sourceUrl)
+bool ScriptLoader::requestScript(const String& sourceUrl)
 {
+    ASSERT(m_element);
+
     RefPtr<Document> originalDocument = m_element->document();
     if (!m_element->dispatchBeforeLoadEvent(sourceUrl))
         return false;
@@ -247,7 +263,7 @@
 
     ASSERT(!m_cachedScript);
     if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
-        CachedResourceRequest request(ResourceRequest(m_element->document()->completeURL(sourceUrl)), element()->localName());
+        CachedResourceRequest request(ResourceRequest(m_element->document()->completeURL(sourceUrl)), m_element->localName());
 
         String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
         if (!crossOriginMode.isNull()) {
@@ -272,17 +288,17 @@
     return false;
 }
 
-bool isHTMLScriptElement(Element* element)
+bool isHTMLScriptLoader(Element* element)
 {
     return element->hasTagName(HTMLNames::scriptTag);
 }
 
-bool isSVGScriptElement(Element* element)
+bool isSVGScriptLoader(Element* element)
 {
     return element->hasTagName(SVGNames::scriptTag);
 }
 
-void ScriptElement::executeScript(const ScriptSourceCode& sourceCode)
+void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode)
 {
     ASSERT(m_alreadyStarted);
 
@@ -303,26 +319,24 @@
     }
 
     if (frame) {
-        {
-            IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.get() : 0);
+        IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.get() : 0);
 
-            if (isHTMLScriptElement(m_element))
-                document->pushCurrentScript(toHTMLScriptElement(m_element));
+        if (isHTMLScriptLoader(m_element))
+            document->pushCurrentScript(toHTMLScriptElement(m_element));
 
-            // Create a script from the script element node, using the script
-            // block's source and the script block's type.
-            // Note: This is where the script is compiled and actually executed.
-            frame->script()->executeScriptInMainWorld(sourceCode);
+        // Create a script from the script element node, using the script
+        // block's source and the script block's type.
+        // Note: This is where the script is compiled and actually executed.
+        frame->script()->executeScriptInMainWorld(sourceCode);
 
-            if (isHTMLScriptElement(m_element)) {
-                ASSERT(document->currentScript() == m_element);
-                document->popCurrentScript();
-            }
+        if (isHTMLScriptLoader(m_element)) {
+            ASSERT(document->currentScript() == m_element);
+            document->popCurrentScript();
         }
     }
 }
 
-void ScriptElement::stopLoadRequest()
+void ScriptLoader::stopLoadRequest()
 {
     if (m_cachedScript) {
         if (!m_willBeParserExecuted)
@@ -331,25 +345,25 @@
     }
 }
 
-void ScriptElement::execute(CachedScript* cachedScript)
+void ScriptLoader::execute(CachedScript* cachedScript)
 {
     ASSERT(!m_willBeParserExecuted);
     ASSERT(cachedScript);
-    if (cachedScript->errorOccurred())
+    if (cachedScript->errorOccurred()) {
         dispatchErrorEvent();
-    else if (!cachedScript->wasCanceled()) {
+    } else if (!cachedScript->wasCanceled()) {
         executeScript(ScriptSourceCode(cachedScript));
         dispatchLoadEvent();
     }
     cachedScript->removeClient(this);
 }
 
-void ScriptElement::notifyFinished(CachedResource* resource)
+void ScriptLoader::notifyFinished(CachedResource* resource)
 {
     ASSERT(!m_willBeParserExecuted);
 
     // CachedResource possibly invokes this notifyFinished() more than
-    // once because ScriptElement doesn't unsubscribe itself from
+    // once because ScriptLoader doesn't unsubscribe itself from
     // CachedResource here and does it in execute() instead.
     // We use m_cachedScript to check if this function is already called.
     ASSERT_UNUSED(resource, resource == m_cachedScript);
@@ -368,15 +382,15 @@
     m_cachedScript = 0;
 }
 
-bool ScriptElement::ignoresLoadRequest() const
+bool ScriptLoader::ignoresLoadRequest() const
 {
-    return m_alreadyStarted || m_isExternalScript || m_parserInserted || !m_element->inDocument();
+    return m_alreadyStarted || m_isExternalScript || m_parserInserted || !element() || !element()->inDocument();
 }
 
-bool ScriptElement::isScriptForEventSupported() const
+bool ScriptLoader::isScriptForEventSupported() const
 {
-    String eventAttribute = eventAttributeValue();
-    String forAttribute = forAttributeValue();
+    String eventAttribute = client()->eventAttributeValue();
+    String forAttribute = client()->forAttributeValue();
     if (!eventAttribute.isEmpty() && !forAttribute.isEmpty()) {
         forAttribute = forAttribute.stripWhiteSpace();
         if (!equalIgnoringCase(forAttribute, "window"))
@@ -389,18 +403,30 @@
     return true;
 }
 
-String ScriptElement::scriptContent() const
+String ScriptLoader::scriptContent() const
 {
     return m_element->textFromChildren();
 }
 
-ScriptElement* toScriptElementIfPossible(Element* element)
+ScriptLoaderClient* ScriptLoader::client() const
 {
-    if (isHTMLScriptElement(element))
-        return toHTMLScriptElement(element);
+    if (isHTMLScriptLoader(m_element))
+        return toHTMLScriptElement(m_element);
 
-    if (isSVGScriptElement(element))
-        return toSVGScriptElement(element);
+    if (isSVGScriptLoader(m_element))
+        return toSVGScriptElement(m_element);
+
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+ScriptLoader* toScriptLoaderIfPossible(Element* element)
+{
+    if (isHTMLScriptLoader(element))
+        return toHTMLScriptElement(element)->loader();
+
+    if (isSVGScriptLoader(element))
+        return toSVGScriptElement(element)->loader();
 
     return 0;
 }
diff --git a/Source/core/dom/ScriptElement.h b/Source/core/dom/ScriptLoader.h
similarity index 78%
rename from Source/core/dom/ScriptElement.h
rename to Source/core/dom/ScriptLoader.h
index 32a011d..55fb167 100644
--- a/Source/core/dom/ScriptElement.h
+++ b/Source/core/dom/ScriptLoader.h
@@ -18,26 +18,27 @@
  *
  */
 
-#ifndef ScriptElement_h
-#define ScriptElement_h
+#ifndef ScriptLoader_h
+#define ScriptLoader_h
 
 #include "core/loader/cache/CachedResourceClient.h"
 #include "core/loader/cache/CachedResourceHandle.h"
-#include <wtf/text/TextPosition.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
 class CachedScript;
 class ContainerNode;
 class Element;
-class ScriptElement;
+class ScriptLoaderClient;
 class ScriptSourceCode;
 
-class ScriptElement : private CachedResourceClient {
+
+class ScriptLoader : private CachedResourceClient {
 public:
-    ScriptElement(Element*, bool createdByParser, bool isEvaluated);
-    virtual ~ScriptElement();
+    static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool isEvaluated);
+    virtual ~ScriptLoader();
 
     Element* element() const { return m_element; }
 
@@ -50,7 +51,7 @@
     void execute(CachedScript*);
 
     // XML parser calls these
-    virtual void dispatchLoadEvent() = 0;
+    void dispatchLoadEvent();
     void dispatchErrorEvent();
     bool isScriptTypeSupported(LegacyTypeSupport) const;
 
@@ -60,7 +61,6 @@
     bool willExecuteWhenDocumentFinishedParsing() const { return m_willExecuteWhenDocumentFinishedParsing; }
     CachedResourceHandle<CachedScript> cachedScript() { return m_cachedScript; }
 
-protected:
     void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFiredLoad; }
     bool isParserInserted() const { return m_parserInserted; }
     bool alreadyStarted() const { return m_alreadyStarted; }
@@ -73,23 +73,18 @@
     void handleAsyncAttribute();
 
 private:
+    ScriptLoader(Element*, bool createdByParser, bool isEvaluated);
+
     bool ignoresLoadRequest() const;
     bool isScriptForEventSupported() const;
 
     bool requestScript(const String& sourceUrl);
     void stopLoadRequest();
 
-    virtual void notifyFinished(CachedResource*);
+    ScriptLoaderClient* client() const;
 
-    virtual String sourceAttributeValue() const = 0;
-    virtual String charsetAttributeValue() const = 0;
-    virtual String typeAttributeValue() const = 0;
-    virtual String languageAttributeValue() const = 0;
-    virtual String forAttributeValue() const = 0;
-    virtual String eventAttributeValue() const = 0;
-    virtual bool asyncAttributeValue() const = 0;
-    virtual bool deferAttributeValue() const = 0;
-    virtual bool hasSourceAttribute() const = 0;
+    // CachedResourceClient
+    virtual void notifyFinished(CachedResource*) OVERRIDE;
 
     Element* m_element;
     CachedResourceHandle<CachedScript> m_cachedScript;
@@ -107,8 +102,14 @@
     String m_fallbackCharacterEncoding;
 };
 
-ScriptElement* toScriptElementIfPossible(Element*);
+ScriptLoader* toScriptLoaderIfPossible(Element*);
+
+inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool createdByParser, bool isEvaluated)
+{
+    return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated));
+}
 
 }
 
+
 #endif
diff --git a/Source/core/dom/ScriptLoaderClient.h b/Source/core/dom/ScriptLoaderClient.h
new file mode 100644
index 0000000..7ca9d74
--- /dev/null
+++ b/Source/core/dom/ScriptLoaderClient.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * 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 ScriptLoaderClient_h
+#define ScriptLoaderClient_h
+
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class ScriptLoaderClient {
+public:
+    virtual ~ScriptLoaderClient() { }
+
+    virtual void dispatchLoadEvent() = 0;
+
+    virtual String sourceAttributeValue() const = 0;
+    virtual String charsetAttributeValue() const = 0;
+    virtual String typeAttributeValue() const = 0;
+    virtual String languageAttributeValue() const = 0;
+    virtual String forAttributeValue() const = 0;
+    virtual String eventAttributeValue() const = 0;
+    virtual bool asyncAttributeValue() const = 0;
+    virtual bool deferAttributeValue() const = 0;
+    virtual bool hasSourceAttribute() const = 0;
+};
+
+}
+
+#endif
diff --git a/Source/core/dom/ScriptRunner.cpp b/Source/core/dom/ScriptRunner.cpp
index 706a1d1..db5f7a5 100644
--- a/Source/core/dom/ScriptRunner.cpp
+++ b/Source/core/dom/ScriptRunner.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/PendingScript.h"
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/loader/cache/CachedScript.h"
 
 namespace WebCore {
@@ -51,12 +51,12 @@
         m_document->decrementLoadEventDelayCount();
 }
 
-void ScriptRunner::queueScriptForExecution(ScriptElement* scriptElement, CachedResourceHandle<CachedScript> cachedScript, ExecutionType executionType)
+void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, CachedResourceHandle<CachedScript> cachedScript, ExecutionType executionType)
 {
-    ASSERT(scriptElement);
+    ASSERT(scriptLoader);
     ASSERT(cachedScript.get());
 
-    Element* element = scriptElement->element();
+    Element* element = scriptLoader->element();
     ASSERT(element);
     ASSERT(element->inDocument());
 
@@ -64,7 +64,7 @@
 
     switch (executionType) {
     case ASYNC_EXECUTION:
-        m_pendingAsyncScripts.add(scriptElement, PendingScript(element, cachedScript.get()));
+        m_pendingAsyncScripts.add(scriptLoader, PendingScript(element, cachedScript.get()));
         break;
 
     case IN_ORDER_EXECUTION:
@@ -84,12 +84,12 @@
         m_timer.startOneShot(0);
 }
 
-void ScriptRunner::notifyScriptReady(ScriptElement* scriptElement, ExecutionType executionType)
+void ScriptRunner::notifyScriptReady(ScriptLoader* scriptLoader, ExecutionType executionType)
 {
     switch (executionType) {
     case ASYNC_EXECUTION:
-        ASSERT(m_pendingAsyncScripts.contains(scriptElement));
-        m_scriptsToExecuteSoon.append(m_pendingAsyncScripts.take(scriptElement));
+        ASSERT(m_pendingAsyncScripts.contains(scriptLoader));
+        m_scriptsToExecuteSoon.append(m_pendingAsyncScripts.take(scriptLoader));
         break;
 
     case IN_ORDER_EXECUTION:
@@ -118,7 +118,7 @@
     for (size_t i = 0; i < size; ++i) {
         CachedScript* cachedScript = scripts[i].cachedScript();
         RefPtr<Element> element = scripts[i].releaseElementAndClear();
-        toScriptElementIfPossible(element.get())->execute(cachedScript);
+        toScriptLoaderIfPossible(element.get())->execute(cachedScript);
         m_document->decrementLoadEventDelayCount();
     }
 }
diff --git a/Source/core/dom/ScriptRunner.h b/Source/core/dom/ScriptRunner.h
index 1790764..6cbb2b9 100644
--- a/Source/core/dom/ScriptRunner.h
+++ b/Source/core/dom/ScriptRunner.h
@@ -38,7 +38,7 @@
 class CachedScript;
 class Document;
 class PendingScript;
-class ScriptElement;
+class ScriptLoader;
 
 class ScriptRunner {
     WTF_MAKE_NONCOPYABLE(ScriptRunner); WTF_MAKE_FAST_ALLOCATED;
@@ -47,11 +47,11 @@
     ~ScriptRunner();
 
     enum ExecutionType { ASYNC_EXECUTION, IN_ORDER_EXECUTION };
-    void queueScriptForExecution(ScriptElement*, CachedResourceHandle<CachedScript>, ExecutionType);
+    void queueScriptForExecution(ScriptLoader*, CachedResourceHandle<CachedScript>, ExecutionType);
     bool hasPendingScripts() const { return !m_scriptsToExecuteSoon.isEmpty() || !m_scriptsToExecuteInOrder.isEmpty() || !m_pendingAsyncScripts.isEmpty(); }
     void suspend();
     void resume();
-    void notifyScriptReady(ScriptElement*, ExecutionType);
+    void notifyScriptReady(ScriptLoader*, ExecutionType);
 
 private:
     explicit ScriptRunner(Document*);
@@ -61,7 +61,7 @@
     Document* m_document;
     Vector<PendingScript> m_scriptsToExecuteInOrder;
     Vector<PendingScript> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
-    HashMap<ScriptElement*, PendingScript> m_pendingAsyncScripts;
+    HashMap<ScriptLoader*, PendingScript> m_pendingAsyncScripts;
     Timer<ScriptRunner> m_timer;
 };
 
diff --git a/Source/core/dom/ScriptableDocumentParser.h b/Source/core/dom/ScriptableDocumentParser.h
index f8a95ad..e40e8dd 100644
--- a/Source/core/dom/ScriptableDocumentParser.h
+++ b/Source/core/dom/ScriptableDocumentParser.h
@@ -28,7 +28,7 @@
 
 #include "core/dom/DecodedDataDocumentParser.h"
 #include "core/dom/ParserContentPolicy.h"
-#include <wtf/text/TextPosition.h>
+#include "wtf/text/TextPosition.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/SecurityContext.cpp b/Source/core/dom/SecurityContext.cpp
index 80fcaba..c40d60c 100644
--- a/Source/core/dom/SecurityContext.cpp
+++ b/Source/core/dom/SecurityContext.cpp
@@ -27,11 +27,11 @@
 #include "config.h"
 #include "core/dom/SecurityContext.h"
 
-#include <wtf/text/StringBuilder.h>
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/page/ContentSecurityPolicy.h"
 #include "weborigin/SecurityOrigin.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/SecurityContext.h b/Source/core/dom/SecurityContext.h
index 61f0e6a..9685aea 100644
--- a/Source/core/dom/SecurityContext.h
+++ b/Source/core/dom/SecurityContext.h
@@ -27,9 +27,9 @@
 #ifndef SecurityContext_h
 #define SecurityContext_h
 
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/SecurityPolicyViolationEvent.h b/Source/core/dom/SecurityPolicyViolationEvent.h
index 5915e43..40ff41b 100644
--- a/Source/core/dom/SecurityPolicyViolationEvent.h
+++ b/Source/core/dom/SecurityPolicyViolationEvent.h
@@ -44,6 +44,7 @@
     String sourceFile;
     int lineNumber;
     int columnNumber;
+    int statusCode;
 };
 
 class SecurityPolicyViolationEvent : public Event {
@@ -67,6 +68,7 @@
     const String& sourceFile() const { return m_sourceFile; }
     int lineNumber() const { return m_lineNumber; }
     int columnNumber() const { return m_columnNumber; }
+    int statusCode() const { return m_statusCode; }
 
     virtual const AtomicString& interfaceName() const { return eventNames().interfaceForSecurityPolicyViolationEvent; }
 
@@ -87,6 +89,7 @@
         , m_sourceFile(initializer.sourceFile)
         , m_lineNumber(initializer.lineNumber)
         , m_columnNumber(initializer.columnNumber)
+        , m_statusCode(initializer.statusCode)
     {
         ScriptWrappable::init(this);
     }
@@ -100,6 +103,7 @@
     String m_sourceFile;
     int m_lineNumber;
     int m_columnNumber;
+    int m_statusCode;
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/SecurityPolicyViolationEvent.idl b/Source/core/dom/SecurityPolicyViolationEvent.idl
index 528b0cc..8eab91e 100644
--- a/Source/core/dom/SecurityPolicyViolationEvent.idl
+++ b/Source/core/dom/SecurityPolicyViolationEvent.idl
@@ -35,4 +35,5 @@
     [InitializedByEventConstructor] readonly attribute DOMString sourceFile;
     [InitializedByEventConstructor] readonly attribute long      lineNumber;
     [InitializedByEventConstructor] readonly attribute long      columnNumber;
+    [InitializedByEventConstructor] readonly attribute long      statusCode;
 };
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index 32ed0f3..dd04402 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -220,13 +220,13 @@
     parser.parseSelector(selectors, selectorList);
 
     if (!selectorList.first() || selectorList.hasInvalidSelector()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
-    // throw a NAMESPACE_ERR if the selector includes any namespace prefixes.
+    // throw a NamespaceError if the selector includes any namespace prefixes.
     if (selectorList.selectorsNeedNamespaceResolution()) {
-        ec = NAMESPACE_ERR;
+        ec = NamespaceError;
         return 0;
     }
 
diff --git a/Source/core/dom/SelectorQuery.h b/Source/core/dom/SelectorQuery.h
index 79e6381..c3bd41a 100644
--- a/Source/core/dom/SelectorQuery.h
+++ b/Source/core/dom/SelectorQuery.h
@@ -27,9 +27,9 @@
 #define SelectorQuery_h
 
 #include "core/css/CSSSelectorList.h"
-#include <wtf/HashMap.h>
-#include <wtf/text/AtomicStringHash.h>
-#include <wtf/Vector.h>
+#include "wtf/HashMap.h"
+#include "wtf/Vector.h"
+#include "wtf/text/AtomicStringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/SpaceSplitString.h b/Source/core/dom/SpaceSplitString.h
index 53b588f..7f9816c 100644
--- a/Source/core/dom/SpaceSplitString.h
+++ b/Source/core/dom/SpaceSplitString.h
@@ -21,9 +21,9 @@
 #ifndef SpaceSplitString_h
 #define SpaceSplitString_h
 
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/StaticNodeList.h b/Source/core/dom/StaticNodeList.h
index 823f48f..ece0926 100644
--- a/Source/core/dom/StaticNodeList.h
+++ b/Source/core/dom/StaticNodeList.h
@@ -30,9 +30,9 @@
 #define StaticNodeList_h
 
 #include "core/dom/NodeList.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/StringCallback.cpp b/Source/core/dom/StringCallback.cpp
index 687821e..092f70e 100644
--- a/Source/core/dom/StringCallback.cpp
+++ b/Source/core/dom/StringCallback.cpp
@@ -32,7 +32,7 @@
 #include "core/dom/StringCallback.h"
 
 #include "core/dom/ScriptExecutionContext.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/StringCallback.h b/Source/core/dom/StringCallback.h
index 92e83e2..e600847 100644
--- a/Source/core/dom/StringCallback.h
+++ b/Source/core/dom/StringCallback.h
@@ -31,8 +31,8 @@
 #ifndef StringCallback_h
 #define StringCallback_h
 
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/StyleElement.cpp b/Source/core/dom/StyleElement.cpp
index 83f797b..4ac26c2 100644
--- a/Source/core/dom/StyleElement.cpp
+++ b/Source/core/dom/StyleElement.cpp
@@ -29,8 +29,8 @@
 #include "core/dom/Element.h"
 #include "core/dom/ScriptableDocumentParser.h"
 #include "core/page/ContentSecurityPolicy.h"
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/TextPosition.h>
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/TextPosition.h"
 
 namespace WebCore {
 
@@ -71,12 +71,14 @@
     ASSERT(element);
     document->styleSheetCollection()->removeStyleSheetCandidateNode(element);
 
+    RefPtr<StyleSheet> removedSheet = m_sheet;
+
     if (m_sheet)
         clearSheet();
 
     // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
     if (document->renderer())
-        document->styleResolverChanged(DeferRecalcStyle);
+        document->removedStyleSheet(removedSheet.get());
 }
 
 void StyleElement::clearDocumentData(Document* document, Element* element)
@@ -143,7 +145,7 @@
             m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, document->inputEncoding());
             m_sheet->setMediaQueries(mediaQueries.release());
             m_sheet->setTitle(e->title());
-            m_sheet->contents()->parseStringAtLine(text, startPosition.m_line.zeroBasedInt(), m_createdByParser);
+            m_sheet->contents()->parseStringAtPosition(text, startPosition, m_createdByParser);
 
             m_loading = false;
         }
diff --git a/Source/core/dom/StyleSheetCollection.cpp b/Source/core/dom/StyleSheetCollection.cpp
new file mode 100644
index 0000000..2f3c5b7
--- /dev/null
+++ b/Source/core/dom/StyleSheetCollection.cpp
@@ -0,0 +1,293 @@
+/*
+ * 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, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) Research In Motion Limited 2010-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/dom/StyleSheetCollection.h"
+
+#include "HTMLNames.h"
+#include "SVGNames.h"
+#include "core/css/CSSStyleSheet.h"
+#include "core/css/StyleInvalidationAnalysis.h"
+#include "core/css/StyleSheetContents.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/Document.h"
+#include "core/dom/DocumentStyleSheetCollection.h"
+#include "core/dom/Element.h"
+#include "core/dom/ProcessingInstruction.h"
+#include "core/dom/WebCoreMemoryInstrumentation.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLLinkElement.h"
+#include "core/html/HTMLStyleElement.h"
+#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 "wtf/MemoryInstrumentationListHashSet.h"
+#include "wtf/MemoryInstrumentationVector.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+StyleSheetCollection::StyleSheetCollection(TreeScope* treeScope)
+    : m_treeScope(treeScope)
+    , m_hadActiveLoadingStylesheet(false)
+{
+}
+
+void StyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool createdByParser)
+{
+    if (!node->inDocument())
+        return;
+
+    // Until the <body> exists, we have no choice but to compare document positions,
+    // since styles outside of the body and head continue to be shunted into the head
+    // (and thus can shift to end up before dynamically added DOM content that is also
+    // outside the body).
+    if (createdByParser && document()->body()) {
+        m_styleSheetCandidateNodes.parserAdd(node);
+        return;
+    }
+
+    m_styleSheetCandidateNodes.add(node);
+}
+
+void StyleSheetCollection::removeStyleSheetCandidateNode(Node* node)
+{
+    m_styleSheetCandidateNodes.remove(node);
+}
+
+void StyleSheetCollection::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
+{
+    if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled())
+        return;
+
+    DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
+    DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
+    for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
+        Node* n = *it;
+        StyleSheet* sheet = 0;
+        CSSStyleSheet* activeSheet = 0;
+        if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) {
+            // Processing instruction (XML documents only).
+            // We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
+            ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n);
+            // Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
+            if (pi->isXSL() && !document()->transformSourceDocument()) {
+                // Don't apply XSL transforms until loading is finished.
+                if (!document()->parsing())
+                    document()->applyXSLTransform(pi);
+                return;
+            }
+            sheet = pi->sheet();
+            if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
+                activeSheet = static_cast<CSSStyleSheet*>(sheet);
+        } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) {
+            Element* e = toElement(n);
+            AtomicString title = e->getAttribute(titleAttr);
+            bool enabledViaScript = false;
+            if (e->hasLocalName(linkTag)) {
+                // <LINK> element
+                HTMLLinkElement* linkElement = toHTMLLinkElement(n);
+                enabledViaScript = linkElement->isEnabledViaScript();
+                if (!linkElement->isDisabled() && linkElement->styleSheetIsLoading()) {
+                    // it is loading but we should still decide which style sheet set to use
+                    if (!enabledViaScript && !title.isEmpty() && collections->preferredStylesheetSetName().isEmpty()) {
+                        const AtomicString& rel = e->getAttribute(relAttr);
+                        if (!rel.contains("alternate")) {
+                            collections->setPreferredStylesheetSetName(title);
+                            collections->setSelectedStylesheetSetName(title);
+                        }
+                    }
+
+                    continue;
+                }
+                sheet = linkElement->sheet();
+                if (!sheet)
+                    title = nullAtom;
+            } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) {
+                sheet = static_cast<SVGStyleElement*>(n)->sheet();
+            } else {
+                sheet = static_cast<HTMLStyleElement*>(n)->sheet();
+            }
+
+            if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
+                activeSheet = static_cast<CSSStyleSheet*>(sheet);
+
+            // Check to see if this sheet belongs to a styleset
+            // (thus making it PREFERRED or ALTERNATE rather than
+            // PERSISTENT).
+            AtomicString rel = e->getAttribute(relAttr);
+            if (!enabledViaScript && sheet && !title.isEmpty()) {
+                // Yes, we have a title.
+                if (collections->preferredStylesheetSetName().isEmpty()) {
+                    // No preferred set has been established. If
+                    // we are NOT an alternate sheet, then establish
+                    // us as the preferred set. Otherwise, just ignore
+                    // this sheet.
+                    if (e->hasLocalName(styleTag) || !rel.contains("alternate")) {
+                        collections->setPreferredStylesheetSetName(title);
+                        collections->setSelectedStylesheetSetName(title);
+                    }
+                }
+                if (title != collections->preferredStylesheetSetName())
+                    activeSheet = 0;
+            }
+
+            if (rel.contains("alternate") && title.isEmpty())
+                activeSheet = 0;
+        }
+        if (sheet)
+            styleSheets.append(sheet);
+        if (activeSheet)
+            activeSheets.append(activeSheet);
+    }
+}
+
+StyleSheetCollection::StyleResolverUpdateType StyleSheetCollection::compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets)
+{
+    // Find out which stylesheets are new.
+    unsigned newStylesheetCount = newStylesheets.size();
+    unsigned oldStylesheetCount = oldStyleSheets.size();
+    if (newStylesheetCount < oldStylesheetCount)
+        return Reconstruct;
+
+    unsigned newIndex = 0;
+    for (unsigned oldIndex = 0; oldIndex < oldStylesheetCount; ++oldIndex) {
+        if (newIndex >= newStylesheetCount)
+            return Reconstruct;
+        while (oldStyleSheets[oldIndex] != newStylesheets[newIndex]) {
+            addedSheets.append(newStylesheets[newIndex]->contents());
+            ++newIndex;
+            if (newIndex == newStylesheetCount)
+                return Reconstruct;
+        }
+        ++newIndex;
+    }
+    bool hasInsertions = !addedSheets.isEmpty();
+    while (newIndex < newStylesheetCount) {
+        addedSheets.append(newStylesheets[newIndex]->contents());
+        ++newIndex;
+    }
+    // If all new sheets were added at the end of the list we can just add them to existing StyleResolver.
+    // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly.
+    return hasInsertions ? Reset : Additive;
+}
+
+bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets)
+{
+    // StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
+    bool hasActiveLoadingStylesheet = false;
+    unsigned newStylesheetCount = newStyleSheets.size();
+    for (unsigned i = 0; i < newStylesheetCount; ++i) {
+        if (newStyleSheets[i]->isLoading())
+            hasActiveLoadingStylesheet = true;
+    }
+    if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
+        m_hadActiveLoadingStylesheet = false;
+        return true;
+    }
+    m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
+    return false;
+}
+
+void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc)
+{
+    styleResolverUpdateType = Reconstruct;
+    requiresFullStyleRecalc = true;
+
+    if (activeLoadingStyleSheetLoaded(newStyleSheets))
+        return;
+
+    if (updateMode != AnalyzedStyleUpdate)
+        return;
+    if (!document()->styleResolverIfExists())
+        return;
+
+    // Find out which stylesheets are new.
+    Vector<StyleSheetContents*> addedSheets;
+    styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets);
+
+    // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
+    if (!document()->body() || document()->hasNodesWithPlaceholderStyle())
+        return;
+    StyleInvalidationAnalysis invalidationAnalysis(addedSheets);
+    if (invalidationAnalysis.dirtiesAllStyle())
+        return;
+    invalidationAnalysis.invalidateStyle(document());
+    requiresFullStyleRecalc = false;
+}
+
+static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyleSheet> >& sheets, Document* document)
+{
+    HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
+    if (!seamlessParentIFrame)
+        return;
+    sheets.append(seamlessParentIFrame->document()->styleSheetCollection()->activeAuthorStyleSheets());
+}
+
+bool StyleSheetCollection::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode, StyleResolverUpdateType& styleResolverUpdateType)
+{
+    Vector<RefPtr<StyleSheet> > styleSheets;
+    Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
+    activeCSSStyleSheets.append(collections->injectedAuthorStyleSheets());
+    activeCSSStyleSheets.append(collections->documentAuthorStyleSheets());
+    collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, document());
+    collectStyleSheets(collections, styleSheets, activeCSSStyleSheets);
+
+    bool requiresFullStyleRecalc;
+    analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
+
+    if (styleResolverUpdateType == Reconstruct) {
+        document()->clearStyleResolver();
+    } else {
+        StyleResolver* styleResolver = document()->styleResolver();
+        if (styleResolverUpdateType == Reset) {
+            styleResolver->resetAuthorStyle();
+            styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets);
+        } else {
+            ASSERT(styleResolverUpdateType == Additive);
+            styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets);
+        }
+    }
+    m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
+    m_styleSheetsForStyleSheetList.swap(styleSheets);
+
+    return requiresFullStyleRecalc;
+}
+
+void StyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+    info.addMember(m_activeAuthorStyleSheets, "activeAuthorStyleSheets");
+    info.addMember(m_styleSheetsForStyleSheetList, "styleSheetsForStyleSheetList");
+    info.addMember(m_styleSheetCandidateNodes, "styleSheetCandidateNodes");
+    info.addMember(m_treeScope, "treeScope");
+}
+
+}
diff --git a/Source/core/dom/StyleSheetCollection.h b/Source/core/dom/StyleSheetCollection.h
new file mode 100644
index 0000000..fd0d176
--- /dev/null
+++ b/Source/core/dom/StyleSheetCollection.h
@@ -0,0 +1,95 @@
+/*
+ * 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) 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 StyleSheetCollection_h
+#define StyleSheetCollection_h
+
+#include "core/dom/Document.h"
+#include "core/dom/DocumentOrderedList.h"
+#include "core/dom/TreeScope.h"
+#include "wtf/FastAllocBase.h"
+#include "wtf/ListHashSet.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class CSSStyleSheet;
+class DocumentStyleSheetCollection;
+class Node;
+class StyleSheet;
+class StyleSheetContents;
+class StyleSheetList;
+
+class StyleSheetCollection {
+    WTF_MAKE_NONCOPYABLE(StyleSheetCollection); WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit StyleSheetCollection(TreeScope*);
+
+    void addStyleSheetCandidateNode(Node*, bool createdByParser);
+    void removeStyleSheetCandidateNode(Node*);
+
+    Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() { return m_activeAuthorStyleSheets; }
+    Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() { return m_styleSheetsForStyleSheetList; }
+    const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { return m_activeAuthorStyleSheets; }
+    const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() const { return m_styleSheetsForStyleSheetList; }
+
+    DocumentOrderedList& styleSheetCandidateNodes() { return m_styleSheetCandidateNodes; }
+
+    enum StyleResolverUpdateType {
+        Reconstruct,
+        Reset,
+        Additive
+    };
+    bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode, StyleResolverUpdateType&);
+
+    void reportMemoryUsage(MemoryObjectInfo*) const;
+
+private:
+    Document* document() { return m_treeScope->documentScope(); }
+
+    void collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
+
+    StyleResolverUpdateType compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets);
+    bool activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets);
+
+    void analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc);
+
+    Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList;
+    Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets;
+
+    TreeScope* m_treeScope;
+    bool m_hadActiveLoadingStylesheet;
+
+    DocumentOrderedList m_styleSheetCandidateNodes;
+};
+
+}
+
+#endif
+
diff --git a/Source/core/dom/TagNodeList.cpp b/Source/core/dom/TagNodeList.cpp
index 1835c65..b0e34f6 100644
--- a/Source/core/dom/TagNodeList.cpp
+++ b/Source/core/dom/TagNodeList.cpp
@@ -26,7 +26,7 @@
 
 #include "core/dom/Element.h"
 #include "core/dom/NodeRareData.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/TagNodeList.h b/Source/core/dom/TagNodeList.h
index f580ca0..3ef510b 100644
--- a/Source/core/dom/TagNodeList.h
+++ b/Source/core/dom/TagNodeList.h
@@ -26,7 +26,7 @@
 
 #include "core/dom/Element.h"
 #include "core/dom/LiveNodeList.h"
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index c36409b..9886613 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -26,6 +26,7 @@
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
+#include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/ScopedEventQueue.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -58,10 +59,10 @@
 {
     ec = 0;
 
-    // INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than
+    // IndexSizeError: Raised if the specified offset is negative or greater than
     // the number of 16-bit units in data.
     if (offset > length()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
 
@@ -217,7 +218,7 @@
     
     if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
         return true;
-    
+
     RenderObject* prev = context.previousRenderer();
     if (prev && prev->isBR()) // <span><br/> <br/></span>
         return false;
@@ -277,20 +278,32 @@
     CharacterData::attach(context);
 }
 
-void Text::recalcTextStyle(StyleChange change)
+bool Text::recalcTextStyle(StyleChange change)
 {
-    RenderText* renderer = toRenderText(this->renderer());
-
-    if (renderer) {
+    if (RenderText* renderer = toRenderText(this->renderer())) {
         if (change != NoChange || needsStyleRecalc())
             renderer->setStyle(document()->styleResolver()->styleForText(this));
         if (needsStyleRecalc())
             renderer->setText(dataImpl());
-    } else if (needsStyleRecalc()) {
+        clearNeedsStyleRecalc();
+    } else if (needsStyleRecalc() || needsWhitespaceRenderer()) {
         reattach();
+        return true;
     }
+    return false;
+}
 
-    clearNeedsStyleRecalc();
+// If a whitespace node had no renderer and goes through a recalcStyle it may
+// need to create one if the parent style now has white-space: pre.
+bool Text::needsWhitespaceRenderer()
+{
+    ASSERT(!renderer());
+    ContainerNode* parent = parentNodeForRenderingAndStyle();
+    if (!parent)
+        return false;
+    if (RenderStyle* style = parent->renderStyle())
+        return style->preserveNewline();
+    return false;
 }
 
 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData)
diff --git a/Source/core/dom/Text.h b/Source/core/dom/Text.h
index e4b3b1c..65f7738 100644
--- a/Source/core/dom/Text.h
+++ b/Source/core/dom/Text.h
@@ -46,7 +46,7 @@
     String wholeText() const;
     PassRefPtr<Text> replaceWholeText(const String&);
     
-    void recalcTextStyle(StyleChange);
+    bool recalcTextStyle(StyleChange);
     void createTextRendererIfNeeded();
     bool textRendererIsNeeded(const NodeRenderingContext&);
     virtual RenderText* createTextRenderer(RenderStyle*);
@@ -66,9 +66,11 @@
 
 private:
     virtual String nodeName() const OVERRIDE;
-    virtual PassRefPtr<Node> cloneNode(bool deep) OVERRIDE FINAL;
+    virtual PassRefPtr<Node> cloneNode(bool deep = true) OVERRIDE FINAL;
     virtual bool childTypeAllowed(NodeType) const OVERRIDE;
 
+    bool needsWhitespaceRenderer();
+
     virtual PassRefPtr<Text> cloneWithData(const String&);
 
 #ifndef NDEBUG
diff --git a/Source/core/dom/TextLinkColors.cpp b/Source/core/dom/TextLinkColors.cpp
new file mode 100644
index 0000000..f6e1fd8
--- /dev/null
+++ b/Source/core/dom/TextLinkColors.cpp
@@ -0,0 +1,121 @@
+/*
+ * 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, 2011, 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) Research In Motion Limited 2010-2011. All rights reserved.
+ * 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.
+ */
+
+#include "config.h"
+#include "core/dom/TextLinkColors.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/rendering/RenderTheme.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+TextLinkColors::TextLinkColors()
+    : m_textColor(Color::black)
+{
+    resetLinkColor();
+    resetVisitedLinkColor();
+    resetActiveLinkColor();
+}
+
+void TextLinkColors::resetLinkColor()
+{
+    m_linkColor = Color(0, 0, 238);
+}
+
+void TextLinkColors::resetVisitedLinkColor()
+{
+    m_visitedLinkColor = Color(85, 26, 139);
+}
+
+void TextLinkColors::resetActiveLinkColor()
+{
+    m_activeLinkColor.setNamedColor("red");
+}
+
+static Color colorForCSSValue(CSSValueID cssValueId)
+{
+    struct ColorValue {
+        CSSValueID cssValueId;
+        RGBA32 color;
+    };
+
+    static const ColorValue colorValues[] = {
+        { CSSValueAqua, 0xFF00FFFF },
+        { CSSValueBlack, 0xFF000000 },
+        { CSSValueBlue, 0xFF0000FF },
+        { CSSValueFuchsia, 0xFFFF00FF },
+        { CSSValueGray, 0xFF808080 },
+        { CSSValueGreen, 0xFF008000  },
+        { CSSValueGrey, 0xFF808080 },
+        { CSSValueLime, 0xFF00FF00 },
+        { CSSValueMaroon, 0xFF800000 },
+        { CSSValueNavy, 0xFF000080 },
+        { CSSValueOlive, 0xFF808000  },
+        { CSSValueOrange, 0xFFFFA500 },
+        { CSSValuePurple, 0xFF800080 },
+        { CSSValueRed, 0xFFFF0000 },
+        { CSSValueSilver, 0xFFC0C0C0 },
+        { CSSValueTeal, 0xFF008080  },
+        { CSSValueTransparent, 0x00000000 },
+        { CSSValueWhite, 0xFFFFFFFF },
+        { CSSValueYellow, 0xFFFFFF00 },
+        { CSSValueInvalid, CSSValueInvalid }
+    };
+
+    for (const ColorValue* col = colorValues; col->cssValueId; ++col) {
+        if (col->cssValueId == cssValueId)
+            return col->color;
+    }
+    return RenderTheme::defaultTheme()->systemColor(cssValueId);
+}
+
+Color TextLinkColors::colorFromPrimitiveValue(const CSSPrimitiveValue* value, Color currentColor, bool forVisitedLink) const
+{
+    if (value->isRGBColor())
+        return Color(value->getRGBA32Value());
+
+    CSSValueID valueID = value->getValueID();
+    switch (valueID) {
+    case 0:
+        return Color();
+    case CSSValueWebkitText:
+        return textColor();
+    case CSSValueWebkitLink:
+        return forVisitedLink ? visitedLinkColor() : linkColor();
+    case CSSValueWebkitActivelink:
+        return activeLinkColor();
+    case CSSValueWebkitFocusRingColor:
+        return RenderTheme::focusRingColor();
+    case CSSValueCurrentcolor:
+        return currentColor;
+    default:
+        return colorForCSSValue(valueID);
+    }
+}
+
+}
diff --git a/Source/core/dom/TextLinkColors.h b/Source/core/dom/TextLinkColors.h
new file mode 100644
index 0000000..6d2728c
--- /dev/null
+++ b/Source/core/dom/TextLinkColors.h
@@ -0,0 +1,67 @@
+/*
+ * 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 TextLinkColors_h
+#define TextLinkColors_h
+
+#include "core/platform/graphics/Color.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+class Element;
+
+class TextLinkColors {
+WTF_MAKE_NONCOPYABLE(TextLinkColors);
+public:
+    TextLinkColors();
+
+    void setTextColor(const Color& color) { m_textColor = color; }
+    Color textColor() const { return m_textColor; }
+
+    const Color& linkColor() const { return m_linkColor; }
+    const Color& visitedLinkColor() const { return m_visitedLinkColor; }
+    const Color& activeLinkColor() const { return m_activeLinkColor; }
+    void setLinkColor(const Color& color) { m_linkColor = color; }
+    void setVisitedLinkColor(const Color& color) { m_visitedLinkColor = color; }
+    void setActiveLinkColor(const Color& color) { m_activeLinkColor = color; }
+    void resetLinkColor();
+    void resetVisitedLinkColor();
+    void resetActiveLinkColor();
+    Color colorFromPrimitiveValue(const CSSPrimitiveValue*, Color currentColor, bool forVisitedLink = false) const;
+private:
+
+    Color m_textColor;
+    Color m_linkColor;
+    Color m_visitedLinkColor;
+    Color m_activeLinkColor;
+};
+
+}
+
+#endif
diff --git a/Source/core/dom/TouchEvent.idl b/Source/core/dom/TouchEvent.idl
index 6348e68..b054441 100644
--- a/Source/core/dom/TouchEvent.idl
+++ b/Source/core/dom/TouchEvent.idl
@@ -22,8 +22,9 @@
  * (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 TouchEvent : UIEvent {
+[
+    AllowJSCreationOnlyIfFeatureEnabled
+] interface TouchEvent : UIEvent {
     readonly attribute TouchList touches;
     readonly attribute TouchList targetTouches;
     readonly attribute TouchList changedTouches;
diff --git a/Source/core/dom/TransformSource.h b/Source/core/dom/TransformSource.h
index 002e912..f637ce3 100644
--- a/Source/core/dom/TransformSource.h
+++ b/Source/core/dom/TransformSource.h
@@ -20,11 +20,11 @@
 #ifndef TransformSource_h
 #define TransformSource_h
 
+#include "wtf/FastAllocBase.h"
+#include "wtf/Forward.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/text/WTFString.h"
 #include <libxml/tree.h>
-#include <wtf/FastAllocBase.h>
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Traversal.h b/Source/core/dom/Traversal.h
index 3e70886..58ef152 100644
--- a/Source/core/dom/Traversal.h
+++ b/Source/core/dom/Traversal.h
@@ -26,7 +26,7 @@
 #define Traversal_h
 
 #include "bindings/v8/ScriptState.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 2c447dc..1d778d9 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -35,6 +35,7 @@
 #include "core/dom/IdTargetObserverRegistry.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/TreeScopeAdopter.h"
+#include "core/dom/shadow/ElementShadow.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
@@ -204,8 +205,8 @@
     size_t hashPos = url.find('#');
     String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();
     if (rootNode()->document()->isHTMLDocument())
-        return static_cast<HTMLMapElement*>(m_imageMapsByName->getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));
-    return static_cast<HTMLMapElement*>(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this));
+        return toHTMLMapElement(m_imageMapsByName->getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));
+    return toHTMLMapElement(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this));
 }
 
 Node* nodeFromPoint(Document* document, int x, int y, LayoutPoint* localPoint)
@@ -237,10 +238,12 @@
 Element* TreeScope::elementFromPoint(int x, int y) const
 {
     Node* node = nodeFromPoint(rootNode()->document(), x, y);
-    while (node && !node->isElementNode())
+    if (node && node->isTextNode())
         node = node->parentNode();
-    if (node)
-        node = ancestorInThisScope(node);
+    ASSERT(!node || node->isElementNode() || node->isShadowRoot());
+    node = ancestorInThisScope(node);
+    if (!node || !node->isElementNode())
+        return 0;
     return toElement(node);
 }
 
@@ -265,8 +268,8 @@
         // Populate the map on first access.
         m_labelsByForAttribute = adoptPtr(new DocumentOrderedMap);
         for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(element)) {
-            if (element->hasTagName(labelTag)) {
-                HTMLLabelElement* label = static_cast<HTMLLabelElement*>(element);
+            if (isHTMLLabelElement(element)) {
+                HTMLLabelElement* label = toHTMLLabelElement(element);
                 const AtomicString& forValue = label->fastGetAttribute(forAttr);
                 if (!forValue.isEmpty())
                     addLabel(forValue, label);
@@ -274,7 +277,7 @@
         }
     }
 
-    return static_cast<HTMLLabelElement*>(m_labelsByForAttribute->getElementByLabelForAttribute(forAttributeValue.impl(), this));
+    return toHTMLLabelElement(m_labelsByForAttribute->getElementByLabelForAttribute(forAttributeValue.impl(), this));
 }
 
 DOMSelection* TreeScope::getSelection() const
@@ -299,8 +302,8 @@
     if (Element* element = getElementById(name))
         return element;
     for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(element)) {
-        if (element->hasTagName(aTag)) {
-            HTMLAnchorElement* anchor = static_cast<HTMLAnchorElement*>(element);
+        if (isHTMLAnchorElement(element)) {
+            HTMLAnchorElement* anchor = toHTMLAnchorElement(element);
             if (rootNode()->document()->inQuirksMode()) {
                 // Quirks mode, case insensitive comparison of names.
                 if (equalIgnoringCase(anchor->name(), name))
@@ -345,7 +348,7 @@
     return 0;
 }
 
-Node* TreeScope::focusedNode()
+Element* TreeScope::adjustedFocusedElement()
 {
     Document* document = rootNode()->document();
     Node* node = document->focusedNode();
@@ -361,7 +364,7 @@
         else if (walker.isVisitingInsertionPointInReprojection())
             targetStack.append(targetStack.last());
         if (node == rootNode())
-            return targetStack.last();
+            return toElement(targetStack.last());
         if (node->isShadowRoot()) {
             ASSERT(!targetStack.isEmpty());
             targetStack.removeLast();
@@ -492,4 +495,21 @@
     return false;
 }
 
+Element* TreeScope::getElementByAccessKey(const String& key) const
+{
+    if (key.isEmpty())
+        return 0;
+    Element* result = 0;
+    Node* root = rootNode();
+    for (Element* element = ElementTraversal::firstWithin(root); element; element = ElementTraversal::next(element, root)) {
+        if (element->fastGetAttribute(accesskeyAttr) == key)
+            result = element;
+        for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
+            if (Element* shadowResult = shadowRoot->getElementByAccessKey(key))
+                result = shadowResult;
+        }
+    }
+    return result;
+}
+
 } // namespace WebCore
diff --git a/Source/core/dom/TreeScope.h b/Source/core/dom/TreeScope.h
index 18eb059..989638c 100644
--- a/Source/core/dom/TreeScope.h
+++ b/Source/core/dom/TreeScope.h
@@ -28,8 +28,8 @@
 #define TreeScope_h
 
 #include "core/dom/DocumentOrderedMap.h"
-#include <wtf/Forward.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/Forward.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
     TreeScope* parentTreeScope() const { return m_parentTreeScope; }
     void setParentTreeScope(TreeScope*);
 
-    Node* focusedNode();
+    Element* adjustedFocusedElement();
     Element* getElementById(const AtomicString&) const;
     bool hasElementWithId(AtomicStringImpl* id) const;
     bool containsMultipleElementsWithId(const AtomicString& id) const;
@@ -130,6 +130,8 @@
     bool isInclusiveAncestorOf(const TreeScope*) const;
     unsigned short comparePosition(const TreeScope*) const;
 
+    Element* getElementByAccessKey(const String& key) const;
+
 protected:
     TreeScope(ContainerNode*, Document*);
     TreeScope(Document*);
diff --git a/Source/core/dom/TreeWalker.cpp b/Source/core/dom/TreeWalker.cpp
index 8ed9d78..626a4fc 100644
--- a/Source/core/dom/TreeWalker.cpp
+++ b/Source/core/dom/TreeWalker.cpp
@@ -30,7 +30,7 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeFilter.h"
 #include "core/dom/NodeTraversal.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
@@ -44,7 +44,7 @@
 void TreeWalker::setCurrentNode(PassRefPtr<Node> node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     m_current = node;
diff --git a/Source/core/dom/TreeWalker.h b/Source/core/dom/TreeWalker.h
index 0ab3976..9fcc954 100644
--- a/Source/core/dom/TreeWalker.h
+++ b/Source/core/dom/TreeWalker.h
@@ -28,8 +28,8 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/NodeFilter.h"
 #include "core/dom/Traversal.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/UserGestureIndicator.cpp b/Source/core/dom/UserGestureIndicator.cpp
index c4e891f..dc98aed 100644
--- a/Source/core/dom/UserGestureIndicator.cpp
+++ b/Source/core/dom/UserGestureIndicator.cpp
@@ -25,19 +25,36 @@
 
 #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 { return m_consumableGestures > 0; }
+    virtual bool hasGestures() const OVERRIDE
+    {
+        if (m_consumableGestures < 1 || WTF::currentTime() - m_timestamp > (m_outOfProcess ? userGestureOutOfProcessTimeout : userGestureTimeout))
+            return false;
+        return true;
+    }
 
-    void addGesture() { m_consumableGestures++; }
+    void addGesture()
+    {
+        m_consumableGestures++;
+        m_timestamp = WTF::currentTime();
+    }
+
     bool consumeGesture()
     {
         if (!m_consumableGestures)
@@ -46,13 +63,25 @@
         return true;
     }
 
+    virtual void setOutOfProcess() OVERRIDE
+    {
+        if (WTF::currentTime() - m_timestamp > userGestureTimeout)
+            return;
+        if (hasGestures())
+            m_outOfProcess = true;
+    }
+
 private:
     GestureToken()
-        : m_consumableGestures(0)
+        : m_consumableGestures(0),
+        m_timestamp(0),
+        m_outOfProcess(false)
     {
     }
 
     size_t m_consumableGestures;
+    double m_timestamp;
+    bool m_outOfProcess;
 };
 
 }
diff --git a/Source/core/dom/UserGestureIndicator.h b/Source/core/dom/UserGestureIndicator.h
index 4c29acb..7eaaf05 100644
--- a/Source/core/dom/UserGestureIndicator.h
+++ b/Source/core/dom/UserGestureIndicator.h
@@ -26,9 +26,9 @@
 #ifndef UserGestureIndicator_h
 #define UserGestureIndicator_h
 
-#include <wtf/Noncopyable.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
@@ -45,6 +45,7 @@
 public:
     virtual ~UserGestureToken() { }
     virtual bool hasGestures() const = 0;
+    virtual void setOutOfProcess() = 0;
 };
 
 class UserGestureIndicatorDisabler {
diff --git a/Source/core/dom/UserTypingGestureIndicator.cpp b/Source/core/dom/UserTypingGestureIndicator.cpp
index 5b6684e..1200868 100644
--- a/Source/core/dom/UserTypingGestureIndicator.cpp
+++ b/Source/core/dom/UserTypingGestureIndicator.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Node.h"
 #include "core/page/Frame.h"
-#include <wtf/StdLibExtras.h>
+#include "wtf/StdLibExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/UserTypingGestureIndicator.h b/Source/core/dom/UserTypingGestureIndicator.h
index 21f4c7e..149c430 100644
--- a/Source/core/dom/UserTypingGestureIndicator.h
+++ b/Source/core/dom/UserTypingGestureIndicator.h
@@ -26,8 +26,8 @@
 #ifndef UserTypingGestureIndicator_h
 #define UserTypingGestureIndicator_h
 
-#include <wtf/Noncopyable.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/ViewportArguments.cpp b/Source/core/dom/ViewportArguments.cpp
index e0b346d..d6a56f9 100644
--- a/Source/core/dom/ViewportArguments.cpp
+++ b/Source/core/dom/ViewportArguments.cpp
@@ -114,10 +114,10 @@
         ASSERT(resultMaxHeight != ViewportArguments::ValueDeviceHeight);
 
         if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != ViewportArguments::ValueAuto)
-            resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(resultMaxWidth, deviceSize.width(), min), max);
+            resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(resultMaxWidth, initialViewportSize.width(), min), max);
 
         if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight != ViewportArguments::ValueAuto)
-            resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto(resultMaxHeight, deviceSize.height(), min), max);
+            resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto(resultMaxHeight, initialViewportSize.height(), min), max);
 
         if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != ViewportArguments::ValueAuto)
             resultMaxZoom = max(resultMinZoom, resultMaxZoom);
@@ -125,25 +125,20 @@
         if (resultZoom != ViewportArguments::ValueAuto)
             resultZoom = compareIgnoringAuto(resultMinZoom, compareIgnoringAuto(resultMaxZoom, resultZoom, min), max);
 
-        if (resultWidth == ViewportArguments::ValueAuto && resultZoom == ViewportArguments::ValueAuto)
-            resultWidth = deviceSize.width();
+        if (resultWidth == ViewportArguments::ValueAuto && (resultHeight == ViewportArguments::ValueAuto || !initialViewportSize.height()))
+            resultWidth = initialViewportSize.width();
 
-        if (resultWidth == ViewportArguments::ValueAuto && resultHeight == ViewportArguments::ValueAuto)
-            resultWidth = deviceSize.width() / resultZoom;
-
-        if (resultWidth == ViewportArguments::ValueAuto)
-            resultWidth = resultHeight * deviceSize.width() / deviceSize.height();
-
-        if (resultHeight == ViewportArguments::ValueAuto)
-            resultHeight = resultWidth * deviceSize.height() / deviceSize.width();
-
-        if (resultZoom != ViewportArguments::ValueAuto || resultMaxZoom != ViewportArguments::ValueAuto) {
-            resultWidth = compareIgnoringAuto(resultWidth, deviceSize.width() / compareIgnoringAuto(resultZoom, resultMaxZoom, min), max);
-            resultHeight = compareIgnoringAuto(resultHeight, deviceSize.height() / compareIgnoringAuto(resultZoom, resultMaxZoom, min), max);
+        if (resultWidth == ViewportArguments::ValueAuto) {
+            ASSERT(initialViewportSize.height()); // If height is 0, resultWidth should be resolved above.
+            resultWidth = resultHeight * initialViewportSize.width() / initialViewportSize.height();
         }
 
-        resultWidth = max<float>(1, resultWidth);
-        resultHeight = max<float>(1, resultHeight);
+        if (resultHeight == ViewportArguments::ValueAuto) {
+            if (!initialViewportSize.width())
+                resultHeight = initialViewportSize.height();
+            else
+                resultHeight = resultWidth * initialViewportSize.height() / initialViewportSize.width();
+        }
     }
 
     if (type != ViewportArguments::CSSDeviceAdaptation && type != ViewportArguments::Implicit) {
@@ -175,9 +170,9 @@
     result.initialScale = resultZoom;
     if (resultZoom == ViewportArguments::ValueAuto) {
         result.initialScale = initialViewportSize.width() / defaultWidth;
-        if (resultWidth != ViewportArguments::ValueAuto)
+        if (resultWidth != ViewportArguments::ValueAuto && resultWidth > 0)
             result.initialScale = initialViewportSize.width() / resultWidth;
-        if (resultHeight != ViewportArguments::ValueAuto) {
+        if (resultHeight != ViewportArguments::ValueAuto && resultHeight > 0) {
             // if 'auto', the initial-scale will be negative here and thus ignored.
             result.initialScale = max<float>(result.initialScale, initialViewportSize.height() / resultHeight);
         }
diff --git a/Source/core/dom/ViewportArguments.h b/Source/core/dom/ViewportArguments.h
index a311af6..925604a 100644
--- a/Source/core/dom/ViewportArguments.h
+++ b/Source/core/dom/ViewportArguments.h
@@ -30,7 +30,7 @@
 
 #include "core/page/PageScaleConstraints.h"
 #include "core/platform/graphics/FloatSize.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/VisitedLinkState.cpp b/Source/core/dom/VisitedLinkState.cpp
index d6236d4..77e8fd1 100644
--- a/Source/core/dom/VisitedLinkState.cpp
+++ b/Source/core/dom/VisitedLinkState.cpp
@@ -50,16 +50,16 @@
 
 inline static LinkHash linkHashForElement(Document* document, Element* element)
 {
-    if (element->hasTagName(aTag))
-        return static_cast<HTMLAnchorElement*>(element)->visitedLinkHash();
+    if (isHTMLAnchorElement(element))
+        return toHTMLAnchorElement(element)->visitedLinkHash();
     return visitedLinkHash(document->baseURL(), linkAttribute(element));
 }
 
 inline static LinkHash linkHashForElementWithAttribute(Document* document, Element* element, const AtomicString& attribute)
 {
     ASSERT(linkAttribute(element) == attribute);
-    if (element->hasTagName(aTag))
-        return static_cast<HTMLAnchorElement*>(element)->visitedLinkHash();
+    if (isHTMLAnchorElement(element))
+        return toHTMLAnchorElement(element)->visitedLinkHash();
     return visitedLinkHash(document->baseURL(), attribute);
 }
 
diff --git a/Source/core/dom/WebCoreMemoryInstrumentation.h b/Source/core/dom/WebCoreMemoryInstrumentation.h
index 4fe69b2..dc0e49e 100644
--- a/Source/core/dom/WebCoreMemoryInstrumentation.h
+++ b/Source/core/dom/WebCoreMemoryInstrumentation.h
@@ -32,7 +32,7 @@
 #define WebCoreMemoryInstrumentation_h
 
 #include "core/platform/PlatformMemoryInstrumentation.h"
-#include <wtf/MemoryInstrumentationString.h>
+#include "wtf/MemoryInstrumentationString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/WebKitNamedFlow.idl b/Source/core/dom/WebKitNamedFlow.idl
index 5a008bd..68f2858 100644
--- a/Source/core/dom/WebKitNamedFlow.idl
+++ b/Source/core/dom/WebKitNamedFlow.idl
@@ -30,23 +30,13 @@
 [
     NoInterfaceObject,
     EnabledAtRuntime=cssRegions,
-    EventTarget,
     ImplementedAs=NamedFlow,
     GenerateIsReachable=ownerNode
-] interface WebKitNamedFlow {
+] interface WebKitNamedFlow : EventTarget {
     readonly attribute DOMString name;
     readonly attribute boolean overset;
     readonly attribute long firstEmptyRegionIndex;
     NodeList getRegionsByContent(Node contentNode);
     NodeList getRegions();
     NodeList getContent();
-
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event event);
 };
diff --git a/Source/core/dom/WindowEventContext.h b/Source/core/dom/WindowEventContext.h
index a19e04d..5d0aa7c 100644
--- a/Source/core/dom/WindowEventContext.h
+++ b/Source/core/dom/WindowEventContext.h
@@ -27,7 +27,7 @@
 #ifndef WindowEventContext_h
 #define WindowEventContext_h
 
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/default/PlatformMessagePortChannel.h b/Source/core/dom/default/PlatformMessagePortChannel.h
index 1a087af..f8dffd0 100644
--- a/Source/core/dom/default/PlatformMessagePortChannel.h
+++ b/Source/core/dom/default/PlatformMessagePortChannel.h
@@ -33,9 +33,9 @@
 
 #include "core/dom/MessagePortChannel.h"
 
-#include <wtf/MessageQueue.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include "wtf/MessageQueue.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/Threading.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h b/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h
index 08a95c8..f4b8373 100644
--- a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h
+++ b/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h
@@ -34,8 +34,8 @@
 
 #include "core/dom/MessagePortChannel.h"
 #include "public/platform/WebMessagePortChannelClient.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/Threading.h"
 
 namespace WebKit {
 class WebMessagePortChannel;
diff --git a/Source/core/dom/shadow/ContentDistributor.cpp b/Source/core/dom/shadow/ContentDistributor.cpp
index b3daf77..5b3a68b 100644
--- a/Source/core/dom/shadow/ContentDistributor.cpp
+++ b/Source/core/dom/shadow/ContentDistributor.cpp
@@ -436,7 +436,7 @@
 {
     for (NodeInsertionPointMap::iterator i = m_nodeToInsertionPoint.begin(); i != m_nodeToInsertionPoint.end(); ++i) {
         if (i->value == insertionPoint)
-            const_cast<Node*>(i->key)->setNeedsStyleRecalc(InlineStyleChange);
+            const_cast<Node*>(i->key)->setNeedsStyleRecalc(LocalStyleChange);
     }
 }
 
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
index 52165d6..42152f7 100644
--- a/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -108,7 +108,7 @@
 
 PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionCode& ec)
 {
-    ec = DATA_CLONE_ERR;
+    ec = DataCloneError;
     return 0;
 }
 
@@ -120,7 +120,7 @@
 void ShadowRoot::setInnerHTML(const String& markup, ExceptionCode& ec)
 {
     if (isOrphan()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -158,17 +158,30 @@
         return;
     }
 
-    // When we're set to lazyAttach we'll have a FullStyleChange and we'll need
+    // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll need
     // to promote the change to a Force for all our descendants so they get a
     // recalc and will attach.
-    if (styleChangeType() == FullStyleChange)
+    if (styleChangeType() == SubtreeStyleChange)
         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()) {
-        if (child->isElementNode())
-            toElement(child)->recalcStyle(change);
-        else if (child->isTextNode())
-            toText(child)->recalcTextStyle(change);
+        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() && shouldRecalcStyle(change, child)) {
+            didReattach = toElement(child)->recalcStyle(change);
+        }
+
+        forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyWhitespaceSibling;
     }
 
     styleResolver->popParentShadowRoot(this);
diff --git a/Source/core/dom/shadow/ShadowRoot.h b/Source/core/dom/shadow/ShadowRoot.h
index 203e2b6..9d17cad 100644
--- a/Source/core/dom/shadow/ShadowRoot.h
+++ b/Source/core/dom/shadow/ShadowRoot.h
@@ -96,6 +96,7 @@
     ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
 
     PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
+    PassRefPtr<Node> cloneNode(ExceptionCode& ec) { return cloneNode(true, ec); }
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
 
@@ -126,8 +127,8 @@
 
 inline Element* ShadowRoot::activeElement() const
 {
-    if (Node* node = treeScope()->focusedNode())
-        return node->isElementNode() ? toElement(node) : 0;
+    if (Element* element = treeScope()->adjustedFocusedElement())
+        return element;
     return 0;
 }
 
diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
index d8810b1..2d257d5 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -44,8 +44,8 @@
 #include "core/editing/htmlediting.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderText.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index 17d3111..c95f16a 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -393,11 +393,12 @@
     applyCommandToComposite(RemoveNodePreservingChildrenCommand::create(node, shouldAssumeContentIsAlwaysEditable));
 }
 
-void CompositeEditCommand::removeNodeAndPruneAncestors(PassRefPtr<Node> node)
+void CompositeEditCommand::removeNodeAndPruneAncestors(PassRefPtr<Node> node, Node* excludeNode)
 {
+    ASSERT(node.get() != excludeNode);
     RefPtr<ContainerNode> parent = node->parentNode();
     removeNode(node);
-    prune(parent.release());
+    prune(parent.release(), excludeNode);
 }
 
 void CompositeEditCommand::moveRemainingSiblingsToNewParent(Node* node, Node* pastLastNodeToMove, PassRefPtr<Element> prpNewParent)
@@ -436,9 +437,9 @@
     return command->spanElement();
 }
 
-void CompositeEditCommand::prune(PassRefPtr<Node> node)
+void CompositeEditCommand::prune(PassRefPtr<Node> node, Node* excludeNode)
 {
-    if (RefPtr<Node> highestNodeToRemove = highestNodeToRemoveInPruning(node.get()))
+    if (RefPtr<Node> highestNodeToRemove = highestNodeToRemoveInPruning(node.get(), excludeNode))
         removeNode(highestNodeToRemove.release());
 }
 
@@ -1044,13 +1045,14 @@
 void CompositeEditCommand::cleanupAfterDeletion(VisiblePosition destination)
 {
     VisiblePosition caretAfterDelete = endingSelection().visibleStart();
+    Node* destinationNode = destination.deepEquivalent().anchorNode();
     if (caretAfterDelete != destination && isStartOfParagraph(caretAfterDelete) && isEndOfParagraph(caretAfterDelete)) {
         // Note: We want the rightmost candidate.
         Position position = caretAfterDelete.deepEquivalent().downstream();
         Node* node = position.deprecatedNode();
         // Normally deletion will leave a br as a placeholder.
         if (node->hasTagName(brTag))
-            removeNodeAndPruneAncestors(node);
+            removeNodeAndPruneAncestors(node, destinationNode);
         // If the selection to move was empty and in an empty block that 
         // doesn't require a placeholder to prop itself open (like a bordered
         // div or an li), remove it during the move (the list removal code
@@ -1059,17 +1061,17 @@
             // If caret position after deletion and destination position coincides,
             // node should not be removed.
             if (!position.rendersInDifferentPosition(destination.deepEquivalent())) {
-                prune(node);
+                prune(node, destinationNode);
                 return;
             }
-            removeNodeAndPruneAncestors(node);
+            removeNodeAndPruneAncestors(node, destinationNode);
         }
         else if (lineBreakExistsAtPosition(position)) {
             // There is a preserved '\n' at caretAfterDelete.
             // We can safely assume this is a text node.
             Text* textNode = toText(node);
             if (textNode->length() == 1)
-                removeNodeAndPruneAncestors(node);
+                removeNodeAndPruneAncestors(node, destinationNode);
             else
                 deleteTextFromNode(textNode, position.deprecatedEditingOffset(), 1);
         }
diff --git a/Source/core/editing/CompositeEditCommand.h b/Source/core/editing/CompositeEditCommand.h
index 7c48bd5..35fe4fb 100644
--- a/Source/core/editing/CompositeEditCommand.h
+++ b/Source/core/editing/CompositeEditCommand.h
@@ -29,7 +29,7 @@
 #include "CSSPropertyNames.h"
 #include "core/editing/EditCommand.h"
 #include "core/editing/UndoStep.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -124,10 +124,10 @@
     virtual void removeNode(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable);
     HTMLElement* replaceElementWithSpanPreservingChildrenAndAttributes(PassRefPtr<HTMLElement>);
     void removeNodePreservingChildren(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable);
-    void removeNodeAndPruneAncestors(PassRefPtr<Node>);
+    void removeNodeAndPruneAncestors(PassRefPtr<Node>, Node* excludeNode = 0);
     void moveRemainingSiblingsToNewParent(Node*, Node* pastLastNodeToMove, PassRefPtr<Element> prpNewParent);
     void updatePositionForNodeRemovalPreservingChildren(Position&, Node*);
-    void prune(PassRefPtr<Node>);
+    void prune(PassRefPtr<Node>, Node* excludeNode = 0);
     void replaceTextInNode(PassRefPtr<Text>, unsigned offset, unsigned count, const String& replacementText);
     Position replaceSelectedTextInNode(const String&);
     void replaceTextInNodePreservingMarkers(PassRefPtr<Text>, unsigned offset, unsigned count, const String& replacementText);
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index a01bb00..9ede8f3 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -36,6 +36,7 @@
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/page/Frame.h"
 #include "core/rendering/RenderTableCell.h"
 
@@ -269,6 +270,12 @@
     m_endBlock = enclosingNodeOfType(m_upstreamEnd.parentAnchoredEquivalent(), &isBlock, CanCrossEditingBoundary);
 }
 
+// We don't want to inherit style from an element which can't have contents.
+static bool shouldNotInheritStyleFrom(const Node& node)
+{
+    return !node.canContainRangeEndPoint();
+}
+
 void DeleteSelectionCommand::saveTypingStyleState()
 {
     // A common case is deleting characters that are all from the same text node. In 
@@ -281,6 +288,9 @@
     if (m_upstreamStart.deprecatedNode() == m_downstreamEnd.deprecatedNode() && m_upstreamStart.deprecatedNode()->isTextNode())
         return;
 
+    if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode()))
+        return;
+
     // Figure out the typing style in effect before the delete is done.
     m_typingStyle = EditingStyle::create(m_selectionToDelete.start());
     m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDelete.start()));
@@ -443,7 +453,7 @@
     makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss();
 
     // Never remove the start block unless it's a table, in which case we won't merge content in.
-    if (startNode == m_startBlock && startOffset == 0 && canHaveChildrenForEditing(startNode) && !startNode->hasTagName(tableTag)) {
+    if (startNode->isSameNode(m_startBlock.get()) && !startOffset && canHaveChildrenForEditing(startNode) && !isHTMLTableElement(startNode)) {
         startOffset = 0;
         startNode = NodeTraversal::next(startNode);
         if (!startNode)
diff --git a/Source/core/editing/EditCommand.h b/Source/core/editing/EditCommand.h
index d91c2cc..447ccc2 100644
--- a/Source/core/editing/EditCommand.h
+++ b/Source/core/editing/EditCommand.h
@@ -30,7 +30,7 @@
 #include "core/editing/VisibleSelection.h"
 
 #ifndef NDEBUG
-#include <wtf/HashSet.h>
+#include "wtf/HashSet.h"
 #endif
 
 namespace WebCore {
diff --git a/Source/core/editing/EditingBehavior.h b/Source/core/editing/EditingBehavior.h
index 79baf2b..262960b 100644
--- a/Source/core/editing/EditingBehavior.h
+++ b/Source/core/editing/EditingBehavior.h
@@ -41,7 +41,7 @@
     // content on Mac.
     bool shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom() const
     {
-        return m_type != EditingWindowsBehavior && m_type != EditingAndroidBehavior;
+        return m_type != EditingWindowsBehavior && m_type != EditingAndroidBehavior && m_type != EditingUnixBehavior;
     }
 
     // On Windows, selections should always be considered as directional, regardless if it is
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index 080a3f5..aab6855 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -1503,7 +1503,7 @@
     int wordLength = word.length();
     int misspellingLocation = -1;
     int misspellingLength = 0;
-    textChecker()->checkSpellingOfString(word.bloatedCharacters(), wordLength, &misspellingLocation, &misspellingLength);
+    textChecker()->checkSpellingOfString(word, &misspellingLocation, &misspellingLength);
 
     return misspellingLength == wordLength ? word : String();
 }
@@ -1696,8 +1696,7 @@
     }
 
     Vector<TextCheckingResult> results;
-    checkTextOfParagraph(textChecker(), paragraphToCheck.textCharacters(), paragraphToCheck.textLength(),
-        resolveTextCheckingTypeMask(textCheckingOptions), results);
+    checkTextOfParagraph(textChecker(), paragraphToCheck.text(), resolveTextCheckingTypeMask(textCheckingOptions), results);
     markAndReplaceFor(request, results);
 }
 
@@ -1724,9 +1723,9 @@
             Position caretPosition = m_frame->selection()->end();
             selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPTION);
             restoreSelectionAfterChange = true;
-            if (selectionOffset > 0 && (selectionOffset > paragraph.textLength() || paragraph.textCharAt(selectionOffset - 1) == newlineCharacter))
+            if (selectionOffset > 0 && (static_cast<unsigned>(selectionOffset) > paragraph.text().length() || paragraph.textCharAt(selectionOffset - 1) == newlineCharacter))
                 adjustSelectionForParagraphBoundaries = true;
-            if (selectionOffset > 0 && selectionOffset <= paragraph.textLength() && isAmbiguousBoundaryCharacter(paragraph.textCharAt(selectionOffset - 1)))
+            if (selectionOffset > 0 && static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && isAmbiguousBoundaryCharacter(paragraph.textCharAt(selectionOffset - 1)))
                 ambiguousBoundaryOffset = selectionOffset - 1;
         }
     }
@@ -1923,7 +1922,7 @@
     if (!range)
         return false;
 
-    return m_frame->selection()->setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, false);
+    return m_frame->selection()->setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, true);
 }
 
 void Editor::transpose()
diff --git a/Source/core/editing/EditorCommand.cpp b/Source/core/editing/EditorCommand.cpp
index 95ee56b..ce72ca2 100644
--- a/Source/core/editing/EditorCommand.cpp
+++ b/Source/core/editing/EditorCommand.cpp
@@ -60,7 +60,7 @@
 #include "core/platform/Scrollbar.h"
 #include "core/platform/Sound.h"
 #include "core/rendering/RenderBox.h"
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index 44df81e..4ff8d91 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -604,13 +604,11 @@
     return positionAfterCurrentWord;
 }
 
-#if ENABLE(USERSELECT_ALL)
 static void adjustPositionForUserSelectAll(VisiblePosition& pos, bool isForward)
 {
     if (Node* rootUserSelectAll = Position::rootUserSelectAllForNode(pos.deepEquivalent().anchorNode()))
         pos = isForward ? positionAfterNode(rootUserSelectAll).downstream(CanCrossEditingBoundary) : positionBeforeNode(rootUserSelectAll).upstream(CanCrossEditingBoundary);
 }
-#endif
 
 VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity)
 {
@@ -650,9 +648,7 @@
         pos = modifyExtendingForward(granularity);
         break;
     }
-#if ENABLE(USERSELECT_ALL)
     adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR);
-#endif
     return pos;
 }
 
@@ -692,9 +688,7 @@
             pos = endOfDocument(pos);
         break;
     }
-#if ENABLE(USERSELECT_ALL)
      adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR);
-#endif
     return pos;
 }
 
@@ -817,9 +811,7 @@
         pos = modifyExtendingBackward(granularity);
         break;
     }
-#if ENABLE(USERSELECT_ALL)
     adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == LTR));
-#endif
     return pos;
 }
        
@@ -864,9 +856,7 @@
             pos = startOfDocument(pos);
         break;
     }
-#if ENABLE(USERSELECT_ALL)
     adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == LTR));
-#endif
     return pos;
 }
 
@@ -1204,6 +1194,7 @@
         view->clearSelection();
 
     setSelection(VisibleSelection(), CloseTyping | ClearTypingStyle | DoNotUpdateAppearance);
+    m_previousCaretNode.clear();
 }
 
 void FrameSelection::setStart(const VisiblePosition &pos, EUserTriggered trigger)
@@ -1915,29 +1906,29 @@
 
     bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
     if (caretBrowsing) {
-        if (Node* anchor = enclosingAnchorElement(base())) {
-            m_frame->page()->focusController()->setFocusedNode(anchor, m_frame);
+        if (Element* anchor = enclosingAnchorElement(base())) {
+            m_frame->page()->focusController()->setFocusedElement(anchor, m_frame);
             return;
         }
     }
 
-    if (Node* target = rootEditableElement()) {
+    if (Element* target = rootEditableElement()) {
         // Walk up the DOM tree to search for a node to focus. 
         while (target) {
             // We don't want to set focus on a subframe when selecting in a parent frame,
             // so add the !isFrameElement check here. There's probably a better way to make this
             // work in the long term, but this is the safest fix at this time.
             if (target->isMouseFocusable() && !isFrameElement(target)) {
-                m_frame->page()->focusController()->setFocusedNode(target, m_frame);
+                m_frame->page()->focusController()->setFocusedElement(target, m_frame);
                 return;
             }
-            target = target->parentOrShadowHostNode();
+            target = target->parentOrShadowHostElement();
         }
-        m_frame->document()->setFocusedNode(0);
+        m_frame->document()->setFocusedElement(0);
     }
 
     if (caretBrowsing)
-        m_frame->page()->focusController()->setFocusedNode(0, m_frame);
+        m_frame->page()->focusController()->setFocusedElement(0, m_frame);
 }
 
 void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const
diff --git a/Source/core/editing/FrameSelection.h b/Source/core/editing/FrameSelection.h
index 655be75..95fdf72 100644
--- a/Source/core/editing/FrameSelection.h
+++ b/Source/core/editing/FrameSelection.h
@@ -33,7 +33,7 @@
 #include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/ScrollBehavior.h"
-#include <wtf/Noncopyable.h>
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/HTMLInterchange.h b/Source/core/editing/HTMLInterchange.h
index 4029ea2..c933623 100644
--- a/Source/core/editing/HTMLInterchange.h
+++ b/Source/core/editing/HTMLInterchange.h
@@ -26,7 +26,7 @@
 #ifndef HTMLInterchange_h
 #define HTMLInterchange_h
 
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/InsertLineBreakCommand.cpp b/Source/core/editing/InsertLineBreakCommand.cpp
index b02dbd7..9a4e722 100644
--- a/Source/core/editing/InsertLineBreakCommand.cpp
+++ b/Source/core/editing/InsertLineBreakCommand.cpp
@@ -35,6 +35,7 @@
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/page/Frame.h"
 #include "core/rendering/RenderObject.h"
 
@@ -112,10 +113,10 @@
         nodeToInsert = document()->createTextNode("\n");
     
     // FIXME: Need to merge text nodes when inserting just after or before text.
-    
+
     if (isEndOfParagraph(caret) && !lineBreakExistsAtVisiblePosition(caret)) {
-        bool needExtraLineBreak = !pos.deprecatedNode()->hasTagName(hrTag) && !pos.deprecatedNode()->hasTagName(tableTag);
-        
+        bool needExtraLineBreak = !pos.deprecatedNode()->hasTagName(hrTag) && !isHTMLTableElement(pos.deprecatedNode());
+
         insertNodeAt(nodeToInsert.get(), pos);
         
         if (needExtraLineBreak)
diff --git a/Source/core/editing/InsertParagraphSeparatorCommand.cpp b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
index cbfb99f..3eca035 100644
--- a/Source/core/editing/InsertParagraphSeparatorCommand.cpp
+++ b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
@@ -316,6 +316,15 @@
     // before we walk the DOM tree.
     insertionPosition = positionOutsideTabSpan(VisiblePosition(insertionPosition).deepEquivalent());
 
+    // If the returned position lies either at the end or at the start of an element that is ignored by editing
+    // we should move to its upstream or downstream position.
+    if (editingIgnoresContent(insertionPosition.deprecatedNode())) {
+        if (insertionPosition.atLastEditingPositionForNode())
+            insertionPosition = insertionPosition.downstream();
+        else if (insertionPosition.atFirstEditingPositionForNode())
+            insertionPosition = insertionPosition.upstream();
+    }
+
     // Make sure we do not cause a rendered space to become unrendered.
     // FIXME: We need the affinity for pos, but pos.downstream() does not give it
     Position leadingWhitespace = insertionPosition.leadingWhitespacePosition(VP_DEFAULT_AFFINITY);
diff --git a/Source/core/editing/MarkupAccumulator.h b/Source/core/editing/MarkupAccumulator.h
index ca638cc..fd0fc36 100644
--- a/Source/core/editing/MarkupAccumulator.h
+++ b/Source/core/editing/MarkupAccumulator.h
@@ -27,9 +27,9 @@
 #define MarkupAccumulator_h
 
 #include "core/editing/markup.h"
-#include <wtf/HashMap.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/Vector.h>
+#include "wtf/HashMap.h"
+#include "wtf/Vector.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/RemoveCSSPropertyCommand.cpp b/Source/core/editing/RemoveCSSPropertyCommand.cpp
index d94cf8a..d5a07b3 100644
--- a/Source/core/editing/RemoveCSSPropertyCommand.cpp
+++ b/Source/core/editing/RemoveCSSPropertyCommand.cpp
@@ -30,7 +30,7 @@
 #include "core/css/StylePropertySet.h"
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/RemoveNodeCommand.cpp b/Source/core/editing/RemoveNodeCommand.cpp
index ad2726a..ca456a7 100644
--- a/Source/core/editing/RemoveNodeCommand.cpp
+++ b/Source/core/editing/RemoveNodeCommand.cpp
@@ -28,7 +28,7 @@
 
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Node.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/RemoveNodePreservingChildrenCommand.cpp b/Source/core/editing/RemoveNodePreservingChildrenCommand.cpp
index 79587b5..23e8737 100644
--- a/Source/core/editing/RemoveNodePreservingChildrenCommand.cpp
+++ b/Source/core/editing/RemoveNodePreservingChildrenCommand.cpp
@@ -27,7 +27,7 @@
 #include "core/editing/RemoveNodePreservingChildrenCommand.h"
 
 #include "core/dom/Node.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
index 0fa8615..df7d37a 100644
--- a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
+++ b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
@@ -35,7 +35,7 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
 
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp
index 0185e5e..0ef13b3 100644
--- a/Source/core/editing/ReplaceSelectionCommand.cpp
+++ b/Source/core/editing/ReplaceSelectionCommand.cpp
@@ -51,11 +51,12 @@
 #include "core/editing/markup.h"
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLTitleElement.h"
 #include "core/page/Frame.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderText.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/Vector.h>
+#include "wtf/StdLibExtras.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -500,7 +501,7 @@
 
             // If Mail wraps the fragment with a Paste as Quotation blockquote, or if you're pasting into a quoted region,
             // styles from blockquoteNode are allowed to override those from the source document, see <rdar://problem/4930986> and <rdar://problem/5089327>.
-            Node* blockquoteNode = isMailPasteAsQuotationNode(context) ? context : enclosingNodeOfType(firstPositionInNode(context), isMailBlockquote, CanCrossEditingBoundary);
+            Node* blockquoteNode = !context || isMailPasteAsQuotationNode(context) ? context : enclosingNodeOfType(firstPositionInNode(context), isMailBlockquote, CanCrossEditingBoundary);
             if (blockquoteNode)
                 newInlineStyle->removeStyleFromRulesAndContext(element, document()->documentElement());
 
@@ -526,7 +527,7 @@
             continue;
         }
 
-        if (element->parentNode()->rendererIsRichlyEditable())
+        if (element->parentNode() && element->parentNode()->rendererIsRichlyEditable())
             removeNodeAttribute(element, contenteditableAttr);
 
         // WebKit used to not add display: inline and float: none on copy.
@@ -703,7 +704,7 @@
             || node->hasTagName(linkTag)
             || node->hasTagName(metaTag)
             || node->hasTagName(styleTag)
-            || node->hasTagName(titleTag)) {
+            || isHTMLTitleElement(node)) {
             next = NodeTraversal::nextSkippingChildren(node);
             fragment.removeNode(node);
         } else
diff --git a/Source/core/editing/SetNodeAttributeCommand.cpp b/Source/core/editing/SetNodeAttributeCommand.cpp
index 8152603..bb97c12 100644
--- a/Source/core/editing/SetNodeAttributeCommand.cpp
+++ b/Source/core/editing/SetNodeAttributeCommand.cpp
@@ -27,7 +27,7 @@
 #include "core/editing/SetNodeAttributeCommand.h"
 
 #include "core/dom/Element.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/SimplifyMarkupCommand.cpp b/Source/core/editing/SimplifyMarkupCommand.cpp
index ba0cb46..2692b09 100644
--- a/Source/core/editing/SimplifyMarkupCommand.cpp
+++ b/Source/core/editing/SimplifyMarkupCommand.cpp
@@ -53,6 +53,8 @@
             continue;
         
         Node* startingNode = node->parentNode();
+        if (!startingNode)
+            continue;
         RenderStyle* startingStyle = startingNode->renderStyle();
         if (!startingStyle)
             continue;
diff --git a/Source/core/editing/SmartReplace.h b/Source/core/editing/SmartReplace.h
index b072e58..abce578 100644
--- a/Source/core/editing/SmartReplace.h
+++ b/Source/core/editing/SmartReplace.h
@@ -29,7 +29,7 @@
 #ifndef SmartReplace_h
 #define SmartReplace_h
 
-#include <wtf/unicode/Unicode.h>
+#include "wtf/unicode/Unicode.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/SmartReplaceICU.cpp b/Source/core/editing/SmartReplaceICU.cpp
index fe46581..329ae4c 100644
--- a/Source/core/editing/SmartReplaceICU.cpp
+++ b/Source/core/editing/SmartReplaceICU.cpp
@@ -31,17 +31,16 @@
 #include "core/editing/SmartReplace.h"
 
 #if !USE(CF)
+#include "wtf/Assertions.h"
+#include "wtf/text/WTFString.h"
 #include <unicode/uset.h>
-#include <wtf/Assertions.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
 static void addAllCodePoints(USet* smartSet, const String& string)
 {
-    const UChar* characters = string.bloatedCharacters();
     for (size_t i = 0; i < string.length(); i++)
-        uset_add(smartSet, characters[i]);
+        uset_add(smartSet, string[i]);
 }
 
 // This is mostly a port of the code in WebCore/editing/SmartReplaceCF.cpp
@@ -55,7 +54,7 @@
         // Whitespace and newline (kCFCharacterSetWhitespaceAndNewline)
         UErrorCode ec = U_ZERO_ERROR;
         String whitespaceAndNewline = ASCIILiteral("[[:WSpace:] [\\u000A\\u000B\\u000C\\u000D\\u0085]]");
-        smartSet = uset_openPattern(whitespaceAndNewline.bloatedCharacters(), whitespaceAndNewline.length(), &ec);
+        smartSet = uset_openPattern(whitespaceAndNewline.charactersWithNullTermination().data(), whitespaceAndNewline.length(), &ec);
         ASSERT(U_SUCCESS(ec));
 
         // CJK ranges
@@ -79,7 +78,7 @@
             // Punctuation (kCFCharacterSetPunctuation)
             UErrorCode ec = U_ZERO_ERROR;
             String punctuationClass = ASCIILiteral("[:P:]");
-            USet* icuPunct = uset_openPattern(punctuationClass.bloatedCharacters(), punctuationClass.length(), &ec);
+            USet* icuPunct = uset_openPattern(punctuationClass.charactersWithNullTermination().data(), punctuationClass.length(), &ec);
             ASSERT(U_SUCCESS(ec));
             uset_addAll(smartSet, icuPunct);
             uset_close(icuPunct);
diff --git a/Source/core/editing/SplitElementCommand.cpp b/Source/core/editing/SplitElementCommand.cpp
index 10e8654..d3e9251 100644
--- a/Source/core/editing/SplitElementCommand.cpp
+++ b/Source/core/editing/SplitElementCommand.cpp
@@ -28,7 +28,7 @@
 
 #include "HTMLNames.h"
 #include "core/dom/Element.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/SplitTextNodeCommand.cpp b/Source/core/editing/SplitTextNodeCommand.cpp
index 34bbf1c..f4263e1 100644
--- a/Source/core/editing/SplitTextNodeCommand.cpp
+++ b/Source/core/editing/SplitTextNodeCommand.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/Text.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/SplitTextNodeContainingElementCommand.cpp b/Source/core/editing/SplitTextNodeContainingElementCommand.cpp
index 4d2a6e6..3bc6922 100644
--- a/Source/core/editing/SplitTextNodeContainingElementCommand.cpp
+++ b/Source/core/editing/SplitTextNodeContainingElementCommand.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/Text.h"
 #include "core/rendering/RenderObject.h"
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/SurroundingText.h b/Source/core/editing/SurroundingText.h
index 6e8713d..03ef289 100644
--- a/Source/core/editing/SurroundingText.h
+++ b/Source/core/editing/SurroundingText.h
@@ -31,7 +31,7 @@
 #ifndef SurroundingText_h
 #define SurroundingText_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/TextCheckingHelper.cpp b/Source/core/editing/TextCheckingHelper.cpp
index 5cd787a..6a62891 100644
--- a/Source/core/editing/TextCheckingHelper.cpp
+++ b/Source/core/editing/TextCheckingHelper.cpp
@@ -49,7 +49,7 @@
         int badGrammarLocation = -1;
         int badGrammarLength = 0;
         Vector<GrammarDetail> badGrammarDetails;
-        client->checkGrammarOfString(text + checkLocation, checkLength, badGrammarDetails, &badGrammarLocation, &badGrammarLength);
+        client->checkGrammarOfString(String(text + checkLocation, checkLength), badGrammarDetails, &badGrammarLocation, &badGrammarLength);
         if (!badGrammarLength)
             break;
         ASSERT(0 <= badGrammarLocation && badGrammarLocation <= checkLength);
@@ -79,7 +79,7 @@
         int wordLength = wordEnd - wordStart;
         int misspellingLocation = -1;
         int misspellingLength = 0;
-        client->checkSpellingOfString(text + start + wordStart, wordLength, &misspellingLocation, &misspellingLength);
+        client->checkSpellingOfString(String(text + start + wordStart, wordLength), &misspellingLocation, &misspellingLength);
         if (0 < misspellingLength) {
             ASSERT(0 <= misspellingLocation && misspellingLocation <= wordLength);
             ASSERT(0 < misspellingLength && misspellingLocation + misspellingLength <= wordLength);
@@ -245,7 +245,7 @@
             
             int misspellingLocation = -1;
             int misspellingLength = 0;
-            m_client->textChecker()->checkSpellingOfString(chars, len, &misspellingLocation, &misspellingLength);
+            m_client->textChecker()->checkSpellingOfString(String(chars, len), &misspellingLocation, &misspellingLength);
 
             // 5490627 shows that there was some code path here where the String constructor below crashes.
             // We don't know exactly what combination of bad input caused this, so we're making this much
@@ -339,7 +339,7 @@
                 
                 Vector<TextCheckingResult> results;
                 TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
-                checkTextOfParagraph(m_client->textChecker(), paragraphString.bloatedCharacters(), paragraphString.length(), checkingTypes, results);
+                checkTextOfParagraph(m_client->textChecker(), paragraphString, checkingTypes, results);
                 
                 for (unsigned i = 0; i < results.size(); i++) {
                     const TextCheckingResult* result = &results[i];
@@ -466,7 +466,7 @@
         Vector<GrammarDetail> grammarDetails;
         int badGrammarPhraseLocation = -1;
         int badGrammarPhraseLength = 0;
-        m_client->textChecker()->checkGrammarOfString(paragraph.textCharacters() + startOffset, paragraph.textLength() - startOffset, grammarDetails, &badGrammarPhraseLocation, &badGrammarPhraseLength);
+        m_client->textChecker()->checkGrammarOfString(paragraph.textSubstring(startOffset), grammarDetails, &badGrammarPhraseLocation, &badGrammarPhraseLength);
         
         if (!badGrammarPhraseLength) {
             ASSERT(badGrammarPhraseLocation == -1);
@@ -532,12 +532,15 @@
     return WebCore::unifiedTextCheckerEnabled(doc->frame());
 }
 
-void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int length,
-                          TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results)
+void checkTextOfParagraph(TextCheckerClient* client, const String& text, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results)
 {
+    Vector<UChar> characters;
+    text.appendTo(characters);
+    unsigned length = text.length();
+
     Vector<TextCheckingResult> spellingResult;
     if (checkingTypes & TextCheckingTypeSpelling)
-        findMisspellings(client, text, 0, length, spellingResult);
+        findMisspellings(client, characters.data(), 0, length, spellingResult);
 
     Vector<TextCheckingResult> grammarResult;
     if (checkingTypes & TextCheckingTypeGrammar) {
@@ -548,7 +551,7 @@
                 grammarCheckLength = spellingResult[i].location;
         }
 
-        findBadGrammars(client, text, 0, grammarCheckLength, grammarResult);
+        findBadGrammars(client, characters.data(), 0, grammarCheckLength, grammarResult);
     }
 
     if (grammarResult.size())
diff --git a/Source/core/editing/TextCheckingHelper.h b/Source/core/editing/TextCheckingHelper.h
index 95ca2c5..7a4acc4 100644
--- a/Source/core/editing/TextCheckingHelper.h
+++ b/Source/core/editing/TextCheckingHelper.h
@@ -24,7 +24,7 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/page/EditorClient.h"
 #include "core/platform/text/TextChecking.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -43,9 +43,9 @@
     int offsetTo(const Position&, ExceptionCode&) const;
     void expandRangeToNextEnd();
 
-    int textLength() const { return text().length(); }
+    const String& text() const;
+    // Why not let clients call these functions on text() themselves?
     String textSubstring(unsigned pos, unsigned len = INT_MAX) const { return text().substring(pos, len); }
-    const UChar* textCharacters() const { return text().bloatedCharacters(); }
     UChar textCharAt(int index) const { return text()[static_cast<unsigned>(index)]; }
 
     bool isEmpty() const;
@@ -64,7 +64,6 @@
     void invalidateParagraphRangeValues();
     PassRefPtr<Range> checkingRange() const { return m_checkingRange; }
     PassRefPtr<Range> offsetAsRange() const;
-    const String& text() const;
 
     RefPtr<Range> m_checkingRange;
     mutable RefPtr<Range> m_paragraphRange;
@@ -95,8 +94,7 @@
     bool unifiedTextCheckerEnabled() const;
 };
 
-void checkTextOfParagraph(TextCheckerClient*, const UChar* text, int length,
-    TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results);
+void checkTextOfParagraph(TextCheckerClient*, const String&, TextCheckingTypeMask, Vector<TextCheckingResult>&);
 
 bool unifiedTextCheckerEnabled(const Frame*);
 
diff --git a/Source/core/editing/TextInsertionBaseCommand.h b/Source/core/editing/TextInsertionBaseCommand.h
index e67d3af..628b42e 100644
--- a/Source/core/editing/TextInsertionBaseCommand.h
+++ b/Source/core/editing/TextInsertionBaseCommand.h
@@ -27,7 +27,7 @@
 #define TextInsertionBaseCommand_h
 
 #include "core/editing/CompositeEditCommand.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 7e90478..6e8d1ea 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -40,19 +40,16 @@
 #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 <wtf/text/CString.h>
-#include <wtf/unicode/CharacterNames.h>
-
-#if !UCONFIG_NO_COLLATION
+#include "wtf/text/CString.h"
+#include "wtf/unicode/CharacterNames.h"
 #include <unicode/usearch.h>
-#include "core/platform/text/TextBreakIteratorInternalICU.h"
-#endif
 
 using namespace WTF::Unicode;
 using namespace std;
@@ -84,13 +81,11 @@
     size_t search(size_t& startOffset);
     bool atBreak() const;
 
-#if !UCONFIG_NO_COLLATION
-
 private:
     bool isBadMatch(const UChar*, size_t length) const;
     bool isWordStartMatch(size_t start, size_t length) const;
 
-    String m_target;
+    Vector<UChar> m_target;
     FindOptions m_options;
 
     Vector<UChar> m_buffer;
@@ -102,22 +97,6 @@
     bool m_targetRequiresKanaWorkaround;
     Vector<UChar> m_normalizedTarget;
     mutable Vector<UChar> m_normalizedMatch;
-
-#else
-
-private:
-    void append(UChar, bool isCharacterStart);
-    size_t length() const;
-
-    String m_target;
-    FindOptions m_options;
-
-    Vector<UChar> m_buffer;
-    Vector<bool> m_isCharacterStartBuffer;
-    bool m_isBufferFull;
-    size_t m_cursor;
-
-#endif
 };
 
 // --------
@@ -1629,21 +1608,6 @@
     }
 }
 
-static inline void foldQuoteMarksAndSoftHyphens(String& s)
-{
-    s.replace(hebrewPunctuationGeresh, '\'');
-    s.replace(hebrewPunctuationGershayim, '"');
-    s.replace(leftDoubleQuotationMark, '"');
-    s.replace(leftSingleQuotationMark, '\'');
-    s.replace(rightDoubleQuotationMark, '"');
-    s.replace(rightSingleQuotationMark, '\'');
-    // Replace soft hyphen with an ignorable character so that their presence or absence will
-    // not affect string comparison.
-    s.replace(softHyphen, 0);
-}
-
-#if !UCONFIG_NO_COLLATION
-
 static inline void foldQuoteMarksAndSoftHyphens(UChar* data, size_t length)
 {
     for (size_t i = 0; i < length; ++i)
@@ -1926,27 +1890,27 @@
 }
 
 inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
-    : m_target(target)
-    , m_options(options)
+    : m_options(options)
     , m_prefixLength(0)
     , m_atBreak(true)
     , m_needsMoreContext(options & AtWordStarts)
-    , m_targetRequiresKanaWorkaround(containsKanaLetters(m_target))
+    , m_targetRequiresKanaWorkaround(containsKanaLetters(target))
 {
-    ASSERT(!m_target.isEmpty());
+    ASSERT(!target.isEmpty());
+    target.appendTo(m_target);
 
     // FIXME: We'd like to tailor the searcher to fold quote marks for us instead
     // of doing it in a separate replacement pass here, but ICU doesn't offer a way
     // to add tailoring on top of the locale-specific tailoring as of this writing.
-    foldQuoteMarksAndSoftHyphens(m_target);
+    foldQuoteMarksAndSoftHyphens(m_target.data(), m_target.size());
 
-    size_t targetLength = m_target.length();
+    size_t targetLength = m_target.size();
     m_buffer.reserveInitialCapacity(max(targetLength * 8, minimumSearchBufferSize));
     m_overlap = m_buffer.capacity() / 4;
 
     if ((m_options & AtWordStarts) && targetLength) {
         UChar32 targetFirstCharacter;
-        U16_GET(m_target.bloatedCharacters(), 0, 0, targetLength, targetFirstCharacter);
+        U16_GET(m_target.data(), 0, 0, targetLength, targetFirstCharacter);
         // Characters in the separator category never really occur at the beginning of a word,
         // so if the target begins with such a character, we just ignore the AtWordStart option.
         if (isSeparator(targetFirstCharacter)) {
@@ -1970,12 +1934,12 @@
     }
 
     UErrorCode status = U_ZERO_ERROR;
-    usearch_setPattern(searcher, m_target.bloatedCharacters(), targetLength, &status);
+    usearch_setPattern(searcher, m_target.data(), targetLength, &status);
     ASSERT(status == U_ZERO_ERROR);
 
     // The kana workaround requires a normalized copy of the target string.
     if (m_targetRequiresKanaWorkaround)
-        normalizeCharacters(m_target.bloatedCharacters(), m_target.length(), m_normalizedTarget);
+        normalizeCharacters(m_target.data(), m_target.size(), m_normalizedTarget);
 }
 
 inline SearchBuffer::~SearchBuffer()
@@ -2231,118 +2195,6 @@
     return matchedLength;
 }
 
-#else // !UCONFIG_NO_COLLATION
-
-inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
-    : m_target(options & CaseInsensitive ? target.foldCase() : target)
-    , m_options(options)
-    , m_buffer(m_target.length())
-    , m_isCharacterStartBuffer(m_target.length())
-    , m_isBufferFull(false)
-    , m_cursor(0)
-{
-    ASSERT(!m_target.isEmpty());
-    m_target.replace(noBreakSpace, ' ');
-    foldQuoteMarksAndSoftHyphens(m_target);
-}
-
-inline SearchBuffer::~SearchBuffer()
-{
-}
-
-inline void SearchBuffer::reachedBreak()
-{
-    m_cursor = 0;
-    m_isBufferFull = false;
-}
-
-inline bool SearchBuffer::atBreak() const
-{
-    return !m_cursor && !m_isBufferFull;
-}
-
-inline void SearchBuffer::append(UChar c, bool isStart)
-{
-    m_buffer[m_cursor] = c == noBreakSpace ? ' ' : foldQuoteMarkOrSoftHyphen(c);
-    m_isCharacterStartBuffer[m_cursor] = isStart;
-    if (++m_cursor == m_target.length()) {
-        m_cursor = 0;
-        m_isBufferFull = true;
-    }
-}
-
-inline size_t SearchBuffer::append(const UChar* characters, size_t length)
-{
-    ASSERT(length);
-    if (!(m_options & CaseInsensitive)) {
-        append(characters[0], true);
-        return 1;
-    }
-    const int maxFoldedCharacters = 16; // sensible maximum is 3, this should be more than enough
-    UChar foldedCharacters[maxFoldedCharacters];
-    bool error;
-    int numFoldedCharacters = foldCase(foldedCharacters, maxFoldedCharacters, characters, 1, &error);
-    ASSERT(!error);
-    ASSERT(numFoldedCharacters);
-    ASSERT(numFoldedCharacters <= maxFoldedCharacters);
-    if (!error && numFoldedCharacters) {
-        numFoldedCharacters = min(numFoldedCharacters, maxFoldedCharacters);
-        append(foldedCharacters[0], true);
-        for (int i = 1; i < numFoldedCharacters; ++i)
-            append(foldedCharacters[i], false);
-    }
-    return 1;
-}
-
-inline bool SearchBuffer::needsMoreContext() const
-{
-    return false;
-}
-
-void SearchBuffer::prependContext(const UChar*, size_t)
-{
-    ASSERT_NOT_REACHED();
-}
-
-inline size_t SearchBuffer::search(size_t& start)
-{
-    if (!m_isBufferFull)
-        return 0;
-    if (!m_isCharacterStartBuffer[m_cursor])
-        return 0;
-
-    size_t tailSpace = m_target.length() - m_cursor;
-    if (memcmp(&m_buffer[m_cursor], m_target.bloatedCharacters(), tailSpace * sizeof(UChar)) != 0)
-        return 0;
-    if (memcmp(&m_buffer[0], m_target.bloatedCharacters() + tailSpace, m_cursor * sizeof(UChar)) != 0)
-        return 0;
-
-    start = length();
-
-    // Now that we've found a match once, we don't want to find it again, because those
-    // are the SearchBuffer semantics, allowing for a buffer where you append more than one
-    // character at a time. To do this we take advantage of m_isCharacterStartBuffer, but if
-    // we want to get rid of that in the future we could track this with a separate boolean
-    // or even move the characters to the start of the buffer and set m_isBufferFull to false.
-    m_isCharacterStartBuffer[m_cursor] = false;
-
-    return start;
-}
-
-// Returns the number of characters that were appended to the buffer (what we are searching in).
-// That's not necessarily the same length as the passed-in target string, because case folding
-// can make two strings match even though they're not the same length.
-size_t SearchBuffer::length() const
-{
-    size_t bufferSize = m_target.length();
-    size_t length = 0;
-    for (size_t i = 0; i < bufferSize; ++i)
-        length += m_isCharacterStartBuffer[i];
-    return length;
-}
-
-#endif // !UCONFIG_NO_COLLATION
-
 // --------
 
 int TextIterator::rangeLength(const Range* r, bool forSelectionPreservation)
diff --git a/Source/core/editing/TextIterator.h b/Source/core/editing/TextIterator.h
index 0bc5c97..ff0f4a2 100644
--- a/Source/core/editing/TextIterator.h
+++ b/Source/core/editing/TextIterator.h
@@ -28,7 +28,7 @@
 
 #include "core/dom/Range.h"
 #include "core/editing/FindOptions.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/UndoStep.h b/Source/core/editing/UndoStep.h
index b5e8d8e..bdc2b7c 100644
--- a/Source/core/editing/UndoStep.h
+++ b/Source/core/editing/UndoStep.h
@@ -32,7 +32,7 @@
 #define UndoStep_h
 
 #include "core/editing/EditAction.h"
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/VisiblePosition.cpp b/Source/core/editing/VisiblePosition.cpp
index df1efaa..934ea6a 100644
--- a/Source/core/editing/VisiblePosition.cpp
+++ b/Source/core/editing/VisiblePosition.cpp
@@ -35,10 +35,11 @@
 #include "core/editing/VisibleUnits.h"
 #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 <wtf/text/CString.h>
+#include "wtf/text/CString.h"
 
 namespace WebCore {
 
@@ -534,14 +535,14 @@
 
     // The new position must be in the same editable element. Enforce that first.
     // Unless the descent is from a non-editable html element to an editable body.
-    if (node && node->hasTagName(htmlTag) && !node->rendererIsEditable() && node->document()->body() && node->document()->body()->rendererIsEditable())
+    if (node && isHTMLHtmlElement(node) && !node->rendererIsEditable() && node->document()->body() && node->document()->body()->rendererIsEditable())
         return next.isNotNull() ? next : prev;
 
     Node* editingRoot = editableRootForPosition(position);
         
     // If the html element is editable, descending into its body will look like a descent 
     // from non-editable to editable content since rootEditableElement() always stops at the body.
-    if ((editingRoot && editingRoot->hasTagName(htmlTag)) || position.deprecatedNode()->isDocumentNode())
+    if ((editingRoot && isHTMLHtmlElement(editingRoot)) || position.deprecatedNode()->isDocumentNode())
         return next.isNotNull() ? next : prev;
         
     bool prevIsInSameEditableElement = prevNode && editableRootForPosition(prev) == editingRoot;
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index c5e9884..8c19083 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -36,10 +36,10 @@
 #include "core/editing/htmlediting.h"
 #include "core/platform/graphics/LayoutPoint.h"
 #include "core/rendering/RenderObject.h"
-#include <wtf/Assertions.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/unicode/CharacterNames.h>
+#include "wtf/Assertions.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/unicode/CharacterNames.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
index 5409467..6ee1386 100644
--- a/Source/core/editing/VisibleUnits.cpp
+++ b/Source/core/editing/VisibleUnits.cpp
@@ -292,10 +292,10 @@
     string.clear();
     if (previousBox) {
         previousBoxLength = previousBox->len();
-        string.append(previousBox->textRenderer()->text()->bloatedCharacters() + previousBox->start(), previousBoxLength);
+        previousBox->textRenderer()->text().appendTo(string, previousBox->start(), previousBoxLength);
         len += previousBoxLength;
     }
-    string.append(textBox->textRenderer()->text()->bloatedCharacters() + textBox->start(), textBox->len());
+    textBox->textRenderer()->text().appendTo(string, textBox->start(), textBox->len());
     len += textBox->len();
 
     return wordBreakIterator(string.data(), len);
@@ -311,10 +311,10 @@
 
     int len = 0;
     string.clear();
-    string.append(textBox->textRenderer()->text()->bloatedCharacters() + textBox->start(), textBox->len());
+    textBox->textRenderer()->text().appendTo(string, textBox->start(), textBox->len());
     len += textBox->len();
     if (nextBox) {
-        string.append(nextBox->textRenderer()->text()->bloatedCharacters() + nextBox->start(), nextBox->len());
+        nextBox->textRenderer()->text().appendTo(string, nextBox->start(), nextBox->len());
         len += nextBox->len();
     }
 
@@ -381,7 +381,7 @@
         else if (offsetInBox == box->caretMaxOffset())
             iter = wordBreakIteratorForMaxOffsetBoundary(visiblePosition, textBox, nextBoxInDifferentBlock, string, leafBoxes);
         else if (movingIntoNewBox) {
-            iter = wordBreakIterator(textBox->textRenderer()->text()->bloatedCharacters() + textBox->start(), textBox->len());
+            iter = wordBreakIterator(textBox->textRenderer()->text(), textBox->start(), textBox->len());
             previouslyVisitedBox = box;
         }
 
@@ -492,9 +492,9 @@
             string.prepend(it.characters(), it.length());
         else {
             // Treat bullets used in the text security mode as regular characters when looking for boundaries
-            String iteratorString(it.characters(), it.length());
-            iteratorString.fill('x');
-            string.prepend(iteratorString.bloatedCharacters(), iteratorString.length());
+            Vector<UChar, 1024> iteratorString;
+            iteratorString.fill('x', it.length());
+            string.prepend(iteratorString.data(), iteratorString.size());
         }
         next = searchFunction(string.data(), string.size(), string.size() - suffixLength, MayHaveMoreContext, needMoreContext);
         if (next)
@@ -568,7 +568,7 @@
             // Treat bullets used in the text security mode as regular characters when looking for boundaries
             String iteratorString(it.characters(), it.length());
             iteratorString.fill('x');
-            string.append(iteratorString.bloatedCharacters(), iteratorString.length());
+            iteratorString.appendTo(string);
         }
         next = searchFunction(string.data(), string.size(), prefixLength, MayHaveMoreContext, needMoreContext);
         if (next != string.size())
@@ -1106,11 +1106,7 @@
 
     Node* n = startNode;
     while (n) {
-#if ENABLE(USERSELECT_ALL)
         if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable())
-#else
-        if (boundaryCrossingRule == CannotCrossEditingBoundary && n->rendererIsEditable() != startNode->rendererIsEditable())
-#endif
             break;
         if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
             while (n && n->rendererIsEditable() != startNode->rendererIsEditable())
@@ -1136,13 +1132,13 @@
             ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode());
             type = Position::PositionIsOffsetInAnchor;
             if (style->preserveNewline()) {
-                const UChar* chars = toRenderText(r)->characters();
-                int i = toRenderText(r)->textLength();
+                RenderText* text = toRenderText(r);
+                int i = text->textLength();
                 int o = offset;
                 if (n == startNode && o < i)
                     i = max(0, o);
                 while (--i >= 0) {
-                    if (chars[i] == '\n')
+                    if ((*text)[i] == '\n')
                         return VisiblePosition(Position(toText(n), i + 1), DOWNSTREAM);
                 }
             }
@@ -1186,11 +1182,7 @@
 
     Node* n = startNode;
     while (n) {
-#if ENABLE(USERSELECT_ALL)
         if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nodeIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable())
-#else
-        if (boundaryCrossingRule == CannotCrossEditingBoundary && n->rendererIsEditable() != startNode->rendererIsEditable())
-#endif
             break;
         if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
             while (n && n->rendererIsEditable() != startNode->rendererIsEditable())
@@ -1219,10 +1211,10 @@
             int length = toRenderText(r)->textLength();
             type = Position::PositionIsOffsetInAnchor;
             if (style->preserveNewline()) {
-                const UChar* chars = toRenderText(r)->characters();
+                RenderText* text = toRenderText(r);
                 int o = n == startNode ? offset : 0;
                 for (int i = o; i < length; ++i) {
-                    if (chars[i] == '\n')
+                    if ((*text)[i] == '\n')
                         return VisiblePosition(Position(toText(n), i), DOWNSTREAM);
                 }
             }
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp
index e09f35a..a2fd9aa 100644
--- a/Source/core/editing/htmlediting.cpp
+++ b/Source/core/editing/htmlediting.cpp
@@ -46,12 +46,13 @@
 #include "core/html/HTMLLIElement.h"
 #include "core/html/HTMLOListElement.h"
 #include "core/html/HTMLParagraphElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/html/HTMLUListElement.h"
 #include "core/page/Frame.h"
 #include "core/rendering/RenderObject.h"
-#include <wtf/Assertions.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/unicode/CharacterNames.h>
+#include "wtf/Assertions.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/unicode/CharacterNames.h"
 
 using namespace std;
 
@@ -652,13 +653,13 @@
     return false;
 }
 
-Node* highestNodeToRemoveInPruning(Node* node)
+Node* highestNodeToRemoveInPruning(Node* node, Node* excludeNode)
 {
     Node* previousNode = 0;
     Node* rootEditableElement = node ? node->rootEditableElement() : 0;
     for (; node; node = node->parentNode()) {
         if (RenderObject* renderer = node->renderer()) {
-            if (!renderer->canHaveChildren() || hasARenderedDescendant(node, previousNode) || rootEditableElement == node)
+            if (!renderer->canHaveChildren() || hasARenderedDescendant(node, previousNode) || rootEditableElement == node || excludeNode == node)
                 return previousNode;
         }
         previousNode = node;
@@ -671,7 +672,7 @@
     return toElement(enclosingNodeOfType(p, isTableCell));
 }
 
-Node* enclosingAnchorElement(const Position& p)
+Element* enclosingAnchorElement(const Position& p)
 {
     if (p.isNull())
         return 0;
@@ -679,7 +680,7 @@
     Node* node = p.deprecatedNode();
     while (node && !(node->isElementNode() && node->isLink()))
         node = node->parentNode();
-    return node;
+    return toElement(node);
 }
 
 HTMLElement* enclosingList(Node* node)
@@ -1169,7 +1170,7 @@
     return node->hasTagName(listingTag)
         || node->hasTagName(olTag)
         || node->hasTagName(preTag)
-        || node->hasTagName(tableTag)
+        || isHTMLTableElement(node)
         || node->hasTagName(ulTag)
         || node->hasTagName(xmpTag)
         || node->hasTagName(h1Tag)
diff --git a/Source/core/editing/htmlediting.h b/Source/core/editing/htmlediting.h
index 4674c91..243c47c 100644
--- a/Source/core/editing/htmlediting.h
+++ b/Source/core/editing/htmlediting.h
@@ -29,8 +29,8 @@
 #include "core/dom/Position.h"
 #include "core/editing/EditingBoundary.h"
 #include "core/platform/text/TextDirection.h"
-#include <wtf/Forward.h>
-#include <wtf/unicode/CharacterNames.h>
+#include "wtf/Forward.h"
+#include "wtf/unicode/CharacterNames.h"
 
 namespace WebCore {
 
@@ -58,13 +58,13 @@
 
 Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*),
     EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = 0);
-Node* highestNodeToRemoveInPruning(Node*);
+Node* highestNodeToRemoveInPruning(Node*, Node* excludeNode = 0);
 Node* lowestEditableAncestor(Node*);
 
 Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
 Node* enclosingTableCell(const Position&);
 Node* enclosingEmptyListItem(const VisiblePosition&);
-Node* enclosingAnchorElement(const Position&);
+Element* enclosingAnchorElement(const Position&);
 Node* enclosingNodeWithTag(const Position&, const QualifiedName&);
 Node* enclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
 
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp
index b16678e..bb695bf 100644
--- a/Source/core/editing/markup.cpp
+++ b/Source/core/editing/markup.cpp
@@ -51,6 +51,8 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLBodyElement.h"
 #include "core/html/HTMLElement.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/html/HTMLTextFormControlElement.h"
 #include "core/page/Frame.h"
 #include "core/rendering/RenderObject.h"
@@ -222,9 +224,7 @@
         // FIXME: Should this be included in forceInline?
         wrappingStyle->style()->setProperty(CSSPropertyFloat, CSSValueNone);
 
-        StringBuilder openTag;
-        appendStyleNodeOpenTag(openTag, wrappingStyle->style(), text->document());
-        out.append(openTag.characters(), openTag.length());
+        appendStyleNodeOpenTag(out, wrappingStyle->style(), text->document());
     }
 
     if (!shouldAnnotate() || parentIsTextarea)
@@ -431,7 +431,7 @@
 
     if (commonAncestorBlock->hasTagName(tbodyTag) || commonAncestorBlock->hasTagName(trTag)) {
         ContainerNode* table = commonAncestorBlock->parentNode();
-        while (table && !table->hasTagName(tableTag))
+        while (table && !isHTMLTableElement(table))
             table = table->parentNode();
 
         return table;
@@ -707,7 +707,7 @@
     taggedMarkup.append(markup.substring(fragmentEnd));
 
     RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy);
-    RefPtr<Document> taggedDocument = Document::create(0, KURL());
+    RefPtr<Document> taggedDocument = Document::create();
     taggedDocument->setContextFeatures(document->contextFeatures());
     taggedDocument->takeAllChildrenFrom(taggedFragment.get());
 
@@ -842,7 +842,7 @@
     bool useClonesOfEnclosingBlock = blockNode
         && blockNode->isElementNode()
         && !block->hasTagName(bodyTag)
-        && !block->hasTagName(htmlTag)
+        && !isHTMLHtmlElement(block)
         && block != editableRootForPosition(context->startPosition());
     bool useLineBreak = enclosingTextFormControl(context->startPosition());
 
@@ -955,7 +955,7 @@
 
     bool wasValid = fragment->parseXML(markup, contextElement, parserContentPolicy);
     if (!wasValid) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
     return fragment.release();
@@ -1000,13 +1000,13 @@
 {
     ASSERT(element);
     if (element->ieForbidsInsertHTML()) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
     if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
         || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -1021,7 +1021,7 @@
     RefPtr<Node> nextNode;
     for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
         nextNode = node->nextSibling();
-        if (node->hasTagName(htmlTag) || node->hasTagName(headTag) || node->hasTagName(bodyTag)) {
+        if (isHTMLHtmlElement(node.get()) || node->hasTagName(headTag) || node->hasTagName(bodyTag)) {
             HTMLElement* element = toHTMLElement(node.get());
             if (Node* firstChild = element->firstChild())
                 nextNode = firstChild;
diff --git a/Source/core/editing/markup.h b/Source/core/editing/markup.h
index 0afcae9..3c1b435 100644
--- a/Source/core/editing/markup.h
+++ b/Source/core/editing/markup.h
@@ -28,8 +28,8 @@
 
 #include "core/dom/ParserContentPolicy.h"
 #include "core/editing/HTMLInterchange.h"
-#include <wtf/Forward.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/features.gypi b/Source/core/features.gypi
index 3c0d1c1..e157f2d 100644
--- a/Source/core/features.gypi
+++ b/Source/core/features.gypi
@@ -32,7 +32,6 @@
   # The following defines turn WebKit features on and off.
   'variables': {
     'feature_defines': [
-      'ENABLE_CANVAS_USES_MAILBOX=1',
       'ENABLE_CSS3_TEXT=0',
       'ENABLE_CSS_EXCLUSIONS=1',
       'ENABLE_CSS_REGIONS=1',
@@ -40,9 +39,7 @@
       'ENABLE_ENCRYPTED_MEDIA_V2=1',
       'ENABLE_SVG_FONTS=1',
       'ENABLE_TOUCH_ICON_LOADING=<(enable_touch_icon_loading)',
-      'ENABLE_XHR_TIMEOUT=0',
       'ENABLE_GDI_FONTS_ON_WINDOWS=1',
-      'ENABLE_PARTITION_ALLOC=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.
@@ -85,12 +82,6 @@
           'ENABLE_WEB_AUDIO=1',
         ],
       }],
-      ['OS=="linux" or OS=="mac" or OS=="android"', {
-        'feature_defines': [
-          # 8Bit text runs should be enabled for all platforms webkit.org/b/111348
-          'ENABLE_8BIT_TEXTRUN=1',
-        ],
-      }],
       # Mac OS X uses Accelerate.framework FFT by default instead of FFmpeg.
       ['OS!="mac" and OS!="android"', {
         'feature_defines': [
@@ -110,11 +101,6 @@
           'ENABLE_OPENTYPE_VERTICAL=1',
         ],
       }],
-      ['OS=="win"', {
-        'feature_defines': [
-          'ENABLE_PAN_SCROLLING=1',
-        ],
-      }],
       ['OS=="mac"', {
         'feature_defines': [
           'ENABLE_RUBBER_BANDING=1',
diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp
index c6fe3af..257b47c 100644
--- a/Source/core/fileapi/File.cpp
+++ b/Source/core/fileapi/File.cpp
@@ -29,9 +29,9 @@
 #include "core/platform/FileMetadata.h"
 #include "core/platform/FileSystem.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/DateMath.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/DateMath.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fileapi/FileError.cpp b/Source/core/fileapi/FileError.cpp
index 671b309..99d686d 100644
--- a/Source/core/fileapi/FileError.cpp
+++ b/Source/core/fileapi/FileError.cpp
@@ -47,7 +47,7 @@
     case NOT_READABLE_ERR:
         return FSNotReadableError;
     case ENCODING_ERR:
-        return FSEncodingError;
+        return EncodingError;
     case NO_MODIFICATION_ALLOWED_ERR:
         return FSNoModificationAllowedError;
     case INVALID_STATE_ERR:
@@ -55,13 +55,13 @@
     case SYNTAX_ERR:
         return FSSyntaxError;
     case INVALID_MODIFICATION_ERR:
-        return FSInvalidModificationError;
+        return InvalidModificationError;
     case QUOTA_EXCEEDED_ERR:
         return FSQuotaExceededError;
     case TYPE_MISMATCH_ERR:
         return FSTypeMismatchError;
     case PATH_EXISTS_ERR:
-        return FSPathExistsError;
+        return PathExistsError;
     default:
         ASSERT_NOT_REACHED();
         return 0;
diff --git a/Source/core/fileapi/FileList.h b/Source/core/fileapi/FileList.h
index 9a3b6bc..fbd29bf 100644
--- a/Source/core/fileapi/FileList.h
+++ b/Source/core/fileapi/FileList.h
@@ -28,10 +28,10 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/fileapi/File.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fileapi/FileReader.cpp b/Source/core/fileapi/FileReader.cpp
index bf29841..a6189a7 100644
--- a/Source/core/fileapi/FileReader.cpp
+++ b/Source/core/fileapi/FileReader.cpp
@@ -37,9 +37,9 @@
 #include "core/dom/ScriptExecutionContext.h"
 #include "core/fileapi/File.h"
 #include "core/platform/Logging.h"
-#include <wtf/ArrayBuffer.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/text/CString.h>
+#include "wtf/ArrayBuffer.h"
+#include "wtf/CurrentTime.h"
+#include "wtf/text/CString.h"
 
 namespace WebCore {
 
@@ -145,9 +145,9 @@
 
 void FileReader::readInternal(Blob* blob, FileReaderLoader::ReadType type, ExceptionCode& ec)
 {
-    // If multiple concurrent read methods are called on the same FileReader, INVALID_STATE_ERR should be thrown when the state is LOADING.
+    // If multiple concurrent read methods are called on the same FileReader, InvalidStateError should be thrown when the state is LOADING.
     if (m_state == LOADING) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -161,7 +161,7 @@
     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.get());
+    m_loader->start(scriptExecutionContext(), *m_blob);
 }
 
 static void delayedAbort(ScriptExecutionContext*, FileReader* reader)
diff --git a/Source/core/fileapi/FileReader.h b/Source/core/fileapi/FileReader.h
index c8482fd..27a4a2b 100644
--- a/Source/core/fileapi/FileReader.h
+++ b/Source/core/fileapi/FileReader.h
@@ -37,9 +37,9 @@
 #include "core/fileapi/FileError.h"
 #include "core/fileapi/FileReaderLoader.h"
 #include "core/fileapi/FileReaderLoaderClient.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fileapi/FileReader.idl b/Source/core/fileapi/FileReader.idl
index d551b0f..2727d12 100644
--- a/Source/core/fileapi/FileReader.idl
+++ b/Source/core/fileapi/FileReader.idl
@@ -33,9 +33,8 @@
     GlobalContext=Window&WorkerGlobalScope,
     ActiveDOMObject,
     Constructor,
-    ConstructorCallWith=ScriptExecutionContext,
-    EventTarget
-] interface FileReader {
+    ConstructorCallWith=ScriptExecutionContext
+] interface FileReader : EventTarget {
     // ready states
     const unsigned short EMPTY = 0;
     const unsigned short LOADING = 1;
@@ -55,15 +54,6 @@
 
     readonly attribute FileError error;
 
-    // EventTarget interface
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
-
     attribute EventListener onloadstart;
     attribute EventListener onprogress;
     attribute EventListener onload;
diff --git a/Source/core/fileapi/FileReaderLoader.cpp b/Source/core/fileapi/FileReaderLoader.cpp
index e70634b..5a97eeb 100644
--- a/Source/core/fileapi/FileReaderLoader.cpp
+++ b/Source/core/fileapi/FileReaderLoader.cpp
@@ -37,16 +37,17 @@
 #include "core/fileapi/BlobRegistry.h"
 #include "core/fileapi/BlobURL.h"
 #include "core/fileapi/FileReaderLoaderClient.h"
+#include "core/fileapi/Stream.h"
 #include "core/loader/TextResourceDecoder.h"
 #include "core/loader/ThreadableLoader.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
-#include <wtf/ArrayBuffer.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/Base64.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/Vector.h>
+#include "wtf/ArrayBuffer.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/Base64.h"
+#include "wtf/text/StringBuilder.h"
 
 using namespace std;
 
@@ -76,7 +77,7 @@
         BlobRegistry::unregisterBlobURL(m_urlForReading);
 }
 
-void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
+void FileReaderLoader::startForURL(ScriptExecutionContext* scriptExecutionContext, const KURL& url)
 {
     // The blob is read by routing through the request handling layer given a temporary public url.
     m_urlForReading = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin());
@@ -84,7 +85,7 @@
         failed(FileError::SECURITY_ERR);
         return;
     }
-    BlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, blob->url());
+    BlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, url);
 
     // Construct and load the request.
     ResourceRequest request(m_urlForReading);
@@ -107,6 +108,16 @@
         ThreadableLoader::loadResourceSynchronously(scriptExecutionContext, request, *this, options);
 }
 
+void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, const Blob& blob)
+{
+    startForURL(scriptExecutionContext, blob.url());
+}
+
+void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, const Stream& stream)
+{
+    startForURL(scriptExecutionContext, stream.url());
+}
+
 void FileReaderLoader::cancel()
 {
     m_errorCode = FileError::ABORT_ERR;
@@ -271,32 +282,9 @@
         return m_rawData;
 
     // Otherwise, return a copy.
-    return ArrayBuffer::create(m_rawData.get());
+    return m_rawData->slice(0, m_bytesLoaded);
 }
 
-#if ENABLE(STREAM)
-PassRefPtr<Blob> FileReaderLoader::blobResult()
-{
-    ASSERT(m_readType == ReadAsBlob);
-
-    // If the loading is not finished or an error occurs, return an empty result.
-    if (!m_rawData || m_errorCode || !isCompleted())
-        return 0;
-
-    if (!m_blobResult) {
-        OwnPtr<BlobData> blobData = BlobData::create();
-        size_t size = 0;
-        RefPtr<RawData> rawData = RawData::create();
-        size = m_rawData->byteLength();
-        rawData->mutableData()->append(static_cast<char*>(m_rawData->data()), size);
-        blobData->appendData(rawData, 0, size);
-        blobData->setContentType(m_dataType);
-        m_blobResult = Blob::create(blobData.release(), size);
-    }
-    return m_blobResult;
-}
-#endif // ENABLE(STREAM)
-
 String FileReaderLoader::stringResult()
 {
     ASSERT(m_readType != ReadAsArrayBuffer && m_readType != ReadAsBlob);
@@ -384,14 +372,4 @@
         m_encoding = WTF::TextEncoding(encoding);
 }
 
-#if ENABLE(STREAM)
-void FileReaderLoader::setRange(unsigned start, unsigned length)
-{
-    ASSERT(length > 0);
-    m_hasRange = true;
-    m_rangeStart = start;
-    m_rangeEnd = start + length - 1;
-}
-#endif // ENABLE(STREAM)
-
 } // namespace WebCore
diff --git a/Source/core/fileapi/FileReaderLoader.h b/Source/core/fileapi/FileReaderLoader.h
index c4b0291..e567dfe 100644
--- a/Source/core/fileapi/FileReaderLoader.h
+++ b/Source/core/fileapi/FileReaderLoader.h
@@ -43,6 +43,7 @@
 class Blob;
 class FileReaderLoaderClient;
 class ScriptExecutionContext;
+class Stream;
 class TextResourceDecoder;
 class ThreadableLoader;
 
@@ -60,7 +61,8 @@
     FileReaderLoader(ReadType, FileReaderLoaderClient*);
     ~FileReaderLoader();
 
-    void start(ScriptExecutionContext*, Blob*);
+    void start(ScriptExecutionContext*, const Blob&);
+    void start(ScriptExecutionContext*, const Stream&);
     void cancel();
 
     // ThreadableLoaderClient
@@ -71,20 +73,18 @@
 
     String stringResult();
     PassRefPtr<ArrayBuffer> arrayBufferResult() const;
-#if ENABLE(STREAM)
-    PassRefPtr<Blob> blobResult();
-#endif // ENABLE(STREAM)
     unsigned bytesLoaded() const { return m_bytesLoaded; }
     unsigned totalBytes() const { return m_totalBytes; }
     FileError::ErrorCode errorCode() const { return m_errorCode; }
 
     void setEncoding(const String&);
     void setDataType(const String& dataType) { m_dataType = dataType; }
-#if ENABLE(STREAM)
-    void setRange(unsigned, unsigned);
-#endif // ENABLE(STREAM)
 
 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 terminate();
     void cleanup();
     void failed(FileError::ErrorCode);
diff --git a/Source/core/fileapi/FileReaderSync.cpp b/Source/core/fileapi/FileReaderSync.cpp
index 1cacad8..200ce39 100644
--- a/Source/core/fileapi/FileReaderSync.cpp
+++ b/Source/core/fileapi/FileReaderSync.cpp
@@ -34,8 +34,8 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/fileapi/Blob.h"
 #include "core/fileapi/FileReaderLoader.h"
-#include <wtf/ArrayBuffer.h>
-#include <wtf/PassRefPtr.h>
+#include "wtf/ArrayBuffer.h"
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
@@ -52,7 +52,7 @@
     }
 
     FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0);
-    startLoading(scriptExecutionContext, loader, blob, ec);
+    startLoading(scriptExecutionContext, loader, *blob, ec);
 
     return loader.arrayBufferResult();
 }
@@ -65,7 +65,7 @@
     }
 
     FileReaderLoader loader(FileReaderLoader::ReadAsBinaryString, 0);
-    startLoading(scriptExecutionContext, loader, blob, ec);
+    startLoading(scriptExecutionContext, loader, *blob, ec);
     return loader.stringResult();
 }
 
@@ -78,7 +78,7 @@
 
     FileReaderLoader loader(FileReaderLoader::ReadAsText, 0);
     loader.setEncoding(encoding);
-    startLoading(scriptExecutionContext, loader, blob, ec);
+    startLoading(scriptExecutionContext, loader, *blob, ec);
     return loader.stringResult();
 }
 
@@ -91,11 +91,11 @@
 
     FileReaderLoader loader(FileReaderLoader::ReadAsDataURL, 0);
     loader.setDataType(blob->type());
-    startLoading(scriptExecutionContext, loader, blob, ec);
+    startLoading(scriptExecutionContext, loader, *blob, ec);
     return loader.stringResult();
 }
 
-void FileReaderSync::startLoading(ScriptExecutionContext* scriptExecutionContext, FileReaderLoader& loader, Blob* blob, ExceptionCode& ec)
+void FileReaderSync::startLoading(ScriptExecutionContext* scriptExecutionContext, FileReaderLoader& loader, const Blob& blob, ExceptionCode& ec)
 {
     loader.start(scriptExecutionContext, blob);
     ec = FileError::ErrorCodeToExceptionCode(loader.errorCode());
diff --git a/Source/core/fileapi/FileReaderSync.h b/Source/core/fileapi/FileReaderSync.h
index 6f20dca..3b88271 100644
--- a/Source/core/fileapi/FileReaderSync.h
+++ b/Source/core/fileapi/FileReaderSync.h
@@ -65,7 +65,7 @@
 private:
     FileReaderSync();
 
-    void startLoading(ScriptExecutionContext*, FileReaderLoader&, Blob*, ExceptionCode&);
+    void startLoading(ScriptExecutionContext*, FileReaderLoader&, const Blob&, ExceptionCode&);
 };
 
 } // namespace WebCore
diff --git a/Source/core/history/BackForwardClient.h b/Source/core/history/BackForwardClient.h
index fa4a4a8..f4be36a 100644
--- a/Source/core/history/BackForwardClient.h
+++ b/Source/core/history/BackForwardClient.h
@@ -29,8 +29,8 @@
 #define BackForwardClient_h
 
 #include "core/history/HistoryItem.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/history/BackForwardController.h b/Source/core/history/BackForwardController.h
index 61f49b8..f6c123c 100644
--- a/Source/core/history/BackForwardController.h
+++ b/Source/core/history/BackForwardController.h
@@ -26,9 +26,9 @@
 #ifndef BackForwardController_h
 #define BackForwardController_h
 
-#include <wtf/Noncopyable.h>
-#include <wtf/Forward.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Forward.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/history/HistoryItem.h b/Source/core/history/HistoryItem.h
index 804e1e9..50c92e1 100644
--- a/Source/core/history/HistoryItem.h
+++ b/Source/core/history/HistoryItem.h
@@ -100,7 +100,7 @@
     void setIsTargetItem(bool);
     
     void setStateObject(PassRefPtr<SerializedScriptValue> object);
-    PassRefPtr<SerializedScriptValue> stateObject() const { return m_stateObject; }
+    SerializedScriptValue* stateObject() const { return m_stateObject.get(); }
 
     void setItemSequenceNumber(long long number) { m_itemSequenceNumber = number; }
     long long itemSequenceNumber() const { return m_itemSequenceNumber; }
diff --git a/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp b/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp
index b15c0a4..0484277 100644
--- a/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp
+++ b/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp
@@ -50,7 +50,7 @@
 #include "core/platform/text/DateTimeFormat.h"
 #include "core/platform/text/PlatformLocale.h"
 #include "core/rendering/RenderTheme.h"
-#include <wtf/DateMath.h>
+#include "wtf/DateMath.h"
 
 namespace WebCore {
 
@@ -148,11 +148,18 @@
     return toPickerIndicatorElement(elementById(ShadowElementNames::pickerIndicator()));
 }
 
+inline bool BaseMultipleFieldsDateAndTimeInputType::containsFocusedShadowElement() const
+{
+    return element()->userAgentShadowRoot()->contains(element()->document()->focusedNode());
+}
+
 void BaseMultipleFieldsDateAndTimeInputType::didBlurFromControl()
 {
     // We don't need to call blur(). This function is called when control
     // lost focus.
 
+    if (containsFocusedShadowElement())
+        return;
     RefPtr<HTMLInputElement> protector(element());
     // Remove focus ring by CSS "focus" pseudo class.
     element()->setFocus(false);
@@ -163,6 +170,8 @@
     // We don't need to call focus(). This function is called when control
     // got focus.
 
+    if (!containsFocusedShadowElement())
+        return;
     // Add focus ring by CSS "focus" pseudo class.
     // FIXME: Setting the focus flag to non-focused element is too tricky.
     element()->setFocus(true);
@@ -355,7 +364,7 @@
 
     // If a field element has focus, set focus back to the <input> itself before
     // deleting the field. This prevents unnecessary focusout/blur events.
-    if (element()->focused())
+    if (containsFocusedShadowElement())
         element()->focus();
 
     BaseDateAndTimeInputType::destroyShadowSubtree();
diff --git a/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.h b/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.h
index 639dc04..4726dfc 100644
--- a/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.h
+++ b/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.h
@@ -115,6 +115,7 @@
     SpinButtonElement* spinButtonElement() const;
     ClearButtonElement* clearButtonElement() const;
     PickerIndicatorElement* pickerIndicatorElement() const;
+    bool containsFocusedShadowElement() const;
     void showPickerIndicator();
     void hidePickerIndicator();
     void updatePickerIndicatorVisibility();
diff --git a/Source/core/html/ButtonInputType.cpp b/Source/core/html/ButtonInputType.cpp
index 787dcae..e5dcac0 100644
--- a/Source/core/html/ButtonInputType.cpp
+++ b/Source/core/html/ButtonInputType.cpp
@@ -32,7 +32,7 @@
 #include "core/html/ButtonInputType.h"
 
 #include "core/html/InputTypeNames.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/CheckboxInputType.cpp b/Source/core/html/CheckboxInputType.cpp
index 376e0e4..a9dbab6 100644
--- a/Source/core/html/CheckboxInputType.cpp
+++ b/Source/core/html/CheckboxInputType.cpp
@@ -36,7 +36,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/DOMFormData.h b/Source/core/html/DOMFormData.h
index dfb2783..c522b72 100644
--- a/Source/core/html/DOMFormData.h
+++ b/Source/core/html/DOMFormData.h
@@ -32,9 +32,9 @@
 #define DOMFormData_h
 
 #include "core/html/FormDataList.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WTF{
 class TextEncoding;
diff --git a/Source/core/html/DOMTokenList.cpp b/Source/core/html/DOMTokenList.cpp
index 3f36935..b61dfec 100644
--- a/Source/core/html/DOMTokenList.cpp
+++ b/Source/core/html/DOMTokenList.cpp
@@ -27,21 +27,21 @@
 
 #include "core/dom/ExceptionCode.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
 bool DOMTokenList::validateToken(const AtomicString& token, ExceptionCode& ec)
 {
     if (token.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return false;
     }
 
     unsigned length = token.length();
     for (unsigned i = 0; i < length; ++i) {
         if (isHTMLSpace(token[i])) {
-            ec = INVALID_CHARACTER_ERR;
+            ec = InvalidCharacterError;
             return false;
         }
     }
diff --git a/Source/core/html/DOMTokenList.idl b/Source/core/html/DOMTokenList.idl
index bfc142a..c885018 100644
--- a/Source/core/html/DOMTokenList.idl
+++ b/Source/core/html/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] void add(DOMString... tokens);
-    [RaisesException] void remove(DOMString... tokens);
-    [RaisesException] boolean toggle(DOMString token, optional boolean force);
+    [RaisesException, DeliverCustomElementCallbacks] void add(DOMString... tokens);
+    [RaisesException, DeliverCustomElementCallbacks] void remove(DOMString... tokens);
+    [RaisesException, DeliverCustomElementCallbacks] boolean toggle(DOMString token, optional boolean force);
     [NotEnumerable] DOMString toString();
 };
 
diff --git a/Source/core/html/DOMURL.cpp b/Source/core/html/DOMURL.cpp
index 6fe9ffa..360cc2f 100644
--- a/Source/core/html/DOMURL.cpp
+++ b/Source/core/html/DOMURL.cpp
@@ -33,33 +33,11 @@
 #include "core/fileapi/BlobURL.h"
 #include "core/html/PublicURLManager.h"
 #include "core/loader/cache/MemoryCache.h"
-#include "modules/mediasource/MediaSourceBase.h"
-#include "modules/mediastream/MediaStream.h"
 #include "weborigin/KURL.h"
 #include "wtf/MainThread.h"
 
 namespace WebCore {
 
-String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaSourceBase* source)
-{
-    // Since WebWorkers cannot obtain MediaSource objects, we should be on the main thread.
-    ASSERT(isMainThread());
-
-    if (!scriptExecutionContext || !source)
-        return String();
-    return createPublicURL(scriptExecutionContext, source);
-}
-
-String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaStream* stream)
-{
-    // Since WebWorkers cannot obtain Stream objects, we should be on the main thread.
-    ASSERT(isMainThread());
-
-    if (!scriptExecutionContext || !stream)
-        return String();
-    return createPublicURL(scriptExecutionContext, stream);
-}
-
 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
 {
     if (!scriptExecutionContext || !blob)
diff --git a/Source/core/html/DOMURL.h b/Source/core/html/DOMURL.h
index 3b80033..a3784de 100644
--- a/Source/core/html/DOMURL.h
+++ b/Source/core/html/DOMURL.h
@@ -34,8 +34,6 @@
 namespace WebCore {
 
 class Blob;
-class MediaSourceBase;
-class MediaStream;
 class ScriptExecutionContext;
 class URLRegistrable;
 
@@ -46,10 +44,7 @@
 
     static String createObjectURL(ScriptExecutionContext*, Blob*);
     static void revokeObjectURL(ScriptExecutionContext*, const String&);
-    static String createObjectURL(ScriptExecutionContext*, MediaSourceBase*);
-    static String createObjectURL(ScriptExecutionContext*, MediaStream*);
 
-private:
     static String createPublicURL(ScriptExecutionContext*, URLRegistrable*);
 };
 
diff --git a/Source/core/html/DateInputType.cpp b/Source/core/html/DateInputType.cpp
index d53ec40..ec2f6a0 100644
--- a/Source/core/html/DateInputType.cpp
+++ b/Source/core/html/DateInputType.cpp
@@ -38,7 +38,7 @@
 #include "core/platform/DateComponents.h"
 #include "core/platform/LocalizedStrings.h"
 #include "core/platform/text/PlatformLocale.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/EmailInputType.cpp b/Source/core/html/EmailInputType.cpp
index 70a9d5d..086af07 100644
--- a/Source/core/html/EmailInputType.cpp
+++ b/Source/core/html/EmailInputType.cpp
@@ -32,9 +32,9 @@
 #include "core/platform/LocalizedStrings.h"
 #include "core/platform/text/RegularExpression.h"
 #include "public/platform/Platform.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringBuilder.h"
 #include <unicode/uidna.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -58,7 +58,7 @@
 
     UErrorCode error = U_ZERO_ERROR;
     UChar domainNameBuffer[maximumDomainNameLength];
-    int32_t domainNameLength = uidna_IDNToASCII(address.bloatedCharacters() + atPosition + 1, address.length() - atPosition - 1, domainNameBuffer, WTF_ARRAY_LENGTH(domainNameBuffer), idnaConversionOption, 0, &error);
+    int32_t domainNameLength = uidna_IDNToASCII(address.charactersWithNullTermination().data() + atPosition + 1, address.length() - atPosition - 1, domainNameBuffer, WTF_ARRAY_LENGTH(domainNameBuffer), idnaConversionOption, 0, &error);
     if (error != U_ZERO_ERROR || domainNameLength <= 0)
         return address;
 
diff --git a/Source/core/html/FileInputType.cpp b/Source/core/html/FileInputType.cpp
index 50e4641..6804ebb 100644
--- a/Source/core/html/FileInputType.cpp
+++ b/Source/core/html/FileInputType.cpp
@@ -39,9 +39,9 @@
 #include "core/platform/LocalizedStrings.h"
 #include "core/platform/graphics/Icon.h"
 #include "core/rendering/RenderFileUploadControl.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -151,7 +151,7 @@
         settings.acceptFileExtensions = input->acceptFileExtensions();
         settings.selectedFiles = m_fileList->paths();
 #if ENABLE(MEDIA_CAPTURE)
-        settings.capture = input->capture();
+        settings.useMediaCapture = input->capture();
 #endif
         chrome->runOpenPanel(input->document()->frame(), newFileChooser(settings));
     }
diff --git a/Source/core/html/FileInputType.h b/Source/core/html/FileInputType.h
index 2a5ce2e..71f626a 100644
--- a/Source/core/html/FileInputType.h
+++ b/Source/core/html/FileInputType.h
@@ -35,7 +35,7 @@
 #include "core/html/BaseClickableWithKeyInputType.h"
 #include "core/platform/FileChooser.h"
 #include "core/platform/FileIconLoader.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/FormAssociatedElement.h b/Source/core/html/FormAssociatedElement.h
index 40f2b36..85b5e74 100644
--- a/Source/core/html/FormAssociatedElement.h
+++ b/Source/core/html/FormAssociatedElement.h
@@ -24,7 +24,7 @@
 #ifndef FormAssociatedElement_h
 #define FormAssociatedElement_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/FormController.cpp b/Source/core/html/FormController.cpp
index 57436bb..903b879 100644
--- a/Source/core/html/FormController.cpp
+++ b/Source/core/html/FormController.cpp
@@ -25,7 +25,7 @@
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/platform/FileChooser.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index 68b31d3..5e6e54d 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -24,18 +24,16 @@
 #include "config.h"
 #include "core/html/HTMLAnchorElement.h"
 
-#include "public/platform/Platform.h"
-#include "public/platform/WebPrescientNetworking.h"
-#include "public/platform/WebURL.h"
-#include <wtf/text/StringBuilder.h>
 #include "HTMLNames.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/editing/FrameSelection.h"
+#include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
+#include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/FrameLoaderTypes.h"
@@ -50,9 +48,13 @@
 #include "core/platform/network/DNS.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/rendering/RenderImage.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebPrescientNetworking.h"
+#include "public/platform/WebURL.h"
 #include "weborigin/KnownPorts.h"
 #include "weborigin/SecurityOrigin.h"
 #include "weborigin/SecurityPolicy.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -76,14 +78,15 @@
         return adoptPtr(new HTMLAnchorElement::PrefetchEventHandler(anchorElement));
     }
 
+    void reset();
+
     void handleEvent(Event* e);
     void didChangeHREF() { m_hadHREFChanged = true; }
+    bool hasIssuedPreconnect() const { return m_hasIssuedPreconnect; }
 
 private:
     explicit PrefetchEventHandler(HTMLAnchorElement*);
 
-    void reset();
-
     void handleMouseOver(Event* event);
     void handleMouseOut(Event* event);
     void handleLeftMouseDown(Event* event);
@@ -220,6 +223,7 @@
 
         if (isLinkClick(event) && treatLinkAsLiveForEventType(eventType(event))) {
             handleClick(event);
+            prefetchEventHandler()->reset();
             return;
         }
 
@@ -566,22 +570,28 @@
     StringBuilder url;
     url.append(stripLeadingAndTrailingHTMLSpaces(fastGetAttribute(hrefAttr)));
     appendServerMapMousePosition(url, event);
-    KURL kurl = document()->completeURL(url.toString());
+    KURL completedURL = document()->completeURL(url.toString());
 
+    ResourceRequest request(completedURL);
+    if (prefetchEventHandler()->hasIssuedPreconnect())
+        frame->loader()->client()->dispatchWillRequestAfterPreconnect(request);
     if (hasAttribute(downloadAttr)) {
-        ResourceRequest request(kurl);
-
         if (!hasRel(RelationNoReferrer)) {
-            String referrer = SecurityPolicy::generateReferrerHeader(document()->referrerPolicy(), kurl, frame->loader()->outgoingReferrer());
+            String referrer = SecurityPolicy::generateReferrerHeader(document()->referrerPolicy(), completedURL, frame->loader()->outgoingReferrer());
             if (!referrer.isEmpty())
                 request.setHTTPReferrer(referrer);
         }
 
-        frame->loader()->client()->startDownload(request, fastGetAttribute(downloadAttr));
-    } else
-        frame->loader()->urlSelected(kurl, target(), event, false, hasRel(RelationNoReferrer) ? NeverSendReferrer : MaybeSendReferrer);
+        frame->loader()->client()->loadURLExternally(request, NavigationPolicyDownload, fastGetAttribute(downloadAttr));
+    } else {
+        FrameLoadRequest frameRequest(document()->securityOrigin(), request, target());
+        frameRequest.setTriggeringEvent(event);
+        if (hasRel(RelationNoReferrer))
+            frameRequest.setShouldSendReferrer(NeverSendReferrer);
+        frame->loader()->load(frameRequest);
+    }
 
-    sendPings(kurl);
+    sendPings(completedURL);
 }
 
 HTMLAnchorElement::EventType HTMLAnchorElement::eventType(Event* event)
@@ -790,8 +800,6 @@
 
     int flags = (m_hadTapUnconfirmed ? 2 : 0) | (capturedTapDown ? 1 : 0);
     HistogramSupport::histogramEnumeration("MouseEventPrefetch.PreTapEventsFollowedByClick", flags, 4);
-
-    reset();
 }
 
 bool HTMLAnchorElement::PrefetchEventHandler::shouldPrefetch(const KURL& url)
@@ -833,7 +841,12 @@
     if (!shouldPrefetch(url))
         return;
 
+    // The precision of current MouseOver trigger is too low to actually trigger preconnects.
+    if (motivation == WebKit::WebPreconnectMotivationLinkMouseOver)
+        return;
+
     preconnectToURL(url, motivation);
+    m_hasIssuedPreconnect = true;
 }
 
 }
diff --git a/Source/core/html/HTMLAnchorElement.h b/Source/core/html/HTMLAnchorElement.h
index 5cc83ca..a63c563 100644
--- a/Source/core/html/HTMLAnchorElement.h
+++ b/Source/core/html/HTMLAnchorElement.h
@@ -158,6 +158,22 @@
 bool isEnterKeyKeydownEvent(Event*);
 bool isLinkClick(Event*);
 
+inline bool isHTMLAnchorElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::aTag);
+}
+
+inline bool isHTMLAnchorElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::aTag);
+}
+
+inline HTMLAnchorElement* toHTMLAnchorElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLAnchorElement(node));
+    return static_cast<HTMLAnchorElement*>(node);
+}
+
 } // namespace WebCore
 
 #endif // HTMLAnchorElement_h
diff --git a/Source/core/html/HTMLAreaElement.cpp b/Source/core/html/HTMLAreaElement.cpp
index c298681..87ca99e 100644
--- a/Source/core/html/HTMLAreaElement.cpp
+++ b/Source/core/html/HTMLAreaElement.cpp
@@ -188,7 +188,7 @@
     if (!mapElement)
         return 0;
     
-    return static_cast<HTMLMapElement*>(mapElement)->imageElement();
+    return toHTMLMapElement(mapElement)->imageElement();
 }
 
 bool HTMLAreaElement::isKeyboardFocusable(KeyboardEvent*) const
diff --git a/Source/core/html/HTMLAreaElement.h b/Source/core/html/HTMLAreaElement.h
index 778e1e5..056758a 100644
--- a/Source/core/html/HTMLAreaElement.h
+++ b/Source/core/html/HTMLAreaElement.h
@@ -68,6 +68,22 @@
     Shape m_shape;
 };
 
+inline bool isHTMLAreaElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::areaTag);
+}
+
+inline bool isHTMLAreaElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::areaTag);
+}
+
+inline HTMLAreaElement* toHTMLAreaElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLAreaElement(node));
+    return static_cast<HTMLAreaElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLAttributeNames.in b/Source/core/html/HTMLAttributeNames.in
index 1dfbd91..cc3c0cd 100644
--- a/Source/core/html/HTMLAttributeNames.in
+++ b/Source/core/html/HTMLAttributeNames.in
@@ -210,6 +210,8 @@
 onloadedmetadata
 onloadstart
 onmousedown
+onmouseenter
+onmouseleave
 onmousemove
 onmouseout
 onmouseover
diff --git a/Source/core/html/HTMLBodyElement.cpp b/Source/core/html/HTMLBodyElement.cpp
index 7d5ac62..97fd499 100644
--- a/Source/core/html/HTMLBodyElement.cpp
+++ b/Source/core/html/HTMLBodyElement.cpp
@@ -100,20 +100,20 @@
     if (name == vlinkAttr || name == alinkAttr || name == linkAttr) {
         if (value.isNull()) {
             if (name == linkAttr)
-                document()->resetLinkColor();
+                document()->textLinkColors().resetLinkColor();
             else if (name == vlinkAttr)
-                document()->resetVisitedLinkColor();
+                document()->textLinkColors().resetVisitedLinkColor();
             else
-                document()->resetActiveLinkColor();
+                document()->textLinkColors().resetActiveLinkColor();
         } else {
             RGBA32 color;
             if (CSSParser::parseColor(color, value, !document()->inQuirksMode())) {
                 if (name == linkAttr)
-                    document()->setLinkColor(color);
+                    document()->textLinkColors().setLinkColor(color);
                 else if (name == vlinkAttr)
-                    document()->setVisitedLinkColor(color);
+                    document()->textLinkColors().setVisitedLinkColor(color);
                 else
-                    document()->setActiveLinkColor(color);
+                    document()->textLinkColors().setActiveLinkColor(color);
             }
         }
 
diff --git a/Source/core/html/HTMLButtonElement.cpp b/Source/core/html/HTMLButtonElement.cpp
index abbf43c..4ab7d19 100644
--- a/Source/core/html/HTMLButtonElement.cpp
+++ b/Source/core/html/HTMLButtonElement.cpp
@@ -33,7 +33,7 @@
 #include "core/html/FormDataList.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/rendering/RenderButton.h"
-#include <wtf/StdLibExtras.h>
+#include "wtf/StdLibExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index bd0a8fa..ddbe25a 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -72,7 +72,7 @@
     , m_size(DefaultWidth, DefaultHeight)
     , m_rendererIsCanvas(false)
     , m_ignoreReset(false)
-    , m_deviceScaleFactor(targetDeviceScaleFactor())
+    , m_deviceScaleFactor(1)
     , m_originClean(true)
     , m_hasCreatedImageBuffer(false)
     , m_didClearImageBuffer(false)
@@ -162,7 +162,7 @@
         if (!m_context) {
             m_context = CanvasRenderingContext2D::create(this, RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() ? static_cast<Canvas2DContextAttributes*>(attrs) : 0, document()->inQuirksMode());
             if (m_context)
-                setNeedsLayerUpdate();
+                scheduleLayerUpdate();
         }
         return m_context.get();
     }
@@ -184,7 +184,7 @@
             if (!m_context) {
                 m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(attrs));
                 if (m_context)
-                    setNeedsLayerUpdate();
+                    scheduleLayerUpdate();
             }
             return m_context.get();
         }
@@ -246,7 +246,7 @@
 
     IntSize oldSize = size();
     IntSize newSize(w, h);
-    float newDeviceScaleFactor = targetDeviceScaleFactor();
+    float newDeviceScaleFactor = 1;
 
     // If the size of an existing buffer matches, we can just clear it instead of reallocating.
     // This optimization is only done for 2D canvases for now.
@@ -280,15 +280,6 @@
         (*it)->canvasResized(this);
 }
 
-float HTMLCanvasElement::targetDeviceScaleFactor() const
-{
-#if ENABLE(HIGH_DPI_CANVAS)
-    return document()->frame() ? document()->frame()->page()->deviceScaleFactor() : 1;
-#else
-    return 1;
-#endif
-}
-
 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const
 {
     ASSERT(m_context);
@@ -379,7 +370,7 @@
 String HTMLCanvasElement::toDataURL(const String& mimeType, const double* quality, ExceptionCode& ec)
 {
     if (!m_originClean) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return String();
     }
 
@@ -502,12 +493,15 @@
     m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQuality);
     if (document()->settings() && !document()->settings()->antialiased2dCanvasEnabled())
         m_imageBuffer->context()->setShouldAntialias(false);
+    // GraphicsContext's defaults don't always agree with the 2d canvas spec.
+    // See CanvasRenderingContext2D::State::State() for more information.
+    m_imageBuffer->context()->setMiterLimit(10);
     m_imageBuffer->context()->setStrokeThickness(1);
     m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer->context()));
 
     // Recalculate compositing requirements if acceleration state changed.
     if (m_context && m_context->is2d())
-        setNeedsLayerUpdate();
+        scheduleLayerUpdate();
 }
 
 GraphicsContext* HTMLCanvasElement::drawingContext() const
diff --git a/Source/core/html/HTMLCanvasElement.h b/Source/core/html/HTMLCanvasElement.h
index 34bccfb..5d5557b 100644
--- a/Source/core/html/HTMLCanvasElement.h
+++ b/Source/core/html/HTMLCanvasElement.h
@@ -31,7 +31,7 @@
 #include "core/html/HTMLElement.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/IntSize.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 #define DefaultInterpolationQuality InterpolationMedium
 
@@ -78,7 +78,7 @@
 
     void setSize(const IntSize& newSize)
     { 
-        if (newSize == size() && targetDeviceScaleFactor() == m_deviceScaleFactor)
+        if (newSize == size() && m_deviceScaleFactor == 1)
             return;
         m_ignoreReset = true; 
         setWidth(newSize.width());
@@ -145,8 +145,6 @@
 
     void reset();
 
-    float targetDeviceScaleFactor() const;
-
     void createImageBuffer();
     void clearImageBuffer();
 
@@ -166,7 +164,7 @@
     bool m_accelerationDisabled;
     FloatRect m_dirtyRect;
 
-    float m_deviceScaleFactor;
+    float m_deviceScaleFactor; // FIXME: This is always 1 and should probable be deleted
     bool m_originClean;
 
     // m_createdImageBuffer means we tried to malloc the buffer.  We didn't necessarily get it.
@@ -179,6 +177,12 @@
     mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue).
 };
 
+inline HTMLCanvasElement* toHTMLCanvasElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::canvasTag));
+    return static_cast<HTMLCanvasElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLDialogElement.cpp b/Source/core/html/HTMLDialogElement.cpp
index 431099e..bdd1b6a 100644
--- a/Source/core/html/HTMLDialogElement.cpp
+++ b/Source/core/html/HTMLDialogElement.cpp
@@ -44,6 +44,7 @@
     : HTMLElement(tagName, document)
     , m_topIsValid(false)
     , m_top(0)
+    , m_returnValue("")
 {
     ASSERT(hasTagName(dialogTag));
     setHasCustomStyleCallbacks();
@@ -55,15 +56,18 @@
     return adoptRef(new HTMLDialogElement(tagName, document));
 }
 
-void HTMLDialogElement::close(ExceptionCode& ec)
+void HTMLDialogElement::close(const String& returnValue, ExceptionCode& ec)
 {
     if (!fastHasAttribute(openAttr)) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     setBooleanAttribute(openAttr, false);
     document()->removeFromTopLayer(this);
     m_topIsValid = false;
+
+    if (!returnValue.isNull())
+        m_returnValue = returnValue;
 }
 
 PassRefPtr<RenderStyle> HTMLDialogElement::customStyleForRenderer()
@@ -97,7 +101,7 @@
         m_top += (visibleHeight - box->height()) / 2;
     m_topIsValid = true;
 
-    setNeedsStyleRecalc(InlineStyleChange);
+    setNeedsStyleRecalc(LocalStyleChange);
 }
 
 void HTMLDialogElement::show()
@@ -111,7 +115,7 @@
 void HTMLDialogElement::showModal(ExceptionCode& ec)
 {
     if (fastHasAttribute(openAttr) || !inDocument()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     document()->addToTopLayer(this);
diff --git a/Source/core/html/HTMLDialogElement.h b/Source/core/html/HTMLDialogElement.h
index d840034..948b8d4 100644
--- a/Source/core/html/HTMLDialogElement.h
+++ b/Source/core/html/HTMLDialogElement.h
@@ -37,10 +37,13 @@
 public:
     static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document*);
 
-    void close(ExceptionCode&);
+    void close(const String& returnValue, ExceptionCode&);
     void show();
     void showModal(ExceptionCode&);
 
+    String returnValue() const { return m_returnValue; }
+    void setReturnValue(const String& returnValue) { m_returnValue = returnValue; }
+
 private:
     HTMLDialogElement(const QualifiedName&, Document*);
 
@@ -51,6 +54,7 @@
 
     bool m_topIsValid;
     LayoutUnit m_top;
+    String m_returnValue;
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/HTMLDialogElement.idl b/Source/core/html/HTMLDialogElement.idl
index 3fddf94..2cf7e38 100644
--- a/Source/core/html/HTMLDialogElement.idl
+++ b/Source/core/html/HTMLDialogElement.idl
@@ -27,7 +27,8 @@
     EnabledPerContext=dialogElement
 ] interface HTMLDialogElement : HTMLElement {
     [Reflect] attribute boolean open;
-    [RaisesException] void close();
+    attribute DOMString returnValue;
+    [RaisesException] void close([Default=NullString] optional DOMString returnValue);
     void show();
     [RaisesException] void showModal();
 };
diff --git a/Source/core/html/HTMLDimension.cpp b/Source/core/html/HTMLDimension.cpp
new file mode 100644
index 0000000..fb91fd1
--- /dev/null
+++ b/Source/core/html/HTMLDimension.cpp
@@ -0,0 +1,133 @@
+/*
+ * 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/HTMLDimension.h"
+
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+template <typename CharacterType>
+static Length parseDimension(const CharacterType* characters, size_t lastParsedIndex, size_t endOfCurrentToken)
+{
+    LengthType type = Fixed;
+    double value = 0.;
+
+    // HTML5's split removes leading and trailing spaces so we need to skip the leading spaces here.
+    while (lastParsedIndex < endOfCurrentToken && isASCIISpace((characters[lastParsedIndex])))
+        ++lastParsedIndex;
+
+    // This is Step 5.5. in the algorithm. Going to the last step would make the code less readable.
+    if (lastParsedIndex >= endOfCurrentToken)
+        return Length(value, Relative);
+
+    size_t position = lastParsedIndex;
+    while (position < endOfCurrentToken && isASCIIDigit(characters[position]))
+        ++position;
+
+    if (position > lastParsedIndex) {
+        bool ok = false;
+        unsigned integerValue = charactersToUIntStrict(characters + lastParsedIndex, position - lastParsedIndex, &ok);
+        ASSERT(ok);
+        value += integerValue;
+
+        if (position < endOfCurrentToken && characters[position] == '.') {
+            ++position;
+            size_t fractionStart = position;
+            Vector<CharacterType> fractionNumbers;
+            while (position < endOfCurrentToken && (isASCIIDigit(characters[position]) || isASCIISpace(characters[position]))) {
+                if (isASCIIDigit(characters[position]))
+                    fractionNumbers.append(characters[position]);
+                ++position;
+            }
+
+            if (fractionNumbers.size()) {
+                double fractionValue = charactersToUIntStrict(fractionNumbers.data(), fractionNumbers.size(), &ok);
+                ASSERT(ok);
+
+                value += fractionValue / pow(10., static_cast<double>(fractionNumbers.size()));
+            }
+        }
+    }
+
+    while (position < endOfCurrentToken && isASCIISpace(characters[position]))
+        ++position;
+
+    if (position < endOfCurrentToken) {
+        if (characters[position] == '*')
+            type = Relative;
+        else if (characters[position] == '%')
+            type = Percent;
+    }
+
+    return Length(value, type);
+}
+
+static Length parseDimension(const String& rawToken, size_t lastParsedIndex, size_t endOfCurrentToken)
+{
+    if (rawToken.is8Bit())
+        return parseDimension<LChar>(rawToken.characters8(), lastParsedIndex, endOfCurrentToken);
+    return parseDimension<UChar>(rawToken.characters16(), lastParsedIndex, endOfCurrentToken);
+}
+
+// This implements the "rules for parsing a list of dimensions" per HTML5.
+// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#rules-for-parsing-a-list-of-dimensions
+Vector<Length> parseListOfDimensions(const String& input)
+{
+    static const char comma = ',';
+
+    // Step 2. Remove the last character if it's a comma.
+    String trimmedString = input;
+    if (trimmedString.endsWith(comma))
+        trimmedString.truncate(trimmedString.length() - 1);
+
+    // HTML5's split doesn't return a token for an empty string so
+    // we need to match them here.
+    if (trimmedString.isEmpty())
+        return Vector<Length>();
+
+    // Step 3. To avoid String copies, we just look for commas instead of splitting.
+    Vector<Length> parsedLength;
+    size_t lastParsedIndex = 0;
+    while (true) {
+        size_t nextComma = trimmedString.find(comma, lastParsedIndex);
+        if (nextComma == notFound)
+            break;
+
+        parsedLength.append(parseDimension(trimmedString, lastParsedIndex, nextComma));
+        lastParsedIndex = nextComma + 1;
+    }
+
+    parsedLength.append(parseDimension(trimmedString, lastParsedIndex, trimmedString.length()));
+    return parsedLength;
+}
+
+} // namespace WebCore
diff --git a/Source/core/loader/FrameLoadRequest.cpp b/Source/core/html/HTMLDimension.h
similarity index 76%
copy from Source/core/loader/FrameLoadRequest.cpp
copy to Source/core/html/HTMLDimension.h
index 0ec26ba..0241d7a 100644
--- a/Source/core/loader/FrameLoadRequest.cpp
+++ b/Source/core/html/HTMLDimension.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,20 +28,20 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "core/loader/FrameLoadRequest.h"
+#ifndef HTMLDimension_h
+#define HTMLDimension_h
 
-#include "core/dom/Document.h"
-#include "core/page/Frame.h"
+// FIXME: Remove once we introduce HTMLDimension.
+#include "core/platform/Length.h"
+#include "wtf/Forward.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
-FrameLoadRequest::FrameLoadRequest(Frame* frame, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
-    : m_requester(frame->document()->securityOrigin())
-    , m_resourceRequest(resourceRequest)
-    , m_lockHistory(false)
-    , m_substituteData(substituteData)
-{
-}
+struct Length;
+
+Vector<Length> parseListOfDimensions(const String&);
 
 } // namespace WebCore
+
+#endif // HTMLDimension_h
diff --git a/Source/core/html/HTMLDocument.cpp b/Source/core/html/HTMLDocument.cpp
index a9ceaf4..90ccd0f 100644
--- a/Source/core/html/HTMLDocument.cpp
+++ b/Source/core/html/HTMLDocument.cpp
@@ -66,8 +66,8 @@
 
 using namespace HTMLNames;
 
-HTMLDocument::HTMLDocument(Frame* frame, const KURL& url, DocumentClassFlags extendedDocumentClasses)
-    : Document(frame, url, HTMLDocumentClass | extendedDocumentClasses)
+HTMLDocument::HTMLDocument(const DocumentInit& initializer, DocumentClassFlags extendedDocumentClasses)
+    : Document(initializer, HTMLDocumentClass | extendedDocumentClasses)
 {
     ScriptWrappable::init(this);
     clearXMLVersion();
@@ -111,8 +111,8 @@
 
 Element* HTMLDocument::activeElement()
 {
-    if (Node* node = treeScope()->focusedNode())
-        return node->isElementNode() ? toElement(node) : body();
+    if (Element* element = treeScope()->adjustedFocusedElement())
+        return element;
     return body();
 }
 
diff --git a/Source/core/html/HTMLDocument.h b/Source/core/html/HTMLDocument.h
index 82f46a3..369758a 100644
--- a/Source/core/html/HTMLDocument.h
+++ b/Source/core/html/HTMLDocument.h
@@ -35,9 +35,9 @@
 
 class HTMLDocument : public Document, public CachedResourceClient {
 public:
-    static PassRefPtr<HTMLDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<HTMLDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new HTMLDocument(frame, url));
+        return adoptRef(new HTMLDocument(initializer));
     }
     virtual ~HTMLDocument();
 
@@ -74,7 +74,7 @@
     static bool isCaseSensitiveAttribute(const QualifiedName&);
 
 protected:
-    HTMLDocument(Frame*, const KURL&, DocumentClassFlags extendedDocumentClasses = DefaultDocumentClass);
+    HTMLDocument(const DocumentInit&, DocumentClassFlags extendedDocumentClasses = DefaultDocumentClass);
 
 private:
     HTMLBodyElement* bodyAsHTMLBodyElement() const;
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index 44c6176..54a2bbb 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -51,8 +51,8 @@
 #include "core/page/Frame.h"
 #include "core/page/Settings.h"
 #include "core/rendering/RenderWordBreak.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/CString.h"
 
 namespace WebCore {
 
@@ -204,6 +204,8 @@
         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);
@@ -336,7 +338,7 @@
 {
     Node* p = parentNode();
     if (!p || !p->isHTMLElement()) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return;
     }
     RefPtr<HTMLElement> parent = toHTMLElement(p);
@@ -392,14 +394,14 @@
 void HTMLElement::setInnerText(const String& text, ExceptionCode& ec)
 {
     if (ieForbidsInsertHTML()) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return;
     }
     if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
         hasLocalName(headTag) || hasLocalName(htmlTag) || hasLocalName(tableTag) || 
         hasLocalName(tbodyTag) || hasLocalName(tfootTag) || hasLocalName(theadTag) ||
         hasLocalName(trTag)) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return;
     }
 
@@ -440,20 +442,20 @@
 void HTMLElement::setOuterText(const String &text, ExceptionCode& ec)
 {
     if (ieForbidsInsertHTML()) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return;
     }
     if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
         hasLocalName(headTag) || hasLocalName(htmlTag) || hasLocalName(tableTag) || 
         hasLocalName(tbodyTag) || hasLocalName(tfootTag) || hasLocalName(theadTag) ||
         hasLocalName(trTag)) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return;
     }
 
     ContainerNode* parent = parentNode();
     if (!parent) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return;
     }
 
@@ -469,7 +471,7 @@
         newChild = Text::create(document(), text);
 
     if (!this || !parentNode())
-        ec = HIERARCHY_REQUEST_ERR;
+        ec = HierarchyRequestError;
     if (ec)
         return;
     parent->replaceChild(newChild.release(), this, ec);
@@ -492,23 +494,35 @@
     // Opera also appears to disallow such usage.
 
     if (equalIgnoringCase(where, "beforeBegin")) {
-        ContainerNode* parent = this->parentNode();
-        return (parent && parent->insertBefore(newChild, this, ec)) ? newChild : 0;
+        if (ContainerNode* parent = this->parentNode()) {
+            parent->insertBefore(newChild, this, ec, AttachLazily);
+            if (!ec)
+                return newChild;
+        }
+        return 0;
     }
 
-    if (equalIgnoringCase(where, "afterBegin"))
-        return insertBefore(newChild, firstChild(), ec) ? newChild : 0;
+    if (equalIgnoringCase(where, "afterBegin")) {
+        insertBefore(newChild, firstChild(), ec, AttachLazily);
+        return ec ? 0 : newChild;
+    }
 
-    if (equalIgnoringCase(where, "beforeEnd"))
-        return appendChild(newChild, ec) ? newChild : 0;
+    if (equalIgnoringCase(where, "beforeEnd")) {
+        appendChild(newChild, ec, AttachLazily);
+        return ec ? 0 : newChild;
+    }
 
     if (equalIgnoringCase(where, "afterEnd")) {
-        ContainerNode* parent = this->parentNode();
-        return (parent && parent->insertBefore(newChild, nextSibling(), ec)) ? newChild : 0;
+        if (ContainerNode* parent = this->parentNode()) {
+            parent->insertBefore(newChild, nextSibling(), ec, AttachLazily);
+            if (!ec)
+                return newChild;
+        }
+        return 0;
     }
     
     // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
-    ec = NOT_SUPPORTED_ERR;
+    ec = NotSupportedError;
     return 0;
 }
 
@@ -516,12 +530,11 @@
 {
     if (!newChild) {
         // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return 0;
     }
 
     Node* returnValue = insertAdjacent(where, newChild, ec);
-    ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || returnValue->isElementNode());
     return toElement(returnValue); 
 }
 
@@ -531,15 +544,14 @@
     if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) {
         ContainerNode* parent = element->parentNode();
         if (parent && !parent->isElementNode()) {
-            ec = NO_MODIFICATION_ALLOWED_ERR;
+            ec = NoModificationAllowedError;
             return 0;
         }
-        ASSERT_WITH_SECURITY_IMPLICATION(!parent || parent->isElementNode());
         return toElement(parent);
     }
     if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd"))
         return element;
-    ec =  SYNTAX_ERR;
+    ec =  SyntaxError;
     return 0;
 }
 
@@ -655,7 +667,7 @@
     else if (equalIgnoringCase(enabled, "inherit"))
         removeAttribute(contenteditableAttr);
     else
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
 }
 
 bool HTMLElement::draggable() const
diff --git a/Source/core/html/HTMLFieldSetElement.cpp b/Source/core/html/HTMLFieldSetElement.cpp
index 21a386b..c79aa6c 100644
--- a/Source/core/html/HTMLFieldSetElement.cpp
+++ b/Source/core/html/HTMLFieldSetElement.cpp
@@ -31,7 +31,7 @@
 #include "core/html/HTMLLegendElement.h"
 #include "core/html/HTMLObjectElement.h"
 #include "core/rendering/RenderFieldset.h"
-#include <wtf/StdLibExtras.h>
+#include "wtf/StdLibExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLFontElement.cpp b/Source/core/html/HTMLFontElement.cpp
index 9a11a69..3eaaf9d 100644
--- a/Source/core/html/HTMLFontElement.cpp
+++ b/Source/core/html/HTMLFontElement.cpp
@@ -30,7 +30,7 @@
 #include "core/css/CSSValuePool.h"
 #include "core/css/StylePropertySet.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 using namespace WTF;
 
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
index 6fc0026..0e79cdd 100644
--- a/Source/core/html/HTMLFormControlElement.cpp
+++ b/Source/core/html/HTMLFormControlElement.cpp
@@ -31,12 +31,13 @@
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLLegendElement.h"
+#include "core/html/HTMLTextAreaElement.h"
 #include "core/html/ValidationMessage.h"
 #include "core/html/ValidityState.h"
 #include "core/page/UseCounter.h"
 #include "core/rendering/RenderBox.h"
 #include "core/rendering/RenderTheme.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -192,7 +193,7 @@
         return true;
     if (element->hasTagName(buttonTag))
         return true;
-    if (element->hasTagName(textareaTag))
+    if (isHTMLTextAreaElement(element))
         return true;
 
     return false;
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index e9988d1..ce3447a 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -41,10 +41,12 @@
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLInputElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/loader/FormState.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/page/Frame.h"
+#include "core/page/UseCounter.h"
 #include "core/rendering/RenderTextControl.h"
 
 using namespace std;
@@ -70,11 +72,13 @@
 
 PassRefPtr<HTMLFormElement> HTMLFormElement::create(Document* document)
 {
+    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);
     return adoptRef(new HTMLFormElement(tagName, document));
 }
 
@@ -101,7 +105,7 @@
     ContainerNode* node = parentNode();
     RenderObject* parentRenderer = node->renderer();
     // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| below).
-    bool parentIsTableElementPart = (parentRenderer->isTable() && node->hasTagName(tableTag))
+    bool parentIsTableElementPart = (parentRenderer->isTable() && isHTMLTableElement(node))
         || (parentRenderer->isTableRow() && node->hasTagName(trTag))
         || (parentRenderer->isTableSection() && node->hasTagName(tbodyTag))
         || (parentRenderer->isRenderTableCol() && node->hasTagName(colTag))
@@ -730,4 +734,11 @@
     returnValue0 = NamedNodesCollection::create(elements);
 }
 
+void HTMLFormElement::setDemoted(bool demoted)
+{
+    if (demoted)
+        UseCounter::count(document(), UseCounter::DemotedFormElement);
+    m_wasDemoted = demoted;
+}
+
 } // namespace
diff --git a/Source/core/html/HTMLFormElement.h b/Source/core/html/HTMLFormElement.h
index d745ea2..c3fd077 100644
--- a/Source/core/html/HTMLFormElement.h
+++ b/Source/core/html/HTMLFormElement.h
@@ -29,7 +29,7 @@
 #include "core/html/HTMLFormControlElement.h"
 #include "core/loader/FormState.h"
 #include "core/loader/FormSubmission.h"
-#include <wtf/OwnPtr.h>
+#include "wtf/OwnPtr.h"
 
 namespace WTF{
 class TextEncoding;
@@ -76,7 +76,7 @@
     void submitFromJavaScript();
     void reset();
 
-    void setDemoted(bool demoted) { m_wasDemoted = demoted; }
+    void setDemoted(bool);
 
     void submitImplicitly(Event*, bool fromImplicitSubmissionTrigger);
     bool formWouldHaveSecureSubmission(const String& url);
diff --git a/Source/core/html/HTMLFrameOwnerElement.cpp b/Source/core/html/HTMLFrameOwnerElement.cpp
index ff37aad..779e19c 100644
--- a/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -114,7 +114,7 @@
     if (doc && doc->isSVGDocument())
         return toSVGDocument(doc);
     // Spec: http://www.w3.org/TR/SVG/struct.html#InterfaceGetSVGDocument
-    ec = NOT_SUPPORTED_ERR;
+    ec = NotSupportedError;
     return 0;
 }
 
diff --git a/Source/core/html/HTMLFrameSetElement.cpp b/Source/core/html/HTMLFrameSetElement.cpp
index 6ae06a4..02d929f 100644
--- a/Source/core/html/HTMLFrameSetElement.cpp
+++ b/Source/core/html/HTMLFrameSetElement.cpp
@@ -33,10 +33,10 @@
 #include "core/dom/MouseEvent.h"
 #include "core/dom/NodeRenderingContext.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/platform/Length.h"
 #include "core/rendering/RenderFrameSet.h"
 
 namespace WebCore {
@@ -81,12 +81,12 @@
 {
     if (name == rowsAttr) {
         if (!value.isNull()) {
-            m_rowLengths = parseFrameSetListOfDimensions(value.string());
+            m_rowLengths = parseListOfDimensions(value.string());
             setNeedsStyleRecalc();
         }
     } else if (name == colsAttr) {
         if (!value.isNull()) {
-            m_colLengths = parseFrameSetListOfDimensions(value.string());
+            m_colLengths = parseListOfDimensions(value.string());
             setNeedsStyleRecalc();
         }
     } else if (name == frameborderAttr) {
diff --git a/Source/core/html/HTMLHtmlElement.h b/Source/core/html/HTMLHtmlElement.h
index 6ac6ed4..3dad999 100644
--- a/Source/core/html/HTMLHtmlElement.h
+++ b/Source/core/html/HTMLHtmlElement.h
@@ -41,6 +41,22 @@
     virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
 };
 
+inline bool isHTMLHtmlElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::htmlTag);
+}
+
+inline bool isHTMLHtmlElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::htmlTag);
+}
+
+inline HTMLHtmlElement* toHTMLHtmlElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLHtmlElement(node));
+    return static_cast<HTMLHtmlElement*>(node);
+}
+
 } // namespace
 
 #endif
diff --git a/Source/core/html/HTMLIFrameElement.h b/Source/core/html/HTMLIFrameElement.h
index ac821c2..9aa74ae 100644
--- a/Source/core/html/HTMLIFrameElement.h
+++ b/Source/core/html/HTMLIFrameElement.h
@@ -56,6 +56,12 @@
     bool m_didLoadNonEmptyDocument;
 };
 
+inline HTMLIFrameElement* toHTMLIFrameElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::iframeTag));
+    return static_cast<HTMLIFrameElement*>(node);
+}
+
 } // namespace WebCore
 
 #endif // HTMLIFrameElement_h
diff --git a/Source/core/html/HTMLImageElement.h b/Source/core/html/HTMLImageElement.h
index d0186c4..590029b 100644
--- a/Source/core/html/HTMLImageElement.h
+++ b/Source/core/html/HTMLImageElement.h
@@ -32,7 +32,7 @@
 
 class HTMLFormElement;
 
-class HTMLImageElement : public HTMLElement {
+class HTMLImageElement FINAL : public HTMLElement {
     friend class HTMLFormElement;
 public:
     static PassRefPtr<HTMLImageElement> create(Document*);
diff --git a/Source/core/html/HTMLImageLoader.cpp b/Source/core/html/HTMLImageLoader.cpp
index a6d9042..bf89f1f 100644
--- a/Source/core/html/HTMLImageLoader.cpp
+++ b/Source/core/html/HTMLImageLoader.cpp
@@ -27,6 +27,7 @@
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
 #include "core/html/HTMLObjectElement.h"
+#include "core/html/HTMLVideoElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/loader/cache/CachedImage.h"
 
@@ -44,7 +45,7 @@
 void HTMLImageLoader::dispatchLoadEvent()
 {
     // HTMLVideoElement uses this class to load the poster image, but it should not fire events for loading or failure.
-    if (element()->hasTagName(HTMLNames::videoTag))
+    if (isHTMLVideoElement(element()))
         return;
 
     bool errorOccurred = image()->errorOccurred();
diff --git a/Source/core/loader/FrameLoadRequest.cpp b/Source/core/html/HTMLImport.cpp
similarity index 77%
rename from Source/core/loader/FrameLoadRequest.cpp
rename to Source/core/html/HTMLImport.cpp
index 0ec26ba..8e349be 100644
--- a/Source/core/loader/FrameLoadRequest.cpp
+++ b/Source/core/html/HTMLImport.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,19 +29,17 @@
  */
 
 #include "config.h"
-#include "core/loader/FrameLoadRequest.h"
+#include "core/html/HTMLImport.h"
 
-#include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#include "core/html/HTMLImportsController.h"
 
 namespace WebCore {
 
-FrameLoadRequest::FrameLoadRequest(Frame* frame, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
-    : m_requester(frame->document()->securityOrigin())
-    , m_resourceRequest(resourceRequest)
-    , m_lockHistory(false)
-    , m_substituteData(substituteData)
+bool HTMLImport::haveChildrenLoaded()
 {
+    if (HTMLImportsController* controller = this->controller())
+        return controller->haveChildrenLoaded(this);
+    return true;
 }
 
 } // namespace WebCore
diff --git a/Source/core/loader/FrameLoadRequest.cpp b/Source/core/html/HTMLImport.h
similarity index 76%
copy from Source/core/loader/FrameLoadRequest.cpp
copy to Source/core/html/HTMLImport.h
index 0ec26ba..afcec17 100644
--- a/Source/core/loader/FrameLoadRequest.cpp
+++ b/Source/core/html/HTMLImport.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,20 +28,26 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "core/loader/FrameLoadRequest.h"
-
-#include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#ifndef HTMLImport_h
+#define HTMLImport_h
 
 namespace WebCore {
 
-FrameLoadRequest::FrameLoadRequest(Frame* frame, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
-    : m_requester(frame->document()->securityOrigin())
-    , m_resourceRequest(resourceRequest)
-    , m_lockHistory(false)
-    , m_substituteData(substituteData)
-{
-}
+class Document;
+class HTMLImportsController;
+
+class HTMLImport {
+public:
+    virtual ~HTMLImport() { }
+
+    bool haveChildrenLoaded();
+
+    virtual HTMLImportsController* controller() = 0;
+    virtual HTMLImport* parent() = 0;
+    virtual Document* document() = 0;
+    virtual void wasDetachedFromDocument() = 0;
+};
 
 } // namespace WebCore
+
+#endif // HTMLImport_h
diff --git a/Source/core/html/HTMLImportsController.cpp b/Source/core/html/HTMLImportsController.cpp
index 3f59c55..68d4b6b 100644
--- a/Source/core/html/HTMLImportsController.cpp
+++ b/Source/core/html/HTMLImportsController.cpp
@@ -34,6 +34,8 @@
 #include "core/dom/Document.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLLinkElement.h"
+#include "core/loader/CrossOriginAccessControl.h"
+#include "core/loader/DocumentWriter.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedScript.h"
 #include "weborigin/SecurityOrigin.h"
@@ -68,28 +70,27 @@
     if (!m_owner)
         return;
 
-    // FIXME(morrita): Should take care of sub-imports whose document doesn't have frame.
-    if (!m_owner->document()->frame() && !m_owner->document()->imports())
+    if (!m_owner->document()->frame() && !m_owner->document()->import())
         return;
 
     LinkRequestBuilder builder(m_owner);
     if (!builder.isValid())
         return;
 
-    HTMLImportsController* controller = m_owner->document()->imports();
-    if (!controller) {
+    if (!m_owner->document()->import()) {
         ASSERT(m_owner->document()->frame()); // The document should be the master.
-        m_owner->document()->setImports(HTMLImportsController::create(m_owner->document()));
-        controller = m_owner->document()->imports();
+        HTMLImportsController::provideTo(m_owner->document());
     }
 
+    HTMLImportsController* controller = m_owner->document()->import()->controller();
     if (RefPtr<HTMLImportLoader> found = controller->findLinkFor(builder.url())) {
         m_loader = found;
         return;
     }
 
     CachedResourceRequest request = builder.build(true);
-    CachedResourceHandle<CachedScript> resource = controller->cachedResourceLoader()->requestScript(request);
+    request.setPotentiallyCrossOriginEnabled(controller->securityOrigin(), DoNotAllowStoredCredentials);
+    CachedResourceHandle<CachedRawResource> resource = controller->cachedResourceLoader()->requestRawResource(request);
     if (!resource)
         return;
 
@@ -103,15 +104,15 @@
 }
 
 
-PassRefPtr<HTMLImportLoader> HTMLImportLoader::create(HTMLImportsController* controller, const KURL& url, const CachedResourceHandle<CachedScript>& resource)
+PassRefPtr<HTMLImportLoader> HTMLImportLoader::create(HTMLImport* parent, const KURL& url, const CachedResourceHandle<CachedScript>& resource)
 {
-    RefPtr<HTMLImportLoader> loader = adoptRef(new HTMLImportLoader(controller, url, resource));
-    controller->addImport(loader);
-    return loader;
+    RefPtr<HTMLImportLoader> loader = adoptRef(new HTMLImportLoader(parent, url, resource));
+    loader->controller()->addImport(loader);
+    return loader.release();
 }
 
-HTMLImportLoader::HTMLImportLoader(HTMLImportsController* controller, const KURL& url, const CachedResourceHandle<CachedScript>& resource)
-    : m_controller(controller)
+HTMLImportLoader::HTMLImportLoader(HTMLImport* parent, const KURL& url, const CachedResourceHandle<CachedScript>& resource)
+    : m_parent(parent)
     , m_state(StateLoading)
     , m_resource(resource)
     , m_url(url)
@@ -121,10 +122,24 @@
 
 HTMLImportLoader::~HTMLImportLoader()
 {
+    // importDestroyed() should be called before the destruction.
+    ASSERT(!m_parent);
+    ASSERT(!m_importedDocument);
     if (m_resource)
         m_resource->removeClient(this);
 }
 
+void HTMLImportLoader::responseReceived(CachedResource*, const ResourceResponse& response)
+{
+    setState(startParsing(response));
+}
+
+void HTMLImportLoader::dataReceived(CachedResource*, const char* data, int length)
+{
+    RefPtr<DocumentWriter> protectingWriter(m_writer);
+    m_writer->addData(data, length);
+}
+
 void HTMLImportLoader::notifyFinished(CachedResource*)
 {
     setState(finish());
@@ -134,32 +149,50 @@
 {
     if (m_state == state)
         return;
+
     m_state = state;
 
-    if ((m_state == StateReady  || m_state == StateError) && m_controller)
-        m_controller->didLoad();
+    if (m_state == StateReady || m_state == StateError)
+        dispose();
+}
+
+void HTMLImportLoader::dispose()
+{
+    if (m_writer) {
+        m_writer->end();
+        m_writer.clear();
+    }
+
+    if (m_resource) {
+        m_resource->removeClient(this);
+        m_resource = 0;
+    }
+
+
+    if (HTMLImportsController* controller = this->controller())
+        controller->didLoad(this);
+}
+
+HTMLImportLoader::State HTMLImportLoader::startParsing(const ResourceResponse& response)
+{
+    // Current canAccess() implementation isn't sufficient for catching cross-domain redirects: http://crbug.com/256976
+    if (!controller()->cachedResourceLoader()->canAccess(m_resource.get()))
+        return StateError;
+
+    m_importedDocument = HTMLDocument::create(DocumentInit(response.url(), 0, this));
+    m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeType(), response.textEncodingName());
+
+    return StateLoading;
 }
 
 HTMLImportLoader::State HTMLImportLoader::finish()
 {
-    if (!m_controller)
+    if (!m_parent)
         return StateError;
-
-    if (m_resource->loadFailedOrCanceled())
+    // The writer instance indicates that a part of the document can be already loaded.
+    // We don't take such a case as an error because the partially-loaded document has been visible from script at this point.
+    if (m_resource->loadFailedOrCanceled() && !m_writer)
         return StateError;
-
-    String error;
-    if (!m_controller->securityOrigin()->canRequest(m_resource->response().url())
-        && !m_resource->passesAccessControlCheck(m_controller->securityOrigin(), error)) {
-        m_controller->showSecurityErrorMessage("Import from origin '" + SecurityOrigin::create(m_resource->response().url())->toString() + "' has been blocked from loading by Cross-Origin Resource Sharing policy: " + error);
-        return StateError;
-    }
-
-    // FIXME(morrita): This should be done in incremental way.
-    m_importedDocument = HTMLDocument::create(0, m_resource->response().url());
-    m_importedDocument->setImports(m_controller);
-    m_importedDocument->setContent(m_resource->script());
-
     return StateReady;
 }
 
@@ -172,14 +205,39 @@
 
 void HTMLImportLoader::importDestroyed()
 {
-    m_controller = 0;
-    m_importedDocument.clear();
+    m_parent = 0;
+    if (RefPtr<Document> document = m_importedDocument.release())
+        document->setImport(0);
 }
 
-
-PassRefPtr<HTMLImportsController> HTMLImportsController::create(Document* master)
+HTMLImportsController* HTMLImportLoader::controller()
 {
-    return adoptRef(new HTMLImportsController(master));
+    return m_parent ? m_parent->controller() : 0;
+}
+
+HTMLImport* HTMLImportLoader::parent()
+{
+    return m_parent;
+}
+
+Document* HTMLImportLoader::document()
+{
+    return m_importedDocument.get();
+}
+
+void HTMLImportLoader::wasDetachedFromDocument()
+{
+    // For imported documens this shouldn't be called because Document::m_import is
+    // cleared before Document is destroyed by HTMLImportLoader::importDestroyed().
+    ASSERT_NOT_REACHED();
+}
+
+void HTMLImportsController::provideTo(Document* master)
+{
+    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());
 }
 
 HTMLImportsController::HTMLImportsController(Document* master)
@@ -189,8 +247,16 @@
 
 HTMLImportsController::~HTMLImportsController()
 {
+    ASSERT(!m_master);
+}
+
+void HTMLImportsController::clear()
+{
     for (size_t i = 0; i < m_imports.size(); ++i)
         m_imports[i]->importDestroyed();
+    if (m_master)
+        m_master->setImport(0);
+    m_master = 0;
 }
 
 void HTMLImportsController::addImport(PassRefPtr<HTMLImportLoader> link)
@@ -204,10 +270,12 @@
     m_master->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
 }
 
-void HTMLImportsController::didLoad()
+void HTMLImportsController::didLoad(HTMLImportLoader* loadedImport)
 {
-    if (haveLoaded())
-        m_master->didLoadAllImports();
+    for (HTMLImport* ancestorToNotify = loadedImport->parent(); ancestorToNotify; ancestorToNotify = ancestorToNotify->parent()) {
+        if (haveChildrenLoaded(ancestorToNotify))
+            ancestorToNotify->document()->didLoadAllImports();
+    }
 }
 
 PassRefPtr<HTMLImportLoader> HTMLImportsController::findLinkFor(const KURL& url) const
@@ -230,14 +298,34 @@
     return m_master->cachedResourceLoader();
 }
 
-bool HTMLImportsController::haveLoaded() const
+bool HTMLImportsController::haveChildrenLoaded(HTMLImport* parent) const
 {
     for (size_t i = 0; i < m_imports.size(); ++i) {
-        if (!m_imports[i]->isDone())
+        if (!m_imports[i]->isDone() && m_imports[i]->parent() == parent)
             return false;
     }
 
     return true;
 }
 
+HTMLImportsController* HTMLImportsController::controller()
+{
+    return this;
+}
+
+HTMLImport* HTMLImportsController::parent()
+{
+    return 0;
+}
+
+Document* HTMLImportsController::document()
+{
+    return m_master;
+}
+
+void HTMLImportsController::wasDetachedFromDocument()
+{
+    clear();
+}
+
 } // namespace WebCore
diff --git a/Source/core/html/HTMLImportsController.h b/Source/core/html/HTMLImportsController.h
index fd1ecc3..28765f1 100644
--- a/Source/core/html/HTMLImportsController.h
+++ b/Source/core/html/HTMLImportsController.h
@@ -31,18 +31,22 @@
 #ifndef HTMLImportsController_h
 #define HTMLImportsController_h
 
+#include "core/html/HTMLImport.h"
 #include "core/html/LinkResource.h"
-#include "core/loader/cache/CachedResourceClient.h"
+#include "core/loader/cache/CachedRawResource.h"
 #include "core/loader/cache/CachedResourceHandle.h"
+#include "core/platform/Supplementable.h"
 #include "wtf/FastAllocBase.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
 
+class ScriptExecutionContext;
 class CachedResourceLoader;
 class HTMLImportLoader;
 class HTMLImportsController;
+class DocumentWriter;
 
 //
 // A LinkResource subclasss used for @rel=import.
@@ -67,8 +71,7 @@
     RefPtr<HTMLImportLoader> m_loader;
 };
 
-
-class HTMLImportLoader : public RefCounted<HTMLImportLoader>, public CachedResourceClient {
+class HTMLImportLoader : public RefCounted<HTMLImportLoader>, public HTMLImport, public CachedRawResourceClient {
 public:
     enum State {
         StateLoading,
@@ -76,7 +79,7 @@
         StateReady
     };
 
-    static PassRefPtr<HTMLImportLoader> create(HTMLImportsController*, const KURL&, const CachedResourceHandle<CachedScript>&);
+    static PassRefPtr<HTMLImportLoader> create(HTMLImport* parent, const KURL&, const CachedResourceHandle<CachedScript>&);
     virtual ~HTMLImportLoader();
 
     Document* importedDocument() const;
@@ -85,40 +88,58 @@
     void importDestroyed();
     bool isDone() const { return m_state == StateReady || m_state == StateError; }
 
-private:
-    HTMLImportLoader(HTMLImportsController*, const KURL&, const CachedResourceHandle<CachedScript>&);
+    // HTMLImport
+    virtual HTMLImportsController* controller() OVERRIDE;
+    virtual HTMLImport* parent() OVERRIDE;
+    virtual Document* document() OVERRIDE;
+    virtual void wasDetachedFromDocument() OVERRIDE;
 
-    // CachedResourceClient
+private:
+    HTMLImportLoader(HTMLImport*, const KURL&, const CachedResourceHandle<CachedScript>&);
+
+    // CachedRawResourceClient
+    virtual void responseReceived(CachedResource*, const ResourceResponse&) OVERRIDE;
+    virtual void dataReceived(CachedResource*, const char* data, int length) OVERRIDE;
     virtual void notifyFinished(CachedResource*) OVERRIDE;
 
+    State startParsing(const ResourceResponse&);
     State finish();
     void setState(State);
+    void dispose();
 
-    HTMLImportsController* m_controller;
+    HTMLImport* m_parent;
     State m_state;
     KURL m_url;
-    CachedResourceHandle<CachedScript> m_resource;
+    CachedResourceHandle<CachedRawResource> m_resource;
     RefPtr<Document> m_importedDocument;
+    RefPtr<DocumentWriter> m_writer;
 };
 
-
-class HTMLImportsController : public RefCounted<HTMLImportsController> {
+class HTMLImportsController : public HTMLImport, public Supplement<ScriptExecutionContext> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<HTMLImportsController> create(Document*);
+    static void provideTo(Document*);
 
     explicit HTMLImportsController(Document*);
     virtual ~HTMLImportsController();
 
+    // HTMLImport
+    virtual HTMLImportsController* controller() OVERRIDE;
+    virtual HTMLImport* parent() OVERRIDE;
+    virtual Document* document() OVERRIDE;
+    virtual void wasDetachedFromDocument() OVERRIDE;
+
     void addImport(PassRefPtr<HTMLImportLoader>);
     void showSecurityErrorMessage(const String&);
     PassRefPtr<HTMLImportLoader> findLinkFor(const KURL&) const;
     SecurityOrigin* securityOrigin() const;
     CachedResourceLoader* cachedResourceLoader() const;
-    bool haveLoaded() const;
-    void didLoad();
+    bool haveChildrenLoaded(HTMLImport* parent) const;
+    void didLoad(HTMLImportLoader*);
 
 private:
+    void clear();
+
     Document* m_master;
 
     // List of import which has been loaded or being loaded.
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index de999dd..e8e8e7c 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -204,6 +204,11 @@
 }
 #endif
 
+HTMLElement* HTMLInputElement::passwordGeneratorButtonElement() const
+{
+    return m_inputType->passwordGeneratorButtonElement();
+}
+
 HTMLElement* HTMLInputElement::sliderThumbElement() const
 {
     return m_inputType->sliderThumbElement();
@@ -553,7 +558,7 @@
 int HTMLInputElement::selectionStartForBinding(ExceptionCode& ec) const
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
     return HTMLTextFormControlElement::selectionStart();
@@ -562,7 +567,7 @@
 int HTMLInputElement::selectionEndForBinding(ExceptionCode& ec) const
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
     return HTMLTextFormControlElement::selectionEnd();
@@ -571,7 +576,7 @@
 String HTMLInputElement::selectionDirectionForBinding(ExceptionCode& ec) const
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return String();
     }
     return HTMLTextFormControlElement::selectionDirection();
@@ -580,7 +585,7 @@
 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionCode& ec)
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     HTMLTextFormControlElement::setSelectionStart(start);
@@ -589,7 +594,7 @@
 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionCode& ec)
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     HTMLTextFormControlElement::setSelectionEnd(end);
@@ -598,7 +603,7 @@
 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionCode& ec)
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     HTMLTextFormControlElement::setSelectionDirection(direction);
@@ -607,7 +612,7 @@
 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, ExceptionCode& ec)
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     HTMLTextFormControlElement::setSelectionRange(start, end);
@@ -616,7 +621,7 @@
 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionCode& ec)
 {
     if (!canHaveSelection()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     HTMLTextFormControlElement::setSelectionRange(start, end, direction);
@@ -1027,7 +1032,7 @@
 void HTMLInputElement::setValue(const String& value, ExceptionCode& ec, TextFieldEventBehavior eventBehavior)
 {
     if (isFileUpload() && !value.isEmpty()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     setValue(value, eventBehavior);
@@ -1079,7 +1084,7 @@
 void HTMLInputElement::setValueAsNumber(double newValue, ExceptionCode& ec, TextFieldEventBehavior eventBehavior)
 {
     if (!std::isfinite(newValue)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     m_inputType->setValueAsDouble(newValue, eventBehavior, ec);
@@ -1317,7 +1322,7 @@
 void HTMLInputElement::setMaxLength(int maxLength, ExceptionCode& ec)
 {
     if (maxLength < 0)
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
     else
         setAttribute(maxlengthAttr, String::number(maxLength));
 }
@@ -1335,7 +1340,7 @@
 void HTMLInputElement::setSize(unsigned size, ExceptionCode& ec)
 {
     if (!size)
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
     else
         setSize(size);
 }
@@ -1739,26 +1744,22 @@
 }
 
 #if ENABLE(MEDIA_CAPTURE)
-String HTMLInputElement::capture() const
+bool HTMLInputElement::capture() const
 {
-    if (!isFileUpload())
-        return String();
+    if (!isFileUpload() || !fastHasAttribute(captureAttr))
+        return false;
 
-    String capture = fastGetAttribute(captureAttr).lower();
-    if (capture == "camera"
-        || capture == "camcorder"
-        || capture == "microphone"
-        || capture == "filesystem")
-        return capture;
+    // As per crbug.com/240252, emit a deprecation warning when the "capture"
+    // attribute is used as an enum. The spec has been updated and "capture" is
+    // supposed to be used as a boolean.
+    bool hasDeprecatedUsage = !fastGetAttribute(captureAttr).isNull();
+    if (hasDeprecatedUsage)
+        UseCounter::countDeprecation(document(), UseCounter::CaptureAttributeAsEnum);
+    else
+        UseCounter::count(document(), UseCounter::CaptureAttributeAsEnum);
 
-    return "filesystem";
+    return true;
 }
-
-void HTMLInputElement::setCapture(const String& value)
-{
-    setAttribute(captureAttr, value);
-}
-
 #endif
 
 bool HTMLInputElement::isInRequiredRadioButtonGroup()
@@ -1838,7 +1839,7 @@
 void HTMLInputElement::setRangeText(const String& replacement, ExceptionCode& ec)
 {
     if (!m_inputType->supportsSelectionAPI()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -1848,7 +1849,7 @@
 void HTMLInputElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec)
 {
     if (!m_inputType->supportsSelectionAPI()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -1909,6 +1910,11 @@
     info.addMember(m_listAttributeTargetObserver, "listAttributeTargetObserver");
 }
 
+bool HTMLInputElement::supportsInputModeAttribute() const
+{
+    return m_inputType->supportsInputModeAttribute();
+}
+
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
 {
diff --git a/Source/core/html/HTMLInputElement.h b/Source/core/html/HTMLInputElement.h
index 80fc77d..e790c4b 100644
--- a/Source/core/html/HTMLInputElement.h
+++ b/Source/core/html/HTMLInputElement.h
@@ -128,6 +128,7 @@
 #endif
     HTMLElement* sliderThumbElement() const;
     HTMLElement* sliderTrackElement() const;
+    HTMLElement* passwordGeneratorButtonElement() const;
     virtual HTMLElement* placeholderElement() const;
 
     bool checked() const { return m_isChecked; }
@@ -260,8 +261,7 @@
     String defaultToolTip() const;
 
 #if ENABLE(MEDIA_CAPTURE)
-    String capture() const;
-    void setCapture(const String& value);
+    bool capture() const;
 #endif
 
     static const int maximumLength;
@@ -291,6 +291,8 @@
     bool setupDateTimeChooserParameters(DateTimeChooserParameters&);
     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
 
+    bool supportsInputModeAttribute() const;
+
 protected:
     HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
 
diff --git a/Source/core/html/HTMLInputElement.idl b/Source/core/html/HTMLInputElement.idl
index 42d3347..b4db40f 100644
--- a/Source/core/html/HTMLInputElement.idl
+++ b/Source/core/html/HTMLInputElement.idl
@@ -97,5 +97,5 @@
     [Conditional=INPUT_SPEECH, NotEnumerable] attribute EventListener onwebkitspeechchange;
 
     // See http://www.w3.org/TR/html-media-capture/
-    [Conditional=MEDIA_CAPTURE] attribute DOMString capture;
+    [Conditional=MEDIA_CAPTURE, Reflect] attribute boolean capture;
 };
diff --git a/Source/core/html/HTMLKeygenElement.cpp b/Source/core/html/HTMLKeygenElement.cpp
index 30a8deb..ff619e2 100644
--- a/Source/core/html/HTMLKeygenElement.cpp
+++ b/Source/core/html/HTMLKeygenElement.cpp
@@ -33,7 +33,7 @@
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLSelectElement.h"
 #include "core/platform/SSLKeyGenerator.h"
-#include <wtf/StdLibExtras.h>
+#include "wtf/StdLibExtras.h"
 
 using namespace WebCore;
 
@@ -41,51 +41,31 @@
 
 using namespace HTMLNames;
 
-class KeygenSelectElement FINAL : public HTMLSelectElement {
-public:
-    static PassRefPtr<KeygenSelectElement> create(Document* document)
-    {
-        return adoptRef(new KeygenSelectElement(document));
-    }
-
-protected:
-    KeygenSelectElement(Document* document)
-        : HTMLSelectElement(selectTag, document, 0, false)
-    {
-        DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-keygen-select", AtomicString::ConstructFromLiteral));
-        setPseudo(pseudoId);
-    }
-
-private:
-    virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren()
-    {
-        return create(document());
-    }
-};
-
-inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
+HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     : HTMLFormControlElementWithState(tagName, document, form)
 {
     ASSERT(hasTagName(keygenTag));
     ScriptWrappable::init(this);
+    ensureUserAgentShadowRoot();
+}
 
-    // Create a select element with one option element for each key size.
+void HTMLKeygenElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+{
+    DEFINE_STATIC_LOCAL(AtomicString, keygenSelectPseudoId, ("-webkit-keygen-select", AtomicString::ConstructFromLiteral));
+
     Vector<String> keys;
     getSupportedKeySizes(keys);
 
-    RefPtr<HTMLSelectElement> select = KeygenSelectElement::create(document);
+    // Create a select element with one option element for each key size.
+    RefPtr<HTMLSelectElement> select = HTMLSelectElement::create(document());
+    select->setPseudo(keygenSelectPseudoId);
     for (size_t i = 0; i < keys.size(); ++i) {
-        RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document);
-        select->appendChild(option, IGNORE_EXCEPTION);
-        option->appendChild(Text::create(document, keys[i]), IGNORE_EXCEPTION);
+        RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document());
+        option->appendChild(Text::create(document(), keys[i]), ASSERT_NO_EXCEPTION);
+        select->appendChild(option, ASSERT_NO_EXCEPTION);
     }
 
-    ensureUserAgentShadowRoot()->appendChild(select, IGNORE_EXCEPTION);
-}
-
-PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
-{
-    return adoptRef(new HTMLKeygenElement(tagName, document, form));
+    root->appendChild(select, ASSERT_NO_EXCEPTION);
 }
 
 void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -97,7 +77,7 @@
     HTMLFormControlElement::parseAttribute(name, value);
 }
 
-bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool)
+bool HTMLKeygenElement::appendFormData(FormDataList& encoding, bool)
 {
     // Only RSA is supported at this time.
     const AtomicString& keyType = fastGetAttribute(keytypeAttr);
@@ -106,7 +86,7 @@
     String value = signedPublicKeyAndChallengeString(shadowSelect()->selectedIndex(), fastGetAttribute(challengeAttr), document()->baseURL());
     if (value.isNull())
         return false;
-    encoded_values.appendData(name(), value.utf8());
+    encoding.appendData(name(), value.utf8());
     return true;
 }
 
@@ -121,11 +101,6 @@
     shadowSelect()->reset();
 }
 
-bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const
-{
-    return false;
-}
-
 HTMLSelectElement* HTMLKeygenElement::shadowSelect() const
 {
     ShadowRoot* root = userAgentShadowRoot();
diff --git a/Source/core/html/HTMLKeygenElement.h b/Source/core/html/HTMLKeygenElement.h
index 2af5860..6b12e19 100644
--- a/Source/core/html/HTMLKeygenElement.h
+++ b/Source/core/html/HTMLKeygenElement.h
@@ -32,28 +32,33 @@
 
 class HTMLKeygenElement FINAL : public HTMLFormControlElementWithState {
 public:
-    static PassRefPtr<HTMLKeygenElement> create(const QualifiedName&, Document*, HTMLFormElement*);
+    static PassRefPtr<HTMLKeygenElement> create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
+    {
+        return adoptRef(new HTMLKeygenElement(tagName, document, form));
+    }
 
-    virtual bool willValidate() const { return false; }
+    virtual bool willValidate() const OVERRIDE { return false; }
 
 private:
     HTMLKeygenElement(const QualifiedName&, Document*, HTMLFormElement*);
 
     virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
 
-    virtual bool canStartSelection() const { return false; }
+    virtual bool canStartSelection() const OVERRIDE { return false; }
 
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
 
-    virtual bool appendFormData(FormDataList&, bool);
-    virtual const AtomicString& formControlType() const;
-    virtual bool isOptionalFormControl() const { return false; }
+    virtual bool appendFormData(FormDataList&, bool) OVERRIDE;
+    virtual const AtomicString& formControlType() const OVERRIDE;
+    virtual bool isOptionalFormControl() const OVERRIDE { return false; }
 
-    virtual bool isEnumeratable() const { return true; }
+    virtual bool isEnumeratable() const OVERRIDE { return true; }
     virtual bool supportLabels() const OVERRIDE { return true; }
 
-    virtual void reset();
-    virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE;
+    virtual void reset() OVERRIDE;
+    virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE { return false; }
+
+    virtual void didAddUserAgentShadowRoot(ShadowRoot*) OVERRIDE;
 
     HTMLSelectElement* shadowSelect() const;
 };
diff --git a/Source/core/html/HTMLLabelElement.h b/Source/core/html/HTMLLabelElement.h
index 4e239ed..4c11115 100644
--- a/Source/core/html/HTMLLabelElement.h
+++ b/Source/core/html/HTMLLabelElement.h
@@ -55,6 +55,22 @@
     virtual void focus(bool restorePreviousSelection, FocusDirection) OVERRIDE;
 };
 
+inline bool isHTMLLabelElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::labelTag);
+}
+
+inline bool isHTMLLabelElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::labelTag);
+}
+
+inline HTMLLabelElement* toHTMLLabelElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLLabelElement(node));
+    return static_cast<HTMLLabelElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp
index a98eaa0..cfdadad 100644
--- a/Source/core/html/HTMLLinkElement.cpp
+++ b/Source/core/html/HTMLLinkElement.cpp
@@ -215,11 +215,13 @@
     }
     document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
 
+    RefPtr<StyleSheet> removedSheet = sheet();
+
     if (m_link)
         m_link->ownerRemoved();
 
     if (document()->renderer())
-        document()->styleResolverChanged(DeferRecalcStyle);
+        document()->removedStyleSheet(removedSheet.get());
 }
 
 void HTMLLinkElement::finishParsingChildren()
@@ -406,6 +408,8 @@
         ASSERT(restoredSheet->isCacheable());
         ASSERT(!restoredSheet->isLoading());
 
+        if (m_sheet)
+            clearSheet();
         m_sheet = CSSStyleSheet::create(restoredSheet, m_owner);
         m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media()));
         m_sheet->setTitle(m_owner->title());
@@ -418,6 +422,8 @@
 
     RefPtr<StyleSheetContents> styleSheet = StyleSheetContents::create(href, parserContext);
 
+    if (m_sheet)
+        clearSheet();
     m_sheet = CSSStyleSheet::create(styleSheet, m_owner);
     m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media()));
     m_sheet->setTitle(m_owner->title());
@@ -493,6 +499,8 @@
         return;
     if (type == NonBlocking) {
         // Document::removePendingSheet() triggers the style selector recalc for blocking sheets.
+        // FIXME: We don't have enough knowledge at this point to know if we're adding or removing a sheet
+        // so we can't call addedStyleSheet() or removedStyleSheet().
         m_owner->document()->styleResolverChanged(RecalcStyleImmediately);
         return;
     }
@@ -538,8 +546,10 @@
         if (!m_sheet && m_disabledState == EnabledViaScript) {
             if (m_owner->shouldProcessStyle())
                 process();
-        } else
-            m_owner->document()->styleResolverChanged(DeferRecalcStyle); // Update the style selector.
+        } else {
+            // FIXME: We don't have enough knowledge here to know if we should call addedStyleSheet() or removedStyleSheet().
+            m_owner->document()->styleResolverChanged(DeferRecalcStyle);
+        }
     }
 }
 
@@ -599,8 +609,9 @@
         }
     } else if (m_sheet) {
         // we no longer contain a stylesheet, e.g. perhaps rel or type was changed
+        RefPtr<StyleSheet> removedSheet = m_sheet;
         clearSheet();
-        document()->styleResolverChanged(DeferRecalcStyle);
+        document()->removedStyleSheet(removedSheet.get());
     }
 }
 
diff --git a/Source/core/html/HTMLLinkElement.h b/Source/core/html/HTMLLinkElement.h
index c854140..941fa3c 100644
--- a/Source/core/html/HTMLLinkElement.h
+++ b/Source/core/html/HTMLLinkElement.h
@@ -203,6 +203,12 @@
     int m_beforeLoadRecurseCount;
 };
 
+inline HTMLLinkElement* toHTMLLinkElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::linkTag));
+    return static_cast<HTMLLinkElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLMapElement.cpp b/Source/core/html/HTMLMapElement.cpp
index c7e800c..7c6ea39 100644
--- a/Source/core/html/HTMLMapElement.cpp
+++ b/Source/core/html/HTMLMapElement.cpp
@@ -62,8 +62,8 @@
     HTMLAreaElement* defaultArea = 0;
     Element* element = this;
     while ((element = ElementTraversal::next(element, this))) {
-        if (element->hasTagName(areaTag)) {
-            HTMLAreaElement* areaElt = static_cast<HTMLAreaElement*>(element);
+        if (isHTMLAreaElement(element)) {
+            HTMLAreaElement* areaElt = toHTMLAreaElement(element);
             if (areaElt->isDefault()) {
                 if (!defaultArea)
                     defaultArea = areaElt;
@@ -71,7 +71,7 @@
                 return true;
         }
     }
-    
+
     if (defaultArea) {
         result.setInnerNode(defaultArea);
         result.setURLElement(defaultArea);
diff --git a/Source/core/html/HTMLMapElement.h b/Source/core/html/HTMLMapElement.h
index 7843179..e56929b 100644
--- a/Source/core/html/HTMLMapElement.h
+++ b/Source/core/html/HTMLMapElement.h
@@ -54,6 +54,12 @@
     AtomicString m_name;
 };
 
+inline HTMLMapElement* toHTMLMapElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::mapTag));
+    return static_cast<HTMLMapElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLMarqueeElement.cpp b/Source/core/html/HTMLMarqueeElement.cpp
index 181c72c..6c5362c 100644
--- a/Source/core/html/HTMLMarqueeElement.cpp
+++ b/Source/core/html/HTMLMarqueeElement.cpp
@@ -130,7 +130,7 @@
 void HTMLMarqueeElement::setScrollAmount(int scrollAmount, ExceptionCode& ec)
 {
     if (scrollAmount < 0)
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
     else
         setIntegralAttribute(scrollamountAttr, scrollAmount);
 }
@@ -145,7 +145,7 @@
 void HTMLMarqueeElement::setScrollDelay(int scrollDelay, ExceptionCode& ec)
 {
     if (scrollDelay < 0)
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
     else
         setIntegralAttribute(scrolldelayAttr, scrollDelay);
 }
@@ -160,7 +160,7 @@
 void HTMLMarqueeElement::setLoop(int loop, ExceptionCode& ec)
 {
     if (loop <= 0 && loop != -1)
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
     else
         setIntegralAttribute(loopAttr, loop);
 }
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 8c01b54..378f218 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -41,6 +41,7 @@
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/html/HTMLMediaSource.h"
 #include "core/html/HTMLSourceElement.h"
 #include "core/html/HTMLTrackElement.h"
 #include "core/html/MediaController.h"
@@ -67,8 +68,6 @@
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
 #include "core/platform/graphics/MediaPlayer.h"
 #include "core/rendering/RenderVideo.h"
-#include "modules/mediasource/MediaSourceBase.h"
-#include "modules/mediasource/MediaSourceRegistry.h"
 #include "modules/mediastream/MediaStreamRegistry.h"
 #include "public/platform/Platform.h"
 #include "weborigin/SecurityOrigin.h"
@@ -160,13 +159,13 @@
     case MediaPlayer::NoError:
         return 0;
     case MediaPlayer::InvalidPlayerState:
-        return INVALID_STATE_ERR;
+        return InvalidStateError;
     case MediaPlayer::KeySystemNotSupported:
-        return NOT_SUPPORTED_ERR;
+        return NotSupportedError;
     }
 
     ASSERT_NOT_REACHED();
-    return INVALID_STATE_ERR;
+    return InvalidStateError;
 }
 
 class TrackDisplayUpdateScope {
@@ -894,14 +893,22 @@
     ASSERT(!m_mediaSource);
 
     if (url.protocolIs(mediaSourceBlobProtocol))
-        m_mediaSource = MediaSourceRegistry::registry().lookupMediaSource(url.string());
+        m_mediaSource = HTMLMediaSource::lookup(url.string());
 
-    if (m_mediaSource)
-        m_player->load(url, m_mediaSource);
-    else if (canLoadURL(url, contentType, keySystem))
+    if (m_mediaSource) {
+        if (m_mediaSource->attachToElement()) {
+            m_player->load(url, m_mediaSource);
+        } else {
+            // Forget our reference to the MediaSource, so we leave it alone
+            // while processing remainder of load failure.
+            m_mediaSource = 0;
+            mediaLoadingFailed(MediaPlayer::FormatError);
+        }
+    } else if (canLoadURL(url, contentType, keySystem)) {
         m_player->load(url);
-    else
+    } else {
         mediaLoadingFailed(MediaPlayer::FormatError);
+    }
 
     // If there is no poster to display, allow the media engine to render video frames as soon as
     // they are available.
@@ -1262,9 +1269,11 @@
         updateActiveTextTrackCues(currentTime());
 }
 
-void HTMLMediaElement::textTrackAddCues(TextTrack*, const TextTrackCueList* cues)
+void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList* cues)
 {
     LOG(Media, "HTMLMediaElement::textTrackAddCues");
+    if (track->mode() == TextTrack::disabledKeyword())
+        return;
 
     TrackDisplayUpdateScope scope(this);
     for (size_t i = 0; i < cues->length(); ++i)
@@ -1280,8 +1289,11 @@
         textTrackRemoveCue(cues->item(i)->track(), cues->item(i));
 }
 
-void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue)
+void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> cue)
 {
+    if (track->mode() == TextTrack::disabledKeyword())
+        return;
+
     // Negative duration cues need be treated in the interval tree as
     // zero-length cues.
     double endTime = max(cue->startTime(), cue->endTime());
@@ -1826,9 +1838,9 @@
 
     // 4.8.9.9 Seeking
 
-    // 1 - If the media element's readyState is HAVE_NOTHING, then raise an INVALID_STATE_ERR exception.
+    // 1 - If the media element's readyState is HAVE_NOTHING, then raise an InvalidStateError exception.
     if (m_readyState == HAVE_NOTHING || !m_player) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -1993,7 +2005,7 @@
 void HTMLMediaElement::setCurrentTime(double time, ExceptionCode& ec)
 {
     if (m_mediaController) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     seek(time, ec);
@@ -2217,12 +2229,12 @@
 void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionCode& ec)
 {
     if (keySystem.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
     if (!m_player) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -2245,22 +2257,22 @@
 void HTMLMediaElement::webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionCode& ec)
 {
     if (keySystem.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
     if (!key) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
     if (!key->length()) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
 
     if (!m_player) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -2283,12 +2295,12 @@
 void HTMLMediaElement::webkitCancelKeyRequest(const String& keySystem, const String& sessionId, ExceptionCode& ec)
 {
     if (keySystem.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
     if (!m_player) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -2338,7 +2350,7 @@
     LOG(Media, "HTMLMediaElement::setVolume(%f)", vol);
 
     if (vol < 0.0f || vol > 1.0f) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -2589,7 +2601,7 @@
 
     // 1. If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps
     if (!TextTrack::isValidKindKeyword(kind)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -3171,6 +3183,10 @@
 {
     if (!m_player)
         return TimeRanges::create();
+
+    if (m_mediaSource)
+        return m_mediaSource->buffered();
+
     return m_player->buffered();
 }
 
@@ -3937,9 +3953,9 @@
     m_restrictions = NoRestrictions;
 }
 
-void HTMLMediaElement::scheduleLayerUpdate()
+void HTMLMediaElement::mediaPlayerScheduleLayerUpdate()
 {
-    setNeedsLayerUpdate();
+    scheduleLayerUpdate();
 }
 
 void HTMLMediaElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index 3e2d4b8..1f7819e 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -52,7 +52,7 @@
 class MediaController;
 class MediaControls;
 class MediaError;
-class MediaSourceBase;
+class HTMLMediaSource;
 class TextTrackList;
 class TimeRanges;
 #if ENABLE(ENCRYPTED_MEDIA_V2)
@@ -376,7 +376,7 @@
 
     virtual CORSMode mediaPlayerCORSMode() const OVERRIDE;
 
-    virtual void scheduleLayerUpdate() OVERRIDE;
+    virtual void mediaPlayerScheduleLayerUpdate() OVERRIDE;
 
     void loadTimerFired(Timer<HTMLMediaElement>*);
     void progressEventTimerFired(Timer<HTMLMediaElement>*);
@@ -505,7 +505,7 @@
 
     DisplayMode m_displayMode;
 
-    RefPtr<MediaSourceBase> m_mediaSource;
+    RefPtr<HTMLMediaSource> m_mediaSource;
 
     mutable double m_cachedTime;
     mutable double m_cachedTimeWallClockUpdateTime;
diff --git a/Source/core/loader/FrameLoadRequest.cpp b/Source/core/html/HTMLMediaSource.cpp
similarity index 76%
copy from Source/core/loader/FrameLoadRequest.cpp
copy to Source/core/html/HTMLMediaSource.cpp
index 0ec26ba..7221cfe 100644
--- a/Source/core/loader/FrameLoadRequest.cpp
+++ b/Source/core/html/HTMLMediaSource.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,19 +29,16 @@
  */
 
 #include "config.h"
-#include "core/loader/FrameLoadRequest.h"
-
-#include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#include "core/html/HTMLMediaSource.h"
 
 namespace WebCore {
 
-FrameLoadRequest::FrameLoadRequest(Frame* frame, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
-    : m_requester(frame->document()->securityOrigin())
-    , m_resourceRequest(resourceRequest)
-    , m_lockHistory(false)
-    , m_substituteData(substituteData)
+URLRegistry* HTMLMediaSource::s_registry = 0;
+
+void HTMLMediaSource::setRegistry(URLRegistry* registry)
 {
+    ASSERT(!s_registry);
+    s_registry = registry;
 }
 
-} // namespace WebCore
+}
diff --git a/Source/core/html/HTMLMediaSource.h b/Source/core/html/HTMLMediaSource.h
new file mode 100644
index 0000000..0b02672
--- /dev/null
+++ b/Source/core/html/HTMLMediaSource.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 HTMLMediaSource_h
+#define HTMLMediaSource_h
+
+#include "core/html/URLRegistry.h"
+#include "wtf/Forward.h"
+
+namespace WebCore {
+
+class MediaSourcePrivate;
+class TimeRanges;
+
+class HTMLMediaSource : public URLRegistrable {
+public:
+    static void setRegistry(URLRegistry*);
+    static HTMLMediaSource* lookup(const String& url) { return s_registry ? static_cast<HTMLMediaSource*>(s_registry->lookup(url)) : 0; }
+
+    void ref() { refHTMLMediaSource(); }
+    void deref() { derefHTMLMediaSource(); }
+
+    // Called when an HTMLMediaElement is attempting to attach to this object,
+    // and helps enforce attachment to at most one element at a time.
+    // If already attached, returns false. Otherwise, must be in
+    // 'closed' state, and returns true to indicate attachment success.
+    // Reattachment allowed by first calling close() (even if already in 'closed').
+    virtual bool attachToElement() = 0;
+    virtual void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>) = 0;
+    virtual void close() = 0;
+    virtual bool isClosed() const = 0;
+    virtual double duration() const = 0;
+    virtual PassRefPtr<TimeRanges> buffered() const = 0;
+    virtual void refHTMLMediaSource() = 0;
+    virtual void derefHTMLMediaSource() = 0;
+
+    // URLRegistrable
+    virtual URLRegistry& registry() const OVERRIDE { return *s_registry; }
+
+private:
+    static URLRegistry* s_registry;
+};
+
+}
+
+#endif
diff --git a/Source/core/html/HTMLMetaElement.cpp b/Source/core/html/HTMLMetaElement.cpp
index 4130084..a93e2ce 100644
--- a/Source/core/html/HTMLMetaElement.cpp
+++ b/Source/core/html/HTMLMetaElement.cpp
@@ -37,6 +37,11 @@
     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));
diff --git a/Source/core/html/HTMLMetaElement.h b/Source/core/html/HTMLMetaElement.h
index d445f92..f9255b1 100644
--- a/Source/core/html/HTMLMetaElement.h
+++ b/Source/core/html/HTMLMetaElement.h
@@ -29,6 +29,7 @@
 
 class HTMLMetaElement FINAL : public HTMLElement {
 public:
+    static PassRefPtr<HTMLMetaElement> create(Document*);
     static PassRefPtr<HTMLMetaElement> create(const QualifiedName&, Document*);
 
     String content() const;
diff --git a/Source/core/html/HTMLMeterElement.cpp b/Source/core/html/HTMLMeterElement.cpp
index e2680b9..b8b59e0 100644
--- a/Source/core/html/HTMLMeterElement.cpp
+++ b/Source/core/html/HTMLMeterElement.cpp
@@ -83,7 +83,7 @@
 void HTMLMeterElement::setMin(double min, ExceptionCode& ec)
 {
     if (!std::isfinite(min)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(minAttr, String::number(min));
@@ -97,7 +97,7 @@
 void HTMLMeterElement::setMax(double max, ExceptionCode& ec)
 {
     if (!std::isfinite(max)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(maxAttr, String::number(max));
@@ -112,7 +112,7 @@
 void HTMLMeterElement::setValue(double value, ExceptionCode& ec)
 {
     if (!std::isfinite(value)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(valueAttr, String::number(value));
@@ -127,7 +127,7 @@
 void HTMLMeterElement::setLow(double low, ExceptionCode& ec)
 {
     if (!std::isfinite(low)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(lowAttr, String::number(low));
@@ -142,7 +142,7 @@
 void HTMLMeterElement::setHigh(double high, ExceptionCode& ec)
 {
     if (!std::isfinite(high)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(highAttr, String::number(high));
@@ -157,7 +157,7 @@
 void HTMLMeterElement::setOptimum(double optimum, ExceptionCode& ec)
 {
     if (!std::isfinite(optimum)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(optimumAttr, String::number(optimum));
diff --git a/Source/core/html/HTMLNameCollection.h b/Source/core/html/HTMLNameCollection.h
index 099e470..a13039d 100644
--- a/Source/core/html/HTMLNameCollection.h
+++ b/Source/core/html/HTMLNameCollection.h
@@ -25,7 +25,7 @@
 
 #include "core/html/HTMLCollection.h"
 
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLOptGroupElement.cpp b/Source/core/html/HTMLOptGroupElement.cpp
index d5bf7ad..492f2b0 100644
--- a/Source/core/html/HTMLOptGroupElement.cpp
+++ b/Source/core/html/HTMLOptGroupElement.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/html/HTMLSelectElement.h"
-#include <wtf/StdLibExtras.h>
+#include "wtf/StdLibExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLOptGroupElement.h b/Source/core/html/HTMLOptGroupElement.h
index e3360f9..ccf6758 100644
--- a/Source/core/html/HTMLOptGroupElement.h
+++ b/Source/core/html/HTMLOptGroupElement.h
@@ -63,6 +63,22 @@
     RefPtr<RenderStyle> m_style;
 };
 
+inline bool isHTMLOptGroupElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::optgroupTag);
+}
+
+inline bool isHTMLOptGroupElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::optgroupTag);
+}
+
+inline HTMLOptGroupElement* toHTMLOptGroupElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLOptGroupElement(node));
+    return static_cast<HTMLOptGroupElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index 4947a72..0ca2446 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -31,9 +31,10 @@
 #include "core/dom/Document.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/dom/Text.h"
 #include "core/html/HTMLDataListElement.h"
+#include "core/html/HTMLOptGroupElement.h"
 #include "core/html/HTMLSelectElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/rendering/RenderTheme.h"
@@ -144,7 +145,7 @@
         toText(child)->setData(text);
     else {
         removeChildren();
-        appendChild(Text::create(document(), text), ec);
+        appendChild(Text::create(document(), text), ec, AttachLazily);
     }
     
     if (selectIsMenuList && select->selectedIndex() != oldSelectedIndex)
@@ -333,7 +334,7 @@
 String HTMLOptionElement::textIndentedToRespectGroupLabel() const
 {
     ContainerNode* parent = parentNode();
-    if (parent && parent->hasTagName(optgroupTag))
+    if (parent && isHTMLOptGroupElement(parent))
         return "    " + text();
     return text();
 }
@@ -343,7 +344,7 @@
     if (ownElementDisabled())
         return true;
     if (Element* parent = parentElement())
-        return parent->hasTagName(optgroupTag) && parent->isDisabledFormControl();
+        return isHTMLOptGroupElement(parent) && parent->isDisabledFormControl();
     return false;
 }
 
@@ -370,7 +371,7 @@
         if (node->isTextNode())
             text.append(node->nodeValue());
         // Text nodes inside script elements are not part of the option text.
-        if (node->isElementNode() && toScriptElementIfPossible(toElement(node)))
+        if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node)))
             node = NodeTraversal::nextSkippingChildren(node, this);
         else
             node = NodeTraversal::next(node, this);
diff --git a/Source/core/html/HTMLOptionsCollection.cpp b/Source/core/html/HTMLOptionsCollection.cpp
index e0a7a4b..66ea1ed 100644
--- a/Source/core/html/HTMLOptionsCollection.cpp
+++ b/Source/core/html/HTMLOptionsCollection.cpp
@@ -50,12 +50,12 @@
     HTMLOptionElement* newOption = element.get();
 
     if (!newOption) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
 
     if (index < -1) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -119,7 +119,7 @@
 {
     HTMLSelectElement* base = toHTMLSelectElement(ownerNode());
     if (!value) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return true;
     }
     base->setOption(index, value.get(), ec);
diff --git a/Source/core/html/HTMLPlugInElement.cpp b/Source/core/html/HTMLPlugInElement.cpp
index 73f7249..b2f2068 100644
--- a/Source/core/html/HTMLPlugInElement.cpp
+++ b/Source/core/html/HTMLPlugInElement.cpp
@@ -35,7 +35,7 @@
 #include "core/plugins/PluginView.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "core/rendering/RenderWidget.h"
-#include <wtf/UnusedParam.h>
+#include "wtf/UnusedParam.h"
 
 
 namespace WebCore {
diff --git a/Source/core/html/HTMLProgressElement.cpp b/Source/core/html/HTMLProgressElement.cpp
index d39fc76..3aad685 100644
--- a/Source/core/html/HTMLProgressElement.cpp
+++ b/Source/core/html/HTMLProgressElement.cpp
@@ -105,7 +105,7 @@
 void HTMLProgressElement::setValue(double value, ExceptionCode& ec)
 {
     if (!std::isfinite(value)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(valueAttr, String::number(value >= 0 ? value : 0));
@@ -120,7 +120,7 @@
 void HTMLProgressElement::setMax(double max, ExceptionCode& ec)
 {
     if (!std::isfinite(max)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
     setAttribute(maxAttr, String::number(max > 0 ? max : 1));
diff --git a/Source/core/html/HTMLQuoteElement.h b/Source/core/html/HTMLQuoteElement.h
index add536c..2b85303 100644
--- a/Source/core/html/HTMLQuoteElement.h
+++ b/Source/core/html/HTMLQuoteElement.h
@@ -25,7 +25,7 @@
 #define HTMLQuoteElement_h
 
 #include "core/html/HTMLElement.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLScriptElement.cpp b/Source/core/html/HTMLScriptElement.cpp
index c0fbc1f..880f10d 100644
--- a/Source/core/html/HTMLScriptElement.cpp
+++ b/Source/core/html/HTMLScriptElement.cpp
@@ -29,6 +29,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/dom/Text.h"
 
 namespace WebCore {
@@ -37,7 +38,7 @@
 
 inline HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool alreadyStarted)
     : HTMLElement(tagName, document)
-    , ScriptElement(this, wasInsertedByParser, alreadyStarted)
+    , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted))
 {
     ASSERT(hasTagName(scriptTag));
     ScriptWrappable::init(this);
@@ -56,15 +57,15 @@
 void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-    ScriptElement::childrenChanged();
+    m_loader->childrenChanged();
 }
 
 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == srcAttr)
-        handleSourceAttribute(value);
+        m_loader->handleSourceAttribute(value);
     else if (name == asyncAttr)
-        handleAsyncAttribute();
+        m_loader->handleAsyncAttribute();
     else if (name == onbeforeloadAttr)
         setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
     else
@@ -74,7 +75,7 @@
 Node::InsertionNotificationRequest HTMLScriptElement::insertedInto(ContainerNode* insertionPoint)
 {
     HTMLElement::insertedInto(insertionPoint);
-    ScriptElement::insertedInto(insertionPoint);
+    m_loader->insertedInto(insertionPoint);
     return InsertionDone;
 }
 
@@ -98,12 +99,12 @@
 void HTMLScriptElement::setAsync(bool async)
 {
     setBooleanAttribute(asyncAttr, async);
-    handleAsyncAttribute();
+    m_loader->handleAsyncAttribute();
 }
 
 bool HTMLScriptElement::async() const
 {
-    return fastHasAttribute(asyncAttr) || forceAsync();
+    return fastHasAttribute(asyncAttr) || (m_loader->forceAsync());
 }
 
 KURL HTMLScriptElement::src() const
@@ -165,15 +166,13 @@
 
 void HTMLScriptElement::dispatchLoadEvent()
 {
-    ASSERT(!haveFiredLoadEvent());
-    setHaveFiredLoadEvent(true);
-
+    ASSERT(!m_loader->haveFiredLoadEvent());
     dispatchEvent(Event::create(eventNames().loadEvent, false, false));
 }
 
 PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren()
 {
-    return adoptRef(new HTMLScriptElement(tagQName(), document(), false, alreadyStarted()));
+    return adoptRef(new HTMLScriptElement(tagQName(), document(), false, m_loader->alreadyStarted()));
 }
 
 }
diff --git a/Source/core/html/HTMLScriptElement.h b/Source/core/html/HTMLScriptElement.h
index 153f271..704b77e 100644
--- a/Source/core/html/HTMLScriptElement.h
+++ b/Source/core/html/HTMLScriptElement.h
@@ -24,16 +24,18 @@
 #ifndef HTMLScriptElement_h
 #define HTMLScriptElement_h
 
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoaderClient.h"
 #include "core/html/HTMLElement.h"
 
 namespace WebCore {
 
-class HTMLScriptElement FINAL : public HTMLElement, public ScriptElement {
+class ScriptLoader;
+
+class HTMLScriptElement FINAL : public HTMLElement, public ScriptLoaderClient {
 public:
     static PassRefPtr<HTMLScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted = false);
 
-    String text() const { return scriptContent(); }
+    String text() { return textFromChildren(); }
     void setText(const String&);
 
     KURL src() const;
@@ -41,6 +43,8 @@
     void setAsync(bool);
     bool async() const;
 
+    ScriptLoader* loader() const { return m_loader.get(); }
+
 private:
     HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
 
@@ -65,6 +69,8 @@
     virtual void dispatchLoadEvent();
 
     virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
+
+    OwnPtr<ScriptLoader> m_loader;
 };
 
 inline HTMLScriptElement* toHTMLScriptElement(Node* node)
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index cdec5af..53e16a6 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -40,6 +40,7 @@
 #include "core/html/FormController.h"
 #include "core/html/FormDataList.h"
 #include "core/html/HTMLFormElement.h"
+#include "core/html/HTMLOptGroupElement.h"
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLOptionsCollection.h"
 #include "core/page/EventHandler.h"
@@ -79,6 +80,11 @@
     ScriptWrappable::init(this);
 }
 
+PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document* document)
+{
+    return adoptRef(new HTMLSelectElement(selectTag, document, 0, false));
+}
+
 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
 {
     ASSERT(tagName.matches(selectTag));
@@ -334,7 +340,7 @@
     if (!HTMLFormControlElementWithState::childShouldCreateRenderer(childContext))
         return false;
     if (!usesMenuList())
-        return childContext.node()->hasTagName(HTMLNames::optionTag) || childContext.node()->hasTagName(HTMLNames::optgroupTag);
+        return childContext.node()->hasTagName(HTMLNames::optionTag) || isHTMLOptGroupElement(childContext.node());
     return false;
 }
 
@@ -740,7 +746,7 @@
         // optgroup tags may not nest. However, both FireFox and IE will
         // flatten the tree automatically, so we follow suit.
         // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6)
-        if (current->hasTagName(optgroupTag)) {
+        if (isHTMLOptGroupElement(current)) {
             m_listItems.append(current);
             if (Element* nextElement = ElementTraversal::firstWithin(current)) {
                 currentElement = nextElement;
@@ -1566,7 +1572,7 @@
 bool HTMLSelectElement::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionCode& ec)
 {
     if (!value) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return false;
     }
     setOption(index, value.get(), ec);
diff --git a/Source/core/html/HTMLSelectElement.h b/Source/core/html/HTMLSelectElement.h
index 1fa1b46..65ab1d5 100644
--- a/Source/core/html/HTMLSelectElement.h
+++ b/Source/core/html/HTMLSelectElement.h
@@ -30,14 +30,15 @@
 #include "core/html/HTMLFormControlElementWithState.h"
 #include "core/html/HTMLOptionsCollection.h"
 #include "core/html/TypeAhead.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
 class HTMLOptionElement;
 
-class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAheadDataSource {
+class HTMLSelectElement FINAL : public HTMLFormControlElementWithState, public TypeAheadDataSource {
 public:
+    static PassRefPtr<HTMLSelectElement> create(Document*);
     static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
 
     int selectedIndex() const;
diff --git a/Source/core/html/HTMLSourceElement.h b/Source/core/html/HTMLSourceElement.h
index 7e7c5ed..bd03ca8 100644
--- a/Source/core/html/HTMLSourceElement.h
+++ b/Source/core/html/HTMLSourceElement.h
@@ -33,6 +33,7 @@
 
 class HTMLSourceElement FINAL : public HTMLElement {
 public:
+    static PassRefPtr<HTMLSourceElement> create(Document* document) { return create(HTMLNames::sourceTag, document); }
     static PassRefPtr<HTMLSourceElement> create(const QualifiedName&, Document*);
 
     String media() const;
diff --git a/Source/core/html/HTMLStyleElement.cpp b/Source/core/html/HTMLStyleElement.cpp
index 7d7ba3f..1a26b6d 100644
--- a/Source/core/html/HTMLStyleElement.cpp
+++ b/Source/core/html/HTMLStyleElement.cpp
@@ -70,15 +70,17 @@
 
 void HTMLStyleElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    if (name == titleAttr && m_sheet)
+    if (name == titleAttr && m_sheet) {
         m_sheet->setTitle(value);
-    else if (name == scopedAttr && ContextFeatures::styleScopedEnabled(document()))
+    } 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()->renderer() && m_sheet) {
         m_sheet->setMediaQueries(MediaQuerySet::create(value));
-        document()->styleResolverChanged(RecalcStyleImmediately);
-    } else
+        // FIXME: This shold be DeferRecalcStyle.
+        document()->modifiedStyleSheet(m_sheet.get(), RecalcStyleImmediately);
+    } else {
         HTMLElement::parseAttribute(name, value);
+    }
 }
 
 void HTMLStyleElement::scopedAttributeChanged(bool scoped)
@@ -103,7 +105,7 @@
         }
 
         if (scopedValueChanged)
-            document()->styleResolverChanged(DeferRecalcStyle);
+            document()->modifiedStyleSheet(sheet());
         return;
     }
 
@@ -122,7 +124,7 @@
     }
 
     if (scopedValueChanged)
-        document()->styleResolverChanged(DeferRecalcStyle);
+        document()->modifiedStyleSheet(sheet());
 }
 
 void HTMLStyleElement::finishParsingChildren()
diff --git a/Source/core/html/HTMLTableElement.cpp b/Source/core/html/HTMLTableElement.cpp
index 209470e..001f141 100644
--- a/Source/core/html/HTMLTableElement.cpp
+++ b/Source/core/html/HTMLTableElement.cpp
@@ -186,7 +186,7 @@
 PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec)
 {
     if (index < -1) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
 
@@ -201,7 +201,7 @@
             row = HTMLTableRowsCollection::rowAfter(this, lastRow.get());
             if (!row) {
                 if (i != index) {
-                    ec = INDEX_SIZE_ERR;
+                    ec = IndexSizeError;
                     return 0;
                 }
                 break;
@@ -219,13 +219,13 @@
             RefPtr<HTMLTableSectionElement> newBody = HTMLTableSectionElement::create(tbodyTag, document());
             RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document());
             newBody->appendChild(newRow, ec);
-            appendChild(newBody.release(), ec);
+            appendChild(newBody.release(), ec, AttachLazily);
             return newRow.release();
         }
     }
 
     RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document());
-    parent->insertBefore(newRow, row.get(), ec);
+    parent->insertBefore(newRow, row.get(), ec, AttachLazily);
     return newRow.release();
 }
 
@@ -242,7 +242,7 @@
         }
     }
     if (!row) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
     row->remove(ec);
diff --git a/Source/core/html/HTMLTableElement.h b/Source/core/html/HTMLTableElement.h
index 73fee6b..c9b4afd 100644
--- a/Source/core/html/HTMLTableElement.h
+++ b/Source/core/html/HTMLTableElement.h
@@ -100,6 +100,22 @@
     RefPtr<StylePropertySet> m_sharedCellStyle;
 };
 
+inline bool isHTMLTableElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::tableTag);
+}
+
+inline bool isHTMLTableElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::tableTag);
+}
+
+inline HTMLTableElement* toHTMLTableElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTableElement(node));
+    return static_cast<HTMLTableElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLTablePartElement.cpp b/Source/core/html/HTMLTablePartElement.cpp
index 25644e7..2373e52 100644
--- a/Source/core/html/HTMLTablePartElement.cpp
+++ b/Source/core/html/HTMLTablePartElement.cpp
@@ -86,9 +86,9 @@
 HTMLTableElement* HTMLTablePartElement::findParentTable() const
 {
     ContainerNode* parent = NodeRenderingTraversal::parent(this);
-    while (parent && !parent->hasTagName(tableTag))
+    while (parent && !isHTMLTableElement(parent))
         parent = NodeRenderingTraversal::parent(parent);
-    return static_cast<HTMLTableElement*>(parent);
+    return toHTMLTableElement(parent);
 }
 
 }
diff --git a/Source/core/html/HTMLTableRowElement.cpp b/Source/core/html/HTMLTableRowElement.cpp
index fb62c58..79882ae 100644
--- a/Source/core/html/HTMLTableRowElement.cpp
+++ b/Source/core/html/HTMLTableRowElement.cpp
@@ -59,7 +59,7 @@
     if (!table)
         return -1;
     table = table->parentNode();
-    if (!table || !table->hasTagName(tableTag))
+    if (!table || !isHTMLTableElement(table))
         return -1;
 
     // To match Firefox, the row indices work like this:
@@ -69,7 +69,7 @@
 
     int rIndex = 0;
 
-    if (HTMLTableSectionElement* head = static_cast<HTMLTableElement*>(table)->tHead()) {
+    if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) {
         for (Node *row = head->firstChild(); row; row = row->nextSibling()) {
             if (row == this)
                 return rIndex;
@@ -77,7 +77,7 @@
                 ++rIndex;
         }
     }
-    
+
     for (Node *node = table->firstChild(); node; node = node->nextSibling()) {
         if (node->hasTagName(tbodyTag)) {
             HTMLTableSectionElement* section = static_cast<HTMLTableSectionElement*>(node);
@@ -90,7 +90,7 @@
         }
     }
 
-    if (HTMLTableSectionElement* foot = static_cast<HTMLTableElement*>(table)->tFoot()) {
+    if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) {
         for (Node *row = foot->firstChild(); row; row = row->nextSibling()) {
             if (row == this)
                 return rIndex;
@@ -122,20 +122,20 @@
     RefPtr<HTMLCollection> children = cells();
     int numCells = children ? children->length() : 0;
     if (index < -1 || index > numCells) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
 
     RefPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create(tdTag, document());
     if (index < 0 || index >= numCells)
-        appendChild(cell, ec);
+        appendChild(cell, ec, AttachLazily);
     else {
         Node* n;
         if (index < 1)
             n = firstChild();
         else
             n = children->item(index);
-        insertBefore(cell, n, ec);
+        insertBefore(cell, n, ec, AttachLazily);
     }
     return cell.release();
 }
@@ -149,8 +149,9 @@
     if (index >= 0 && index < numCells) {
         RefPtr<Node> cell = children->item(index);
         HTMLElement::removeChild(cell.get(), ec);
-    } else
-        ec = INDEX_SIZE_ERR;
+    } else {
+        ec = IndexSizeError;
+    }
 }
 
 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells()
@@ -160,7 +161,7 @@
 
 void HTMLTableRowElement::setCells(HTMLCollection*, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 }
diff --git a/Source/core/html/HTMLTableRowElement.h b/Source/core/html/HTMLTableRowElement.h
index c50725b..3eb2ee8 100644
--- a/Source/core/html/HTMLTableRowElement.h
+++ b/Source/core/html/HTMLTableRowElement.h
@@ -51,6 +51,17 @@
     HTMLTableRowElement(const QualifiedName&, Document*);
 };
 
+inline bool isHTMLTableRowElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::trTag);
+}
+
+inline HTMLTableRowElement* toHTMLTableRowElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTableRowElement(node));
+    return static_cast<HTMLTableRowElement*>(node);
+}
+
 } // namespace
 
 #endif
diff --git a/Source/core/html/HTMLTableRowsCollection.cpp b/Source/core/html/HTMLTableRowsCollection.cpp
index 128d3a9..3037aff 100644
--- a/Source/core/html/HTMLTableRowsCollection.cpp
+++ b/Source/core/html/HTMLTableRowsCollection.cpp
@@ -60,8 +60,8 @@
     // Continue only if there is none.
     if (previous && previous->parentNode() != table) {
         for (child = previous->nextSibling(); child; child = child->nextSibling()) {
-            if (child->hasTagName(trTag))
-                return static_cast<HTMLTableRowElement*>(child);
+            if (isHTMLTableRowElement(child))
+                return toHTMLTableRowElement(child);
         }
     }
 
@@ -73,8 +73,8 @@
     for (; child; child = child->nextSibling()) {
         if (child->hasTagName(theadTag)) {
             for (Node* grandchild = child->firstChild(); grandchild; grandchild = grandchild->nextSibling()) {
-                if (grandchild->hasTagName(trTag))
-                    return static_cast<HTMLTableRowElement*>(grandchild);
+                if (isHTMLTableRowElement(grandchild))
+                    return toHTMLTableRowElement(grandchild);
             }
         }
     }
@@ -87,12 +87,12 @@
     else if (isInBody(previous))
         child = previous->parentNode()->nextSibling();
     for (; child; child = child->nextSibling()) {
-        if (child->hasTagName(trTag))
-            return static_cast<HTMLTableRowElement*>(child);
+        if (isHTMLTableRowElement(child))
+            return toHTMLTableRowElement(child);
         if (child->hasTagName(tbodyTag)) {
             for (Node* grandchild = child->firstChild(); grandchild; grandchild = grandchild->nextSibling()) {
-                if (grandchild->hasTagName(trTag))
-                    return static_cast<HTMLTableRowElement*>(grandchild);
+                if (isHTMLTableRowElement(grandchild))
+                    return toHTMLTableRowElement(grandchild);
             }
         }
     }
@@ -105,8 +105,8 @@
     for (; child; child = child->nextSibling()) {
         if (child->hasTagName(tfootTag)) {
             for (Node* grandchild = child->firstChild(); grandchild; grandchild = grandchild->nextSibling()) {
-                if (grandchild->hasTagName(trTag))
-                    return static_cast<HTMLTableRowElement*>(grandchild);
+                if (isHTMLTableRowElement(grandchild))
+                    return toHTMLTableRowElement(grandchild);
             }
         }
     }
@@ -119,19 +119,19 @@
     for (Node* child = table->lastChild(); child; child = child->previousSibling()) {
         if (child->hasTagName(tfootTag)) {
             for (Node* grandchild = child->lastChild(); grandchild; grandchild = grandchild->previousSibling()) {
-                if (grandchild->hasTagName(trTag))
-                    return static_cast<HTMLTableRowElement*>(grandchild);
+                if (isHTMLTableRowElement(grandchild))
+                    return toHTMLTableRowElement(grandchild);
             }
         }
     }
 
     for (Node* child = table->lastChild(); child; child = child->previousSibling()) {
-        if (child->hasTagName(trTag))
-            return static_cast<HTMLTableRowElement*>(child);
+        if (isHTMLTableRowElement(child))
+            return toHTMLTableRowElement(child);
         if (child->hasTagName(tbodyTag)) {
             for (Node* grandchild = child->lastChild(); grandchild; grandchild = grandchild->previousSibling()) {
-                if (grandchild->hasTagName(trTag))
-                    return static_cast<HTMLTableRowElement*>(grandchild);
+                if (isHTMLTableRowElement(grandchild))
+                    return toHTMLTableRowElement(grandchild);
             }
         }
     }
@@ -139,8 +139,8 @@
     for (Node* child = table->lastChild(); child; child = child->previousSibling()) {
         if (child->hasTagName(theadTag)) {
             for (Node* grandchild = child->lastChild(); grandchild; grandchild = grandchild->previousSibling()) {
-                if (grandchild->hasTagName(trTag))
-                    return static_cast<HTMLTableRowElement*>(grandchild);
+                if (isHTMLTableRowElement(grandchild))
+                    return toHTMLTableRowElement(grandchild);
             }
         }
     }
@@ -154,7 +154,7 @@
 HTMLTableRowsCollection::HTMLTableRowsCollection(Node* table)
     : HTMLCollection(table, TableRows, OverridesItemAfter)
 {
-    ASSERT(table->hasTagName(tableTag));
+    ASSERT(isHTMLTableElement(table));
 }
 
 PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(Node* table, CollectionType)
@@ -165,8 +165,7 @@
 Element* HTMLTableRowsCollection::virtualItemAfter(unsigned& offsetInArray, Element* previous) const
 {
     ASSERT_UNUSED(offsetInArray, !offsetInArray);
-    ASSERT(!previous || (previous->isHTMLElement() && toHTMLElement(previous)->hasLocalName(trTag)));
-    return rowAfter(static_cast<HTMLTableElement*>(ownerNode()), static_cast<HTMLTableRowElement*>(previous));
+    return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previous));
 }
 
 }
diff --git a/Source/core/html/HTMLTableSectionElement.cpp b/Source/core/html/HTMLTableSectionElement.cpp
index 19be0af..5ca10cf 100644
--- a/Source/core/html/HTMLTableSectionElement.cpp
+++ b/Source/core/html/HTMLTableSectionElement.cpp
@@ -61,18 +61,18 @@
     RefPtr<HTMLCollection> children = rows();
     int numRows = children ? (int)children->length() : 0;
     if (index < -1 || index > numRows)
-        ec = INDEX_SIZE_ERR; // per the DOM
+        ec = IndexSizeError; // per the DOM
     else {
         row = HTMLTableRowElement::create(trTag, document());
         if (numRows == index || index == -1)
-            appendChild(row, ec);
+            appendChild(row, ec, AttachLazily);
         else {
             Node* n;
             if (index < 1)
                 n = firstChild();
             else
                 n = children->item(index);
-            insertBefore(row, n, ec);
+            insertBefore(row, n, ec, AttachLazily);
         }
     }
     return row.release();
@@ -87,8 +87,9 @@
     if (index >= 0 && index < numRows) {
         RefPtr<Node> row = children->item(index);
         HTMLElement::removeChild(row.get(), ec);
-    } else
-        ec = INDEX_SIZE_ERR;
+    } else {
+        ec = IndexSizeError;
+    }
 }
 
 int HTMLTableSectionElement::numRows() const
diff --git a/Source/core/html/HTMLTemplateElement.h b/Source/core/html/HTMLTemplateElement.h
index 685d62a..a24d8aa 100644
--- a/Source/core/html/HTMLTemplateElement.h
+++ b/Source/core/html/HTMLTemplateElement.h
@@ -44,7 +44,7 @@
     DocumentFragment* content() const;
 
 private:
-    virtual PassRefPtr<Node> cloneNode(bool deep) OVERRIDE;
+    virtual PassRefPtr<Node> cloneNode(bool deep = true) 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 2c102f2..0e5110b 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -44,8 +44,8 @@
 #include "core/page/Frame.h"
 #include "core/platform/LocalizedStrings.h"
 #include "core/rendering/RenderTextControlMultiLine.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -441,7 +441,7 @@
 void HTMLTextAreaElement::setMaxLength(int newValue, ExceptionCode& ec)
 {
     if (newValue < 0)
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
     else
         setAttribute(maxlengthAttr, String::number(newValue));
 }
diff --git a/Source/core/html/HTMLTextAreaElement.h b/Source/core/html/HTMLTextAreaElement.h
index 8d06a88..58808aa 100644
--- a/Source/core/html/HTMLTextAreaElement.h
+++ b/Source/core/html/HTMLTextAreaElement.h
@@ -127,11 +127,22 @@
     mutable bool m_wasModifiedByUser;
 };
 
-inline bool isHTMLTextAreaElement(Node* node)
+inline bool isHTMLTextAreaElement(const Node* node)
 {
     return node->hasTagName(HTMLNames::textareaTag);
 }
 
+inline bool isHTMLTextAreaElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::textareaTag);
+}
+
+inline HTMLTextAreaElement* toHTMLTextAreaElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTextAreaElement(node));
+    return static_cast<HTMLTextAreaElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index 50c6c79..7d1ce1b 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -41,7 +41,7 @@
 #include "core/rendering/RenderBox.h"
 #include "core/rendering/RenderTextControl.h"
 #include "core/rendering/RenderTheme.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -182,14 +182,6 @@
     parentRenderer->addChild(placeholderRenderer, siblingRenderer);
 }
 
-RenderTextControl* HTMLTextFormControlElement::textRendererAfterUpdateLayout()
-{
-    if (!isTextFormControl())
-        return 0;
-    document()->updateLayoutIgnorePendingStylesheets();
-    return toRenderTextControl(renderer());
-}
-
 void HTMLTextFormControlElement::setSelectionStart(int start)
 {
     setSelectionRange(start, max(start, selectionEnd()), selectionDirection());
@@ -241,7 +233,7 @@
 void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec)
 {
     if (start > end) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
diff --git a/Source/core/html/HTMLTextFormControlElement.h b/Source/core/html/HTMLTextFormControlElement.h
index 506380b..09007ea 100644
--- a/Source/core/html/HTMLTextFormControlElement.h
+++ b/Source/core/html/HTMLTextFormControlElement.h
@@ -132,8 +132,6 @@
     // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent().
     virtual void handleBlurEvent() { }
 
-    RenderTextControl* textRendererAfterUpdateLayout();
-
     String m_textAsOfLastFormControlChangeEvent;
     bool m_lastChangeWasUserEdit;
     
diff --git a/Source/core/html/HTMLTitleElement.cpp b/Source/core/html/HTMLTitleElement.cpp
index 9df7789..c467796 100644
--- a/Source/core/html/HTMLTitleElement.cpp
+++ b/Source/core/html/HTMLTitleElement.cpp
@@ -38,6 +38,7 @@
     : HTMLElement(tagName, document)
 {
     ASSERT(hasTagName(titleTag));
+    setHasCustomStyleCallbacks();
     ScriptWrappable::init(this);
 }
 
@@ -50,7 +51,7 @@
 {
     HTMLElement::insertedInto(insertionPoint);
     if (inDocument() && !isInShadowTree())
-        document()->setTitleElement(m_title, this);
+        document()->setTitleElement(textWithDirection(), this);
     return InsertionDone;
 }
 
@@ -64,13 +65,50 @@
 void HTMLTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-    m_title = textWithDirection();
-    if (inDocument()) {
-        if (!isInShadowTree())
-            document()->setTitleElement(m_title, this);
-        else
-            document()->removeTitle(this);
-    }
+    if (inDocument() && !isInShadowTree())
+        document()->setTitleElement(textWithDirection(), this);
+}
+
+void HTMLTitleElement::attach(const AttachContext& context)
+{
+    HTMLElement::attach(context);
+    // If after attaching nothing called styleForRenderer() on this node we
+    // manually cache the value. This happens if our parent doesn't have a
+    // renderer like <optgroup> or if it doesn't allow children like <select>.
+    if (!m_style)
+        updateNonRenderStyle();
+}
+
+void HTMLTitleElement::detach(const AttachContext& context)
+{
+    m_style.clear();
+    HTMLElement::detach(context);
+}
+
+void HTMLTitleElement::updateNonRenderStyle()
+{
+    m_style = document()->styleForElementIgnoringPendingStylesheets(this);
+}
+
+RenderStyle* HTMLTitleElement::nonRendererStyle() const
+{
+    return m_style.get();
+}
+
+PassRefPtr<RenderStyle> HTMLTitleElement::customStyleForRenderer()
+{
+    // styleForRenderer is called whenever a new style should be associated
+    // with an Element so now is a good time to update our cached style.
+    updateNonRenderStyle();
+    return m_style;
+}
+
+void HTMLTitleElement::didRecalcStyle(StyleChange)
+{
+    if (isInShadowTree())
+        return;
+
+    document()->setTitleElement(textWithDirection(), this);
 }
 
 String HTMLTitleElement::text() const
@@ -88,10 +126,8 @@
 StringWithDirection HTMLTitleElement::textWithDirection()
 {
     TextDirection direction = LTR;
-    if (RenderStyle* style = computedStyle())
-        direction = style->direction();
-    else if (RefPtr<RenderStyle> style = styleForRenderer())
-        direction = style->direction();
+    if (m_style)
+        direction = m_style->direction();
     return StringWithDirection(text(), direction);
 }
 
diff --git a/Source/core/html/HTMLTitleElement.h b/Source/core/html/HTMLTitleElement.h
index b80f598..939a828 100644
--- a/Source/core/html/HTMLTitleElement.h
+++ b/Source/core/html/HTMLTitleElement.h
@@ -39,13 +39,37 @@
 private:
     HTMLTitleElement(const QualifiedName&, Document*);
 
+    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
+    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
+
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     virtual void removedFrom(ContainerNode*) OVERRIDE;
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
-    StringWithDirection m_title;
+    void updateNonRenderStyle();
+    virtual RenderStyle* nonRendererStyle() const OVERRIDE;
+    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
+    virtual void didRecalcStyle(StyleChange) OVERRIDE;
+
+    RefPtr<RenderStyle> m_style;
 };
 
+inline bool isHTMLTitleElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::titleTag);
+}
+
+inline bool isHTMLTitleElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::titleTag);
+}
+
+inline HTMLTitleElement* toHTMLTitleElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTitleElement(node));
+    return static_cast<HTMLTitleElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLVideoElement.cpp b/Source/core/html/HTMLVideoElement.cpp
index 83eb6fe..bbdf46b 100644
--- a/Source/core/html/HTMLVideoElement.cpp
+++ b/Source/core/html/HTMLVideoElement.cpp
@@ -227,7 +227,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()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
diff --git a/Source/core/html/HTMLVideoElement.h b/Source/core/html/HTMLVideoElement.h
index d77a4b5..bf598aa 100644
--- a/Source/core/html/HTMLVideoElement.h
+++ b/Source/core/html/HTMLVideoElement.h
@@ -34,6 +34,7 @@
 
 class HTMLVideoElement FINAL : public HTMLMediaElement {
 public:
+    static PassRefPtr<HTMLVideoElement> create(Document* document) { return create(HTMLNames::videoTag, document, false); }
     static PassRefPtr<HTMLVideoElement> create(const QualifiedName&, Document*, bool);
 
     unsigned width() const;
@@ -93,6 +94,22 @@
     AtomicString m_defaultPosterURL;
 };
 
+inline bool isHTMLVideoElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::videoTag);
+}
+
+inline bool isHTMLVideoElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::videoTag);
+}
+
+inline HTMLVideoElement* toHTMLVideoElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLVideoElement(node));
+    return static_cast<HTMLVideoElement*>(node);
+}
+
 } //namespace
 
 #endif
diff --git a/Source/core/html/HTMLViewSourceDocument.cpp b/Source/core/html/HTMLViewSourceDocument.cpp
index b40c084..c9d5d7c 100644
--- a/Source/core/html/HTMLViewSourceDocument.cpp
+++ b/Source/core/html/HTMLViewSourceDocument.cpp
@@ -45,8 +45,8 @@
 
 using namespace HTMLNames;
 
-HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, const String& mimeType)
-    : HTMLDocument(frame, url)
+HTMLViewSourceDocument::HTMLViewSourceDocument(const DocumentInit& initializer, const String& mimeType)
+    : HTMLDocument(initializer)
     , m_type(mimeType)
 {
     styleSheetCollection()->setUsesBeforeAfterRulesOverride(true);
diff --git a/Source/core/html/HTMLViewSourceDocument.h b/Source/core/html/HTMLViewSourceDocument.h
index 9e196c8..45f870f 100644
--- a/Source/core/html/HTMLViewSourceDocument.h
+++ b/Source/core/html/HTMLViewSourceDocument.h
@@ -35,15 +35,15 @@
 
 class HTMLViewSourceDocument FINAL : public HTMLDocument {
 public:
-    static PassRefPtr<HTMLViewSourceDocument> create(Frame* frame, const KURL& url, const String& mimeType)
+    static PassRefPtr<HTMLViewSourceDocument> create(const DocumentInit& initializer, const String& mimeType)
     {
-        return adoptRef(new HTMLViewSourceDocument(frame, url, mimeType));
+        return adoptRef(new HTMLViewSourceDocument(initializer, mimeType));
     }
 
     void addSource(const String&, HTMLToken&);
 
 private:
-    HTMLViewSourceDocument(Frame*, const KURL&, const String& mimeType);
+    HTMLViewSourceDocument(const DocumentInit&, const String& mimeType);
 
     virtual PassRefPtr<DocumentParser> createParser() OVERRIDE;
 
diff --git a/Source/core/html/HiddenInputType.cpp b/Source/core/html/HiddenInputType.cpp
index 8b1d15c..056f379 100644
--- a/Source/core/html/HiddenInputType.cpp
+++ b/Source/core/html/HiddenInputType.cpp
@@ -37,7 +37,7 @@
 #include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/ImageData.h b/Source/core/html/ImageData.h
index 7fcfd3e..0032ebb 100644
--- a/Source/core/html/ImageData.h
+++ b/Source/core/html/ImageData.h
@@ -31,9 +31,9 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/platform/graphics/IntSize.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Uint8ClampedArray.h>
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Uint8ClampedArray.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/ImageDocument.cpp b/Source/core/html/ImageDocument.cpp
index eb594be..db1a3d1 100644
--- a/Source/core/html/ImageDocument.cpp
+++ b/Source/core/html/ImageDocument.cpp
@@ -31,8 +31,11 @@
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/RawDataDocumentParser.h"
+#include "core/html/HTMLBodyElement.h"
+#include "core/html/HTMLHeadElement.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLMetaElement.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
@@ -95,28 +98,6 @@
     virtual void finish();
 };
 
-class ImageDocumentElement FINAL : public HTMLImageElement {
-public:
-    static PassRefPtr<ImageDocumentElement> create(ImageDocument*);
-
-private:
-    ImageDocumentElement(ImageDocument* document)
-        : HTMLImageElement(imgTag, document)
-        , m_imageDocument(document)
-    {
-    }
-
-    virtual ~ImageDocumentElement();
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
-
-    ImageDocument* m_imageDocument;
-};
-
-inline PassRefPtr<ImageDocumentElement> ImageDocumentElement::create(ImageDocument* document)
-{
-    return adoptRef(new ImageDocumentElement(document));
-}
-
 // --------
 
 static float pageZoomFactor(const Document* document)
@@ -167,8 +148,8 @@
     
 // --------
 
-ImageDocument::ImageDocument(Frame* frame, const KURL& url)
-    : HTMLDocument(frame, url, ImageDocumentClass)
+ImageDocument::ImageDocument(const DocumentInit& initializer)
+    : HTMLDocument(initializer, ImageDocumentClass)
     , m_imageElement(0)
     , m_imageSizeIsKnown(false)
     , m_didShrinkImage(false)
@@ -185,40 +166,43 @@
 
 void ImageDocument::createDocumentStructure()
 {
-    RefPtr<Element> rootElement = Document::createElement(htmlTag, false);
-    appendChild(rootElement, IGNORE_EXCEPTION);
-    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
+    RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(this);
+    appendChild(rootElement, ASSERT_NO_EXCEPTION, AttachLazily);
+    rootElement->insertedByParser();
 
     if (frame() && frame()->loader())
         frame()->loader()->dispatchDocumentElementAvailable();
-    
-    RefPtr<Element> body = Document::createElement(bodyTag, false);
+
+    RefPtr<HTMLHeadElement> head = HTMLHeadElement::create(this);
+    RefPtr<HTMLMetaElement> meta = HTMLMetaElement::create(this);
+    meta->setAttribute(nameAttr, "viewport");
+    meta->setAttribute(contentAttr, "width=device-width");
+    head->appendChild(meta, ASSERT_NO_EXCEPTION, AttachLazily);
+
+    RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(this);
     body->setAttribute(styleAttr, "margin: 0px;");
-    
-    rootElement->appendChild(body, IGNORE_EXCEPTION);
-    
-    RefPtr<ImageDocumentElement> imageElement = ImageDocumentElement::create(this);
-    
-    imageElement->setAttribute(styleAttr, "-webkit-user-select: none");        
-    imageElement->setLoadManually(true);
-    imageElement->setSrc(url().string());
-    
-    body->appendChild(imageElement, IGNORE_EXCEPTION);
-    
+
+    m_imageElement = HTMLImageElement::create(this);
+    m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
+    m_imageElement->setLoadManually(true);
+    m_imageElement->setSrc(url().string());
+    body->appendChild(m_imageElement.get(), ASSERT_NO_EXCEPTION, AttachLazily);
+
     if (shouldShrinkToFit()) {
         // Add event listeners
         RefPtr<EventListener> listener = ImageEventListener::create(this);
         if (DOMWindow* domWindow = this->domWindow())
             domWindow->addEventListener("resize", listener, false);
-        imageElement->addEventListener("click", listener.release(), false);
+        m_imageElement->addEventListener("click", listener.release(), false);
     }
 
-    m_imageElement = imageElement.get();
+    rootElement->appendChild(head, ASSERT_NO_EXCEPTION, AttachLazily);
+    rootElement->appendChild(body, ASSERT_NO_EXCEPTION, AttachLazily);
 }
 
 float ImageDocument::scale() const
 {
-    if (!m_imageElement)
+    if (!m_imageElement || m_imageElement->document() != this)
         return 1.0f;
 
     FrameView* view = frame()->view();
@@ -236,7 +220,7 @@
 
 void ImageDocument::resizeImageToFit()
 {
-    if (!m_imageElement)
+    if (!m_imageElement || m_imageElement->document() != this)
         return;
 
     LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), pageZoomFactor(this));
@@ -291,7 +275,7 @@
 
 void ImageDocument::restoreImageSize()
 {
-    if (!m_imageElement || !m_imageSizeIsKnown)
+    if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this)
         return;
     
     LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), 1.0f);
@@ -308,7 +292,7 @@
 
 bool ImageDocument::imageFitsInWindow() const
 {
-    if (!m_imageElement)
+    if (!m_imageElement || m_imageElement->document() != this)
         return true;
 
     FrameView* view = frame()->view();
@@ -323,7 +307,7 @@
 
 void ImageDocument::windowSizeChanged()
 {
-    if (!m_imageElement || !m_imageSizeIsKnown)
+    if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this)
         return;
 
     bool fitsInWindow = imageFitsInWindow();
@@ -368,6 +352,12 @@
         frame()->page()->mainFrame() == frame();
 }
 
+void ImageDocument::dispose()
+{
+    m_imageElement = 0;
+    HTMLDocument::dispose();
+}
+
 // --------
 
 void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
@@ -387,21 +377,4 @@
     return false;
 }
 
-// --------
-
-ImageDocumentElement::~ImageDocumentElement()
-{
-    if (m_imageDocument)
-        m_imageDocument->disconnectImageElement();
-}
-
-void ImageDocumentElement::didMoveToNewDocument(Document* oldDocument)
-{
-    if (m_imageDocument) {
-        m_imageDocument->disconnectImageElement();
-        m_imageDocument = 0;
-    }
-    HTMLImageElement::didMoveToNewDocument(oldDocument);
-}
-
 }
diff --git a/Source/core/html/ImageDocument.h b/Source/core/html/ImageDocument.h
index 9dd3253..81a1675 100644
--- a/Source/core/html/ImageDocument.h
+++ b/Source/core/html/ImageDocument.h
@@ -26,31 +26,32 @@
 #define ImageDocument_h
 
 #include "core/html/HTMLDocument.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
 class CachedImage;
-class ImageDocumentElement;
+class HTMLImageElement;
 
 class ImageDocument FINAL : public HTMLDocument {
 public:
-    static PassRefPtr<ImageDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<ImageDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new ImageDocument(frame, url));
+        return adoptRef(new ImageDocument(initializer));
     }
 
     CachedImage* cachedImage();
-    ImageDocumentElement* imageElement() const { return m_imageElement; }
-    void disconnectImageElement() { m_imageElement = 0; }
-    
+    HTMLImageElement* imageElement() const { return m_imageElement.get(); }
+
     void windowSizeChanged();
     void imageUpdated();
     void imageClicked(int x, int y);
 
 private:
-    ImageDocument(Frame*, const KURL&);
+    ImageDocument(const DocumentInit&);
 
-    virtual PassRefPtr<DocumentParser> createParser();
+    virtual PassRefPtr<DocumentParser> createParser() OVERRIDE;
+    virtual void dispose() OVERRIDE;
 
     void createDocumentStructure();
     void resizeImageToFit();
@@ -59,7 +60,7 @@
     bool shouldShrinkToFit() const;
     float scale() const;
     
-    ImageDocumentElement* m_imageElement;
+    RefPtr<HTMLImageElement> m_imageElement;
     
     // Whether enough of the image has been loaded to determine its size
     bool m_imageSizeIsKnown;
diff --git a/Source/core/html/ImageInputType.cpp b/Source/core/html/ImageInputType.cpp
index 3147783..7c03d83 100644
--- a/Source/core/html/ImageInputType.cpp
+++ b/Source/core/html/ImageInputType.cpp
@@ -33,7 +33,7 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/loader/cache/CachedImage.h"
 #include "core/rendering/RenderImage.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/InputType.cpp b/Source/core/html/InputType.cpp
index 665b6ae..57c8ad3 100644
--- a/Source/core/html/InputType.cpp
+++ b/Source/core/html/InputType.cpp
@@ -74,9 +74,9 @@
 #include "core/platform/text/TextBreakIterator.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderTheme.h"
-#include <wtf/Assertions.h>
-#include <wtf/HashMap.h>
-#include <wtf/text/StringHash.h>
+#include "wtf/Assertions.h"
+#include "wtf/HashMap.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
@@ -194,7 +194,7 @@
 
 void InputType::setValueAsDate(double, ExceptionCode& ec) const
 {
-    ec = INVALID_STATE_ERR;
+    ec = InvalidStateError;
 }
 
 double InputType::valueAsDouble() const
@@ -209,7 +209,7 @@
 
 void InputType::setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode& ec) const
 {
-    ec = INVALID_STATE_ERR;
+    ec = InvalidStateError;
 }
 
 bool InputType::supportsValidation() const
@@ -465,7 +465,7 @@
     root->removeChildren();
 
     // It's ok to clear contents of all other ShadowRoots because they must have
-    // been created by TextFieldDecorationElement, and we don't allow adding
+    // been created by InputFieldPasswordGeneratorButtonElement, and we don't allow adding
     // AuthorShadowRoot to HTMLInputElement.
     while ((root = root->youngerShadowRoot())) {
         root->removeChildren();
@@ -919,6 +919,11 @@
     return false;
 }
 
+bool InputType::supportsInputModeAttribute() const
+{
+    return false;
+}
+
 bool InputType::supportsSelectionAPI() const
 {
     return false;
@@ -938,24 +943,24 @@
 {
     StepRange stepRange(createStepRange(anyStepHandling));
     if (!stepRange.hasStep()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     const Decimal current = parseToNumberOrNaN(element()->value());
     if (!current.isFinite()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     Decimal newValue = current + stepRange.step() * count;
     if (!newValue.isFinite()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     const Decimal acceptableErrorValue = stepRange.acceptableError();
     if (newValue - stepRange.minimum() < -acceptableErrorValue) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     if (newValue < stepRange.minimum())
@@ -966,7 +971,7 @@
         newValue = stepRange.alignValueForStep(current, newValue);
 
     if (newValue - stepRange.maximum() > acceptableErrorValue) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     if (newValue > stepRange.maximum())
@@ -994,7 +999,7 @@
 void InputType::stepUp(int n, ExceptionCode& ec)
 {
     if (!isSteppable()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     applyStep(n, RejectAny, DispatchNoEvent, ec);
diff --git a/Source/core/html/InputType.h b/Source/core/html/InputType.h
index 28f95d7..e4f473e 100644
--- a/Source/core/html/InputType.h
+++ b/Source/core/html/InputType.h
@@ -221,6 +221,7 @@
 #if ENABLE(INPUT_SPEECH)
     virtual HTMLElement* speechButtonElement() const { return 0; }
 #endif
+    virtual HTMLElement* passwordGeneratorButtonElement() const { return 0; }
     virtual HTMLElement* sliderThumbElement() const { return 0; }
     virtual HTMLElement* sliderTrackElement() const { return 0; }
     virtual HTMLElement* placeholderElement() const;
@@ -290,6 +291,8 @@
 
     virtual bool supportsIndeterminateAppearance() const;
 
+    virtual bool supportsInputModeAttribute() const;
+
     virtual bool supportsSelectionAPI() const;
 
     // Gets width and height of the input element if the type of the
diff --git a/Source/core/html/InputTypeNames.h b/Source/core/html/InputTypeNames.h
index 0a94c8b..bb84f3e 100644
--- a/Source/core/html/InputTypeNames.h
+++ b/Source/core/html/InputTypeNames.h
@@ -22,7 +22,7 @@
 #ifndef InputTypeNames_h
 #define InputTypeNames_h
 
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/LabelsNodeList.cpp b/Source/core/html/LabelsNodeList.cpp
index f925e9f..a822c47 100644
--- a/Source/core/html/LabelsNodeList.cpp
+++ b/Source/core/html/LabelsNodeList.cpp
@@ -41,11 +41,11 @@
 LabelsNodeList::~LabelsNodeList()
 {
     ownerNode()->nodeLists()->removeCacheWithAtomicName(this, LabelsNodeListType, starAtom);
-} 
-    
+}
+
 bool LabelsNodeList::nodeMatches(Element* testNode) const
 {
-    return testNode->hasTagName(labelTag) && static_cast<HTMLLabelElement*>(testNode)->control() == ownerNode();
+    return isHTMLLabelElement(testNode) && toHTMLLabelElement(testNode)->control() == ownerNode();
 }
 
 } // namespace WebCore
diff --git a/Source/core/html/LabelsNodeList.h b/Source/core/html/LabelsNodeList.h
index 8c7f211..83339a4 100644
--- a/Source/core/html/LabelsNodeList.h
+++ b/Source/core/html/LabelsNodeList.h
@@ -26,7 +26,7 @@
 #define LabelsNodeList_h
 
 #include "core/dom/LiveNodeList.h"
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/MediaController.cpp b/Source/core/html/MediaController.cpp
index eee60cf..f8f7b13 100644
--- a/Source/core/html/MediaController.cpp
+++ b/Source/core/html/MediaController.cpp
@@ -31,9 +31,9 @@
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/TimeRanges.h"
 #include "core/platform/Clock.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/AtomicString.h"
 
 using namespace WebCore;
 using namespace std;
@@ -157,7 +157,7 @@
     return m_position;
 }
 
-void MediaController::setCurrentTime(double time, ExceptionCode& code)
+void MediaController::setCurrentTime(double time, ExceptionCode& ec)
 {
     // When the user agent is to seek the media controller to a particular new playback position, 
     // it must follow these steps:
@@ -173,7 +173,7 @@
     
     // Seek each slaved media element to the new playback position relative to the media element timeline.
     for (size_t index = 0; index < m_mediaElements.size(); ++index)
-        m_mediaElements[index]->seek(time, code);
+        m_mediaElements[index]->seek(time, ec);
 
     scheduleTimeupdateEvent();
 }
@@ -251,7 +251,7 @@
     scheduleEvent(eventNames().ratechangeEvent);
 }
 
-void MediaController::setVolume(double level, ExceptionCode& code)
+void MediaController::setVolume(double level, ExceptionCode& ec)
 {
     if (m_volume == level)
         return;
@@ -259,7 +259,7 @@
     // If the new value is outside the range 0.0 to 1.0 inclusive, then, on setting, an 
     // IndexSizeError exception must be raised instead.
     if (level < 0 || level > 1) {
-        code = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
         
diff --git a/Source/core/html/MediaController.idl b/Source/core/html/MediaController.idl
index 54c4153..8516705 100644
--- a/Source/core/html/MediaController.idl
+++ b/Source/core/html/MediaController.idl
@@ -26,9 +26,8 @@
 [
     EnabledAtRuntime=media,
     Constructor,
-    ConstructorCallWith=ScriptExecutionContext,
-    EventTarget
-] interface MediaController {
+    ConstructorCallWith=ScriptExecutionContext
+] interface MediaController : EventTarget {
     readonly attribute TimeRanges buffered;
     readonly attribute TimeRanges seekable;
 
@@ -47,13 +46,4 @@
 
     [SetterRaisesException] attribute double volume;
     attribute boolean muted;
-
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
diff --git a/Source/core/html/MediaControllerInterface.h b/Source/core/html/MediaControllerInterface.h
index b54206d..d81283a 100644
--- a/Source/core/html/MediaControllerInterface.h
+++ b/Source/core/html/MediaControllerInterface.h
@@ -26,7 +26,7 @@
 #ifndef MediaControllerInterface_h
 #define MediaControllerInterface_h
 
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/MediaDocument.cpp b/Source/core/html/MediaDocument.cpp
index 4be22af..496ae2f 100644
--- a/Source/core/html/MediaDocument.cpp
+++ b/Source/core/html/MediaDocument.cpp
@@ -31,9 +31,12 @@
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
-#include "core/dom/NodeList.h"
+#include "core/dom/NodeTraversal.h"
 #include "core/dom/RawDataDocumentParser.h"
+#include "core/html/HTMLBodyElement.h"
+#include "core/html/HTMLHeadElement.h"
 #include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLMetaElement.h"
 #include "core/html/HTMLSourceElement.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/loader/DocumentLoader.h"
@@ -54,9 +57,9 @@
     }
     
 private:
-    MediaDocumentParser(Document* document)
+    explicit MediaDocumentParser(Document* document)
         : RawDataDocumentParser(document)
-        , m_mediaElement(0)
+        , m_didBuildDocumentStructure(false)
     {
     }
 
@@ -64,53 +67,58 @@
 
     void createDocumentStructure();
 
-    HTMLMediaElement* m_mediaElement;
+    bool m_didBuildDocumentStructure;
 };
-    
+
 void MediaDocumentParser::createDocumentStructure()
 {
-    RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
-    document()->appendChild(rootElement, IGNORE_EXCEPTION);
-    document()->setCSSTarget(rootElement.get());
-    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
+    RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(document());
+    rootElement->insertedByParser();
 
     if (document()->frame())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
-        
-    RefPtr<Element> body = document()->createElement(bodyTag, false);
-    rootElement->appendChild(body, IGNORE_EXCEPTION);
 
-    RefPtr<Element> mediaElement = document()->createElement(videoTag, false);
+    RefPtr<HTMLHeadElement> head = HTMLHeadElement::create(document());
+    RefPtr<HTMLMetaElement> meta = HTMLMetaElement::create(document());
+    meta->setAttribute(nameAttr, "viewport");
+    meta->setAttribute(contentAttr, "width=device-width");
+    head->appendChild(meta.release(), ASSERT_NO_EXCEPTION);
 
-    m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get());
-    m_mediaElement->setAttribute(controlsAttr, "");
-    m_mediaElement->setAttribute(autoplayAttr, "");
+    RefPtr<HTMLVideoElement> media = HTMLVideoElement::create(document());
+    media->setAttribute(controlsAttr, "");
+    media->setAttribute(autoplayAttr, "");
+    media->setAttribute(nameAttr, "media");
 
-    m_mediaElement->setAttribute(nameAttr, "media");
-
-    RefPtr<Element> sourceElement = document()->createElement(sourceTag, false);
-    HTMLSourceElement* source = static_cast<HTMLSourceElement*>(sourceElement.get());
+    RefPtr<HTMLSourceElement> source = HTMLSourceElement::create(document());
     source->setSrc(document()->url());
 
     if (DocumentLoader* loader = document()->loader())
         source->setType(loader->responseMIMEType());
 
-    m_mediaElement->appendChild(sourceElement, IGNORE_EXCEPTION);
-    body->appendChild(mediaElement, IGNORE_EXCEPTION);
+    media->appendChild(source.release(), ASSERT_NO_EXCEPTION);
+
+    RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(document());
+    body->appendChild(media.release(), ASSERT_NO_EXCEPTION);
+
+    rootElement->appendChild(head.release(), ASSERT_NO_EXCEPTION);
+    rootElement->appendChild(body.release(), ASSERT_NO_EXCEPTION);
+
+    document()->appendChild(rootElement.release(), ASSERT_NO_EXCEPTION, AttachLazily);
+    m_didBuildDocumentStructure = true;
 }
 
 size_t MediaDocumentParser::appendBytes(const char*, size_t)
 {
-    if (m_mediaElement)
+    if (m_didBuildDocumentStructure)
         return 0;
 
     createDocumentStructure();
     finish();
     return 0;
 }
-    
-MediaDocument::MediaDocument(Frame* frame, const KURL& url)
-    : HTMLDocument(frame, url, MediaDocumentClass)
+
+MediaDocument::MediaDocument(const DocumentInit& initializer)
+    : HTMLDocument(initializer, MediaDocumentClass)
 {
     setCompatibilityMode(QuirksMode);
     lockCompatibilityMode();
@@ -121,25 +129,20 @@
     return MediaDocumentParser::create(this);
 }
 
-static inline HTMLVideoElement* descendentVideoElement(Node* node)
+static inline HTMLVideoElement* descendentVideoElement(Node* root)
 {
-    ASSERT(node);
+    ASSERT(root);
 
-    if (node->hasTagName(videoTag))
-        return static_cast<HTMLVideoElement*>(node);
-
-    RefPtr<NodeList> nodeList = node->getElementsByTagNameNS(videoTag.namespaceURI(), videoTag.localName());
-   
-    if (nodeList.get()->length() > 0)
-        return static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
+    for (Node* node = root; node; node = NodeTraversal::next(node, root)) {
+        if (isHTMLVideoElement(node))
+            return toHTMLVideoElement(node);
+    }
 
     return 0;
 }
 
 void MediaDocument::defaultEventHandler(Event* event)
 {
-    // Match the default Quicktime plugin behavior to allow 
-    // clicking and double-clicking to pause and play the media.
     Node* targetNode = event->target()->toNode();
     if (!targetNode)
         return;
diff --git a/Source/core/html/MediaDocument.h b/Source/core/html/MediaDocument.h
index afba636..ae68d81 100644
--- a/Source/core/html/MediaDocument.h
+++ b/Source/core/html/MediaDocument.h
@@ -32,13 +32,13 @@
 
 class MediaDocument FINAL : public HTMLDocument {
 public:
-    static PassRefPtr<MediaDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<MediaDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new MediaDocument(frame, url));
+        return adoptRef(new MediaDocument(initializer));
     }
 
 private:
-    MediaDocument(Frame*, const KURL&);
+    MediaDocument(const DocumentInit&);
 
     virtual PassRefPtr<DocumentParser> createParser() OVERRIDE;
 
diff --git a/Source/core/html/MediaFragmentURIParser.cpp b/Source/core/html/MediaFragmentURIParser.cpp
index 5a8ddf9..59042b1 100644
--- a/Source/core/html/MediaFragmentURIParser.cpp
+++ b/Source/core/html/MediaFragmentURIParser.cpp
@@ -24,13 +24,12 @@
  */
 
 #include "config.h"
-
 #include "core/html/MediaFragmentURIParser.h"
 
 #include "core/platform/graphics/MediaPlayer.h"
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/MediaKeyEvent.cpp b/Source/core/html/MediaKeyEvent.cpp
index 4b6af83..71c8a63 100644
--- a/Source/core/html/MediaKeyEvent.cpp
+++ b/Source/core/html/MediaKeyEvent.cpp
@@ -24,11 +24,10 @@
  */
 
 #include "config.h"
-
 #include "core/html/MediaKeyEvent.h"
 
 #include "core/dom/EventNames.h"
-#include <wtf/Uint8Array.h>
+#include "wtf/Uint8Array.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/MonthInputType.cpp b/Source/core/html/MonthInputType.cpp
index 885f311..3de0be5 100644
--- a/Source/core/html/MonthInputType.cpp
+++ b/Source/core/html/MonthInputType.cpp
@@ -35,15 +35,15 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/DateComponents.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/DateMath.h>
-#include <wtf/MathExtras.h>
-#include <wtf/PassOwnPtr.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/DateMath.h"
+#include "wtf/MathExtras.h"
+#include "wtf/PassOwnPtr.h"
 
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 #include "core/html/DateTimeFieldsState.h"
 #include "core/platform/text/PlatformLocale.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 #endif
 
 namespace WebCore {
diff --git a/Source/core/html/NumberInputType.cpp b/Source/core/html/NumberInputType.cpp
index be73a85..6b49e00 100644
--- a/Source/core/html/NumberInputType.cpp
+++ b/Source/core/html/NumberInputType.cpp
@@ -127,11 +127,11 @@
     // FIXME: We should use numeric_limits<double>::max for number input type.
     const double floatMax = numeric_limits<float>::max();
     if (newValue < -floatMax) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     if (newValue > floatMax) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     element()->setValue(serializeForNumberType(newValue), eventBehavior);
@@ -142,11 +142,11 @@
     // FIXME: We should use numeric_limits<double>::max for number input type.
     const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max());
     if (newValue < -floatMax) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     if (newValue > floatMax) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     element()->setValue(serializeForNumberType(newValue), eventBehavior);
diff --git a/Source/core/html/PasswordInputType.cpp b/Source/core/html/PasswordInputType.cpp
index b56e423..819b75e 100644
--- a/Source/core/html/PasswordInputType.cpp
+++ b/Source/core/html/PasswordInputType.cpp
@@ -35,8 +35,11 @@
 #include "core/html/FormController.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
-#include <wtf/Assertions.h>
-#include <wtf/PassOwnPtr.h>
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Page.h"
+#include "wtf/Assertions.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
@@ -45,6 +48,38 @@
     return adoptPtr(new PasswordInputType(element));
 }
 
+HTMLElement* PasswordInputType::passwordGeneratorButtonElement() const
+{
+    return m_generatorButton.get();
+}
+
+bool PasswordInputType::isPasswordGenerationEnabled() const
+{
+    Document* document = element()->document();
+    ChromeClient* chromeClient = document->page() ? document->page()->chrome().client() : 0;
+    return chromeClient && chromeClient->isPasswordGenerationEnabled();
+}
+
+bool PasswordInputType::needsContainer() const
+{
+    return BaseTextInputType::needsContainer() || isPasswordGenerationEnabled();
+}
+
+void PasswordInputType::createShadowSubtree()
+{
+    BaseTextInputType::createShadowSubtree();
+    if (isPasswordGenerationEnabled()) {
+        m_generatorButton = PasswordGeneratorButtonElement::create(element()->document());
+        m_generatorButton->decorate(element());
+    }
+}
+
+void PasswordInputType::destroyShadowSubtree()
+{
+    BaseTextInputType::destroyShadowSubtree();
+    m_generatorButton = 0;
+}
+
 const AtomicString& PasswordInputType::formControlType() const
 {
     return InputTypeNames::password();
diff --git a/Source/core/html/PasswordInputType.h b/Source/core/html/PasswordInputType.h
index 96afdb5..46ba3dc 100644
--- a/Source/core/html/PasswordInputType.h
+++ b/Source/core/html/PasswordInputType.h
@@ -32,15 +32,20 @@
 #define PasswordInputType_h
 
 #include "core/html/BaseTextInputType.h"
+#include "core/html/shadow/PasswordGeneratorButtonElement.h"
 
 namespace WebCore {
 
-class PasswordInputType : public BaseTextInputType {
+class PasswordInputType FINAL : public BaseTextInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
     PasswordInputType(HTMLInputElement* element) : BaseTextInputType(element) { }
+    virtual HTMLElement* passwordGeneratorButtonElement() const OVERRIDE;
+    virtual bool needsContainer() const OVERRIDE;
+    virtual void createShadowSubtree() OVERRIDE;
+    virtual void destroyShadowSubtree() OVERRIDE;
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE;
     virtual FormControlState saveFormControlState() const OVERRIDE;
@@ -52,6 +57,10 @@
     virtual bool isPasswordField() const OVERRIDE;
     virtual void handleFocusEvent(Node* oldFocusedNode, FocusDirection) OVERRIDE;
     virtual void handleBlurEvent() OVERRIDE;
+
+    bool isPasswordGenerationEnabled() const;
+
+    RefPtr<PasswordGeneratorButtonElement> m_generatorButton;
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/PluginDocument.cpp b/Source/core/html/PluginDocument.cpp
index b4f129c..7164d88 100644
--- a/Source/core/html/PluginDocument.cpp
+++ b/Source/core/html/PluginDocument.cpp
@@ -72,7 +72,7 @@
 {
     RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
     document()->appendChild(rootElement, IGNORE_EXCEPTION);
-    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
+    toHTMLHtmlElement(rootElement.get())->insertedByParser();
 
     if (document()->frame() && document()->frame()->loader())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
@@ -156,8 +156,8 @@
     return 0;
 }
 
-PluginDocument::PluginDocument(Frame* frame, const KURL& url)
-    : HTMLDocument(frame, url, PluginDocumentClass)
+PluginDocument::PluginDocument(const DocumentInit& initializer)
+    : HTMLDocument(initializer, PluginDocumentClass)
     , m_shouldLoadPluginManually(true)
 {
     setCompatibilityMode(QuirksMode);
diff --git a/Source/core/html/PluginDocument.h b/Source/core/html/PluginDocument.h
index bd74d2c..78c8355 100644
--- a/Source/core/html/PluginDocument.h
+++ b/Source/core/html/PluginDocument.h
@@ -34,9 +34,9 @@
 
 class PluginDocument FINAL : public HTMLDocument {
 public:
-    static PassRefPtr<PluginDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<PluginDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new PluginDocument(frame, url));
+        return adoptRef(new PluginDocument(initializer));
     }
 
     void setPluginNode(Node* pluginNode) { m_pluginNode = pluginNode; }
@@ -51,7 +51,7 @@
     bool shouldLoadPluginManually() { return m_shouldLoadPluginManually; }
 
 private:
-    PluginDocument(Frame*, const KURL&);
+    PluginDocument(const DocumentInit&);
 
     virtual PassRefPtr<DocumentParser> createParser() OVERRIDE;
         
diff --git a/Source/core/html/RadioInputType.cpp b/Source/core/html/RadioInputType.cpp
index 1818056..45b3b7f 100644
--- a/Source/core/html/RadioInputType.cpp
+++ b/Source/core/html/RadioInputType.cpp
@@ -30,7 +30,7 @@
 #include "core/html/InputTypeNames.h"
 #include "core/page/SpatialNavigation.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
@@ -95,7 +95,7 @@
             break;
         if (inputElement->isRadioButton() && inputElement->name() == element()->name() && inputElement->isFocusable()) {
             RefPtr<HTMLInputElement> protector(inputElement);
-            document->setFocusedNode(inputElement);
+            document->setFocusedElement(inputElement);
             inputElement->dispatchSimulatedClick(event, SendNoEvents, DoNotShowPressedLook);
             event->setDefaultHandled();
             return;
diff --git a/Source/core/html/ResetInputType.cpp b/Source/core/html/ResetInputType.cpp
index 332e3ed..6477ec1 100644
--- a/Source/core/html/ResetInputType.cpp
+++ b/Source/core/html/ResetInputType.cpp
@@ -37,7 +37,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/SearchInputType.cpp b/Source/core/html/SearchInputType.cpp
index dc515fc..ae5b543 100644
--- a/Source/core/html/SearchInputType.cpp
+++ b/Source/core/html/SearchInputType.cpp
@@ -37,7 +37,7 @@
 #include "core/html/InputTypeNames.h"
 #include "core/html/shadow/TextControlInnerElements.h"
 #include "core/rendering/RenderSearchField.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
@@ -185,4 +185,9 @@
     TextFieldInputType::didSetValueByUserEdit(state);
 }
 
+bool SearchInputType::supportsInputModeAttribute() const
+{
+    return true;
+}
+
 } // namespace WebCore
diff --git a/Source/core/html/SearchInputType.h b/Source/core/html/SearchInputType.h
index c30272e..33a2c0a 100644
--- a/Source/core/html/SearchInputType.h
+++ b/Source/core/html/SearchInputType.h
@@ -59,6 +59,7 @@
     virtual HTMLElement* cancelButtonElement() const OVERRIDE;
     virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
     virtual void didSetValueByUserEdit(ValueChangeState) OVERRIDE;
+    virtual bool supportsInputModeAttribute() const OVERRIDE;
 
     void searchEventTimerFired(Timer<SearchInputType>*);
     bool searchEventsShouldBeDispatched() const;
diff --git a/Source/core/html/StepRange.cpp b/Source/core/html/StepRange.cpp
index fd51d03..60a1e87 100644
--- a/Source/core/html/StepRange.cpp
+++ b/Source/core/html/StepRange.cpp
@@ -23,8 +23,8 @@
 
 #include "HTMLNames.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include <wtf/MathExtras.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/MathExtras.h"
+#include "wtf/text/WTFString.h"
 
 using namespace std;
 
diff --git a/Source/core/html/SubmitInputType.cpp b/Source/core/html/SubmitInputType.cpp
index 1cb2c63..1aadb5f 100644
--- a/Source/core/html/SubmitInputType.cpp
+++ b/Source/core/html/SubmitInputType.cpp
@@ -38,7 +38,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/TelephoneInputType.cpp b/Source/core/html/TelephoneInputType.cpp
index 3e4adfc..815fd8d 100644
--- a/Source/core/html/TelephoneInputType.cpp
+++ b/Source/core/html/TelephoneInputType.cpp
@@ -32,7 +32,7 @@
 #include "core/html/TelephoneInputType.h"
 
 #include "core/html/InputTypeNames.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/TextDocument.cpp b/Source/core/html/TextDocument.cpp
index 83caa01..acff1d9 100644
--- a/Source/core/html/TextDocument.cpp
+++ b/Source/core/html/TextDocument.cpp
@@ -29,8 +29,8 @@
 
 namespace WebCore {
 
-TextDocument::TextDocument(Frame* frame, const KURL& url)
-    : HTMLDocument(frame, url)
+TextDocument::TextDocument(const DocumentInit& initializer)
+    : HTMLDocument(initializer)
 {
     setCompatibilityMode(QuirksMode);
     lockCompatibilityMode();
diff --git a/Source/core/html/TextDocument.h b/Source/core/html/TextDocument.h
index c0d3384..8ae9365 100644
--- a/Source/core/html/TextDocument.h
+++ b/Source/core/html/TextDocument.h
@@ -31,13 +31,13 @@
 
 class TextDocument FINAL : public HTMLDocument {
 public:
-    static PassRefPtr<TextDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<TextDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new TextDocument(frame, url));
+        return adoptRef(new TextDocument(initializer));
     }
 
 private:
-    TextDocument(Frame*, const KURL&);
+    TextDocument(const DocumentInit&);
     
     virtual PassRefPtr<DocumentParser> createParser();
 };
diff --git a/Source/core/html/TextFieldInputType.cpp b/Source/core/html/TextFieldInputType.cpp
index 9c848cb..1cd61d6 100644
--- a/Source/core/html/TextFieldInputType.cpp
+++ b/Source/core/html/TextFieldInputType.cpp
@@ -44,15 +44,13 @@
 #include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/shadow/TextControlInnerElements.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
 #include "core/page/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderTextControlSingleLine.h"
 #include "core/rendering/RenderTheme.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -241,10 +239,8 @@
     ASSERT(!m_innerSpinButton);
 
     Document* document = element()->document();
-    ChromeClient* chromeClient = document->page() ? document->page()->chrome().client() : 0;
-    bool shouldAddDecorations = chromeClient && chromeClient->willAddTextFieldDecorationsTo(element());
     bool shouldHaveSpinButton = this->shouldHaveSpinButton();
-    bool createsContainer = shouldHaveSpinButton || needsContainer() || shouldAddDecorations;
+    bool createsContainer = shouldHaveSpinButton || needsContainer();
 
     m_innerText = TextControlInnerTextElement::create(document);
     if (!createsContainer) {
@@ -273,9 +269,6 @@
         m_innerSpinButton = SpinButtonElement::create(document, *this);
         m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
     }
-
-    if (shouldAddDecorations)
-        chromeClient->addTextFieldDecorationsTo(element());
 }
 
 HTMLElement* TextFieldInputType::containerElement() const
diff --git a/Source/core/html/TextInputType.cpp b/Source/core/html/TextInputType.cpp
index ff8d2bf..cfdfd9a 100644
--- a/Source/core/html/TextInputType.cpp
+++ b/Source/core/html/TextInputType.cpp
@@ -33,7 +33,7 @@
 
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
@@ -64,4 +64,9 @@
     return true;
 }
 
+bool TextInputType::supportsInputModeAttribute() const
+{
+    return true;
+}
+
 } // namespace WebCore
diff --git a/Source/core/html/TextInputType.h b/Source/core/html/TextInputType.h
index 5f4ebf7..bb9e6b3 100644
--- a/Source/core/html/TextInputType.h
+++ b/Source/core/html/TextInputType.h
@@ -44,6 +44,7 @@
     virtual void attach() OVERRIDE;
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual bool shouldRespectSpeechAttribute() OVERRIDE;
+    virtual bool supportsInputModeAttribute() const OVERRIDE;
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/TimeInputType.cpp b/Source/core/html/TimeInputType.cpp
index c20d431..916761c 100644
--- a/Source/core/html/TimeInputType.cpp
+++ b/Source/core/html/TimeInputType.cpp
@@ -35,15 +35,15 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/DateComponents.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/DateMath.h>
-#include <wtf/MathExtras.h>
-#include <wtf/PassOwnPtr.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/DateMath.h"
+#include "wtf/MathExtras.h"
+#include "wtf/PassOwnPtr.h"
 
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 #include "core/html/DateTimeFieldsState.h"
 #include "core/platform/text/PlatformLocale.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 #endif
 
 namespace WebCore {
diff --git a/Source/core/html/TimeRanges.cpp b/Source/core/html/TimeRanges.cpp
index 11cc533..1657115 100644
--- a/Source/core/html/TimeRanges.cpp
+++ b/Source/core/html/TimeRanges.cpp
@@ -20,7 +20,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -60,13 +60,15 @@
     if (!m_ranges.size())
         inverted->add(negInf, posInf);
     else {
-        if (double start = m_ranges.first().m_start != negInf)
+        double start = m_ranges.first().m_start;
+        if (start != negInf)
             inverted->add(negInf, start);
 
         for (size_t index = 0; index + 1 < m_ranges.size(); ++index)
             inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start);
 
-        if (double end = m_ranges.last().m_end != posInf)
+        double end = m_ranges.last().m_end;
+        if (end != posInf)
             inverted->add(end, posInf);
     }
 
@@ -76,12 +78,16 @@
 void TimeRanges::intersectWith(const TimeRanges* other)
 {
     ASSERT(other);
-    RefPtr<TimeRanges> inverted = copy();
-    RefPtr<TimeRanges> invertedOther = other->copy();
-    inverted->unionWith(invertedOther.get());
-    inverted->invert();
 
-    m_ranges.swap(inverted->m_ranges);
+    if (other == this)
+        return;
+
+    RefPtr<TimeRanges> invertedOther = other->copy();
+    invertedOther->invert();
+
+    invert();
+    unionWith(invertedOther.get());
+    invert();
 }
 
 void TimeRanges::unionWith(const TimeRanges* other)
@@ -99,7 +105,7 @@
 double TimeRanges::start(unsigned index, ExceptionCode& ec) const
 {
     if (index >= length()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
     return m_ranges[index].m_start;
@@ -108,7 +114,7 @@
 double TimeRanges::end(unsigned index, ExceptionCode& ec) const
 {
     if (index >= length()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
     return m_ranges[index].m_end;
diff --git a/Source/core/html/TimeRanges.h b/Source/core/html/TimeRanges.h
index e5fb27c..e58de4a 100644
--- a/Source/core/html/TimeRanges.h
+++ b/Source/core/html/TimeRanges.h
@@ -20,7 +20,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef TimeRanges_h
@@ -49,7 +49,6 @@
     }
 
     PassRefPtr<TimeRanges> copy() const;
-    void invert();
     void intersectWith(const TimeRanges*);
     void unionWith(const TimeRanges*);
 
@@ -71,6 +70,8 @@
 
     TimeRanges(double start, double end);
 
+    void invert();
+
     // We consider all the Ranges to be semi-bounded as follow: [start, end[
     struct Range {
         Range() { }
@@ -86,7 +87,7 @@
         {
             return m_start <= point && point < m_end;
         }
-        
+
         inline bool isOverlappingRange(const Range& range) const
         {
             return isPointInRange(range.m_start) || isPointInRange(range.m_end) || range.isPointInRange(m_start);
@@ -96,7 +97,7 @@
         {
             return range.m_start == m_end || range.m_end == m_start;
         }
-        
+
         inline Range unionWithOverlappingOrContiguousRange(const Range& range) const
         {
             Range ret;
@@ -112,7 +113,7 @@
             return range.m_start >= m_end;
         }
     };
-    
+
     Vector<Range> m_ranges;
 };
 
diff --git a/Source/core/html/TimeRangesTest.cpp b/Source/core/html/TimeRangesTest.cpp
new file mode 100644
index 0000000..12c5104
--- /dev/null
+++ b/Source/core/html/TimeRangesTest.cpp
@@ -0,0 +1,290 @@
+/*
+ * 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/TimeRanges.h"
+
+#include "core/dom/ExceptionCodePlaceholder.h"
+#include <gtest/gtest.h>
+
+#include <sstream>
+
+using WebCore::TimeRanges;
+
+static std::string ToString(const TimeRanges& ranges)
+{
+    std::stringstream ss;
+    ss << "{";
+    for (unsigned i = 0; i < ranges.length(); ++i)
+        ss << " [" << ranges.start(i, IGNORE_EXCEPTION) << "," << ranges.end(i, IGNORE_EXCEPTION) << ")";
+    ss << " }";
+
+    return ss.str();
+}
+
+#define ASSERT_RANGE(expected, range) ASSERT_EQ(expected, ToString(*range))
+
+TEST(TimeRanges, Empty)
+{
+    ASSERT_RANGE("{ }", TimeRanges::create());
+}
+
+TEST(TimeRanges, SingleRange)
+{
+    ASSERT_RANGE("{ [1,2) }", TimeRanges::create(1, 2));
+}
+
+TEST(TimeRanges, AddOrder)
+{
+    RefPtr<TimeRanges> rangeA = TimeRanges::create();
+    RefPtr<TimeRanges> rangeB = TimeRanges::create();
+
+    rangeA->add(0, 2);
+    rangeA->add(3, 4);
+    rangeA->add(5, 100);
+
+    std::string expected = "{ [0,2) [3,4) [5,100) }";
+    ASSERT_RANGE(expected, rangeA);
+
+    // Add the values in rangeA to rangeB in reverse order.
+    for (int i = rangeA->length() - 1; i >= 0; --i)
+        rangeB->add(rangeA->start(i, IGNORE_EXCEPTION), rangeA->end(i, IGNORE_EXCEPTION));
+
+    ASSERT_RANGE(expected, rangeB);
+}
+
+TEST(TimeRanges, OverlappingAdds)
+{
+    RefPtr<TimeRanges> ranges = TimeRanges::create();
+
+    ranges->add(0, 2);
+    ranges->add(10, 11);
+    ASSERT_RANGE("{ [0,2) [10,11) }", ranges);
+
+    ranges->add(0, 2);
+    ASSERT_RANGE("{ [0,2) [10,11) }", ranges);
+
+    ranges->add(2, 3);
+    ASSERT_RANGE("{ [0,3) [10,11) }", ranges);
+
+    ranges->add(2, 6);
+    ASSERT_RANGE("{ [0,6) [10,11) }", ranges);
+
+    ranges->add(9, 10);
+    ASSERT_RANGE("{ [0,6) [9,11) }", ranges);
+
+    ranges->add(8, 10);
+    ASSERT_RANGE("{ [0,6) [8,11) }", ranges);
+
+    ranges->add(-1, 7);
+    ASSERT_RANGE("{ [-1,7) [8,11) }", ranges);
+
+    ranges->add(6, 9);
+    ASSERT_RANGE("{ [-1,11) }", ranges);
+}
+
+TEST(TimeRanges, IntersectWith_Self)
+{
+    RefPtr<TimeRanges> ranges = TimeRanges::create(0, 2);
+
+    ASSERT_RANGE("{ [0,2) }", ranges);
+
+    ranges->intersectWith(ranges.get());
+
+    ASSERT_RANGE("{ [0,2) }", ranges);
+}
+
+TEST(TimeRanges, IntersectWith_IdenticalRange)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create(0, 2);
+    RefPtr<TimeRanges> rangesB = rangesA->copy();
+
+    ASSERT_RANGE("{ [0,2) }", rangesA);
+    ASSERT_RANGE("{ [0,2) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ [0,2) }", rangesA);
+    ASSERT_RANGE("{ [0,2) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_Empty)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create(0, 2);
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    ASSERT_RANGE("{ [0,2) }", rangesA);
+    ASSERT_RANGE("{ }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ }", rangesA);
+    ASSERT_RANGE("{ }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_DisjointRanges1)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(0, 1);
+    rangesA->add(4, 5);
+
+    rangesB->add(2, 3);
+    rangesB->add(6, 7);
+
+    ASSERT_RANGE("{ [0,1) [4,5) }", rangesA);
+    ASSERT_RANGE("{ [2,3) [6,7) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ }", rangesA);
+    ASSERT_RANGE("{ [2,3) [6,7) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_DisjointRanges2)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(0, 1);
+    rangesA->add(4, 5);
+
+    rangesB->add(1, 4);
+    rangesB->add(5, 7);
+
+    ASSERT_RANGE("{ [0,1) [4,5) }", rangesA);
+    ASSERT_RANGE("{ [1,4) [5,7) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ }", rangesA);
+    ASSERT_RANGE("{ [1,4) [5,7) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_CompleteOverlap1)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(1, 3);
+    rangesA->add(4, 5);
+    rangesA->add(6, 9);
+
+    rangesB->add(0, 10);
+
+    ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
+    ASSERT_RANGE("{ [0,10) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
+    ASSERT_RANGE("{ [0,10) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_CompleteOverlap2)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(1, 3);
+    rangesA->add(4, 5);
+    rangesA->add(6, 9);
+
+    rangesB->add(1, 9);
+
+    ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
+    ASSERT_RANGE("{ [1,9) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
+    ASSERT_RANGE("{ [1,9) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_Gaps1)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(0, 2);
+    rangesA->add(4, 6);
+
+    rangesB->add(1, 5);
+
+    ASSERT_RANGE("{ [0,2) [4,6) }", rangesA);
+    ASSERT_RANGE("{ [1,5) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ [1,2) [4,5) }", rangesA);
+    ASSERT_RANGE("{ [1,5) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_Gaps2)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(0, 2);
+    rangesA->add(4, 6);
+    rangesA->add(8, 10);
+
+    rangesB->add(1, 9);
+
+    ASSERT_RANGE("{ [0,2) [4,6) [8,10) }", rangesA);
+    ASSERT_RANGE("{ [1,9) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ [1,2) [4,6) [8,9) }", rangesA);
+    ASSERT_RANGE("{ [1,9) }", rangesB);
+}
+
+TEST(TimeRanges, IntersectWith_Gaps3)
+{
+    RefPtr<TimeRanges> rangesA = TimeRanges::create();
+    RefPtr<TimeRanges> rangesB = TimeRanges::create();
+
+    rangesA->add(0, 2);
+    rangesA->add(4, 7);
+    rangesA->add(8, 10);
+
+    rangesB->add(1, 5);
+    rangesB->add(6, 9);
+
+    ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA);
+    ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
+
+    rangesA->intersectWith(rangesB.get());
+
+    ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA);
+    ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
+}
diff --git a/Source/core/html/TypeAhead.h b/Source/core/html/TypeAhead.h
index dcc50ed..9dd38e7 100644
--- a/Source/core/html/TypeAhead.h
+++ b/Source/core/html/TypeAhead.h
@@ -27,8 +27,8 @@
 #define TypeAhead_h
 
 #include "core/dom/DOMTimeStamp.h"
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/URL.idl b/Source/core/html/URL.idl
index 9f71a67..265f371 100644
--- a/Source/core/html/URL.idl
+++ b/Source/core/html/URL.idl
@@ -29,9 +29,6 @@
     Constructor,
     ImplementedAs=DOMURL
 ] interface URL {
-    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaSource? source);
-    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(WebKitMediaSource? source);
-    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(MediaStream? stream);
     [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(Blob? blob);
     [CallWith=ScriptExecutionContext] static void revokeObjectURL(DOMString url);
 };
diff --git a/Source/core/html/URLInputType.cpp b/Source/core/html/URLInputType.cpp
index 94d34d1..ca8dc54 100644
--- a/Source/core/html/URLInputType.cpp
+++ b/Source/core/html/URLInputType.cpp
@@ -34,7 +34,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/URLRegistry.h b/Source/core/html/URLRegistry.h
index e30d776..660acb9 100644
--- a/Source/core/html/URLRegistry.h
+++ b/Source/core/html/URLRegistry.h
@@ -51,6 +51,9 @@
     virtual ~URLRegistry() { }
     virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) = 0;
     virtual void unregisterURL(const KURL&) = 0;
+
+    // This is an optional API
+    virtual URLRegistrable* lookup(const String&) { ASSERT_NOT_REACHED(); return 0; }
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/ValidityState.h b/Source/core/html/ValidityState.h
index 9f24806..44d05b8 100644
--- a/Source/core/html/ValidityState.h
+++ b/Source/core/html/ValidityState.h
@@ -26,7 +26,7 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/html/FormAssociatedElement.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/VoidCallback.h b/Source/core/html/VoidCallback.h
index 3ee383f..10c3c11 100644
--- a/Source/core/html/VoidCallback.h
+++ b/Source/core/html/VoidCallback.h
@@ -26,7 +26,7 @@
 #ifndef VoidCallback_h
 #define VoidCallback_h
 
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/WeekInputType.cpp b/Source/core/html/WeekInputType.cpp
index 50cfd74..4676696 100644
--- a/Source/core/html/WeekInputType.cpp
+++ b/Source/core/html/WeekInputType.cpp
@@ -35,12 +35,12 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/DateComponents.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 #include "core/html/DateTimeFieldsState.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 #endif
 
 namespace WebCore {
diff --git a/Source/core/html/canvas/ArrayBuffer.idl b/Source/core/html/canvas/ArrayBuffer.idl
deleted file mode 100644
index 781bd90..0000000
--- a/Source/core/html/canvas/ArrayBuffer.idl
+++ /dev/null
@@ -1,33 +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. 
- */
-
-[
-    GlobalContext=Window&WorkerGlobalScope,
-    CustomConstructor(unsigned long length)
-] interface ArrayBuffer {
-    readonly attribute unsigned long byteLength;
-    ArrayBuffer slice(long begin, optional long end);
-};
-
diff --git a/Source/core/html/canvas/CanvasContextAttributes.h b/Source/core/html/canvas/CanvasContextAttributes.h
index dfdfcf4..912864a 100644
--- a/Source/core/html/canvas/CanvasContextAttributes.h
+++ b/Source/core/html/canvas/CanvasContextAttributes.h
@@ -27,7 +27,7 @@
 #ifndef CanvasContextAttributes_h
 #define CanvasContextAttributes_h
 
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/CanvasGradient.cpp b/Source/core/html/canvas/CanvasGradient.cpp
index 3661a2b..e1c9028 100644
--- a/Source/core/html/canvas/CanvasGradient.cpp
+++ b/Source/core/html/canvas/CanvasGradient.cpp
@@ -48,13 +48,13 @@
 void CanvasGradient::addColorStop(float value, const String& color, ExceptionCode& ec)
 {
     if (!(value >= 0 && value <= 1.0f)) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
     RGBA32 rgba = 0;
     if (!parseColorOrCurrentColor(rgba, color, 0 /*canvas*/)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
diff --git a/Source/core/html/canvas/CanvasPathMethods.cpp b/Source/core/html/canvas/CanvasPathMethods.cpp
index 0226af2..f5515d1 100644
--- a/Source/core/html/canvas/CanvasPathMethods.cpp
+++ b/Source/core/html/canvas/CanvasPathMethods.cpp
@@ -37,7 +37,7 @@
 
 #include "core/dom/ExceptionCode.h"
 #include "core/platform/graphics/FloatRect.h"
-#include <wtf/MathExtras.h>
+#include "wtf/MathExtras.h"
 
 namespace WebCore {
 
@@ -112,7 +112,7 @@
         return;
 
     if (r < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -137,7 +137,7 @@
         return;
 
     if (r < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
diff --git a/Source/core/html/canvas/CanvasPattern.cpp b/Source/core/html/canvas/CanvasPattern.cpp
index 262d12c..c46f590 100644
--- a/Source/core/html/canvas/CanvasPattern.cpp
+++ b/Source/core/html/canvas/CanvasPattern.cpp
@@ -27,7 +27,7 @@
 #include "core/html/canvas/CanvasPattern.h"
 
 #include "core/dom/ExceptionCode.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
         repeatY = true;
         return;
     }
-    ec = SYNTAX_ERR;
+    ec = SyntaxError;
 }
 
 CanvasPattern::CanvasPattern(PassRefPtr<Image> image, bool repeatX, bool repeatY, bool originClean)
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index bbb61bb..b270133 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -52,6 +52,7 @@
 #include "core/html/canvas/CanvasStyle.h"
 #include "core/html/canvas/DOMPath.h"
 #include "core/loader/cache/CachedImage.h"
+#include "core/page/ImageBitmap.h"
 #include "core/platform/graphics/DrawLooper.h"
 #include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/FontCache.h"
@@ -131,6 +132,10 @@
     m_unrealizedSaveCount = 0;
 }
 
+// Important: Several of these properties are also stored in GraphicsContext's
+// StrokeData. The default values that StrokeData uses may not the same values
+// that the canvas 2d spec specifies. Make sure to sync the initial state of the
+// GraphicsContext in HTMLCanvasElement::createImageBuffer()!
 CanvasRenderingContext2D::State::State()
     : m_strokeStyle(CanvasStyle::createFromRGBA(Color::black))
     , m_fillStyle(CanvasStyle::createFromRGBA(Color::black))
@@ -1186,10 +1191,99 @@
         max(rect.height(), -rect.height()));
 }
 
+void CanvasRenderingContext2D::drawImageInternal(Image* image, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode)
+{
+    if (!image)
+        return;
+
+    GraphicsContext* c = drawingContext();
+    if (!c)
+        return;
+    if (!state().m_invertibleCTM)
+        return;
+
+    if (rectContainsCanvas(dstRect)) {
+        c->drawImage(image, dstRect, srcRect, op, blendMode);
+        didDrawEntireCanvas();
+    } else if (isFullCanvasCompositeMode(op)) {
+        fullCanvasCompositedDrawImage(image, dstRect, srcRect, op);
+        didDrawEntireCanvas();
+    } else if (op == CompositeCopy) {
+        clearCanvas();
+        c->drawImage(image, dstRect, srcRect, op, blendMode);
+        didDrawEntireCanvas();
+    } else {
+        c->drawImage(image, dstRect, srcRect, op, blendMode);
+        didDraw(dstRect);
+    }
+}
+
+void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, float x, float y, ExceptionCode& ec)
+{
+    if (!bitmap) {
+        ec = TypeMismatchError;
+        return;
+    }
+    drawImage(bitmap, x, y, bitmap->width(), bitmap->height(), ec);
+}
+
+void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap,
+    float x, float y, float width, float height, ExceptionCode& ec)
+{
+    if (!bitmap) {
+        ec = TypeMismatchError;
+        return;
+    }
+    if (!bitmap->bitmapWidth() || !bitmap->bitmapHeight())
+        return;
+
+    drawImage(bitmap, 0, 0, bitmap->bitmapWidth(), bitmap->bitmapHeight(), x, y, width, height, ec);
+}
+
+void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap,
+    float sx, float sy, float sw, float sh,
+    float dx, float dy, float dw, float dh, ExceptionCode& ec)
+{
+    if (!bitmap) {
+        ec = TypeMismatchError;
+        return;
+    }
+
+    FloatRect srcRect(sx, sy, sw, sh);
+    FloatRect dstRect(dx, dy, dw, dh);
+
+    if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfinite(dstRect.width()) || !std::isfinite(dstRect.height())
+        || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::isfinite(srcRect.width()) || !std::isfinite(srcRect.height()))
+        return;
+
+    if (!dstRect.width() || !dstRect.height())
+        return;
+
+    ASSERT(bitmap->height() && bitmap->width());
+
+    FloatRect normalizedSrcRect = normalizeRect(srcRect);
+    FloatRect normalizedDstRect = normalizeRect(dstRect);
+    FloatRect actualDstRect(FloatPoint(bitmap->bitmapOffset()), bitmap->bitmapSize());
+    actualDstRect.scale(normalizedDstRect.width() / bitmap->width(), normalizedDstRect.height() / bitmap->height());
+    actualDstRect.moveBy(normalizedDstRect.location());
+
+    FloatRect imageRect = FloatRect(FloatPoint(), bitmap->bitmapSize());
+    if (!srcRect.width() || !srcRect.height()) {
+        ec = IndexSizeError;
+        return;
+    }
+    if (!imageRect.contains(normalizedSrcRect))
+        return;
+
+    Image* imageForRendering = bitmap->bitmapImage();
+
+    drawImageInternal(imageForRendering, normalizedSrcRect, actualDstRect, state().m_globalComposite, state().m_globalBlend);
+}
+
 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y, ExceptionCode& ec)
 {
     if (!image) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     LayoutSize s = size(image);
@@ -1200,7 +1294,7 @@
     float x, float y, float width, float height, ExceptionCode& ec)
 {
     if (!image) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     LayoutSize s = size(image);
@@ -1222,7 +1316,7 @@
 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode, ExceptionCode& ec)
 {
     if (!image) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
 
@@ -1243,18 +1337,12 @@
 
     FloatRect imageRect = FloatRect(FloatPoint(), size(image));
     if (!srcRect.width() || !srcRect.height()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
     if (!imageRect.contains(normalizedSrcRect))
         return;
 
-    GraphicsContext* c = drawingContext();
-    if (!c)
-        return;
-    if (!state().m_invertibleCTM)
-        return;
-
     CachedImage* cachedImage = image->cachedImage();
     if (!cachedImage)
         return;
@@ -1269,20 +1357,7 @@
     if (!image->renderer() && imageForRendering->usesContainerSize())
         imageForRendering->setContainerSize(imageForRendering->size());
 
-    if (rectContainsCanvas(normalizedDstRect)) {
-        c->drawImage(imageForRendering, normalizedDstRect, normalizedSrcRect, op, blendMode);
-        didDrawEntireCanvas();
-    } else if (isFullCanvasCompositeMode(op)) {
-        fullCanvasCompositedDrawImage(imageForRendering, normalizedDstRect, normalizedSrcRect, op);
-        didDrawEntireCanvas();
-    } else if (op == CompositeCopy) {
-        clearCanvas();
-        c->drawImage(imageForRendering, normalizedDstRect, normalizedSrcRect, op, blendMode);
-        didDrawEntireCanvas();
-    } else {
-        c->drawImage(imageForRendering, normalizedDstRect, normalizedSrcRect, op, blendMode);
-        didDraw(normalizedDstRect);
-    }
+    drawImageInternal(imageForRendering, normalizedSrcRect, normalizedDstRect, op, blendMode);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionCode& ec)
@@ -1307,19 +1382,19 @@
     const FloatRect& dstRect, ExceptionCode& ec)
 {
     if (!sourceCanvas) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
 
     FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas->size());
 
     if (!srcCanvasRect.width() || !srcCanvasRect.height()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!srcRect.width() || !srcRect.height()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -1367,7 +1442,7 @@
 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, float x, float y, ExceptionCode& ec)
 {
     if (!video) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     IntSize s = size(video);
@@ -1378,7 +1453,7 @@
                                          float x, float y, float width, float height, ExceptionCode& ec)
 {
     if (!video) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     IntSize s = size(video);
@@ -1396,7 +1471,7 @@
                                          ExceptionCode& ec)
 {
     if (!video) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
 
@@ -1407,7 +1482,7 @@
 
     FloatRect videoRect = FloatRect(FloatPoint(), size(video));
     if (!srcRect.width() || !srcRect.height()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -1599,7 +1674,7 @@
 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode& ec)
 {
     if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(x1) || !std::isfinite(y1)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -1610,12 +1685,12 @@
 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode& ec)
 {
     if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(r0) || !std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(r1)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
     if (r0 < 0 || r1 < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
 
@@ -1627,7 +1702,7 @@
     const String& repetitionType, ExceptionCode& ec)
 {
     if (!image) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return 0;
     }
     bool repeatX, repeatY;
@@ -1656,11 +1731,11 @@
     const String& repetitionType, ExceptionCode& ec)
 {
     if (!canvas) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return 0;
     }
     if (!canvas->width() || !canvas->height()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -1740,7 +1815,7 @@
 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<ImageData> imageData, ExceptionCode& ec) const
 {
     if (!imageData) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -1751,11 +1826,11 @@
 {
     ec = 0;
     if (!sw || !sh) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
     if (!std::isfinite(sw) || !std::isfinite(sh)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -1787,16 +1862,16 @@
     if (!canvas()->originClean()) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Unable to get image data from canvas because the canvas has been tainted by cross-origin data.")));
         canvas()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
     if (!sw || !sh) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
     if (!std::isfinite(sx) || !std::isfinite(sy) || !std::isfinite(sw) || !std::isfinite(sh)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -1832,7 +1907,7 @@
 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionCode& ec)
 {
     if (!data) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     putImageData(data, dx, dy, 0, 0, data->width(), data->height(), ec);
@@ -1841,7 +1916,7 @@
 void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, ExceptionCode& ec)
 {
     if (!data) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     webkitPutImageDataHD(data, dx, dy, 0, 0, data->width(), data->height(), ec);
@@ -1862,11 +1937,11 @@
                                             float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
 {
     if (!data) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
     if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dirtyX) || !std::isfinite(dirtyY) || !std::isfinite(dirtyWidth) || !std::isfinite(dirtyHeight)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
@@ -1990,19 +2065,17 @@
     newStyle->font().update(newStyle->font().fontSelector());
 
     // Now map the font property longhands into the style.
-    StyleResolver* styleResolver = canvas()->styleResolver();
-    styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getPropertyCSSValue(CSSPropertyFontFamily).get(), newStyle.get());
-    styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontStyle, parsedStyle->getPropertyCSSValue(CSSPropertyFontStyle).get());
-    styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontVariant, parsedStyle->getPropertyCSSValue(CSSPropertyFontVariant).get());
-    styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontWeight, parsedStyle->getPropertyCSSValue(CSSPropertyFontWeight).get());
+    CSSPropertyValue properties[] = {
+        CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle),
+        CSSPropertyValue(CSSPropertyFontSize, *parsedStyle),
+        CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle),
+    };
 
-    // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
-    // which assumes the fontMetrics are available for the affected font, otherwise a crash occurs (see http://trac.webkit.org/changeset/96122).
-    // The updateFont() calls below update the fontMetrics and ensure the proper setting of font-size and line-height.
-    styleResolver->updateFont();
-    styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontSize, parsedStyle->getPropertyCSSValue(CSSPropertyFontSize).get());
-    styleResolver->updateFont();
-    styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyle->getPropertyCSSValue(CSSPropertyLineHeight).get());
+    StyleResolver* styleResolver = canvas()->styleResolver();
+    styleResolver->applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties), newStyle.get());
 
     modifiableState().m_font = newStyle->font();
     modifiableState().m_font.update(styleResolver->fontSelector());
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
index d4ff4af..6ec4525 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -53,6 +53,7 @@
 class HTMLCanvasElement;
 class HTMLImageElement;
 class HTMLVideoElement;
+class ImageBitmap;
 class ImageData;
 class TextMetrics;
 
@@ -160,15 +161,18 @@
 
     void clearShadow();
 
+    void drawImage(ImageBitmap*, float x, float y, ExceptionCode&);
+    void drawImage(ImageBitmap*, float x, float y, float width, float height, ExceptionCode&);
+    void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
     void drawImage(HTMLImageElement*, float x, float y, ExceptionCode&);
     void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionCode&);
     void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
     void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&, ExceptionCode&);
     void drawImage(HTMLCanvasElement*, float x, float y, ExceptionCode&);
     void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionCode&);
     void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
     void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
-    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&, ExceptionCode&);
     void drawImage(HTMLVideoElement*, float x, float y, ExceptionCode&);
     void drawImage(HTMLVideoElement*, float x, float y, float width, float height, ExceptionCode&);
     void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
@@ -279,6 +283,7 @@
     void applyShadow();
     bool shouldDrawShadows() const;
 
+    void drawImageInternal(Image*, const FloatRect&, const FloatRect&, const CompositeOperator&, const BlendMode&);
     void didDraw(const FloatRect&, unsigned options = CanvasDidDrawApplyAll);
     void didDrawEntireCanvas();
 
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.idl b/Source/core/html/canvas/CanvasRenderingContext2D.idl
index 7e3d07f..ed6cbc4 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.idl
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.idl
@@ -126,6 +126,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);
 
     void drawImageFromRect(HTMLImageElement image,
                            optional float sx, optional float sy, optional float sw, optional float sh,
diff --git a/Source/core/html/canvas/CanvasStyle.cpp b/Source/core/html/canvas/CanvasStyle.cpp
index 3d103eb..74717d0 100644
--- a/Source/core/html/canvas/CanvasStyle.cpp
+++ b/Source/core/html/canvas/CanvasStyle.cpp
@@ -36,8 +36,8 @@
 #include "core/html/canvas/CanvasGradient.h"
 #include "core/html/canvas/CanvasPattern.h"
 #include "core/platform/graphics/GraphicsContext.h"
-#include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
+#include "wtf/Assertions.h"
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/CanvasStyle.h b/Source/core/html/canvas/CanvasStyle.h
index fad215b..5c2a0fb 100644
--- a/Source/core/html/canvas/CanvasStyle.h
+++ b/Source/core/html/canvas/CanvasStyle.h
@@ -28,9 +28,9 @@
 #define CanvasStyle_h
 
 #include "core/platform/graphics/Color.h"
-#include <wtf/Assertions.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Assertions.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/DataView.cpp b/Source/core/html/canvas/DataView.cpp
index 23b6c0d..df95f82 100644
--- a/Source/core/html/canvas/DataView.cpp
+++ b/Source/core/html/canvas/DataView.cpp
@@ -132,7 +132,7 @@
 T DataView::getData(unsigned byteOffset, bool littleEndian, ExceptionCode& ec) const
 {
     if (beyondRange<T>(byteOffset)) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
 
@@ -147,7 +147,7 @@
 void DataView::setData(unsigned byteOffset, T value, bool littleEndian, ExceptionCode& ec)
 {
     if (beyondRange<T>(byteOffset)) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
diff --git a/Source/core/html/canvas/Path.idl b/Source/core/html/canvas/Path.idl
index ae5943f..5b767e3 100644
--- a/Source/core/html/canvas/Path.idl
+++ b/Source/core/html/canvas/Path.idl
@@ -27,7 +27,7 @@
  */
 
 [
-    EnabledAtRuntime=canvasPath,
+    EnabledAtRuntime=experimentalCanvasFeatures,
     Constructor,
     Constructor(Path path),
     Constructor(DOMString text),
diff --git a/Source/core/html/canvas/WebGLContextGroup.h b/Source/core/html/canvas/WebGLContextGroup.h
index e888083..3bd0056 100644
--- a/Source/core/html/canvas/WebGLContextGroup.h
+++ b/Source/core/html/canvas/WebGLContextGroup.h
@@ -27,9 +27,9 @@
 #define WebGLContextGroup_h
 
 #include "core/html/canvas/WebGLRenderingContext.h"
-#include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/HashSet.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/WebGLGetInfo.cpp b/Source/core/html/canvas/WebGLGetInfo.cpp
index bb2b986..e8e71de 100644
--- a/Source/core/html/canvas/WebGLGetInfo.cpp
+++ b/Source/core/html/canvas/WebGLGetInfo.cpp
@@ -25,7 +25,6 @@
  */
 
 #include "config.h"
-
 #include "core/html/canvas/WebGLGetInfo.h"
 
 #include "core/html/canvas/WebGLBuffer.h"
@@ -34,10 +33,10 @@
 #include "core/html/canvas/WebGLRenderbuffer.h"
 #include "core/html/canvas/WebGLTexture.h"
 #include "core/html/canvas/WebGLVertexArrayObjectOES.h"
-#include <wtf/Float32Array.h>
-#include <wtf/Int32Array.h>
-#include <wtf/Uint32Array.h>
-#include <wtf/Uint8Array.h>
+#include "wtf/Float32Array.h"
+#include "wtf/Int32Array.h"
+#include "wtf/Uint32Array.h"
+#include "wtf/Uint8Array.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/WebGLGetInfo.h b/Source/core/html/canvas/WebGLGetInfo.h
index d92c128..552cf47 100644
--- a/Source/core/html/canvas/WebGLGetInfo.h
+++ b/Source/core/html/canvas/WebGLGetInfo.h
@@ -33,13 +33,13 @@
 #include "core/html/canvas/WebGLRenderbuffer.h"
 #include "core/html/canvas/WebGLTexture.h"
 #include "core/html/canvas/WebGLVertexArrayObjectOES.h"
-#include <wtf/Float32Array.h>
-#include <wtf/Int32Array.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Uint32Array.h>
-#include <wtf/Uint8Array.h>
+#include "wtf/Float32Array.h"
+#include "wtf/Int32Array.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Uint32Array.h"
+#include "wtf/Uint8Array.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index 1faa49d..ec4979a 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -107,6 +107,7 @@
         activeContexts().remove(0);
 
         oldestActiveContext->printWarningToConsole(reason);
+        InspectorInstrumentation::didFireWebGLWarning(oldestActiveContext->canvas());
 
         // This will call deactivateContext once the context has actually been lost.
         oldestActiveContext->forceLostContext(WebGLRenderingContext::SyntheticLostContext);
@@ -483,6 +484,7 @@
     {
         if (m_context->m_synthesizedErrorsToConsole)
             m_context->printGLErrorToConsole(message);
+        InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas(), message);
     }
     virtual ~WebGLRenderingContextErrorMessageCallback() { }
 private:
@@ -1296,7 +1298,7 @@
     const char* reason = "framebuffer incomplete";
     GC3Denum result = m_framebufferBinding->checkStatus(&reason);
     if (result != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
-        printGLWarningToConsole("checkFramebufferStatus", reason);
+        emitGLWarning("checkFramebufferStatus", reason);
         return result;
     }
     result = m_context->checkFramebufferStatus(target);
@@ -2174,7 +2176,7 @@
         case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
             return WebGLGetInfo(GraphicsContext3D::TEXTURE);
         case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
-            return WebGLGetInfo(PassRefPtr<WebGLTexture>(reinterpret_cast<WebGLTexture*>(object)));
+            return WebGLGetInfo(PassRefPtr<WebGLTexture>(static_cast<WebGLTexture*>(object)));
         case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
         case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
             {
@@ -2191,7 +2193,7 @@
         case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
             return WebGLGetInfo(GraphicsContext3D::RENDERBUFFER);
         case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
-            return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(reinterpret_cast<WebGLRenderbuffer*>(object)));
+            return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(static_cast<WebGLRenderbuffer*>(object)));
         default:
             synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment");
             return WebGLGetInfo();
@@ -4357,7 +4359,7 @@
                 String msg(String("texture bound to texture unit ") + String::number(ii)
                     + " is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'."
                     + " Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled.");
-                printGLWarningToConsole(functionName, msg.utf8().data());
+                emitGLWarning(functionName, msg.utf8().data());
                 tex2D = m_blackTexture2D.get();
                 texCubeMap = m_blackTextureCubeMap.get();
             } else {
@@ -5136,7 +5138,7 @@
         return false;
     }
     if (wouldTaintOrigin(image)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return false;
     }
     return true;
@@ -5149,7 +5151,7 @@
         return false;
     }
     if (wouldTaintOrigin(canvas)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return false;
     }
     return true;
@@ -5162,7 +5164,7 @@
         return false;
     }
     if (wouldTaintOrigin(video)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return false;
     }
     return true;
@@ -5499,16 +5501,16 @@
         if (lost_context_errors_.find(error) == WTF::notFound)
             lost_context_errors_.append(error);
     }
-    InspectorInstrumentation::didFireWebGLError(canvas()->document(), errorType);
+    InspectorInstrumentation::didFireWebGLError(canvas(), errorType);
 }
 
-
-void WebGLRenderingContext::printGLWarningToConsole(const char* functionName, const char* description)
+void WebGLRenderingContext::emitGLWarning(const char* functionName, const char* description)
 {
     if (m_synthesizedErrorsToConsole) {
-        String str = String("WebGL: ") + String(functionName) + ": " + String(description);
-        printGLErrorToConsole(str);
+        String message = String("WebGL: ") + String(functionName) + ": " + String(description);
+        printGLErrorToConsole(message);
     }
+    InspectorInstrumentation::didFireWebGLWarning(canvas());
 }
 
 void WebGLRenderingContext::applyStencilTest()
diff --git a/Source/core/html/canvas/WebGLRenderingContext.h b/Source/core/html/canvas/WebGLRenderingContext.h
index e260a29..83bb6a6 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.h
+++ b/Source/core/html/canvas/WebGLRenderingContext.h
@@ -772,7 +772,6 @@
 
     // Helper function to print GL errors to console.
     void printGLErrorToConsole(const String&);
-    void printGLWarningToConsole(const char* function, const char* reason);
 
     // Helper function to print warnings to console. Currently
     // used only to warn about use of obsolete functions.
@@ -850,6 +849,7 @@
     // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message
     // to the JavaScript console.
     void synthesizeGLError(GC3Denum, const char* functionName, const char* description, ConsoleDisplayPreference = DisplayInConsole);
+    void emitGLWarning(const char* function, const char* reason);
 
     String ensureNotNull(const String&) const;
 
diff --git a/Source/core/html/parser/AtomicHTMLToken.h b/Source/core/html/parser/AtomicHTMLToken.h
index 7438659..95ab0a0 100644
--- a/Source/core/html/parser/AtomicHTMLToken.h
+++ b/Source/core/html/parser/AtomicHTMLToken.h
@@ -29,8 +29,8 @@
 #include "core/dom/Attribute.h"
 #include "core/html/parser/CompactHTMLToken.h"
 #include "core/html/parser/HTMLToken.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/BackgroundHTMLInputStream.h b/Source/core/html/parser/BackgroundHTMLInputStream.h
index 58b76d5..036533f 100644
--- a/Source/core/html/parser/BackgroundHTMLInputStream.h
+++ b/Source/core/html/parser/BackgroundHTMLInputStream.h
@@ -27,8 +27,8 @@
 #define BackgroundHTMLInputStream_h
 
 #include "core/platform/text/SegmentedString.h"
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/CSSPreloadScanner.cpp b/Source/core/html/parser/CSSPreloadScanner.cpp
index c2711e8..be74d9f 100644
--- a/Source/core/html/parser/CSSPreloadScanner.cpp
+++ b/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -165,54 +165,54 @@
     }
 }
 
-static String parseCSSStringOrURL(const UChar* characters, size_t length)
+static String parseCSSStringOrURL(const String& string)
 {
     size_t offset = 0;
-    size_t reducedLength = length;
+    size_t reducedLength = string.length();
 
-    while (reducedLength && isHTMLSpace(characters[offset])) {
+    while (reducedLength && isHTMLSpace(string[offset])) {
         ++offset;
         --reducedLength;
     }
-    while (reducedLength && isHTMLSpace(characters[offset + reducedLength - 1]))
+    while (reducedLength && isHTMLSpace(string[offset + reducedLength - 1]))
         --reducedLength;
 
     if (reducedLength >= 5
-            && (characters[offset] == 'u' || characters[offset] == 'U')
-            && (characters[offset + 1] == 'r' || characters[offset + 1] == 'R')
-            && (characters[offset + 2] == 'l' || characters[offset + 2] == 'L')
-            && characters[offset + 3] == '('
-            && characters[offset + reducedLength - 1] == ')') {
+        && (string[offset] == 'u' || string[offset] == 'U')
+        && (string[offset + 1] == 'r' || string[offset + 1] == 'R')
+        && (string[offset + 2] == 'l' || string[offset + 2] == 'L')
+        && string[offset + 3] == '('
+        && string[offset + reducedLength - 1] == ')') {
         offset += 4;
         reducedLength -= 5;
     }
 
-    while (reducedLength && isHTMLSpace(characters[offset])) {
+    while (reducedLength && isHTMLSpace(string[offset])) {
         ++offset;
         --reducedLength;
     }
-    while (reducedLength && isHTMLSpace(characters[offset + reducedLength - 1]))
+    while (reducedLength && isHTMLSpace(string[offset + reducedLength - 1]))
         --reducedLength;
 
-    if (reducedLength < 2 || characters[offset] != characters[offset + reducedLength - 1] || !(characters[offset] == '\'' || characters[offset] == '"'))
+    if (reducedLength < 2 || string[offset] != string[offset + reducedLength - 1] || !(string[offset] == '\'' || string[offset] == '"'))
         return String();
     offset++;
     reducedLength -= 2;
 
-    while (reducedLength && isHTMLSpace(characters[offset])) {
+    while (reducedLength && isHTMLSpace(string[offset])) {
         ++offset;
         --reducedLength;
     }
-    while (reducedLength && isHTMLSpace(characters[offset + reducedLength - 1]))
+    while (reducedLength && isHTMLSpace(string[offset + reducedLength - 1]))
         --reducedLength;
 
-    return String(characters + offset, reducedLength);
+    return string.substring(offset, reducedLength);
 }
 
 void CSSPreloadScanner::emitRule(const SegmentedString& source)
 {
-    if (equalIgnoringCase("import", m_rule.characters(), m_rule.length())) {
-        String url = parseCSSStringOrURL(m_ruleValue.characters(), m_ruleValue.length());
+    if (equalIgnoringCase(m_rule, "import")) {
+        String url = parseCSSStringOrURL(m_ruleValue.toStringPreserveCapacity());
         if (!url.isEmpty()) {
             KURL baseElementURL; // FIXME: This should be passed in from the HTMLPreloadScaner via scan()!
             TextPosition position = TextPosition(source.currentLine(), source.currentColumn());
@@ -221,7 +221,7 @@
             m_requests->append(request.release());
         }
         m_state = Initial;
-    } else if (equalIgnoringCase("charset", m_rule.characters(), m_rule.length()))
+    } else if (equalIgnoringCase(m_rule, "charset"))
         m_state = Initial;
     else
         m_state = DoneParsingImportRules;
diff --git a/Source/core/html/parser/CSSPreloadScanner.h b/Source/core/html/parser/CSSPreloadScanner.h
index 4395a32..806779f 100644
--- a/Source/core/html/parser/CSSPreloadScanner.h
+++ b/Source/core/html/parser/CSSPreloadScanner.h
@@ -29,7 +29,7 @@
 
 #include "core/html/parser/HTMLResourcePreloader.h"
 #include "core/html/parser/HTMLToken.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/CompactHTMLToken.h b/Source/core/html/parser/CompactHTMLToken.h
index 04f1fab..9667a2b 100644
--- a/Source/core/html/parser/CompactHTMLToken.h
+++ b/Source/core/html/parser/CompactHTMLToken.h
@@ -28,9 +28,9 @@
 
 #include "core/html/parser/HTMLIdentifier.h"
 #include "core/html/parser/HTMLToken.h"
-#include <wtf/text/TextPosition.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
+#include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLConstructionSite.cpp b/Source/core/html/parser/HTMLConstructionSite.cpp
index e6566a3..10643a2 100644
--- a/Source/core/html/parser/HTMLConstructionSite.cpp
+++ b/Source/core/html/parser/HTMLConstructionSite.cpp
@@ -33,9 +33,11 @@
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/dom/Text.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLOptGroupElement.h"
 #include "core/html/HTMLScriptElement.h"
 #include "core/html/HTMLTemplateElement.h"
 #include "core/html/parser/AtomicHTMLToken.h"
@@ -67,7 +69,7 @@
         || item->hasTagName(dtTag)
         || item->hasTagName(liTag)
         || item->hasTagName(optionTag)
-        || item->hasTagName(optgroupTag)
+        || isHTMLOptGroupElement(item->node())
         || item->hasTagName(pTag)
         || item->hasTagName(rpTag)
         || item->hasTagName(rtTag);
@@ -175,7 +177,7 @@
 
 void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild, bool selfClosing)
 {
-    ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->isElementNode() || !toScriptElementIfPossible(toElement(prpChild.get())));
+    ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->isElementNode() || !toScriptLoaderIfPossible(toElement(prpChild.get())));
     ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !prpChild->isPluginElement());
 
     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
@@ -532,7 +534,7 @@
     notImplemented(); // parseError when xmlns or xmlns:xlink are wrong.
 
     RefPtr<Element> element = createElement(token, namespaceURI);
-    if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptElementIfPossible(element.get()))
+    if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptLoaderIfPossible(element.get()))
         attachLater(currentNode(), element, token->selfClosing());
     if (!token->selfClosing())
         m_openElements.push(HTMLStackItem::create(element.release(), token, namespaceURI));
diff --git a/Source/core/html/parser/HTMLElementStack.cpp b/Source/core/html/parser/HTMLElementStack.cpp
index affc1a3..084b474 100644
--- a/Source/core/html/parser/HTMLElementStack.cpp
+++ b/Source/core/html/parser/HTMLElementStack.cpp
@@ -31,7 +31,10 @@
 #include "MathMLNames.h"
 #include "SVGNames.h"
 #include "core/dom/Element.h"
-#include <wtf/PassOwnPtr.h>
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLOptGroupElement.h"
+#include "core/html/HTMLTableElement.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
@@ -43,7 +46,7 @@
 inline bool isRootNode(HTMLStackItem* item)
 {
     return item->isDocumentFragmentNode()
-        || item->hasTagName(htmlTag);
+        || isHTMLHtmlElement(item->node());
 }
 
 inline bool isScopeMarker(HTMLStackItem* item)
@@ -52,7 +55,7 @@
         || item->hasTagName(captionTag)
         || item->hasTagName(marqueeTag)
         || item->hasTagName(objectTag)
-        || item->hasTagName(tableTag)
+        || isHTMLTableElement(item->node())
         || item->hasTagName(tdTag)
         || item->hasTagName(thTag)
         || item->hasTagName(MathMLNames::miTag)
@@ -77,7 +80,7 @@
 
 inline bool isTableScopeMarker(HTMLStackItem* item)
 {
-    return item->hasTagName(tableTag)
+    return isHTMLTableElement(item->node())
         || item->hasTagName(templateTag)
         || isRootNode(item);
 }
@@ -113,7 +116,7 @@
 
 inline bool isSelectScopeMarker(HTMLStackItem* item)
 {
-    return !item->hasTagName(optgroupTag)
+    return !isHTMLOptGroupElement(item->node())
         && !item->hasTagName(optionTag);
 }
 
@@ -307,7 +310,7 @@
 
 void HTMLElementStack::pushHTMLHtmlElement(PassRefPtr<HTMLStackItem> item)
 {
-    ASSERT(item->hasTagName(HTMLNames::htmlTag));
+    ASSERT(isHTMLHtmlElement(item->node()));
     pushRootNodeCommon(item);
 }
     
@@ -337,7 +340,7 @@
 
 void HTMLElementStack::push(PassRefPtr<HTMLStackItem> item)
 {
-    ASSERT(!item->hasTagName(HTMLNames::htmlTag));
+    ASSERT(!isHTMLHtmlElement(item->node()));
     ASSERT(!item->hasTagName(HTMLNames::headTag));
     ASSERT(!item->hasTagName(HTMLNames::bodyTag));
     ASSERT(m_rootNode);
@@ -349,7 +352,7 @@
     ASSERT(item);
     ASSERT(recordBelow);
     ASSERT(m_top);
-    ASSERT(!item->hasTagName(HTMLNames::htmlTag));
+    ASSERT(!isHTMLHtmlElement(item->node()));
     ASSERT(!item->hasTagName(HTMLNames::headTag));
     ASSERT(!item->hasTagName(HTMLNames::bodyTag));
     ASSERT(m_rootNode);
@@ -564,7 +567,7 @@
 
 void HTMLElementStack::popCommon()
 {
-    ASSERT(!topStackItem()->hasTagName(HTMLNames::htmlTag));
+    ASSERT(!isHTMLHtmlElement(topStackItem()->node()));
     ASSERT(!topStackItem()->hasTagName(HTMLNames::headTag) || !m_headElement);
     ASSERT(!topStackItem()->hasTagName(HTMLNames::bodyTag) || !m_bodyElement);
     top()->finishParsingChildren();
@@ -575,7 +578,7 @@
 
 void HTMLElementStack::removeNonTopCommon(Element* element)
 {
-    ASSERT(!element->hasTagName(HTMLNames::htmlTag));
+    ASSERT(!isHTMLHtmlElement(element));
     ASSERT(!element->hasTagName(HTMLNames::bodyTag));
     ASSERT(top() != element);
     for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) {
diff --git a/Source/core/html/parser/HTMLEntityParser.cpp b/Source/core/html/parser/HTMLEntityParser.cpp
index 9583421..563c8a4 100644
--- a/Source/core/html/parser/HTMLEntityParser.cpp
+++ b/Source/core/html/parser/HTMLEntityParser.cpp
@@ -31,7 +31,7 @@
 #include "core/html/parser/HTMLEntitySearch.h"
 #include "core/html/parser/HTMLEntityTable.h"
 #include "core/xml/parser/CharacterReferenceParserInlines.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 using namespace WTF;
 
diff --git a/Source/core/html/parser/HTMLEntitySearch.h b/Source/core/html/parser/HTMLEntitySearch.h
index 0cb5920..270cc29 100644
--- a/Source/core/html/parser/HTMLEntitySearch.h
+++ b/Source/core/html/parser/HTMLEntitySearch.h
@@ -26,7 +26,7 @@
 #ifndef HTMLEntitySearch_h
 #define HTMLEntitySearch_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLEntityTable.h b/Source/core/html/parser/HTMLEntityTable.h
index 5293f46..f44858c 100644
--- a/Source/core/html/parser/HTMLEntityTable.h
+++ b/Source/core/html/parser/HTMLEntityTable.h
@@ -26,7 +26,7 @@
 #ifndef HTMLEntityTable_h
 #define HTMLEntityTable_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLFormattingElementList.h b/Source/core/html/parser/HTMLFormattingElementList.h
index 24ba01f..720b7d2 100644
--- a/Source/core/html/parser/HTMLFormattingElementList.h
+++ b/Source/core/html/parser/HTMLFormattingElementList.h
@@ -27,9 +27,9 @@
 #define HTMLFormattingElementList_h
 
 #include "core/html/parser/HTMLStackItem.h"
-#include <wtf/Forward.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLIdentifier.cpp b/Source/core/html/parser/HTMLIdentifier.cpp
index 8c5fa52..d12ea6a 100644
--- a/Source/core/html/parser/HTMLIdentifier.cpp
+++ b/Source/core/html/parser/HTMLIdentifier.cpp
@@ -27,9 +27,9 @@
 #include "core/html/parser/HTMLIdentifier.h"
 
 #include "HTMLNames.h"
-#include <wtf/HashMap.h>
-#include <wtf/MainThread.h>
-#include <wtf/text/StringHash.h>
+#include "wtf/HashMap.h"
+#include "wtf/MainThread.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
@@ -100,7 +100,7 @@
         IdentifierTable::AddResult addResult = table.add(hash, name);
         maxNameLength = std::max(maxNameLength, name->length());
         // Ensure we're using the same hashing algorithm to get and set.
-        ASSERT_UNUSED(addResult, !addResult.isNewEntry || HTMLIdentifier::findIfKnown(name->bloatedCharacters(), name->length()) == name);
+        ASSERT_UNUSED(addResult, !addResult.isNewEntry || HTMLIdentifier::findIfKnown(String(name).charactersWithNullTermination().data(), name->length()) == name);
         // We expect some hash collisions, but only for identical strings.
         // Since all of these names are AtomicStrings pointers should be equal.
         // Note: If you hit this ASSERT, then we had a hash collision among
diff --git a/Source/core/html/parser/HTMLIdentifier.h b/Source/core/html/parser/HTMLIdentifier.h
index 08eef85..1aec5f7 100644
--- a/Source/core/html/parser/HTMLIdentifier.h
+++ b/Source/core/html/parser/HTMLIdentifier.h
@@ -26,7 +26,7 @@
 #ifndef HTMLIdentifier_h
 #define HTMLIdentifier_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLPreloadScanner.h b/Source/core/html/parser/HTMLPreloadScanner.h
index c7ff2b1..2496e47 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.h
+++ b/Source/core/html/parser/HTMLPreloadScanner.h
@@ -31,7 +31,7 @@
 #include "core/html/parser/CompactHTMLToken.h"
 #include "core/html/parser/HTMLToken.h"
 #include "core/platform/text/SegmentedString.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLScriptRunner.cpp b/Source/core/html/parser/HTMLScriptRunner.cpp
index 0429e96..3b8462d 100644
--- a/Source/core/html/parser/HTMLScriptRunner.cpp
+++ b/Source/core/html/parser/HTMLScriptRunner.cpp
@@ -31,7 +31,7 @@
 #include "core/dom/Event.h"
 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
 #include "core/dom/Microtask.h"
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/html/parser/HTMLInputStream.h"
 #include "core/html/parser/HTMLScriptRunnerHost.h"
 #include "core/html/parser/NestingLevelIncrementer.h"
@@ -130,14 +130,14 @@
 
     // Clear the pending script before possible rentrancy from executeScript()
     RefPtr<Element> element = pendingScript.releaseElementAndClear();
-    if (ScriptElement* scriptElement = toScriptElementIfPossible(element.get())) {
+    if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) {
         NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
         IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_document);
         if (errorOccurred)
-            scriptElement->dispatchErrorEvent();
+            scriptLoader->dispatchErrorEvent();
         else {
             ASSERT(isExecutingScript());
-            scriptElement->executeScript(sourceCode);
+            scriptLoader->executeScript(sourceCode);
             element->dispatchEvent(createScriptLoadEvent());
         }
     }
@@ -259,7 +259,7 @@
     ASSERT(!pendingScript.element());
     pendingScript.setElement(script);
     // This should correctly return 0 for empty or invalid srcValues.
-    CachedScript* cachedScript = toScriptElementIfPossible(script)->cachedScript().get();
+    CachedScript* cachedScript = toScriptLoaderIfPossible(script)->cachedScript().get();
     if (!cachedScript) {
         notImplemented(); // Dispatch error event.
         return false;
@@ -275,14 +275,14 @@
     ASSERT(m_document);
     ASSERT(!hasParserBlockingScript());
     {
-        ScriptElement* scriptElement = toScriptElementIfPossible(script);
+        ScriptLoader* scriptLoader = toScriptLoaderIfPossible(script);
 
         // This contains both and ASSERTION and a null check since we should not
         // be getting into the case of a null script element, but seem to be from
         // time to time. The assertion is left in to help find those cases and
         // is being tracked by <https://bugs.webkit.org/show_bug.cgi?id=60559>.
-        ASSERT(scriptElement);
-        if (!scriptElement)
+        ASSERT(scriptLoader);
+        if (!scriptLoader)
             return;
 
         // FIXME: This may be too agressive as we always deliver mutations at
@@ -295,23 +295,24 @@
         InsertionPointRecord insertionPointRecord(m_host->inputStream());
         NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
 
-        scriptElement->prepareScript(scriptStartPosition);
+        scriptLoader->prepareScript(scriptStartPosition);
 
-        if (!scriptElement->willBeParserExecuted())
+        if (!scriptLoader->willBeParserExecuted())
             return;
 
-        if (scriptElement->willExecuteWhenDocumentFinishedParsing())
+        if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) {
             requestDeferredScript(script);
-        else if (scriptElement->readyToBeParserExecuted()) {
+        } else if (scriptLoader->readyToBeParserExecuted()) {
             if (m_scriptNestingLevel == 1) {
                 m_parserBlockingScript.setElement(script);
                 m_parserBlockingScript.setStartingPosition(scriptStartPosition);
             } else {
                 ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), scriptStartPosition);
-                scriptElement->executeScript(sourceCode);
+                scriptLoader->executeScript(sourceCode);
             }
-        } else
+        } else {
             requestParsingBlockingScript(script);
+        }
     }
 }
 
diff --git a/Source/core/html/parser/HTMLScriptRunner.h b/Source/core/html/parser/HTMLScriptRunner.h
index efa3fff..c780c6e 100644
--- a/Source/core/html/parser/HTMLScriptRunner.h
+++ b/Source/core/html/parser/HTMLScriptRunner.h
@@ -27,9 +27,9 @@
 #define HTMLScriptRunner_h
 
 #include "core/dom/PendingScript.h"
-#include <wtf/Deque.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/TextPosition.h>
+#include "wtf/Deque.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/TextPosition.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLScriptRunnerHost.h b/Source/core/html/parser/HTMLScriptRunnerHost.h
index 1f22896..4302c0b 100644
--- a/Source/core/html/parser/HTMLScriptRunnerHost.h
+++ b/Source/core/html/parser/HTMLScriptRunnerHost.h
@@ -26,7 +26,7 @@
 #ifndef HTMLScriptRunnerHost_h
 #define HTMLScriptRunnerHost_h
 
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLSourceTracker.cpp b/Source/core/html/parser/HTMLSourceTracker.cpp
index d2e6038..ef802ba 100644
--- a/Source/core/html/parser/HTMLSourceTracker.cpp
+++ b/Source/core/html/parser/HTMLSourceTracker.cpp
@@ -25,8 +25,9 @@
 
 #include "config.h"
 #include "core/html/parser/HTMLSourceTracker.h"
+
 #include "core/html/parser/HTMLTokenizer.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLStackItem.h b/Source/core/html/parser/HTMLStackItem.h
index dd8eac6..2fe98bc 100644
--- a/Source/core/html/parser/HTMLStackItem.h
+++ b/Source/core/html/parser/HTMLStackItem.h
@@ -31,10 +31,9 @@
 #include "SVGNames.h"
 #include "core/dom/Element.h"
 #include "core/html/parser/AtomicHTMLToken.h"
-
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLToken.h b/Source/core/html/parser/HTMLToken.h
index ef93950..7b91fb5 100644
--- a/Source/core/html/parser/HTMLToken.h
+++ b/Source/core/html/parser/HTMLToken.h
@@ -28,8 +28,8 @@
 
 #include "core/dom/Attribute.h"
 #include "core/html/parser/HTMLToken.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLTreeBuilder.cpp b/Source/core/html/parser/HTMLTreeBuilder.cpp
index 2f3e37e..79b20e7 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -35,6 +35,9 @@
 #include "XMLNames.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/html/HTMLFormElement.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLOptGroupElement.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/html/parser/AtomicHTMLToken.h"
 #include "core/html/parser/HTMLDocumentParser.h"
 #include "core/html/parser/HTMLParserIdioms.h"
@@ -1370,7 +1373,7 @@
                 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
                 processEndTag(&endOption);
             }
-            if (m_tree.currentStackItem()->hasTagName(optgroupTag)) {
+            if (isHTMLOptGroupElement(m_tree.currentStackItem()->node())) {
                 AtomicHTMLToken endOptgroup(HTMLToken::EndTag, optgroupTag.localName());
                 processEndTag(&endOptgroup);
             }
@@ -1619,7 +1622,7 @@
         if (item->hasTagName(colgroupTag)) {
             return setInsertionMode(InColumnGroupMode);
         }
-        if (item->hasTagName(tableTag))
+        if (isHTMLTableElement(item->node()))
             return setInsertionMode(InTableMode);
         if (item->hasTagName(headTag)) {
             if (!m_fragmentContext.fragment() || m_fragmentContext.contextElement() != item->node())
@@ -1631,7 +1634,7 @@
         if (item->hasTagName(framesetTag)) {
             return setInsertionMode(InFramesetMode);
         }
-        if (item->hasTagName(htmlTag)) {
+        if (isHTMLHtmlElement(item->node())) {
             ASSERT(isParsingFragment());
             return setInsertionMode(BeforeHeadMode);
         }
@@ -2175,9 +2178,9 @@
     case InSelectMode:
         ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode);
         if (token->name() == optgroupTag) {
-            if (m_tree.currentStackItem()->hasTagName(optionTag) && m_tree.oneBelowTop() && m_tree.oneBelowTop()->hasTagName(optgroupTag))
+            if (m_tree.currentStackItem()->hasTagName(optionTag) && m_tree.oneBelowTop() && isHTMLOptGroupElement(m_tree.oneBelowTop()->node()))
                 processFakeEndTag(optionTag);
-            if (m_tree.currentStackItem()->hasTagName(optgroupTag)) {
+            if (isHTMLOptGroupElement(m_tree.currentStackItem()->node())) {
                 m_tree.openElements()->pop();
                 return;
             }
@@ -2329,7 +2332,7 @@
         ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyMode || insertionMode() == InRowMode);
         ASSERT(m_pendingTableCharacters.isEmpty());
         if (m_tree.currentStackItem()->isElementNode()
-            && (m_tree.currentStackItem()->hasTagName(HTMLNames::tableTag)
+            && (isHTMLTableElement(m_tree.currentStackItem()->node())
                 || m_tree.currentStackItem()->hasTagName(HTMLNames::tbodyTag)
                 || m_tree.currentStackItem()->hasTagName(HTMLNames::tfootTag)
                 || m_tree.currentStackItem()->hasTagName(HTMLNames::theadTag)
diff --git a/Source/core/html/parser/InputStreamPreprocessor.h b/Source/core/html/parser/InputStreamPreprocessor.h
index dfb72f0..842e948 100644
--- a/Source/core/html/parser/InputStreamPreprocessor.h
+++ b/Source/core/html/parser/InputStreamPreprocessor.h
@@ -29,7 +29,7 @@
 #define InputStreamPreprocessor_h
 
 #include "core/platform/text/SegmentedString.h"
-#include <wtf/Noncopyable.h>
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/NestingLevelIncrementer.h b/Source/core/html/parser/NestingLevelIncrementer.h
index bf08425..d9d7d54 100644
--- a/Source/core/html/parser/NestingLevelIncrementer.h
+++ b/Source/core/html/parser/NestingLevelIncrementer.h
@@ -26,7 +26,7 @@
 #ifndef NestingLevelIncrementer_h
 #define NestingLevelIncrementer_h
 
-#include <wtf/Noncopyable.h>
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/XSSAuditorDelegate.cpp b/Source/core/html/parser/XSSAuditorDelegate.cpp
index bc435c5..f75adb5 100644
--- a/Source/core/html/parser/XSSAuditorDelegate.cpp
+++ b/Source/core/html/parser/XSSAuditorDelegate.cpp
@@ -107,7 +107,7 @@
         frameLoader->client()->didDetectXSS(m_document->url(), xssInfo.m_didBlockEntirePage);
 
         if (!m_reportURL.isEmpty())
-            PingLoader::sendViolationReport(m_document->frame(), m_reportURL, generateViolationReport());
+            PingLoader::sendViolationReport(m_document->frame(), m_reportURL, generateViolationReport(), PingLoader::XSSAuditorViolationReport);
     }
 
     if (xssInfo.m_didBlockEntirePage)
diff --git a/Source/core/html/shadow/ClearButtonElement.h b/Source/core/html/shadow/ClearButtonElement.h
index a08b1d3..2371888 100644
--- a/Source/core/html/shadow/ClearButtonElement.h
+++ b/Source/core/html/shadow/ClearButtonElement.h
@@ -27,7 +27,7 @@
 #define ClearButtonElement_h
 
 #include "core/html/HTMLDivElement.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/DateTimeFieldElement.cpp b/Source/core/html/shadow/DateTimeFieldElement.cpp
index a53010a..8f266c0 100644
--- a/Source/core/html/shadow/DateTimeFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeFieldElement.cpp
@@ -32,7 +32,7 @@
 #include "core/dom/Text.h"
 #include "core/platform/LocalizedStrings.h"
 #include "core/platform/text/PlatformLocale.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/DateTimeFieldElements.cpp b/Source/core/html/shadow/DateTimeFieldElements.cpp
index d7aff17..8a8a052 100644
--- a/Source/core/html/shadow/DateTimeFieldElements.cpp
+++ b/Source/core/html/shadow/DateTimeFieldElements.cpp
@@ -30,8 +30,8 @@
 #include "core/html/DateTimeFieldsState.h"
 #include "core/platform/DateComponents.h"
 #include "core/platform/LocalizedStrings.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/DateMath.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/DateMath.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/DateTimeNumericFieldElement.cpp b/Source/core/html/shadow/DateTimeNumericFieldElement.cpp
index 0b9e174..281d5ba 100644
--- a/Source/core/html/shadow/DateTimeNumericFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeNumericFieldElement.cpp
@@ -32,7 +32,7 @@
 #include "core/dom/KeyboardEvent.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/text/PlatformLocale.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 using namespace WTF::Unicode;
 
diff --git a/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp b/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp
index d2ff82d..f20ed22 100644
--- a/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp
@@ -30,8 +30,8 @@
 #include "core/dom/KeyboardEvent.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/text/TextBreakIterator.h"
-#include <wtf/text/StringBuilder.h>
-#include <wtf/unicode/Unicode.h>
+#include "wtf/text/StringBuilder.h"
+#include "wtf/unicode/Unicode.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/DetailsMarkerControl.h b/Source/core/html/shadow/DetailsMarkerControl.h
index 168491f..0971195 100644
--- a/Source/core/html/shadow/DetailsMarkerControl.h
+++ b/Source/core/html/shadow/DetailsMarkerControl.h
@@ -32,7 +32,7 @@
 #define DetailsMarkerControl_h
 
 #include "core/html/HTMLDivElement.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/HTMLShadowElement.h b/Source/core/html/shadow/HTMLShadowElement.h
index 20fd615..2134e07 100644
--- a/Source/core/html/shadow/HTMLShadowElement.h
+++ b/Source/core/html/shadow/HTMLShadowElement.h
@@ -32,7 +32,7 @@
 #define HTMLShadowElement_h
 
 #include "core/dom/shadow/InsertionPoint.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index 8e22f60..3940978 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -695,7 +695,7 @@
         return;
 
     // 2. Let video be the media element or other playback mechanism.
-    HTMLVideoElement* video = static_cast<HTMLVideoElement*>(mediaElement);
+    HTMLVideoElement* video = toHTMLVideoElement(mediaElement);
 
     // 3. Let output be an empty list of absolutely positioned CSS block boxes.
     Vector<RefPtr<HTMLDivElement> > output;
diff --git a/Source/core/html/shadow/MeterShadowElement.h b/Source/core/html/shadow/MeterShadowElement.h
index a7b644c..381c74e 100644
--- a/Source/core/html/shadow/MeterShadowElement.h
+++ b/Source/core/html/shadow/MeterShadowElement.h
@@ -32,7 +32,7 @@
 #define MeterShadowElement_h
 
 #include "core/html/HTMLDivElement.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/TextFieldDecorationElement.cpp b/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp
similarity index 65%
rename from Source/core/html/shadow/TextFieldDecorationElement.cpp
rename to Source/core/html/shadow/PasswordGeneratorButtonElement.cpp
index 5020fc7..5b5fae8 100644
--- a/Source/core/html/shadow/TextFieldDecorationElement.cpp
+++ b/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#include "core/html/shadow/TextFieldDecorationElement.h"
+#include "core/html/shadow/PasswordGeneratorButtonElement.h"
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
@@ -39,47 +39,27 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/shadow/HTMLShadowElement.h"
+#include "core/loader/cache/CachedImage.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Page.h"
+#include "core/platform/graphics/Image.h"
 #include "core/rendering/RenderImage.h"
 
 namespace WebCore {
 
 using namespace HTMLNames;
 
-// TextFieldDecorator ----------------------------------------------------------------
+// FIXME: This class is only used in Chromium and has no layout tests.
 
-TextFieldDecorator::~TextFieldDecorator()
-{
-}
-
-// TextFieldDecorationElement ----------------------------------------------------------------
-
-// FIXME: This class is only used in Chromium, and has no layout tests!!
-
-TextFieldDecorationElement::TextFieldDecorationElement(Document* document, TextFieldDecorator* decorator)
+PasswordGeneratorButtonElement::PasswordGeneratorButtonElement(Document* document)
     : HTMLDivElement(HTMLNames::divTag, document)
-    , m_textFieldDecorator(decorator)
     , m_isInHoverState(false)
 {
-    ASSERT(decorator);
     setHasCustomStyleCallbacks();
 }
 
-PassRefPtr<TextFieldDecorationElement> TextFieldDecorationElement::create(Document* document, TextFieldDecorator* decorator)
-{
-    return adoptRef(new TextFieldDecorationElement(document, decorator));
-}
-
-TextFieldDecorationElement* TextFieldDecorationElement::fromShadowRoot(ShadowRoot* shadowRoot)
-{
-    if (!shadowRoot->firstChild()
-        || !shadowRoot->firstChild()->lastChild()
-        || !shadowRoot->firstChild()->lastChild()->isElementNode()
-        || !toElement(shadowRoot->firstChild()->lastChild())->isTextFieldDecoration())
-        return 0;
-    return toTextFieldDecorationElement(shadowRoot->firstChild()->lastChild());
-}
-
-static inline void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, ShadowRoot*& decorationRoot, ShadowRoot*& decoratedRoot)
+static void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, ShadowRoot*& decorationRoot, ShadowRoot*& decoratedRoot)
 {
     ShadowRoot* existingRoot = input->youngestShadowRoot();
     ShadowRoot* newRoot = 0;
@@ -88,9 +68,9 @@
         existingRoot = existingRoot->olderShadowRoot();
         ASSERT(existingRoot);
     }
-    if (newRoot)
+    if (newRoot) {
         newRoot->removeChild(newRoot->firstChild());
-    else {
+    } 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
@@ -101,7 +81,7 @@
     decoratedRoot = existingRoot;
 }
 
-void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible)
+void PasswordGeneratorButtonElement::decorate(HTMLInputElement* input)
 {
     ASSERT(input);
     ShadowRoot* existingRoot;
@@ -116,41 +96,28 @@
     ASSERT(existingRoot->childNodeCount() == 1);
     toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropertyFlexGrow, 1.0, CSSPrimitiveValue::CSS_NUMBER);
     box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->document()));
-    setInlineStyleProperty(CSSPropertyDisplay, visible ? CSSValueBlock : CSSValueNone);
+    setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
     box->appendChild(this);
 }
 
-inline HTMLInputElement* TextFieldDecorationElement::hostInput()
+inline HTMLInputElement* PasswordGeneratorButtonElement::hostInput()
 {
-    // TextFieldDecorationElement is created only by C++ code, and it is always
+    // PasswordGeneratorButtonElement is created only by C++ code, and it is always
     // in <input> shadow.
     return toHTMLInputElement(shadowHost());
 }
 
-bool TextFieldDecorationElement::isTextFieldDecoration() const
-{
-    return true;
-}
-
-void TextFieldDecorationElement::updateImage()
+void PasswordGeneratorButtonElement::updateImage()
 {
     if (!renderer() || !renderer()->isImage())
         return;
     RenderImageResource* resource = toRenderImage(renderer())->imageResource();
-    CachedImage* image;
-    if (hostInput()->isDisabledFormControl())
-        image = m_textFieldDecorator->imageForDisabledState();
-    else if (hostInput()->isReadOnly())
-        image = m_textFieldDecorator->imageForReadonlyState();
-    else if (m_isInHoverState)
-        image = m_textFieldDecorator->imageForHoverState();
-    else
-        image = m_textFieldDecorator->imageForNormalState();
+    CachedImage* image = m_isInHoverState ? imageForHoverState() : imageForNormalState();
     ASSERT(image);
     resource->setCachedImage(image);
 }
 
-PassRefPtr<RenderStyle> TextFieldDecorationElement::customStyleForRenderer()
+PassRefPtr<RenderStyle> PasswordGeneratorButtonElement::customStyleForRenderer()
 {
     RefPtr<RenderStyle> originalStyle = originalStyleForRenderer();
     RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
@@ -162,42 +129,50 @@
     return style.release();
 }
 
-RenderObject* TextFieldDecorationElement::createRenderer(RenderStyle*)
+RenderObject* PasswordGeneratorButtonElement::createRenderer(RenderStyle*)
 {
     RenderImage* image = new (document()->renderArena()) RenderImage(this);
     image->setImageResource(RenderImageResource::create());
     return image;
 }
 
-void TextFieldDecorationElement::attach(const AttachContext& context)
+void PasswordGeneratorButtonElement::attach(const AttachContext& context)
 {
     HTMLDivElement::attach(context);
     updateImage();
 }
 
-void TextFieldDecorationElement::detach(const AttachContext& context)
+CachedImage* PasswordGeneratorButtonElement::imageForNormalState()
 {
-    m_textFieldDecorator->willDetach(hostInput());
-    HTMLDivElement::detach(context);
+    if (!m_cachedImageForNormalState) {
+        RefPtr<Image> image = Image::loadPlatformResource("generatePassword");
+        m_cachedImageForNormalState = new CachedImage(image.get());
+    }
+    return m_cachedImageForNormalState.get();
 }
 
-bool TextFieldDecorationElement::isMouseFocusable() const
+CachedImage* PasswordGeneratorButtonElement::imageForHoverState()
 {
-    return false;
+    if (!m_cachedImageForHoverState) {
+        RefPtr<Image> image = Image::loadPlatformResource("generatePasswordHover");
+        m_cachedImageForHoverState = new CachedImage(image.get());
+    }
+    return m_cachedImageForHoverState.get();
 }
 
-void TextFieldDecorationElement::defaultEventHandler(Event* event)
+void PasswordGeneratorButtonElement::defaultEventHandler(Event* event)
 {
-    RefPtr<HTMLInputElement> input(hostInput());
+    RefPtr<HTMLInputElement> input = hostInput();
     if (!input || input->isDisabledOrReadOnly() || !event->isMouseEvent()) {
         if (!event->defaultHandled())
             HTMLDivElement::defaultEventHandler(event);
         return;
     }
 
-    RefPtr<TextFieldDecorationElement> protector(this);
+    RefPtr<PasswordGeneratorButtonElement> protector(this);
     if (event->type() == eventNames().clickEvent) {
-        m_textFieldDecorator->handleClick(input.get());
+        if (ChromeClient* chromeClient = document()->page() ? document()->page()->chrome().client() : 0)
+            chromeClient->openPasswordGenerator(input.get());
         event->setDefaultHandled();
     }
 
@@ -215,7 +190,7 @@
         HTMLDivElement::defaultEventHandler(event);
 }
 
-bool TextFieldDecorationElement::willRespondToMouseMoveEvents()
+bool PasswordGeneratorButtonElement::willRespondToMouseMoveEvents()
 {
     const HTMLInputElement* input = hostInput();
     if (!input->isDisabledOrReadOnly())
@@ -224,7 +199,7 @@
     return HTMLDivElement::willRespondToMouseMoveEvents();
 }
 
-bool TextFieldDecorationElement::willRespondToMouseClickEvents()
+bool PasswordGeneratorButtonElement::willRespondToMouseClickEvents()
 {
     const HTMLInputElement* input = hostInput();
     if (!input->isDisabledOrReadOnly())
diff --git a/Source/core/html/shadow/PasswordGeneratorButtonElement.h b/Source/core/html/shadow/PasswordGeneratorButtonElement.h
new file mode 100644
index 0000000..5e9609a
--- /dev/null
+++ b/Source/core/html/shadow/PasswordGeneratorButtonElement.h
@@ -0,0 +1,76 @@
+/*
+ * 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 PasswordGeneratorButtonElement_h
+#define PasswordGeneratorButtonElement_h
+
+#include "core/html/HTMLDivElement.h"
+#include "core/loader/cache/CachedResourceHandle.h"
+
+namespace WebCore {
+
+class CachedImage;
+class HTMLInputElement;
+class ShadowRoot;
+
+class PasswordGeneratorButtonElement FINAL : public HTMLDivElement {
+public:
+    static PassRefPtr<PasswordGeneratorButtonElement> create(Document* document)
+    {
+        return adoptRef(new PasswordGeneratorButtonElement(document));
+    }
+
+    void decorate(HTMLInputElement*);
+
+    virtual bool willRespondToMouseMoveEvents() OVERRIDE;
+    virtual bool willRespondToMouseClickEvents() OVERRIDE;
+
+private:
+    PasswordGeneratorButtonElement(Document*);
+    virtual bool isPasswordGeneratorButtonElement() const OVERRIDE { return true; }
+    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
+    virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
+    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
+    virtual bool isMouseFocusable() const OVERRIDE { return false; }
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+
+    CachedImage* imageForNormalState();
+    CachedImage* imageForHoverState();
+
+    HTMLInputElement* hostInput();
+    void updateImage();
+
+    CachedResourceHandle<CachedImage> m_cachedImageForNormalState;
+    CachedResourceHandle<CachedImage> m_cachedImageForHoverState;
+    bool m_isInHoverState;
+};
+
+}
+#endif
diff --git a/Source/core/html/shadow/ProgressShadowElement.h b/Source/core/html/shadow/ProgressShadowElement.h
index 68b5f64..7cdf2f1 100644
--- a/Source/core/html/shadow/ProgressShadowElement.h
+++ b/Source/core/html/shadow/ProgressShadowElement.h
@@ -33,7 +33,7 @@
 #define ProgressShadowElement_h
 
 #include "core/html/HTMLDivElement.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/TextControlInnerElements.h b/Source/core/html/shadow/TextControlInnerElements.h
index 2bb6e24..dd1daeb 100644
--- a/Source/core/html/shadow/TextControlInnerElements.h
+++ b/Source/core/html/shadow/TextControlInnerElements.h
@@ -29,7 +29,7 @@
 
 #include "core/html/HTMLDivElement.h"
 #include "core/page/SpeechInputListener.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/TextFieldDecorationElement.h b/Source/core/html/shadow/TextFieldDecorationElement.h
deleted file mode 100644
index e4cd73b..0000000
--- a/Source/core/html/shadow/TextFieldDecorationElement.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 TextFieldDecorationElement_h
-#define TextFieldDecorationElement_h
-
-#include "core/html/HTMLDivElement.h"
-
-namespace WebCore {
-
-class CachedImage;
-class HTMLInputElement;
-class ShadowRoot;
-
-// A TextFieldDecorator object must live until all of text fields which were
-// decorated by it die.
-class TextFieldDecorator {
-public:
-    // Returns true if this TextFieldDecorator wants to add a
-    // decoration to the specified text field.
-    virtual bool willAddDecorationTo(HTMLInputElement*) = 0;
-    virtual bool visibleByDefault() = 0;
-
-    // A TextFieldDecorator object should own the CachedImage objects.
-    virtual CachedImage* imageForNormalState() = 0;
-    virtual CachedImage* imageForDisabledState() = 0;
-    virtual CachedImage* imageForReadonlyState() = 0;
-    virtual CachedImage* imageForHoverState() = 0;
-
-    virtual void handleClick(HTMLInputElement*) = 0;
-    // This function is called just before detaching the decoration. It must not
-    // call functions which updating state of the specified HTMLInputElement
-    // object.
-    virtual void willDetach(HTMLInputElement*) = 0;
-
-    virtual ~TextFieldDecorator();
-};
-
-// A TextFieldDecorationElement object must be in a shadow tree of an
-// HTMLInputElement.
-class TextFieldDecorationElement FINAL : public HTMLDivElement {
-public:
-    static PassRefPtr<TextFieldDecorationElement> create(Document*, TextFieldDecorator*);
-    static TextFieldDecorationElement* fromShadowRoot(ShadowRoot*);
-    TextFieldDecorator* textFieldDecorator() { return m_textFieldDecorator; }
-    void decorate(HTMLInputElement*, bool visible);
-
-    virtual bool willRespondToMouseMoveEvents() OVERRIDE;
-    virtual bool willRespondToMouseClickEvents() OVERRIDE;
-
-private:
-    TextFieldDecorationElement(Document*, TextFieldDecorator*);
-    virtual bool isTextFieldDecoration() const OVERRIDE;
-    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
-    virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
-    virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
-    virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
-    virtual bool isMouseFocusable() const OVERRIDE;
-    virtual void defaultEventHandler(Event*) OVERRIDE;
-
-    HTMLInputElement* hostInput();
-    void updateImage();
-
-    TextFieldDecorator* m_textFieldDecorator;
-    bool m_isInHoverState;
-};
-
-inline TextFieldDecorationElement* toTextFieldDecorationElement(Node* node)
-{
-    ASSERT(node);
-    ASSERT_WITH_SECURITY_IMPLICATION(node->isElementNode());
-    ASSERT_WITH_SECURITY_IMPLICATION(toElement(node)->isTextFieldDecoration());
-    return static_cast<TextFieldDecorationElement*>(node);
-}
-
-}
-#endif
diff --git a/Source/core/html/track/InbandTextTrack.cpp b/Source/core/html/track/InbandTextTrack.cpp
index fa3d2a5..c97e193 100644
--- a/Source/core/html/track/InbandTextTrack.cpp
+++ b/Source/core/html/track/InbandTextTrack.cpp
@@ -24,7 +24,6 @@
  */
 
 #include "config.h"
-
 #include "core/html/track/InbandTextTrack.h"
 
 #include <math.h>
@@ -32,7 +31,7 @@
 #include "core/html/track/TextTrackCueGeneric.h"
 #include "core/platform/Logging.h"
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
-#include <wtf/UnusedParam.h>
+#include "wtf/UnusedParam.h"
 
 namespace WebCore {
 
@@ -46,7 +45,7 @@
     , m_private(tracksPrivate)
 {
     m_private->setClient(this);
-    
+
     switch (m_private->kind()) {
     case InbandTextTrackPrivate::Subtitles:
         setKind(TextTrack::subtitlesKeyword());
@@ -72,13 +71,17 @@
 
 InbandTextTrack::~InbandTextTrack()
 {
-    m_private->setClient(0);
+    // Make sure m_private was cleared by trackRemoved() before destruction.
+    ASSERT(!m_private);
 }
 
 void InbandTextTrack::setMode(const AtomicString& mode)
 {
     TextTrack::setMode(mode);
 
+    if (!m_private)
+        return;
+
     if (mode == TextTrack::disabledKeyword())
         m_private->setMode(InbandTextTrackPrivate::Disabled);
     else if (mode == TextTrack::hiddenKeyword())
@@ -101,7 +104,7 @@
 {
     if (!m_private)
         return false;
-    
+
     return m_private->containsOnlyForcedSubtitles();
 }
 
@@ -109,7 +112,7 @@
 {
     if (!m_private)
         return false;
-    
+
     return m_private->isMainProgramContent();
 }
 
@@ -117,16 +120,24 @@
 {
     if (!m_private)
         return false;
-    
+
     return m_private->isEasyToRead();
 }
-    
+
 size_t InbandTextTrack::inbandTrackIndex()
 {
     ASSERT(m_private);
     return m_private->textTrackIndex();
 }
 
+void InbandTextTrack::trackRemoved()
+{
+    ASSERT(m_private);
+    m_private->setClient(0);
+    m_private = 0;
+    clearClient();
+}
+
 void InbandTextTrack::addGenericCue(InbandTextTrackPrivate* trackPrivate, GenericCueData* cueData)
 {
     UNUSED_PARAM(trackPrivate);
@@ -183,4 +194,3 @@
 }
 
 } // namespace WebCore
-
diff --git a/Source/core/html/track/InbandTextTrack.h b/Source/core/html/track/InbandTextTrack.h
index 236d5de..5707249 100644
--- a/Source/core/html/track/InbandTextTrack.h
+++ b/Source/core/html/track/InbandTextTrack.h
@@ -48,6 +48,7 @@
     virtual bool isEasyToRead() const OVERRIDE;
     virtual void setMode(const AtomicString&) OVERRIDE;
     size_t inbandTrackIndex();
+    void trackRemoved();
 
 private:
     InbandTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 7c62a80..178c29d 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -266,13 +266,13 @@
     // 1. If the given cue is not currently listed in the method's TextTrack 
     // object's text track's text track list of cues, then throw a NotFoundError exception.
     if (cue->track() != this) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
     // 2. Remove cue from the method's TextTrack object's text track's text track list of cues.
     if (!m_cues || !m_cues->remove(cue)) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -347,12 +347,12 @@
     // 1. If the given region is not currently listed in the method's TextTrack
     // object's text track list of regions, then throw a NotFoundError exception.
     if (region->track() != this) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return;
     }
 
     if (!m_regions || !m_regions->remove(region)) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
diff --git a/Source/core/html/track/TextTrack.idl b/Source/core/html/track/TextTrack.idl
index c1b39ff..8b2e8aa 100644
--- a/Source/core/html/track/TextTrack.idl
+++ b/Source/core/html/track/TextTrack.idl
@@ -24,9 +24,8 @@
  */
 
 [
-    EnabledAtRuntime=videoTrack,
-    EventTarget
-] interface TextTrack {
+    EnabledAtRuntime=videoTrack
+] interface TextTrack : EventTarget {
     readonly attribute DOMString kind;
     readonly attribute DOMString label;
     readonly attribute DOMString language;
@@ -43,13 +42,4 @@
     [Conditional=WEBVTT_REGIONS] readonly attribute TextTrackRegionList regions;
     [Conditional=WEBVTT_REGIONS] void addRegion(TextTrackRegion region);
     [RaisesException, Conditional=WEBVTT_REGIONS] void removeRegion(TextTrackRegion region);
-
-    // EventTarget interface
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
diff --git a/Source/core/html/track/TextTrackCue.cpp b/Source/core/html/track/TextTrackCue.cpp
index 96083de..068e4d1 100644
--- a/Source/core/html/track/TextTrackCue.cpp
+++ b/Source/core/html/track/TextTrackCue.cpp
@@ -345,7 +345,7 @@
     else if (value == verticalGrowingRightKeyword())
         direction = VerticalGrowingRight;
     else
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
     
     if (direction == m_writingDirection)
         return;
@@ -371,7 +371,7 @@
     // On setting, if the text track cue snap-to-lines flag is not set, and the new
     // value is negative or greater than 100, then throw an IndexSizeError exception.
     if (!m_snapToLines && (position < 0 || position > 100)) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -391,7 +391,7 @@
     // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception.
     // Otherwise, set the text track cue text position to the new value.
     if (position < 0 || position > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
     
@@ -410,7 +410,7 @@
     // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError
     // exception. Otherwise, set the text track cue size to the new value.
     if (size < 0 || size > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
     
@@ -454,7 +454,7 @@
     else if (value == endKeyword())
         alignment = End;
     else
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
     
     if (alignment == m_cueAlignment)
         return;
@@ -479,11 +479,8 @@
 
 int TextTrackCue::cueIndex()
 {
-    if (m_cueIndex == invalidCueIndex) {
-        TextTrackCueList* cues = track()->cues();
-        if (cues)
-            m_cueIndex = cues->getCueIndex(this);
-    }
+    if (m_cueIndex == invalidCueIndex)
+        m_cueIndex = track()->cues()->getCueIndex(this);
 
     return m_cueIndex;
 }
@@ -1191,4 +1188,3 @@
 }
 
 } // namespace WebCore
-
diff --git a/Source/core/html/track/TextTrackCue.idl b/Source/core/html/track/TextTrackCue.idl
index 962f695..f398a9a 100644
--- a/Source/core/html/track/TextTrackCue.idl
+++ b/Source/core/html/track/TextTrackCue.idl
@@ -26,9 +26,8 @@
 [
     EnabledAtRuntime=videoTrack,
     Constructor(double startTime, double endTime, DOMString text),
-    ConstructorCallWith=ScriptExecutionContext,
-    EventTarget
-] interface TextTrackCue {
+    ConstructorCallWith=ScriptExecutionContext
+] interface TextTrackCue : EventTarget {
     readonly attribute TextTrack track;
 
     attribute DOMString id;
@@ -49,15 +48,6 @@
     attribute EventListener onenter;
     attribute EventListener onexit;
 
-    // EventTarget interface
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
-
     [Conditional=WEBVTT_REGIONS] attribute DOMString regionId;
 };
 
diff --git a/Source/core/html/track/TextTrackList.cpp b/Source/core/html/track/TextTrackList.cpp
index f47192c..5be8aaf 100644
--- a/Source/core/html/track/TextTrackList.cpp
+++ b/Source/core/html/track/TextTrackList.cpp
@@ -20,7 +20,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -79,7 +79,7 @@
     for (size_t i = 0; i < m_elementTracks.size(); ++i) {
         if (!m_elementTracks[i]->isRendered())
             continue;
-        
+
         if (m_elementTracks[i] == textTrack)
             return trackIndex;
         ++trackIndex;
@@ -88,7 +88,7 @@
     for (size_t i = 0; i < m_addTrackTracks.size(); ++i) {
         if (!m_addTrackTracks[i]->isRendered())
             continue;
-        
+
         if (m_addTrackTracks[i] == textTrack)
             return trackIndex;
         ++trackIndex;
@@ -97,7 +97,7 @@
     for (size_t i = 0; i < m_inbandTracks.size(); ++i) {
         if (!m_inbandTracks[i]->isRendered())
             continue;
-        
+
         if (m_inbandTracks[i] == textTrack)
             return trackIndex;
         ++trackIndex;
@@ -186,15 +186,18 @@
 void TextTrackList::remove(TextTrack* track)
 {
     Vector<RefPtr<TextTrack> >* tracks = 0;
+    RefPtr<InbandTextTrack> inbandTrack;
 
-    if (track->trackType() == TextTrack::TrackElement)
+    if (track->trackType() == TextTrack::TrackElement) {
         tracks = &m_elementTracks;
-    else if (track->trackType() == TextTrack::AddTrack)
+    } else if (track->trackType() == TextTrack::AddTrack) {
         tracks = &m_addTrackTracks;
-    else if (track->trackType() == TextTrack::InBand)
+    } else if (track->trackType() == TextTrack::InBand) {
         tracks = &m_inbandTracks;
-    else
+        inbandTrack = static_cast<InbandTextTrack*>(track);
+    } else {
         ASSERT_NOT_REACHED();
+    }
 
     size_t index = tracks->find(track);
     if (index == notFound)
@@ -206,12 +209,15 @@
     track->setMediaElement(0);
 
     tracks->remove(index);
+
+    if (inbandTrack)
+        inbandTrack->trackRemoved();
 }
 
 bool TextTrackList::contains(TextTrack* track) const
 {
     const Vector<RefPtr<TextTrack> >* tracks = 0;
-    
+
     if (track->trackType() == TextTrack::TrackElement)
         tracks = &m_elementTracks;
     else if (track->trackType() == TextTrack::AddTrack)
@@ -220,7 +226,7 @@
         tracks = &m_inbandTracks;
     else
         ASSERT_NOT_REACHED();
-    
+
     return tracks->find(track) != notFound;
 }
 
@@ -233,9 +239,9 @@
 {
     // 4.8.10.12.3 Sourcing out-of-band text tracks
     // 4.8.10.12.4 Text track API
-    // ... then queue a task to fire an event with the name addtrack, that does not 
-    // bubble and is not cancelable, and that uses the TrackEvent interface, with 
-    // the track attribute initialized to the text track's TextTrack object, at 
+    // ... then queue a task to fire an event with the name addtrack, that does not
+    // bubble and is not cancelable, and that uses the TrackEvent interface, with
+    // the track attribute initialized to the text track's TextTrack object, at
     // the media element's textTracks attribute's TextTrackList object.
 
     RefPtr<TextTrack> trackRef = track;
@@ -265,4 +271,3 @@
 {
     return m_owner;
 }
-
diff --git a/Source/core/html/track/TextTrackList.idl b/Source/core/html/track/TextTrackList.idl
index 905efc3..a6e51b3 100644
--- a/Source/core/html/track/TextTrackList.idl
+++ b/Source/core/html/track/TextTrackList.idl
@@ -25,20 +25,11 @@
 
 [
     EnabledAtRuntime=videoTrack,
-    EventTarget,
     GenerateIsReachable=owner
-] interface TextTrackList {
+] interface TextTrackList : EventTarget {
     readonly attribute unsigned long length;
     getter TextTrack item(unsigned long index);
 
     attribute EventListener onaddtrack;
-
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
 
diff --git a/Source/core/html/track/TextTrackRegion.cpp b/Source/core/html/track/TextTrackRegion.cpp
index 17bf8db..6d93be3 100644
--- a/Source/core/html/track/TextTrackRegion.cpp
+++ b/Source/core/html/track/TextTrackRegion.cpp
@@ -42,8 +42,8 @@
 #include "core/platform/Logging.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderObject.h"
-#include <wtf/MathExtras.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/MathExtras.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -107,7 +107,7 @@
     }
 
     if (value < 0 || value > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -117,7 +117,7 @@
 void TextTrackRegion::setHeight(long value, ExceptionCode& ec)
 {
     if (value < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -132,7 +132,7 @@
     }
 
     if (value < 0 || value > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -147,7 +147,7 @@
     }
 
     if (value < 0 || value > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -162,7 +162,7 @@
     }
 
     if (value < 0 || value > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -177,7 +177,7 @@
     }
 
     if (value < 0 || value > 100) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -199,7 +199,7 @@
     DEFINE_STATIC_LOCAL(const AtomicString, upScrollValueKeyword, ("up", AtomicString::ConstructFromLiteral));
 
     if (value != emptyString() && value != upScrollValueKeyword) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
diff --git a/Source/core/html/track/TextTrackRegion.h b/Source/core/html/track/TextTrackRegion.h
index 30b8568..920a54b 100644
--- a/Source/core/html/track/TextTrackRegion.h
+++ b/Source/core/html/track/TextTrackRegion.h
@@ -37,8 +37,8 @@
 #include "core/dom/Document.h"
 #include "core/html/track/TextTrack.h"
 #include "core/platform/graphics/FloatPoint.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/track/TextTrackRegionList.h b/Source/core/html/track/TextTrackRegionList.h
index 1ff8956..dd8a64e 100644
--- a/Source/core/html/track/TextTrackRegionList.h
+++ b/Source/core/html/track/TextTrackRegionList.h
@@ -29,9 +29,9 @@
 #if ENABLE(WEBVTT_REGIONS)
 
 #include "core/html/track/TextTrackRegion.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/track/TrackBase.h b/Source/core/html/track/TrackBase.h
index 30cfd52..c3cc850 100644
--- a/Source/core/html/track/TrackBase.h
+++ b/Source/core/html/track/TrackBase.h
@@ -27,7 +27,7 @@
 #define TrackBase_h
 
 #include "core/dom/EventTarget.h"
-#include <wtf/RefCounted.h>
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/track/WebVTTParser.cpp b/Source/core/html/track/WebVTTParser.cpp
index 33b01fb..117661e 100644
--- a/Source/core/html/track/WebVTTParser.cpp
+++ b/Source/core/html/track/WebVTTParser.cpp
@@ -29,14 +29,13 @@
  */
 
 #include "config.h"
-
 #include "core/html/track/WebVTTParser.h"
 
 #include "core/dom/ProcessingInstruction.h"
 #include "core/dom/Text.h"
 #include "core/html/track/WebVTTElement.h"
 #include "core/platform/text/SegmentedString.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/track/WebVTTParser.h b/Source/core/html/track/WebVTTParser.h
index 8c8d187..8839af7 100644
--- a/Source/core/html/track/WebVTTParser.h
+++ b/Source/core/html/track/WebVTTParser.h
@@ -36,8 +36,8 @@
 #include "core/html/track/TextTrackCue.h"
 #include "core/html/track/TextTrackRegion.h"
 #include "core/html/track/WebVTTTokenizer.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/track/WebVTTTokenizer.h b/Source/core/html/track/WebVTTTokenizer.h
index de1ee0a..2622a53 100644
--- a/Source/core/html/track/WebVTTTokenizer.h
+++ b/Source/core/html/track/WebVTTTokenizer.h
@@ -33,7 +33,7 @@
 
 #include "core/html/parser/InputStreamPreprocessor.h"
 #include "core/html/track/WebVTTToken.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/icu/LICENSE b/Source/core/icu/LICENSE
deleted file mode 100644
index 385d130..0000000
--- a/Source/core/icu/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1995-2006 International Business Machines Corporation and others
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this
-software and associated documentation files (the "Software"), to deal in the Software
-without restriction, including without limitation the rights to use, copy, modify,
-merge, publish, distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above copyright notice(s)
-and this permission notice appear in all copies of the Software and that both the above
-copyright notice(s) and this permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER
-OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
-CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not be used in
-advertising or otherwise to promote the sale, use or other dealings in this Software
-without prior written authorization of the copyright holder.
diff --git a/Source/core/icu/README b/Source/core/icu/README
deleted file mode 100644
index 389e2e8..0000000
--- a/Source/core/icu/README
+++ /dev/null
@@ -1,4 +0,0 @@
-The headers in this directory are for compiling on Mac OS X 10.4.
-The Mac OS X 10.4 release includes the ICU binary, but not ICU headers.
-For other platforms, installed ICU headers should be used rather than these.
-They are specific to Mac OS X 10.4.
diff --git a/Source/core/icu/unicode/bytestream.h b/Source/core/icu/unicode/bytestream.h
deleted file mode 100644
index fb9e07a..0000000
--- a/Source/core/icu/unicode/bytestream.h
+++ /dev/null
@@ -1,252 +0,0 @@
-// Copyright (C) 2009-2010, International Business Machines
-// Corporation and others. All Rights Reserved.
-//
-// Copyright 2007 Google Inc. All Rights Reserved.
-// Author: sanjay@google.com (Sanjay Ghemawat)
-//
-// Abstract interface that consumes a sequence of bytes (ByteSink).
-//
-// Used so that we can write a single piece of code that can operate
-// on a variety of output string types.
-//
-// Various implementations of this interface are provided:
-//   ByteSink:
-//      CheckedArrayByteSink    Write to a flat array, with bounds checking
-//      StringByteSink          Write to an STL string
-
-// This code is a contribution of Google code, and the style used here is
-// a compromise between the original Google code and the ICU coding guidelines.
-// For example, data types are ICU-ified (size_t,int->int32_t),
-// and API comments doxygen-ified, but function names and behavior are
-// as in the original, if possible.
-// Assertion-style error handling, not available in ICU, was changed to
-// parameter "pinning" similar to UnicodeString.
-//
-// In addition, this is only a partial port of the original Google code,
-// limited to what was needed so far. The (nearly) complete original code
-// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib
-// (see ICU ticket 6765, r25517).
-
-#ifndef __BYTESTREAM_H__
-#define __BYTESTREAM_H__
-
-/**
- * \file
- * \brief C++ API: Interface for writing bytes, and implementation classes.
- */
-
-#include "unicode/utypes.h"
-#include "unicode/uobject.h"
-#include "unicode/std_string.h"
-
-U_NAMESPACE_BEGIN
-
-/**
- * A ByteSink can be filled with bytes.
- * @stable ICU 4.2
- */
-class U_COMMON_API ByteSink : public UMemory {
-public:
-  /**
-   * Default constructor.
-   * @stable ICU 4.2
-   */
-  ByteSink() { }
-  /**
-   * Virtual destructor.
-   * @stable ICU 4.2
-   */
-  virtual ~ByteSink() { }
-
-  /**
-   * Append "bytes[0,n-1]" to this.
-   * @param bytes the pointer to the bytes
-   * @param n the number of bytes; must be non-negative
-   * @stable ICU 4.2
-   */
-  virtual void Append(const char* bytes, int32_t n) = 0;
-
-  /**
-   * Returns a writable buffer for appending and writes the buffer's capacity to
-   * *result_capacity. Guarantees *result_capacity>=min_capacity.
-   * May return a pointer to the caller-owned scratch buffer which must have
-   * scratch_capacity>=min_capacity.
-   * The returned buffer is only valid until the next operation
-   * on this ByteSink.
-   *
-   * After writing at most *result_capacity bytes, call Append() with the
-   * pointer returned from this function and the number of bytes written.
-   * Many Append() implementations will avoid copying bytes if this function
-   * returned an internal buffer.
-   *
-   * Partial usage example:
-   *  int32_t capacity;
-   *  char* buffer = sink->GetAppendBuffer(..., &capacity);
-   *  ... Write n bytes into buffer, with n <= capacity.
-   *  sink->Append(buffer, n);
-   * In many implementations, that call to Append will avoid copying bytes.
-   *
-   * If the ByteSink allocates or reallocates an internal buffer, it should use
-   * the desired_capacity_hint if appropriate.
-   * If a caller cannot provide a reasonable guess at the desired capacity,
-   * it should pass desired_capacity_hint=0.
-   *
-   * If a non-scratch buffer is returned, the caller may only pass
-   * a prefix to it to Append().
-   * That is, it is not correct to pass an interior pointer to Append().
-   *
-   * The default implementation always returns the scratch buffer.
-   *
-   * @param min_capacity required minimum capacity of the returned buffer;
-   *                     must be non-negative
-   * @param desired_capacity_hint desired capacity of the returned buffer;
-   *                              must be non-negative
-   * @param scratch default caller-owned buffer
-   * @param scratch_capacity capacity of the scratch buffer
-   * @param result_capacity pointer to an integer which will be set to the
-   *                        capacity of the returned buffer
-   * @return a buffer with *result_capacity>=min_capacity
-   * @stable ICU 4.2
-   */
-  virtual char* GetAppendBuffer(int32_t min_capacity,
-                                int32_t desired_capacity_hint,
-                                char* scratch, int32_t scratch_capacity,
-                                int32_t* result_capacity);
-
-  /**
-   * Flush internal buffers.
-   * Some byte sinks use internal buffers or provide buffering
-   * and require calling Flush() at the end of the stream.
-   * The ByteSink should be ready for further Append() calls after Flush().
-   * The default implementation of Flush() does nothing.
-   * @stable ICU 4.2
-   */
-  virtual void Flush();
-
-private:
-  ByteSink(const ByteSink &); // copy constructor not implemented
-  ByteSink &operator=(const ByteSink &); // assignment operator not implemented
-};
-
-// -------------------------------------------------------------
-// Some standard implementations
-
-/** 
- * Implementation of ByteSink that writes to a flat byte array,
- * with bounds-checking:
- * This sink will not write more than capacity bytes to outbuf.
- * If more than capacity bytes are Append()ed, then excess bytes are ignored,
- * and Overflowed() will return true.
- * Overflow does not cause a runtime error.
- * @stable ICU 4.2
- */
-class U_COMMON_API CheckedArrayByteSink : public ByteSink {
-public:
-  /**
-   * Constructs a ByteSink that will write to outbuf[0..capacity-1].
-   * @param outbuf buffer to write to
-   * @param capacity size of the buffer
-   * @stable ICU 4.2
-   */
-  CheckedArrayByteSink(char* outbuf, int32_t capacity);
-  /**
-   * Returns the sink to its original state, without modifying the buffer.
-   * Useful for reusing both the buffer and the sink for multiple streams.
-   * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0
-   * and Overflowed()=FALSE.
-   * @return *this
-   * @draft ICU 4.6
-   */
-  virtual CheckedArrayByteSink& Reset();
-  /**
-   * Append "bytes[0,n-1]" to this.
-   * @param bytes the pointer to the bytes
-   * @param n the number of bytes; must be non-negative
-   * @stable ICU 4.2
-   */
-  virtual void Append(const char* bytes, int32_t n);
-  /**
-   * Returns a writable buffer for appending and writes the buffer's capacity to
-   * *result_capacity. For details see the base class documentation.
-   * @param min_capacity required minimum capacity of the returned buffer;
-   *                     must be non-negative
-   * @param desired_capacity_hint desired capacity of the returned buffer;
-   *                              must be non-negative
-   * @param scratch default caller-owned buffer
-   * @param scratch_capacity capacity of the scratch buffer
-   * @param result_capacity pointer to an integer which will be set to the
-   *                        capacity of the returned buffer
-   * @return a buffer with *result_capacity>=min_capacity
-   * @stable ICU 4.2
-   */
-  virtual char* GetAppendBuffer(int32_t min_capacity,
-                                int32_t desired_capacity_hint,
-                                char* scratch, int32_t scratch_capacity,
-                                int32_t* result_capacity);
-  /**
-   * Returns the number of bytes actually written to the sink.
-   * @return number of bytes written to the buffer
-   * @stable ICU 4.2
-   */
-  int32_t NumberOfBytesWritten() const { return size_; }
-  /**
-   * Returns true if any bytes were discarded, i.e., if there was an
-   * attempt to write more than 'capacity' bytes.
-   * @return TRUE if more than 'capacity' bytes were Append()ed
-   * @stable ICU 4.2
-   */
-  UBool Overflowed() const { return overflowed_; }
-  /**
-   * Returns the number of bytes appended to the sink.
-   * If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten()
-   * else they return the same number.
-   * @return number of bytes written to the buffer
-   * @draft ICU 4.6
-   */
-  int32_t NumberOfBytesAppended() const { return appended_; }
-private:
-  char* outbuf_;
-  const int32_t capacity_;
-  int32_t size_;
-  int32_t appended_;
-  UBool overflowed_;
-  CheckedArrayByteSink(); ///< default constructor not implemented 
-  CheckedArrayByteSink(const CheckedArrayByteSink &); ///< copy constructor not implemented
-  CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assignment operator not implemented
-};
-
-#if U_HAVE_STD_STRING
-
-/** 
- * Implementation of ByteSink that writes to a "string".
- * The StringClass is usually instantiated with a std::string.
- * @stable ICU 4.2
- */
-template<typename StringClass>
-class StringByteSink : public ByteSink {
- public:
-  /**
-   * Constructs a ByteSink that will append bytes to the dest string.
-   * @param dest pointer to string object to append to
-   * @stable ICU 4.2
-   */
-  StringByteSink(StringClass* dest) : dest_(dest) { }
-  /**
-   * Append "bytes[0,n-1]" to this.
-   * @param data the pointer to the bytes
-   * @param n the number of bytes; must be non-negative
-   * @stable ICU 4.2
-   */
-  virtual void Append(const char* data, int32_t n) { dest_->append(data, n); }
- private:
-  StringClass* dest_;
-  StringByteSink(); ///< default constructor not implemented 
-  StringByteSink(const StringByteSink &); ///< copy constructor not implemented
-  StringByteSink &operator=(const StringByteSink &); ///< assignment operator not implemented
-};
-
-#endif
-
-U_NAMESPACE_END
-
-#endif  // __BYTESTREAM_H__
diff --git a/Source/core/icu/unicode/chariter.h b/Source/core/icu/unicode/chariter.h
deleted file mode 100644
index 12fc924..0000000
--- a/Source/core/icu/unicode/chariter.h
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
-********************************************************************
-*
-*   Copyright (C) 1997-2005, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-********************************************************************
-*/
-
-#ifndef CHARITER_H
-#define CHARITER_H
-
-#include "unicode/utypes.h"
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-/**
- * \file
- * \brief C++ API: Character Iterator
- */
- 
-U_NAMESPACE_BEGIN
-/**
- * Abstract class that defines an API for forward-only iteration
- * on text objects.
- * This is a minimal interface for iteration without random access
- * or backwards iteration. It is especially useful for wrapping
- * streams with converters into an object for collation or
- * normalization.
- *
- * <p>Characters can be accessed in two ways: as code units or as
- * code points.
- * Unicode code points are 21-bit integers and are the scalar values
- * of Unicode characters. ICU uses the type UChar32 for them.
- * Unicode code units are the storage units of a given
- * Unicode/UCS Transformation Format (a character encoding scheme).
- * With UTF-16, all code points can be represented with either one
- * or two code units ("surrogates").
- * String storage is typically based on code units, while properties
- * of characters are typically determined using code point values.
- * Some processes may be designed to work with sequences of code units,
- * or it may be known that all characters that are important to an
- * algorithm can be represented with single code units.
- * Other processes will need to use the code point access functions.</p>
- *
- * <p>ForwardCharacterIterator provides nextPostInc() to access
- * a code unit and advance an internal position into the text object,
- * similar to a <code>return text[position++]</code>.<br>
- * It provides next32PostInc() to access a code point and advance an internal
- * position.</p>
- *
- * <p>next32PostInc() assumes that the current position is that of
- * the beginning of a code point, i.e., of its first code unit.
- * After next32PostInc(), this will be true again.
- * In general, access to code units and code points in the same
- * iteration loop should not be mixed. In UTF-16, if the current position
- * is on a second code unit (Low Surrogate), then only that code unit
- * is returned even by next32PostInc().</p>
- *
- * <p>For iteration with either function, there are two ways to
- * check for the end of the iteration. When there are no more
- * characters in the text object:
- * <ul>
- * <li>The hasNext() function returns FALSE.</li>
- * <li>nextPostInc() and next32PostInc() return DONE
- *     when one attempts to read beyond the end of the text object.</li>
- * </ul>
- *
- * Example:
- * \code 
- * void function1(ForwardCharacterIterator &it) {
- *     UChar32 c;
- *     while(it.hasNext()) {
- *         c=it.next32PostInc();
- *         // use c
- *     }
- * }
- *
- * void function1(ForwardCharacterIterator &it) {
- *     UChar c;
- *     while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) {
- *         // use c
- *      }
- *  }
- * \endcode
- * </p>
- *
- * @stable ICU 2.0
- */
-class U_COMMON_API ForwardCharacterIterator : public UObject {
-public:
-    /**
-     * Value returned by most of ForwardCharacterIterator's functions
-     * when the iterator has reached the limits of its iteration.
-     * @stable ICU 2.0
-     */
-    enum { DONE = 0xffff };
-    
-    /**
-     * Destructor.  
-     * @stable ICU 2.0
-     */
-    virtual ~ForwardCharacterIterator();
-    
-    /**
-     * Returns true when both iterators refer to the same
-     * character in the same character-storage object.  
-     * @param that The ForwardCharacterIterator to be compared for equality
-     * @return true when both iterators refer to the same
-     * character in the same character-storage object
-     * @stable ICU 2.0
-     */
-    virtual UBool operator==(const ForwardCharacterIterator& that) const = 0;
-    
-    /**
-     * Returns true when the iterators refer to different
-     * text-storage objects, or to different characters in the
-     * same text-storage object.  
-     * @param that The ForwardCharacterIterator to be compared for inequality
-     * @return true when the iterators refer to different
-     * text-storage objects, or to different characters in the
-     * same text-storage object
-     * @stable ICU 2.0
-     */
-    inline UBool operator!=(const ForwardCharacterIterator& that) const;
-    
-    /**
-     * Generates a hash code for this iterator.  
-     * @return the hash code.
-     * @stable ICU 2.0
-     */
-    virtual int32_t hashCode(void) const = 0;
-    
-    /**
-     * Returns a UClassID for this ForwardCharacterIterator ("poor man's
-     * RTTI").<P> Despite the fact that this function is public,
-     * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API! 
-     * @return a UClassID for this ForwardCharacterIterator 
-     * @stable ICU 2.0
-     */
-    virtual UClassID getDynamicClassID(void) const = 0;
-    
-    /**
-     * Gets the current code unit for returning and advances to the next code unit
-     * in the iteration range
-     * (toward endIndex()).  If there are
-     * no more code units to return, returns DONE.
-     * @return the current code unit.
-     * @stable ICU 2.0
-     */
-    virtual UChar         nextPostInc(void) = 0;
-    
-    /**
-     * Gets the current code point for returning and advances to the next code point
-     * in the iteration range
-     * (toward endIndex()).  If there are
-     * no more code points to return, returns DONE.
-     * @return the current code point.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       next32PostInc(void) = 0;
-    
-    /**
-     * Returns FALSE if there are no more code units or code points
-     * at or after the current position in the iteration range.
-     * This is used with nextPostInc() or next32PostInc() in forward
-     * iteration.
-     * @returns FALSE if there are no more code units or code points
-     * at or after the current position in the iteration range.
-     * @stable ICU 2.0
-     */
-    virtual UBool        hasNext() = 0;
-    
-protected:
-    /** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/
-    ForwardCharacterIterator();
-    
-    /** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/
-    ForwardCharacterIterator(const ForwardCharacterIterator &other);
-    
-    /**
-     * Assignment operator to be overridden in the implementing class.
-     * @stable ICU 2.0
-     */
-    ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; }
-};
-
-/**
- * Abstract class that defines an API for iteration
- * on text objects.
- * This is an interface for forward and backward iteration
- * and random access into a text object.
- *
- * <p>The API provides backward compatibility to the Java and older ICU
- * CharacterIterator classes but extends them significantly:
- * <ol>
- * <li>CharacterIterator is now a subclass of ForwardCharacterIterator.</li>
- * <li>While the old API functions provided forward iteration with
- *     "pre-increment" semantics, the new one also provides functions
- *     with "post-increment" semantics. They are more efficient and should
- *     be the preferred iterator functions for new implementations.
- *     The backward iteration always had "pre-decrement" semantics, which
- *     are efficient.</li>
- * <li>Just like ForwardCharacterIterator, it provides access to
- *     both code units and code points. Code point access versions are available
- *     for the old and the new iteration semantics.</li>
- * <li>There are new functions for setting and moving the current position
- *     without returning a character, for efficiency.</li>
- * </ol>
- *
- * See ForwardCharacterIterator for examples for using the new forward iteration
- * functions. For backward iteration, there is also a hasPrevious() function
- * that can be used analogously to hasNext().
- * The old functions work as before and are shown below.</p>
- *
- * <p>Examples for some of the new functions:</p>
- *
- * Forward iteration with hasNext():
- * \code
- * void forward1(CharacterIterator &it) {
- *     UChar32 c;
- *     for(it.setToStart(); it.hasNext();) {
- *         c=it.next32PostInc();
- *         // use c
- *     }
- *  }
- * \endcode
- * Forward iteration more similar to loops with the old forward iteration,
- * showing a way to convert simple for() loops:
- * \code
- * void forward2(CharacterIterator &it) {
- *     UChar c;
- *     for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) {
- *          // use c
- *      }
- * }
- * \endcode
- * Backward iteration with setToEnd() and hasPrevious():
- * \code
- *  void backward1(CharacterIterator &it) {
- *      UChar32 c;
- *      for(it.setToEnd(); it.hasPrevious();) {
- *         c=it.previous32();
- *          // use c
- *      }
- *  }
- * \endcode
- * Backward iteration with a more traditional for() loop:
- * \code
- * void backward2(CharacterIterator &it) {
- *     UChar c;
- *     for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) {
- *         // use c
- *      }
- *  }
- * \endcode
- *
- * Example for random access:
- * \code
- *  void random(CharacterIterator &it) {
- *      // set to the third code point from the beginning
- *      it.move32(3, CharacterIterator::kStart);
- *      // get a code point from here without moving the position
- *      UChar32 c=it.current32();
- *      // get the position
- *      int32_t pos=it.getIndex();
- *      // get the previous code unit
- *      UChar u=it.previous();
- *      // move back one more code unit
- *      it.move(-1, CharacterIterator::kCurrent);
- *      // set the position back to where it was
- *      // and read the same code point c and move beyond it
- *      it.setIndex(pos);
- *      if(c!=it.next32PostInc()) {
- *          exit(1); // CharacterIterator inconsistent
- *      }
- *  }
- * \endcode
- *
- * <p>Examples, especially for the old API:</p>
- *
- * Function processing characters, in this example simple output
- * <pre>
- * \code
- *  void processChar( UChar c )
- *  {
- *      cout << " " << c;
- *  }
- * \endcode
- * </pre>
- * Traverse the text from start to finish
- * <pre> 
- * \code
- *  void traverseForward(CharacterIterator& iter)
- *  {
- *      for(UChar c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
- *          processChar(c);
- *      }
- *  }
- * \endcode
- * </pre>
- * Traverse the text backwards, from end to start
- * <pre>
- * \code
- *  void traverseBackward(CharacterIterator& iter)
- *  {
- *      for(UChar c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
- *          processChar(c);
- *      }
- *  }
- * \endcode
- * </pre>
- * Traverse both forward and backward from a given position in the text. 
- * Calls to notBoundary() in this example represents some additional stopping criteria.
- * <pre>
- * \code
- * void traverseOut(CharacterIterator& iter, int32_t pos)
- * {
- *      UChar c;
- *      for (c = iter.setIndex(pos);
- *      c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
- *          c = iter.next()) {}
- *      int32_t end = iter.getIndex();
- *      for (c = iter.setIndex(pos);
- *          c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
- *          c = iter.previous()) {}
- *      int32_t start = iter.getIndex() + 1;
- *  
- *      cout << "start: " << start << " end: " << end << endl;
- *      for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
- *          processChar(c);
- *     }
- *  }
- * \endcode
- * </pre>
- * Creating a StringCharacterIterator and calling the test functions
- * <pre>
- * \code
- *  void CharacterIterator_Example( void )
- *   {
- *       cout << endl << "===== CharacterIterator_Example: =====" << endl;
- *       UnicodeString text("Ein kleiner Satz.");
- *       StringCharacterIterator iterator(text);
- *       cout << "----- traverseForward: -----------" << endl;
- *       traverseForward( iterator );
- *       cout << endl << endl << "----- traverseBackward: ----------" << endl;
- *       traverseBackward( iterator );
- *       cout << endl << endl << "----- traverseOut: ---------------" << endl;
- *       traverseOut( iterator, 7 );
- *       cout << endl << endl << "-----" << endl;
- *   }
- * \endcode
- * </pre>
- *
- * @stable ICU 2.0
- */
-class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
-public:
-    /**
-     * Origin enumeration for the move() and move32() functions.
-     * @stable ICU 2.0
-     */
-    enum EOrigin { kStart, kCurrent, kEnd };
-
-    /**
-     * Returns a pointer to a new CharacterIterator of the same
-     * concrete class as this one, and referring to the same
-     * character in the same text-storage object as this one.  The
-     * caller is responsible for deleting the new clone.  
-     * @return a pointer to a new CharacterIterator
-     * @stable ICU 2.0
-     */
-    virtual CharacterIterator* clone(void) const = 0;
-
-    /**
-     * Sets the iterator to refer to the first code unit in its
-     * iteration range, and returns that code unit.
-     * This can be used to begin an iteration with next().
-     * @return the first code unit in its iteration range.
-     * @stable ICU 2.0
-     */
-    virtual UChar         first(void) = 0;
-
-    /**
-     * Sets the iterator to refer to the first code unit in its
-     * iteration range, returns that code unit, and moves the position
-     * to the second code unit. This is an alternative to setToStart()
-     * for forward iteration with nextPostInc().
-     * @return the first code unit in its iteration range.
-     * @stable ICU 2.0
-     */
-    virtual UChar         firstPostInc(void);
-
-    /**
-     * Sets the iterator to refer to the first code point in its
-     * iteration range, and returns that code unit,
-     * This can be used to begin an iteration with next32().
-     * Note that an iteration with next32PostInc(), beginning with,
-     * e.g., setToStart() or firstPostInc(), is more efficient.
-     * @return the first code point in its iteration range.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       first32(void) = 0;
-
-    /**
-     * Sets the iterator to refer to the first code point in its
-     * iteration range, returns that code point, and moves the position
-     * to the second code point. This is an alternative to setToStart()
-     * for forward iteration with next32PostInc().
-     * @return the first code point in its iteration range.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       first32PostInc(void);
-
-    /**
-     * Sets the iterator to refer to the first code unit or code point in its
-     * iteration range. This can be used to begin a forward
-     * iteration with nextPostInc() or next32PostInc().
-     * @return the start position of the iteration range
-     * @stable ICU 2.0
-     */
-    inline int32_t    setToStart();
-
-    /**
-     * Sets the iterator to refer to the last code unit in its
-     * iteration range, and returns that code unit.
-     * This can be used to begin an iteration with previous().
-     * @return the last code unit.
-     * @stable ICU 2.0
-     */
-    virtual UChar         last(void) = 0;
-        
-    /**
-     * Sets the iterator to refer to the last code point in its
-     * iteration range, and returns that code unit.
-     * This can be used to begin an iteration with previous32().
-     * @return the last code point.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       last32(void) = 0;
-
-    /**
-     * Sets the iterator to the end of its iteration range, just behind
-     * the last code unit or code point. This can be used to begin a backward
-     * iteration with previous() or previous32().
-     * @return the end position of the iteration range
-     * @stable ICU 2.0
-     */
-    inline int32_t    setToEnd();
-
-    /**
-     * Sets the iterator to refer to the "position"-th code unit
-     * in the text-storage object the iterator refers to, and
-     * returns that code unit.  
-     * @param position the "position"-th code unit in the text-storage object
-     * @return the "position"-th code unit.
-     * @stable ICU 2.0
-     */
-    virtual UChar         setIndex(int32_t position) = 0;
-
-    /**
-     * Sets the iterator to refer to the beginning of the code point
-     * that contains the "position"-th code unit
-     * in the text-storage object the iterator refers to, and
-     * returns that code point.
-     * The current position is adjusted to the beginning of the code point
-     * (its first code unit).
-     * @param position the "position"-th code unit in the text-storage object
-     * @return the "position"-th code point.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       setIndex32(int32_t position) = 0;
-
-    /**
-     * Returns the code unit the iterator currently refers to. 
-     * @return the current code unit. 
-     * @stable ICU 2.0
-     */
-    virtual UChar         current(void) const = 0;
-        
-    /**
-     * Returns the code point the iterator currently refers to.  
-     * @return the current code point.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       current32(void) const = 0;
-        
-    /**
-     * Advances to the next code unit in the iteration range
-     * (toward endIndex()), and returns that code unit.  If there are
-     * no more code units to return, returns DONE.
-     * @return the next code unit.
-     * @stable ICU 2.0
-     */
-    virtual UChar         next(void) = 0;
-        
-    /**
-     * Advances to the next code point in the iteration range
-     * (toward endIndex()), and returns that code point.  If there are
-     * no more code points to return, returns DONE.
-     * Note that iteration with "pre-increment" semantics is less
-     * efficient than iteration with "post-increment" semantics
-     * that is provided by next32PostInc().
-     * @return the next code point.
-     * @stable ICU 2.0
-     */
-    virtual UChar32       next32(void) = 0;
-        
-    /**
-     * Advances to the previous code unit in the iteration range
-     * (toward startIndex()), and returns that code unit.  If there are
-     * no more code units to return, returns DONE.  
-     * @return the previous code unit.
-     * @stable ICU 2.0
-     */
-    virtual UChar         previous(void) = 0;
-
-    /**
-     * Advances to the previous code point in the iteration range
-     * (toward startIndex()), and returns that code point.  If there are
-     * no more code points to return, returns DONE. 
-     * @return the previous code point. 
-     * @stable ICU 2.0
-     */
-    virtual UChar32       previous32(void) = 0;
-
-    /**
-     * Returns FALSE if there are no more code units or code points
-     * before the current position in the iteration range.
-     * This is used with previous() or previous32() in backward
-     * iteration.
-     * @return FALSE if there are no more code units or code points
-     * before the current position in the iteration range, return TRUE otherwise.
-     * @stable ICU 2.0
-     */
-    virtual UBool        hasPrevious() = 0;
-
-    /**
-     * Returns the numeric index in the underlying text-storage
-     * object of the character returned by first().  Since it's
-     * possible to create an iterator that iterates across only
-     * part of a text-storage object, this number isn't
-     * necessarily 0.  
-     * @returns the numeric index in the underlying text-storage
-     * object of the character returned by first().
-     * @stable ICU 2.0
-     */
-    inline int32_t       startIndex(void) const;
-        
-    /**
-     * Returns the numeric index in the underlying text-storage
-     * object of the position immediately BEYOND the character
-     * returned by last().  
-     * @return the numeric index in the underlying text-storage
-     * object of the position immediately BEYOND the character
-     * returned by last().
-     * @stable ICU 2.0
-     */
-    inline int32_t       endIndex(void) const;
-        
-    /**
-     * Returns the numeric index in the underlying text-storage
-     * object of the character the iterator currently refers to
-     * (i.e., the character returned by current()).  
-     * @return the numberic index in the text-storage object of 
-     * the character the iterator currently refers to
-     * @stable ICU 2.0
-     */
-    inline int32_t       getIndex(void) const;
-
-    /**
-     * Returns the length of the entire text in the underlying
-     * text-storage object.
-     * @return the length of the entire text in the text-storage object
-     * @stable ICU 2.0
-     */
-    inline int32_t           getLength() const;
-
-    /**
-     * Moves the current position relative to the start or end of the
-     * iteration range, or relative to the current position itself.
-     * The movement is expressed in numbers of code units forward
-     * or backward by specifying a positive or negative delta.
-     * @param delta the position relative to origin. A positive delta means forward;
-     * a negative delta means backward.
-     * @param origin Origin enumeration {kStart, kCurrent, kEnd}
-     * @return the new position
-     * @stable ICU 2.0
-     */
-    virtual int32_t      move(int32_t delta, EOrigin origin) = 0;
-
-    /**
-     * Moves the current position relative to the start or end of the
-     * iteration range, or relative to the current position itself.
-     * The movement is expressed in numbers of code points forward
-     * or backward by specifying a positive or negative delta.
-     * @param delta the position relative to origin. A positive delta means forward;
-     * a negative delta means backward.
-     * @param origin Origin enumeration {kStart, kCurrent, kEnd}
-     * @return the new position
-     * @stable ICU 2.0
-     */
-    virtual int32_t      move32(int32_t delta, EOrigin origin) = 0;
-
-    /**
-     * Copies the text under iteration into the UnicodeString
-     * referred to by "result".  
-     * @param result Receives a copy of the text under iteration.  
-     * @stable ICU 2.0
-     */
-    virtual void            getText(UnicodeString&  result) = 0;
-
-protected:
-    /**
-     * Empty constructor.
-     * @stable ICU 2.0
-     */
-    CharacterIterator();
-
-    /**
-     * Constructor, just setting the length field in this base class.
-     * @stable ICU 2.0
-     */
-    CharacterIterator(int32_t length);
-
-    /**
-     * Constructor, just setting the length and position fields in this base class.
-     * @stable ICU 2.0
-     */
-    CharacterIterator(int32_t length, int32_t position);
-
-    /**
-     * Constructor, just setting the length, start, end, and position fields in this base class.
-     * @stable ICU 2.0
-     */
-    CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
-  
-    /**
-     * Copy constructor.
-     *
-     * @param that The CharacterIterator to be copied
-     * @stable ICU 2.0
-     */
-    CharacterIterator(const CharacterIterator &that);
-
-    /**
-     * Assignment operator.  Sets this CharacterIterator to have the same behavior,
-     * as the one passed in.
-     * @param that The CharacterIterator passed in.
-     * @return the newly set CharacterIterator.
-     * @stable ICU 2.0
-     */
-    CharacterIterator &operator=(const CharacterIterator &that);
-
-    /**
-     * Base class text length field.
-     * Necessary this for correct getText() and hashCode().
-     * @stable ICU 2.0
-     */
-    int32_t textLength;
-
-    /**
-     * Base class field for the current position.
-     * @stable ICU 2.0
-     */
-    int32_t  pos;
-
-    /**
-     * Base class field for the start of the iteration range.
-     * @stable ICU 2.0
-     */
-    int32_t  begin;
-
-    /**
-     * Base class field for the end of the iteration range.
-     * @stable ICU 2.0
-     */
-    int32_t  end;
-};
-
-inline UBool
-ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const {
-    return !operator==(that);
-}
-
-inline int32_t
-CharacterIterator::setToStart() {
-    return move(0, kStart);
-}
-
-inline int32_t
-CharacterIterator::setToEnd() {
-    return move(0, kEnd);
-}
-
-inline int32_t
-CharacterIterator::startIndex(void) const {
-    return begin;
-}
-
-inline int32_t
-CharacterIterator::endIndex(void) const {
-    return end;
-}
-
-inline int32_t
-CharacterIterator::getIndex(void) const {
-    return pos;
-}
-
-inline int32_t
-CharacterIterator::getLength(void) const {
-    return textLength;
-}
-
-U_NAMESPACE_END
-#endif
diff --git a/Source/core/icu/unicode/localpointer.h b/Source/core/icu/unicode/localpointer.h
deleted file mode 100644
index b76a1f8..0000000
--- a/Source/core/icu/unicode/localpointer.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2009-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  localpointer.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2009nov13
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __LOCALPOINTER_H__
-#define __LOCALPOINTER_H__
-
-/**
- * \file 
- * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
- *
- * These classes are inspired by
- * - std::auto_ptr
- * - boost::scoped_ptr & boost::scoped_array
- * - Taligent Safe Pointers (TOnlyPointerTo)
- *
- * but none of those provide for all of the goals for ICU smart pointers:
- * - Smart pointer owns the object and releases it when it goes out of scope.
- * - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust.
- * - ICU-compatible: No exceptions.
- * - Need to be able to orphan/release the pointer and its ownership.
- * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects.
- *
- * For details see http://site.icu-project.org/design/cpp/scoped_ptr
- */
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * "Smart pointer" base class; do not use directly: use LocalPointer etc.
- *
- * Base class for smart pointer classes that do not throw exceptions.
- *
- * Do not use this base class directly, since it does not delete its pointer.
- * A subclass must implement methods that delete the pointer:
- * Destructor and adoptInstead().
- *
- * There is no operator T *() provided because the programmer must decide
- * whether to use getAlias() (without transfer of ownership) or orpan()
- * (with transfer of ownership and NULLing of the pointer).
- *
- * @see LocalPointer
- * @see LocalArray
- * @see U_DEFINE_LOCAL_OPEN_POINTER
- * @stable ICU 4.4
- */
-template<typename T>
-class LocalPointerBase {
-public:
-    /**
-     * Constructor takes ownership.
-     * @param p simple pointer to an object that is adopted
-     * @stable ICU 4.4
-     */
-    explicit LocalPointerBase(T *p=NULL) : ptr(p) {}
-    /**
-     * Destructor deletes the object it owns.
-     * Subclass must override: Base class does nothing.
-     * @stable ICU 4.4
-     */
-    ~LocalPointerBase() { /* delete ptr; */ }
-    /**
-     * NULL check.
-     * @return TRUE if ==NULL
-     * @stable ICU 4.4
-     */
-    UBool isNull() const { return ptr==NULL; }
-    /**
-     * NULL check.
-     * @return TRUE if !=NULL
-     * @stable ICU 4.4
-     */
-    UBool isValid() const { return ptr!=NULL; }
-    /**
-     * Comparison with a simple pointer, so that existing code
-     * with ==NULL need not be changed.
-     * @param other simple pointer for comparison
-     * @return true if this pointer value equals other
-     * @stable ICU 4.4
-     */
-    bool operator==(const T *other) const { return ptr==other; }
-    /**
-     * Comparison with a simple pointer, so that existing code
-     * with !=NULL need not be changed.
-     * @param other simple pointer for comparison
-     * @return true if this pointer value differs from other
-     * @stable ICU 4.4
-     */
-    bool operator!=(const T *other) const { return ptr!=other; }
-    /**
-     * Access without ownership change.
-     * @return the pointer value
-     * @stable ICU 4.4
-     */
-    T *getAlias() const { return ptr; }
-    /**
-     * Access without ownership change.
-     * @return the pointer value as a reference
-     * @stable ICU 4.4
-     */
-    T &operator*() const { return *ptr; }
-    /**
-     * Access without ownership change.
-     * @return the pointer value
-     * @stable ICU 4.4
-     */
-    T *operator->() const { return ptr; }
-    /**
-     * Gives up ownership; the internal pointer becomes NULL.
-     * @return the pointer value;
-     *         caller becomes responsible for deleting the object
-     * @stable ICU 4.4
-     */
-    T *orphan() {
-        T *p=ptr;
-        ptr=NULL;
-        return p;
-    }
-    /**
-     * Deletes the object it owns,
-     * and adopts (takes ownership of) the one passed in.
-     * Subclass must override: Base class does not delete the object.
-     * @param p simple pointer to an object that is adopted
-     * @stable ICU 4.4
-     */
-    void adoptInstead(T *p) {
-        // delete ptr;
-        ptr=p;
-    }
-protected:
-    T *ptr;
-private:
-    // No comparison operators with other LocalPointerBases.
-    bool operator==(const LocalPointerBase &other);
-    bool operator!=(const LocalPointerBase &other);
-    // No ownership transfer: No copy constructor, no assignment operator.
-    LocalPointerBase(const LocalPointerBase &other);
-    void operator=(const LocalPointerBase &other);
-    // No heap allocation. Use only on the stack.
-    static void * U_EXPORT2 operator new(size_t size);
-    static void * U_EXPORT2 operator new[](size_t size);
-#if U_HAVE_PLACEMENT_NEW
-    static void * U_EXPORT2 operator new(size_t, void *ptr);
-#endif
-};
-
-/**
- * "Smart pointer" class, deletes objects via the standard C++ delete operator.
- * For most methods see the LocalPointerBase base class.
- *
- * Usage example:
- * \code
- * LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005));
- * int32_t length=s->length();  // 2
- * UChar lead=s->charAt(0);  // 0xd900
- * if(some condition) { return; }  // no need to explicitly delete the pointer
- * s.adoptInstead(new UnicodeString((UChar)0xfffc));
- * length=s->length();  // 1
- * // no need to explicitly delete the pointer
- * \endcode
- *
- * @see LocalPointerBase
- * @stable ICU 4.4
- */
-template<typename T>
-class LocalPointer : public LocalPointerBase<T> {
-public:
-    /**
-     * Constructor takes ownership.
-     * @param p simple pointer to an object that is adopted
-     * @stable ICU 4.4
-     */
-    explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {}
-    /**
-     * Destructor deletes the object it owns.
-     * @stable ICU 4.4
-     */
-    ~LocalPointer() {
-        delete LocalPointerBase<T>::ptr;
-    }
-    /**
-     * Deletes the object it owns,
-     * and adopts (takes ownership of) the one passed in.
-     * @param p simple pointer to an object that is adopted
-     * @stable ICU 4.4
-     */
-    void adoptInstead(T *p) {
-        delete LocalPointerBase<T>::ptr;
-        LocalPointerBase<T>::ptr=p;
-    }
-};
-
-/**
- * "Smart pointer" class, deletes objects via the C++ array delete[] operator.
- * For most methods see the LocalPointerBase base class.
- * Adds operator[] for array item access.
- *
- * Usage example:
- * \code
- * LocalArray<UnicodeString> a(new UnicodeString[2]);
- * a[0].append((UChar)0x61);
- * if(some condition) { return; }  // no need to explicitly delete the array
- * a.adoptInstead(new UnicodeString[4]);
- * a[3].append((UChar)0x62).append((UChar)0x63).reverse();
- * // no need to explicitly delete the array
- * \endcode
- *
- * @see LocalPointerBase
- * @stable ICU 4.4
- */
-template<typename T>
-class LocalArray : public LocalPointerBase<T> {
-public:
-    /**
-     * Constructor takes ownership.
-     * @param p simple pointer to an array of T objects that is adopted
-     * @stable ICU 4.4
-     */
-    explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
-    /**
-     * Destructor deletes the array it owns.
-     * @stable ICU 4.4
-     */
-    ~LocalArray() {
-        delete[] LocalPointerBase<T>::ptr;
-    }
-    /**
-     * Deletes the array it owns,
-     * and adopts (takes ownership of) the one passed in.
-     * @param p simple pointer to an array of T objects that is adopted
-     * @stable ICU 4.4
-     */
-    void adoptInstead(T *p) {
-        delete[] LocalPointerBase<T>::ptr;
-        LocalPointerBase<T>::ptr=p;
-    }
-    /**
-     * Array item access (writable).
-     * No index bounds check.
-     * @param i array index
-     * @return reference to the array item
-     * @stable ICU 4.4
-     */
-    T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
-};
-
-/**
- * \def U_DEFINE_LOCAL_OPEN_POINTER
- * "Smart pointer" definition macro, deletes objects via the closeFunction.
- * Defines a subclass of LocalPointerBase which works just
- * like LocalPointer<Type> except that this subclass will use the closeFunction
- * rather than the C++ delete operator.
- *
- * Requirement: The closeFunction must tolerate a NULL pointer.
- * (We could add a NULL check here but it is normally redundant.)
- *
- * Usage example:
- * \code
- * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
- * utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(),
- *     utf8Out, (int32_t)sizeof(utf8Out),
- *     utf8In, utf8InLength, &errorCode);
- * if(U_FAILURE(errorCode)) { return; }  // no need to explicitly delete the UCaseMap
- * \endcode
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
-    class LocalPointerClassName : public LocalPointerBase<Type> { \
-    public: \
-        explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
-        ~LocalPointerClassName() { closeFunction(ptr); } \
-        void adoptInstead(Type *p) { \
-            closeFunction(ptr); \
-            ptr=p; \
-        } \
-    }
-
-U_NAMESPACE_END
-
-#endif  /* U_SHOW_CPLUSPLUS_API */
-#endif  /* __LOCALPOINTER_H__ */
diff --git a/Source/core/icu/unicode/parseerr.h b/Source/core/icu/unicode/parseerr.h
deleted file mode 100644
index 44ff008..0000000
--- a/Source/core/icu/unicode/parseerr.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1999-2005, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*   Date        Name        Description
-*   03/14/00    aliu        Creation.
-*   06/27/00    aliu        Change from C++ class to C struct
-**********************************************************************
-*/
-#ifndef PARSEERR_H
-#define PARSEERR_H
-
-#include "unicode/utypes.h"
-
-
-/**
- * \file
- * \brief C API: Parse Error Information
- */
-/**
- * The capacity of the context strings in UParseError.
- * @stable ICU 2.0
- */ 
-enum { U_PARSE_CONTEXT_LEN = 16 };
-
-/**
- * A UParseError struct is used to returned detailed information about
- * parsing errors.  It is used by ICU parsing engines that parse long
- * rules, patterns, or programs, where the text being parsed is long
- * enough that more information than a UErrorCode is needed to
- * localize the error.
- *
- * <p>The line, offset, and context fields are optional; parsing
- * engines may choose not to use to use them.
- *
- * <p>The preContext and postContext strings include some part of the
- * context surrounding the error.  If the source text is "let for=7"
- * and "for" is the error (e.g., because it is a reserved word), then
- * some examples of what a parser might produce are the following:
- *
- * <pre>
- * preContext   postContext
- * ""           ""            The parser does not support context
- * "let "       "=7"          Pre- and post-context only
- * "let "       "for=7"       Pre- and post-context and error text
- * ""           "for"         Error text only
- * </pre>
- *
- * <p>Examples of engines which use UParseError (or may use it in the
- * future) are Transliterator, RuleBasedBreakIterator, and
- * RegexPattern.
- * 
- * @stable ICU 2.0
- */
-typedef struct UParseError {
-
-    /**
-     * The line on which the error occured.  If the parser uses this
-     * field, it sets it to the line number of the source text line on
-     * which the error appears, which will be be a value >= 1.  If the
-     * parse does not support line numbers, the value will be <= 0.
-     * @stable ICU 2.0
-     */
-    int32_t        line;
-
-    /**
-     * The character offset to the error.  If the line field is >= 1,
-     * then this is the offset from the start of the line.  Otherwise,
-     * this is the offset from the start of the text.  If the parser
-     * does not support this field, it will have a value < 0.
-     * @stable ICU 2.0
-     */
-    int32_t        offset;
-
-    /**
-     * Textual context before the error.  Null-terminated.  The empty
-     * string if not supported by parser.
-     * @stable ICU 2.0   
-     */
-    UChar          preContext[U_PARSE_CONTEXT_LEN];
-
-    /**
-     * The error itself and/or textual context after the error.
-     * Null-terminated.  The empty string if not supported by parser.
-     * @stable ICU 2.0   
-     */
-    UChar          postContext[U_PARSE_CONTEXT_LEN];
-
-} UParseError;
-
-#endif
diff --git a/Source/core/icu/unicode/platform.h b/Source/core/icu/unicode/platform.h
deleted file mode 100644
index 3de40d2..0000000
--- a/Source/core/icu/unicode/platform.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
-******************************************************************************
-*
-*   Copyright (C) 1997-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-******************************************************************************
-*
-* Note: autoconf creates platform.h from platform.h.in at configure time.
-*
-******************************************************************************
-*
-*  FILE NAME : platform.h
-*
-*   Date        Name        Description
-*   05/13/98    nos         Creation (content moved here from ptypes.h).
-*   03/02/99    stephen     Added AS400 support.
-*   03/30/99    stephen     Added Linux support.
-*   04/13/99    stephen     Reworked for autoconf.
-******************************************************************************
-*/
-
-#ifndef _PLATFORM_H
-#define _PLATFORM_H
-
-/**
- * \file 
- * \brief Basic types for the platform 
- */
-
-/* This file should be included before uvernum.h. */
-#if defined(UVERNUM_H)
-# error Do not include unicode/uvernum.h before #including unicode/platform.h.  Instead of unicode/uvernum.h, #include unicode/uversion.h
-#endif
-
-/**
- * Determine wheter to enable auto cleanup of libraries. 
- * @internal
- */
-#ifndef UCLN_NO_AUTO_CLEANUP
-#define UCLN_NO_AUTO_CLEANUP 1
-#endif
-
-/* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
-#ifndef CYGWINMSVC
-
-/** Define the platform we're on. */
-#ifndef U_DARWIN
-#define U_DARWIN
-#endif
-
-/**
- * \def U_HAVE_DIRENT_H
- * Define whether dirent.h is available 
- * @internal
- */
-#ifndef U_HAVE_DIRENT_H
-#define U_HAVE_DIRENT_H 1
-#endif
-
-/** Define whether inttypes.h is available */
-#ifndef U_HAVE_INTTYPES_H
-#define U_HAVE_INTTYPES_H 1
-#endif
-
-/**
- * Define what support for C++ streams is available.
- *     If U_IOSTREAM_SOURCE is set to 199711, then &lt;iostream&gt; is available
- * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
- * one should qualify streams using the std namespace in ICU header
- * files.
- *     If U_IOSTREAM_SOURCE is set to 198506, then &lt;iostream.h&gt; is
- * available instead (198506 is the date when Stroustrup published
- * "An Extensible I/O Facility for C++" at the summer USENIX conference).
- *     If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
- * support for them will be silently suppressed in ICU.
- *
- */
-
-#ifndef U_IOSTREAM_SOURCE
-#define U_IOSTREAM_SOURCE 199711
-#endif
-
-/**
- * \def U_HAVE_STD_STRING
- * Define whether the standard C++ (STL) &lt;string&gt; header is available.
- * For platforms that do not use platform.h and do not define this constant
- * in their platform-specific headers, std_string.h defaults
- * U_HAVE_STD_STRING to 1.
- * @internal
- */
-#ifndef U_HAVE_STD_STRING
-#define U_HAVE_STD_STRING 1
-#endif
-
-/** @{ Determines whether specific types are available */
-#ifndef U_HAVE_INT8_T
-#define U_HAVE_INT8_T 1
-#endif
-
-#ifndef U_HAVE_UINT8_T
-#define U_HAVE_UINT8_T 0
-#endif
-
-#ifndef U_HAVE_INT16_T
-#define U_HAVE_INT16_T 1
-#endif
-
-#ifndef U_HAVE_UINT16_T
-#define U_HAVE_UINT16_T 0
-#endif
-
-#ifndef U_HAVE_INT32_T
-#define U_HAVE_INT32_T 1
-#endif
-
-#ifndef U_HAVE_UINT32_T
-#define U_HAVE_UINT32_T 0
-#endif
-
-#ifndef U_HAVE_INT64_T
-#define U_HAVE_INT64_T 1
-#endif
-
-#ifndef U_HAVE_UINT64_T
-#define U_HAVE_UINT64_T 0
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Compiler and environment features                                     */
-/*===========================================================================*/
-
-/* Define whether namespace is supported */
-#ifndef U_HAVE_NAMESPACE
-#define U_HAVE_NAMESPACE 1
-#endif
-
-/* Determines the endianness of the platform
-   It's done this way in case multiple architectures are being built at once.
-   For example, Darwin supports fat binaries, which can be both PPC and x86 based. */
-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN)
-#define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
-#else
-#define U_IS_BIG_ENDIAN 1
-#endif
-
-/* 1 or 0 to enable or disable threads.  If undefined, default is: enable threads. */
-#ifndef ICU_USE_THREADS 
-#define ICU_USE_THREADS 1
-#endif
-
-/* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */
-#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-#define UMTX_STRONG_MEMORY_MODEL 1
-#endif
-
-#ifndef U_DEBUG
-#define U_DEBUG 0
-#endif
-
-#ifndef U_RELEASE
-#define U_RELEASE 1
-#endif
-
-/* Determine whether to disable renaming or not. This overrides the
-   setting in umachine.h which is for all platforms. */
-#ifndef U_DISABLE_RENAMING
-#define U_DISABLE_RENAMING 1
-#endif
-
-/* Determine whether to override new and delete. */
-#ifndef U_OVERRIDE_CXX_ALLOCATION
-#define U_OVERRIDE_CXX_ALLOCATION 1
-#endif
-/* Determine whether to override placement new and delete for STL. */
-#ifndef U_HAVE_PLACEMENT_NEW
-#define U_HAVE_PLACEMENT_NEW 1
-#endif
-
-/* Determine whether to enable tracing. */
-#ifndef U_ENABLE_TRACING
-#define U_ENABLE_TRACING 1
-#endif
-
-/**
- * Whether to enable Dynamic loading in ICU
- * @internal
- */
-#ifndef U_ENABLE_DYLOAD
-#define U_ENABLE_DYLOAD 1
-#endif
-
-/**
- * Whether to test Dynamic loading as an OS capabilty
- * @internal
- */
-#ifndef U_CHECK_DYLOAD
-#define U_CHECK_DYLOAD 1
-#endif
-
-
-/** Do we allow ICU users to use the draft APIs by default? */
-#ifndef U_DEFAULT_SHOW_DRAFT
-#define U_DEFAULT_SHOW_DRAFT 1
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Character data types                                                      */
-/*===========================================================================*/
-
-#if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400)
-#   define U_CHARSET_FAMILY 1
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Information about wchar support                                           */
-/*===========================================================================*/
-
-#ifndef U_HAVE_WCHAR_H
-#define U_HAVE_WCHAR_H      1
-#endif
-
-#ifndef U_SIZEOF_WCHAR_T
-#define U_SIZEOF_WCHAR_T    4
-#endif
-
-#ifndef U_HAVE_WCSCPY
-#define U_HAVE_WCSCPY       1
-#endif
-
-/** @} */
-
-/**
- * @{
- * \def U_DECLARE_UTF16
- * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
- * instead.
- * @internal
- *
- * \def U_GNUC_UTF16_STRING
- * @internal
- */
-#ifndef U_GNUC_UTF16_STRING
-#define U_GNUC_UTF16_STRING 0
-#endif
-#if 1 || defined(U_CHECK_UTF16_STRING)
-#if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
-    || (defined(__HP_aCC) && __HP_aCC >= 035000) \
-    || (defined(__HP_cc) && __HP_cc >= 111106) \
-    || U_GNUC_UTF16_STRING
-#define U_DECLARE_UTF16(string) u ## string
-#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
-/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
-/* Sun's C compiler has issues with this notation, and it's unreliable. */
-#define U_DECLARE_UTF16(string) U ## string
-#elif U_SIZEOF_WCHAR_T == 2 \
-    && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__)))
-#define U_DECLARE_UTF16(string) L ## string
-#endif
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Information about POSIX support                                           */
-/*===========================================================================*/
-
-#ifndef U_HAVE_NL_LANGINFO_CODESET
-#define U_HAVE_NL_LANGINFO_CODESET  1
-#endif
-
-#ifndef U_NL_LANGINFO_CODESET
-#define U_NL_LANGINFO_CODESET       CODESET
-#endif
-
-#if 1
-#define U_TZSET         tzset
-#endif
-#if 0
-#define U_TIMEZONE      timezone
-#endif
-#if 1
-#define U_TZNAME        tzname
-#endif
-
-#define U_HAVE_MMAP     1
-#define U_HAVE_POPEN    1
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Symbol import-export control                                              */
-/*===========================================================================*/
-
-#if 1
-#define U_EXPORT __attribute__((visibility("default")))
-#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
-   || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) 
-#define U_EXPORT __global
-/*#elif defined(__HP_aCC) || defined(__HP_cc)
-#define U_EXPORT __declspec(dllexport)*/
-#else
-#define U_EXPORT
-#endif
-
-/* U_CALLCONV is releated to U_EXPORT2 */
-#define U_EXPORT2
-
-/* cygwin needs to export/import data */
-#if defined(U_CYGWIN) && !defined(__GNUC__)
-#define U_IMPORT __declspec(dllimport)
-#else
-#define U_IMPORT 
-#endif
-
-/* @} */
-
-/*===========================================================================*/
-/** @{ Code alignment and C function inlining                                    */
-/*===========================================================================*/
-
-#ifndef U_INLINE
-#   ifdef __cplusplus
-#       define U_INLINE inline
-#   else
-#       define U_INLINE __inline__
-#   endif
-#endif
-
-#ifndef U_ALIGN_CODE
-#define U_ALIGN_CODE(n) 
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ GCC built in functions for atomic memory operations                       */
-/*===========================================================================*/
-
-/**
- * \def U_HAVE_GCC_ATOMICS
- * @internal
- */
-#ifndef U_HAVE_GCC_ATOMICS
-#define U_HAVE_GCC_ATOMICS 1
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Programs used by ICU code                                                 */
-/*===========================================================================*/
-
-/**
- * \def U_MAKE
- * What program to execute to run 'make'
- */
-#ifndef U_MAKE
-#define U_MAKE  "/usr/bin/gnumake"
-#endif
-
-/** @} */
-
-#endif /* CYGWINMSVC */
-
-/*===========================================================================*/
-/* Custom icu entry point renaming                                                  */
-/*===========================================================================*/
-
-/**
- * Define the library suffix with C syntax.
- * @internal
- */
-# define U_LIB_SUFFIX_C_NAME 
-/**
- * Define the library suffix as a string with C syntax
- * @internal
- */
-# define U_LIB_SUFFIX_C_NAME_STRING ""
-/**
- * 1 if a custom library suffix is set
- * @internal
- */
-# define U_HAVE_LIB_SUFFIX 0
-
-#if U_HAVE_LIB_SUFFIX
-# ifndef U_ICU_ENTRY_POINT_RENAME
-/* Renaming pattern:    u_strcpy_41_suffix */
-#  define U_ICU_ENTRY_POINT_RENAME(x)    x ## _ ## 46 ## 
-#  define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat
-
-# endif
-#endif
-
-#endif
diff --git a/Source/core/icu/unicode/ptypes.h b/Source/core/icu/unicode/ptypes.h
deleted file mode 100644
index 1f34d2f..0000000
--- a/Source/core/icu/unicode/ptypes.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-******************************************************************************
-*
-*   Copyright (C) 1997-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-******************************************************************************
-*
-*  FILE NAME : ptypes.h
-*
-*   Date        Name        Description
-*   05/13/98    nos         Creation (content moved here from ptypes.h).
-*   03/02/99    stephen     Added AS400 support.
-*   03/30/99    stephen     Added Linux support.
-*   04/13/99    stephen     Reworked for autoconf.
-*   09/18/08    srl         Moved basic types back to ptypes.h from platform.h
-******************************************************************************
-*/
-
-#ifndef _PTYPES_H
-#define _PTYPES_H
-
-#include <sys/types.h>
-
-#include "unicode/platform.h"
-
-/*===========================================================================*/
-/* Generic data types                                                        */
-/*===========================================================================*/
-
-/* If your platform does not have the <inttypes.h> header, you may
-   need to edit the typedefs below. */
-#if U_HAVE_INTTYPES_H
-
-/* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */
-/* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */
-/* doesn't have uint8_t depending on the OS version. */
-/* So we have this work around. */
-#ifdef OS390
-/* The features header is needed to get (u)int64_t sometimes. */
-#include <features.h>
-#if ! U_HAVE_INT8_T
-typedef signed char int8_t;
-#endif
-#if !defined(__uint8_t)
-#define __uint8_t 1
-typedef unsigned char uint8_t;
-#endif
-#endif /* OS390 */
-
-#include <inttypes.h>
-
-#else /* U_HAVE_INTTYPES_H */
-
-#if ! U_HAVE_INT8_T
-typedef signed char int8_t;
-#endif
-
-#if ! U_HAVE_UINT8_T
-typedef unsigned char uint8_t;
-#endif
-
-#if ! U_HAVE_INT16_T
-typedef signed short int16_t;
-#endif
-
-#if ! U_HAVE_UINT16_T
-typedef unsigned short uint16_t;
-#endif
-
-#if ! U_HAVE_INT32_T
-typedef signed int int32_t;
-#endif
-
-#if ! U_HAVE_UINT32_T
-typedef unsigned int uint32_t;
-#endif
-
-#if ! U_HAVE_INT64_T
-    typedef signed long long int64_t;
-/* else we may not have a 64-bit type */
-#endif
-
-#if ! U_HAVE_UINT64_T
-    typedef unsigned long long uint64_t;
-/* else we may not have a 64-bit type */
-#endif
-
-#endif /* U_HAVE_INTTYPES_H */
-
-#endif /* _PTYPES_H */
-
diff --git a/Source/core/icu/unicode/putil.h b/Source/core/icu/unicode/putil.h
deleted file mode 100644
index 71d5d26..0000000
--- a/Source/core/icu/unicode/putil.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
-******************************************************************************
-*
-*   Copyright (C) 1997-2009, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-******************************************************************************
-*
-*  FILE NAME : putil.h
-*
-*   Date        Name        Description
-*   05/14/98    nos         Creation (content moved here from utypes.h).
-*   06/17/99    erm         Added IEEE_754
-*   07/22/98    stephen     Added IEEEremainder, max, min, trunc
-*   08/13/98    stephen     Added isNegativeInfinity, isPositiveInfinity
-*   08/24/98    stephen     Added longBitsFromDouble
-*   03/02/99    stephen     Removed openFile().  Added AS400 support.
-*   04/15/99    stephen     Converted to C
-*   11/15/99    helena      Integrated S/390 changes for IEEE support.
-*   01/11/00    helena      Added u_getVersion.
-******************************************************************************
-*/
-
-#ifndef PUTIL_H
-#define PUTIL_H
-
-#include "unicode/utypes.h"
- /**
-  * \file
-  * \brief C API: Platform Utilities
-  */
-
-/** Define this to 1 if your platform supports IEEE 754 floating point,
-   to 0 if it does not. */
-#ifndef IEEE_754
-#   define IEEE_754 1
-#endif
-
-/*==========================================================================*/
-/* Platform utilities                                                       */
-/*==========================================================================*/
-
-/**
- * Platform utilities isolates the platform dependencies of the
- * libarary.  For each platform which this code is ported to, these
- * functions may have to be re-implemented.
- */
-
-/**
- * Return the ICU data directory. 
- * The data directory is where common format ICU data files (.dat files)
- *   are loaded from.  Note that normal use of the built-in ICU
- *   facilities does not require loading of an external data file;
- *   unless you are adding custom data to ICU, the data directory
- *   does not need to be set.
- *
- * The data directory is determined as follows:
- *    If u_setDataDirectory() has been called, that is it, otherwise
- *    if the ICU_DATA environment variable is set, use that, otherwise
- *    If a data directory was specifed at ICU build time
- *      <code>
- * \code
- *        #define ICU_DATA_DIR "path" 
- * \endcode
- * </code> use that,
- *    otherwise no data directory is available.
- *
- * @return the data directory, or an empty string ("") if no data directory has
- *         been specified.
- *   
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
-
-/** 
- * Set the ICU data directory. 
- * The data directory is where common format ICU data files (.dat files)
- *   are loaded from.  Note that normal use of the built-in ICU
- *   facilities does not require loading of an external data file;
- *   unless you are adding custom data to ICU, the data directory
- *   does not need to be set.
- *
- * This function should be called at most once in a process, before the
- * first ICU operation (e.g., u_init()) that will require the loading of an
- * ICU data file.
- * This function is not thread-safe. Use it before calling ICU APIs from
- * multiple threads.
- *
- * @param directory The directory to be set.
- *
- * @see u_init
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
-
-#if !U_CHARSET_IS_UTF8
-/**
- * Please use ucnv_getDefaultName() instead.
- * Return the default codepage for this platform and locale.
- * This function can call setlocale() on Unix platforms. Please read the
- * platform documentation on setlocale() before calling this function.
- * @return the default codepage for this platform 
- * @internal
- */
-U_INTERNAL const char*  U_EXPORT2 uprv_getDefaultCodepage(void);
-#endif
-
-/**
- * Please use uloc_getDefault() instead.
- * Return the default locale ID string by querying ths system, or
- *     zero if one cannot be found. 
- * This function can call setlocale() on Unix platforms. Please read the
- * platform documentation on setlocale() before calling this function.
- * @return the default locale ID string
- * @internal
- */
-U_INTERNAL const char*  U_EXPORT2 uprv_getDefaultLocaleID(void);
-
-/**
- * @{
- * Filesystem file and path separator characters.
- * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
- * @stable ICU 2.0
- */
-#ifdef XP_MAC
-#   define U_FILE_SEP_CHAR ':'
-#   define U_FILE_ALT_SEP_CHAR ':'
-#   define U_PATH_SEP_CHAR ';'
-#   define U_FILE_SEP_STRING ":"
-#   define U_FILE_ALT_SEP_STRING ":"
-#   define U_PATH_SEP_STRING ";"
-#elif defined(WIN32) || defined(OS2)
-#   define U_FILE_SEP_CHAR '\\'
-#   define U_FILE_ALT_SEP_CHAR '/'
-#   define U_PATH_SEP_CHAR ';'
-#   define U_FILE_SEP_STRING "\\"
-#   define U_FILE_ALT_SEP_STRING "/"
-#   define U_PATH_SEP_STRING ";"
-#else
-#   define U_FILE_SEP_CHAR '/'
-#   define U_FILE_ALT_SEP_CHAR '/'
-#   define U_PATH_SEP_CHAR ':'
-#   define U_FILE_SEP_STRING "/"
-#   define U_FILE_ALT_SEP_STRING "/"
-#   define U_PATH_SEP_STRING ":"
-#endif
-
-/** @} */
-
-/**
- * Convert char characters to UChar characters.
- * This utility function is useful only for "invariant characters"
- * that are encoded in the platform default encoding.
- * They are a small, constant subset of the encoding and include
- * just the latin letters, digits, and some punctuation.
- * For details, see U_CHARSET_FAMILY.
- *
- * @param cs Input string, points to <code>length</code>
- *           character bytes from a subset of the platform encoding.
- * @param us Output string, points to memory for <code>length</code>
- *           Unicode characters.
- * @param length The number of characters to convert; this may
- *               include the terminating <code>NUL</code>.
- *
- * @see U_CHARSET_FAMILY
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-u_charsToUChars(const char *cs, UChar *us, int32_t length);
-
-/**
- * Convert UChar characters to char characters.
- * This utility function is useful only for "invariant characters"
- * that can be encoded in the platform default encoding.
- * They are a small, constant subset of the encoding and include
- * just the latin letters, digits, and some punctuation.
- * For details, see U_CHARSET_FAMILY.
- *
- * @param us Input string, points to <code>length</code>
- *           Unicode characters that can be encoded with the
- *           codepage-invariant subset of the platform encoding.
- * @param cs Output string, points to memory for <code>length</code>
- *           character bytes.
- * @param length The number of characters to convert; this may
- *               include the terminating <code>NUL</code>.
- *
- * @see U_CHARSET_FAMILY
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-u_UCharsToChars(const UChar *us, char *cs, int32_t length);
-
-#endif
diff --git a/Source/core/icu/unicode/rep.h b/Source/core/icu/unicode/rep.h
deleted file mode 100644
index 3fab6fa..0000000
--- a/Source/core/icu/unicode/rep.h
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
-**************************************************************************
-* Copyright (C) 1999-2005, International Business Machines Corporation and
-* others. All Rights Reserved.
-**************************************************************************
-*   Date        Name        Description
-*   11/17/99    aliu        Creation.  Ported from java.  Modified to
-*                           match current UnicodeString API.  Forced
-*                           to use name "handleReplaceBetween" because
-*                           of existing methods in UnicodeString.
-**************************************************************************
-*/
-
-#ifndef REP_H
-#define REP_H
-
-#include "unicode/uobject.h"
-
-/**
- * \file 
- * \brief C++ API: Replaceable String
- */
- 
-U_NAMESPACE_BEGIN
-
-class UnicodeString;
-
-/**
- * <code>Replaceable</code> is an abstract base class representing a
- * string of characters that supports the replacement of a range of
- * itself with a new string of characters.  It is used by APIs that
- * change a piece of text while retaining metadata.  Metadata is data
- * other than the Unicode characters returned by char32At().  One
- * example of metadata is style attributes; another is an edit
- * history, marking each character with an author and revision number.
- *
- * <p>An implicit aspect of the <code>Replaceable</code> API is that
- * during a replace operation, new characters take on the metadata of
- * the old characters.  For example, if the string "the <b>bold</b>
- * font" has range (4, 8) replaced with "strong", then it becomes "the
- * <b>strong</b> font".
- *
- * <p><code>Replaceable</code> specifies ranges using a start
- * offset and a limit offset.  The range of characters thus specified
- * includes the characters at offset start..limit-1.  That is, the
- * start offset is inclusive, and the limit offset is exclusive.
- *
- * <p><code>Replaceable</code> also includes API to access characters
- * in the string: <code>length()</code>, <code>charAt()</code>,
- * <code>char32At()</code>, and <code>extractBetween()</code>.
- *
- * <p>For a subclass to support metadata, typical behavior of
- * <code>replace()</code> is the following:
- * <ul>
- *   <li>Set the metadata of the new text to the metadata of the first
- *   character replaced</li>
- *   <li>If no characters are replaced, use the metadata of the
- *   previous character</li>
- *   <li>If there is no previous character (i.e. start == 0), use the
- *   following character</li>
- *   <li>If there is no following character (i.e. the replaceable was
- *   empty), use default metadata.<br>
- *   <li>If the code point U+FFFF is seen, it should be interpreted as
- *   a special marker having no metadata<li>
- *   </li>
- * </ul>
- * If this is not the behavior, the subclass should document any differences.
- * @author Alan Liu
- * @stable ICU 2.0
- */
-class U_COMMON_API Replaceable : public UObject {
-
-public:
-    /**
-     * Destructor.
-     * @stable ICU 2.0
-     */
-    virtual ~Replaceable();
-
-    /**
-     * Returns the number of 16-bit code units in the text.
-     * @return number of 16-bit code units in text
-     * @stable ICU 1.8
-     */ 
-    inline int32_t length() const;
-
-    /**
-     * Returns the 16-bit code unit at the given offset into the text.
-     * @param offset an integer between 0 and <code>length()</code>-1
-     * inclusive
-     * @return 16-bit code unit of text at given offset
-     * @stable ICU 1.8
-     */
-    inline UChar charAt(int32_t offset) const;
-
-    /**
-     * Returns the 32-bit code point at the given 16-bit offset into
-     * the text.  This assumes the text is stored as 16-bit code units
-     * with surrogate pairs intermixed.  If the offset of a leading or
-     * trailing code unit of a surrogate pair is given, return the
-     * code point of the surrogate pair.
-     *
-     * @param offset an integer between 0 and <code>length()</code>-1
-     * inclusive
-     * @return 32-bit code point of text at given offset
-     * @stable ICU 1.8
-     */
-    inline UChar32 char32At(int32_t offset) const;
-
-    /**
-     * Copies characters in the range [<tt>start</tt>, <tt>limit</tt>) 
-     * into the UnicodeString <tt>target</tt>.
-     * @param start offset of first character which will be copied
-     * @param limit offset immediately following the last character to
-     * be copied
-     * @param target UnicodeString into which to copy characters.
-     * @return A reference to <TT>target</TT>
-     * @stable ICU 2.1
-     */
-    virtual void extractBetween(int32_t start,
-                                int32_t limit,
-                                UnicodeString& target) const = 0;
-
-    /**
-     * Replaces a substring of this object with the given text.  If the
-     * characters being replaced have metadata, the new characters
-     * that replace them should be given the same metadata.
-     *
-     * <p>Subclasses must ensure that if the text between start and
-     * limit is equal to the replacement text, that replace has no
-     * effect. That is, any metadata
-     * should be unaffected. In addition, subclasses are encouraged to
-     * check for initial and trailing identical characters, and make a
-     * smaller replacement if possible. This will preserve as much
-     * metadata as possible.
-     * @param start the beginning index, inclusive; <code>0 <= start
-     * <= limit</code>.
-     * @param limit the ending index, exclusive; <code>start <= limit
-     * <= length()</code>.
-     * @param text the text to replace characters <code>start</code>
-     * to <code>limit - 1</code> 
-     * @stable ICU 2.0
-     */
-    virtual void handleReplaceBetween(int32_t start,
-                                      int32_t limit,
-                                      const UnicodeString& text) = 0;
-    // Note: All other methods in this class take the names of
-    // existing UnicodeString methods.  This method is the exception.
-    // It is named differently because all replace methods of
-    // UnicodeString return a UnicodeString&.  The 'between' is
-    // required in order to conform to the UnicodeString naming
-    // convention; API taking start/length are named <operation>, and
-    // those taking start/limit are named <operationBetween>.  The
-    // 'handle' is added because 'replaceBetween' and
-    // 'doReplaceBetween' are already taken.
-
-    /**
-     * Copies a substring of this object, retaining metadata.
-     * This method is used to duplicate or reorder substrings.
-     * The destination index must not overlap the source range.
-     * 
-     * @param start the beginning index, inclusive; <code>0 <= start <=
-     * limit</code>.
-     * @param limit the ending index, exclusive; <code>start <= limit <=
-     * length()</code>.
-     * @param dest the destination index.  The characters from
-     * <code>start..limit-1</code> will be copied to <code>dest</code>.
-     * Implementations of this method may assume that <code>dest <= start ||
-     * dest >= limit</code>.
-     * @stable ICU 2.0
-     */
-    virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0;
-
-    /**
-     * Returns true if this object contains metadata.  If a
-     * Replaceable object has metadata, calls to the Replaceable API
-     * must be made so as to preserve metadata.  If it does not, calls
-     * to the Replaceable API may be optimized to improve performance.
-     * The default implementation returns true.
-     * @return true if this object contains metadata
-     * @stable ICU 2.2
-     */
-    virtual UBool hasMetaData() const;
-
-    /**
-     * Clone this object, an instance of a subclass of Replaceable.
-     * Clones can be used concurrently in multiple threads.
-     * If a subclass does not implement clone(), or if an error occurs,
-     * then NULL is returned.
-     * The clone functions in all subclasses return a pointer to a Replaceable
-     * because some compilers do not support covariant (same-as-this)
-     * return types; cast to the appropriate subclass if necessary.
-     * The caller must delete the clone.
-     *
-     * @return a clone of this object
-     *
-     * @see getDynamicClassID
-     * @stable ICU 2.6
-     */
-    virtual Replaceable *clone() const;
-
-protected:
-
-    /**
-     * Default constructor.
-     * @stable ICU 2.4
-     */
-    Replaceable();
-
-    /*
-     * Assignment operator not declared. The compiler will provide one
-     * which does nothing since this class does not contain any data members.
-     * API/code coverage may show the assignment operator as present and
-     * untested - ignore.
-     * Subclasses need this assignment operator if they use compiler-provided
-     * assignment operators of their own. An alternative to not declaring one
-     * here would be to declare and empty-implement a protected or public one.
-    Replaceable &Replaceable::operator=(const Replaceable &);
-     */
-
-    /**
-     * Virtual version of length().
-     * @stable ICU 2.4
-     */ 
-    virtual int32_t getLength() const = 0;
-
-    /**
-     * Virtual version of charAt().
-     * @stable ICU 2.4
-     */
-    virtual UChar getCharAt(int32_t offset) const = 0;
-
-    /**
-     * Virtual version of char32At().
-     * @stable ICU 2.4
-     */
-    virtual UChar32 getChar32At(int32_t offset) const = 0;
-};
-
-inline int32_t
-Replaceable::length() const {
-    return getLength();
-}
-
-inline UChar
-Replaceable::charAt(int32_t offset) const {
-    return getCharAt(offset);
-}
-
-inline UChar32
-Replaceable::char32At(int32_t offset) const {
-    return getChar32At(offset);
-}
-
-// There is no rep.cpp, see unistr.cpp for Replaceable function implementations.
-
-U_NAMESPACE_END
-
-#endif
diff --git a/Source/core/icu/unicode/std_string.h b/Source/core/icu/unicode/std_string.h
deleted file mode 100644
index dd43b74..0000000
--- a/Source/core/icu/unicode/std_string.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2009-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  std_string.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2009feb19
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __STD_STRING_H__
-#define __STD_STRING_H__
-
-/**
- * \file 
- * \brief C++ API: Central ICU header for including the C++ standard &lt;string&gt;
- *                 header and for related definitions.
- */
-
-#include "unicode/utypes.h"
-
-/**
- * \def U_HAVE_STD_STRING
- * Define whether the standard C++ (STL) &lt;string&gt; header is available.
- * @internal
- */
-#ifndef U_HAVE_STD_STRING
-#define U_HAVE_STD_STRING 1
-#endif
-
-#if U_HAVE_STD_STRING
-
-#include <string>
-
-/**
- * \def U_STD_NS
- * Define the namespace to use for standard C++ (STL) classes.
- * Either std or empty.
- * @draft ICU 4.2
- */
-
-/**
- * \def U_STD_NSQ
- * Define the namespace qualifier to use for standard C++ (STL) classes.
- * Either std:: or empty.
- * For example,
- *   U_STD_NSQ string StringFromUnicodeString(const UnicodeString &unistr);
- * @draft ICU 4.2
- */
-
-/**
- * \def U_STD_NS_USE
- * This is used to specify that the rest of the code uses the
- * standard (STL) namespace.
- * Either "using namespace std;" or empty.
- * @draft ICU 4.2
- */
-#ifndef U_STD_NSQ
-#   if U_HAVE_NAMESPACE
-#       define U_STD_NS std
-#       define U_STD_NSQ U_STD_NS::
-#       define U_STD_NS_USE using namespace U_STD_NS;
-#   else
-#       define U_STD_NS
-#       define U_STD_NSQ
-#       define U_STD_NS_USE
-#   endif
-#endif
-
-#endif  // U_HAVE_STD_STRING
-
-#endif  // __STD_STRING_H__
diff --git a/Source/core/icu/unicode/strenum.h b/Source/core/icu/unicode/strenum.h
deleted file mode 100644
index ce42195..0000000
--- a/Source/core/icu/unicode/strenum.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2002-2007, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*/
-
-#ifndef STRENUM_H
-#define STRENUM_H
-
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-
-/**
- * \file 
- * \brief C++ API: String Enumeration
- */
- 
-U_NAMESPACE_BEGIN
-
-/**
- * Base class for 'pure' C++ implementations of uenum api.  Adds a
- * method that returns the next UnicodeString since in C++ this can
- * be a common storage format for strings.
- *
- * <p>The model is that the enumeration is over strings maintained by
- * a 'service.'  At any point, the service might change, invalidating
- * the enumerator (though this is expected to be rare).  The iterator
- * returns an error if this has occurred.  Lack of the error is no
- * guarantee that the service didn't change immediately after the
- * call, so the returned string still might not be 'valid' on
- * subsequent use.</p>
- *
- * <p>Strings may take the form of const char*, const UChar*, or const
- * UnicodeString*.  The type you get is determine by the variant of
- * 'next' that you call.  In general the StringEnumeration is
- * optimized for one of these types, but all StringEnumerations can
- * return all types.  Returned strings are each terminated with a NUL.
- * Depending on the service data, they might also include embedded NUL
- * characters, so API is provided to optionally return the true
- * length, counting the embedded NULs but not counting the terminating
- * NUL.</p>
- *
- * <p>The pointers returned by next, unext, and snext become invalid
- * upon any subsequent call to the enumeration's destructor, next,
- * unext, snext, or reset.</p>
- *
- * ICU 2.8 adds some default implementations and helper functions
- * for subclasses.
- *
- * @stable ICU 2.4 
- */
-class U_COMMON_API StringEnumeration : public UObject { 
-public:
-    /**
-     * Destructor.
-     * @stable ICU 2.4
-     */
-    virtual ~StringEnumeration();
-
-    /**
-     * Clone this object, an instance of a subclass of StringEnumeration.
-     * Clones can be used concurrently in multiple threads.
-     * If a subclass does not implement clone(), or if an error occurs,
-     * then NULL is returned.
-     * The clone functions in all subclasses return a base class pointer
-     * because some compilers do not support covariant (same-as-this)
-     * return types; cast to the appropriate subclass if necessary.
-     * The caller must delete the clone.
-     *
-     * @return a clone of this object
-     *
-     * @see getDynamicClassID
-     * @stable ICU 2.8
-     */
-    virtual StringEnumeration *clone() const;
-
-    /**
-     * <p>Return the number of elements that the iterator traverses.  If
-     * the iterator is out of sync with its service, status is set to
-     * U_ENUM_OUT_OF_SYNC_ERROR, and the return value is zero.</p>
-     *
-     * <p>The return value will not change except possibly as a result of
-     * a subsequent call to reset, or if the iterator becomes out of sync.</p>
-     *
-     * <p>This is a convenience function. It can end up being very
-     * expensive as all the items might have to be pre-fetched
-     * (depending on the storage format of the data being
-     * traversed).</p>
-     *
-     * @param status the error code.
-     * @return number of elements in the iterator.
-     *
-     * @stable ICU 2.4 */
-    virtual int32_t count(UErrorCode& status) const = 0;
-
-    /**
-     * <p>Returns the next element as a NUL-terminated char*.  If there
-     * are no more elements, returns NULL.  If the resultLength pointer
-     * is not NULL, the length of the string (not counting the
-     * terminating NUL) is returned at that address.  If an error
-     * status is returned, the value at resultLength is undefined.</p>
-     *
-     * <p>The returned pointer is owned by this iterator and must not be
-     * deleted by the caller.  The pointer is valid until the next call
-     * to next, unext, snext, reset, or the enumerator's destructor.</p>
-     *
-     * <p>If the iterator is out of sync with its service, status is set
-     * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
-     *
-     * <p>If the native service string is a UChar* string, it is
-     * converted to char* with the invariant converter.  If the
-     * conversion fails (because a character cannot be converted) then
-     * status is set to U_INVARIANT_CONVERSION_ERROR and the return
-     * value is undefined (though not NULL).</p>
-     *
-     * Starting with ICU 2.8, the default implementation calls snext()
-     * and handles the conversion.
-     *
-     * @param status the error code.
-     * @param resultLength a pointer to receive the length, can be NULL.
-     * @return a pointer to the string, or NULL.
-     *
-     * @stable ICU 2.4 
-     */
-    virtual const char* next(int32_t *resultLength, UErrorCode& status);
-
-    /**
-     * <p>Returns the next element as a NUL-terminated UChar*.  If there
-     * are no more elements, returns NULL.  If the resultLength pointer
-     * is not NULL, the length of the string (not counting the
-     * terminating NUL) is returned at that address.  If an error
-     * status is returned, the value at resultLength is undefined.</p>
-     *
-     * <p>The returned pointer is owned by this iterator and must not be
-     * deleted by the caller.  The pointer is valid until the next call
-     * to next, unext, snext, reset, or the enumerator's destructor.</p>
-     *
-     * <p>If the iterator is out of sync with its service, status is set
-     * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
-     *
-     * Starting with ICU 2.8, the default implementation calls snext()
-     * and handles the conversion.
-     *
-     * @param status the error code.
-     * @param resultLength a ponter to receive the length, can be NULL.
-     * @return a pointer to the string, or NULL.
-     *
-     * @stable ICU 2.4 
-     */
-    virtual const UChar* unext(int32_t *resultLength, UErrorCode& status);
-
-    /**
-     * <p>Returns the next element a UnicodeString*.  If there are no
-     * more elements, returns NULL.</p>
-     *
-     * <p>The returned pointer is owned by this iterator and must not be
-     * deleted by the caller.  The pointer is valid until the next call
-     * to next, unext, snext, reset, or the enumerator's destructor.</p>
-     *
-     * <p>If the iterator is out of sync with its service, status is set
-     * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
-     *
-     * @param status the error code.
-     * @return a pointer to the string, or NULL.
-     *
-     * @stable ICU 2.4 
-     */
-    virtual const UnicodeString* snext(UErrorCode& status) = 0;
-
-    /**
-     * <p>Resets the iterator.  This re-establishes sync with the
-     * service and rewinds the iterator to start at the first
-     * element.</p>
-     *
-     * <p>Previous pointers returned by next, unext, or snext become
-     * invalid, and the value returned by count might change.</p>
-     *
-     * @param status the error code.
-     *
-     * @stable ICU 2.4 
-     */
-    virtual void reset(UErrorCode& status) = 0;
-
-    /**
-     * Compares this enumeration to other to check if both are equal
-     *
-     * @param that The other string enumeration to compare this object to
-     * @return TRUE if the enumerations are equal. FALSE if not.
-     * @stable ICU 3.6 
-     */
-    virtual UBool operator==(const StringEnumeration& that)const;
-    /**
-     * Compares this enumeration to other to check if both are not equal
-     *
-     * @param that The other string enumeration to compare this object to
-     * @return TRUE if the enumerations are equal. FALSE if not.
-     * @stable ICU 3.6 
-     */
-    virtual UBool operator!=(const StringEnumeration& that)const;
-
-protected:
-    /**
-     * UnicodeString field for use with default implementations and subclasses.
-     * @stable ICU 2.8
-     */
-    UnicodeString unistr;
-    /**
-     * char * default buffer for use with default implementations and subclasses.
-     * @stable ICU 2.8
-     */
-    char charsBuffer[32];
-    /**
-     * char * buffer for use with default implementations and subclasses.
-     * Allocated in constructor and in ensureCharsCapacity().
-     * @stable ICU 2.8
-     */
-    char *chars;
-    /**
-     * Capacity of chars, for use with default implementations and subclasses.
-     * @stable ICU 2.8
-     */
-    int32_t charsCapacity;
-
-    /**
-     * Default constructor for use with default implementations and subclasses.
-     * @stable ICU 2.8
-     */
-    StringEnumeration();
-
-    /**
-     * Ensures that chars is at least as large as the requested capacity.
-     * For use with default implementations and subclasses.
-     *
-     * @param capacity Requested capacity.
-     * @param status ICU in/out error code.
-     * @stable ICU 2.8
-     */
-    void ensureCharsCapacity(int32_t capacity, UErrorCode &status);
-
-    /**
-     * Converts s to Unicode and sets unistr to the result.
-     * For use with default implementations and subclasses,
-     * especially for implementations of snext() in terms of next().
-     * This is provided with a helper function instead of a default implementation
-     * of snext() to avoid potential infinite loops between next() and snext().
-     *
-     * For example:
-     * \code
-     * const UnicodeString* snext(UErrorCode& status) {
-     *   int32_t resultLength=0;
-     *   const char *s=next(&resultLength, status);
-     *   return setChars(s, resultLength, status);
-     * }
-     * \endcode
-     *
-     * @param s String to be converted to Unicode.
-     * @param length Length of the string.
-     * @param status ICU in/out error code.
-     * @return A pointer to unistr.
-     * @stable ICU 2.8
-     */
-    UnicodeString *setChars(const char *s, int32_t length, UErrorCode &status);
-};
-
-U_NAMESPACE_END
-
-/* STRENUM_H */
-#endif
diff --git a/Source/core/icu/unicode/stringpiece.h b/Source/core/icu/unicode/stringpiece.h
deleted file mode 100644
index 79d5a05..0000000
--- a/Source/core/icu/unicode/stringpiece.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright (C) 2010, International Business Machines
-// Corporation and others. All Rights Reserved.
-//
-// Copyright 2001 and onwards Google Inc.
-// Author: Sanjay Ghemawat
-
-// This code is a contribution of Google code, and the style used here is
-// a compromise between the original Google code and the ICU coding guidelines.
-// For example, data types are ICU-ified (size_t,int->int32_t),
-// and API comments doxygen-ified, but function names and behavior are
-// as in the original, if possible.
-// Assertion-style error handling, not available in ICU, was changed to
-// parameter "pinning" similar to UnicodeString.
-//
-// In addition, this is only a partial port of the original Google code,
-// limited to what was needed so far. The (nearly) complete original code
-// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib
-// (see ICU ticket 6765, r25517).
-
-#ifndef __STRINGPIECE_H__
-#define __STRINGPIECE_H__
-
-/**
- * \file 
- * \brief C++ API: StringPiece: Read-only byte string wrapper class.
- */
-
-#include "unicode/utypes.h"
-#include "unicode/uobject.h"
-#include "unicode/std_string.h"
-
-// Arghh!  I wish C++ literals were "string".
-
-U_NAMESPACE_BEGIN
-
-/**
- * A string-like object that points to a sized piece of memory.
- *
- * We provide non-explicit singleton constructors so users can pass
- * in a "const char*" or a "string" wherever a "StringPiece" is
- * expected.
- *
- * Functions or methods may use const StringPiece& parameters to accept either
- * a "const char*" or a "string" value that will be implicitly converted to
- * a StringPiece.
- *
- * Systematic usage of StringPiece is encouraged as it will reduce unnecessary
- * conversions from "const char*" to "string" and back again.
- *
- * @stable ICU 4.2
- */
-class U_COMMON_API StringPiece : public UMemory {
- private:
-  const char*   ptr_;
-  int32_t       length_;
-
- public:
-  /**
-   * Default constructor, creates an empty StringPiece.
-   * @stable ICU 4.2
-   */
-  StringPiece() : ptr_(NULL), length_(0) { }
-  /**
-   * Constructs from a NUL-terminated const char * pointer.
-   * @param str a NUL-terminated const char * pointer
-   * @stable ICU 4.2
-   */
-  StringPiece(const char* str);
-#if U_HAVE_STD_STRING
-  /**
-   * Constructs from a std::string.
-   * @stable ICU 4.2
-   */
-  StringPiece(const U_STD_NSQ string& str)
-    : ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
-#endif
-  /**
-   * Constructs from a const char * pointer and a specified length.
-   * @param offset a const char * pointer (need not be terminated)
-   * @param len the length of the string; must be non-negative
-   * @stable ICU 4.2
-   */
-  StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { }
-  /**
-   * Substring of another StringPiece.
-   * @param x the other StringPiece
-   * @param pos start position in x; must be non-negative and <= x.length().
-   * @stable ICU 4.2
-   */
-  StringPiece(const StringPiece& x, int32_t pos);
-  /**
-   * Substring of another StringPiece.
-   * @param x the other StringPiece
-   * @param pos start position in x; must be non-negative and <= x.length().
-   * @param len length of the substring;
-   *            must be non-negative and will be pinned to at most x.length() - pos.
-   * @stable ICU 4.2
-   */
-  StringPiece(const StringPiece& x, int32_t pos, int32_t len);
-
-  /**
-   * Returns the string pointer. May be NULL if it is empty.
-   *
-   * data() may return a pointer to a buffer with embedded NULs, and the
-   * returned buffer may or may not be null terminated.  Therefore it is
-   * typically a mistake to pass data() to a routine that expects a NUL
-   * terminated string.
-   * @return the string pointer
-   * @stable ICU 4.2
-   */
-  const char* data() const { return ptr_; }
-  /**
-   * Returns the string length. Same as length().
-   * @return the string length
-   * @stable ICU 4.2
-   */
-  int32_t size() const { return length_; }
-  /**
-   * Returns the string length. Same as size().
-   * @return the string length
-   * @stable ICU 4.2
-   */
-  int32_t length() const { return length_; }
-  /**
-   * Returns whether the string is empty.
-   * @return TRUE if the string is empty
-   * @stable ICU 4.2
-   */
-  UBool empty() const { return length_ == 0; }
-
-  /**
-   * Sets to an empty string.
-   * @stable ICU 4.2
-   */
-  void clear() { ptr_ = NULL; length_ = 0; }
-
-  /**
-   * Reset the stringpiece to refer to new data.
-   * @param data pointer the new string data.  Need not be nul terminated.
-   * @param len the length of the new data
-   * @internal
-   */
-  void set(const char* data, int32_t len) { ptr_ = data; length_ = len; }
-
-  /**
-   * Reset the stringpiece to refer to new data.
-   * @param str a pointer to a NUL-terminated string. 
-   * @internal
-   */
-  void set(const char* str);
-
-  /**
-   * Removes the first n string units.
-   * @param n prefix length, must be non-negative and <=length()
-   * @stable ICU 4.2
-   */
-  void remove_prefix(int32_t n) {
-    if (n >= 0) {
-      if (n > length_) {
-        n = length_;
-      }
-      ptr_ += n;
-      length_ -= n;
-    }
-  }
-
-  /**
-   * Removes the last n string units.
-   * @param n suffix length, must be non-negative and <=length()
-   * @stable ICU 4.2
-   */
-  void remove_suffix(int32_t n) {
-    if (n >= 0) {
-      if (n <= length_) {
-        length_ -= n;
-      } else {
-        length_ = 0;
-      }
-    }
-  }
-
-  /**
-   * Maximum integer, used as a default value for substring methods.
-   * @stable ICU 4.2
-   */
-  static const int32_t npos = 0x7fffffff;
-
-  /**
-   * Returns a substring of this StringPiece.
-   * @param pos start position; must be non-negative and <= length().
-   * @param len length of the substring;
-   *            must be non-negative and will be pinned to at most length() - pos.
-   * @return the substring StringPiece
-   * @stable ICU 4.2
-   */
-  StringPiece substr(int32_t pos, int32_t len = npos) const {
-    return StringPiece(*this, pos, len);
-  }
-};
-
-/**
- * Global operator == for StringPiece
- * @param x The first StringPiece to compare.
- * @param y The second StringPiece to compare.
- * @return TRUE if the string data is equal
- * @internal
- */
-U_EXPORT UBool U_EXPORT2 
-operator==(const StringPiece& x, const StringPiece& y);
-
-/**
- * Global operator != for StringPiece
- * @param x The first StringPiece to compare.
- * @param y The second StringPiece to compare.
- * @return TRUE if the string data is not equal
- * @internal
- */
-inline UBool operator!=(const StringPiece& x, const StringPiece& y) {
-  return !(x == y);
-}
-
-U_NAMESPACE_END
-
-#endif  // __STRINGPIECE_H__
diff --git a/Source/core/icu/unicode/ubrk.h b/Source/core/icu/unicode/ubrk.h
deleted file mode 100644
index f8304a6..0000000
--- a/Source/core/icu/unicode/ubrk.h
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
-******************************************************************************
-* Copyright (C) 1996-2010, International Business Machines Corporation and others.
-* All Rights Reserved.
-******************************************************************************
-*/
-
-#ifndef UBRK_H
-#define UBRK_H
-
-#include "unicode/utypes.h"
-#include "unicode/uloc.h"
-#include "unicode/utext.h"
-#include "unicode/localpointer.h"
-
-/**
- * A text-break iterator.
- *  For usage in C programs.
- */
-#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
-#   define UBRK_TYPEDEF_UBREAK_ITERATOR
-    /**
-     *  Opaque type representing an ICU Break iterator object.
-     *  @stable ICU 2.0
-     */
-    typedef struct UBreakIterator UBreakIterator;
-#endif
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-#include "unicode/parseerr.h"
-
-/**
- * \file
- * \brief C API: BreakIterator
- *
- * <h2> BreakIterator C API </h2>
- *
- * The BreakIterator C API defines  methods for finding the location
- * of boundaries in text. Pointer to a UBreakIterator maintain a
- * current position and scan over text returning the index of characters
- * where boundaries occur.
- * <p>
- * Line boundary analysis determines where a text string can be broken
- * when line-wrapping. The mechanism correctly handles punctuation and
- * hyphenated words.
- * <p>
- * Sentence boundary analysis allows selection with correct
- * interpretation of periods within numbers and abbreviations, and
- * trailing punctuation marks such as quotation marks and parentheses.
- * <p>
- * Word boundary analysis is used by search and replace functions, as
- * well as within text editing applications that allow the user to
- * select words with a double click. Word selection provides correct
- * interpretation of punctuation marks within and following
- * words. Characters that are not part of a word, such as symbols or
- * punctuation marks, have word-breaks on both sides.
- * <p>
- * Character boundary analysis identifies the boundaries of
- * "Extended Grapheme Clusters", which are groupings of codepoints
- * that should be treated as character-like units for many text operations.
- * Please see Unicode Standard Annex #29, Unicode Text Segmentation,
- * http://www.unicode.org/reports/tr29/ for additional information 
- * on grapheme clusters and guidelines on their use.
- * <p>
- * Title boundary analysis locates all positions,
- * typically starts of words, that should be set to Title Case
- * when title casing the text.
- * <p>
- * The text boundary positions are found according to the rules
- * described in Unicode Standard Annex #29, Text Boundaries, and
- * Unicode Standard Annex #14, Line Breaking Properties.  These
- * are available at http://www.unicode.org/reports/tr14/ and
- * http://www.unicode.org/reports/tr29/.
- * <p>
- * In addition to the plain C API defined in this header file, an
- * object oriented C++ API with equivalent functionality is defined in the
- * file brkiter.h.
- * <p>
- * Code snippets illustrating the use of the Break Iterator APIs
- * are available in the ICU User Guide,
- * http://icu-project.org/userguide/boundaryAnalysis.html
- * and in the sample program icu/source/samples/break/break.cpp
- */
-
-/** The possible types of text boundaries.  @stable ICU 2.0 */
-typedef enum UBreakIteratorType {
-  /** Character breaks  @stable ICU 2.0 */
-  UBRK_CHARACTER = 0,
-  /** Word breaks @stable ICU 2.0 */
-  UBRK_WORD = 1,
-  /** Line breaks @stable ICU 2.0 */
-  UBRK_LINE = 2,
-  /** Sentence breaks @stable ICU 2.0 */
-  UBRK_SENTENCE = 3,
-
-#ifndef U_HIDE_DEPRECATED_API
-  /**
-   * Title Case breaks
-   * The iterator created using this type locates title boundaries as described for
-   * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,
-   * please use Word Boundary iterator.
-   *
-   * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later.
-   */
-  UBRK_TITLE = 4,
-#endif /* U_HIDE_DEPRECATED_API */
-  UBRK_COUNT = 5
-} UBreakIteratorType;
-
-/** Value indicating all text boundaries have been returned.
- *  @stable ICU 2.0
- */
-#define UBRK_DONE ((int32_t) -1)
-
-
-/**
- *  Enum constants for the word break tags returned by
- *  getRuleStatus().  A range of values is defined for each category of
- *  word, to allow for further subdivisions of a category in future releases.
- *  Applications should check for tag values falling within the range, rather
- *  than for single individual values.
- *  @stable ICU 2.2
-*/
-typedef enum UWordBreak {
-    /** Tag value for "words" that do not fit into any of other categories.
-     *  Includes spaces and most punctuation. */
-    UBRK_WORD_NONE           = 0,
-    /** Upper bound for tags for uncategorized words. */
-    UBRK_WORD_NONE_LIMIT     = 100,
-    /** Tag value for words that appear to be numbers, lower limit.    */
-    UBRK_WORD_NUMBER         = 100,
-    /** Tag value for words that appear to be numbers, upper limit.    */
-    UBRK_WORD_NUMBER_LIMIT   = 200,
-    /** Tag value for words that contain letters, excluding
-     *  hiragana, katakana or ideographic characters, lower limit.    */
-    UBRK_WORD_LETTER         = 200,
-    /** Tag value for words containing letters, upper limit  */
-    UBRK_WORD_LETTER_LIMIT   = 300,
-    /** Tag value for words containing kana characters, lower limit */
-    UBRK_WORD_KANA           = 300,
-    /** Tag value for words containing kana characters, upper limit */
-    UBRK_WORD_KANA_LIMIT     = 400,
-    /** Tag value for words containing ideographic characters, lower limit */
-    UBRK_WORD_IDEO           = 400,
-    /** Tag value for words containing ideographic characters, upper limit */
-    UBRK_WORD_IDEO_LIMIT     = 500
-} UWordBreak;
-
-/**
- *  Enum constants for the line break tags returned by getRuleStatus().
- *  A range of values is defined for each category of
- *  word, to allow for further subdivisions of a category in future releases.
- *  Applications should check for tag values falling within the range, rather
- *  than for single individual values.
- *  @stable ICU 2.8
-*/
-typedef enum ULineBreakTag {
-    /** Tag value for soft line breaks, positions at which a line break
-      *  is acceptable but not required                */
-    UBRK_LINE_SOFT            = 0,
-    /** Upper bound for soft line breaks.              */
-    UBRK_LINE_SOFT_LIMIT      = 100,
-    /** Tag value for a hard, or mandatory line break  */
-    UBRK_LINE_HARD            = 100,
-    /** Upper bound for hard line breaks.              */
-    UBRK_LINE_HARD_LIMIT      = 200
-} ULineBreakTag;
-
-
-
-/**
- *  Enum constants for the sentence break tags returned by getRuleStatus().
- *  A range of values is defined for each category of
- *  sentence, to allow for further subdivisions of a category in future releases.
- *  Applications should check for tag values falling within the range, rather
- *  than for single individual values.
- *  @stable ICU 2.8
-*/
-typedef enum USentenceBreakTag {
-    /** Tag value for for sentences  ending with a sentence terminator
-      * ('.', '?', '!', etc.) character, possibly followed by a
-      * hard separator (CR, LF, PS, etc.)
-      */
-    UBRK_SENTENCE_TERM       = 0,
-    /** Upper bound for tags for sentences ended by sentence terminators.    */
-    UBRK_SENTENCE_TERM_LIMIT = 100,
-    /** Tag value for for sentences that do not contain an ending
-      * sentence terminator ('.', '?', '!', etc.) character, but
-      * are ended only by a hard separator (CR, LF, PS, etc.) or end of input.
-      */
-    UBRK_SENTENCE_SEP        = 100,
-    /** Upper bound for tags for sentences ended by a separator.              */
-    UBRK_SENTENCE_SEP_LIMIT  = 200
-    /** Tag value for a hard, or mandatory line break  */
-} USentenceBreakTag;
-
-
-/**
- * Open a new UBreakIterator for locating text boundaries for a specified locale.
- * A UBreakIterator may be used for detecting character, line, word,
- * and sentence breaks in text.
- * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD,
- * UBRK_LINE, UBRK_SENTENCE
- * @param locale The locale specifying the text-breaking conventions.
- * @param text The text to be iterated over.
- * @param textLength The number of characters in text, or -1 if null-terminated.
- * @param status A UErrorCode to receive any errors.
- * @return A UBreakIterator for the specified locale.
- * @see ubrk_openRules
- * @stable ICU 2.0
- */
-U_STABLE UBreakIterator* U_EXPORT2
-ubrk_open(UBreakIteratorType type,
-      const char *locale,
-      const UChar *text,
-      int32_t textLength,
-      UErrorCode *status);
-
-/**
- * Open a new UBreakIterator for locating text boundaries using specified breaking rules.
- * The rule syntax is ... (TBD)
- * @param rules A set of rules specifying the text breaking conventions.
- * @param rulesLength The number of characters in rules, or -1 if null-terminated.
- * @param text The text to be iterated over.  May be null, in which case ubrk_setText() is
- *        used to specify the text to be iterated.
- * @param textLength The number of characters in text, or -1 if null-terminated.
- * @param parseErr   Receives position and context information for any syntax errors
- *                   detected while parsing the rules.
- * @param status A UErrorCode to receive any errors.
- * @return A UBreakIterator for the specified rules.
- * @see ubrk_open
- * @stable ICU 2.2
- */
-U_STABLE UBreakIterator* U_EXPORT2
-ubrk_openRules(const UChar     *rules,
-               int32_t         rulesLength,
-               const UChar     *text,
-               int32_t          textLength,
-               UParseError     *parseErr,
-               UErrorCode      *status);
-
-/**
- * Thread safe cloning operation
- * @param bi iterator to be cloned
- * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated.
- *  If buffer is not large enough, new memory will be allocated.
- *  Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations.
- * @param pBufferSize pointer to size of allocated space.
- *  If *pBufferSize == 0, a sufficient size for use in cloning will
- *  be returned ('pre-flighting')
- *  If *pBufferSize is not enough for a stack-based safe clone,
- *  new memory will be allocated.
- * @param status to indicate whether the operation went on smoothly or there were errors
- *  An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary.
- * @return pointer to the new clone
- * @stable ICU 2.0
- */
-U_STABLE UBreakIterator * U_EXPORT2
-ubrk_safeClone(
-          const UBreakIterator *bi,
-          void *stackBuffer,
-          int32_t *pBufferSize,
-          UErrorCode *status);
-
-/**
-  * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone().
-  * @stable ICU 2.0
-  */
-#define U_BRK_SAFECLONE_BUFFERSIZE 512
-
-/**
-* Close a UBreakIterator.
-* Once closed, a UBreakIterator may no longer be used.
-* @param bi The break iterator to close.
- * @stable ICU 2.0
-*/
-U_STABLE void U_EXPORT2
-ubrk_close(UBreakIterator *bi);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUBreakIteratorPointer
- * "Smart pointer" class, closes a UBreakIterator via ubrk_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Sets an existing iterator to point to a new piece of text
- * @param bi The iterator to use
- * @param text The text to be set
- * @param textLength The length of the text
- * @param status The error code
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ubrk_setText(UBreakIterator* bi,
-             const UChar*    text,
-             int32_t         textLength,
-             UErrorCode*     status);
-
-
-/**
- * Sets an existing iterator to point to a new piece of text
- * @param bi The iterator to use
- * @param text The text to be set.
- *             This function makes a shallow clone of the supplied UText.  This means
- *             that the caller is free to immediately close or otherwise reuse the
- *             UText that was passed as a parameter, but that the underlying text itself
- *             must not be altered while being referenced by the break iterator.
- * @param status The error code
- * @stable ICU 3.4
- */
-U_STABLE void U_EXPORT2
-ubrk_setUText(UBreakIterator* bi,
-             UText*          text,
-             UErrorCode*     status);
-
-
-
-/**
- * Determine the most recently-returned text boundary.
- *
- * @param bi The break iterator to use.
- * @return The character index most recently returned by \ref ubrk_next, \ref ubrk_previous,
- * \ref ubrk_first, or \ref ubrk_last.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_current(const UBreakIterator *bi);
-
-/**
- * Determine the text boundary following the current text boundary.
- *
- * @param bi The break iterator to use.
- * @return The character index of the next text boundary, or UBRK_DONE
- * if all text boundaries have been returned.
- * @see ubrk_previous
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_next(UBreakIterator *bi);
-
-/**
- * Determine the text boundary preceding the current text boundary.
- *
- * @param bi The break iterator to use.
- * @return The character index of the preceding text boundary, or UBRK_DONE
- * if all text boundaries have been returned.
- * @see ubrk_next
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_previous(UBreakIterator *bi);
-
-/**
- * Determine the index of the first character in the text being scanned.
- * This is not always the same as index 0 of the text.
- * @param bi The break iterator to use.
- * @return The character index of the first character in the text being scanned.
- * @see ubrk_last
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_first(UBreakIterator *bi);
-
-/**
- * Determine the index immediately <EM>beyond</EM> the last character in the text being
- * scanned.
- * This is not the same as the last character.
- * @param bi The break iterator to use.
- * @return The character offset immediately <EM>beyond</EM> the last character in the
- * text being scanned.
- * @see ubrk_first
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_last(UBreakIterator *bi);
-
-/**
- * Determine the text boundary preceding the specified offset.
- * The value returned is always smaller than offset, or UBRK_DONE.
- * @param bi The break iterator to use.
- * @param offset The offset to begin scanning.
- * @return The text boundary preceding offset, or UBRK_DONE.
- * @see ubrk_following
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_preceding(UBreakIterator *bi,
-           int32_t offset);
-
-/**
- * Determine the text boundary following the specified offset.
- * The value returned is always greater than offset, or UBRK_DONE.
- * @param bi The break iterator to use.
- * @param offset The offset to begin scanning.
- * @return The text boundary following offset, or UBRK_DONE.
- * @see ubrk_preceding
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_following(UBreakIterator *bi,
-           int32_t offset);
-
-/**
-* Get a locale for which text breaking information is available.
-* A UBreakIterator in a locale returned by this function will perform the correct
-* text breaking for the locale.
-* @param index The index of the desired locale.
-* @return A locale for which number text breaking information is available, or 0 if none.
-* @see ubrk_countAvailable
-* @stable ICU 2.0
-*/
-U_STABLE const char* U_EXPORT2
-ubrk_getAvailable(int32_t index);
-
-/**
-* Determine how many locales have text breaking information available.
-* This function is most useful as determining the loop ending condition for
-* calls to \ref ubrk_getAvailable.
-* @return The number of locales for which text breaking information is available.
-* @see ubrk_getAvailable
-* @stable ICU 2.0
-*/
-U_STABLE int32_t U_EXPORT2
-ubrk_countAvailable(void);
-
-
-/**
-* Returns true if the specfied position is a boundary position.  As a side
-* effect, leaves the iterator pointing to the first boundary position at
-* or after "offset".
-* @param bi The break iterator to use.
-* @param offset the offset to check.
-* @return True if "offset" is a boundary position.
-* @stable ICU 2.0
-*/
-U_STABLE  UBool U_EXPORT2
-ubrk_isBoundary(UBreakIterator *bi, int32_t offset);
-
-/**
- * Return the status from the break rule that determined the most recently
- * returned break position.  The values appear in the rule source
- * within brackets, {123}, for example.  For rules that do not specify a
- * status, a default value of 0 is returned.
- * <p>
- * For word break iterators, the possible values are defined in enum UWordBreak.
- * @stable ICU 2.2
- */
-U_STABLE  int32_t U_EXPORT2
-ubrk_getRuleStatus(UBreakIterator *bi);
-
-/**
- * Get the statuses from the break rules that determined the most recently
- * returned break position.  The values appear in the rule source
- * within brackets, {123}, for example.  The default status value for rules
- * that do not explicitly provide one is zero.
- * <p>
- * For word break iterators, the possible values are defined in enum UWordBreak.
- * @param bi        The break iterator to use
- * @param fillInVec an array to be filled in with the status values.
- * @param capacity  the length of the supplied vector.  A length of zero causes
- *                  the function to return the number of status values, in the
- *                  normal way, without attemtping to store any values.
- * @param status    receives error codes.
- * @return          The number of rule status values from rules that determined
- *                  the most recent boundary returned by the break iterator.
- * @stable ICU 3.0
- */
-U_STABLE  int32_t U_EXPORT2
-ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status);
-
-/**
- * Return the locale of the break iterator. You can choose between the valid and
- * the actual locale.
- * @param bi break iterator
- * @param type locale type (valid or actual)
- * @param status error code
- * @return locale string
- * @stable ICU 2.8
- */
-U_STABLE const char* U_EXPORT2
-ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status);
-
-
-#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-
-#endif
diff --git a/Source/core/icu/unicode/uchar.h b/Source/core/icu/unicode/uchar.h
deleted file mode 100644
index 93aa663..0000000
--- a/Source/core/icu/unicode/uchar.h
+++ /dev/null
@@ -1,3168 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1997-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*
-* File UCHAR.H
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   04/02/97    aliu        Creation.
-*   03/29/99    helena      Updated for C APIs.
-*   4/15/99     Madhu       Updated for C Implementation and Javadoc
-*   5/20/99     Madhu       Added the function u_getVersion()
-*   8/19/1999   srl         Upgraded scripts to Unicode 3.0
-*   8/27/1999   schererm    UCharDirection constants: U_...
-*   11/11/1999  weiv        added u_isalnum(), cleaned comments
-*   01/11/2000  helena      Renamed u_getVersion to u_getUnicodeVersion().
-******************************************************************************
-*/
-
-#ifndef UCHAR_H
-#define UCHAR_H
-
-#include "unicode/utypes.h"
-
-U_CDECL_BEGIN
-
-/*==========================================================================*/
-/* Unicode version number                                                   */
-/*==========================================================================*/
-/**
- * Unicode version number, default for the current ICU version.
- * The actual Unicode Character Database (UCD) data is stored in uprops.dat
- * and may be generated from UCD files from a different Unicode version.
- * Call u_getUnicodeVersion to get the actual Unicode version of the data.
- *
- * @see u_getUnicodeVersion
- * @stable ICU 2.0
- */
-#define U_UNICODE_VERSION "6.0"
-
-/**
- * \file
- * \brief C API: Unicode Properties
- *
- * This C API provides low-level access to the Unicode Character Database.
- * In addition to raw property values, some convenience functions calculate
- * derived properties, for example for Java-style programming.
- *
- * Unicode assigns each code point (not just assigned character) values for
- * many properties.
- * Most of them are simple boolean flags, or constants from a small enumerated list.
- * For some properties, values are strings or other relatively more complex types.
- *
- * For more information see
- * "About the Unicode Character Database" (http://www.unicode.org/ucd/)
- * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html).
- *
- * Many functions are designed to match java.lang.Character functions.
- * See the individual function documentation,
- * and see the JDK 1.4 java.lang.Character documentation
- * at http://java.sun.com/j2se/1.4/docs/api/java/lang/Character.html
- *
- * There are also functions that provide easy migration from C/POSIX functions
- * like isblank(). Their use is generally discouraged because the C/POSIX
- * standards do not define their semantics beyond the ASCII range, which means
- * that different implementations exhibit very different behavior.
- * Instead, Unicode properties should be used directly.
- *
- * There are also only a few, broad C/POSIX character classes, and they tend
- * to be used for conflicting purposes. For example, the "isalpha()" class
- * is sometimes used to determine word boundaries, while a more sophisticated
- * approach would at least distinguish initial letters from continuation
- * characters (the latter including combining marks).
- * (In ICU, BreakIterator is the most sophisticated API for word boundaries.)
- * Another example: There is no "istitle()" class for titlecase characters.
- *
- * ICU 3.4 and later provides API access for all twelve C/POSIX character classes.
- * ICU implements them according to the Standard Recommendations in
- * Annex C: Compatibility Properties of UTS #18 Unicode Regular Expressions
- * (http://www.unicode.org/reports/tr18/#Compatibility_Properties).
- *
- * API access for C/POSIX character classes is as follows:
- * - alpha:     u_isUAlphabetic(c) or u_hasBinaryProperty(c, UCHAR_ALPHABETIC)
- * - lower:     u_isULowercase(c) or u_hasBinaryProperty(c, UCHAR_LOWERCASE)
- * - upper:     u_isUUppercase(c) or u_hasBinaryProperty(c, UCHAR_UPPERCASE)
- * - punct:     u_ispunct(c)
- * - digit:     u_isdigit(c) or u_charType(c)==U_DECIMAL_DIGIT_NUMBER
- * - xdigit:    u_isxdigit(c) or u_hasBinaryProperty(c, UCHAR_POSIX_XDIGIT)
- * - alnum:     u_hasBinaryProperty(c, UCHAR_POSIX_ALNUM)
- * - space:     u_isUWhiteSpace(c) or u_hasBinaryProperty(c, UCHAR_WHITE_SPACE)
- * - blank:     u_isblank(c) or u_hasBinaryProperty(c, UCHAR_POSIX_BLANK)
- * - cntrl:     u_charType(c)==U_CONTROL_CHAR
- * - graph:     u_hasBinaryProperty(c, UCHAR_POSIX_GRAPH)
- * - print:     u_hasBinaryProperty(c, UCHAR_POSIX_PRINT)
- *
- * Note: Some of the u_isxyz() functions in uchar.h predate, and do not match,
- * the Standard Recommendations in UTS #18. Instead, they match Java
- * functions according to their API documentation.
- *
- * \htmlonly
- * The C/POSIX character classes are also available in UnicodeSet patterns,
- * using patterns like [:graph:] or \p{graph}.
- * \endhtmlonly
- *
- * Note: There are several ICU whitespace functions.
- * Comparison:
- * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property;
- *       most of general categories "Z" (separators) + most whitespace ISO controls
- *       (including no-break spaces, but excluding IS1..IS4 and ZWSP)
- * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces
- * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces)
- * - u_isspace: Z + whitespace ISO controls (including no-break spaces)
- * - u_isblank: "horizontal spaces" = TAB + Zs - ZWSP
- */
-
-/**
- * Constants.
- */
-
-/** The lowest Unicode code point value. Code points are non-negative. @stable ICU 2.0 */
-#define UCHAR_MIN_VALUE 0
-
-/**
- * The highest Unicode code point value (scalar value) according to
- * The Unicode Standard. This is a 21-bit value (20.1 bits, rounded up).
- * For a single character, UChar32 is a simple type that can hold any code point value.
- *
- * @see UChar32
- * @stable ICU 2.0
- */
-#define UCHAR_MAX_VALUE 0x10ffff
-
-/**
- * Get a single-bit bit set (a flag) from a bit number 0..31.
- * @stable ICU 2.1
- */
-#define U_MASK(x) ((uint32_t)1<<(x))
-
-/*
- * !! Note: Several comments in this file are machine-read by the
- * genpname tool.  These comments describe the correspondence between
- * icu enum constants and UCD entities.  Do not delete them.  Update
- * these comments as needed.
- *
- * Any comment of the form "/ *[name]* /" (spaces added) is such
- * a comment.
- *
- * The U_JG_* and U_GC_*_MASK constants are matched by their symbolic
- * name, which must match PropertyValueAliases.txt.
- */
-
-/**
- * Selection constants for Unicode properties.
- * These constants are used in functions like u_hasBinaryProperty to select
- * one of the Unicode properties.
- *
- * The properties APIs are intended to reflect Unicode properties as defined
- * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
- * For details about the properties see http://www.unicode.org/ucd/ .
- * For names of Unicode properties see the UCD file PropertyAliases.txt.
- *
- * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2,
- * then properties marked with "new in Unicode 3.2" are not or not fully available.
- * Check u_getUnicodeVersion to be sure.
- *
- * @see u_hasBinaryProperty
- * @see u_getIntPropertyValue
- * @see u_getUnicodeVersion
- * @stable ICU 2.1
- */
-typedef enum UProperty {
-    /*  See note !!.  Comments of the form "Binary property Dash",
-        "Enumerated property Script", "Double property Numeric_Value",
-        and "String property Age" are read by genpname. */
-
-    /*  Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that
-    debuggers display UCHAR_ALPHABETIC as the symbolic name for 0,
-    rather than UCHAR_BINARY_START.  Likewise for other *_START
-    identifiers. */
-
-    /** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha.
-        Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */
-    UCHAR_ALPHABETIC=0,
-    /** First constant for binary Unicode properties. @stable ICU 2.1 */
-    UCHAR_BINARY_START=UCHAR_ALPHABETIC,
-    /** Binary property ASCII_Hex_Digit. 0-9 A-F a-f @stable ICU 2.1 */
-    UCHAR_ASCII_HEX_DIGIT=1,
-    /** Binary property Bidi_Control.
-        Format controls which have specific functions
-        in the Bidi Algorithm. @stable ICU 2.1 */
-    UCHAR_BIDI_CONTROL=2,
-    /** Binary property Bidi_Mirrored.
-        Characters that may change display in RTL text.
-        Same as u_isMirrored.
-        See Bidi Algorithm, UTR 9. @stable ICU 2.1 */
-    UCHAR_BIDI_MIRRORED=3,
-    /** Binary property Dash. Variations of dashes. @stable ICU 2.1 */
-    UCHAR_DASH=4,
-    /** Binary property Default_Ignorable_Code_Point (new in Unicode 3.2).
-        Ignorable in most processing.
-        <2060..206F, FFF0..FFFB, E0000..E0FFF>+Other_Default_Ignorable_Code_Point+(Cf+Cc+Cs-White_Space) @stable ICU 2.1 */
-    UCHAR_DEFAULT_IGNORABLE_CODE_POINT=5,
-    /** Binary property Deprecated (new in Unicode 3.2).
-        The usage of deprecated characters is strongly discouraged. @stable ICU 2.1 */
-    UCHAR_DEPRECATED=6,
-    /** Binary property Diacritic. Characters that linguistically modify
-        the meaning of another character to which they apply. @stable ICU 2.1 */
-    UCHAR_DIACRITIC=7,
-    /** Binary property Extender.
-        Extend the value or shape of a preceding alphabetic character,
-        e.g., length and iteration marks. @stable ICU 2.1 */
-    UCHAR_EXTENDER=8,
-    /** Binary property Full_Composition_Exclusion.
-        CompositionExclusions.txt+Singleton Decompositions+
-        Non-Starter Decompositions. @stable ICU 2.1 */
-    UCHAR_FULL_COMPOSITION_EXCLUSION=9,
-    /** Binary property Grapheme_Base (new in Unicode 3.2).
-        For programmatic determination of grapheme cluster boundaries.
-        [0..10FFFF]-Cc-Cf-Cs-Co-Cn-Zl-Zp-Grapheme_Link-Grapheme_Extend-CGJ @stable ICU 2.1 */
-    UCHAR_GRAPHEME_BASE=10,
-    /** Binary property Grapheme_Extend (new in Unicode 3.2).
-        For programmatic determination of grapheme cluster boundaries.
-        Me+Mn+Mc+Other_Grapheme_Extend-Grapheme_Link-CGJ @stable ICU 2.1 */
-    UCHAR_GRAPHEME_EXTEND=11,
-    /** Binary property Grapheme_Link (new in Unicode 3.2).
-        For programmatic determination of grapheme cluster boundaries. @stable ICU 2.1 */
-    UCHAR_GRAPHEME_LINK=12,
-    /** Binary property Hex_Digit.
-        Characters commonly used for hexadecimal numbers. @stable ICU 2.1 */
-    UCHAR_HEX_DIGIT=13,
-    /** Binary property Hyphen. Dashes used to mark connections
-        between pieces of words, plus the Katakana middle dot. @stable ICU 2.1 */
-    UCHAR_HYPHEN=14,
-    /** Binary property ID_Continue.
-        Characters that can continue an identifier.
-        DerivedCoreProperties.txt also says "NOTE: Cf characters should be filtered out."
-        ID_Start+Mn+Mc+Nd+Pc @stable ICU 2.1 */
-    UCHAR_ID_CONTINUE=15,
-    /** Binary property ID_Start.
-        Characters that can start an identifier.
-        Lu+Ll+Lt+Lm+Lo+Nl @stable ICU 2.1 */
-    UCHAR_ID_START=16,
-    /** Binary property Ideographic.
-        CJKV ideographs. @stable ICU 2.1 */
-    UCHAR_IDEOGRAPHIC=17,
-    /** Binary property IDS_Binary_Operator (new in Unicode 3.2).
-        For programmatic determination of
-        Ideographic Description Sequences. @stable ICU 2.1 */
-    UCHAR_IDS_BINARY_OPERATOR=18,
-    /** Binary property IDS_Trinary_Operator (new in Unicode 3.2).
-        For programmatic determination of
-        Ideographic Description Sequences. @stable ICU 2.1 */
-    UCHAR_IDS_TRINARY_OPERATOR=19,
-    /** Binary property Join_Control.
-        Format controls for cursive joining and ligation. @stable ICU 2.1 */
-    UCHAR_JOIN_CONTROL=20,
-    /** Binary property Logical_Order_Exception (new in Unicode 3.2).
-        Characters that do not use logical order and
-        require special handling in most processing. @stable ICU 2.1 */
-    UCHAR_LOGICAL_ORDER_EXCEPTION=21,
-    /** Binary property Lowercase. Same as u_isULowercase, different from u_islower.
-        Ll+Other_Lowercase @stable ICU 2.1 */
-    UCHAR_LOWERCASE=22,
-    /** Binary property Math. Sm+Other_Math @stable ICU 2.1 */
-    UCHAR_MATH=23,
-    /** Binary property Noncharacter_Code_Point.
-        Code points that are explicitly defined as illegal
-        for the encoding of characters. @stable ICU 2.1 */
-    UCHAR_NONCHARACTER_CODE_POINT=24,
-    /** Binary property Quotation_Mark. @stable ICU 2.1 */
-    UCHAR_QUOTATION_MARK=25,
-    /** Binary property Radical (new in Unicode 3.2).
-        For programmatic determination of
-        Ideographic Description Sequences. @stable ICU 2.1 */
-    UCHAR_RADICAL=26,
-    /** Binary property Soft_Dotted (new in Unicode 3.2).
-        Characters with a "soft dot", like i or j.
-        An accent placed on these characters causes
-        the dot to disappear. @stable ICU 2.1 */
-    UCHAR_SOFT_DOTTED=27,
-    /** Binary property Terminal_Punctuation.
-        Punctuation characters that generally mark
-        the end of textual units. @stable ICU 2.1 */
-    UCHAR_TERMINAL_PUNCTUATION=28,
-    /** Binary property Unified_Ideograph (new in Unicode 3.2).
-        For programmatic determination of
-        Ideographic Description Sequences. @stable ICU 2.1 */
-    UCHAR_UNIFIED_IDEOGRAPH=29,
-    /** Binary property Uppercase. Same as u_isUUppercase, different from u_isupper.
-        Lu+Other_Uppercase @stable ICU 2.1 */
-    UCHAR_UPPERCASE=30,
-    /** Binary property White_Space.
-        Same as u_isUWhiteSpace, different from u_isspace and u_isWhitespace.
-        Space characters+TAB+CR+LF-ZWSP-ZWNBSP @stable ICU 2.1 */
-    UCHAR_WHITE_SPACE=31,
-    /** Binary property XID_Continue.
-        ID_Continue modified to allow closure under
-        normalization forms NFKC and NFKD. @stable ICU 2.1 */
-    UCHAR_XID_CONTINUE=32,
-    /** Binary property XID_Start. ID_Start modified to allow
-        closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */
-    UCHAR_XID_START=33,
-    /** Binary property Case_Sensitive. Either the source of a case
-        mapping or _in_ the target of a case mapping. Not the same as
-        the general category Cased_Letter. @stable ICU 2.6 */
-   UCHAR_CASE_SENSITIVE=34,
-    /** Binary property STerm (new in Unicode 4.0.1).
-        Sentence Terminal. Used in UAX #29: Text Boundaries
-        (http://www.unicode.org/reports/tr29/)
-        @stable ICU 3.0 */
-    UCHAR_S_TERM=35,
-    /** Binary property Variation_Selector (new in Unicode 4.0.1).
-        Indicates all those characters that qualify as Variation Selectors.
-        For details on the behavior of these characters,
-        see StandardizedVariants.html and 15.6 Variation Selectors.
-        @stable ICU 3.0 */
-    UCHAR_VARIATION_SELECTOR=36,
-    /** Binary property NFD_Inert.
-        ICU-specific property for characters that are inert under NFD,
-        i.e., they do not interact with adjacent characters.
-        See the documentation for the Normalizer2 class and the
-        Normalizer2::isInert() method.
-        @stable ICU 3.0 */
-    UCHAR_NFD_INERT=37,
-    /** Binary property NFKD_Inert.
-        ICU-specific property for characters that are inert under NFKD,
-        i.e., they do not interact with adjacent characters.
-        See the documentation for the Normalizer2 class and the
-        Normalizer2::isInert() method.
-        @stable ICU 3.0 */
-    UCHAR_NFKD_INERT=38,
-    /** Binary property NFC_Inert.
-        ICU-specific property for characters that are inert under NFC,
-        i.e., they do not interact with adjacent characters.
-        See the documentation for the Normalizer2 class and the
-        Normalizer2::isInert() method.
-        @stable ICU 3.0 */
-    UCHAR_NFC_INERT=39,
-    /** Binary property NFKC_Inert.
-        ICU-specific property for characters that are inert under NFKC,
-        i.e., they do not interact with adjacent characters.
-        See the documentation for the Normalizer2 class and the
-        Normalizer2::isInert() method.
-        @stable ICU 3.0 */
-    UCHAR_NFKC_INERT=40,
-    /** Binary Property Segment_Starter.
-        ICU-specific property for characters that are starters in terms of
-        Unicode normalization and combining character sequences.
-        They have ccc=0 and do not occur in non-initial position of the
-        canonical decomposition of any character
-        (like a-umlaut in NFD and a Jamo T in an NFD(Hangul LVT)).
-        ICU uses this property for segmenting a string for generating a set of
-        canonically equivalent strings, e.g. for canonical closure while
-        processing collation tailoring rules.
-        @stable ICU 3.0 */
-    UCHAR_SEGMENT_STARTER=41,
-    /** Binary property Pattern_Syntax (new in Unicode 4.1).
-        See UAX #31 Identifier and Pattern Syntax
-        (http://www.unicode.org/reports/tr31/)
-        @stable ICU 3.4 */
-    UCHAR_PATTERN_SYNTAX=42,
-    /** Binary property Pattern_White_Space (new in Unicode 4.1).
-        See UAX #31 Identifier and Pattern Syntax
-        (http://www.unicode.org/reports/tr31/)
-        @stable ICU 3.4 */
-    UCHAR_PATTERN_WHITE_SPACE=43,
-    /** Binary property alnum (a C/POSIX character class).
-        Implemented according to the UTS #18 Annex C Standard Recommendation.
-        See the uchar.h file documentation.
-        @stable ICU 3.4 */
-    UCHAR_POSIX_ALNUM=44,
-    /** Binary property blank (a C/POSIX character class).
-        Implemented according to the UTS #18 Annex C Standard Recommendation.
-        See the uchar.h file documentation.
-        @stable ICU 3.4 */
-    UCHAR_POSIX_BLANK=45,
-    /** Binary property graph (a C/POSIX character class).
-        Implemented according to the UTS #18 Annex C Standard Recommendation.
-        See the uchar.h file documentation.
-        @stable ICU 3.4 */
-    UCHAR_POSIX_GRAPH=46,
-    /** Binary property print (a C/POSIX character class).
-        Implemented according to the UTS #18 Annex C Standard Recommendation.
-        See the uchar.h file documentation.
-        @stable ICU 3.4 */
-    UCHAR_POSIX_PRINT=47,
-    /** Binary property xdigit (a C/POSIX character class).
-        Implemented according to the UTS #18 Annex C Standard Recommendation.
-        See the uchar.h file documentation.
-        @stable ICU 3.4 */
-    UCHAR_POSIX_XDIGIT=48,
-    /** Binary property Cased. For Lowercase, Uppercase and Titlecase characters. @stable ICU 4.4 */
-    UCHAR_CASED=49,
-    /** Binary property Case_Ignorable. Used in context-sensitive case mappings. @stable ICU 4.4 */
-    UCHAR_CASE_IGNORABLE=50,
-    /** Binary property Changes_When_Lowercased. @stable ICU 4.4 */
-    UCHAR_CHANGES_WHEN_LOWERCASED=51,
-    /** Binary property Changes_When_Uppercased. @stable ICU 4.4 */
-    UCHAR_CHANGES_WHEN_UPPERCASED=52,
-    /** Binary property Changes_When_Titlecased. @stable ICU 4.4 */
-    UCHAR_CHANGES_WHEN_TITLECASED=53,
-    /** Binary property Changes_When_Casefolded. @stable ICU 4.4 */
-    UCHAR_CHANGES_WHEN_CASEFOLDED=54,
-    /** Binary property Changes_When_Casemapped. @stable ICU 4.4 */
-    UCHAR_CHANGES_WHEN_CASEMAPPED=55,
-    /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */
-    UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56,
-    /** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */
-    UCHAR_BINARY_LIMIT=57,
-
-    /** Enumerated property Bidi_Class.
-        Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */
-    UCHAR_BIDI_CLASS=0x1000,
-    /** First constant for enumerated/integer Unicode properties. @stable ICU 2.2 */
-    UCHAR_INT_START=UCHAR_BIDI_CLASS,
-    /** Enumerated property Block.
-        Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2 */
-    UCHAR_BLOCK=0x1001,
-    /** Enumerated property Canonical_Combining_Class.
-        Same as u_getCombiningClass, returns 8-bit numeric values. @stable ICU 2.2 */
-    UCHAR_CANONICAL_COMBINING_CLASS=0x1002,
-    /** Enumerated property Decomposition_Type.
-        Returns UDecompositionType values. @stable ICU 2.2 */
-    UCHAR_DECOMPOSITION_TYPE=0x1003,
-    /** Enumerated property East_Asian_Width.
-        See http://www.unicode.org/reports/tr11/
-        Returns UEastAsianWidth values. @stable ICU 2.2 */
-    UCHAR_EAST_ASIAN_WIDTH=0x1004,
-    /** Enumerated property General_Category.
-        Same as u_charType, returns UCharCategory values. @stable ICU 2.2 */
-    UCHAR_GENERAL_CATEGORY=0x1005,
-    /** Enumerated property Joining_Group.
-        Returns UJoiningGroup values. @stable ICU 2.2 */
-    UCHAR_JOINING_GROUP=0x1006,
-    /** Enumerated property Joining_Type.
-        Returns UJoiningType values. @stable ICU 2.2 */
-    UCHAR_JOINING_TYPE=0x1007,
-    /** Enumerated property Line_Break.
-        Returns ULineBreak values. @stable ICU 2.2 */
-    UCHAR_LINE_BREAK=0x1008,
-    /** Enumerated property Numeric_Type.
-        Returns UNumericType values. @stable ICU 2.2 */
-    UCHAR_NUMERIC_TYPE=0x1009,
-    /** Enumerated property Script.
-        Same as uscript_getScript, returns UScriptCode values. @stable ICU 2.2 */
-    UCHAR_SCRIPT=0x100A,
-    /** Enumerated property Hangul_Syllable_Type, new in Unicode 4.
-        Returns UHangulSyllableType values. @stable ICU 2.6 */
-    UCHAR_HANGUL_SYLLABLE_TYPE=0x100B,
-    /** Enumerated property NFD_Quick_Check.
-        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
-    UCHAR_NFD_QUICK_CHECK=0x100C,
-    /** Enumerated property NFKD_Quick_Check.
-        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
-    UCHAR_NFKD_QUICK_CHECK=0x100D,
-    /** Enumerated property NFC_Quick_Check.
-        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
-    UCHAR_NFC_QUICK_CHECK=0x100E,
-    /** Enumerated property NFKC_Quick_Check.
-        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
-    UCHAR_NFKC_QUICK_CHECK=0x100F,
-    /** Enumerated property Lead_Canonical_Combining_Class.
-        ICU-specific property for the ccc of the first code point
-        of the decomposition, or lccc(c)=ccc(NFD(c)[0]).
-        Useful for checking for canonically ordered text;
-        see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD .
-        Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */
-    UCHAR_LEAD_CANONICAL_COMBINING_CLASS=0x1010,
-    /** Enumerated property Trail_Canonical_Combining_Class.
-        ICU-specific property for the ccc of the last code point
-        of the decomposition, or tccc(c)=ccc(NFD(c)[last]).
-        Useful for checking for canonically ordered text;
-        see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD .
-        Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */
-    UCHAR_TRAIL_CANONICAL_COMBINING_CLASS=0x1011,
-    /** Enumerated property Grapheme_Cluster_Break (new in Unicode 4.1).
-        Used in UAX #29: Text Boundaries
-        (http://www.unicode.org/reports/tr29/)
-        Returns UGraphemeClusterBreak values. @stable ICU 3.4 */
-    UCHAR_GRAPHEME_CLUSTER_BREAK=0x1012,
-    /** Enumerated property Sentence_Break (new in Unicode 4.1).
-        Used in UAX #29: Text Boundaries
-        (http://www.unicode.org/reports/tr29/)
-        Returns USentenceBreak values. @stable ICU 3.4 */
-    UCHAR_SENTENCE_BREAK=0x1013,
-    /** Enumerated property Word_Break (new in Unicode 4.1).
-        Used in UAX #29: Text Boundaries
-        (http://www.unicode.org/reports/tr29/)
-        Returns UWordBreakValues values. @stable ICU 3.4 */
-    UCHAR_WORD_BREAK=0x1014,
-    /** One more than the last constant for enumerated/integer Unicode properties. @stable ICU 2.2 */
-    UCHAR_INT_LIMIT=0x1015,
-
-    /** Bitmask property General_Category_Mask.
-        This is the General_Category property returned as a bit mask.
-        When used in u_getIntPropertyValue(c), same as U_MASK(u_charType(c)),
-        returns bit masks for UCharCategory values where exactly one bit is set.
-        When used with u_getPropertyValueName() and u_getPropertyValueEnum(),
-        a multi-bit mask is used for sets of categories like "Letters".
-        Mask values should be cast to uint32_t.
-        @stable ICU 2.4 */
-    UCHAR_GENERAL_CATEGORY_MASK=0x2000,
-    /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */
-    UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK,
-    /** One more than the last constant for bit-mask Unicode properties. @stable ICU 2.4 */
-    UCHAR_MASK_LIMIT=0x2001,
-
-    /** Double property Numeric_Value.
-        Corresponds to u_getNumericValue. @stable ICU 2.4 */
-    UCHAR_NUMERIC_VALUE=0x3000,
-    /** First constant for double Unicode properties. @stable ICU 2.4 */
-    UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE,
-    /** One more than the last constant for double Unicode properties. @stable ICU 2.4 */
-    UCHAR_DOUBLE_LIMIT=0x3001,
-
-    /** String property Age.
-        Corresponds to u_charAge. @stable ICU 2.4 */
-    UCHAR_AGE=0x4000,
-    /** First constant for string Unicode properties. @stable ICU 2.4 */
-    UCHAR_STRING_START=UCHAR_AGE,
-    /** String property Bidi_Mirroring_Glyph.
-        Corresponds to u_charMirror. @stable ICU 2.4 */
-    UCHAR_BIDI_MIRRORING_GLYPH=0x4001,
-    /** String property Case_Folding.
-        Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */
-    UCHAR_CASE_FOLDING=0x4002,
-    /** String property ISO_Comment.
-        Corresponds to u_getISOComment. @stable ICU 2.4 */
-    UCHAR_ISO_COMMENT=0x4003,
-    /** String property Lowercase_Mapping.
-        Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */
-    UCHAR_LOWERCASE_MAPPING=0x4004,
-    /** String property Name.
-        Corresponds to u_charName. @stable ICU 2.4 */
-    UCHAR_NAME=0x4005,
-    /** String property Simple_Case_Folding.
-        Corresponds to u_foldCase. @stable ICU 2.4 */
-    UCHAR_SIMPLE_CASE_FOLDING=0x4006,
-    /** String property Simple_Lowercase_Mapping.
-        Corresponds to u_tolower. @stable ICU 2.4 */
-    UCHAR_SIMPLE_LOWERCASE_MAPPING=0x4007,
-    /** String property Simple_Titlecase_Mapping.
-        Corresponds to u_totitle. @stable ICU 2.4 */
-    UCHAR_SIMPLE_TITLECASE_MAPPING=0x4008,
-    /** String property Simple_Uppercase_Mapping.
-        Corresponds to u_toupper. @stable ICU 2.4 */
-    UCHAR_SIMPLE_UPPERCASE_MAPPING=0x4009,
-    /** String property Titlecase_Mapping.
-        Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */
-    UCHAR_TITLECASE_MAPPING=0x400A,
-    /** String property Unicode_1_Name.
-        Corresponds to u_charName. @stable ICU 2.4 */
-    UCHAR_UNICODE_1_NAME=0x400B,
-    /** String property Uppercase_Mapping.
-        Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */
-    UCHAR_UPPERCASE_MAPPING=0x400C,
-    /** One more than the last constant for string Unicode properties. @stable ICU 2.4 */
-    UCHAR_STRING_LIMIT=0x400D,
-
-    /** Provisional property Script_Extensions (new in Unicode 6.0).
-        As a provisional property, it may be modified or removed
-        in future versions of the Unicode Standard, and thus in ICU.
-        Some characters are commonly used in multiple scripts.
-        For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
-        Corresponds to uscript_hasScript and uscript_getScriptExtensions in uscript.h.
-        @draft ICU 4.6 */
-    UCHAR_SCRIPT_EXTENSIONS=0x7000,
-    /** First constant for Unicode properties with unusual value types. @draft ICU 4.6 */
-    UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS,
-    /** One more than the last constant for Unicode properties with unusual value types.
-     * @draft ICU 4.6 */
-    UCHAR_OTHER_PROPERTY_LIMIT=0x7001,
-
-    /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */
-    UCHAR_INVALID_CODE = -1
-} UProperty;
-
-/**
- * Data for enumerated Unicode general category types.
- * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html .
- * @stable ICU 2.0
- */
-typedef enum UCharCategory
-{
-    /** See note !!.  Comments of the form "Cn" are read by genpname. */
-
-    /** Non-category for unassigned and non-character code points. @stable ICU 2.0 */
-    U_UNASSIGNED              = 0,
-    /** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */
-    U_GENERAL_OTHER_TYPES     = 0,
-    /** Lu @stable ICU 2.0 */
-    U_UPPERCASE_LETTER        = 1,
-    /** Ll @stable ICU 2.0 */
-    U_LOWERCASE_LETTER        = 2,
-    /** Lt @stable ICU 2.0 */
-    U_TITLECASE_LETTER        = 3,
-    /** Lm @stable ICU 2.0 */
-    U_MODIFIER_LETTER         = 4,
-    /** Lo @stable ICU 2.0 */
-    U_OTHER_LETTER            = 5,
-    /** Mn @stable ICU 2.0 */
-    U_NON_SPACING_MARK        = 6,
-    /** Me @stable ICU 2.0 */
-    U_ENCLOSING_MARK          = 7,
-    /** Mc @stable ICU 2.0 */
-    U_COMBINING_SPACING_MARK  = 8,
-    /** Nd @stable ICU 2.0 */
-    U_DECIMAL_DIGIT_NUMBER    = 9,
-    /** Nl @stable ICU 2.0 */
-    U_LETTER_NUMBER           = 10,
-    /** No @stable ICU 2.0 */
-    U_OTHER_NUMBER            = 11,
-    /** Zs @stable ICU 2.0 */
-    U_SPACE_SEPARATOR         = 12,
-    /** Zl @stable ICU 2.0 */
-    U_LINE_SEPARATOR          = 13,
-    /** Zp @stable ICU 2.0 */
-    U_PARAGRAPH_SEPARATOR     = 14,
-    /** Cc @stable ICU 2.0 */
-    U_CONTROL_CHAR            = 15,
-    /** Cf @stable ICU 2.0 */
-    U_FORMAT_CHAR             = 16,
-    /** Co @stable ICU 2.0 */
-    U_PRIVATE_USE_CHAR        = 17,
-    /** Cs @stable ICU 2.0 */
-    U_SURROGATE               = 18,
-    /** Pd @stable ICU 2.0 */
-    U_DASH_PUNCTUATION        = 19,
-    /** Ps @stable ICU 2.0 */
-    U_START_PUNCTUATION       = 20,
-    /** Pe @stable ICU 2.0 */
-    U_END_PUNCTUATION         = 21,
-    /** Pc @stable ICU 2.0 */
-    U_CONNECTOR_PUNCTUATION   = 22,
-    /** Po @stable ICU 2.0 */
-    U_OTHER_PUNCTUATION       = 23,
-    /** Sm @stable ICU 2.0 */
-    U_MATH_SYMBOL             = 24,
-    /** Sc @stable ICU 2.0 */
-    U_CURRENCY_SYMBOL         = 25,
-    /** Sk @stable ICU 2.0 */
-    U_MODIFIER_SYMBOL         = 26,
-    /** So @stable ICU 2.0 */
-    U_OTHER_SYMBOL            = 27,
-    /** Pi @stable ICU 2.0 */
-    U_INITIAL_PUNCTUATION     = 28,
-    /** Pf @stable ICU 2.0 */
-    U_FINAL_PUNCTUATION       = 29,
-    /** One higher than the last enum UCharCategory constant. @stable ICU 2.0 */
-    U_CHAR_CATEGORY_COUNT
-} UCharCategory;
-
-/**
- * U_GC_XX_MASK constants are bit flags corresponding to Unicode
- * general category values.
- * For each category, the nth bit is set if the numeric value of the
- * corresponding UCharCategory constant is n.
- *
- * There are also some U_GC_Y_MASK constants for groups of general categories
- * like L for all letter categories.
- *
- * @see u_charType
- * @see U_GET_GC_MASK
- * @see UCharCategory
- * @stable ICU 2.1
- */
-#define U_GC_CN_MASK    U_MASK(U_GENERAL_OTHER_TYPES)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_LU_MASK    U_MASK(U_UPPERCASE_LETTER)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_LL_MASK    U_MASK(U_LOWERCASE_LETTER)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_LT_MASK    U_MASK(U_TITLECASE_LETTER)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_LM_MASK    U_MASK(U_MODIFIER_LETTER)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_LO_MASK    U_MASK(U_OTHER_LETTER)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_MN_MASK    U_MASK(U_NON_SPACING_MARK)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_ME_MASK    U_MASK(U_ENCLOSING_MARK)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_MC_MASK    U_MASK(U_COMBINING_SPACING_MARK)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_ND_MASK    U_MASK(U_DECIMAL_DIGIT_NUMBER)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_NL_MASK    U_MASK(U_LETTER_NUMBER)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_NO_MASK    U_MASK(U_OTHER_NUMBER)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_ZS_MASK    U_MASK(U_SPACE_SEPARATOR)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_ZL_MASK    U_MASK(U_LINE_SEPARATOR)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_ZP_MASK    U_MASK(U_PARAGRAPH_SEPARATOR)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_CC_MASK    U_MASK(U_CONTROL_CHAR)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_CF_MASK    U_MASK(U_FORMAT_CHAR)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_CO_MASK    U_MASK(U_PRIVATE_USE_CHAR)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_CS_MASK    U_MASK(U_SURROGATE)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PD_MASK    U_MASK(U_DASH_PUNCTUATION)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PS_MASK    U_MASK(U_START_PUNCTUATION)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PE_MASK    U_MASK(U_END_PUNCTUATION)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PC_MASK    U_MASK(U_CONNECTOR_PUNCTUATION)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PO_MASK    U_MASK(U_OTHER_PUNCTUATION)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_SM_MASK    U_MASK(U_MATH_SYMBOL)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_SC_MASK    U_MASK(U_CURRENCY_SYMBOL)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_SK_MASK    U_MASK(U_MODIFIER_SYMBOL)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_SO_MASK    U_MASK(U_OTHER_SYMBOL)
-
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PI_MASK    U_MASK(U_INITIAL_PUNCTUATION)
-/** Mask constant for a UCharCategory. @stable ICU 2.1 */
-#define U_GC_PF_MASK    U_MASK(U_FINAL_PUNCTUATION)
-
-
-/** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */
-#define U_GC_L_MASK \
-            (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK)
-
-/** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */
-#define U_GC_LC_MASK \
-            (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK)
-
-/** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */
-#define U_GC_M_MASK (U_GC_MN_MASK|U_GC_ME_MASK|U_GC_MC_MASK)
-
-/** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */
-#define U_GC_N_MASK (U_GC_ND_MASK|U_GC_NL_MASK|U_GC_NO_MASK)
-
-/** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */
-#define U_GC_Z_MASK (U_GC_ZS_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK)
-
-/** Mask constant for multiple UCharCategory bits (C Others). @stable ICU 2.1 */
-#define U_GC_C_MASK \
-            (U_GC_CN_MASK|U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CO_MASK|U_GC_CS_MASK)
-
-/** Mask constant for multiple UCharCategory bits (P Punctuation). @stable ICU 2.1 */
-#define U_GC_P_MASK \
-            (U_GC_PD_MASK|U_GC_PS_MASK|U_GC_PE_MASK|U_GC_PC_MASK|U_GC_PO_MASK| \
-             U_GC_PI_MASK|U_GC_PF_MASK)
-
-/** Mask constant for multiple UCharCategory bits (S Symbols). @stable ICU 2.1 */
-#define U_GC_S_MASK (U_GC_SM_MASK|U_GC_SC_MASK|U_GC_SK_MASK|U_GC_SO_MASK)
-
-/**
- * This specifies the language directional property of a character set.
- * @stable ICU 2.0
- */
-typedef enum UCharDirection {
-    /** See note !!.  Comments of the form "EN" are read by genpname. */
-
-    /** L @stable ICU 2.0 */
-    U_LEFT_TO_RIGHT               = 0,
-    /** R @stable ICU 2.0 */
-    U_RIGHT_TO_LEFT               = 1,
-    /** EN @stable ICU 2.0 */
-    U_EUROPEAN_NUMBER             = 2,
-    /** ES @stable ICU 2.0 */
-    U_EUROPEAN_NUMBER_SEPARATOR   = 3,
-    /** ET @stable ICU 2.0 */
-    U_EUROPEAN_NUMBER_TERMINATOR  = 4,
-    /** AN @stable ICU 2.0 */
-    U_ARABIC_NUMBER               = 5,
-    /** CS @stable ICU 2.0 */
-    U_COMMON_NUMBER_SEPARATOR     = 6,
-    /** B @stable ICU 2.0 */
-    U_BLOCK_SEPARATOR             = 7,
-    /** S @stable ICU 2.0 */
-    U_SEGMENT_SEPARATOR           = 8,
-    /** WS @stable ICU 2.0 */
-    U_WHITE_SPACE_NEUTRAL         = 9,
-    /** ON @stable ICU 2.0 */
-    U_OTHER_NEUTRAL               = 10,
-    /** LRE @stable ICU 2.0 */
-    U_LEFT_TO_RIGHT_EMBEDDING     = 11,
-    /** LRO @stable ICU 2.0 */
-    U_LEFT_TO_RIGHT_OVERRIDE      = 12,
-    /** AL @stable ICU 2.0 */
-    U_RIGHT_TO_LEFT_ARABIC        = 13,
-    /** RLE @stable ICU 2.0 */
-    U_RIGHT_TO_LEFT_EMBEDDING     = 14,
-    /** RLO @stable ICU 2.0 */
-    U_RIGHT_TO_LEFT_OVERRIDE      = 15,
-    /** PDF @stable ICU 2.0 */
-    U_POP_DIRECTIONAL_FORMAT      = 16,
-    /** NSM @stable ICU 2.0 */
-    U_DIR_NON_SPACING_MARK        = 17,
-    /** BN @stable ICU 2.0 */
-    U_BOUNDARY_NEUTRAL            = 18,
-    /** @stable ICU 2.0 */
-    U_CHAR_DIRECTION_COUNT
-} UCharDirection;
-
-/**
- * Constants for Unicode blocks, see the Unicode Data file Blocks.txt
- * @stable ICU 2.0
- */
-enum UBlockCode {
-
-    /** New No_Block value in Unicode 4. @stable ICU 2.6 */
-    UBLOCK_NO_BLOCK = 0, /*[none]*/ /* Special range indicating No_Block */
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BASIC_LATIN = 1, /*[0000]*/ /*See note !!*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LATIN_1_SUPPLEMENT=2, /*[0080]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LATIN_EXTENDED_A =3, /*[0100]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LATIN_EXTENDED_B =4, /*[0180]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_IPA_EXTENSIONS =5, /*[0250]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_SPACING_MODIFIER_LETTERS =6, /*[02B0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_COMBINING_DIACRITICAL_MARKS =7, /*[0300]*/
-
-    /**
-     * Unicode 3.2 renames this block to "Greek and Coptic".
-     * @stable ICU 2.0
-     */
-    UBLOCK_GREEK =8, /*[0370]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CYRILLIC =9, /*[0400]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ARMENIAN =10, /*[0530]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HEBREW =11, /*[0590]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ARABIC =12, /*[0600]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_SYRIAC =13, /*[0700]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_THAANA =14, /*[0780]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_DEVANAGARI =15, /*[0900]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BENGALI =16, /*[0980]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_GURMUKHI =17, /*[0A00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_GUJARATI =18, /*[0A80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ORIYA =19, /*[0B00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_TAMIL =20, /*[0B80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_TELUGU =21, /*[0C00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_KANNADA =22, /*[0C80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_MALAYALAM =23, /*[0D00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_SINHALA =24, /*[0D80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_THAI =25, /*[0E00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LAO =26, /*[0E80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_TIBETAN =27, /*[0F00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_MYANMAR =28, /*[1000]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_GEORGIAN =29, /*[10A0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HANGUL_JAMO =30, /*[1100]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ETHIOPIC =31, /*[1200]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CHEROKEE =32, /*[13A0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =33, /*[1400]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_OGHAM =34, /*[1680]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_RUNIC =35, /*[16A0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_KHMER =36, /*[1780]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_MONGOLIAN =37, /*[1800]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LATIN_EXTENDED_ADDITIONAL =38, /*[1E00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_GREEK_EXTENDED =39, /*[1F00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_GENERAL_PUNCTUATION =40, /*[2000]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS =41, /*[2070]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CURRENCY_SYMBOLS =42, /*[20A0]*/
-
-    /**
-     * Unicode 3.2 renames this block to "Combining Diacritical Marks for Symbols".
-     * @stable ICU 2.0
-     */
-    UBLOCK_COMBINING_MARKS_FOR_SYMBOLS =43, /*[20D0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LETTERLIKE_SYMBOLS =44, /*[2100]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_NUMBER_FORMS =45, /*[2150]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ARROWS =46, /*[2190]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_MATHEMATICAL_OPERATORS =47, /*[2200]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_MISCELLANEOUS_TECHNICAL =48, /*[2300]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CONTROL_PICTURES =49, /*[2400]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_OPTICAL_CHARACTER_RECOGNITION =50, /*[2440]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ENCLOSED_ALPHANUMERICS =51, /*[2460]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BOX_DRAWING =52, /*[2500]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BLOCK_ELEMENTS =53, /*[2580]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_GEOMETRIC_SHAPES =54, /*[25A0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_MISCELLANEOUS_SYMBOLS =55, /*[2600]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_DINGBATS =56, /*[2700]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BRAILLE_PATTERNS =57, /*[2800]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_RADICALS_SUPPLEMENT =58, /*[2E80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_KANGXI_RADICALS =59, /*[2F00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS =60, /*[2FF0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION =61, /*[3000]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HIRAGANA =62, /*[3040]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_KATAKANA =63, /*[30A0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BOPOMOFO =64, /*[3100]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HANGUL_COMPATIBILITY_JAMO =65, /*[3130]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_KANBUN =66, /*[3190]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_BOPOMOFO_EXTENDED =67, /*[31A0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS =68, /*[3200]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_COMPATIBILITY =69, /*[3300]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =70, /*[3400]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_UNIFIED_IDEOGRAPHS =71, /*[4E00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_YI_SYLLABLES =72, /*[A000]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_YI_RADICALS =73, /*[A490]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HANGUL_SYLLABLES =74, /*[AC00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HIGH_SURROGATES =75, /*[D800]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HIGH_PRIVATE_USE_SURROGATES =76, /*[DB80]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_LOW_SURROGATES =77, /*[DC00]*/
-
-    /**
-     * Same as UBLOCK_PRIVATE_USE_AREA.
-     * Until Unicode 3.1.1, the corresponding block name was "Private Use",
-     * and multiple code point ranges had this block.
-     * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and
-     * adds separate blocks for the supplementary PUAs.
-     *
-     * @stable ICU 2.0
-     */
-    UBLOCK_PRIVATE_USE = 78,
-    /**
-     * Same as UBLOCK_PRIVATE_USE.
-     * Until Unicode 3.1.1, the corresponding block name was "Private Use",
-     * and multiple code point ranges had this block.
-     * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and
-     * adds separate blocks for the supplementary PUAs.
-     *
-     * @stable ICU 2.0
-     */
-    UBLOCK_PRIVATE_USE_AREA =UBLOCK_PRIVATE_USE, /*[E000]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS =79, /*[F900]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ALPHABETIC_PRESENTATION_FORMS =80, /*[FB00]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ARABIC_PRESENTATION_FORMS_A =81, /*[FB50]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_COMBINING_HALF_MARKS =82, /*[FE20]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_COMPATIBILITY_FORMS =83, /*[FE30]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_SMALL_FORM_VARIANTS =84, /*[FE50]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_ARABIC_PRESENTATION_FORMS_B =85, /*[FE70]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_SPECIALS =86, /*[FFF0]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS =87, /*[FF00]*/
-
-    /* New blocks in Unicode 3.1 */
-
-    /** @stable ICU 2.0 */
-    UBLOCK_OLD_ITALIC = 88  , /*[10300]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_GOTHIC = 89 , /*[10330]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_DESERET = 90 , /*[10400]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = 91 , /*[1D000]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_MUSICAL_SYMBOLS = 92 , /*[1D100]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93  , /*[1D400]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B  = 94 , /*[20000]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95 , /*[2F800]*/
-    /** @stable ICU 2.0 */
-    UBLOCK_TAGS = 96, /*[E0000]*/
-
-    /* New blocks in Unicode 3.2 */
-
-    /**
-     * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement".
-     * @stable ICU 2.2
-     */
-    UBLOCK_CYRILLIC_SUPPLEMENTARY = 97, 
-    /** @stable ICU 3.0  */
-    UBLOCK_CYRILLIC_SUPPLEMENT = UBLOCK_CYRILLIC_SUPPLEMENTARY, /*[0500]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_TAGALOG = 98, /*[1700]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_HANUNOO = 99, /*[1720]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_BUHID = 100, /*[1740]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_TAGBANWA = 101, /*[1760]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, /*[27C0]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_SUPPLEMENTAL_ARROWS_A = 103, /*[27F0]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_SUPPLEMENTAL_ARROWS_B = 104, /*[2900]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, /*[2980]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, /*[2A00]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = 107, /*[31F0]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_VARIATION_SELECTORS = 108, /*[FE00]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, /*[F0000]*/
-    /** @stable ICU 2.2 */
-    UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, /*[100000]*/
-
-    /* New blocks in Unicode 4 */
-
-    /** @stable ICU 2.6 */
-    UBLOCK_LIMBU = 111, /*[1900]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_TAI_LE = 112, /*[1950]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_KHMER_SYMBOLS = 113, /*[19E0]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_PHONETIC_EXTENSIONS = 114, /*[1D00]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, /*[2B00]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_YIJING_HEXAGRAM_SYMBOLS = 116, /*[4DC0]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_LINEAR_B_SYLLABARY = 117, /*[10000]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_LINEAR_B_IDEOGRAMS = 118, /*[10080]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_AEGEAN_NUMBERS = 119, /*[10100]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_UGARITIC = 120, /*[10380]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_SHAVIAN = 121, /*[10450]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_OSMANYA = 122, /*[10480]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_CYPRIOT_SYLLABARY = 123, /*[10800]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_TAI_XUAN_JING_SYMBOLS = 124, /*[1D300]*/
-    /** @stable ICU 2.6 */
-    UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = 125, /*[E0100]*/
-
-    /* New blocks in Unicode 4.1 */
-
-    /** @stable ICU 3.4 */
-    UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION = 126, /*[1D200]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_ANCIENT_GREEK_NUMBERS = 127, /*[10140]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_ARABIC_SUPPLEMENT = 128, /*[0750]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_BUGINESE = 129, /*[1A00]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_CJK_STROKES = 130, /*[31C0]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 131, /*[1DC0]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_COPTIC = 132, /*[2C80]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_ETHIOPIC_EXTENDED = 133, /*[2D80]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_ETHIOPIC_SUPPLEMENT = 134, /*[1380]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_GEORGIAN_SUPPLEMENT = 135, /*[2D00]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_GLAGOLITIC = 136, /*[2C00]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_KHAROSHTHI = 137, /*[10A00]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_MODIFIER_TONE_LETTERS = 138, /*[A700]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_NEW_TAI_LUE = 139, /*[1980]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_OLD_PERSIAN = 140, /*[103A0]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT = 141, /*[1D80]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_SUPPLEMENTAL_PUNCTUATION = 142, /*[2E00]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_SYLOTI_NAGRI = 143, /*[A800]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_TIFINAGH = 144, /*[2D30]*/
-    /** @stable ICU 3.4 */
-    UBLOCK_VERTICAL_FORMS = 145, /*[FE10]*/
-
-    /* New blocks in Unicode 5.0 */
-
-    /** @stable ICU 3.6 */
-    UBLOCK_NKO = 146, /*[07C0]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_BALINESE = 147, /*[1B00]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_LATIN_EXTENDED_C = 148, /*[2C60]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_LATIN_EXTENDED_D = 149, /*[A720]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_PHAGS_PA = 150, /*[A840]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_PHOENICIAN = 151, /*[10900]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_CUNEIFORM = 152, /*[12000]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION = 153, /*[12400]*/
-    /** @stable ICU 3.6 */
-    UBLOCK_COUNTING_ROD_NUMERALS = 154, /*[1D360]*/
-
-    /* New blocks in Unicode 5.1 */
-
-    /** @stable ICU 4.0 */
-    UBLOCK_SUNDANESE = 155, /*[1B80]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_LEPCHA = 156, /*[1C00]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_OL_CHIKI = 157, /*[1C50]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_CYRILLIC_EXTENDED_A = 158, /*[2DE0]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_VAI = 159, /*[A500]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_CYRILLIC_EXTENDED_B = 160, /*[A640]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_SAURASHTRA = 161, /*[A880]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_KAYAH_LI = 162, /*[A900]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_REJANG = 163, /*[A930]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_CHAM = 164, /*[AA00]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_ANCIENT_SYMBOLS = 165, /*[10190]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_PHAISTOS_DISC = 166, /*[101D0]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_LYCIAN = 167, /*[10280]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_CARIAN = 168, /*[102A0]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_LYDIAN = 169, /*[10920]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_MAHJONG_TILES = 170, /*[1F000]*/
-    /** @stable ICU 4.0 */
-    UBLOCK_DOMINO_TILES = 171, /*[1F030]*/
-
-    /* New blocks in Unicode 5.2 */
-
-    /** @stable ICU 4.4 */
-    UBLOCK_SAMARITAN = 172, /*[0800]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, /*[18B0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_TAI_THAM = 174, /*[1A20]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_VEDIC_EXTENSIONS = 175, /*[1CD0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_LISU = 176, /*[A4D0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_BAMUM = 177, /*[A6A0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_COMMON_INDIC_NUMBER_FORMS = 178, /*[A830]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_DEVANAGARI_EXTENDED = 179, /*[A8E0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_HANGUL_JAMO_EXTENDED_A = 180, /*[A960]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_JAVANESE = 181, /*[A980]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_MYANMAR_EXTENDED_A = 182, /*[AA60]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_TAI_VIET = 183, /*[AA80]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_MEETEI_MAYEK = 184, /*[ABC0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_HANGUL_JAMO_EXTENDED_B = 185, /*[D7B0]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_IMPERIAL_ARAMAIC = 186, /*[10840]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_OLD_SOUTH_ARABIAN = 187, /*[10A60]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_AVESTAN = 188, /*[10B00]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_INSCRIPTIONAL_PARTHIAN = 189, /*[10B40]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_INSCRIPTIONAL_PAHLAVI = 190, /*[10B60]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_OLD_TURKIC = 191, /*[10C00]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_RUMI_NUMERAL_SYMBOLS = 192, /*[10E60]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_KAITHI = 193, /*[11080]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_EGYPTIAN_HIEROGLYPHS = 194, /*[13000]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, /*[1F100]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, /*[1F200]*/
-    /** @stable ICU 4.4 */
-    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, /*[2A700]*/
-
-    /* New blocks in Unicode 6.0 */
-
-    /** @stable ICU 4.6 */
-    UBLOCK_MANDAIC = 198, /*[0840]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_BATAK = 199, /*[1BC0]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_ETHIOPIC_EXTENDED_A = 200, /*[AB00]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_BRAHMI = 201, /*[11000]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_BAMUM_SUPPLEMENT = 202, /*[16800]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_KANA_SUPPLEMENT = 203, /*[1B000]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_PLAYING_CARDS = 204, /*[1F0A0]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 205, /*[1F300]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_EMOTICONS = 206, /*[1F600]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_TRANSPORT_AND_MAP_SYMBOLS = 207, /*[1F680]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_ALCHEMICAL_SYMBOLS = 208, /*[1F700]*/
-    /** @stable ICU 4.6 */
-    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 209, /*[2B740]*/
-
-    /** @stable ICU 2.0 */
-    UBLOCK_COUNT = 210,
-
-    /** @stable ICU 2.0 */
-    UBLOCK_INVALID_CODE=-1
-};
-
-/** @stable ICU 2.0 */
-typedef enum UBlockCode UBlockCode;
-
-/**
- * East Asian Width constants.
- *
- * @see UCHAR_EAST_ASIAN_WIDTH
- * @see u_getIntPropertyValue
- * @stable ICU 2.2
- */
-typedef enum UEastAsianWidth {
-    U_EA_NEUTRAL,   /*[N]*/ /*See note !!*/
-    U_EA_AMBIGUOUS, /*[A]*/
-    U_EA_HALFWIDTH, /*[H]*/
-    U_EA_FULLWIDTH, /*[F]*/
-    U_EA_NARROW,    /*[Na]*/
-    U_EA_WIDE,      /*[W]*/
-    U_EA_COUNT
-} UEastAsianWidth;
-/*
- * Implementation note:
- * Keep UEastAsianWidth constant values in sync with names list in genprops/props2.c.
- */
-
-/**
- * Selector constants for u_charName().
- * u_charName() returns the "modern" name of a
- * Unicode character; or the name that was defined in
- * Unicode version 1.0, before the Unicode standard merged
- * with ISO-10646; or an "extended" name that gives each
- * Unicode code point a unique name.
- *
- * @see u_charName
- * @stable ICU 2.0
- */
-typedef enum UCharNameChoice {
-    U_UNICODE_CHAR_NAME,
-    U_UNICODE_10_CHAR_NAME,
-    U_EXTENDED_CHAR_NAME,
-    U_CHAR_NAME_ALIAS,          /**< Corrected name from NameAliases.txt. @stable ICU 4.4 */
-    U_CHAR_NAME_CHOICE_COUNT
-} UCharNameChoice;
-
-/**
- * Selector constants for u_getPropertyName() and
- * u_getPropertyValueName().  These selectors are used to choose which
- * name is returned for a given property or value.  All properties and
- * values have a long name.  Most have a short name, but some do not.
- * Unicode allows for additional names, beyond the long and short
- * name, which would be indicated by U_LONG_PROPERTY_NAME + i, where
- * i=1, 2,...
- *
- * @see u_getPropertyName()
- * @see u_getPropertyValueName()
- * @stable ICU 2.4
- */
-typedef enum UPropertyNameChoice {
-    U_SHORT_PROPERTY_NAME,
-    U_LONG_PROPERTY_NAME,
-    U_PROPERTY_NAME_CHOICE_COUNT
-} UPropertyNameChoice;
-
-/**
- * Decomposition Type constants.
- *
- * @see UCHAR_DECOMPOSITION_TYPE
- * @stable ICU 2.2
- */
-typedef enum UDecompositionType {
-    U_DT_NONE,              /*[none]*/ /*See note !!*/
-    U_DT_CANONICAL,         /*[can]*/
-    U_DT_COMPAT,            /*[com]*/
-    U_DT_CIRCLE,            /*[enc]*/
-    U_DT_FINAL,             /*[fin]*/
-    U_DT_FONT,              /*[font]*/
-    U_DT_FRACTION,          /*[fra]*/
-    U_DT_INITIAL,           /*[init]*/
-    U_DT_ISOLATED,          /*[iso]*/
-    U_DT_MEDIAL,            /*[med]*/
-    U_DT_NARROW,            /*[nar]*/
-    U_DT_NOBREAK,           /*[nb]*/
-    U_DT_SMALL,             /*[sml]*/
-    U_DT_SQUARE,            /*[sqr]*/
-    U_DT_SUB,               /*[sub]*/
-    U_DT_SUPER,             /*[sup]*/
-    U_DT_VERTICAL,          /*[vert]*/
-    U_DT_WIDE,              /*[wide]*/
-    U_DT_COUNT /* 18 */
-} UDecompositionType;
-
-/**
- * Joining Type constants.
- *
- * @see UCHAR_JOINING_TYPE
- * @stable ICU 2.2
- */
-typedef enum UJoiningType {
-    U_JT_NON_JOINING,       /*[U]*/ /*See note !!*/
-    U_JT_JOIN_CAUSING,      /*[C]*/
-    U_JT_DUAL_JOINING,      /*[D]*/
-    U_JT_LEFT_JOINING,      /*[L]*/
-    U_JT_RIGHT_JOINING,     /*[R]*/
-    U_JT_TRANSPARENT,       /*[T]*/
-    U_JT_COUNT /* 6 */
-} UJoiningType;
-
-/**
- * Joining Group constants.
- *
- * @see UCHAR_JOINING_GROUP
- * @stable ICU 2.2
- */
-typedef enum UJoiningGroup {
-    U_JG_NO_JOINING_GROUP,
-    U_JG_AIN,
-    U_JG_ALAPH,
-    U_JG_ALEF,
-    U_JG_BEH,
-    U_JG_BETH,
-    U_JG_DAL,
-    U_JG_DALATH_RISH,
-    U_JG_E,
-    U_JG_FEH,
-    U_JG_FINAL_SEMKATH,
-    U_JG_GAF,
-    U_JG_GAMAL,
-    U_JG_HAH,
-    U_JG_TEH_MARBUTA_GOAL,  /**< @stable ICU 4.6 */
-    U_JG_HAMZA_ON_HEH_GOAL=U_JG_TEH_MARBUTA_GOAL,
-    U_JG_HE,
-    U_JG_HEH,
-    U_JG_HEH_GOAL,
-    U_JG_HETH,
-    U_JG_KAF,
-    U_JG_KAPH,
-    U_JG_KNOTTED_HEH,
-    U_JG_LAM,
-    U_JG_LAMADH,
-    U_JG_MEEM,
-    U_JG_MIM,
-    U_JG_NOON,
-    U_JG_NUN,
-    U_JG_PE,
-    U_JG_QAF,
-    U_JG_QAPH,
-    U_JG_REH,
-    U_JG_REVERSED_PE,
-    U_JG_SAD,
-    U_JG_SADHE,
-    U_JG_SEEN,
-    U_JG_SEMKATH,
-    U_JG_SHIN,
-    U_JG_SWASH_KAF,
-    U_JG_SYRIAC_WAW,
-    U_JG_TAH,
-    U_JG_TAW,
-    U_JG_TEH_MARBUTA,
-    U_JG_TETH,
-    U_JG_WAW,
-    U_JG_YEH,
-    U_JG_YEH_BARREE,
-    U_JG_YEH_WITH_TAIL,
-    U_JG_YUDH,
-    U_JG_YUDH_HE,
-    U_JG_ZAIN,
-    U_JG_FE,        /**< @stable ICU 2.6 */
-    U_JG_KHAPH,     /**< @stable ICU 2.6 */
-    U_JG_ZHAIN,     /**< @stable ICU 2.6 */
-    U_JG_BURUSHASKI_YEH_BARREE, /**< @stable ICU 4.0 */
-    U_JG_FARSI_YEH, /**< @stable ICU 4.4 */
-    U_JG_NYA,       /**< @stable ICU 4.4 */
-    U_JG_COUNT
-} UJoiningGroup;
-
-/**
- * Grapheme Cluster Break constants.
- *
- * @see UCHAR_GRAPHEME_CLUSTER_BREAK
- * @stable ICU 3.4
- */
-typedef enum UGraphemeClusterBreak {
-    U_GCB_OTHER = 0,            /*[XX]*/ /*See note !!*/
-    U_GCB_CONTROL = 1,          /*[CN]*/
-    U_GCB_CR = 2,               /*[CR]*/
-    U_GCB_EXTEND = 3,           /*[EX]*/
-    U_GCB_L = 4,                /*[L]*/
-    U_GCB_LF = 5,               /*[LF]*/
-    U_GCB_LV = 6,               /*[LV]*/
-    U_GCB_LVT = 7,              /*[LVT]*/
-    U_GCB_T = 8,                /*[T]*/
-    U_GCB_V = 9,                /*[V]*/
-    U_GCB_SPACING_MARK = 10,    /*[SM]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */
-    U_GCB_PREPEND = 11,         /*[PP]*/
-    U_GCB_COUNT = 12
-} UGraphemeClusterBreak;
-
-/**
- * Word Break constants.
- * (UWordBreak is a pre-existing enum type in ubrk.h for word break status tags.)
- *
- * @see UCHAR_WORD_BREAK
- * @stable ICU 3.4
- */
-typedef enum UWordBreakValues {
-    U_WB_OTHER = 0,             /*[XX]*/ /*See note !!*/
-    U_WB_ALETTER = 1,           /*[LE]*/
-    U_WB_FORMAT = 2,            /*[FO]*/
-    U_WB_KATAKANA = 3,          /*[KA]*/
-    U_WB_MIDLETTER = 4,         /*[ML]*/
-    U_WB_MIDNUM = 5,            /*[MN]*/
-    U_WB_NUMERIC = 6,           /*[NU]*/
-    U_WB_EXTENDNUMLET = 7,      /*[EX]*/
-    U_WB_CR = 8,                /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */
-    U_WB_EXTEND = 9,            /*[Extend]*/
-    U_WB_LF = 10,               /*[LF]*/
-    U_WB_MIDNUMLET =11,         /*[MB]*/
-    U_WB_NEWLINE =12,           /*[NL]*/
-    U_WB_COUNT = 13
-} UWordBreakValues;
-
-/**
- * Sentence Break constants.
- *
- * @see UCHAR_SENTENCE_BREAK
- * @stable ICU 3.4
- */
-typedef enum USentenceBreak {
-    U_SB_OTHER = 0,             /*[XX]*/ /*See note !!*/
-    U_SB_ATERM = 1,             /*[AT]*/
-    U_SB_CLOSE = 2,             /*[CL]*/
-    U_SB_FORMAT = 3,            /*[FO]*/
-    U_SB_LOWER = 4,             /*[LO]*/
-    U_SB_NUMERIC = 5,           /*[NU]*/
-    U_SB_OLETTER = 6,           /*[LE]*/
-    U_SB_SEP = 7,               /*[SE]*/
-    U_SB_SP = 8,                /*[SP]*/
-    U_SB_STERM = 9,             /*[ST]*/
-    U_SB_UPPER = 10,            /*[UP]*/
-    U_SB_CR = 11,               /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */
-    U_SB_EXTEND = 12,           /*[EX]*/
-    U_SB_LF = 13,               /*[LF]*/
-    U_SB_SCONTINUE = 14,        /*[SC]*/
-    U_SB_COUNT = 15
-} USentenceBreak;
-
-/**
- * Line Break constants.
- *
- * @see UCHAR_LINE_BREAK
- * @stable ICU 2.2
- */
-typedef enum ULineBreak {
-    U_LB_UNKNOWN = 0,           /*[XX]*/ /*See note !!*/
-    U_LB_AMBIGUOUS = 1,         /*[AI]*/
-    U_LB_ALPHABETIC = 2,        /*[AL]*/
-    U_LB_BREAK_BOTH = 3,        /*[B2]*/
-    U_LB_BREAK_AFTER = 4,       /*[BA]*/
-    U_LB_BREAK_BEFORE = 5,      /*[BB]*/
-    U_LB_MANDATORY_BREAK = 6,   /*[BK]*/
-    U_LB_CONTINGENT_BREAK = 7,  /*[CB]*/
-    U_LB_CLOSE_PUNCTUATION = 8, /*[CL]*/
-    U_LB_COMBINING_MARK = 9,    /*[CM]*/
-    U_LB_CARRIAGE_RETURN = 10,   /*[CR]*/
-    U_LB_EXCLAMATION = 11,       /*[EX]*/
-    U_LB_GLUE = 12,              /*[GL]*/
-    U_LB_HYPHEN = 13,            /*[HY]*/
-    U_LB_IDEOGRAPHIC = 14,       /*[ID]*/
-    U_LB_INSEPERABLE = 15,
-    /** Renamed from the misspelled "inseperable" in Unicode 4.0.1/ICU 3.0 @stable ICU 3.0 */
-    U_LB_INSEPARABLE=U_LB_INSEPERABLE,/*[IN]*/
-    U_LB_INFIX_NUMERIC = 16,     /*[IS]*/
-    U_LB_LINE_FEED = 17,         /*[LF]*/
-    U_LB_NONSTARTER = 18,        /*[NS]*/
-    U_LB_NUMERIC = 19,           /*[NU]*/
-    U_LB_OPEN_PUNCTUATION = 20,  /*[OP]*/
-    U_LB_POSTFIX_NUMERIC = 21,   /*[PO]*/
-    U_LB_PREFIX_NUMERIC = 22,    /*[PR]*/
-    U_LB_QUOTATION = 23,         /*[QU]*/
-    U_LB_COMPLEX_CONTEXT = 24,   /*[SA]*/
-    U_LB_SURROGATE = 25,         /*[SG]*/
-    U_LB_SPACE = 26,             /*[SP]*/
-    U_LB_BREAK_SYMBOLS = 27,     /*[SY]*/
-    U_LB_ZWSPACE = 28,           /*[ZW]*/
-    U_LB_NEXT_LINE = 29,         /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */
-    U_LB_WORD_JOINER = 30,       /*[WJ]*/
-    U_LB_H2 = 31,                /*[H2]*/ /* from here on: new in Unicode 4.1/ICU 3.4 */
-    U_LB_H3 = 32,                /*[H3]*/
-    U_LB_JL = 33,                /*[JL]*/
-    U_LB_JT = 34,                /*[JT]*/
-    U_LB_JV = 35,                /*[JV]*/
-    U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */
-    U_LB_COUNT = 37
-} ULineBreak;
-
-/**
- * Numeric Type constants.
- *
- * @see UCHAR_NUMERIC_TYPE
- * @stable ICU 2.2
- */
-typedef enum UNumericType {
-    U_NT_NONE,              /*[None]*/ /*See note !!*/
-    U_NT_DECIMAL,           /*[de]*/
-    U_NT_DIGIT,             /*[di]*/
-    U_NT_NUMERIC,           /*[nu]*/
-    U_NT_COUNT
-} UNumericType;
-
-/**
- * Hangul Syllable Type constants.
- *
- * @see UCHAR_HANGUL_SYLLABLE_TYPE
- * @stable ICU 2.6
- */
-typedef enum UHangulSyllableType {
-    U_HST_NOT_APPLICABLE,   /*[NA]*/ /*See note !!*/
-    U_HST_LEADING_JAMO,     /*[L]*/
-    U_HST_VOWEL_JAMO,       /*[V]*/
-    U_HST_TRAILING_JAMO,    /*[T]*/
-    U_HST_LV_SYLLABLE,      /*[LV]*/
-    U_HST_LVT_SYLLABLE,     /*[LVT]*/
-    U_HST_COUNT
-} UHangulSyllableType;
-
-/**
- * Check a binary Unicode property for a code point.
- *
- * Unicode, especially in version 3.2, defines many more properties than the
- * original set in UnicodeData.txt.
- *
- * The properties APIs are intended to reflect Unicode properties as defined
- * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
- * For details about the properties see http://www.unicode.org/ucd/ .
- * For names of Unicode properties see the UCD file PropertyAliases.txt.
- *
- * Important: If ICU is built with UCD files from Unicode versions below 3.2,
- * then properties marked with "new in Unicode 3.2" are not or not fully available.
- *
- * @param c Code point to test.
- * @param which UProperty selector constant, identifies which binary property to check.
- *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT.
- * @return TRUE or FALSE according to the binary Unicode property value for c.
- *         Also FALSE if 'which' is out of bounds or if the Unicode version
- *         does not have data for the property at all, or not for this code point.
- *
- * @see UProperty
- * @see u_getIntPropertyValue
- * @see u_getUnicodeVersion
- * @stable ICU 2.1
- */
-U_STABLE UBool U_EXPORT2
-u_hasBinaryProperty(UChar32 c, UProperty which);
-
-/**
- * Check if a code point has the Alphabetic Unicode property.
- * Same as u_hasBinaryProperty(c, UCHAR_ALPHABETIC).
- * This is different from u_isalpha!
- * @param c Code point to test
- * @return true if the code point has the Alphabetic Unicode property, false otherwise
- *
- * @see UCHAR_ALPHABETIC
- * @see u_isalpha
- * @see u_hasBinaryProperty
- * @stable ICU 2.1
- */
-U_STABLE UBool U_EXPORT2
-u_isUAlphabetic(UChar32 c);
-
-/**
- * Check if a code point has the Lowercase Unicode property.
- * Same as u_hasBinaryProperty(c, UCHAR_LOWERCASE).
- * This is different from u_islower!
- * @param c Code point to test
- * @return true if the code point has the Lowercase Unicode property, false otherwise
- *
- * @see UCHAR_LOWERCASE
- * @see u_islower
- * @see u_hasBinaryProperty
- * @stable ICU 2.1
- */
-U_STABLE UBool U_EXPORT2
-u_isULowercase(UChar32 c);
-
-/**
- * Check if a code point has the Uppercase Unicode property.
- * Same as u_hasBinaryProperty(c, UCHAR_UPPERCASE).
- * This is different from u_isupper!
- * @param c Code point to test
- * @return true if the code point has the Uppercase Unicode property, false otherwise
- *
- * @see UCHAR_UPPERCASE
- * @see u_isupper
- * @see u_hasBinaryProperty
- * @stable ICU 2.1
- */
-U_STABLE UBool U_EXPORT2
-u_isUUppercase(UChar32 c);
-
-/**
- * Check if a code point has the White_Space Unicode property.
- * Same as u_hasBinaryProperty(c, UCHAR_WHITE_SPACE).
- * This is different from both u_isspace and u_isWhitespace!
- *
- * Note: There are several ICU whitespace functions; please see the uchar.h
- * file documentation for a detailed comparison.
- *
- * @param c Code point to test
- * @return true if the code point has the White_Space Unicode property, false otherwise.
- *
- * @see UCHAR_WHITE_SPACE
- * @see u_isWhitespace
- * @see u_isspace
- * @see u_isJavaSpaceChar
- * @see u_hasBinaryProperty
- * @stable ICU 2.1
- */
-U_STABLE UBool U_EXPORT2
-u_isUWhiteSpace(UChar32 c);
-
-/**
- * Get the property value for an enumerated or integer Unicode property for a code point.
- * Also returns binary and mask property values.
- *
- * Unicode, especially in version 3.2, defines many more properties than the
- * original set in UnicodeData.txt.
- *
- * The properties APIs are intended to reflect Unicode properties as defined
- * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
- * For details about the properties see http://www.unicode.org/ .
- * For names of Unicode properties see the UCD file PropertyAliases.txt.
- *
- * Sample usage:
- * UEastAsianWidth ea=(UEastAsianWidth)u_getIntPropertyValue(c, UCHAR_EAST_ASIAN_WIDTH);
- * UBool b=(UBool)u_getIntPropertyValue(c, UCHAR_IDEOGRAPHIC);
- *
- * @param c Code point to test.
- * @param which UProperty selector constant, identifies which property to check.
- *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
- *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
- *        or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
- * @return Numeric value that is directly the property value or,
- *         for enumerated properties, corresponds to the numeric value of the enumerated
- *         constant of the respective property value enumeration type
- *         (cast to enum type if necessary).
- *         Returns 0 or 1 (for FALSE/TRUE) for binary Unicode properties.
- *         Returns a bit-mask for mask properties.
- *         Returns 0 if 'which' is out of bounds or if the Unicode version
- *         does not have data for the property at all, or not for this code point.
- *
- * @see UProperty
- * @see u_hasBinaryProperty
- * @see u_getIntPropertyMinValue
- * @see u_getIntPropertyMaxValue
- * @see u_getUnicodeVersion
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_getIntPropertyValue(UChar32 c, UProperty which);
-
-/**
- * Get the minimum value for an enumerated/integer/binary Unicode property.
- * Can be used together with u_getIntPropertyMaxValue
- * to allocate arrays of UnicodeSet or similar.
- *
- * @param which UProperty selector constant, identifies which binary property to check.
- *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
- *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT.
- * @return Minimum value returned by u_getIntPropertyValue for a Unicode property.
- *         0 if the property selector is out of range.
- *
- * @see UProperty
- * @see u_hasBinaryProperty
- * @see u_getUnicodeVersion
- * @see u_getIntPropertyMaxValue
- * @see u_getIntPropertyValue
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_getIntPropertyMinValue(UProperty which);
-
-/**
- * Get the maximum value for an enumerated/integer/binary Unicode property.
- * Can be used together with u_getIntPropertyMinValue
- * to allocate arrays of UnicodeSet or similar.
- *
- * Examples for min/max values (for Unicode 3.2):
- *
- * - UCHAR_BIDI_CLASS:    0/18 (U_LEFT_TO_RIGHT/U_BOUNDARY_NEUTRAL)
- * - UCHAR_SCRIPT:        0/45 (USCRIPT_COMMON/USCRIPT_TAGBANWA)
- * - UCHAR_IDEOGRAPHIC:   0/1  (FALSE/TRUE)
- *
- * For undefined UProperty constant values, min/max values will be 0/-1.
- *
- * @param which UProperty selector constant, identifies which binary property to check.
- *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
- *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT.
- * @return Maximum value returned by u_getIntPropertyValue for a Unicode property.
- *         <=0 if the property selector is out of range.
- *
- * @see UProperty
- * @see u_hasBinaryProperty
- * @see u_getUnicodeVersion
- * @see u_getIntPropertyMaxValue
- * @see u_getIntPropertyValue
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_getIntPropertyMaxValue(UProperty which);
-
-/**
- * Get the numeric value for a Unicode code point as defined in the
- * Unicode Character Database.
- *
- * A "double" return type is necessary because
- * some numeric values are fractions, negative, or too large for int32_t.
- *
- * For characters without any numeric values in the Unicode Character Database,
- * this function will return U_NO_NUMERIC_VALUE.
- *
- * Similar to java.lang.Character.getNumericValue(), but u_getNumericValue()
- * also supports negative values, large values, and fractions,
- * while Java's getNumericValue() returns values 10..35 for ASCII letters.
- *
- * @param c Code point to get the numeric value for.
- * @return Numeric value of c, or U_NO_NUMERIC_VALUE if none is defined.
- *
- * @see U_NO_NUMERIC_VALUE
- * @stable ICU 2.2
- */
-U_STABLE double U_EXPORT2
-u_getNumericValue(UChar32 c);
-
-/**
- * Special value that is returned by u_getNumericValue when
- * no numeric value is defined for a code point.
- *
- * @see u_getNumericValue
- * @stable ICU 2.2
- */
-#define U_NO_NUMERIC_VALUE ((double)-123456789.)
-
-/**
- * Determines whether the specified code point has the general category "Ll"
- * (lowercase letter).
- *
- * Same as java.lang.Character.isLowerCase().
- *
- * This misses some characters that are also lowercase but
- * have a different general category value.
- * In order to include those, use UCHAR_LOWERCASE.
- *
- * In addition to being equivalent to a Java function, this also serves
- * as a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is an Ll lowercase letter
- *
- * @see UCHAR_LOWERCASE
- * @see u_isupper
- * @see u_istitle
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_islower(UChar32 c);
-
-/**
- * Determines whether the specified code point has the general category "Lu"
- * (uppercase letter).
- *
- * Same as java.lang.Character.isUpperCase().
- *
- * This misses some characters that are also uppercase but
- * have a different general category value.
- * In order to include those, use UCHAR_UPPERCASE.
- *
- * In addition to being equivalent to a Java function, this also serves
- * as a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is an Lu uppercase letter
- *
- * @see UCHAR_UPPERCASE
- * @see u_islower
- * @see u_istitle
- * @see u_tolower
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isupper(UChar32 c);
-
-/**
- * Determines whether the specified code point is a titlecase letter.
- * True for general category "Lt" (titlecase letter).
- *
- * Same as java.lang.Character.isTitleCase().
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is an Lt titlecase letter
- *
- * @see u_isupper
- * @see u_islower
- * @see u_totitle
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_istitle(UChar32 c);
-
-/**
- * Determines whether the specified code point is a digit character according to Java.
- * True for characters with general category "Nd" (decimal digit numbers).
- * Beginning with Unicode 4, this is the same as
- * testing for the Numeric_Type of Decimal.
- *
- * Same as java.lang.Character.isDigit().
- *
- * In addition to being equivalent to a Java function, this also serves
- * as a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a digit character according to Character.isDigit()
- *
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isdigit(UChar32 c);
-
-/**
- * Determines whether the specified code point is a letter character.
- * True for general categories "L" (letters).
- *
- * Same as java.lang.Character.isLetter().
- *
- * In addition to being equivalent to a Java function, this also serves
- * as a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a letter character
- *
- * @see u_isdigit
- * @see u_isalnum
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isalpha(UChar32 c);
-
-/**
- * Determines whether the specified code point is an alphanumeric character
- * (letter or digit) according to Java.
- * True for characters with general categories
- * "L" (letters) and "Nd" (decimal digit numbers).
- *
- * Same as java.lang.Character.isLetterOrDigit().
- *
- * In addition to being equivalent to a Java function, this also serves
- * as a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is an alphanumeric character according to Character.isLetterOrDigit()
- *
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isalnum(UChar32 c);
-
-/**
- * Determines whether the specified code point is a hexadecimal digit.
- * This is equivalent to u_digit(c, 16)>=0.
- * True for characters with general category "Nd" (decimal digit numbers)
- * as well as Latin letters a-f and A-F in both ASCII and Fullwidth ASCII.
- * (That is, for letters with code points
- * 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.)
- *
- * In order to narrow the definition of hexadecimal digits to only ASCII
- * characters, use (c<=0x7f && u_isxdigit(c)).
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a hexadecimal digit
- *
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-u_isxdigit(UChar32 c);
-
-/**
- * Determines whether the specified code point is a punctuation character.
- * True for characters with general categories "P" (punctuation).
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a punctuation character
- *
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-u_ispunct(UChar32 c);
-
-/**
- * Determines whether the specified code point is a "graphic" character
- * (printable, excluding spaces).
- * TRUE for all characters except those with general categories
- * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates),
- * "Cn" (unassigned), and "Z" (separators).
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a "graphic" character
- *
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-u_isgraph(UChar32 c);
-
-/**
- * Determines whether the specified code point is a "blank" or "horizontal space",
- * a character that visibly separates words on a line.
- * The following are equivalent definitions:
- *
- * TRUE for Unicode White_Space characters except for "vertical space controls"
- * where "vertical space controls" are the following characters:
- * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS)
- *
- * same as
- *
- * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators)
- * except Zero Width Space (ZWSP, U+200B).
- *
- * Note: There are several ICU whitespace functions; please see the uchar.h
- * file documentation for a detailed comparison.
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a "blank"
- *
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-u_isblank(UChar32 c);
-
-/**
- * Determines whether the specified code point is "defined",
- * which usually means that it is assigned a character.
- * True for general categories other than "Cn" (other, not assigned),
- * i.e., true for all code points mentioned in UnicodeData.txt.
- *
- * Note that non-character code points (e.g., U+FDD0) are not "defined"
- * (they are Cn), but surrogate code points are "defined" (Cs).
- *
- * Same as java.lang.Character.isDefined().
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is assigned a character
- *
- * @see u_isdigit
- * @see u_isalpha
- * @see u_isalnum
- * @see u_isupper
- * @see u_islower
- * @see u_istitle
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isdefined(UChar32 c);
-
-/**
- * Determines if the specified character is a space character or not.
- *
- * Note: There are several ICU whitespace functions; please see the uchar.h
- * file documentation for a detailed comparison.
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c    the character to be tested
- * @return  true if the character is a space character; false otherwise.
- *
- * @see u_isJavaSpaceChar
- * @see u_isWhitespace
- * @see u_isUWhiteSpace
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isspace(UChar32 c);
-
-/**
- * Determine if the specified code point is a space character according to Java.
- * True for characters with general categories "Z" (separators),
- * which does not include control codes (e.g., TAB or Line Feed).
- *
- * Same as java.lang.Character.isSpaceChar().
- *
- * Note: There are several ICU whitespace functions; please see the uchar.h
- * file documentation for a detailed comparison.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a space character according to Character.isSpaceChar()
- *
- * @see u_isspace
- * @see u_isWhitespace
- * @see u_isUWhiteSpace
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-u_isJavaSpaceChar(UChar32 c);
-
-/**
- * Determines if the specified code point is a whitespace character according to Java/ICU.
- * A character is considered to be a Java whitespace character if and only
- * if it satisfies one of the following criteria:
- *
- * - It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not
- *      also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP).
- * - It is U+0009 HORIZONTAL TABULATION.
- * - It is U+000A LINE FEED.
- * - It is U+000B VERTICAL TABULATION.
- * - It is U+000C FORM FEED.
- * - It is U+000D CARRIAGE RETURN.
- * - It is U+001C FILE SEPARATOR.
- * - It is U+001D GROUP SEPARATOR.
- * - It is U+001E RECORD SEPARATOR.
- * - It is U+001F UNIT SEPARATOR.
- *
- * This API tries to sync with the semantics of Java's
- * java.lang.Character.isWhitespace(), but it may not return
- * the exact same results because of the Unicode version
- * difference.
- *
- * Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs)
- * to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false.
- * See http://www.unicode.org/versions/Unicode4.0.1/
- *
- * Note: There are several ICU whitespace functions; please see the uchar.h
- * file documentation for a detailed comparison.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a whitespace character according to Java/ICU
- *
- * @see u_isspace
- * @see u_isJavaSpaceChar
- * @see u_isUWhiteSpace
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isWhitespace(UChar32 c);
-
-/**
- * Determines whether the specified code point is a control character
- * (as defined by this function).
- * A control character is one of the following:
- * - ISO 8-bit control character (U+0000..U+001f and U+007f..U+009f)
- * - U_CONTROL_CHAR (Cc)
- * - U_FORMAT_CHAR (Cf)
- * - U_LINE_SEPARATOR (Zl)
- * - U_PARAGRAPH_SEPARATOR (Zp)
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a control character
- *
- * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
- * @see u_isprint
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_iscntrl(UChar32 c);
-
-/**
- * Determines whether the specified code point is an ISO control code.
- * True for U+0000..U+001f and U+007f..U+009f (general category "Cc").
- *
- * Same as java.lang.Character.isISOControl().
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is an ISO control code
- *
- * @see u_iscntrl
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-u_isISOControl(UChar32 c);
-
-/**
- * Determines whether the specified code point is a printable character.
- * True for general categories <em>other</em> than "C" (controls).
- *
- * This is a C/POSIX migration function.
- * See the comments about C/POSIX character classification functions in the
- * documentation at the top of this header file.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a printable character
- *
- * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
- * @see u_iscntrl
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isprint(UChar32 c);
-
-/**
- * Determines whether the specified code point is a base character.
- * True for general categories "L" (letters), "N" (numbers),
- * "Mc" (spacing combining marks), and "Me" (enclosing marks).
- *
- * Note that this is different from the Unicode definition in
- * chapter 3.5, conformance clause D13,
- * which defines base characters to be all characters (not Cn)
- * that do not graphically combine with preceding characters (M)
- * and that are neither control (Cc) or format (Cf) characters.
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is a base character according to this function
- *
- * @see u_isalpha
- * @see u_isdigit
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isbase(UChar32 c);
-
-/**
- * Returns the bidirectional category value for the code point,
- * which is used in the Unicode bidirectional algorithm
- * (UAX #9 http://www.unicode.org/reports/tr9/).
- * Note that some <em>unassigned</em> code points have bidi values
- * of R or AL because they are in blocks that are reserved
- * for Right-To-Left scripts.
- *
- * Same as java.lang.Character.getDirectionality()
- *
- * @param c the code point to be tested
- * @return the bidirectional category (UCharDirection) value
- *
- * @see UCharDirection
- * @stable ICU 2.0
- */
-U_STABLE UCharDirection U_EXPORT2
-u_charDirection(UChar32 c);
-
-/**
- * Determines whether the code point has the Bidi_Mirrored property.
- * This property is set for characters that are commonly used in
- * Right-To-Left contexts and need to be displayed with a "mirrored"
- * glyph.
- *
- * Same as java.lang.Character.isMirrored().
- * Same as UCHAR_BIDI_MIRRORED
- *
- * @param c the code point to be tested
- * @return TRUE if the character has the Bidi_Mirrored property
- *
- * @see UCHAR_BIDI_MIRRORED
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isMirrored(UChar32 c);
-
-/**
- * Maps the specified character to a "mirror-image" character.
- * For characters with the Bidi_Mirrored property, implementations
- * sometimes need a "poor man's" mapping to another Unicode
- * character (code point) such that the default glyph may serve
- * as the mirror-image of the default glyph of the specified
- * character. This is useful for text conversion to and from
- * codepages with visual order, and for displays without glyph
- * selecetion capabilities.
- *
- * @param c the code point to be mapped
- * @return another Unicode code point that may serve as a mirror-image
- *         substitute, or c itself if there is no such mapping or c
- *         does not have the Bidi_Mirrored property
- *
- * @see UCHAR_BIDI_MIRRORED
- * @see u_isMirrored
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_charMirror(UChar32 c);
-
-/**
- * Returns the general category value for the code point.
- *
- * Same as java.lang.Character.getType().
- *
- * @param c the code point to be tested
- * @return the general category (UCharCategory) value
- *
- * @see UCharCategory
- * @stable ICU 2.0
- */
-U_STABLE int8_t U_EXPORT2
-u_charType(UChar32 c);
-
-/**
- * Get a single-bit bit set for the general category of a character.
- * This bit set can be compared bitwise with U_GC_SM_MASK, U_GC_L_MASK, etc.
- * Same as U_MASK(u_charType(c)).
- *
- * @param c the code point to be tested
- * @return a single-bit mask corresponding to the general category (UCharCategory) value
- *
- * @see u_charType
- * @see UCharCategory
- * @see U_GC_CN_MASK
- * @stable ICU 2.1
- */
-#define U_GET_GC_MASK(c) U_MASK(u_charType(c))
-
-/**
- * Callback from u_enumCharTypes(), is called for each contiguous range
- * of code points c (where start<=c<limit)
- * with the same Unicode general category ("character type").
- *
- * The callback function can stop the enumeration by returning FALSE.
- *
- * @param context an opaque pointer, as passed into utrie_enum()
- * @param start the first code point in a contiguous range with value
- * @param limit one past the last code point in a contiguous range with value
- * @param type the general category for all code points in [start..limit[
- * @return FALSE to stop the enumeration
- *
- * @stable ICU 2.1
- * @see UCharCategory
- * @see u_enumCharTypes
- */
-typedef UBool U_CALLCONV
-UCharEnumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type);
-
-/**
- * Enumerate efficiently all code points with their Unicode general categories.
- *
- * This is useful for building data structures (e.g., UnicodeSet's),
- * for enumerating all assigned code points (type!=U_UNASSIGNED), etc.
- *
- * For each contiguous range of code points with a given general category ("character type"),
- * the UCharEnumTypeRange function is called.
- * Adjacent ranges have different types.
- * The Unicode Standard guarantees that the numeric value of the type is 0..31.
- *
- * @param enumRange a pointer to a function that is called for each contiguous range
- *                  of code points with the same general category
- * @param context an opaque pointer that is passed on to the callback function
- *
- * @stable ICU 2.1
- * @see UCharCategory
- * @see UCharEnumTypeRange
- */
-U_STABLE void U_EXPORT2
-u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context);
-
-#if !UCONFIG_NO_NORMALIZATION
-
-/**
- * Returns the combining class of the code point as specified in UnicodeData.txt.
- *
- * @param c the code point of the character
- * @return the combining class of the character
- * @stable ICU 2.0
- */
-U_STABLE uint8_t U_EXPORT2
-u_getCombiningClass(UChar32 c);
-
-#endif
-
-/**
- * Returns the decimal digit value of a decimal digit character.
- * Such characters have the general category "Nd" (decimal digit numbers)
- * and a Numeric_Type of Decimal.
- *
- * Unlike ICU releases before 2.6, no digit values are returned for any
- * Han characters because Han number characters are often used with a special
- * Chinese-style number format (with characters for powers of 10 in between)
- * instead of in decimal-positional notation.
- * Unicode 4 explicitly assigns Han number characters the Numeric_Type
- * Numeric instead of Decimal.
- * See Jitterbug 1483 for more details.
- *
- * Use u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE) and u_getNumericValue()
- * for complete numeric Unicode properties.
- *
- * @param c the code point for which to get the decimal digit value
- * @return the decimal digit value of c,
- *         or -1 if c is not a decimal digit character
- *
- * @see u_getNumericValue
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_charDigitValue(UChar32 c);
-
-/**
- * Returns the Unicode allocation block that contains the character.
- *
- * @param c the code point to be tested
- * @return the block value (UBlockCode) for c
- *
- * @see UBlockCode
- * @stable ICU 2.0
- */
-U_STABLE UBlockCode U_EXPORT2
-ublock_getCode(UChar32 c);
-
-/**
- * Retrieve the name of a Unicode character.
- * Depending on <code>nameChoice</code>, the character name written
- * into the buffer is the "modern" name or the name that was defined
- * in Unicode version 1.0.
- * The name contains only "invariant" characters
- * like A-Z, 0-9, space, and '-'.
- * Unicode 1.0 names are only retrieved if they are different from the modern
- * names and if the data file contains the data for them. gennames may or may
- * not be called with a command line option to include 1.0 names in unames.dat.
- *
- * @param code The character (code point) for which to get the name.
- *             It must be <code>0<=code<=0x10ffff</code>.
- * @param nameChoice Selector for which name to get.
- * @param buffer Destination address for copying the name.
- *               The name will always be zero-terminated.
- *               If there is no name, then the buffer will be set to the empty string.
- * @param bufferLength <code>==sizeof(buffer)</code>
- * @param pErrorCode Pointer to a UErrorCode variable;
- *        check for <code>U_SUCCESS()</code> after <code>u_charName()</code>
- *        returns.
- * @return The length of the name, or 0 if there is no name for this character.
- *         If the bufferLength is less than or equal to the length, then the buffer
- *         contains the truncated name and the returned length indicates the full
- *         length of the name.
- *         The length does not include the zero-termination.
- *
- * @see UCharNameChoice
- * @see u_charFromName
- * @see u_enumCharNames
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_charName(UChar32 code, UCharNameChoice nameChoice,
-           char *buffer, int32_t bufferLength,
-           UErrorCode *pErrorCode);
-
-/**
- * Get the ISO 10646 comment for a character.
- * The ISO 10646 comment is an informative field in the Unicode Character
- * Database (UnicodeData.txt field 11) and is from the ISO 10646 names list.
- *
- * Note: Unicode 5.2 removes all ISO comment data, resulting in empty strings
- * returned for all characters.
- *
- * @param c The character (code point) for which to get the ISO comment.
- *             It must be <code>0<=c<=0x10ffff</code>.
- * @param dest Destination address for copying the comment.
- *             The comment will be zero-terminated if possible.
- *             If there is no comment, then the buffer will be set to the empty string.
- * @param destCapacity <code>==sizeof(dest)</code>
- * @param pErrorCode Pointer to a UErrorCode variable;
- *        check for <code>U_SUCCESS()</code> after <code>u_getISOComment()</code>
- *        returns.
- * @return The length of the comment, or 0 if there is no comment for this character.
- *         If the destCapacity is less than or equal to the length, then the buffer
- *         contains the truncated name and the returned length indicates the full
- *         length of the name.
- *         The length does not include the zero-termination.
- *
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_getISOComment(UChar32 c,
-                char *dest, int32_t destCapacity,
-                UErrorCode *pErrorCode);
-
-/**
- * Find a Unicode character by its name and return its code point value.
- * The name is matched exactly and completely.
- * If the name does not correspond to a code point, <i>pErrorCode</i>
- * is set to <code>U_INVALID_CHAR_FOUND</code>.
- * A Unicode 1.0 name is matched only if it differs from the modern name.
- * Unicode names are all uppercase. Extended names are lowercase followed
- * by an uppercase hexadecimal number, and within angle brackets.
- *
- * @param nameChoice Selector for which name to match.
- * @param name The name to match.
- * @param pErrorCode Pointer to a UErrorCode variable
- * @return The Unicode value of the code point with the given name,
- *         or an undefined value if there is no such code point.
- *
- * @see UCharNameChoice
- * @see u_charName
- * @see u_enumCharNames
- * @stable ICU 1.7
- */
-U_STABLE UChar32 U_EXPORT2
-u_charFromName(UCharNameChoice nameChoice,
-               const char *name,
-               UErrorCode *pErrorCode);
-
-/**
- * Type of a callback function for u_enumCharNames() that gets called
- * for each Unicode character with the code point value and
- * the character name.
- * If such a function returns FALSE, then the enumeration is stopped.
- *
- * @param context The context pointer that was passed to u_enumCharNames().
- * @param code The Unicode code point for the character with this name.
- * @param nameChoice Selector for which kind of names is enumerated.
- * @param name The character's name, zero-terminated.
- * @param length The length of the name.
- * @return TRUE if the enumeration should continue, FALSE to stop it.
- *
- * @see UCharNameChoice
- * @see u_enumCharNames
- * @stable ICU 1.7
- */
-typedef UBool U_CALLCONV UEnumCharNamesFn(void *context,
-                               UChar32 code,
-                               UCharNameChoice nameChoice,
-                               const char *name,
-                               int32_t length);
-
-/**
- * Enumerate all assigned Unicode characters between the start and limit
- * code points (start inclusive, limit exclusive) and call a function
- * for each, passing the code point value and the character name.
- * For Unicode 1.0 names, only those are enumerated that differ from the
- * modern names.
- *
- * @param start The first code point in the enumeration range.
- * @param limit One more than the last code point in the enumeration range
- *              (the first one after the range).
- * @param fn The function that is to be called for each character name.
- * @param context An arbitrary pointer that is passed to the function.
- * @param nameChoice Selector for which kind of names to enumerate.
- * @param pErrorCode Pointer to a UErrorCode variable
- *
- * @see UCharNameChoice
- * @see UEnumCharNamesFn
- * @see u_charName
- * @see u_charFromName
- * @stable ICU 1.7
- */
-U_STABLE void U_EXPORT2
-u_enumCharNames(UChar32 start, UChar32 limit,
-                UEnumCharNamesFn *fn,
-                void *context,
-                UCharNameChoice nameChoice,
-                UErrorCode *pErrorCode);
-
-/**
- * Return the Unicode name for a given property, as given in the
- * Unicode database file PropertyAliases.txt.
- *
- * In addition, this function maps the property
- * UCHAR_GENERAL_CATEGORY_MASK to the synthetic names "gcm" /
- * "General_Category_Mask".  These names are not in
- * PropertyAliases.txt.
- *
- * @param property UProperty selector other than UCHAR_INVALID_CODE.
- *         If out of range, NULL is returned.
- *
- * @param nameChoice selector for which name to get.  If out of range,
- *         NULL is returned.  All properties have a long name.  Most
- *         have a short name, but some do not.  Unicode allows for
- *         additional names; if present these will be returned by
- *         U_LONG_PROPERTY_NAME + i, where i=1, 2,...
- *
- * @return a pointer to the name, or NULL if either the
- *         property or the nameChoice is out of range.  If a given
- *         nameChoice returns NULL, then all larger values of
- *         nameChoice will return NULL, with one exception: if NULL is
- *         returned for U_SHORT_PROPERTY_NAME, then
- *         U_LONG_PROPERTY_NAME (and higher) may still return a
- *         non-NULL value.  The returned pointer is valid until
- *         u_cleanup() is called.
- *
- * @see UProperty
- * @see UPropertyNameChoice
- * @stable ICU 2.4
- */
-U_STABLE const char* U_EXPORT2
-u_getPropertyName(UProperty property,
-                  UPropertyNameChoice nameChoice);
-
-/**
- * Return the UProperty enum for a given property name, as specified
- * in the Unicode database file PropertyAliases.txt.  Short, long, and
- * any other variants are recognized.
- *
- * In addition, this function maps the synthetic names "gcm" /
- * "General_Category_Mask" to the property
- * UCHAR_GENERAL_CATEGORY_MASK.  These names are not in
- * PropertyAliases.txt.
- *
- * @param alias the property name to be matched.  The name is compared
- *         using "loose matching" as described in PropertyAliases.txt.
- *
- * @return a UProperty enum, or UCHAR_INVALID_CODE if the given name
- *         does not match any property.
- *
- * @see UProperty
- * @stable ICU 2.4
- */
-U_STABLE UProperty U_EXPORT2
-u_getPropertyEnum(const char* alias);
-
-/**
- * Return the Unicode name for a given property value, as given in the
- * Unicode database file PropertyValueAliases.txt.
- *
- * Note: Some of the names in PropertyValueAliases.txt can only be
- * retrieved using UCHAR_GENERAL_CATEGORY_MASK, not
- * UCHAR_GENERAL_CATEGORY.  These include: "C" / "Other", "L" /
- * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
- * / "Punctuation", "S" / "Symbol", and "Z" / "Separator".
- *
- * @param property UProperty selector constant.
- *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
- *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
- *        or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
- *        If out of range, NULL is returned.
- *
- * @param value selector for a value for the given property.  If out
- *         of range, NULL is returned.  In general, valid values range
- *         from 0 up to some maximum.  There are a few exceptions:
- *         (1.) UCHAR_BLOCK values begin at the non-zero value
- *         UBLOCK_BASIC_LATIN.  (2.)  UCHAR_CANONICAL_COMBINING_CLASS
- *         values are not contiguous and range from 0..240.  (3.)
- *         UCHAR_GENERAL_CATEGORY_MASK values are not values of
- *         UCharCategory, but rather mask values produced by
- *         U_GET_GC_MASK().  This allows grouped categories such as
- *         [:L:] to be represented.  Mask values range
- *         non-contiguously from 1..U_GC_P_MASK.
- *
- * @param nameChoice selector for which name to get.  If out of range,
- *         NULL is returned.  All values have a long name.  Most have
- *         a short name, but some do not.  Unicode allows for
- *         additional names; if present these will be returned by
- *         U_LONG_PROPERTY_NAME + i, where i=1, 2,...
-
- * @return a pointer to the name, or NULL if either the
- *         property or the nameChoice is out of range.  If a given
- *         nameChoice returns NULL, then all larger values of
- *         nameChoice will return NULL, with one exception: if NULL is
- *         returned for U_SHORT_PROPERTY_NAME, then
- *         U_LONG_PROPERTY_NAME (and higher) may still return a
- *         non-NULL value.  The returned pointer is valid until
- *         u_cleanup() is called.
- *
- * @see UProperty
- * @see UPropertyNameChoice
- * @stable ICU 2.4
- */
-U_STABLE const char* U_EXPORT2
-u_getPropertyValueName(UProperty property,
-                       int32_t value,
-                       UPropertyNameChoice nameChoice);
-
-/**
- * Return the property value integer for a given value name, as
- * specified in the Unicode database file PropertyValueAliases.txt.
- * Short, long, and any other variants are recognized.
- *
- * Note: Some of the names in PropertyValueAliases.txt will only be
- * recognized with UCHAR_GENERAL_CATEGORY_MASK, not
- * UCHAR_GENERAL_CATEGORY.  These include: "C" / "Other", "L" /
- * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
- * / "Punctuation", "S" / "Symbol", and "Z" / "Separator".
- *
- * @param property UProperty selector constant.
- *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
- *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
- *        or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
- *        If out of range, UCHAR_INVALID_CODE is returned.
- *
- * @param alias the value name to be matched.  The name is compared
- *         using "loose matching" as described in
- *         PropertyValueAliases.txt.
- *
- * @return a value integer or UCHAR_INVALID_CODE if the given name
- *         does not match any value of the given property, or if the
- *         property is invalid.  Note: UCHAR_GENERAL_CATEGORY_MASK values
- *         are not values of UCharCategory, but rather mask values
- *         produced by U_GET_GC_MASK().  This allows grouped
- *         categories such as [:L:] to be represented.
- *
- * @see UProperty
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-u_getPropertyValueEnum(UProperty property,
-                       const char* alias);
-
-/**
- * Determines if the specified character is permissible as the
- * first character in an identifier according to Unicode
- * (The Unicode Standard, Version 3.0, chapter 5.16 Identifiers).
- * True for characters with general categories "L" (letters) and "Nl" (letter numbers).
- *
- * Same as java.lang.Character.isUnicodeIdentifierStart().
- * Same as UCHAR_ID_START
- *
- * @param c the code point to be tested
- * @return TRUE if the code point may start an identifier
- *
- * @see UCHAR_ID_START
- * @see u_isalpha
- * @see u_isIDPart
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isIDStart(UChar32 c);
-
-/**
- * Determines if the specified character is permissible
- * in an identifier according to Java.
- * True for characters with general categories "L" (letters),
- * "Nl" (letter numbers), "Nd" (decimal digits),
- * "Mc" and "Mn" (combining marks), "Pc" (connecting punctuation), and
- * u_isIDIgnorable(c).
- *
- * Same as java.lang.Character.isUnicodeIdentifierPart().
- * Almost the same as Unicode's ID_Continue (UCHAR_ID_CONTINUE)
- * except that Unicode recommends to ignore Cf which is less than
- * u_isIDIgnorable(c).
- *
- * @param c the code point to be tested
- * @return TRUE if the code point may occur in an identifier according to Java
- *
- * @see UCHAR_ID_CONTINUE
- * @see u_isIDStart
- * @see u_isIDIgnorable
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isIDPart(UChar32 c);
-
-/**
- * Determines if the specified character should be regarded
- * as an ignorable character in an identifier,
- * according to Java.
- * True for characters with general category "Cf" (format controls) as well as
- * non-whitespace ISO controls
- * (U+0000..U+0008, U+000E..U+001B, U+007F..U+009F).
- *
- * Same as java.lang.Character.isIdentifierIgnorable().
- *
- * Note that Unicode just recommends to ignore Cf (format controls).
- *
- * @param c the code point to be tested
- * @return TRUE if the code point is ignorable in identifiers according to Java
- *
- * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
- * @see u_isIDStart
- * @see u_isIDPart
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isIDIgnorable(UChar32 c);
-
-/**
- * Determines if the specified character is permissible as the
- * first character in a Java identifier.
- * In addition to u_isIDStart(c), true for characters with
- * general categories "Sc" (currency symbols) and "Pc" (connecting punctuation).
- *
- * Same as java.lang.Character.isJavaIdentifierStart().
- *
- * @param c the code point to be tested
- * @return TRUE if the code point may start a Java identifier
- *
- * @see     u_isJavaIDPart
- * @see     u_isalpha
- * @see     u_isIDStart
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isJavaIDStart(UChar32 c);
-
-/**
- * Determines if the specified character is permissible
- * in a Java identifier.
- * In addition to u_isIDPart(c), true for characters with
- * general category "Sc" (currency symbols).
- *
- * Same as java.lang.Character.isJavaIdentifierPart().
- *
- * @param c the code point to be tested
- * @return TRUE if the code point may occur in a Java identifier
- *
- * @see     u_isIDIgnorable
- * @see     u_isJavaIDStart
- * @see     u_isalpha
- * @see     u_isdigit
- * @see     u_isIDPart
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-u_isJavaIDPart(UChar32 c);
-
-/**
- * The given character is mapped to its lowercase equivalent according to
- * UnicodeData.txt; if the character has no lowercase equivalent, the character
- * itself is returned.
- *
- * Same as java.lang.Character.toLowerCase().
- *
- * This function only returns the simple, single-code point case mapping.
- * Full case mappings should be used whenever possible because they produce
- * better results by working on whole strings.
- * They take into account the string context and the language and can map
- * to a result string with a different length as appropriate.
- * Full case mappings are applied by the string case mapping functions,
- * see ustring.h and the UnicodeString class.
- * See also the User Guide chapter on C/POSIX migration:
- * http://icu-project.org/userguide/posix.html#case_mappings
- *
- * @param c the code point to be mapped
- * @return the Simple_Lowercase_Mapping of the code point, if any;
- *         otherwise the code point itself.
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_tolower(UChar32 c);
-
-/**
- * The given character is mapped to its uppercase equivalent according to UnicodeData.txt;
- * if the character has no uppercase equivalent, the character itself is
- * returned.
- *
- * Same as java.lang.Character.toUpperCase().
- *
- * This function only returns the simple, single-code point case mapping.
- * Full case mappings should be used whenever possible because they produce
- * better results by working on whole strings.
- * They take into account the string context and the language and can map
- * to a result string with a different length as appropriate.
- * Full case mappings are applied by the string case mapping functions,
- * see ustring.h and the UnicodeString class.
- * See also the User Guide chapter on C/POSIX migration:
- * http://icu-project.org/userguide/posix.html#case_mappings
- *
- * @param c the code point to be mapped
- * @return the Simple_Uppercase_Mapping of the code point, if any;
- *         otherwise the code point itself.
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_toupper(UChar32 c);
-
-/**
- * The given character is mapped to its titlecase equivalent
- * according to UnicodeData.txt;
- * if none is defined, the character itself is returned.
- *
- * Same as java.lang.Character.toTitleCase().
- *
- * This function only returns the simple, single-code point case mapping.
- * Full case mappings should be used whenever possible because they produce
- * better results by working on whole strings.
- * They take into account the string context and the language and can map
- * to a result string with a different length as appropriate.
- * Full case mappings are applied by the string case mapping functions,
- * see ustring.h and the UnicodeString class.
- * See also the User Guide chapter on C/POSIX migration:
- * http://icu-project.org/userguide/posix.html#case_mappings
- *
- * @param c the code point to be mapped
- * @return the Simple_Titlecase_Mapping of the code point, if any;
- *         otherwise the code point itself.
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_totitle(UChar32 c);
-
-/** Option value for case folding: use default mappings defined in CaseFolding.txt. @stable ICU 2.0 */
-#define U_FOLD_CASE_DEFAULT 0
-
-/**
- * Option value for case folding:
- *
- * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
- * and dotless i appropriately for Turkic languages (tr, az).
- *
- * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
- * are to be included for default mappings and
- * excluded for the Turkic-specific mappings.
- *
- * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
- * are to be excluded for default mappings and
- * included for the Turkic-specific mappings.
- *
- * @stable ICU 2.0
- */
-#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
-
-/**
- * The given character is mapped to its case folding equivalent according to
- * UnicodeData.txt and CaseFolding.txt;
- * if the character has no case folding equivalent, the character
- * itself is returned.
- *
- * This function only returns the simple, single-code point case mapping.
- * Full case mappings should be used whenever possible because they produce
- * better results by working on whole strings.
- * They take into account the string context and the language and can map
- * to a result string with a different length as appropriate.
- * Full case mappings are applied by the string case mapping functions,
- * see ustring.h and the UnicodeString class.
- * See also the User Guide chapter on C/POSIX migration:
- * http://icu-project.org/userguide/posix.html#case_mappings
- *
- * @param c the code point to be mapped
- * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
- * @return the Simple_Case_Folding of the code point, if any;
- *         otherwise the code point itself.
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_foldCase(UChar32 c, uint32_t options);
-
-/**
- * Returns the decimal digit value of the code point in the
- * specified radix.
- *
- * If the radix is not in the range <code>2<=radix<=36</code> or if the
- * value of <code>c</code> is not a valid digit in the specified
- * radix, <code>-1</code> is returned. A character is a valid digit
- * if at least one of the following is true:
- * <ul>
- * <li>The character has a decimal digit value.
- *     Such characters have the general category "Nd" (decimal digit numbers)
- *     and a Numeric_Type of Decimal.
- *     In this case the value is the character's decimal digit value.</li>
- * <li>The character is one of the uppercase Latin letters
- *     <code>'A'</code> through <code>'Z'</code>.
- *     In this case the value is <code>c-'A'+10</code>.</li>
- * <li>The character is one of the lowercase Latin letters
- *     <code>'a'</code> through <code>'z'</code>.
- *     In this case the value is <code>ch-'a'+10</code>.</li>
- * <li>Latin letters from both the ASCII range (0061..007A, 0041..005A)
- *     as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A)
- *     are recognized.</li>
- * </ul>
- *
- * Same as java.lang.Character.digit().
- *
- * @param   ch      the code point to be tested.
- * @param   radix   the radix.
- * @return  the numeric value represented by the character in the
- *          specified radix,
- *          or -1 if there is no value or if the value exceeds the radix.
- *
- * @see     UCHAR_NUMERIC_TYPE
- * @see     u_forDigit
- * @see     u_charDigitValue
- * @see     u_isdigit
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_digit(UChar32 ch, int8_t radix);
-
-/**
- * Determines the character representation for a specific digit in
- * the specified radix. If the value of <code>radix</code> is not a
- * valid radix, or the value of <code>digit</code> is not a valid
- * digit in the specified radix, the null character
- * (<code>U+0000</code>) is returned.
- * <p>
- * The <code>radix</code> argument is valid if it is greater than or
- * equal to 2 and less than or equal to 36.
- * The <code>digit</code> argument is valid if
- * <code>0 <= digit < radix</code>.
- * <p>
- * If the digit is less than 10, then
- * <code>'0' + digit</code> is returned. Otherwise, the value
- * <code>'a' + digit - 10</code> is returned.
- *
- * Same as java.lang.Character.forDigit().
- *
- * @param   digit   the number to convert to a character.
- * @param   radix   the radix.
- * @return  the <code>char</code> representation of the specified digit
- *          in the specified radix.
- *
- * @see     u_digit
- * @see     u_charDigitValue
- * @see     u_isdigit
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_forDigit(int32_t digit, int8_t radix);
-
-/**
- * Get the "age" of the code point.
- * The "age" is the Unicode version when the code point was first
- * designated (as a non-character or for Private Use)
- * or assigned a character.
- * This can be useful to avoid emitting code points to receiving
- * processes that do not accept newer characters.
- * The data is from the UCD file DerivedAge.txt.
- *
- * @param c The code point.
- * @param versionArray The Unicode version number array, to be filled in.
- *
- * @stable ICU 2.1
- */
-U_STABLE void U_EXPORT2
-u_charAge(UChar32 c, UVersionInfo versionArray);
-
-/**
- * Gets the Unicode version information.
- * The version array is filled in with the version information
- * for the Unicode standard that is currently used by ICU.
- * For example, Unicode version 3.1.1 is represented as an array with
- * the values { 3, 1, 1, 0 }.
- *
- * @param versionArray an output array that will be filled in with
- *                     the Unicode version number
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-u_getUnicodeVersion(UVersionInfo versionArray);
-
-#if !UCONFIG_NO_NORMALIZATION
-/**
- * Get the FC_NFKC_Closure property string for a character.
- * See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure"
- * or for "FNC": http://www.unicode.org/reports/tr15/
- *
- * @param c The character (code point) for which to get the FC_NFKC_Closure string.
- *             It must be <code>0<=c<=0x10ffff</code>.
- * @param dest Destination address for copying the string.
- *             The string will be zero-terminated if possible.
- *             If there is no FC_NFKC_Closure string,
- *             then the buffer will be set to the empty string.
- * @param destCapacity <code>==sizeof(dest)</code>
- * @param pErrorCode Pointer to a UErrorCode variable.
- * @return The length of the string, or 0 if there is no FC_NFKC_Closure string for this character.
- *         If the destCapacity is less than or equal to the length, then the buffer
- *         contains the truncated name and the returned length indicates the full
- *         length of the name.
- *         The length does not include the zero-termination.
- *
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode);
-
-#endif
-
-
-U_CDECL_END
-
-#endif /*_UCHAR*/
-/*eof*/
diff --git a/Source/core/icu/unicode/ucnv.h b/Source/core/icu/unicode/ucnv.h
deleted file mode 100644
index 98da8ff..0000000
--- a/Source/core/icu/unicode/ucnv.h
+++ /dev/null
@@ -1,1997 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1999-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
- *  ucnv.h:
- *  External APIs for the ICU's codeset conversion library
- *  Bertrand A. Damiba
- *
- * Modification History:
- *
- *   Date        Name        Description
- *   04/04/99    helena      Fixed internal header inclusion.
- *   05/11/00    helena      Added setFallback and usesFallback APIs.
- *   06/29/2000  helena      Major rewrite of the callback APIs.
- *   12/07/2000  srl         Update of documentation
- */
-
-/**
- * \file
- * \brief C API: Character conversion 
- *
- * <h2>Character Conversion C API</h2>
- *
- * <p>This API is used to convert codepage or character encoded data to and
- * from UTF-16. You can open a converter with {@link ucnv_open() }. With that
- * converter, you can get its properties, set options, convert your data and
- * close the converter.</p>
- *
- * <p>Since many software programs recogize different converter names for
- * different types of converters, there are other functions in this API to
- * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() },
- * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the
- * more frequently used alias functions to get this information.</p>
- *
- * <p>When a converter encounters an illegal, irregular, invalid or unmappable character
- * its default behavior is to use a substitution character to replace the
- * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromUCallBack() }
- * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h defines
- * many other callback actions that can be used instead of a character substitution.</p>
- *
- * <p>More information about this API can be found in our 
- * <a href="http://icu-project.org/userguide/conversion.html">User's
- * Guide</a>.</p>
- */
-
-#ifndef UCNV_H
-#define UCNV_H
-
-#include "unicode/ucnv_err.h"
-#include "unicode/uenum.h"
-#include "unicode/localpointer.h"
-
-#ifndef __USET_H__
-
-/**
- * USet is the C API type for Unicode sets.
- * It is forward-declared here to avoid including the header file if related
- * conversion APIs are not used.
- * See unicode/uset.h
- *
- * @see ucnv_getUnicodeSet
- * @stable ICU 2.6
- */
-struct USet;
-/** @stable ICU 2.6 */
-typedef struct USet USet;
-
-#endif
-
-#if !UCONFIG_NO_CONVERSION
-
-U_CDECL_BEGIN
-
-/** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */
-#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
-/** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */
-#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
-
-/** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */
-#define  UCNV_SI 0x0F
-/** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */
-#define  UCNV_SO 0x0E
-
-/**
- * Enum for specifying basic types of converters
- * @see ucnv_getType
- * @stable ICU 2.0
- */
-typedef enum {
-    UCNV_UNSUPPORTED_CONVERTER = -1,
-    UCNV_SBCS = 0,
-    UCNV_DBCS = 1,
-    UCNV_MBCS = 2,
-    UCNV_LATIN_1 = 3,
-    UCNV_UTF8 = 4,
-    UCNV_UTF16_BigEndian = 5,
-    UCNV_UTF16_LittleEndian = 6,
-    UCNV_UTF32_BigEndian = 7,
-    UCNV_UTF32_LittleEndian = 8,
-    UCNV_EBCDIC_STATEFUL = 9,
-    UCNV_ISO_2022 = 10,
-
-    UCNV_LMBCS_1 = 11,
-    UCNV_LMBCS_2, 
-    UCNV_LMBCS_3,
-    UCNV_LMBCS_4,
-    UCNV_LMBCS_5,
-    UCNV_LMBCS_6,
-    UCNV_LMBCS_8,
-    UCNV_LMBCS_11,
-    UCNV_LMBCS_16,
-    UCNV_LMBCS_17,
-    UCNV_LMBCS_18,
-    UCNV_LMBCS_19,
-    UCNV_LMBCS_LAST = UCNV_LMBCS_19,
-    UCNV_HZ,
-    UCNV_SCSU,
-    UCNV_ISCII,
-    UCNV_US_ASCII,
-    UCNV_UTF7,
-    UCNV_BOCU1,
-    UCNV_UTF16,
-    UCNV_UTF32,
-    UCNV_CESU8,
-    UCNV_IMAP_MAILBOX,
-
-    /* Number of converter types for which we have conversion routines. */
-    UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
-
-} UConverterType;
-
-/**
- * Enum for specifying which platform a converter ID refers to.
- * The use of platform/CCSID is not recommended. See ucnv_openCCSID().
- *
- * @see ucnv_getPlatform
- * @see ucnv_openCCSID
- * @see ucnv_getCCSID
- * @stable ICU 2.0
- */
-typedef enum {
-    UCNV_UNKNOWN = -1,
-    UCNV_IBM = 0
-} UConverterPlatform;
-
-/**
- * Function pointer for error callback in the codepage to unicode direction.
- * Called when an error has occured in conversion to unicode, or on open/close of the callback (see reason).
- * @param context Pointer to the callback's private data
- * @param args Information about the conversion in progress
- * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param reason Defines the reason the callback was invoked
- * @param pErrorCode    ICU error code in/out parameter.
- *                      For converter callback functions, set to a conversion error
- *                      before the call, and the callback may reset it to U_ZERO_ERROR.
- * @see ucnv_setToUCallBack
- * @see UConverterToUnicodeArgs
- * @stable ICU 2.0
- */
-typedef void (U_EXPORT2 *UConverterToUCallback) (
-                  const void* context,
-                  UConverterToUnicodeArgs *args,
-                  const char *codeUnits,
-                  int32_t length,
-                  UConverterCallbackReason reason,
-                  UErrorCode *pErrorCode);
-
-/**
- * Function pointer for error callback in the unicode to codepage direction.
- * Called when an error has occured in conversion from unicode, or on open/close of the callback (see reason).
- * @param context Pointer to the callback's private data
- * @param args Information about the conversion in progress
- * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
- * @param reason Defines the reason the callback was invoked
- * @param pErrorCode    ICU error code in/out parameter.
- *                      For converter callback functions, set to a conversion error
- *                      before the call, and the callback may reset it to U_ZERO_ERROR.
- * @see ucnv_setFromUCallBack
- * @stable ICU 2.0
- */
-typedef void (U_EXPORT2 *UConverterFromUCallback) (
-                    const void* context,
-                    UConverterFromUnicodeArgs *args,
-                    const UChar* codeUnits,
-                    int32_t length,
-                    UChar32 codePoint,
-                    UConverterCallbackReason reason,
-                    UErrorCode *pErrorCode);
-
-U_CDECL_END
-
-/**
- * Character that separates converter names from options and options from each other.
- * @see ucnv_open
- * @stable ICU 2.0
- */
-#define UCNV_OPTION_SEP_CHAR ','
-
-/**
- * String version of UCNV_OPTION_SEP_CHAR. 
- * @see ucnv_open
- * @stable ICU 2.0
- */
-#define UCNV_OPTION_SEP_STRING ","
-
-/**
- * Character that separates a converter option from its value.
- * @see ucnv_open
- * @stable ICU 2.0
- */
-#define UCNV_VALUE_SEP_CHAR '='
-
-/**
- * String version of UCNV_VALUE_SEP_CHAR. 
- * @see ucnv_open
- * @stable ICU 2.0
- */
-#define UCNV_VALUE_SEP_STRING "="
-
-/**
- * Converter option for specifying a locale.
- * For example, ucnv_open("SCSU,locale=ja", &errorCode);
- * See convrtrs.txt.
- *
- * @see ucnv_open
- * @stable ICU 2.0
- */
-#define UCNV_LOCALE_OPTION_STRING ",locale="
-
-/**
- * Converter option for specifying a version selector (0..9) for some converters.
- * For example, 
- * \code
- *   ucnv_open("UTF-7,version=1", &errorCode);
- * \endcode
- * See convrtrs.txt.
- *
- * @see ucnv_open
- * @stable ICU 2.4
- */
-#define UCNV_VERSION_OPTION_STRING ",version="
-
-/**
- * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages.
- * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on
- * S/390 (z/OS) Unix System Services (Open Edition).
- * For example, ucnv_open("ibm-1047,swaplfnl", &errorCode);
- * See convrtrs.txt.
- *
- * @see ucnv_open
- * @stable ICU 2.4
- */
-#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
-
-/**
- * Do a fuzzy compare of two converter/alias names.
- * The comparison is case-insensitive, ignores leading zeroes if they are not
- * followed by further digits, and ignores all but letters and digits.
- * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent.
- * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22
- * at http://www.unicode.org/reports/tr22/
- *
- * @param name1 a converter name or alias, zero-terminated
- * @param name2 a converter name or alias, zero-terminated
- * @return 0 if the names match, or a negative value if the name1
- * lexically precedes name2, or a positive value if the name1
- * lexically follows name2.
- * @stable ICU 2.0
- */
-U_STABLE int U_EXPORT2
-ucnv_compareNames(const char *name1, const char *name2);
-
-
-/**
- * Creates a UConverter object with the name of a coded character set specified as a C string.
- * The actual name will be resolved with the alias file
- * using a case-insensitive string comparison that ignores
- * leading zeroes and all non-alphanumeric characters.
- * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent.
- * (See also ucnv_compareNames().)
- * If <code>NULL</code> is passed for the converter name, it will create one with the
- * getDefaultName return value.
- *
- * <p>A converter name for ICU 1.5 and above may contain options
- * like a locale specification to control the specific behavior of
- * the newly instantiated converter.
- * The meaning of the options depends on the particular converter.
- * If an option is not defined for or recognized by a given converter, then it is ignored.</p>
- *
- * <p>Options are appended to the converter name string, with a
- * <code>UCNV_OPTION_SEP_CHAR</code> between the name and the first option and
- * also between adjacent options.</p>
- *
- * <p>If the alias is ambiguous, then the preferred converter is used
- * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.</p>
- *
- * <p>The conversion behavior and names can vary between platforms. ICU may
- * convert some characters differently from other platforms. Details on this topic
- * are in the <a href="http://icu-project.org/userguide/conversion.html">User's
- * Guide</a>. Aliases starting with a "cp" prefix have no specific meaning
- * other than its an alias starting with the letters "cp". Please do not
- * associate any meaning to these aliases.</p>
- *
- * @param converterName Name of the coded character set table.
- *          This may have options appended to the string.
- *          IANA alias character set names, IBM CCSIDs starting with "ibm-",
- *          Windows codepage numbers starting with "windows-" are frequently
- *          used for this parameter. See ucnv_getAvailableName and
- *          ucnv_getAlias for a complete list that is available.
- *          If this parameter is NULL, the default converter will be used.
- * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
- * @return the created Unicode converter object, or <TT>NULL</TT> if an error occured
- * @see ucnv_openU
- * @see ucnv_openCCSID
- * @see ucnv_getAvailableName
- * @see ucnv_getAlias
- * @see ucnv_getDefaultName
- * @see ucnv_close
- * @see ucnv_compareNames
- * @stable ICU 2.0
- */
-U_STABLE UConverter* U_EXPORT2 
-ucnv_open(const char *converterName, UErrorCode *err);
-
-
-/**
- * Creates a Unicode converter with the names specified as unicode string. 
- * The name should be limited to the ASCII-7 alphanumerics range.
- * The actual name will be resolved with the alias file
- * using a case-insensitive string comparison that ignores
- * leading zeroes and all non-alphanumeric characters.
- * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent.
- * (See also ucnv_compareNames().)
- * If <TT>NULL</TT> is passed for the converter name, it will create 
- * one with the ucnv_getDefaultName() return value.
- * If the alias is ambiguous, then the preferred converter is used
- * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
- *
- * <p>See ucnv_open for the complete details</p>
- * @param name Name of the UConverter table in a zero terminated 
- *        Unicode string
- * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, 
- *        U_FILE_ACCESS_ERROR</TT>
- * @return the created Unicode converter object, or <TT>NULL</TT> if an 
- *        error occured
- * @see ucnv_open
- * @see ucnv_openCCSID
- * @see ucnv_close
- * @see ucnv_compareNames
- * @stable ICU 2.0
- */
-U_STABLE UConverter* U_EXPORT2 
-ucnv_openU(const UChar *name,
-           UErrorCode *err);
-
-/**
- * Creates a UConverter object from a CCSID number and platform pair.
- * Note that the usefulness of this function is limited to platforms with numeric
- * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for
- * encodings.
- *
- * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related.
- * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and
- * for some Unicode conversion tables there are multiple CCSIDs.
- * Some "alternate" Unicode conversion tables are provided by the
- * IBM CDRA conversion table registry.
- * The most prominent example of a systematic modification of conversion tables that is
- * not provided in the form of conversion table files in the repository is
- * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all
- * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well.
- *
- * Only IBM default conversion tables are accessible with ucnv_openCCSID().
- * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated
- * with that CCSID.
- *
- * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM.
- *
- * In summary, the use of CCSIDs and the associated API functions is not recommended.
- *
- * In order to open a converter with the default IBM CDRA Unicode conversion table,
- * you can use this function or use the prefix "ibm-":
- * \code
- *     char name[20];
- *     sprintf(name, "ibm-%hu", ccsid);
- *     cnv=ucnv_open(name, &errorCode);
- * \endcode
- *
- * In order to open a converter with the IBM S/390 Unix System Services variant
- * of a Unicode/EBCDIC conversion table,
- * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING:
- * \code
- *     char name[20];
- *     sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid);
- *     cnv=ucnv_open(name, &errorCode);
- * \endcode
- *
- * In order to open a converter from a Microsoft codepage number, use the prefix "cp":
- * \code
- *     char name[20];
- *     sprintf(name, "cp%hu", codepageID);
- *     cnv=ucnv_open(name, &errorCode);
- * \endcode
- *
- * If the alias is ambiguous, then the preferred converter is used
- * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
- *
- * @param codepage codepage number to create
- * @param platform the platform in which the codepage number exists
- * @param err error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
- * @return the created Unicode converter object, or <TT>NULL</TT> if an error
- *   occured.
- * @see ucnv_open
- * @see ucnv_openU
- * @see ucnv_close
- * @see ucnv_getCCSID
- * @see ucnv_getPlatform
- * @see UConverterPlatform
- * @stable ICU 2.0
- */
-U_STABLE UConverter* U_EXPORT2
-ucnv_openCCSID(int32_t codepage,
-               UConverterPlatform platform,
-               UErrorCode * err);
-
-/**
- * <p>Creates a UConverter object specified from a packageName and a converterName.</p>
- * 
- * <p>The packageName and converterName must point to an ICU udata object, as defined by
- *   <code> udata_open( packageName, "cnv", converterName, err) </code> or equivalent.
- * Typically, packageName will refer to a (.dat) file, or to a package registered with
- * udata_setAppData(). Using a full file or directory pathname for packageName is deprecated.</p>
- * 
- * <p>The name will NOT be looked up in the alias mechanism, nor will the converter be
- * stored in the converter cache or the alias table. The only way to open further converters
- * is call this function multiple times, or use the ucnv_safeClone() function to clone a 
- * 'master' converter.</p>
- *
- * <p>A future version of ICU may add alias table lookups and/or caching
- * to this function.</p>
- * 
- * <p>Example Use:
- *      <code>cnv = ucnv_openPackage("myapp", "myconverter", &err);</code>
- * </p>
- *
- * @param packageName name of the package (equivalent to 'path' in udata_open() call)
- * @param converterName name of the data item to be used, without suffix.
- * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
- * @return the created Unicode converter object, or <TT>NULL</TT> if an error occured
- * @see udata_open
- * @see ucnv_open
- * @see ucnv_safeClone
- * @see ucnv_close
- * @stable ICU 2.2
- */
-U_STABLE UConverter* U_EXPORT2 
-ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
-
-/**
- * Thread safe converter cloning operation.
- * For most efficient operation, pass in a stackBuffer (and a *pBufferSize)
- * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space.
- * If the buffer size is sufficient, then the clone will use the stack buffer;
- * otherwise, it will be allocated, and *pBufferSize will indicate
- * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.)
- *
- * You must ucnv_close() the clone in any case.
- *
- * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not)
- * then *pBufferSize will be changed to a sufficient size
- * for cloning this converter,
- * without actually cloning the converter ("pure pre-flighting").
- *
- * If *pBufferSize is greater than zero but not large enough for a stack-based
- * clone, then the converter is cloned using newly allocated memory
- * and *pBufferSize is changed to the necessary size.
- *
- * If the converter clone fits into the stack buffer but the stack buffer is not
- * sufficiently aligned for the clone, then the clone will use an
- * adjusted pointer and use an accordingly smaller buffer size.
- *
- * @param cnv converter to be cloned
- * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. 
- *  If buffer is not large enough, new memory will be allocated.
- *  Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations.
- * @param pBufferSize pointer to size of allocated space. pBufferSize must not be NULL.
- * @param status to indicate whether the operation went on smoothly or there were errors
- *  An informational status value, U_SAFECLONE_ALLOCATED_WARNING,
- *  is used if any allocations were necessary.
- *  However, it is better to check if *pBufferSize grew for checking for
- *  allocations because warning codes can be overridden by subsequent
- *  function calls.
- * @return pointer to the new clone
- * @stable ICU 2.0
- */
-U_STABLE UConverter * U_EXPORT2 
-ucnv_safeClone(const UConverter *cnv, 
-               void             *stackBuffer,
-               int32_t          *pBufferSize, 
-               UErrorCode       *status);
-
-/**
- * \def U_CNV_SAFECLONE_BUFFERSIZE
- * Definition of a buffer size that is designed to be large enough for
- * converters to be cloned with ucnv_safeClone().
- * @stable ICU 2.0
- */
-#define U_CNV_SAFECLONE_BUFFERSIZE  1024
-
-/**
- * Deletes the unicode converter and releases resources associated
- * with just this instance.
- * Does not free up shared converter tables.
- *
- * @param converter the converter object to be deleted
- * @see ucnv_open
- * @see ucnv_openU
- * @see ucnv_openCCSID
- * @stable ICU 2.0
- */
-U_STABLE void  U_EXPORT2
-ucnv_close(UConverter * converter);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUConverterPointer
- * "Smart pointer" class, closes a UConverter via ucnv_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Fills in the output parameter, subChars, with the substitution characters
- * as multiple bytes.
- * If ucnv_setSubstString() set a Unicode string because the converter is
- * stateful, then subChars will be an empty string.
- *
- * @param converter the Unicode converter
- * @param subChars the subsitution characters
- * @param len on input the capacity of subChars, on output the number 
- * of bytes copied to it
- * @param  err the outgoing error status code.
- * If the substitution character array is too small, an
- * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
- * @see ucnv_setSubstString
- * @see ucnv_setSubstChars
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_getSubstChars(const UConverter *converter,
-                   char *subChars,
-                   int8_t *len,
-                   UErrorCode *err);
-
-/**
- * Sets the substitution chars when converting from unicode to a codepage. The
- * substitution is specified as a string of 1-4 bytes, and may contain
- * <TT>NULL</TT> bytes.
- * The subChars must represent a single character. The caller needs to know the
- * byte sequence of a valid character in the converter's charset.
- * For some converters, for example some ISO 2022 variants, only single-byte
- * substitution characters may be supported.
- * The newer ucnv_setSubstString() function relaxes these limitations.
- *
- * @param converter the Unicode converter
- * @param subChars the substitution character byte sequence we want set
- * @param len the number of bytes in subChars
- * @param err the error status code.  <TT>U_INDEX_OUTOFBOUNDS_ERROR </TT> if
- * len is bigger than the maximum number of bytes allowed in subchars
- * @see ucnv_setSubstString
- * @see ucnv_getSubstChars
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_setSubstChars(UConverter *converter,
-                   const char *subChars,
-                   int8_t len,
-                   UErrorCode *err);
-
-/**
- * Set a substitution string for converting from Unicode to a charset.
- * The caller need not know the charset byte sequence for each charset.
- *
- * Unlike ucnv_setSubstChars() which is designed to set a charset byte sequence
- * for a single character, this function takes a Unicode string with
- * zero, one or more characters, and immediately verifies that the string can be
- * converted to the charset.
- * If not, or if the result is too long (more than 32 bytes as of ICU 3.6),
- * then the function returns with an error accordingly.
- *
- * Also unlike ucnv_setSubstChars(), this function works for stateful charsets
- * by converting on the fly at the point of substitution rather than setting
- * a fixed byte sequence.
- *
- * @param cnv The UConverter object.
- * @param s The Unicode string.
- * @param length The number of UChars in s, or -1 for a NUL-terminated string.
- * @param err Pointer to a standard ICU error code. Its input value must
- *            pass the U_SUCCESS() test, or else the function returns
- *            immediately. Check for U_FAILURE() on output or use with
- *            function chaining. (See User Guide for details.)
- *
- * @see ucnv_setSubstChars
- * @see ucnv_getSubstChars
- * @stable ICU 3.6
- */
-U_STABLE void U_EXPORT2
-ucnv_setSubstString(UConverter *cnv,
-                    const UChar *s,
-                    int32_t length,
-                    UErrorCode *err);
-
-/**
- * Fills in the output parameter, errBytes, with the error characters from the
- * last failing conversion.
- *
- * @param converter the Unicode converter
- * @param errBytes the codepage bytes which were in error
- * @param len on input the capacity of errBytes, on output the number of
- *  bytes which were copied to it
- * @param err the error status code.
- * If the substitution character array is too small, an
- * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_getInvalidChars(const UConverter *converter,
-                     char *errBytes,
-                     int8_t *len,
-                     UErrorCode *err);
-
-/**
- * Fills in the output parameter, errChars, with the error characters from the
- * last failing conversion.
- *
- * @param converter the Unicode converter
- * @param errUChars the UChars which were in error
- * @param len on input the capacity of errUChars, on output the number of 
- *  UChars which were copied to it
- * @param err the error status code.
- * If the substitution character array is too small, an
- * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_getInvalidUChars(const UConverter *converter,
-                      UChar *errUChars,
-                      int8_t *len,
-                      UErrorCode *err);
-
-/**
- * Resets the state of a converter to the default state. This is used
- * in the case of an error, to restart a conversion from a known default state.
- * It will also empty the internal output buffers.
- * @param converter the Unicode converter
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_reset(UConverter *converter);
-
-/**
- * Resets the to-Unicode part of a converter state to the default state.
- * This is used in the case of an error to restart a conversion to
- * Unicode to a known default state. It will also empty the internal
- * output buffers used for the conversion to Unicode codepoints.
- * @param converter the Unicode converter
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucnv_resetToUnicode(UConverter *converter);
-
-/**
- * Resets the from-Unicode part of a converter state to the default state.
- * This is used in the case of an error to restart a conversion from
- * Unicode to a known default state. It will also empty the internal output
- * buffers used for the conversion from Unicode codepoints.
- * @param converter the Unicode converter
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucnv_resetFromUnicode(UConverter *converter);
-
-/**
- * Returns the maximum number of bytes that are output per UChar in conversion
- * from Unicode using this converter.
- * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING
- * to calculate the size of a target buffer for conversion from Unicode.
- *
- * Note: Before ICU 2.8, this function did not return reliable numbers for
- * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS.
- *
- * This number may not be the same as the maximum number of bytes per
- * "conversion unit". In other words, it may not be the intuitively expected
- * number of bytes per character that would be published for a charset,
- * and may not fulfill any other purpose than the allocation of an output
- * buffer of guaranteed sufficient size for a given input length and converter.
- *
- * Examples for special cases that are taken into account:
- * - Supplementary code points may convert to more bytes than BMP code points.
- *   This function returns bytes per UChar (UTF-16 code unit), not per
- *   Unicode code point, for efficient buffer allocation.
- * - State-shifting output (SI/SO, escapes, etc.) from stateful converters.
- * - When m input UChars are converted to n output bytes, then the maximum m/n
- *   is taken into account.
- *
- * The number returned here does not take into account
- * (see UCNV_GET_MAX_BYTES_FOR_STRING):
- * - callbacks which output more than one charset character sequence per call,
- *   like escape callbacks
- * - initial and final non-character bytes that are output by some converters
- *   (automatic BOMs, initial escape sequence, final SI, etc.)
- *
- * Examples for returned values:
- * - SBCS charsets: 1
- * - Shift-JIS: 2
- * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted)
- * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_)
- * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS)
- * - ISO-2022: 3 (always outputs UTF-8)
- * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS)
- * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS)
- *
- * @param converter The Unicode converter.
- * @return The maximum number of bytes per UChar that are output by ucnv_fromUnicode(),
- *         to be used together with UCNV_GET_MAX_BYTES_FOR_STRING for buffer allocation.
- *
- * @see UCNV_GET_MAX_BYTES_FOR_STRING
- * @see ucnv_getMinCharSize
- * @stable ICU 2.0
- */
-U_STABLE int8_t U_EXPORT2
-ucnv_getMaxCharSize(const UConverter *converter);
-
-/**
- * Calculates the size of a buffer for conversion from Unicode to a charset.
- * The calculated size is guaranteed to be sufficient for this conversion.
- *
- * It takes into account initial and final non-character bytes that are output
- * by some converters.
- * It does not take into account callbacks which output more than one charset
- * character sequence per call, like escape callbacks.
- * The default (substitution) callback only outputs one charset character sequence.
- *
- * @param length Number of UChars to be converted.
- * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter
- *                    that will be used.
- * @return Size of a buffer that will be large enough to hold the output bytes of
- *         converting length UChars with the converter that returned the maxCharSize.
- *
- * @see ucnv_getMaxCharSize
- * @stable ICU 2.8
- */
-#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
-     (((int32_t)(length)+10)*(int32_t)(maxCharSize))
-
-/**
- * Returns the minimum byte length for characters in this codepage. 
- * This is usually either 1 or 2.
- * @param converter the Unicode converter
- * @return the minimum number of bytes allowed by this particular converter
- * @see ucnv_getMaxCharSize
- * @stable ICU 2.0
- */
-U_STABLE int8_t U_EXPORT2
-ucnv_getMinCharSize(const UConverter *converter);
-
-/**
- * Returns the display name of the converter passed in based on the Locale 
- * passed in. If the locale contains no display name, the internal ASCII
- * name will be filled in.
- *
- * @param converter the Unicode converter.
- * @param displayLocale is the specific Locale we want to localised for
- * @param displayName user provided buffer to be filled in
- * @param displayNameCapacity size of displayName Buffer
- * @param err error status code
- * @return displayNameLength number of UChar needed in displayName
- * @see ucnv_getName
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_getDisplayName(const UConverter *converter,
-                    const char *displayLocale,
-                    UChar *displayName,
-                    int32_t displayNameCapacity,
-                    UErrorCode *err);
-
-/**
- * Gets the internal, canonical name of the converter (zero-terminated).
- * The lifetime of the returned string will be that of the converter 
- * passed to this function.
- * @param converter the Unicode converter
- * @param err UErrorCode status
- * @return the internal name of the converter
- * @see ucnv_getDisplayName
- * @stable ICU 2.0
- */
-U_STABLE const char * U_EXPORT2 
-ucnv_getName(const UConverter *converter, UErrorCode *err);
-
-/**
- * Gets a codepage number associated with the converter. This is not guaranteed
- * to be the one used to create the converter. Some converters do not represent
- * platform registered codepages and return zero for the codepage number.
- * The error code fill-in parameter indicates if the codepage number
- * is available.
- * Does not check if the converter is <TT>NULL</TT> or if converter's data
- * table is <TT>NULL</TT>.
- *
- * Important: The use of CCSIDs is not recommended because it is limited
- * to only two platforms in principle and only one (UCNV_IBM) in the current
- * ICU converter API.
- * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely.
- * For more details see ucnv_openCCSID().
- *
- * @param converter the Unicode converter
- * @param err the error status code.
- * @return If any error occurrs, -1 will be returned otherwise, the codepage number
- * will be returned
- * @see ucnv_openCCSID
- * @see ucnv_getPlatform
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_getCCSID(const UConverter *converter,
-              UErrorCode *err);
-
-/**
- * Gets a codepage platform associated with the converter. Currently, 
- * only <TT>UCNV_IBM</TT> will be returned.
- * Does not test if the converter is <TT>NULL</TT> or if converter's data 
- * table is <TT>NULL</TT>. 
- * @param converter the Unicode converter
- * @param err the error status code.
- * @return The codepage platform
- * @stable ICU 2.0
- */
-U_STABLE UConverterPlatform U_EXPORT2
-ucnv_getPlatform(const UConverter *converter,
-                 UErrorCode *err);
-
-/**
- * Gets the type of the converter
- * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, 
- * EBCDIC_STATEFUL, LATIN_1
- * @param converter a valid, opened converter
- * @return the type of the converter
- * @stable ICU 2.0
- */
-U_STABLE UConverterType U_EXPORT2
-ucnv_getType(const UConverter * converter);
-
-/**
- * Gets the "starter" (lead) bytes for converters of type MBCS.
- * Will fill in an <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if converter passed in
- * is not MBCS. Fills in an array of type UBool, with the value of the byte 
- * as offset to the array. For example, if (starters[0x20] == TRUE) at return,
- * it means that the byte 0x20 is a starter byte in this converter.
- * Context pointers are always owned by the caller.
- * 
- * @param converter a valid, opened converter of type MBCS
- * @param starters an array of size 256 to be filled in
- * @param err error status, <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if the 
- * converter is not a type which can return starters.
- * @see ucnv_getType
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_getStarters(const UConverter* converter, 
-                 UBool starters[256],
-                 UErrorCode* err);
-
-
-/**
- * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
- * @see ucnv_getUnicodeSet
- * @stable ICU 2.6
- */
-typedef enum UConverterUnicodeSet {
-    /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */
-    UCNV_ROUNDTRIP_SET,
-    /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */
-    UCNV_ROUNDTRIP_AND_FALLBACK_SET,
-    /** Number of UConverterUnicodeSet selectors. @stable ICU 2.6 */
-    UCNV_SET_COUNT
-} UConverterUnicodeSet;
-
-
-/**
- * Returns the set of Unicode code points that can be converted by an ICU converter.
- *
- * Returns one of several kinds of set:
- *
- * 1. UCNV_ROUNDTRIP_SET
- *
- * The set of all Unicode code points that can be roundtrip-converted
- * (converted without any data loss) with the converter (ucnv_fromUnicode()).
- * This set will not include code points that have fallback mappings
- * or are only the result of reverse fallback mappings.
- * This set will also not include PUA code points with fallbacks, although
- * ucnv_fromUnicode() will always uses those mappings despite ucnv_setFallback().
- * See UTR #22 "Character Mapping Markup Language"
- * at http://www.unicode.org/reports/tr22/
- *
- * This is useful for example for
- * - checking that a string or document can be roundtrip-converted with a converter,
- *   without/before actually performing the conversion
- * - testing if a converter can be used for text for typical text for a certain locale,
- *   by comparing its roundtrip set with the set of ExemplarCharacters from
- *   ICU's locale data or other sources
- *
- * 2. UCNV_ROUNDTRIP_AND_FALLBACK_SET
- *
- * The set of all Unicode code points that can be converted with the converter (ucnv_fromUnicode())
- * when fallbacks are turned on (see ucnv_setFallback()).
- * This set includes all code points with roundtrips and fallbacks (but not reverse fallbacks).
- *
- * In the future, there may be more UConverterUnicodeSet choices to select
- * sets with different properties.
- *
- * @param cnv The converter for which a set is requested.
- * @param setFillIn A valid USet *. It will be cleared by this function before
- *            the converter's specific set is filled into the USet.
- * @param whichSet A UConverterUnicodeSet selector;
- *              currently UCNV_ROUNDTRIP_SET is the only supported value.
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- *
- * @see UConverterUnicodeSet
- * @see uset_open
- * @see uset_close
- * @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
-ucnv_getUnicodeSet(const UConverter *cnv,
-                   USet *setFillIn,
-                   UConverterUnicodeSet whichSet,
-                   UErrorCode *pErrorCode);
-
-/**
- * Gets the current calback function used by the converter when an illegal
- *  or invalid codepage sequence is found. 
- * Context pointers are always owned by the caller.
- *
- * @param converter the unicode converter
- * @param action fillin: returns the callback function pointer
- * @param context fillin: returns the callback's private void* context
- * @see ucnv_setToUCallBack
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_getToUCallBack (const UConverter * converter,
-                     UConverterToUCallback *action,
-                     const void **context);
-
-/**
- * Gets the current callback function used by the converter when illegal 
- * or invalid Unicode sequence is found.
- * Context pointers are always owned by the caller.
- *
- * @param converter the unicode converter
- * @param action fillin: returns the callback function pointer
- * @param context fillin: returns the callback's private void* context
- * @see ucnv_setFromUCallBack
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_getFromUCallBack (const UConverter * converter,
-                       UConverterFromUCallback *action,
-                       const void **context);
-
-/**
- * Changes the callback function used by the converter when
- * an illegal or invalid sequence is found.
- * Context pointers are always owned by the caller.
- * Predefined actions and contexts can be found in the ucnv_err.h header.
- *
- * @param converter the unicode converter
- * @param newAction the new callback function
- * @param newContext the new toUnicode callback context pointer. This can be NULL.
- * @param oldAction fillin: returns the old callback function pointer. This can be NULL.
- * @param oldContext fillin: returns the old callback's private void* context. This can be NULL.
- * @param err The error code status
- * @see ucnv_getToUCallBack
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_setToUCallBack (UConverter * converter,
-                     UConverterToUCallback newAction,
-                     const void* newContext,
-                     UConverterToUCallback *oldAction,
-                     const void** oldContext,
-                     UErrorCode * err);
-
-/**
- * Changes the current callback function used by the converter when
- * an illegal or invalid sequence is found.
- * Context pointers are always owned by the caller.
- * Predefined actions and contexts can be found in the ucnv_err.h header.
- *
- * @param converter the unicode converter
- * @param newAction the new callback function
- * @param newContext the new fromUnicode callback context pointer. This can be NULL.
- * @param oldAction fillin: returns the old callback function pointer. This can be NULL.
- * @param oldContext fillin: returns the old callback's private void* context. This can be NULL.
- * @param err The error code status
- * @see ucnv_getFromUCallBack
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_setFromUCallBack (UConverter * converter,
-                       UConverterFromUCallback newAction,
-                       const void *newContext,
-                       UConverterFromUCallback *oldAction,
-                       const void **oldContext,
-                       UErrorCode * err);
-
-/**
- * Converts an array of unicode characters to an array of codepage
- * characters. This function is optimized for converting a continuous
- * stream of data in buffer-sized chunks, where the entire source and
- * target does not fit in available buffers.
- * 
- * The source pointer is an in/out parameter. It starts out pointing where the 
- * conversion is to begin, and ends up pointing after the last UChar consumed. 
- * 
- * Target similarly starts out pointer at the first available byte in the output
- * buffer, and ends up pointing after the last byte written to the output.
- * 
- * The converter always attempts to consume the entire source buffer, unless 
- * (1.) the target buffer is full, or (2.) a failing error is returned from the
- * current callback function.  When a successful error status has been
- * returned, it means that all of the source buffer has been
- *  consumed. At that point, the caller should reset the source and
- *  sourceLimit pointers to point to the next chunk.
- * 
- * At the end of the stream (flush==TRUE), the input is completely consumed
- * when *source==sourceLimit and no error code is set.
- * The converter object is then automatically reset by this function.
- * (This means that a converter need not be reset explicitly between data
- * streams if it finishes the previous stream without errors.)
- * 
- * This is a <I>stateful</I> conversion. Additionally, even when all source data has
- * been consumed, some data may be in the converters' internal state.
- * Call this function repeatedly, updating the target pointers with
- * the next empty chunk of target in case of a
- * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source  pointers
- *  with the next chunk of source when a successful error status is
- * returned, until there are no more chunks of source data.
- * @param converter the Unicode converter
- * @param target I/O parameter. Input : Points to the beginning of the buffer to copy
- *  codepage characters to. Output : points to after the last codepage character copied
- *  to <TT>target</TT>.
- * @param targetLimit the pointer just after last of the <TT>target</TT> buffer
- * @param source I/O parameter, pointer to pointer to the source Unicode character buffer. 
- * @param sourceLimit the pointer just after the last of the source buffer
- * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
- * of allocated cells as <TT>target</TT>. Will fill in offsets from target to source pointer
- * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT> was a result of transcoding <TT>source[6]</TT>
- * For output data carried across calls, and other data without a specific source character
- * (such as from escape sequences or callbacks)  -1 will be placed for offsets. 
- * @param flush set to <TT>TRUE</TT> if the current source buffer is the last available
- * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status is returned,
- * this function may have to be called multiple times with flush set to <TT>TRUE</TT> until
- * the source buffer is consumed.
- * @param err the error status.  <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set if the
- * converter is <TT>NULL</TT>.
- * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and there is 
- * still data to be written to the target.
- * @see ucnv_fromUChars
- * @see ucnv_convert
- * @see ucnv_getMinCharSize
- * @see ucnv_setToUCallBack
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucnv_fromUnicode (UConverter * converter,
-                  char **target,
-                  const char *targetLimit,
-                  const UChar ** source,
-                  const UChar * sourceLimit,
-                  int32_t* offsets,
-                  UBool flush,
-                  UErrorCode * err);
-
-/**
- * Converts a buffer of codepage bytes into an array of unicode UChars
- * characters. This function is optimized for converting a continuous
- * stream of data in buffer-sized chunks, where the entire source and
- * target does not fit in available buffers.
- * 
- * The source pointer is an in/out parameter. It starts out pointing where the 
- * conversion is to begin, and ends up pointing after the last byte of source consumed. 
- * 
- * Target similarly starts out pointer at the first available UChar in the output
- * buffer, and ends up pointing after the last UChar written to the output. 
- * It does NOT necessarily keep UChar sequences together.
- * 
- * The converter always attempts to consume the entire source buffer, unless 
- * (1.) the target buffer is full, or (2.) a failing error is returned from the
- * current callback function.  When a successful error status has been
- * returned, it means that all of the source buffer has been
- *  consumed. At that point, the caller should reset the source and
- *  sourceLimit pointers to point to the next chunk.
- *
- * At the end of the stream (flush==TRUE), the input is completely consumed
- * when *source==sourceLimit and no error code is set
- * The converter object is then automatically reset by this function.
- * (This means that a converter need not be reset explicitly between data
- * streams if it finishes the previous stream without errors.)
- * 
- * This is a <I>stateful</I> conversion. Additionally, even when all source data has
- * been consumed, some data may be in the converters' internal state.
- * Call this function repeatedly, updating the target pointers with
- * the next empty chunk of target in case of a
- * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source  pointers
- *  with the next chunk of source when a successful error status is
- * returned, until there are no more chunks of source data.
- * @param converter the Unicode converter
- * @param target I/O parameter. Input : Points to the beginning of the buffer to copy
- *  UChars into. Output : points to after the last UChar copied.
- * @param targetLimit the pointer just after the end of the <TT>target</TT> buffer
- * @param source I/O parameter, pointer to pointer to the source codepage buffer. 
- * @param sourceLimit the pointer to the byte after the end of the source buffer
- * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
- * of allocated cells as <TT>target</TT>. Will fill in offsets from target to source pointer
- * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT> was a result of transcoding <TT>source[6]</TT>
- * For output data carried across calls, and other data without a specific source character
- * (such as from escape sequences or callbacks)  -1 will be placed for offsets. 
- * @param flush set to <TT>TRUE</TT> if the current source buffer is the last available
- * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status is returned,
- * this function may have to be called multiple times with flush set to <TT>TRUE</TT> until
- * the source buffer is consumed.
- * @param err the error status.  <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set if the
- * converter is <TT>NULL</TT>.
- * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and there is 
- * still data to be written to the target. 
- * @see ucnv_fromUChars
- * @see ucnv_convert
- * @see ucnv_getMinCharSize
- * @see ucnv_setFromUCallBack
- * @see ucnv_getNextUChar
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucnv_toUnicode(UConverter *converter,
-               UChar **target,
-               const UChar *targetLimit,
-               const char **source,
-               const char *sourceLimit,
-               int32_t *offsets,
-               UBool flush,
-               UErrorCode *err);
-
-/**
- * Convert the Unicode string into a codepage string using an existing UConverter.
- * The output string is NUL-terminated if possible.
- *
- * This function is a more convenient but less powerful version of ucnv_fromUnicode().
- * It is only useful for whole strings, not for streaming conversion.
- *
- * The maximum output buffer capacity required (barring output from callbacks) will be
- * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)).
- *
- * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called)
- * @param src the input Unicode string
- * @param srcLength the input string length, or -1 if NUL-terminated
- * @param dest destination string buffer, can be NULL if destCapacity==0
- * @param destCapacity the number of chars available at dest
- * @param pErrorCode normal ICU error code;
- *                  common error codes that may be set by this function include
- *                  U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING,
- *                  U_ILLEGAL_ARGUMENT_ERROR, and conversion errors
- * @return the length of the output string, not counting the terminating NUL;
- *         if the length is greater than destCapacity, then the string will not fit
- *         and a buffer of the indicated length would need to be passed in
- * @see ucnv_fromUnicode
- * @see ucnv_convert
- * @see UCNV_GET_MAX_BYTES_FOR_STRING
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_fromUChars(UConverter *cnv,
-                char *dest, int32_t destCapacity,
-                const UChar *src, int32_t srcLength,
-                UErrorCode *pErrorCode);
-
-/**
- * Convert the codepage string into a Unicode string using an existing UConverter.
- * The output string is NUL-terminated if possible.
- *
- * This function is a more convenient but less powerful version of ucnv_toUnicode().
- * It is only useful for whole strings, not for streaming conversion.
- *
- * The maximum output buffer capacity required (barring output from callbacks) will be
- * 2*srcLength (each char may be converted into a surrogate pair).
- *
- * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called)
- * @param src the input codepage string
- * @param srcLength the input string length, or -1 if NUL-terminated
- * @param dest destination string buffer, can be NULL if destCapacity==0
- * @param destCapacity the number of UChars available at dest
- * @param pErrorCode normal ICU error code;
- *                  common error codes that may be set by this function include
- *                  U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING,
- *                  U_ILLEGAL_ARGUMENT_ERROR, and conversion errors
- * @return the length of the output string, not counting the terminating NUL;
- *         if the length is greater than destCapacity, then the string will not fit
- *         and a buffer of the indicated length would need to be passed in
- * @see ucnv_toUnicode
- * @see ucnv_convert
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_toUChars(UConverter *cnv,
-              UChar *dest, int32_t destCapacity,
-              const char *src, int32_t srcLength,
-              UErrorCode *pErrorCode);
-
-/**
- * Convert a codepage buffer into Unicode one character at a time.
- * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set.
- *
- * Advantage compared to ucnv_toUnicode() or ucnv_toUChars():
- * - Faster for small amounts of data, for most converters, e.g.,
- *   US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets.
- *   (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants,
- *    it uses ucnv_toUnicode() internally.)
- * - Convenient.
- *
- * Limitations compared to ucnv_toUnicode():
- * - Always assumes flush=TRUE.
- *   This makes ucnv_getNextUChar() unsuitable for "streaming" conversion,
- *   that is, for where the input is supplied in multiple buffers,
- *   because ucnv_getNextUChar() will assume the end of the input at the end
- *   of the first buffer.
- * - Does not provide offset output.
- *
- * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because
- * ucnv_getNextUChar() uses the current state of the converter
- * (unlike ucnv_toUChars() which always resets first).
- * However, if ucnv_getNextUChar() is called after ucnv_toUnicode()
- * stopped in the middle of a character sequence (with flush=FALSE),
- * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode()
- * internally until the next character boundary.
- * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to
- * start at a character boundary.)
- *
- * Instead of using ucnv_getNextUChar(), it is recommended
- * to convert using ucnv_toUnicode() or ucnv_toUChars()
- * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h)
- * or a C++ CharacterIterator or similar.
- * This allows streaming conversion and offset output, for example.
- *
- * <p>Handling of surrogate pairs and supplementary-plane code points:<br>
- * There are two different kinds of codepages that provide mappings for surrogate characters:
- * <ul>
- *   <li>Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode
- *       code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff.
- *       Each valid sequence will result in exactly one returned code point.
- *       If a sequence results in a single surrogate, then that will be returned
- *       by itself, even if a neighboring sequence encodes the matching surrogate.</li>
- *   <li>Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points
- *       including surrogates. Code points in supplementary planes are represented with
- *       two sequences, each encoding a surrogate.
- *       For these codepages, matching pairs of surrogates will be combined into single
- *       code points for returning from this function.
- *       (Note that SCSU is actually a mix of these codepage types.)</li>
- * </ul></p>
- *
- * @param converter an open UConverter
- * @param source the address of a pointer to the codepage buffer, will be
- *  updated to point after the bytes consumed in the conversion call.
- * @param sourceLimit points to the end of the input buffer
- * @param err fills in error status (see ucnv_toUnicode)
- * <code>U_INDEX_OUTOFBOUNDS_ERROR</code> will be set if the input 
- * is empty or does not convert to any output (e.g.: pure state-change 
- * codes SI/SO, escape sequences for ISO 2022,
- * or if the callback did not output anything, ...).
- * This function will not set a <code>U_BUFFER_OVERFLOW_ERROR</code> because
- *  the "buffer" is the return code. However, there might be subsequent output
- *  stored in the converter object
- * that will be returned in following calls to this function.
- * @return a UChar32 resulting from the partial conversion of source
- * @see ucnv_toUnicode
- * @see ucnv_toUChars
- * @see ucnv_convert
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-ucnv_getNextUChar(UConverter * converter,
-                  const char **source,
-                  const char * sourceLimit,
-                  UErrorCode * err);
-
-/**
- * Convert from one external charset to another using two existing UConverters.
- * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() -
- * are used, "pivoting" through 16-bit Unicode.
- *
- * Important: For streaming conversion (multiple function calls for successive
- * parts of a text stream), the caller must provide a pivot buffer explicitly,
- * and must preserve the pivot buffer and associated pointers from one
- * call to another. (The buffer may be moved if its contents and the relative
- * pointer positions are preserved.)
- *
- * There is a similar function, ucnv_convert(),
- * which has the following limitations:
- * - it takes charset names, not converter objects, so that
- *   - two converters are opened for each call
- *   - only single-string conversion is possible, not streaming operation
- * - it does not provide enough information to find out,
- *   in case of failure, whether the toUnicode or
- *   the fromUnicode conversion failed
- *
- * By contrast, ucnv_convertEx()
- * - takes UConverter parameters instead of charset names
- * - fully exposes the pivot buffer for streaming conversion and complete error handling
- *
- * ucnv_convertEx() also provides further convenience:
- * - an option to reset the converters at the beginning
- *   (if reset==TRUE, see parameters;
- *    also sets *pivotTarget=*pivotSource=pivotStart)
- * - allow NUL-terminated input
- *   (only a single NUL byte, will not work for charsets with multi-byte NULs)
- *   (if sourceLimit==NULL, see parameters)
- * - terminate with a NUL on output
- *   (only a single NUL byte, not useful for charsets with multi-byte NULs),
- *   or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills
- *   the target buffer
- * - the pivot buffer can be provided internally;
- *   possible only for whole-string conversion, not streaming conversion;
- *   in this case, the caller will not be able to get details about where an
- *   error occurred
- *   (if pivotStart==NULL, see below)
- *
- * The function returns when one of the following is true:
- * - the entire source text has been converted successfully to the target buffer
- * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR)
- * - a conversion error occurred
- *   (other U_FAILURE(), see description of pErrorCode)
- *
- * Limitation compared to the direct use of
- * ucnv_fromUnicode() and ucnv_toUnicode():
- * ucnv_convertEx() does not provide offset information.
- *
- * Limitation compared to ucnv_fromUChars() and ucnv_toUChars():
- * ucnv_convertEx() does not support preflighting directly.
- *
- * Sample code for converting a single string from
- * one external charset to UTF-8, ignoring the location of errors:
- *
- * \code
- * int32_t
- * myToUTF8(UConverter *cnv,
- *          const char *s, int32_t length,
- *          char *u8, int32_t capacity,
- *          UErrorCode *pErrorCode) {
- *     UConverter *utf8Cnv;
- *     char *target;
- *
- *     if(U_FAILURE(*pErrorCode)) {
- *         return 0;
- *     }
- *
- *     utf8Cnv=myGetCachedUTF8Converter(pErrorCode);
- *     if(U_FAILURE(*pErrorCode)) {
- *         return 0;
- *     }
- *
- *     if(length<0) {
- *         length=strlen(s);
- *     }
- *     target=u8;
- *     ucnv_convertEx(utf8Cnv, cnv,
- *                    &target, u8+capacity,
- *                    &s, s+length,
- *                    NULL, NULL, NULL, NULL,
- *                    TRUE, TRUE,
- *                    pErrorCode);
- * 
- *     myReleaseCachedUTF8Converter(utf8Cnv);
- *
- *     // return the output string length, but without preflighting
- *     return (int32_t)(target-u8);
- * }
- * \endcode
- *
- * @param targetCnv     Output converter, used to convert from the UTF-16 pivot
- *                      to the target using ucnv_fromUnicode().
- * @param sourceCnv     Input converter, used to convert from the source to
- *                      the UTF-16 pivot using ucnv_toUnicode().
- * @param target        I/O parameter, same as for ucnv_fromUChars().
- *                      Input: *target points to the beginning of the target buffer.
- *                      Output: *target points to the first unit after the last char written.
- * @param targetLimit   Pointer to the first unit after the target buffer.
- * @param source        I/O parameter, same as for ucnv_toUChars().
- *                      Input: *source points to the beginning of the source buffer.
- *                      Output: *source points to the first unit after the last char read.
- * @param sourceLimit   Pointer to the first unit after the source buffer.
- * @param pivotStart    Pointer to the UTF-16 pivot buffer. If pivotStart==NULL,
- *                      then an internal buffer is used and the other pivot
- *                      arguments are ignored and can be NULL as well.
- * @param pivotSource   I/O parameter, same as source in ucnv_fromUChars() for
- *                      conversion from the pivot buffer to the target buffer.
- * @param pivotTarget   I/O parameter, same as target in ucnv_toUChars() for
- *                      conversion from the source buffer to the pivot buffer.
- *                      It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit
- *                      and pivotStart<pivotLimit (unless pivotStart==NULL).
- * @param pivotLimit    Pointer to the first unit after the pivot buffer.
- * @param reset         If TRUE, then ucnv_resetToUnicode(sourceCnv) and
- *                      ucnv_resetFromUnicode(targetCnv) are called, and the
- *                      pivot pointers are reset (*pivotTarget=*pivotSource=pivotStart).
- * @param flush         If true, indicates the end of the input.
- *                      Passed directly to ucnv_toUnicode(), and carried over to
- *                      ucnv_fromUnicode() when the source is empty as well.
- * @param pErrorCode    ICU error code in/out parameter.
- *                      Must fulfill U_SUCCESS before the function call.
- *                      U_BUFFER_OVERFLOW_ERROR always refers to the target buffer
- *                      because overflows into the pivot buffer are handled internally.
- *                      Other conversion errors are from the source-to-pivot
- *                      conversion if *pivotSource==pivotStart, otherwise from
- *                      the pivot-to-target conversion.
- *
- * @see ucnv_convert
- * @see ucnv_fromAlgorithmic
- * @see ucnv_toAlgorithmic
- * @see ucnv_fromUnicode
- * @see ucnv_toUnicode
- * @see ucnv_fromUChars
- * @see ucnv_toUChars
- * @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
-ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
-               char **target, const char *targetLimit,
-               const char **source, const char *sourceLimit,
-               UChar *pivotStart, UChar **pivotSource,
-               UChar **pivotTarget, const UChar *pivotLimit,
-               UBool reset, UBool flush,
-               UErrorCode *pErrorCode);
-
-/**
- * Convert from one external charset to another.
- * Internally, two converters are opened according to the name arguments,
- * then the text is converted to and from the 16-bit Unicode "pivot"
- * using ucnv_convertEx(), then the converters are closed again.
- *
- * This is a convenience function, not an efficient way to convert a lot of text:
- * ucnv_convert()
- * - takes charset names, not converter objects, so that
- *   - two converters are opened for each call
- *   - only single-string conversion is possible, not streaming operation
- * - does not provide enough information to find out,
- *   in case of failure, whether the toUnicode or
- *   the fromUnicode conversion failed
- * - allows NUL-terminated input
- *   (only a single NUL byte, will not work for charsets with multi-byte NULs)
- *   (if sourceLength==-1, see parameters)
- * - terminate with a NUL on output
- *   (only a single NUL byte, not useful for charsets with multi-byte NULs),
- *   or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills
- *   the target buffer
- * - a pivot buffer is provided internally
- *
- * The function returns when one of the following is true:
- * - the entire source text has been converted successfully to the target buffer
- *   and either the target buffer is terminated with a single NUL byte
- *   or the error code is set to U_STRING_NOT_TERMINATED_WARNING
- * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR)
- *   and the full output string length is returned ("preflighting")
- * - a conversion error occurred
- *   (other U_FAILURE(), see description of pErrorCode)
- *
- * @param toConverterName   The name of the converter that is used to convert
- *                          from the UTF-16 pivot buffer to the target.
- * @param fromConverterName The name of the converter that is used to convert
- *                          from the source to the UTF-16 pivot buffer.
- * @param target            Pointer to the output buffer.
- * @param targetCapacity    Capacity of the target, in bytes.
- * @param source            Pointer to the input buffer.
- * @param sourceLength      Length of the input text, in bytes, or -1 for NUL-terminated input.
- * @param pErrorCode        ICU error code in/out parameter.
- *                          Must fulfill U_SUCCESS before the function call.
- * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
- *         and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucnv_convertEx
- * @see ucnv_fromAlgorithmic
- * @see ucnv_toAlgorithmic
- * @see ucnv_fromUnicode
- * @see ucnv_toUnicode
- * @see ucnv_fromUChars
- * @see ucnv_toUChars
- * @see ucnv_getNextUChar
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_convert(const char *toConverterName,
-             const char *fromConverterName,
-             char *target,
-             int32_t targetCapacity,
-             const char *source,
-             int32_t sourceLength,
-             UErrorCode *pErrorCode);
-
-/**
- * Convert from one external charset to another.
- * Internally, the text is converted to and from the 16-bit Unicode "pivot"
- * using ucnv_convertEx(). ucnv_toAlgorithmic() works exactly like ucnv_convert()
- * except that the two converters need not be looked up and opened completely.
- *
- * The source-to-pivot conversion uses the cnv converter parameter.
- * The pivot-to-target conversion uses a purely algorithmic converter
- * according to the specified type, e.g., UCNV_UTF8 for a UTF-8 converter.
- *
- * Internally, the algorithmic converter is opened and closed for each
- * function call, which is more efficient than using the public ucnv_open()
- * but somewhat less efficient than only resetting an existing converter
- * and using ucnv_convertEx().
- *
- * This function is more convenient than ucnv_convertEx() for single-string
- * conversions, especially when "preflighting" is desired (returning the length
- * of the complete output even if it does not fit into the target buffer;
- * see the User Guide Strings chapter). See ucnv_convert() for details.
- *
- * @param algorithmicType   UConverterType constant identifying the desired target
- *                          charset as a purely algorithmic converter.
- *                          Those are converters for Unicode charsets like
- *                          UTF-8, BOCU-1, SCSU, UTF-7, IMAP-mailbox-name, etc.,
- *                          as well as US-ASCII and ISO-8859-1.
- * @param cnv               The converter that is used to convert
- *                          from the source to the UTF-16 pivot buffer.
- * @param target            Pointer to the output buffer.
- * @param targetCapacity    Capacity of the target, in bytes.
- * @param source            Pointer to the input buffer.
- * @param sourceLength      Length of the input text, in bytes
- * @param pErrorCode        ICU error code in/out parameter.
- *                          Must fulfill U_SUCCESS before the function call.
- * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
- *         and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucnv_fromAlgorithmic
- * @see ucnv_convert
- * @see ucnv_convertEx
- * @see ucnv_fromUnicode
- * @see ucnv_toUnicode
- * @see ucnv_fromUChars
- * @see ucnv_toUChars
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_toAlgorithmic(UConverterType algorithmicType,
-                   UConverter *cnv,
-                   char *target, int32_t targetCapacity,
-                   const char *source, int32_t sourceLength,
-                   UErrorCode *pErrorCode);
-
-/**
- * Convert from one external charset to another.
- * Internally, the text is converted to and from the 16-bit Unicode "pivot"
- * using ucnv_convertEx(). ucnv_fromAlgorithmic() works exactly like ucnv_convert()
- * except that the two converters need not be looked up and opened completely.
- *
- * The source-to-pivot conversion uses a purely algorithmic converter
- * according to the specified type, e.g., UCNV_UTF8 for a UTF-8 converter.
- * The pivot-to-target conversion uses the cnv converter parameter.
- *
- * Internally, the algorithmic converter is opened and closed for each
- * function call, which is more efficient than using the public ucnv_open()
- * but somewhat less efficient than only resetting an existing converter
- * and using ucnv_convertEx().
- *
- * This function is more convenient than ucnv_convertEx() for single-string
- * conversions, especially when "preflighting" is desired (returning the length
- * of the complete output even if it does not fit into the target buffer;
- * see the User Guide Strings chapter). See ucnv_convert() for details.
- *
- * @param cnv               The converter that is used to convert
- *                          from the UTF-16 pivot buffer to the target.
- * @param algorithmicType   UConverterType constant identifying the desired source
- *                          charset as a purely algorithmic converter.
- *                          Those are converters for Unicode charsets like
- *                          UTF-8, BOCU-1, SCSU, UTF-7, IMAP-mailbox-name, etc.,
- *                          as well as US-ASCII and ISO-8859-1.
- * @param target            Pointer to the output buffer.
- * @param targetCapacity    Capacity of the target, in bytes.
- * @param source            Pointer to the input buffer.
- * @param sourceLength      Length of the input text, in bytes
- * @param pErrorCode        ICU error code in/out parameter.
- *                          Must fulfill U_SUCCESS before the function call.
- * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
- *         and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucnv_fromAlgorithmic
- * @see ucnv_convert
- * @see ucnv_convertEx
- * @see ucnv_fromUnicode
- * @see ucnv_toUnicode
- * @see ucnv_fromUChars
- * @see ucnv_toUChars
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_fromAlgorithmic(UConverter *cnv,
-                     UConverterType algorithmicType,
-                     char *target, int32_t targetCapacity,
-                     const char *source, int32_t sourceLength,
-                     UErrorCode *pErrorCode);
-
-/**
- * Frees up memory occupied by unused, cached converter shared data.
- *
- * @return the number of cached converters successfully deleted
- * @see ucnv_close
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_flushCache(void);
-
-/**
- * Returns the number of available converters, as per the alias file.
- *
- * @return the number of available converters
- * @see ucnv_getAvailableName
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_countAvailable(void);
-
-/**
- * Gets the canonical converter name of the specified converter from a list of
- * all available converters contaied in the alias file. All converters
- * in this list can be opened.
- *
- * @param n the index to a converter available on the system (in the range <TT>[0..ucnv_countAvaiable()]</TT>)
- * @return a pointer a string (library owned), or <TT>NULL</TT> if the index is out of bounds.
- * @see ucnv_countAvailable
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2
-ucnv_getAvailableName(int32_t n);
-
-/**
- * Returns a UEnumeration to enumerate all of the canonical converter
- * names, as per the alias file, regardless of the ability to open each
- * converter.
- *
- * @return A UEnumeration object for getting all the recognized canonical
- *   converter names.
- * @see ucnv_getAvailableName
- * @see uenum_close
- * @see uenum_next
- * @stable ICU 2.4
- */
-U_STABLE UEnumeration * U_EXPORT2
-ucnv_openAllNames(UErrorCode *pErrorCode);
-
-/**
- * Gives the number of aliases for a given converter or alias name.
- * If the alias is ambiguous, then the preferred converter is used
- * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
- * This method only enumerates the listed entries in the alias file.
- * @param alias alias name
- * @param pErrorCode error status
- * @return number of names on alias list for given alias
- * @stable ICU 2.0
- */
-U_STABLE uint16_t U_EXPORT2 
-ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
-
-/**
- * Gives the name of the alias at given index of alias list.
- * This method only enumerates the listed entries in the alias file.
- * If the alias is ambiguous, then the preferred converter is used
- * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
- * @param alias alias name
- * @param n index in alias list
- * @param pErrorCode result of operation
- * @return returns the name of the alias at given index
- * @see ucnv_countAliases
- * @stable ICU 2.0
- */
-U_STABLE const char * U_EXPORT2 
-ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
-
-/**
- * Fill-up the list of alias names for the given alias.
- * This method only enumerates the listed entries in the alias file.
- * If the alias is ambiguous, then the preferred converter is used
- * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
- * @param alias alias name
- * @param aliases fill-in list, aliases is a pointer to an array of
- *        <code>ucnv_countAliases()</code> string-pointers
- *        (<code>const char *</code>) that will be filled in.
- *        The strings themselves are owned by the library.
- * @param pErrorCode result of operation
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
-
-/**
- * Return a new UEnumeration object for enumerating all the
- * alias names for a given converter that are recognized by a standard.
- * This method only enumerates the listed entries in the alias file.
- * The convrtrs.txt file can be modified to change the results of
- * this function.
- * The first result in this list is the same result given by
- * <code>ucnv_getStandardName</code>, which is the default alias for
- * the specified standard name. The returned object must be closed with
- * <code>uenum_close</code> when you are done with the object.
- *
- * @param convName original converter name
- * @param standard name of the standard governing the names; MIME and IANA
- *      are such standards
- * @param pErrorCode The error code
- * @return A UEnumeration object for getting all aliases that are recognized
- *      by a standard. If any of the parameters are invalid, NULL
- *      is returned.
- * @see ucnv_getStandardName
- * @see uenum_close
- * @see uenum_next
- * @stable ICU 2.2
- */
-U_STABLE UEnumeration * U_EXPORT2
-ucnv_openStandardNames(const char *convName,
-                       const char *standard,
-                       UErrorCode *pErrorCode);
-
-/**
- * Gives the number of standards associated to converter names.
- * @return number of standards
- * @stable ICU 2.0
- */
-U_STABLE uint16_t U_EXPORT2
-ucnv_countStandards(void);
-
-/**
- * Gives the name of the standard at given index of standard list.
- * @param n index in standard list
- * @param pErrorCode result of operation
- * @return returns the name of the standard at given index. Owned by the library.
- * @stable ICU 2.0
- */
-U_STABLE const char * U_EXPORT2
-ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
-
-/**
- * Returns a standard name for a given converter name.
- * <p>
- * Example alias table:<br>
- * conv alias1 { STANDARD1 } alias2 { STANDARD1* }
- * <p>
- * Result of ucnv_getStandardName("conv", "STANDARD1") from example
- * alias table:<br>
- * <b>"alias2"</b>
- *
- * @param name original converter name
- * @param standard name of the standard governing the names; MIME and IANA
- *        are such standards
- * @param pErrorCode result of operation
- * @return returns the standard converter name;
- *         if a standard converter name cannot be determined,
- *         then <code>NULL</code> is returned. Owned by the library.
- * @stable ICU 2.0
- */
-U_STABLE const char * U_EXPORT2
-ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
-
-/**
- * This function will return the internal canonical converter name of the
- * tagged alias. This is the opposite of ucnv_openStandardNames, which
- * returns the tagged alias given the canonical name.
- * <p>
- * Example alias table:<br>
- * conv alias1 { STANDARD1 } alias2 { STANDARD1* }
- * <p>
- * Result of ucnv_getStandardName("alias1", "STANDARD1") from example
- * alias table:<br>
- * <b>"conv"</b>
- *
- * @return returns the canonical converter name;
- *         if a standard or alias name cannot be determined,
- *         then <code>NULL</code> is returned. The returned string is
- *         owned by the library.
- * @see ucnv_getStandardName
- * @stable ICU 2.4
- */
-U_STABLE const char * U_EXPORT2
-ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
-
-/**
- * Returns the current default converter name. If you want to open
- * a default converter, you do not need to use this function.
- * It is faster if you pass a NULL argument to ucnv_open the
- * default converter.
- *
- * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function
- * always returns "UTF-8".
- *
- * @return returns the current default converter name.
- *         Storage owned by the library
- * @see ucnv_setDefaultName
- * @stable ICU 2.0
- */
-U_STABLE const char * U_EXPORT2
-ucnv_getDefaultName(void);
-
-/**
- * This function is not thread safe. DO NOT call this function when ANY ICU
- * function is being used from more than one thread! This function sets the
- * current default converter name. If this function needs to be called, it
- * should be called during application initialization. Most of the time, the
- * results from ucnv_getDefaultName() or ucnv_open with a NULL string argument
- * is sufficient for your application.
- *
- * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function
- * does nothing.
- *
- * @param name the converter name to be the default (must be known by ICU).
- * @see ucnv_getDefaultName
- * @system
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_setDefaultName(const char *name);
-
-/**
- * Fixes the backslash character mismapping.  For example, in SJIS, the backslash 
- * character in the ASCII portion is also used to represent the yen currency sign.  
- * When mapping from Unicode character 0x005C, it's unclear whether to map the 
- * character back to yen or backslash in SJIS.  This function will take the input
- * buffer and replace all the yen sign characters with backslash.  This is necessary
- * when the user tries to open a file with the input buffer on Windows.
- * This function will test the converter to see whether such mapping is
- * required.  You can sometimes avoid using this function by using the correct version
- * of Shift-JIS.
- *
- * @param cnv The converter representing the target codepage.
- * @param source the input buffer to be fixed
- * @param sourceLen the length of the input buffer
- * @see ucnv_isAmbiguous
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
-
-/**
- * Determines if the converter contains ambiguous mappings of the same
- * character or not.
- * @param cnv the converter to be tested
- * @return TRUE if the converter contains ambiguous mapping of the same 
- * character, FALSE otherwise.
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2
-ucnv_isAmbiguous(const UConverter *cnv);
-
-/**
- * Sets the converter to use fallback mappings or not.
- * Regardless of this flag, the converter will always use
- * fallbacks from Unicode Private Use code points, as well as
- * reverse fallbacks (to Unicode).
- * For details see ".ucm File Format"
- * in the Conversion Data chapter of the ICU User Guide:
- * http://www.icu-project.org/userguide/conversion-data.html#ucmformat
- *
- * @param cnv The converter to set the fallback mapping usage on.
- * @param usesFallback TRUE if the user wants the converter to take advantage of the fallback 
- * mapping, FALSE otherwise.
- * @stable ICU 2.0
- * @see ucnv_usesFallback
- */
-U_STABLE void U_EXPORT2 
-ucnv_setFallback(UConverter *cnv, UBool usesFallback);
-
-/**
- * Determines if the converter uses fallback mappings or not.
- * This flag has restrictions, see ucnv_setFallback().
- *
- * @param cnv The converter to be tested
- * @return TRUE if the converter uses fallback, FALSE otherwise.
- * @stable ICU 2.0
- * @see ucnv_setFallback
- */
-U_STABLE UBool U_EXPORT2 
-ucnv_usesFallback(const UConverter *cnv);
-
-/**
- * Detects Unicode signature byte sequences at the start of the byte stream
- * and returns the charset name of the indicated Unicode charset.
- * NULL is returned when no Unicode signature is recognized.
- * The number of bytes in the signature is output as well.
- *
- * The caller can ucnv_open() a converter using the charset name.
- * The first code unit (UChar) from the start of the stream will be U+FEFF
- * (the Unicode BOM/signature character) and can usually be ignored.
- *
- * For most Unicode charsets it is also possible to ignore the indicated
- * number of initial stream bytes and start converting after them.
- * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which
- * this will not work. Therefore, it is best to ignore the first output UChar
- * instead of the input signature bytes.
- * <p>
- * Usage:
- * @code     
- *      UErrorCode err = U_ZERO_ERROR;
- *      char input[] = { '\xEF','\xBB', '\xBF','\x41','\x42','\x43' };
- *      int32_t signatureLength = 0;
- *      char *encoding = ucnv_detectUnicodeSignature(input,sizeof(input),&signatureLength,&err);
- *      UConverter *conv = NULL;
- *      UChar output[100];
- *      UChar *target = output, *out;
- *      char *source = input;
- *      if(encoding!=NULL && U_SUCCESS(err)){
- *          // should signature be discarded ?
- *          conv = ucnv_open(encoding, &err);
- *          // do the conversion
- *          ucnv_toUnicode(conv,
- *                         target, output + sizeof(output)/U_SIZEOF_UCHAR,
- *                         source, input + sizeof(input),
- *                         NULL, TRUE, &err);
- *          out = output;
- *          if (discardSignature){
- *              ++out; // ignore initial U+FEFF
- *          }
- *          while(out != target) {
- *              printf("%04x ", *out++);
- *          }
- *          puts("");
- *      }
- *     
- * @endcode
- *
- * @param source            The source string in which the signature should be detected.
- * @param sourceLength      Length of the input string, or -1 if terminated with a NUL byte.
- * @param signatureLength   A pointer to int32_t to receive the number of bytes that make up the signature 
- *                          of the detected UTF. 0 if not detected.
- *                          Can be a NULL pointer.
- * @param pErrorCode        ICU error code in/out parameter.
- *                          Must fulfill U_SUCCESS before the function call.
- * @return The name of the encoding detected. NULL if encoding is not detected. 
- * @stable ICU 2.4
- */
-U_STABLE const char* U_EXPORT2
-ucnv_detectUnicodeSignature(const char* source,
-                            int32_t sourceLength,
-                            int32_t *signatureLength,
-                            UErrorCode *pErrorCode);
-
-/**
- * Returns the number of UChars held in the converter's internal state 
- * because more input is needed for completing the conversion. This function is 
- * useful for mapping semantics of ICU's converter interface to those of iconv,
- * and this information is not needed for normal conversion.
- * @param cnv       The converter in which the input is held
- * @param status    ICU error code in/out parameter.
- *                  Must fulfill U_SUCCESS before the function call.
- * @return The number of UChars in the state. -1 if an error is encountered.
- * @stable ICU 3.4
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
-
-/**
- * Returns the number of chars held in the converter's internal state
- * because more input is needed for completing the conversion. This function is 
- * useful for mapping semantics of ICU's converter interface to those of iconv,
- * and this information is not needed for normal conversion.
- * @param cnv       The converter in which the input is held as internal state
- * @param status    ICU error code in/out parameter.
- *                  Must fulfill U_SUCCESS before the function call.
- * @return The number of chars in the state. -1 if an error is encountered.
- * @stable ICU 3.4
- */
-U_STABLE int32_t U_EXPORT2
-ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
-
-#endif
-
-#endif
-/*_UCNV*/
diff --git a/Source/core/icu/unicode/ucnv_cb.h b/Source/core/icu/unicode/ucnv_cb.h
deleted file mode 100644
index f0e67ba..0000000
--- a/Source/core/icu/unicode/ucnv_cb.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 2000-2004, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
- *  ucnv_cb.h:
- *  External APIs for the ICU's codeset conversion library
- *  Helena Shih
- * 
- * Modification History:
- *
- *   Date        Name        Description
- */
-
-/**
- * \file 
- * \brief C UConverter functions to aid the writers of callbacks
- *
- * <h2> Callback API for UConverter </h2>
- * 
- * These functions are provided here for the convenience of the callback
- * writer. If you are just looking for callback functions to use, please
- * see ucnv_err.h.  DO NOT call these functions directly when you are 
- * working with converters, unless your code has been called as a callback
- * via ucnv_setFromUCallback or ucnv_setToUCallback !!
- * 
- * A note about error codes and overflow.  Unlike other ICU functions,
- * these functions do not expect the error status to be U_ZERO_ERROR.
- * Callbacks must be much more careful about their error codes.
- * The error codes used here are in/out parameters, which should be passed
- * back in the callback's error parameter.
- * 
- * For example, if you call ucnv_cbfromUWriteBytes to write data out 
- * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if 
- * the data did not fit in the target. But this isn't a failing error, 
- * in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error
- * status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes,
- * which will also go into the internal overflow buffers.
- * 
- * Concerning offsets, the 'offset' parameters here are relative to the start
- * of SOURCE.  For example, Suppose the string "ABCD" was being converted 
- * from Unicode into a codepage which doesn't have a mapping for 'B'.
- * 'A' will be written out correctly, but
- * The FromU Callback will be called on an unassigned character for 'B'.
- * At this point, this is the state of the world:
- *    Target:    A [..]     [points after A]
- *    Source:  A B [C] D    [points to C - B has been consumed]
- *             0 1  2  3 
- *    codePoint = "B"       [the unassigned codepoint] 
- * 
- * Now, suppose a callback wants to write the substitution character '?' to
- * the target. It calls ucnv_cbFromUWriteBytes() to write the ?. 
- * It should pass ZERO as the offset, because the offset as far as the 
- * callback is concerned is relative to the SOURCE pointer [which points 
- * before 'C'.]  If the callback goes into the args and consumes 'C' also,
- * it would call FromUWriteBytes with an offset of 1 (and advance the source
- * pointer).
- *
- */
-
-#ifndef UCNV_CB_H
-#define UCNV_CB_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_err.h"
-
-/**
- * ONLY used by FromU callback functions.
- * Writes out the specified byte output bytes to the target byte buffer or to converter internal buffers.
- *
- * @param args callback fromUnicode arguments
- * @param source source bytes to write
- * @param length length of bytes to write
- * @param offsetIndex the relative offset index from callback.
- * @param err error status. If <TT>U_BUFFER_OVERFLOW</TT> is returned, then U_BUFFER_OVERFLOW <STRONG>must</STRONG> 
- * be returned to the user, because it means that not all data could be written into the target buffer, and some is 
- * in the converter error buffer.
- * @see ucnv_cbFromUWriteSub
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args,
-                        const char* source,
-                        int32_t length,
-                        int32_t offsetIndex,
-                        UErrorCode * err);
-
-/**
- * ONLY used by FromU callback functions.  
- * This function will write out the correct substitution character sequence 
- * to the target.
- *
- * @param args callback fromUnicode arguments
- * @param offsetIndex the relative offset index from the current source pointer to be used
- * @param err error status. If <TT>U_BUFFER_OVERFLOW</TT> is returned, then U_BUFFER_OVERFLOW <STRONG>must</STRONG> 
- * be returned to the user, because it means that not all data could be written into the target buffer, and some is 
- * in the converter error buffer.
- * @see ucnv_cbFromUWriteBytes
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
-                      int32_t offsetIndex,
-                      UErrorCode * err);
-
-/**
- * ONLY used by fromU callback functions.  
- * This function will write out the error character(s) to the target UChar buffer.
- *
- * @param args callback fromUnicode arguments
- * @param source pointer to pointer to first UChar to write [on exit: 1 after last UChar processed]
- * @param sourceLimit pointer after last UChar to write
- * @param offsetIndex the relative offset index from callback which will be set
- * @param err error status <TT>U_BUFFER_OVERFLOW</TT>
- * @see ucnv_cbToUWriteSub
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
-                             const UChar** source,
-                             const UChar*  sourceLimit,
-                             int32_t offsetIndex,
-                             UErrorCode * err);
-
-/**
- * ONLY used by ToU callback functions.
- *  This function will write out the specified characters to the target 
- * UChar buffer.
- *
- * @param args callback toUnicode arguments
- * @param source source string to write
- * @param length the length of source string
- * @param offsetIndex the relative offset index which will be written.
- * @param err error status <TT>U_BUFFER_OVERFLOW</TT>
- * @see ucnv_cbToUWriteSub
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args,
-                                             const UChar* source,
-                                             int32_t length,
-                                             int32_t offsetIndex,
-                                             UErrorCode * err);
-
-/**
- * ONLY used by ToU  callback functions.  
- * This function will write out the Unicode substitution character (U+FFFD).
- *
- * @param args callback fromUnicode arguments
- * @param offsetIndex the relative offset index from callback.
- * @param err error status <TT>U_BUFFER_OVERFLOW</TT>
- * @see ucnv_cbToUWriteUChars
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args,
-                       int32_t offsetIndex,
-                       UErrorCode * err);
-#endif
-
-#endif
diff --git a/Source/core/icu/unicode/ucnv_err.h b/Source/core/icu/unicode/ucnv_err.h
deleted file mode 100644
index e092e95..0000000
--- a/Source/core/icu/unicode/ucnv_err.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1999-2009, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
- *
- *
- *   ucnv_err.h:
- */
-
-/**
- * \file
- * \brief C UConverter predefined error callbacks
- *
- *  <h2>Error Behaviour Functions</h2>
- *  Defines some error behaviour functions called by ucnv_{from,to}Unicode
- *  These are provided as part of ICU and many are stable, but they
- *  can also be considered only as an example of what can be done with
- *  callbacks.  You may of course write your own.
- *
- *  If you want to write your own, you may also find the functions from
- *  ucnv_cb.h useful when writing your own callbacks.
- *
- *  These functions, although public, should NEVER be called directly.
- *  They should be used as parameters to the ucnv_setFromUCallback
- *  and ucnv_setToUCallback functions, to set the behaviour of a converter
- *  when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
- *
- *  usage example:  'STOP' doesn't need any context, but newContext
- *    could be set to something other than 'NULL' if needed. The available
- *    contexts in this header can modify the default behavior of the callback.
- *
- *  \code
- *  UErrorCode err = U_ZERO_ERROR;
- *  UConverter *myConverter = ucnv_open("ibm-949", &err);
- *  const void *oldContext;
- *  UConverterFromUCallback oldAction;
- *
- *
- *  if (U_SUCCESS(err))
- *  {
- *      ucnv_setFromUCallBack(myConverter,
- *                       UCNV_FROM_U_CALLBACK_STOP,
- *                       NULL,
- *                       &oldAction,
- *                       &oldContext,
- *                       &status);
- *  }
- *  \endcode
- *
- *  The code above tells "myConverter" to stop when it encounters an
- *  ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
- *  Unicode -> Codepage. The behavior from Codepage to Unicode is not changed,
- *  and ucnv_setToUCallBack would need to be called in order to change
- *  that behavior too.
- *
- *  Here is an example with a context:
- *
- *  \code
- *  UErrorCode err = U_ZERO_ERROR;
- *  UConverter *myConverter = ucnv_open("ibm-949", &err);
- *  const void *oldContext;
- *  UConverterFromUCallback oldAction;
- *
- *
- *  if (U_SUCCESS(err))
- *  {
- *      ucnv_setToUCallBack(myConverter,
- *                       UCNV_TO_U_CALLBACK_SUBSTITUTE,
- *                       UCNV_SUB_STOP_ON_ILLEGAL,
- *                       &oldAction,
- *                       &oldContext,
- *                       &status);
- *  }
- *  \endcode
- *
- *  The code above tells "myConverter" to stop when it encounters an
- *  ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
- *  Codepage -> Unicode. Any unmapped and legal characters will be
- *  substituted to be the default substitution character.
- */
-
-#ifndef UCNV_ERR_H
-#define UCNV_ERR_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-/** Forward declaring the UConverter structure. @stable ICU 2.0 */
-struct UConverter;
-
-/** @stable ICU 2.0 */
-typedef struct UConverter UConverter;
-
-/**
- * FROM_U, TO_U context options for sub callback
- * @stable ICU 2.0
- */
-#define UCNV_SUB_STOP_ON_ILLEGAL "i"
-
-/**
- * FROM_U, TO_U context options for skip callback
- * @stable ICU 2.0
- */
-#define UCNV_SKIP_STOP_ON_ILLEGAL "i"
-
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) 
- * @stable ICU 2.0
- */
-#define UCNV_ESCAPE_ICU       NULL
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX)
- * @stable ICU 2.0
- */
-#define UCNV_ESCAPE_JAVA      "J"
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
- * TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX)
- * @stable ICU 2.0
- */
-#define UCNV_ESCAPE_C         "C"
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
- * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
- * @stable ICU 2.0
- */
-#define UCNV_ESCAPE_XML_DEC   "D"
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
- * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
- * @stable ICU 2.0
- */
-#define UCNV_ESCAPE_XML_HEX   "X"
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX)
- * @stable ICU 2.0
- */
-#define UCNV_ESCAPE_UNICODE   "U"
-
-/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H<space>, that is,
- * a backslash, 1..6 hex digits, and a space)
- * @stable ICU 4.0
- */
-#define UCNV_ESCAPE_CSS2   "S"
-
-/** 
- * The process condition code to be used with the callbacks.  
- * Codes which are greater than UCNV_IRREGULAR should be 
- * passed on to any chained callbacks.
- * @stable ICU 2.0
- */
-typedef enum {
-    UCNV_UNASSIGNED = 0,  /**< The code point is unassigned.
-                             The error code U_INVALID_CHAR_FOUND will be set. */
-    UCNV_ILLEGAL = 1,     /**< The code point is illegal. For example, 
-                             \\x81\\x2E is illegal in SJIS because \\x2E
-                             is not a valid trail byte for the \\x81 
-                             lead byte.
-                             Also, starting with Unicode 3.0.1, non-shortest byte sequences
-                             in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
-                             are also illegal, not just irregular.
-                             The error code U_ILLEGAL_CHAR_FOUND will be set. */
-    UCNV_IRREGULAR = 2,   /**< The codepoint is not a regular sequence in 
-                             the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
-                             are irregular UTF-8 byte sequences for single surrogate
-                             code points.
-                             The error code U_INVALID_CHAR_FOUND will be set. */
-    UCNV_RESET = 3,       /**< The callback is called with this reason when a
-                             'reset' has occured. Callback should reset all
-                             state. */
-    UCNV_CLOSE = 4,        /**< Called when the converter is closed. The
-                             callback should release any allocated memory.*/
-    UCNV_CLONE = 5         /**< Called when ucnv_safeClone() is called on the
-                              converter. the pointer available as the
-                              'context' is an alias to the original converters'
-                              context pointer. If the context must be owned
-                              by the new converter, the callback must clone 
-                              the data and call ucnv_setFromUCallback 
-                              (or setToUCallback) with the correct pointer.
-                              @stable ICU 2.2
-                           */
-} UConverterCallbackReason;
-
-
-/**
- * The structure for the fromUnicode callback function parameter.
- * @stable ICU 2.0
- */
-typedef struct {
-    uint16_t size;              /**< The size of this struct. @stable ICU 2.0 */
-    UBool flush;                /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0    */
-    UConverter *converter;      /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0  */
-    const UChar *source;        /**< Pointer to the source source buffer. @stable ICU 2.0    */
-    const UChar *sourceLimit;   /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0    */
-    char *target;               /**< Pointer to the target buffer. @stable ICU 2.0    */
-    const char *targetLimit;    /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0     */
-    int32_t *offsets;           /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0  */
-} UConverterFromUnicodeArgs;
-
-
-/**
- * The structure for the toUnicode callback function parameter.
- * @stable ICU 2.0
- */
-typedef struct {
-    uint16_t size;              /**< The size of this struct   @stable ICU 2.0 */
-    UBool flush;                /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0   */
-    UConverter *converter;      /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
-    const char *source;         /**< Pointer to the source source buffer. @stable ICU 2.0    */
-    const char *sourceLimit;    /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0    */
-    UChar *target;              /**< Pointer to the target buffer. @stable ICU 2.0    */
-    const UChar *targetLimit;   /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0     */
-    int32_t *offsets;           /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0  */
-} UConverterToUnicodeArgs;
-
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,
- * returning the error code back to the caller immediately.
- *
- * @param context Pointer to the callback's private data
- * @param fromUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
- * @param reason Defines the reason the callback was invoked
- * @param err This should always be set to a failure status prior to calling.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
-                  const void *context,
-                  UConverterFromUnicodeArgs *fromUArgs,
-                  const UChar* codeUnits,
-                  int32_t length,
-                  UChar32 codePoint,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,
- * returning the error code back to the caller immediately.
- *
- * @param context Pointer to the callback's private data
- * @param toUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param reason Defines the reason the callback was invoked
- * @param err This should always be set to a failure status prior to calling.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
-                  const void *context,
-                  UConverterToUnicodeArgs *toUArgs,
-                  const char* codeUnits,
-                  int32_t length,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This From Unicode callback skips any ILLEGAL_SEQUENCE, or
- * skips only UNASSINGED_SEQUENCE depending on the context parameter
- * simply ignoring those characters. 
- *
- * @param context  The function currently recognizes the callback options:
- *                 UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
- *                      returning the error code back to the caller immediately.
- *                 NULL: Skips any ILLEGAL_SEQUENCE
- * @param fromUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
- * @param reason Defines the reason the callback was invoked
- * @param err Return value will be set to success if the callback was handled,
- *      otherwise this value will be set to a failure status.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
-                  const void *context,
-                  UConverterFromUnicodeArgs *fromUArgs,
-                  const UChar* codeUnits,
-                  int32_t length,
-                  UChar32 codePoint,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or 
- * UNASSIGNED_SEQUENCE depending on context parameter, with the
- * current substitution string for the converter. This is the default
- * callback.
- *
- * @param context The function currently recognizes the callback options:
- *                 UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
- *                      returning the error code back to the caller immediately.
- *                 NULL: Substitutes any ILLEGAL_SEQUENCE
- * @param fromUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
- * @param reason Defines the reason the callback was invoked
- * @param err Return value will be set to success if the callback was handled,
- *      otherwise this value will be set to a failure status.
- * @see ucnv_setSubstChars
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
-                  const void *context,
-                  UConverterFromUnicodeArgs *fromUArgs,
-                  const UChar* codeUnits,
-                  int32_t length,
-                  UChar32 codePoint,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the
- * hexadecimal representation of the illegal codepoints
- *
- * @param context The function currently recognizes the callback options:
- *        <ul>
- *        <li>UCNV_ESCAPE_ICU: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
- *          representation in the format  %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). 
- *          In the Event the converter doesn't support the characters {%,U}[A-F][0-9], 
- *          it will  substitute  the illegal sequence with the substitution characters.
- *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
- *          %UD84D%UDC56</li>
- *        <li>UCNV_ESCAPE_JAVA: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
- *          representation in the format  \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). 
- *          In the Event the converter doesn't support the characters {\,u}[A-F][0-9], 
- *          it will  substitute  the illegal sequence with the substitution characters.
- *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
- *          \\uD84D\\uDC56</li>
- *        <li>UCNV_ESCAPE_C: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
- *          representation in the format  \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). 
- *          In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], 
- *          it will  substitute  the illegal sequence with the substitution characters.
- *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
- *          \\U00023456</li>
- *        <li>UCNV_ESCAPE_XML_DEC: Substitues the  ILLEGAL SEQUENCE with the decimal 
- *          representation in the format \htmlonly&amp;#DDDDDDDD;, e.g. "&amp;#65534;&amp;#172;&amp;#51454;")\endhtmlonly. 
- *          In the Event the converter doesn't support the characters {&amp;,#}[0-9], 
- *          it will  substitute  the illegal sequence with the substitution characters.
- *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
- *          &amp;#144470; and Zero padding is ignored.</li>
- *        <li>UCNV_ESCAPE_XML_HEX:Substitues the  ILLEGAL SEQUENCE with the decimal 
- *          representation in the format \htmlonly&amp;#xXXXX; e.g. "&amp;#xFFFE;&amp;#x00AC;&amp;#xC8FE;")\endhtmlonly. 
- *          In the Event the converter doesn't support the characters {&,#,x}[0-9], 
- *          it will  substitute  the illegal sequence with the substitution characters.
- *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
- *          \htmlonly&amp;#x23456;\endhtmlonly</li>
- *        </ul>
- * @param fromUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
- * @param reason Defines the reason the callback was invoked
- * @param err Return value will be set to success if the callback was handled,
- *      otherwise this value will be set to a failure status.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
-                  const void *context,
-                  UConverterFromUnicodeArgs *fromUArgs,
-                  const UChar* codeUnits,
-                  int32_t length,
-                  UChar32 codePoint,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This To Unicode callback skips any ILLEGAL_SEQUENCE, or
- * skips only UNASSINGED_SEQUENCE depending on the context parameter
- * simply ignoring those characters. 
- *
- * @param context  The function currently recognizes the callback options:
- *                 UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
- *                      returning the error code back to the caller immediately.
- *                 NULL: Skips any ILLEGAL_SEQUENCE
- * @param toUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param reason Defines the reason the callback was invoked
- * @param err Return value will be set to success if the callback was handled,
- *      otherwise this value will be set to a failure status.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
-                  const void *context,
-                  UConverterToUnicodeArgs *toUArgs,
-                  const char* codeUnits,
-                  int32_t length,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or 
- * UNASSIGNED_SEQUENCE depending on context parameter,  with the
- * Unicode substitution character, U+FFFD.
- *
- * @param context  The function currently recognizes the callback options:
- *                 UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
- *                      returning the error code back to the caller immediately.
- *                 NULL: Substitutes any ILLEGAL_SEQUENCE
- * @param toUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param reason Defines the reason the callback was invoked
- * @param err Return value will be set to success if the callback was handled,
- *      otherwise this value will be set to a failure status.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
-                  const void *context,
-                  UConverterToUnicodeArgs *toUArgs,
-                  const char* codeUnits,
-                  int32_t length,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-/**
- * DO NOT CALL THIS FUNCTION DIRECTLY!
- * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the
- * hexadecimal representation of the illegal bytes
- *  (in the format  %XNN, e.g. "%XFF%X0A%XC8%X03").
- *
- * @param context This function currently recognizes the callback options:
- *      UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC,
- *      UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE.
- * @param toUArgs Information about the conversion in progress
- * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
- * @param length Size (in bytes) of the concerned codepage sequence
- * @param reason Defines the reason the callback was invoked
- * @param err Return value will be set to success if the callback was handled,
- *      otherwise this value will be set to a failure status.
- * @stable ICU 2.0
- */
-
-U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
-                  const void *context,
-                  UConverterToUnicodeArgs *toUArgs,
-                  const char* codeUnits,
-                  int32_t length,
-                  UConverterCallbackReason reason,
-                  UErrorCode * err);
-
-#endif
-
-#endif
-
-/*UCNV_ERR_H*/ 
diff --git a/Source/core/icu/unicode/ucol.h b/Source/core/icu/unicode/ucol.h
deleted file mode 100644
index 4a4cd60..0000000
--- a/Source/core/icu/unicode/ucol.h
+++ /dev/null
@@ -1,1227 +0,0 @@
-/*
-*******************************************************************************
-* Copyright (c) 1996-2010, International Business Machines Corporation and others.
-* All Rights Reserved.
-*******************************************************************************
-*/
-
-#ifndef UCOL_H
-#define UCOL_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_COLLATION
-
-#include "unicode/unorm.h"
-#include "unicode/localpointer.h"
-#include "unicode/parseerr.h"
-#include "unicode/uloc.h"
-#include "unicode/uset.h"
-
-/**
- * \file
- * \brief C API: Collator 
- *
- * <h2> Collator C API </h2>
- *
- * The C API for Collator performs locale-sensitive
- * string comparison. You use this service to build
- * searching and sorting routines for natural language text.
- * <em>Important: </em>The ICU collation service has been reimplemented 
- * in order to achieve better performance and UCA compliance. 
- * For details, see the 
- * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
- * collation design document</a>.
- * <p>
- * For more information about the collation service see 
- * <a href="http://icu-project.org/userguide/Collate_Intro.html">the users guide</a>.
- * <p>
- * Collation service provides correct sorting orders for most locales supported in ICU. 
- * If specific data for a locale is not available, the orders eventually falls back
- * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>. 
- * <p>
- * Sort ordering may be customized by providing your own set of rules. For more on
- * this subject see the 
- * <a href="http://icu-project.org/userguide/Collate_Customization.html">
- * Collation customization</a> section of the users guide.
- * <p>
- * @see         UCollationResult
- * @see         UNormalizationMode
- * @see         UCollationStrength
- * @see         UCollationElements
- */
-
-/** A collator.
-*  For usage in C programs.
-*/
-struct UCollator;
-/** structure representing a collator object instance 
- * @stable ICU 2.0
- */
-typedef struct UCollator UCollator;
-
-
-/**
- * UCOL_LESS is returned if source string is compared to be less than target
- * string in the u_strcoll() method.
- * UCOL_EQUAL is returned if source string is compared to be equal to target
- * string in the u_strcoll() method.
- * UCOL_GREATER is returned if source string is compared to be greater than
- * target string in the u_strcoll() method.
- * @see u_strcoll()
- * <p>
- * Possible values for a comparison result 
- * @stable ICU 2.0
- */
-typedef enum {
-  /** string a == string b */
-  UCOL_EQUAL    = 0,
-  /** string a > string b */
-  UCOL_GREATER    = 1,
-  /** string a < string b */
-  UCOL_LESS    = -1
-} UCollationResult ;
-
-
-/** Enum containing attribute values for controling collation behavior.
- * Here are all the allowable values. Not every attribute can take every value. The only
- * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined  
- * value for that locale 
- * @stable ICU 2.0
- */
-typedef enum {
-  /** accepted by most attributes */
-  UCOL_DEFAULT = -1,
-
-  /** Primary collation strength */
-  UCOL_PRIMARY = 0,
-  /** Secondary collation strength */
-  UCOL_SECONDARY = 1,
-  /** Tertiary collation strength */
-  UCOL_TERTIARY = 2,
-  /** Default collation strength */
-  UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
-  UCOL_CE_STRENGTH_LIMIT,
-  /** Quaternary collation strength */
-  UCOL_QUATERNARY=3,
-  /** Identical collation strength */
-  UCOL_IDENTICAL=15,
-  UCOL_STRENGTH_LIMIT,
-
-  /** Turn the feature off - works for UCOL_FRENCH_COLLATION, 
-      UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
-      & UCOL_DECOMPOSITION_MODE*/
-  UCOL_OFF = 16,
-  /** Turn the feature on - works for UCOL_FRENCH_COLLATION, 
-      UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
-      & UCOL_DECOMPOSITION_MODE*/
-  UCOL_ON = 17,
-  
-  /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
-  UCOL_SHIFTED = 20,
-  /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
-  UCOL_NON_IGNORABLE = 21,
-
-  /** Valid for UCOL_CASE_FIRST - 
-      lower case sorts before upper case */
-  UCOL_LOWER_FIRST = 24,
-  /** upper case sorts before lower case */
-  UCOL_UPPER_FIRST = 25,
-
-  UCOL_ATTRIBUTE_VALUE_COUNT
-
-} UColAttributeValue;
-
-/** Enum containing the codes for reordering segments of the collation table that are not script
- *  codes. These reordering codes are to be used in conjunction with the script codes.
- *  @internal
- */
-typedef enum {
-    UCOL_REORDER_CODE_SPACE          = 0x1000,
-    UCOL_REORDER_CODE_FIRST          = UCOL_REORDER_CODE_SPACE,
-    UCOL_REORDER_CODE_PUNCTUATION    = 0x1001,
-    UCOL_REORDER_CODE_SYMBOL         = 0x1002,
-    UCOL_REORDER_CODE_CURRENCY       = 0x1003,
-    UCOL_REORDER_CODE_DIGIT          = 0x1004,
-    UCOL_REORDER_CODE_LIMIT          = 0x1005
-} UColReorderCode;
-
-/**
- * Base letter represents a primary difference.  Set comparison
- * level to UCOL_PRIMARY to ignore secondary and tertiary differences.
- * Use this to set the strength of a Collator object.
- * Example of primary difference, "abc" &lt; "abd"
- * 
- * Diacritical differences on the same base letter represent a secondary
- * difference.  Set comparison level to UCOL_SECONDARY to ignore tertiary
- * differences. Use this to set the strength of a Collator object.
- * Example of secondary difference, "&auml;" >> "a".
- *
- * Uppercase and lowercase versions of the same character represents a
- * tertiary difference.  Set comparison level to UCOL_TERTIARY to include
- * all comparison differences. Use this to set the strength of a Collator
- * object.
- * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
- *
- * Two characters are considered "identical" when they have the same
- * unicode spellings.  UCOL_IDENTICAL.
- * For example, "&auml;" == "&auml;".
- *
- * UCollationStrength is also used to determine the strength of sort keys 
- * generated from UCollator objects
- * These values can be now found in the UColAttributeValue enum.
- * @stable ICU 2.0
- **/
-typedef UColAttributeValue UCollationStrength;
-
-/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
- * value, as well as the values specific to each one. 
- * @stable ICU 2.0
- */
-typedef enum {
-     /** Attribute for direction of secondary weights - used in French.
-      * Acceptable values are UCOL_ON, which results in secondary weights
-      * being considered backwards and UCOL_OFF which treats secondary
-      * weights in the order they appear.*/
-     UCOL_FRENCH_COLLATION, 
-     /** Attribute for handling variable elements.
-      * Acceptable values are UCOL_NON_IGNORABLE (default)
-      * which treats all the codepoints with non-ignorable 
-      * primary weights in the same way,
-      * and UCOL_SHIFTED which causes codepoints with primary 
-      * weights that are equal or below the variable top value
-      * to be ignored on primary level and moved to the quaternary 
-      * level.*/
-     UCOL_ALTERNATE_HANDLING, 
-     /** Controls the ordering of upper and lower case letters.
-      * Acceptable values are UCOL_OFF (default), which orders
-      * upper and lower case letters in accordance to their tertiary
-      * weights, UCOL_UPPER_FIRST which forces upper case letters to 
-      * sort before lower case letters, and UCOL_LOWER_FIRST which does 
-      * the opposite. */
-     UCOL_CASE_FIRST, 
-     /** Controls whether an extra case level (positioned before the third
-      * level) is generated or not. Acceptable values are UCOL_OFF (default), 
-      * when case level is not generated, and UCOL_ON which causes the case
-      * level to be generated. Contents of the case level are affected by
-      * the value of UCOL_CASE_FIRST attribute. A simple way to ignore 
-      * accent differences in a string is to set the strength to UCOL_PRIMARY
-      * and enable case level. */
-     UCOL_CASE_LEVEL,
-     /** Controls whether the normalization check and necessary normalizations
-      * are performed. When set to UCOL_OFF (default) no normalization check
-      * is performed. The correctness of the result is guaranteed only if the 
-      * input data is in so-called FCD form (see users manual for more info).
-      * When set to UCOL_ON, an incremental check is performed to see whether
-      * the input data is in the FCD form. If the data is not in the FCD form,
-      * incremental NFD normalization is performed. */
-     UCOL_NORMALIZATION_MODE, 
-     /** An alias for UCOL_NORMALIZATION_MODE attribute */
-     UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
-     /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
-      * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
-      * for most locales (except Japanese) is tertiary. Quaternary strength 
-      * is useful when combined with shifted setting for alternate handling
-      * attribute and for JIS x 4061 collation, when it is used to distinguish
-      * between Katakana  and Hiragana (this is achieved by setting the 
-      * UCOL_HIRAGANA_QUATERNARY mode to on. Otherwise, quaternary level
-      * is affected only by the number of non ignorable code points in
-      * the string. Identical strength is rarely useful, as it amounts 
-      * to codepoints of the NFD form of the string. */
-     UCOL_STRENGTH,  
-     /** When turned on, this attribute positions Hiragana before all  
-      * non-ignorables on quaternary level This is a sneaky way to produce JIS
-      * sort order */
-     UCOL_HIRAGANA_QUATERNARY_MODE,
-     /** When turned on, this attribute generates a collation key
-      * for the numeric value of substrings of digits.
-      * This is a way to get '100' to sort AFTER '2'. Note that the longest
-      * digit substring that can be treated as a single collation element is
-      * 254 digits (not counting leading zeros). If a digit substring is
-      * longer than that, the digits beyond the limit will be treated as a
-      * separate digit substring associated with a separate collation element. */
-     UCOL_NUMERIC_COLLATION, 
-     UCOL_ATTRIBUTE_COUNT
-} UColAttribute;
-
-/** Options for retrieving the rule string 
- *  @stable ICU 2.0
- */
-typedef enum {
-  /** Retrieve tailoring only */
-  UCOL_TAILORING_ONLY, 
-  /** Retrieve UCA rules and tailoring */
-  UCOL_FULL_RULES 
-} UColRuleOption ;
-
-/**
- * Open a UCollator for comparing strings.
- * The UCollator pointer is used in all the calls to the Collation 
- * service. After finished, collator must be disposed of by calling
- * {@link #ucol_close }.
- * @param loc The locale containing the required collation rules. 
- *            Special values for locales can be passed in - 
- *            if NULL is passed for the locale, the default locale
- *            collation rules will be used. If empty string ("") or
- *            "root" are passed, UCA rules will be used.
- * @param status A pointer to an UErrorCode to receive any errors
- * @return A pointer to a UCollator, or 0 if an error occurred.
- * @see ucol_openRules
- * @see ucol_safeClone
- * @see ucol_close
- * @stable ICU 2.0
- */
-U_STABLE UCollator* U_EXPORT2 
-ucol_open(const char *loc, UErrorCode *status);
-
-/**
- * Produce an UCollator instance according to the rules supplied.
- * The rules are used to change the default ordering, defined in the
- * UCA in a process called tailoring. The resulting UCollator pointer
- * can be used in the same way as the one obtained by {@link #ucol_strcoll }.
- * @param rules A string describing the collation rules. For the syntax
- *              of the rules please see users guide.
- * @param rulesLength The length of rules, or -1 if null-terminated.
- * @param normalizationMode The normalization mode: One of
- *             UCOL_OFF     (expect the text to not need normalization),
- *             UCOL_ON      (normalize), or
- *             UCOL_DEFAULT (set the mode according to the rules)
- * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
- * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
- * @param parseError  A pointer to UParseError to recieve information about errors
- *                    occurred during parsing. This argument can currently be set
- *                    to NULL, but at users own risk. Please provide a real structure.
- * @param status A pointer to an UErrorCode to receive any errors
- * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
- *         of error - please use status argument to check for errors.
- * @see ucol_open
- * @see ucol_safeClone
- * @see ucol_close
- * @stable ICU 2.0
- */
-U_STABLE UCollator* U_EXPORT2 
-ucol_openRules( const UChar        *rules,
-                int32_t            rulesLength,
-                UColAttributeValue normalizationMode,
-                UCollationStrength strength,
-                UParseError        *parseError,
-                UErrorCode         *status);
-
-/** 
- * Open a collator defined by a short form string.
- * The structure and the syntax of the string is defined in the "Naming collators"
- * section of the users guide: 
- * http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators
- * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
- * strength will be 3. 3066bis locale overrides individual locale parts.
- * The call to this function is equivalent to a call to ucol_open, followed by a 
- * series of calls to ucol_setAttribute and ucol_setVariableTop.
- * @param definition A short string containing a locale and a set of attributes. 
- *                   Attributes not explicitly mentioned are left at the default
- *                   state for a locale.
- * @param parseError if not NULL, structure that will get filled with error's pre
- *                   and post context in case of error.
- * @param forceDefaults if FALSE, the settings that are the same as the collator 
- *                   default settings will not be applied (for example, setting
- *                   French secondary on a French collator would not be executed). 
- *                   If TRUE, all the settings will be applied regardless of the 
- *                   collator default value. If the definition
- *                   strings are to be cached, should be set to FALSE.
- * @param status     Error code. Apart from regular error conditions connected to 
- *                   instantiating collators (like out of memory or similar), this
- *                   API will return an error if an invalid attribute or attribute/value
- *                   combination is specified.
- * @return           A pointer to a UCollator or 0 if an error occured (including an 
- *                   invalid attribute).
- * @see ucol_open
- * @see ucol_setAttribute
- * @see ucol_setVariableTop
- * @see ucol_getShortDefinitionString
- * @see ucol_normalizeShortDefinitionString
- * @stable ICU 3.0
- *
- */
-U_STABLE UCollator* U_EXPORT2
-ucol_openFromShortString( const char *definition,
-                          UBool forceDefaults,
-                          UParseError *parseError,
-                          UErrorCode *status);
-
-/**
- * Get a set containing the contractions defined by the collator. The set includes
- * both the UCA contractions and the contractions defined by the collator. This set
- * will contain only strings. If a tailoring explicitly suppresses contractions from 
- * the UCA (like Russian), removed contractions will not be in the resulting set.
- * @param coll collator 
- * @param conts the set to hold the result. It gets emptied before
- *              contractions are added. 
- * @param status to hold the error code
- * @return the size of the contraction set
- *
- * @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
- */
-U_DEPRECATED int32_t U_EXPORT2
-ucol_getContractions( const UCollator *coll,
-                  USet *conts,
-                  UErrorCode *status);
-
-/**
- * Get a set containing the expansions defined by the collator. The set includes
- * both the UCA expansions and the expansions defined by the tailoring
- * @param coll collator
- * @param contractions if not NULL, the set to hold the contractions
- * @param expansions if not NULL, the set to hold the expansions
- * @param addPrefixes add the prefix contextual elements to contractions
- * @param status to hold the error code
- *
- * @stable ICU 3.4
- */
-U_STABLE void U_EXPORT2
-ucol_getContractionsAndExpansions( const UCollator *coll,
-                  USet *contractions, USet *expansions,
-                  UBool addPrefixes, UErrorCode *status);
-
-/** 
- * Close a UCollator.
- * Once closed, a UCollator should not be used. Every open collator should
- * be closed. Otherwise, a memory leak will result.
- * @param coll The UCollator to close.
- * @see ucol_open
- * @see ucol_openRules
- * @see ucol_safeClone
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_close(UCollator *coll);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUCollatorPointer
- * "Smart pointer" class, closes a UCollator via ucol_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Compare two strings.
- * The strings will be compared using the options already specified.
- * @param coll The UCollator containing the comparison rules.
- * @param source The source string.
- * @param sourceLength The length of source, or -1 if null-terminated.
- * @param target The target string.
- * @param targetLength The length of target, or -1 if null-terminated.
- * @return The result of comparing the strings; one of UCOL_EQUAL,
- * UCOL_GREATER, UCOL_LESS
- * @see ucol_greater
- * @see ucol_greaterOrEqual
- * @see ucol_equal
- * @stable ICU 2.0
- */
-U_STABLE UCollationResult U_EXPORT2 
-ucol_strcoll(    const    UCollator    *coll,
-        const    UChar        *source,
-        int32_t            sourceLength,
-        const    UChar        *target,
-        int32_t            targetLength);
-
-/**
- * Determine if one string is greater than another.
- * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER
- * @param coll The UCollator containing the comparison rules.
- * @param source The source string.
- * @param sourceLength The length of source, or -1 if null-terminated.
- * @param target The target string.
- * @param targetLength The length of target, or -1 if null-terminated.
- * @return TRUE if source is greater than target, FALSE otherwise.
- * @see ucol_strcoll
- * @see ucol_greaterOrEqual
- * @see ucol_equal
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2 
-ucol_greater(const UCollator *coll,
-             const UChar     *source, int32_t sourceLength,
-             const UChar     *target, int32_t targetLength);
-
-/**
- * Determine if one string is greater than or equal to another.
- * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS
- * @param coll The UCollator containing the comparison rules.
- * @param source The source string.
- * @param sourceLength The length of source, or -1 if null-terminated.
- * @param target The target string.
- * @param targetLength The length of target, or -1 if null-terminated.
- * @return TRUE if source is greater than or equal to target, FALSE otherwise.
- * @see ucol_strcoll
- * @see ucol_greater
- * @see ucol_equal
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2 
-ucol_greaterOrEqual(const UCollator *coll,
-                    const UChar     *source, int32_t sourceLength,
-                    const UChar     *target, int32_t targetLength);
-
-/**
- * Compare two strings for equality.
- * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL
- * @param coll The UCollator containing the comparison rules.
- * @param source The source string.
- * @param sourceLength The length of source, or -1 if null-terminated.
- * @param target The target string.
- * @param targetLength The length of target, or -1 if null-terminated.
- * @return TRUE if source is equal to target, FALSE otherwise
- * @see ucol_strcoll
- * @see ucol_greater
- * @see ucol_greaterOrEqual
- * @stable ICU 2.0
- */
-U_STABLE UBool U_EXPORT2 
-ucol_equal(const UCollator *coll,
-           const UChar     *source, int32_t sourceLength,
-           const UChar     *target, int32_t targetLength);
-
-/**
- * Compare two UTF-8 encoded trings.
- * The strings will be compared using the options already specified.
- * @param coll The UCollator containing the comparison rules.
- * @param sIter The source string iterator.
- * @param tIter The target string iterator.
- * @return The result of comparing the strings; one of UCOL_EQUAL,
- * UCOL_GREATER, UCOL_LESS
- * @param status A pointer to an UErrorCode to receive any errors
- * @see ucol_strcoll
- * @stable ICU 2.6
- */
-U_STABLE UCollationResult U_EXPORT2 
-ucol_strcollIter(  const    UCollator    *coll,
-                  UCharIterator *sIter,
-                  UCharIterator *tIter,
-                  UErrorCode *status);
-
-/**
- * Get the collation strength used in a UCollator.
- * The strength influences how strings are compared.
- * @param coll The UCollator to query.
- * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
- * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
- * @see ucol_setStrength
- * @stable ICU 2.0
- */
-U_STABLE UCollationStrength U_EXPORT2 
-ucol_getStrength(const UCollator *coll);
-
-/**
- * Set the collation strength used in a UCollator.
- * The strength influences how strings are compared.
- * @param coll The UCollator to set.
- * @param strength The desired collation strength; one of UCOL_PRIMARY, 
- * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
- * @see ucol_getStrength
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_setStrength(UCollator *coll,
-                 UCollationStrength strength);
-
-/**
- * Get the current reordering of scripts (if one has been set).
- * @param coll The UCollator to query.
- * @param dest The array to fill with the script ordering.
- * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string (pre-flighting).
- * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
- * @return The length of the array of the script ordering.
- * @see ucol_setReorderCodes
- * @internal 
- */
-U_INTERNAL int32_t U_EXPORT2 
-ucol_getReorderCodes(const UCollator* coll,
-                    int32_t* dest,
-                    int32_t destCapacity,
-                    UErrorCode *pErrorCode);
-
-/**
- * Set the ordering of scripts for this collator.
- * @param coll The UCollator to set.
- * @param reorderCodes An array of script codes in the new order.
- * @param reorderCodesLength The length of reorderCodes.
- * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
- * @see ucol_getReorderCodes
- * @internal 
- */
-U_INTERNAL void U_EXPORT2 
-ucol_setReorderCodes(UCollator* coll,
-                    const int32_t* reorderCodes,
-                    int32_t reorderCodesLength,
-                    UErrorCode *pErrorCode);
-
-/**
- * Get the display name for a UCollator.
- * The display name is suitable for presentation to a user.
- * @param objLoc The locale of the collator in question.
- * @param dispLoc The locale for display.
- * @param result A pointer to a buffer to receive the attribute.
- * @param resultLength The maximum size of result.
- * @param status A pointer to an UErrorCode to receive any errors
- * @return The total buffer size needed; if greater than resultLength,
- * the output was truncated.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_getDisplayName(    const    char        *objLoc,
-            const    char        *dispLoc,
-            UChar             *result,
-            int32_t         resultLength,
-            UErrorCode        *status);
-
-/**
- * Get a locale for which collation rules are available.
- * A UCollator in a locale returned by this function will perform the correct
- * collation for the locale.
- * @param localeIndex The index of the desired locale.
- * @return A locale for which collation rules are available, or 0 if none.
- * @see ucol_countAvailable
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2 
-ucol_getAvailable(int32_t localeIndex);
-
-/**
- * Determine how many locales have collation rules available.
- * This function is most useful as determining the loop ending condition for
- * calls to {@link #ucol_getAvailable }.
- * @return The number of locales for which collation rules are available.
- * @see ucol_getAvailable
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_countAvailable(void);
-
-#if !UCONFIG_NO_SERVICE
-/**
- * Create a string enumerator of all locales for which a valid
- * collator may be opened.
- * @param status input-output error code
- * @return a string enumeration over locale strings. The caller is
- * responsible for closing the result.
- * @stable ICU 3.0
- */
-U_STABLE UEnumeration* U_EXPORT2
-ucol_openAvailableLocales(UErrorCode *status);
-#endif
-
-/**
- * Create a string enumerator of all possible keywords that are relevant to
- * collation. At this point, the only recognized keyword for this
- * service is "collation".
- * @param status input-output error code
- * @return a string enumeration over locale strings. The caller is
- * responsible for closing the result.
- * @stable ICU 3.0
- */
-U_STABLE UEnumeration* U_EXPORT2
-ucol_getKeywords(UErrorCode *status);
-
-/**
- * Given a keyword, create a string enumeration of all values
- * for that keyword that are currently in use.
- * @param keyword a particular keyword as enumerated by
- * ucol_getKeywords. If any other keyword is passed in, *status is set
- * to U_ILLEGAL_ARGUMENT_ERROR.
- * @param status input-output error code
- * @return a string enumeration over collation keyword values, or NULL
- * upon error. The caller is responsible for closing the result.
- * @stable ICU 3.0
- */
-U_STABLE UEnumeration* U_EXPORT2
-ucol_getKeywordValues(const char *keyword, UErrorCode *status);
-
-/**
- * Given a key and a locale, returns an array of string values in a preferred
- * order that would make a difference. These are all and only those values where
- * the open (creation) of the service with the locale formed from the input locale
- * plus input keyword and that value has different behavior than creation with the
- * input locale alone.
- * @param key           one of the keys supported by this service.  For now, only
- *                      "collation" is supported.
- * @param locale        the locale
- * @param commonlyUsed  if set to true it will return only commonly used values
- *                      with the given locale in preferred order.  Otherwise,
- *                      it will return all the available values for the locale.
- * @param status error status
- * @return a string enumeration over keyword values for the given key and the locale.
- * @stable ICU 4.2
- */
-U_STABLE UEnumeration* U_EXPORT2
-ucol_getKeywordValuesForLocale(const char* key,
-                               const char* locale,
-                               UBool commonlyUsed,
-                               UErrorCode* status);
-
-/**
- * Return the functionally equivalent locale for the given
- * requested locale, with respect to given keyword, for the
- * collation service.  If two locales return the same result, then
- * collators instantiated for these locales will behave
- * equivalently.  The converse is not always true; two collators
- * may in fact be equivalent, but return different results, due to
- * internal details.  The return result has no other meaning than
- * that stated above, and implies nothing as to the relationship
- * between the two locales.  This is intended for use by
- * applications who wish to cache collators, or otherwise reuse
- * collators when possible.  The functional equivalent may change
- * over time.  For more information, please see the <a
- * href="http://icu-project.org/userguide/locale.html#services">
- * Locales and Services</a> section of the ICU User Guide.
- * @param result fillin for the functionally equivalent locale
- * @param resultCapacity capacity of the fillin buffer
- * @param keyword a particular keyword as enumerated by
- * ucol_getKeywords.
- * @param locale the requested locale
- * @param isAvailable if non-NULL, pointer to a fillin parameter that
- * indicates whether the requested locale was 'available' to the
- * collation service. A locale is defined as 'available' if it
- * physically exists within the collation locale data.
- * @param status pointer to input-output error code
- * @return the actual buffer size needed for the locale.  If greater
- * than resultCapacity, the returned full name will be truncated and
- * an error code will be returned.
- * @stable ICU 3.0
- */
-U_STABLE int32_t U_EXPORT2
-ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
-                             const char* keyword, const char* locale,
-                             UBool* isAvailable, UErrorCode* status);
-
-/**
- * Get the collation rules from a UCollator.
- * The rules will follow the rule syntax.
- * @param coll The UCollator to query.
- * @param length 
- * @return The collation rules.
- * @stable ICU 2.0
- */
-U_STABLE const UChar* U_EXPORT2 
-ucol_getRules(    const    UCollator    *coll, 
-        int32_t            *length);
-
-/** Get the short definition string for a collator. This API harvests the collator's
- *  locale and the attribute set and produces a string that can be used for opening 
- *  a collator with the same properties using the ucol_openFromShortString API.
- *  This string will be normalized.
- *  The structure and the syntax of the string is defined in the "Naming collators"
- *  section of the users guide: 
- *  http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators
- *  This API supports preflighting.
- *  @param coll a collator
- *  @param locale a locale that will appear as a collators locale in the resulting
- *                short string definition. If NULL, the locale will be harvested 
- *                from the collator.
- *  @param buffer space to hold the resulting string
- *  @param capacity capacity of the buffer
- *  @param status for returning errors. All the preflighting errors are featured
- *  @return length of the resulting string
- *  @see ucol_openFromShortString
- *  @see ucol_normalizeShortDefinitionString
- *  @stable ICU 3.0
- */
-U_STABLE int32_t U_EXPORT2
-ucol_getShortDefinitionString(const UCollator *coll,
-                              const char *locale,
-                              char *buffer,
-                              int32_t capacity,
-                              UErrorCode *status);
-
-/** Verifies and normalizes short definition string.
- *  Normalized short definition string has all the option sorted by the argument name,
- *  so that equivalent definition strings are the same. 
- *  This API supports preflighting.
- *  @param source definition string
- *  @param destination space to hold the resulting string
- *  @param capacity capacity of the buffer
- *  @param parseError if not NULL, structure that will get filled with error's pre
- *                   and post context in case of error.
- *  @param status     Error code. This API will return an error if an invalid attribute 
- *                    or attribute/value combination is specified. All the preflighting 
- *                    errors are also featured
- *  @return length of the resulting normalized string.
- *
- *  @see ucol_openFromShortString
- *  @see ucol_getShortDefinitionString
- * 
- *  @stable ICU 3.0
- */
-
-U_STABLE int32_t U_EXPORT2
-ucol_normalizeShortDefinitionString(const char *source,
-                                    char *destination,
-                                    int32_t capacity,
-                                    UParseError *parseError,
-                                    UErrorCode *status);
-
-
-/**
- * Get a sort key for a string from a UCollator.
- * Sort keys may be compared using <TT>strcmp</TT>.
- *
- * Like ICU functions that write to an output buffer, the buffer contents
- * is undefined if the buffer capacity (resultLength parameter) is too small.
- * Unlike ICU functions that write a string to an output buffer,
- * the terminating zero byte is counted in the sort key length.
- * @param coll The UCollator containing the collation rules.
- * @param source The string to transform.
- * @param sourceLength The length of source, or -1 if null-terminated.
- * @param result A pointer to a buffer to receive the attribute.
- * @param resultLength The maximum size of result.
- * @return The size needed to fully store the sort key.
- *      If there was an internal error generating the sort key,
- *      a zero value is returned.
- * @see ucol_keyHashCode
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_getSortKey(const    UCollator    *coll,
-        const    UChar        *source,
-        int32_t        sourceLength,
-        uint8_t        *result,
-        int32_t        resultLength);
-
-
-/** Gets the next count bytes of a sort key. Caller needs
- *  to preserve state array between calls and to provide
- *  the same type of UCharIterator set with the same string.
- *  The destination buffer provided must be big enough to store
- *  the number of requested bytes. Generated sortkey is not 
- *  compatible with sortkeys generated using ucol_getSortKey
- *  API, since we don't do any compression. If uncompressed
- *  sortkeys are required, this API can be used.
- *  @param coll The UCollator containing the collation rules.
- *  @param iter UCharIterator containing the string we need 
- *              the sort key to be calculated for.
- *  @param state Opaque state of sortkey iteration.
- *  @param dest Buffer to hold the resulting sortkey part
- *  @param count number of sort key bytes required.
- *  @param status error code indicator.
- *  @return the actual number of bytes of a sortkey. It can be
- *          smaller than count if we have reached the end of 
- *          the sort key.
- *  @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_nextSortKeyPart(const UCollator *coll,
-                     UCharIterator *iter,
-                     uint32_t state[2],
-                     uint8_t *dest, int32_t count,
-                     UErrorCode *status);
-
-/** enum that is taken by ucol_getBound API 
- * See below for explanation                
- * do not change the values assigned to the 
- * members of this enum. Underlying code    
- * depends on them having these numbers     
- * @stable ICU 2.0
- */
-typedef enum {
-  /** lower bound */
-  UCOL_BOUND_LOWER = 0,
-  /** upper bound that will match strings of exact size */
-  UCOL_BOUND_UPPER = 1,
-  /** upper bound that will match all the strings that have the same initial substring as the given string */
-  UCOL_BOUND_UPPER_LONG = 2,
-  UCOL_BOUND_VALUE_COUNT
-} UColBoundMode;
-
-/**
- * Produce a bound for a given sortkey and a number of levels.
- * Return value is always the number of bytes needed, regardless of 
- * whether the result buffer was big enough or even valid.<br>
- * Resulting bounds can be used to produce a range of strings that are
- * between upper and lower bounds. For example, if bounds are produced
- * for a sortkey of string "smith", strings between upper and lower 
- * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
- * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
- * is produced, strings matched would be as above. However, if bound
- * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
- * also match "Smithsonian" and similar.<br>
- * For more on usage, see example in cintltst/capitst.c in procedure
- * TestBounds.
- * Sort keys may be compared using <TT>strcmp</TT>.
- * @param source The source sortkey.
- * @param sourceLength The length of source, or -1 if null-terminated. 
- *                     (If an unmodified sortkey is passed, it is always null 
- *                      terminated).
- * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which 
- *                  produces a lower inclusive bound, UCOL_BOUND_UPPER, that 
- *                  produces upper bound that matches strings of the same length 
- *                  or UCOL_BOUND_UPPER_LONG that matches strings that have the 
- *                  same starting substring as the source string.
- * @param noOfLevels  Number of levels required in the resulting bound (for most 
- *                    uses, the recommended value is 1). See users guide for 
- *                    explanation on number of levels a sortkey can have.
- * @param result A pointer to a buffer to receive the resulting sortkey.
- * @param resultLength The maximum size of result.
- * @param status Used for returning error code if something went wrong. If the 
- *               number of levels requested is higher than the number of levels
- *               in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is 
- *               issued.
- * @return The size needed to fully store the bound. 
- * @see ucol_keyHashCode
- * @stable ICU 2.1
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_getBound(const uint8_t       *source,
-        int32_t             sourceLength,
-        UColBoundMode       boundType,
-        uint32_t            noOfLevels,
-        uint8_t             *result,
-        int32_t             resultLength,
-        UErrorCode          *status);
-        
-/**
- * Gets the version information for a Collator. Version is currently
- * an opaque 32-bit number which depends, among other things, on major
- * versions of the collator tailoring and UCA.
- * @param coll The UCollator to query.
- * @param info the version # information, the result will be filled in
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-ucol_getVersion(const UCollator* coll, UVersionInfo info);
-
-/**
- * Gets the UCA version information for a Collator. Version is the
- * UCA version number (3.1.1, 4.0).
- * @param coll The UCollator to query.
- * @param info the version # information, the result will be filled in
- * @stable ICU 2.8
- */
-U_STABLE void U_EXPORT2
-ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
-
-/** 
- * Merge two sort keys. The levels are merged with their corresponding counterparts
- * (primaries with primaries, secondaries with secondaries etc.). Between the values
- * from the same level a separator is inserted.
- * example (uncompressed): 
- * 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00
- * will be merged as 
- * 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00
- * This allows for concatenating of first and last names for sorting, among other things.
- * If the destination buffer is not big enough, the results are undefined.
- * If any of source lengths are zero or any of source pointers are NULL/undefined, 
- * result is of size zero.
- * @param src1 pointer to the first sortkey
- * @param src1Length length of the first sortkey
- * @param src2 pointer to the second sortkey
- * @param src2Length length of the second sortkey
- * @param dest buffer to hold the result
- * @param destCapacity size of the buffer for the result
- * @return size of the result. If the buffer is big enough size is always
- *         src1Length+src2Length-1
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
-                   const uint8_t *src2, int32_t src2Length,
-                   uint8_t *dest, int32_t destCapacity);
-
-/**
- * Universal attribute setter
- * @param coll collator which attributes are to be changed
- * @param attr attribute type 
- * @param value attribute value
- * @param status to indicate whether the operation went on smoothly or there were errors
- * @see UColAttribute
- * @see UColAttributeValue
- * @see ucol_getAttribute
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
-
-/**
- * Universal attribute getter
- * @param coll collator which attributes are to be changed
- * @param attr attribute type
- * @return attribute value
- * @param status to indicate whether the operation went on smoothly or there were errors
- * @see UColAttribute
- * @see UColAttributeValue
- * @see ucol_setAttribute
- * @stable ICU 2.0
- */
-U_STABLE UColAttributeValue  U_EXPORT2 
-ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
-
-/** Variable top
- * is a two byte primary value which causes all the codepoints with primary values that
- * are less or equal than the variable top to be shifted when alternate handling is set
- * to UCOL_SHIFTED.
- * Sets the variable top to a collation element value of a string supplied. 
- * @param coll collator which variable top needs to be changed
- * @param varTop one or more (if contraction) UChars to which the variable top should be set
- * @param len length of variable top string. If -1 it is considered to be zero terminated.
- * @param status error code. If error code is set, the return value is undefined. 
- *               Errors set by this function are: <br>
- *    U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such 
- *    a contraction<br>
- *    U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
- * @return a 32 bit value containing the value of the variable top in upper 16 bits. 
- *         Lower 16 bits are undefined
- * @see ucol_getVariableTop
- * @see ucol_restoreVariableTop
- * @stable ICU 2.0
- */
-U_STABLE uint32_t U_EXPORT2 
-ucol_setVariableTop(UCollator *coll, 
-                    const UChar *varTop, int32_t len, 
-                    UErrorCode *status);
-
-/** 
- * Gets the variable top value of a Collator. 
- * Lower 16 bits are undefined and should be ignored.
- * @param coll collator which variable top needs to be retrieved
- * @param status error code (not changed by function). If error code is set, 
- *               the return value is undefined.
- * @return the variable top value of a Collator.
- * @see ucol_setVariableTop
- * @see ucol_restoreVariableTop
- * @stable ICU 2.0
- */
-U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
-
-/** 
- * Sets the variable top to a collation element value supplied. Variable top is 
- * set to the upper 16 bits. 
- * Lower 16 bits are ignored.
- * @param coll collator which variable top needs to be changed
- * @param varTop CE value, as returned by ucol_setVariableTop or ucol)getVariableTop
- * @param status error code (not changed by function)
- * @see ucol_getVariableTop
- * @see ucol_setVariableTop
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
-
-/**
- * Thread safe cloning operation. The result is a clone of a given collator.
- * @param coll collator to be cloned
- * @param stackBuffer user allocated space for the new clone. 
- * If NULL new memory will be allocated. 
- *  If buffer is not large enough, new memory will be allocated.
- *  Clients can use the U_COL_SAFECLONE_BUFFERSIZE. 
- *  This will probably be enough to avoid memory allocations.
- * @param pBufferSize pointer to size of allocated space. 
- *  If *pBufferSize == 0, a sufficient size for use in cloning will 
- *  be returned ('pre-flighting')
- *  If *pBufferSize is not enough for a stack-based safe clone, 
- *  new memory will be allocated.
- * @param status to indicate whether the operation went on smoothly or there were errors
- *    An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
- * allocations were necessary.
- * @return pointer to the new clone
- * @see ucol_open
- * @see ucol_openRules
- * @see ucol_close
- * @stable ICU 2.0
- */
-U_STABLE UCollator* U_EXPORT2 
-ucol_safeClone(const UCollator *coll,
-               void            *stackBuffer,
-               int32_t         *pBufferSize,
-               UErrorCode      *status);
-
-/** default memory size for the new clone. It needs to be this large for os/400 large pointers 
- * @stable ICU 2.0
- */
-#define U_COL_SAFECLONE_BUFFERSIZE 512
-
-/**
- * Returns current rules. Delta defines whether full rules are returned or just the tailoring. 
- * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough 
- * to store rules, will store up to available space.
- * @param coll collator to get the rules from
- * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. 
- * @param buffer buffer to store the result in. If NULL, you'll get no rules.
- * @param bufferLen lenght of buffer to store rules in. If less then needed you'll get only the part that fits in.
- * @return current rules
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
-
-/**
- * gets the locale name of the collator. If the collator
- * is instantiated from the rules, then this function returns
- * NULL.
- * @param coll The UCollator for which the locale is needed
- * @param type You can choose between requested, valid and actual
- *             locale. For description see the definition of
- *             ULocDataLocaleType in uloc.h
- * @param status error code of the operation
- * @return real locale name from which the collation data comes. 
- *         If the collator was instantiated from rules, returns
- *         NULL.
- * @deprecated ICU 2.8 Use ucol_getLocaleByType instead
- */
-U_DEPRECATED const char * U_EXPORT2
-ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
-
-
-/**
- * gets the locale name of the collator. If the collator
- * is instantiated from the rules, then this function returns
- * NULL.
- * @param coll The UCollator for which the locale is needed
- * @param type You can choose between requested, valid and actual
- *             locale. For description see the definition of
- *             ULocDataLocaleType in uloc.h
- * @param status error code of the operation
- * @return real locale name from which the collation data comes. 
- *         If the collator was instantiated from rules, returns
- *         NULL.
- * @stable ICU 2.8
- */
-U_STABLE const char * U_EXPORT2
-ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
-
-/**
- * Get an Unicode set that contains all the characters and sequences tailored in 
- * this collator. The result must be disposed of by using uset_close.
- * @param coll        The UCollator for which we want to get tailored chars
- * @param status      error code of the operation
- * @return a pointer to newly created USet. Must be be disposed by using uset_close
- * @see ucol_openRules
- * @see uset_close
- * @stable ICU 2.4
- */
-U_STABLE USet * U_EXPORT2
-ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
-
-/**
- * Universal attribute getter that returns UCOL_DEFAULT if the value is default
- * @param coll collator which attributes are to be changed
- * @param attr attribute type
- * @return attribute value or UCOL_DEFAULT if the value is default
- * @param status to indicate whether the operation went on smoothly or there were errors
- * @see UColAttribute
- * @see UColAttributeValue
- * @see ucol_setAttribute
- * @internal ICU 3.0
- */
-U_INTERNAL UColAttributeValue  U_EXPORT2
-ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
-
-/** Check whether two collators are equal. Collators are considered equal if they
- *  will sort strings the same. This means that both the current attributes and the
- *  rules must be equivalent. Currently used for RuleBasedCollator::operator==.
- *  @param source first collator
- *  @param target second collator
- *  @return TRUE or FALSE
- *  @internal ICU 3.0
- */
-U_INTERNAL UBool U_EXPORT2
-ucol_equals(const UCollator *source, const UCollator *target);
-
-/** Calculates the set of unsafe code points, given a collator.
- *   A character is unsafe if you could append any character and cause the ordering to alter significantly.
- *   Collation sorts in normalized order, so anything that rearranges in normalization can cause this.
- *   Thus if you have a character like a_umlaut, and you add a lower_dot to it,
- *   then it normalizes to a_lower_dot + umlaut, and sorts differently.
- *  @param coll Collator
- *  @param unsafe a fill-in set to receive the unsafe points
- *  @param status for catching errors
- *  @return number of elements in the set
- *  @internal ICU 3.0
- */
-U_INTERNAL int32_t U_EXPORT2
-ucol_getUnsafeSet( const UCollator *coll,
-                  USet *unsafe,
-                  UErrorCode *status);
-
-/** Reset UCA's static pointers. You don't want to use this, unless your static memory can go away.
- * @internal ICU 3.2.1
- */
-U_INTERNAL void U_EXPORT2
-ucol_forgetUCA(void);
-
-/** Touches all resources needed for instantiating a collator from a short string definition,
- *  thus filling up the cache.
- * @param definition A short string containing a locale and a set of attributes. 
- *                   Attributes not explicitly mentioned are left at the default
- *                   state for a locale.
- * @param parseError if not NULL, structure that will get filled with error's pre
- *                   and post context in case of error.
- * @param forceDefaults if FALSE, the settings that are the same as the collator 
- *                   default settings will not be applied (for example, setting
- *                   French secondary on a French collator would not be executed). 
- *                   If TRUE, all the settings will be applied regardless of the 
- *                   collator default value. If the definition
- *                   strings are to be cached, should be set to FALSE.
- * @param status     Error code. Apart from regular error conditions connected to 
- *                   instantiating collators (like out of memory or similar), this
- *                   API will return an error if an invalid attribute or attribute/value
- *                   combination is specified.
- * @see ucol_openFromShortString
- * @internal ICU 3.2.1
- */
-U_INTERNAL void U_EXPORT2
-ucol_prepareShortStringOpen( const char *definition,
-                          UBool forceDefaults,
-                          UParseError *parseError,
-                          UErrorCode *status);
-
-/** Creates a binary image of a collator. This binary image can be stored and 
- *  later used to instantiate a collator using ucol_openBinary.
- *  This API supports preflighting.
- *  @param coll Collator
- *  @param buffer a fill-in buffer to receive the binary image
- *  @param capacity capacity of the destination buffer
- *  @param status for catching errors
- *  @return size of the image
- *  @see ucol_openBinary
- *  @stable ICU 3.2
- */
-U_STABLE int32_t U_EXPORT2
-ucol_cloneBinary(const UCollator *coll,
-                 uint8_t *buffer, int32_t capacity,
-                 UErrorCode *status);
-
-/** Opens a collator from a collator binary image created using
- *  ucol_cloneBinary. Binary image used in instantiation of the 
- *  collator remains owned by the user and should stay around for 
- *  the lifetime of the collator. The API also takes a base collator
- *  which usualy should be UCA.
- *  @param bin binary image owned by the user and required through the
- *             lifetime of the collator
- *  @param length size of the image. If negative, the API will try to
- *                figure out the length of the image
- *  @param base fallback collator, usually UCA. Base is required to be
- *              present through the lifetime of the collator. Currently 
- *              it cannot be NULL.
- *  @param status for catching errors
- *  @return newly created collator
- *  @see ucol_cloneBinary
- *  @stable ICU 3.2
- */
-U_STABLE UCollator* U_EXPORT2
-ucol_openBinary(const uint8_t *bin, int32_t length, 
-                const UCollator *base, 
-                UErrorCode *status);
-
-
-#endif /* #if !UCONFIG_NO_COLLATION */
-
-#endif
diff --git a/Source/core/icu/unicode/ucoleitr.h b/Source/core/icu/unicode/ucoleitr.h
deleted file mode 100644
index 419cb9f..0000000
--- a/Source/core/icu/unicode/ucoleitr.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
-*******************************************************************************
-*   Copyright (C) 2001-2009, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*******************************************************************************
-*
-* File ucoleitr.cpp
-*
-* Modification History:
-*
-* Date        Name        Description
-* 02/15/2001  synwee      Modified all methods to process its own function 
-*                         instead of calling the equivalent c++ api (coleitr.h)
-*******************************************************************************/
-
-#ifndef UCOLEITR_H
-#define UCOLEITR_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_COLLATION
-
-/**  
- * This indicates an error has occured during processing or if no more CEs is 
- * to be returned.
- * @stable ICU 2.0
- */
-#define UCOL_NULLORDER        ((int32_t)0xFFFFFFFF)
-
-/**  
- * This indicates an error has occured during processing or there are no more CEs 
- * to be returned.
- *
- * @internal
- */
-#define UCOL_PROCESSED_NULLORDER        ((int64_t)U_INT64_MAX)
-
-#include "unicode/ucol.h"
-
-/** 
- * The UCollationElements struct.
- * For usage in C programs.
- * @stable ICU 2.0
- */
-typedef struct UCollationElements UCollationElements;
-
-/**
- * \file
- * \brief C API: UCollationElements
- *
- * The UCollationElements API is used as an iterator to walk through each 
- * character of an international string. Use the iterator to return the
- * ordering priority of the positioned character. The ordering priority of a 
- * character, which we refer to as a key, defines how a character is collated 
- * in the given collation object.
- * For example, consider the following in Spanish:
- * <pre>
- * .       "ca" -> the first key is key('c') and second key is key('a').
- * .       "cha" -> the first key is key('ch') and second key is key('a').
- * </pre>
- * And in German,
- * <pre>
- * .       "<ae ligature>b"-> the first key is key('a'), the second key is key('e'), and
- * .       the third key is key('b').
- * </pre>
- * <p>Example of the iterator usage: (without error checking)
- * <pre>
- * .  void CollationElementIterator_Example()
- * .  {
- * .      UChar *s;
- * .      t_int32 order, primaryOrder;
- * .      UCollationElements *c;
- * .      UCollatorOld *coll;
- * .      UErrorCode success = U_ZERO_ERROR;
- * .      s=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) );
- * .      u_uastrcpy(s, "This is a test");
- * .      coll = ucol_open(NULL, &success);
- * .      c = ucol_openElements(coll, str, u_strlen(str), &status);
- * .      order = ucol_next(c, &success);
- * .      ucol_reset(c);
- * .      order = ucol_prev(c, &success);
- * .      free(s);
- * .      ucol_close(coll);
- * .      ucol_closeElements(c);
- * .  }
- * </pre>
- * <p>
- * ucol_next() returns the collation order of the next.
- * ucol_prev() returns the collation order of the previous character.
- * The Collation Element Iterator moves only in one direction between calls to
- * ucol_reset. That is, ucol_next() and ucol_prev can not be inter-used. 
- * Whenever ucol_prev is to be called after ucol_next() or vice versa, 
- * ucol_reset has to be called first to reset the status, shifting pointers to 
- * either the end or the start of the string. Hence at the next call of 
- * ucol_prev or ucol_next, the first or last collation order will be returned. 
- * If a change of direction is done without a ucol_reset, the result is 
- * undefined.
- * The result of a forward iterate (ucol_next) and reversed result of the  
- * backward iterate (ucol_prev) on the same string are equivalent, if 
- * collation orders with the value UCOL_IGNORABLE are ignored.
- * Character based on the comparison level of the collator.  A collation order 
- * consists of primary order, secondary order and tertiary order.  The data 
- * type of the collation order is <strong>t_int32</strong>. 
- *
- * @see UCollator
- */
-
-/**
- * Open the collation elements for a string.
- *
- * @param coll The collator containing the desired collation rules.
- * @param text The text to iterate over.
- * @param textLength The number of characters in text, or -1 if null-terminated
- * @param status A pointer to an UErrorCode to receive any errors.
- * @return a struct containing collation element information
- * @stable ICU 2.0
- */
-U_STABLE UCollationElements* U_EXPORT2 
-ucol_openElements(const UCollator  *coll,
-                  const UChar      *text,
-                        int32_t    textLength,
-                        UErrorCode *status);
-
-
-/**
- * get a hash code for a key... Not very useful!
- * @param key    the given key.
- * @param length the size of the key array.
- * @return       the hash code.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_keyHashCode(const uint8_t* key, int32_t length);
-
-/**
- * Close a UCollationElements.
- * Once closed, a UCollationElements may no longer be used.
- * @param elems The UCollationElements to close.
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_closeElements(UCollationElements *elems);
-
-/**
- * Reset the collation elements to their initial state.
- * This will move the 'cursor' to the beginning of the text.
- * Property settings for collation will be reset to the current status.
- * @param elems The UCollationElements to reset.
- * @see ucol_next
- * @see ucol_previous
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_reset(UCollationElements *elems);
-
-/**
- * Set the collation elements to use implicit ordering for Han
- * even if they've been tailored. This will also force Hangul
- * syllables to be ordered by decomposing them to their component
- * Jamo.
- *
- * @param elems The UCollationElements containing the text.
- * @param status A pointer to a UErrorCode to reveive any errors.
- *
- * @internal
- */
-U_INTERNAL void U_EXPORT2
-ucol_forceHanImplicit(UCollationElements *elems, UErrorCode *status);
-
-/**
- * Get the ordering priority of the next collation element in the text.
- * A single character may contain more than one collation element.
- * @param elems The UCollationElements containing the text.
- * @param status A pointer to an UErrorCode to receive any errors.
- * @return The next collation elements ordering, otherwise returns NULLORDER 
- *         if an error has occured or if the end of string has been reached
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_next(UCollationElements *elems, UErrorCode *status);
-
-/**
- * Get the ordering priority of the previous collation element in the text.
- * A single character may contain more than one collation element.
- * Note that internally a stack is used to store buffered collation elements. 
- * It is very rare that the stack will overflow, however if such a case is 
- * encountered, the problem can be solved by increasing the size 
- * UCOL_EXPAND_CE_BUFFER_SIZE in ucol_imp.h.
- * @param elems The UCollationElements containing the text.
- * @param status A pointer to an UErrorCode to receive any errors. Noteably 
- *               a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack
- *               buffer has been exhausted.
- * @return The previous collation elements ordering, otherwise returns 
- *         NULLORDER if an error has occured or if the start of string has 
- *         been reached.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_previous(UCollationElements *elems, UErrorCode *status);
-
-/**
- * Get the processed ordering priority of the next collation element in the text.
- * A single character may contain more than one collation element.
- *
- * @param elems The UCollationElements containing the text.
- * @param ixLow a pointer to an int32_t to receive the iterator index before fetching the CE.
- * @param ixHigh a pointer to an int32_t to receive the iterator index after fetching the CE.
- * @param status A pointer to an UErrorCode to receive any errors.
- * @return The next collation elements ordering, otherwise returns UCOL_PROCESSED_NULLORDER 
- *         if an error has occured or if the end of string has been reached
- *
- * @internal
- */
-U_INTERNAL int64_t U_EXPORT2
-ucol_nextProcessed(UCollationElements *elems, int32_t *ixLow, int32_t *ixHigh, UErrorCode *status);
-
-/**
- * Get the processed ordering priority of the previous collation element in the text.
- * A single character may contain more than one collation element.
- * Note that internally a stack is used to store buffered collation elements. 
- * It is very rare that the stack will overflow, however if such a case is 
- * encountered, the problem can be solved by increasing the size 
- * UCOL_EXPAND_CE_BUFFER_SIZE in ucol_imp.h.
- *
- * @param elems The UCollationElements containing the text.
- * @param ixLow A pointer to an int32_t to receive the iterator index after fetching the CE
- * @param ixHigh A pointer to an int32_t to receiver the iterator index before fetching the CE
- * @param status A pointer to an UErrorCode to receive any errors. Noteably 
- *               a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack
- *               buffer has been exhausted.
- * @return The previous collation elements ordering, otherwise returns 
- *         UCOL_PROCESSED_NULLORDER if an error has occured or if the start of
- *         string has been reached.
- *
- * @internal
- */
-U_INTERNAL int64_t U_EXPORT2
-ucol_previousProcessed(UCollationElements *elems, int32_t *ixLow, int32_t *ixHigh, UErrorCode *status);
-
-/**
- * Get the maximum length of any expansion sequences that end with the 
- * specified comparison order.
- * This is useful for .... ?
- * @param elems The UCollationElements containing the text.
- * @param order A collation order returned by previous or next.
- * @return maximum size of the expansion sequences ending with the collation 
- *         element or 1 if collation element does not occur at the end of any 
- *         expansion sequence
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_getMaxExpansion(const UCollationElements *elems, int32_t order);
-
-/**
- * Set the text containing the collation elements.
- * Property settings for collation will remain the same.
- * In order to reset the iterator to the current collation property settings,
- * the API reset() has to be called.
- * @param elems The UCollationElements to set.
- * @param text The source text containing the collation elements.
- * @param textLength The length of text, or -1 if null-terminated.
- * @param status A pointer to an UErrorCode to receive any errors.
- * @see ucol_getText
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_setText(      UCollationElements *elems, 
-             const UChar              *text,
-                   int32_t            textLength,
-                   UErrorCode         *status);
-
-/**
- * Get the offset of the current source character.
- * This is an offset into the text of the character containing the current
- * collation elements.
- * @param elems The UCollationElements to query.
- * @return The offset of the current source character.
- * @see ucol_setOffset
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-ucol_getOffset(const UCollationElements *elems);
-
-/**
- * Set the offset of the current source character.
- * This is an offset into the text of the character to be processed.
- * Property settings for collation will remain the same.
- * In order to reset the iterator to the current collation property settings,
- * the API reset() has to be called.
- * @param elems The UCollationElements to set.
- * @param offset The desired character offset.
- * @param status A pointer to an UErrorCode to receive any errors.
- * @see ucol_getOffset
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2 
-ucol_setOffset(UCollationElements *elems,
-               int32_t        offset,
-               UErrorCode         *status);
-
-/**
-* Get the primary order of a collation order.
-* @param order the collation order
-* @return the primary order of a collation order.
-* @stable ICU 2.6
-*/
-U_STABLE int32_t U_EXPORT2
-ucol_primaryOrder (int32_t order); 
-
-/**
-* Get the secondary order of a collation order.
-* @param order the collation order
-* @return the secondary order of a collation order.
-* @stable ICU 2.6
-*/
-U_STABLE int32_t U_EXPORT2
-ucol_secondaryOrder (int32_t order); 
-
-/**
-* Get the tertiary order of a collation order.
-* @param order the collation order
-* @return the tertiary order of a collation order.
-* @stable ICU 2.6
-*/
-U_STABLE int32_t U_EXPORT2
-ucol_tertiaryOrder (int32_t order); 
-
-#endif /* #if !UCONFIG_NO_COLLATION */
-
-#endif
diff --git a/Source/core/icu/unicode/uconfig.h b/Source/core/icu/unicode/uconfig.h
deleted file mode 100644
index 7d2d26e..0000000
--- a/Source/core/icu/unicode/uconfig.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*  
-**********************************************************************
-*   Copyright (C) 2002-2009, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*   file name:  uconfig.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2002sep19
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __UCONFIG_H__
-#define __UCONFIG_H__
-
-
-/*!
- * \file
- * \brief Switches for excluding parts of ICU library code modules.
- *
- * Allows to build partial, smaller libraries for special purposes.
- * By default, all modules are built.
- * The switches are fairly coarse, controlling large modules.
- * Basic services cannot be turned off.
- *
- * Building with any of these options does not guarantee that the
- * ICU build process will completely work. It is recommended that
- * the ICU libraries and data be built using the normal build.
- * At that time you should remove the data used by those services.
- * After building the ICU data library, you should rebuild the ICU
- * libraries with these switches customized to your needs.
- *
- * @stable ICU 2.4
- */
-
-/**
- * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h"
- * prior to determining default settings for uconfig variables.
- * 
- * @internal ICU 4.0
- * 
- */
-#if defined(UCONFIG_USE_LOCAL)
-#include "uconfig_local.h"
-#endif
-
-/**
- * \def UCONFIG_ONLY_COLLATION
- * This switch turns off modules that are not needed for collation.
- *
- * It does not turn off legacy conversion because that is necessary
- * for ICU to work on EBCDIC platforms (for the default converter).
- * If you want "only collation" and do not build for EBCDIC,
- * then you can define UCONFIG_NO_LEGACY_CONVERSION 1 as well.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_ONLY_COLLATION
-#   define UCONFIG_ONLY_COLLATION 0
-#endif
-
-#if UCONFIG_ONLY_COLLATION
-    /* common library */
-#   define UCONFIG_NO_BREAK_ITERATION 1
-#   define UCONFIG_NO_IDNA 1
-
-    /* i18n library */
-#   if UCONFIG_NO_COLLATION
-#       error Contradictory collation switches in uconfig.h.
-#   endif
-#   define UCONFIG_NO_FORMATTING 1
-#   define UCONFIG_NO_TRANSLITERATION 1
-#   define UCONFIG_NO_REGULAR_EXPRESSIONS 1
-#endif
-
-/* common library switches -------------------------------------------------- */
-
-/**
- * \def UCONFIG_NO_FILE_IO
- * This switch turns off all file access in the common library
- * where file access is only used for data loading.
- * ICU data must then be provided in the form of a data DLL (or with an
- * equivalent way to link to the data residing in an executable,
- * as in building a combined library with both the common library's code and
- * the data), or via udata_setCommonData().
- * Application data must be provided via udata_setAppData() or by using
- * "open" functions that take pointers to data, for example ucol_openBinary().
- *
- * File access is not used at all in the i18n library.
- *
- * File access cannot be turned off for the icuio library or for the ICU
- * test suites and ICU tools.
- *
- * @stable ICU 3.6
- */
-#ifndef UCONFIG_NO_FILE_IO
-#   define UCONFIG_NO_FILE_IO 0
-#endif
-
-/**
- * \def UCONFIG_NO_CONVERSION
- * ICU will not completely build with this switch turned on.
- * This switch turns off all converters.
- *
- * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
- * in utypes.h if char* strings in your environment are always in UTF-8.
- *
- * @stable ICU 3.2
- * @see U_CHARSET_IS_UTF8
- */
-#ifndef UCONFIG_NO_CONVERSION
-#   define UCONFIG_NO_CONVERSION 0
-#endif
-
-#if UCONFIG_NO_CONVERSION
-#   define UCONFIG_NO_LEGACY_CONVERSION 1
-#endif
-
-/**
- * \def UCONFIG_NO_LEGACY_CONVERSION
- * This switch turns off all converters except for
- * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
- * - US-ASCII
- * - ISO-8859-1
- *
- * Turning off legacy conversion is not possible on EBCDIC platforms
- * because they need ibm-37 or ibm-1047 default converters.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_NO_LEGACY_CONVERSION
-#   define UCONFIG_NO_LEGACY_CONVERSION 0
-#endif
-
-/**
- * \def UCONFIG_NO_NORMALIZATION
- * This switch turns off normalization.
- * It implies turning off several other services as well, for example
- * collation and IDNA.
- *
- * @stable ICU 2.6
- */
-#ifndef UCONFIG_NO_NORMALIZATION
-#   define UCONFIG_NO_NORMALIZATION 0
-#elif UCONFIG_NO_NORMALIZATION
-    /* common library */
-#   define UCONFIG_NO_IDNA 1
-
-    /* i18n library */
-#   if UCONFIG_ONLY_COLLATION
-#       error Contradictory collation switches in uconfig.h.
-#   endif
-#   define UCONFIG_NO_COLLATION 1
-#   define UCONFIG_NO_TRANSLITERATION 1
-#endif
-
-/**
- * \def UCONFIG_NO_BREAK_ITERATION
- * This switch turns off break iteration.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_NO_BREAK_ITERATION
-#   define UCONFIG_NO_BREAK_ITERATION 0
-#endif
-
-/**
- * \def UCONFIG_NO_IDNA
- * This switch turns off IDNA.
- *
- * @stable ICU 2.6
- */
-#ifndef UCONFIG_NO_IDNA
-#   define UCONFIG_NO_IDNA 0
-#endif
-
-/* i18n library switches ---------------------------------------------------- */
-
-/**
- * \def UCONFIG_NO_COLLATION
- * This switch turns off collation and collation-based string search.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_NO_COLLATION
-#   define UCONFIG_NO_COLLATION 0
-#endif
-
-/**
- * \def UCONFIG_NO_FORMATTING
- * This switch turns off formatting and calendar/timezone services.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_NO_FORMATTING
-#   define UCONFIG_NO_FORMATTING 0
-#endif
-
-/**
- * \def UCONFIG_NO_TRANSLITERATION
- * This switch turns off transliteration.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_NO_TRANSLITERATION
-#   define UCONFIG_NO_TRANSLITERATION 0
-#endif
-
-/**
- * \def UCONFIG_NO_REGULAR_EXPRESSIONS
- * This switch turns off regular expressions.
- *
- * @stable ICU 2.4
- */
-#ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
-#   define UCONFIG_NO_REGULAR_EXPRESSIONS 0
-#endif
-
-/**
- * \def UCONFIG_NO_SERVICE
- * This switch turns off service registration.
- *
- * @stable ICU 3.2
- */
-#ifndef UCONFIG_NO_SERVICE
-#   define UCONFIG_NO_SERVICE 1
-#endif
-
-#endif
diff --git a/Source/core/icu/unicode/ucsdet.h b/Source/core/icu/unicode/ucsdet.h
deleted file mode 100644
index dc492ee..0000000
--- a/Source/core/icu/unicode/ucsdet.h
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- **********************************************************************
- *   Copyright (C) 2005-2010, International Business Machines
- *   Corporation and others.  All Rights Reserved.
- **********************************************************************
- *   file name:  ucsdet.h
- *   encoding:   US-ASCII
- *   indentation:4
- *
- *   created on: 2005Aug04
- *   created by: Andy Heninger
- *
- *   ICU Character Set Detection, API for C
- *
- *   Draft version 18 Oct 2005
- *
- */
-
-#ifndef __UCSDET_H
-#define __UCSDET_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/localpointer.h"
-#include "unicode/uenum.h"
-
-/**
- * \file 
- * \brief C API: Charset Detection API
- *
- * This API provides a facility for detecting the
- * charset or encoding of character data in an unknown text format.
- * The input data can be from an array of bytes.
- * <p>
- * Character set detection is at best an imprecise operation.  The detection
- * process will attempt to identify the charset that best matches the characteristics
- * of the byte data, but the process is partly statistical in nature, and
- * the results can not be guaranteed to always be correct.
- * <p>
- * For best accuracy in charset detection, the input data should be primarily
- * in a single language, and a minimum of a few hundred bytes worth of plain text
- * in the language are needed.  The detection process will attempt to
- * ignore html or xml style markup that could otherwise obscure the content.
- */
- 
-
-struct UCharsetDetector;
-/**
-  * Structure representing a charset detector
-  * @stable ICU 3.6
-  */
-typedef struct UCharsetDetector UCharsetDetector;
-
-struct UCharsetMatch;
-/**
-  *  Opaque structure representing a match that was identified
-  *  from a charset detection operation.
-  *  @stable ICU 3.6
-  */
-typedef struct UCharsetMatch UCharsetMatch;
-
-/**
-  *  Open a charset detector.
-  *
-  *  @param status Any error conditions occurring during the open
-  *                operation are reported back in this variable.
-  *  @return the newly opened charset detector.
-  *  @stable ICU 3.6
-  */
-U_STABLE UCharsetDetector * U_EXPORT2
-ucsdet_open(UErrorCode   *status);
-
-/**
-  * Close a charset detector.  All storage and any other resources
-  *   owned by this charset detector will be released.  Failure to
-  *   close a charset detector when finished with it can result in
-  *   memory leaks in the application.
-  *
-  *  @param ucsd  The charset detector to be closed.
-  *  @stable ICU 3.6
-  */
-U_STABLE void U_EXPORT2
-ucsdet_close(UCharsetDetector *ucsd);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUCharsetDetectorPointer
- * "Smart pointer" class, closes a UCharsetDetector via ucsdet_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUCharsetDetectorPointer, UCharsetDetector, ucsdet_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
-  * Set the input byte data whose charset is to detected.
-  *
-  * Ownership of the input  text byte array remains with the caller.
-  * The input string must not be altered or deleted until the charset
-  * detector is either closed or reset to refer to different input text.
-  *
-  * @param ucsd   the charset detector to be used.
-  * @param textIn the input text of unknown encoding.   .
-  * @param len    the length of the input text, or -1 if the text
-  *               is NUL terminated.
-  * @param status any error conditions are reported back in this variable.
-  *
-  * @stable ICU 3.6
-  */
-U_STABLE void U_EXPORT2
-ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status);
-
-
-/** Set the declared encoding for charset detection.
- *  The declared encoding of an input text is an encoding obtained
- *  by the user from an http header or xml declaration or similar source that
- *  can be provided as an additional hint to the charset detector.
- *
- *  How and whether the declared encoding will be used during the
- *  detection process is TBD.
- *
- * @param ucsd      the charset detector to be used.
- * @param encoding  an encoding for the current data obtained from
- *                  a header or declaration or other source outside
- *                  of the byte data itself.
- * @param length    the length of the encoding name, or -1 if the name string
- *                  is NUL terminated.
- * @param status    any error conditions are reported back in this variable.
- *
- * @stable ICU 3.6
- */
-U_STABLE void U_EXPORT2
-ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status);
-
-
-/**
- * Return the charset that best matches the supplied input data.
- * 
- * Note though, that because the detection 
- * only looks at the start of the input data,
- * there is a possibility that the returned charset will fail to handle
- * the full set of input data.
- * <p>
- * The returned UCharsetMatch object is owned by the UCharsetDetector.
- * It will remain valid until the detector input is reset, or until
- * the detector is closed.
- * <p>
- * The function will fail if
- *  <ul>
- *    <li>no charset appears to match the data.</li>
- *    <li>no input text has been provided</li>
- *  </ul>
- *
- * @param ucsd      the charset detector to be used.
- * @param status    any error conditions are reported back in this variable.
- * @return          a UCharsetMatch  representing the best matching charset,
- *                  or NULL if no charset matches the byte data.
- *
- * @stable ICU 3.6
- */
-U_STABLE const UCharsetMatch * U_EXPORT2
-ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status);
-    
-
-/**
- *  Find all charset matches that appear to be consistent with the input,
- *  returning an array of results.  The results are ordered with the
- *  best quality match first.
- *
- *  Because the detection only looks at a limited amount of the
- *  input byte data, some of the returned charsets may fail to handle
- *  the all of input data.
- *  <p>
- *  The returned UCharsetMatch objects are owned by the UCharsetDetector.
- *  They will remain valid until the detector is closed or modified
- *  
- * <p>
- * Return an error if 
- *  <ul>
- *    <li>no charsets appear to match the input data.</li>
- *    <li>no input text has been provided</li>
- *  </ul>
- * 
- * @param ucsd          the charset detector to be used.
- * @param matchesFound  pointer to a variable that will be set to the
- *                      number of charsets identified that are consistent with
- *                      the input data.  Output only.
- * @param status        any error conditions are reported back in this variable.
- * @return              A pointer to an array of pointers to UCharSetMatch objects.
- *                      This array, and the UCharSetMatch instances to which it refers,
- *                      are owned by the UCharsetDetector, and will remain valid until
- *                      the detector is closed or modified.
- * @stable ICU 3.6
- */
-U_STABLE const UCharsetMatch ** U_EXPORT2
-ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status);
-
-
-
-/**
- *  Get the name of the charset represented by a UCharsetMatch.
- *
- *  The storage for the returned name string is owned by the
- *  UCharsetMatch, and will remain valid while the UCharsetMatch
- *  is valid.
- *
- *  The name returned is suitable for use with the ICU conversion APIs.
- *
- *  @param ucsm    The charset match object.
- *  @param status  Any error conditions are reported back in this variable.
- *  @return        The name of the matching charset.
- *
- *  @stable ICU 3.6
- */
-U_STABLE const char * U_EXPORT2
-ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status);
-
-/**
- *  Get a confidence number for the quality of the match of the byte
- *  data with the charset.  Confidence numbers range from zero to 100,
- *  with 100 representing complete confidence and zero representing
- *  no confidence.
- *
- *  The confidence values are somewhat arbitrary.  They define an
- *  an ordering within the results for any single detection operation
- *  but are not generally comparable between the results for different input.
- *
- *  A confidence value of ten does have a general meaning - it is used
- *  for charsets that can represent the input data, but for which there
- *  is no other indication that suggests that the charset is the correct one.
- *  Pure 7 bit ASCII data, for example, is compatible with a
- *  great many charsets, most of which will appear as possible matches
- *  with a confidence of 10.
- *
- *  @param ucsm    The charset match object.
- *  @param status  Any error conditions are reported back in this variable.
- *  @return        A confidence number for the charset match.
- *
- *  @stable ICU 3.6
- */
-U_STABLE int32_t U_EXPORT2
-ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status);
-
-/**
- *  Get the RFC 3066 code for the language of the input data.
- *
- *  The Charset Detection service is intended primarily for detecting
- *  charsets, not language.  For some, but not all, charsets, a language is
- *  identified as a byproduct of the detection process, and that is what
- *  is returned by this function.
- *
- *  CAUTION:
- *    1.  Language information is not available for input data encoded in
- *        all charsets. In particular, no language is identified
- *        for UTF-8 input data.
- *
- *    2.  Closely related languages may sometimes be confused.
- *
- *  If more accurate language detection is required, a linguistic
- *  analysis package should be used.
- *
- *  The storage for the returned name string is owned by the
- *  UCharsetMatch, and will remain valid while the UCharsetMatch
- *  is valid.
- *
- *  @param ucsm    The charset match object.
- *  @param status  Any error conditions are reported back in this variable.
- *  @return        The RFC 3066 code for the language of the input data, or
- *                 an empty string if the language could not be determined.
- *
- *  @stable ICU 3.6
- */
-U_STABLE const char * U_EXPORT2
-ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status);
-
-
-/**
-  *  Get the entire input text as a UChar string, placing it into
-  *  a caller-supplied buffer.  A terminating
-  *  NUL character will be appended to the buffer if space is available.
-  *
-  *  The number of UChars in the output string, not including the terminating
-  *  NUL, is returned. 
-  *
-  *  If the supplied buffer is smaller than required to hold the output,
-  *  the contents of the buffer are undefined.  The full output string length
-  *  (in UChars) is returned as always, and can be used to allocate a buffer
-  *  of the correct size.
-  *
-  *
-  * @param ucsm    The charset match object.
-  * @param buf     A UChar buffer to be filled with the converted text data.
-  * @param cap     The capacity of the buffer in UChars.
-  * @param status  Any error conditions are reported back in this variable.
-  * @return        The number of UChars in the output string.
-  *
-  * @stable ICU 3.6
-  */
-U_STABLE  int32_t U_EXPORT2
-ucsdet_getUChars(const UCharsetMatch *ucsm,
-                 UChar *buf, int32_t cap, UErrorCode *status);
-
-
-
-/**
-  *  Get an iterator over the set of all detectable charsets - 
-  *  over the charsets that are known to the charset detection
-  *  service.
-  *
-  *  The returned UEnumeration provides access to the names of
-  *  the charsets.
-  *
-  *  The state of the Charset detector that is passed in does not
-  *  affect the result of this function, but requiring a valid, open
-  *  charset detector as a parameter insures that the charset detection
-  *  service has been safely initialized and that the required detection
-  *  data is available.
-  *
-  *  @param ucsd a Charset detector.
-  *  @param status  Any error conditions are reported back in this variable.
-  *  @return an iterator providing access to the detectable charset names.
-  *  @stable ICU 3.6
-  */
-U_STABLE  UEnumeration * U_EXPORT2
-ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd,  UErrorCode *status);
-
-
-/**
-  *  Test whether input filtering is enabled for this charset detector.
-  *  Input filtering removes text that appears to be HTML or xml
-  *  markup from the input before applying the code page detection
-  *  heuristics.
-  *
-  *  @param ucsd  The charset detector to check.
-  *  @return TRUE if filtering is enabled.
-  *  @stable ICU 3.6
-  */
-U_STABLE  UBool U_EXPORT2
-ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd);
-
-
-/**
- * Enable filtering of input text. If filtering is enabled,
- * text within angle brackets ("<" and ">") will be removed
- * before detection, which will remove most HTML or xml markup.
- *
- * @param ucsd   the charset detector to be modified.
- * @param filter <code>true</code> to enable input text filtering.
- * @return The previous setting.
- *
- * @stable ICU 3.6
- */
-U_STABLE  UBool U_EXPORT2
-ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter);
-
-#endif
-#endif   /* __UCSDET_H */
-
-
diff --git a/Source/core/icu/unicode/uenum.h b/Source/core/icu/unicode/uenum.h
deleted file mode 100644
index 0e7d90c..0000000
--- a/Source/core/icu/unicode/uenum.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2002-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  uenum.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:2
-*
-*   created on: 2002jul08
-*   created by: Vladimir Weinstein
-*/
-
-#ifndef __UENUM_H
-#define __UENUM_H
-
-#include "unicode/utypes.h"
-#include "unicode/localpointer.h"
-
-#if U_SHOW_CPLUSPLUS_API
-#include "unicode/strenum.h"
-#endif
-
-/**
- * \file
- * \brief C API: String Enumeration 
- */
- 
-/**
- * An enumeration object.
- * For usage in C programs.
- * @stable ICU 2.2
- */
-struct UEnumeration;
-/** structure representing an enumeration object instance @stable ICU 2.2 */
-typedef struct UEnumeration UEnumeration;
-
-/**
- * Disposes of resources in use by the iterator.  If en is NULL,
- * does nothing.  After this call, any char* or UChar* pointer
- * returned by uenum_unext() or uenum_next() is invalid.
- * @param en UEnumeration structure pointer
- * @stable ICU 2.2
- */
-U_STABLE void U_EXPORT2
-uenum_close(UEnumeration* en);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUEnumerationPointer
- * "Smart pointer" class, closes a UEnumeration via uenum_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Returns the number of elements that the iterator traverses.  If
- * the iterator is out-of-sync with its service, status is set to
- * U_ENUM_OUT_OF_SYNC_ERROR.
- * This is a convenience function. It can end up being very
- * expensive as all the items might have to be pre-fetched (depending
- * on the type of data being traversed). Use with caution and only 
- * when necessary.
- * @param en UEnumeration structure pointer
- * @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the
- *               iterator is out of sync.
- * @return number of elements in the iterator
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-uenum_count(UEnumeration* en, UErrorCode* status);
-
-/**
- * Returns the next element in the iterator's list.  If there are
- * no more elements, returns NULL.  If the iterator is out-of-sync
- * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and
- * NULL is returned.  If the native service string is a char* string,
- * it is converted to UChar* with the invariant converter.
- * The result is terminated by (UChar)0.
- * @param en the iterator object
- * @param resultLength pointer to receive the length of the result
- *                     (not including the terminating \\0).
- *                     If the pointer is NULL it is ignored.
- * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
- *               the iterator is out of sync with its service.
- * @return a pointer to the string.  The string will be
- *         zero-terminated.  The return pointer is owned by this iterator
- *         and must not be deleted by the caller.  The pointer is valid
- *         until the next call to any uenum_... method, including
- *         uenum_next() or uenum_unext().  When all strings have been
- *         traversed, returns NULL.
- * @stable ICU 2.2
- */
-U_STABLE const UChar* U_EXPORT2
-uenum_unext(UEnumeration* en,
-            int32_t* resultLength,
-            UErrorCode* status);
-
-/**
- * Returns the next element in the iterator's list.  If there are
- * no more elements, returns NULL.  If the iterator is out-of-sync
- * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and
- * NULL is returned.  If the native service string is a UChar*
- * string, it is converted to char* with the invariant converter.
- * The result is terminated by (char)0.  If the conversion fails
- * (because a character cannot be converted) then status is set to
- * U_INVARIANT_CONVERSION_ERROR and the return value is undefined
- * (but non-NULL).
- * @param en the iterator object
- * @param resultLength pointer to receive the length of the result
- *                     (not including the terminating \\0).
- *                     If the pointer is NULL it is ignored.
- * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
- *               the iterator is out of sync with its service.  Set to
- *               U_INVARIANT_CONVERSION_ERROR if the underlying native string is
- *               UChar* and conversion to char* with the invariant converter
- *               fails. This error pertains only to current string, so iteration
- *               might be able to continue successfully.
- * @return a pointer to the string.  The string will be
- *         zero-terminated.  The return pointer is owned by this iterator
- *         and must not be deleted by the caller.  The pointer is valid
- *         until the next call to any uenum_... method, including
- *         uenum_next() or uenum_unext().  When all strings have been
- *         traversed, returns NULL.
- * @stable ICU 2.2
- */
-U_STABLE const char* U_EXPORT2
-uenum_next(UEnumeration* en,
-           int32_t* resultLength,
-           UErrorCode* status);
-
-/**
- * Resets the iterator to the current list of service IDs.  This
- * re-establishes sync with the service and rewinds the iterator
- * to start at the first element.
- * @param en the iterator object
- * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
- *               the iterator is out of sync with its service.  
- * @stable ICU 2.2
- */
-U_STABLE void U_EXPORT2
-uenum_reset(UEnumeration* en, UErrorCode* status);
-
-#if U_SHOW_CPLUSPLUS_API
-
-/**
- * Given a StringEnumeration, wrap it in a UEnumeration.  The
- * StringEnumeration is adopted; after this call, the caller must not
- * delete it (regardless of error status).
- * @param adopted the C++ StringEnumeration to be wrapped in a UEnumeration.
- * @param ec the error code.
- * @return a UEnumeration wrapping the adopted StringEnumeration.
- * @draft ICU 4.2
- */
-U_CAPI UEnumeration* U_EXPORT2
-uenum_openFromStringEnumeration(U_NAMESPACE_QUALIFIER StringEnumeration* adopted, UErrorCode* ec);
-
-#endif
-
-#endif
diff --git a/Source/core/icu/unicode/uidna.h b/Source/core/icu/unicode/uidna.h
deleted file mode 100644
index 04b439d..0000000
--- a/Source/core/icu/unicode/uidna.h
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- *******************************************************************************
- *
- *   Copyright (C) 2003-2010, International Business Machines
- *   Corporation and others.  All Rights Reserved.
- *
- *******************************************************************************
- *   file name:  uidna.h
- *   encoding:   US-ASCII
- *   tab size:   8 (not used)
- *   indentation:4
- *
- *   created on: 2003feb1
- *   created by: Ram Viswanadha
- */
-
-#ifndef __UIDNA_H__
-#define __UIDNA_H__
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_IDNA
-
-#include "unicode/localpointer.h"
-#include "unicode/parseerr.h"
-
-/**
- * \file
- * \brief C API: Internationalizing Domain Names in Applications (IDNA)
- *
- * IDNA2008 is implemented according to UTS #46, see the IDNA C++ class in idna.h.
- *
- * The C API functions which do take a UIDNA * service object pointer
- * implement UTS #46 and IDNA2008.
- * The C API functions which do not take a service object pointer
- * implement IDNA2003.
- */
-
-/*
- * IDNA option bit set values.
- */
-enum {
-    /**
-     * Default options value: None of the other options are set.
-     * @stable ICU 2.6
-     */
-    UIDNA_DEFAULT=0,
-    /**
-     * Option to allow unassigned code points in domain names and labels.
-     * This option is ignored by the UTS46 implementation.
-     * (UTS #46 disallows unassigned code points.)
-     * @stable ICU 2.6
-     */
-    UIDNA_ALLOW_UNASSIGNED=1,
-    /**
-     * Option to check whether the input conforms to the STD3 ASCII rules,
-     * for example the restriction of labels to LDH characters
-     * (ASCII Letters, Digits and Hyphen-Minus).
-     * @stable ICU 2.6
-     */
-    UIDNA_USE_STD3_RULES=2,
-    /**
-     * IDNA option to check for whether the input conforms to the BiDi rules.
-     * This option is ignored by the IDNA2003 implementation.
-     * (IDNA2003 always performs a BiDi check.)
-     * @draft ICU 4.6
-     */
-    UIDNA_CHECK_BIDI=4,
-    /**
-     * IDNA option to check for whether the input conforms to the CONTEXTJ rules.
-     * This option is ignored by the IDNA2003 implementation.
-     * (The CONTEXTJ check is new in IDNA2008.)
-     * @draft ICU 4.6
-     */
-    UIDNA_CHECK_CONTEXTJ=8,
-    /**
-     * IDNA option for nontransitional processing in ToASCII().
-     * By default, ToASCII() uses transitional processing.
-     * This option is ignored by the IDNA2003 implementation.
-     * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.)
-     * @draft ICU 4.6
-     */
-    UIDNA_NONTRANSITIONAL_TO_ASCII=0x10,
-    /**
-     * IDNA option for nontransitional processing in ToUnicode().
-     * By default, ToUnicode() uses transitional processing.
-     * This option is ignored by the IDNA2003 implementation.
-     * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.)
-     * @draft ICU 4.6
-     */
-    UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20
-};
-
-/**
- * Opaque C service object type for the new IDNA API.
- * @draft ICU 4.6
- */
-struct UIDNA;
-typedef struct UIDNA UIDNA;  /**< C typedef for struct UIDNA. @draft ICU 4.6 */
-
-/**
- * Returns a UIDNA instance which implements UTS #46.
- * Returns an unmodifiable instance, owned by the caller.
- * Cache it for multiple operations, and uidna_close() it when done.
- * The instance is thread-safe, that is, it can be used concurrently.
- *
- * For details about the UTS #46 implementation see the IDNA C++ class in idna.h.
- *
- * @param options Bit set to modify the processing and error checking.
- *                See option bit set values in uidna.h.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return the UTS #46 UIDNA instance, if successful
- * @draft ICU 4.6
- */
-U_DRAFT UIDNA * U_EXPORT2
-uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode);
-
-/**
- * Closes a UIDNA instance.
- * @param idna UIDNA instance to be closed
- * @draft ICU 4.6
- */
-U_DRAFT void U_EXPORT2
-uidna_close(UIDNA *idna);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUIDNAPointer
- * "Smart pointer" class, closes a UIDNA via uidna_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @draft ICU 4.6
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Output container for IDNA processing errors.
- * Initialize with UIDNA_INFO_INITIALIZER:
- * \code
- * UIDNAInfo info = UIDNA_INFO_INITIALIZER;
- * int32_t length = uidna_nameToASCII(..., &info, &errorCode);
- * if(U_SUCCESS(errorCode) && info.errors!=0) { ... }
- * \endcode
- * @draft ICU 4.6
- */
-struct UIDNAInfo {
-    /** sizeof(UIDNAInfo) @draft ICU 4.6 */
-    int16_t size;
-    /**
-     * Set to TRUE if transitional and nontransitional processing produce different results.
-     * For details see C++ IDNAInfo::isTransitionalDifferent().
-     * @draft ICU 4.6
-     */
-    UBool isTransitionalDifferent;
-    UBool reservedB3;  /**< Reserved field, do not use. @internal */
-    /**
-     * Bit set indicating IDNA processing errors. 0 if no errors.
-     * See UIDNA_ERROR_... constants.
-     * @draft ICU 4.6
-     */
-    uint32_t errors;
-    int32_t reservedI2;  /**< Reserved field, do not use. @internal */
-    int32_t reservedI3;  /**< Reserved field, do not use. @internal */
-};
-typedef struct UIDNAInfo UIDNAInfo;
-
-/**
- * Static initializer for a UIDNAInfo struct.
- * @draft ICU 4.6
- */
-#define UIDNA_INFO_INITIALIZER { \
-    (int16_t)sizeof(UIDNAInfo), \
-    FALSE, FALSE, \
-    0, 0, 0 }
-
-/**
- * Converts a single domain name label into its ASCII form for DNS lookup.
- * If any processing step fails, then pInfo->errors will be non-zero and
- * the result might not be an ASCII string.
- * The label might be modified according to the types of errors.
- * Labels with severe errors will be left in (or turned into) their Unicode form.
- *
- * The UErrorCode indicates an error only in exceptional cases,
- * such as a U_MEMORY_ALLOCATION_ERROR.
- *
- * @param idna UIDNA instance
- * @param label Input domain name label
- * @param length Label length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_labelToASCII(const UIDNA *idna,
-                   const UChar *label, int32_t length,
-                   UChar *dest, int32_t capacity,
-                   UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/**
- * Converts a single domain name label into its Unicode form for human-readable display.
- * If any processing step fails, then pInfo->errors will be non-zero.
- * The label might be modified according to the types of errors.
- *
- * The UErrorCode indicates an error only in exceptional cases,
- * such as a U_MEMORY_ALLOCATION_ERROR.
- *
- * @param idna UIDNA instance
- * @param label Input domain name label
- * @param length Label length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_labelToUnicode(const UIDNA *idna,
-                     const UChar *label, int32_t length,
-                     UChar *dest, int32_t capacity,
-                     UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/**
- * Converts a whole domain name into its ASCII form for DNS lookup.
- * If any processing step fails, then pInfo->errors will be non-zero and
- * the result might not be an ASCII string.
- * The domain name might be modified according to the types of errors.
- * Labels with severe errors will be left in (or turned into) their Unicode form.
- *
- * The UErrorCode indicates an error only in exceptional cases,
- * such as a U_MEMORY_ALLOCATION_ERROR.
- *
- * @param idna UIDNA instance
- * @param name Input domain name
- * @param length Domain name length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_nameToASCII(const UIDNA *idna,
-                  const UChar *name, int32_t length,
-                  UChar *dest, int32_t capacity,
-                  UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/**
- * Converts a whole domain name into its Unicode form for human-readable display.
- * If any processing step fails, then pInfo->errors will be non-zero.
- * The domain name might be modified according to the types of errors.
- *
- * The UErrorCode indicates an error only in exceptional cases,
- * such as a U_MEMORY_ALLOCATION_ERROR.
- *
- * @param idna UIDNA instance
- * @param name Input domain name
- * @param length Domain name length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_nameToUnicode(const UIDNA *idna,
-                    const UChar *name, int32_t length,
-                    UChar *dest, int32_t capacity,
-                    UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/* UTF-8 versions of the processing methods --------------------------------- */
-
-/**
- * Converts a single domain name label into its ASCII form for DNS lookup.
- * UTF-8 version of uidna_labelToASCII(), same behavior.
- *
- * @param idna UIDNA instance
- * @param label Input domain name label
- * @param length Label length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_labelToASCII_UTF8(const UIDNA *idna,
-                        const char *label, int32_t length,
-                        char *dest, int32_t capacity,
-                        UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/**
- * Converts a single domain name label into its Unicode form for human-readable display.
- * UTF-8 version of uidna_labelToUnicode(), same behavior.
- *
- * @param idna UIDNA instance
- * @param label Input domain name label
- * @param length Label length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_labelToUnicodeUTF8(const UIDNA *idna,
-                         const char *label, int32_t length,
-                         char *dest, int32_t capacity,
-                         UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/**
- * Converts a whole domain name into its ASCII form for DNS lookup.
- * UTF-8 version of uidna_nameToASCII(), same behavior.
- *
- * @param idna UIDNA instance
- * @param name Input domain name
- * @param length Domain name length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_nameToASCII_UTF8(const UIDNA *idna,
-                       const char *name, int32_t length,
-                       char *dest, int32_t capacity,
-                       UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/**
- * Converts a whole domain name into its Unicode form for human-readable display.
- * UTF-8 version of uidna_nameToUnicode(), same behavior.
- *
- * @param idna UIDNA instance
- * @param name Input domain name
- * @param length Domain name length, or -1 if NUL-terminated
- * @param dest Destination string buffer
- * @param capacity Destination buffer capacity
- * @param pInfo Output container of IDNA processing details.
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return destination string length
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uidna_nameToUnicodeUTF8(const UIDNA *idna,
-                        const char *name, int32_t length,
-                        char *dest, int32_t capacity,
-                        UIDNAInfo *pInfo, UErrorCode *pErrorCode);
-
-/*
- * IDNA error bit set values.
- * When a domain name or label fails a processing step or does not meet the
- * validity criteria, then one or more of these error bits are set.
- */
-enum {
-    /**
-     * A non-final domain name label (or the whole domain name) is empty.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_EMPTY_LABEL=1,
-    /**
-     * A domain name label is longer than 63 bytes.
-     * (See STD13/RFC1034 3.1. Name space specifications and terminology.)
-     * This is only checked in ToASCII operations, and only if the output label is all-ASCII.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_LABEL_TOO_LONG=2,
-    /**
-     * A domain name is longer than 255 bytes in its storage form.
-     * (See STD13/RFC1034 3.1. Name space specifications and terminology.)
-     * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4,
-    /**
-     * A label starts with a hyphen-minus ('-').
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_LEADING_HYPHEN=8,
-    /**
-     * A label ends with a hyphen-minus ('-').
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_TRAILING_HYPHEN=0x10,
-    /**
-     * A label contains hyphen-minus ('-') in the third and fourth positions.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_HYPHEN_3_4=0x20,
-    /**
-     * A label starts with a combining mark.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_LEADING_COMBINING_MARK=0x40,
-    /**
-     * A label or domain name contains disallowed characters.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_DISALLOWED=0x80,
-    /**
-     * A label starts with "xn--" but does not contain valid Punycode.
-     * That is, an xn-- label failed Punycode decoding.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_PUNYCODE=0x100,
-    /**
-     * A label contains a dot=full stop.
-     * This can occur in an input string for a single-label function.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_LABEL_HAS_DOT=0x200,
-    /**
-     * An ACE label does not contain a valid label string.
-     * The label was successfully ACE (Punycode) decoded but the resulting
-     * string had severe validation errors. For example,
-     * it might contain characters that are not allowed in ACE labels,
-     * or it might not be normalized.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_INVALID_ACE_LABEL=0x400,
-    /**
-     * A label does not meet the IDNA BiDi requirements (for right-to-left characters).
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_BIDI=0x800,
-    /**
-     * A label does not meet the IDNA CONTEXTJ requirements.
-     * @draft ICU 4.6
-     */
-    UIDNA_ERROR_CONTEXTJ=0x1000
-};
-
-/* IDNA2003 API ------------------------------------------------------------- */
-
-/**
- * IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC.
- * This operation is done on <b>single labels</b> before sending it to something that expects
- * ASCII names. A label is an individual part of a domain name. Labels are usually
- * separated by dots; e.g. "www.example.com" is composed of 3 labels "www","example", and "com".
- *
- * IDNA2003 API Overview:
- *
- * The uidna_ API implements the IDNA protocol as defined in the IDNA RFC
- * (http://www.ietf.org/rfc/rfc3490.txt).
- * The RFC defines 2 operations: ToASCII and ToUnicode. Domain name labels
- * containing non-ASCII code points are processed by the
- * ToASCII operation before passing it to resolver libraries. Domain names
- * that are obtained from resolver libraries are processed by the
- * ToUnicode operation before displaying the domain name to the user.
- * IDNA requires that implementations process input strings with Nameprep
- * (http://www.ietf.org/rfc/rfc3491.txt),
- * which is a profile of Stringprep (http://www.ietf.org/rfc/rfc3454.txt),
- * and then with Punycode (http://www.ietf.org/rfc/rfc3492.txt).
- * Implementations of IDNA MUST fully implement Nameprep and Punycode;
- * neither Nameprep nor Punycode are optional.
- * The input and output of ToASCII and ToUnicode operations are Unicode
- * and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations
- * multiple times to an input string will yield the same result as applying the operation
- * once.
- * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string) 
- * ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string).
- *
- * @param src               Input UChar array containing label in Unicode.
- * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
- * @param dest              Output UChar array with ASCII (ACE encoded) label.
- * @param destCapacity      Size of dest.
- * @param options           A bit set of options:
- *
- *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
- *                              and do not use STD3 ASCII rules
- *                              If unassigned code points are found the operation fails with 
- *                              U_UNASSIGNED_ERROR error code.
- *
- *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
- *                              If this option is set, the unassigned code points are in the input 
- *                              are treated as normal Unicode code points.
- *
- *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
- *                              If this option is set and the input does not satisfy STD3 rules,  
- *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
- *
- * @param parseError        Pointer to UParseError struct to receive information on position 
- *                          of error if an error is encountered. Can be NULL.
- * @param status            ICU in/out error code parameter.
- *                          U_INVALID_CHAR_FOUND if src contains
- *                          unmatched single surrogates.
- *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
- *                          too many code points.
- *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
- * @return The length of the result string, if successful - or in case of a buffer overflow,
- *         in which case it will be greater than destCapacity.
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-uidna_toASCII(const UChar* src, int32_t srcLength, 
-              UChar* dest, int32_t destCapacity,
-              int32_t options,
-              UParseError* parseError,
-              UErrorCode* status);
-
-
-/**
- * IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC.
- * This operation is done on <b>single labels</b> before sending it to something that expects
- * Unicode names. A label is an individual part of a domain name. Labels are usually
- * separated by dots; for e.g. "www.example.com" is composed of 3 labels "www","example", and "com".
- *
- * @param src               Input UChar array containing ASCII (ACE encoded) label.
- * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
- * @param dest Output       Converted UChar array containing Unicode equivalent of label.
- * @param destCapacity      Size of dest.
- * @param options           A bit set of options:
- *
- *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
- *                              and do not use STD3 ASCII rules
- *                              If unassigned code points are found the operation fails with 
- *                              U_UNASSIGNED_ERROR error code.
- *
- *  - UIDNA_ALLOW_UNASSIGNED      Unassigned values can be converted to ASCII for query operations
- *                              If this option is set, the unassigned code points are in the input 
- *                              are treated as normal Unicode code points. <b> Note: </b> This option is 
- *                              required on toUnicode operation because the RFC mandates 
- *                              verification of decoded ACE input by applying toASCII and comparing
- *                              its output with source
- *
- *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
- *                              If this option is set and the input does not satisfy STD3 rules,  
- *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
- *
- * @param parseError        Pointer to UParseError struct to receive information on position 
- *                          of error if an error is encountered. Can be NULL.
- * @param status            ICU in/out error code parameter.
- *                          U_INVALID_CHAR_FOUND if src contains
- *                          unmatched single surrogates.
- *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
- *                          too many code points.
- *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
- * @return The length of the result string, if successful - or in case of a buffer overflow,
- *         in which case it will be greater than destCapacity.
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-uidna_toUnicode(const UChar* src, int32_t srcLength,
-                UChar* dest, int32_t destCapacity,
-                int32_t options,
-                UParseError* parseError,
-                UErrorCode* status);
-
-
-/**
- * IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
- * This operation is done on complete domain names, e.g: "www.example.com". 
- * It is important to note that this operation can fail. If it fails, then the input 
- * domain name cannot be used as an Internationalized Domain Name and the application
- * should have methods defined to deal with the failure.
- *
- * <b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
- * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, 
- * and then convert. This function does not offer that level of granularity. The options once  
- * set will apply to all labels in the domain name
- *
- * @param src               Input UChar array containing IDN in Unicode.
- * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
- * @param dest              Output UChar array with ASCII (ACE encoded) IDN.
- * @param destCapacity      Size of dest.
- * @param options           A bit set of options:
- *
- *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
- *                              and do not use STD3 ASCII rules
- *                              If unassigned code points are found the operation fails with 
- *                              U_UNASSIGNED_CODE_POINT_FOUND error code.
- *
- *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
- *                              If this option is set, the unassigned code points are in the input 
- *                              are treated as normal Unicode code points.
- *
- *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
- *                              If this option is set and the input does not satisfy STD3 rules,  
- *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
- *
- * @param parseError        Pointer to UParseError struct to receive information on position 
- *                          of error if an error is encountered. Can be NULL.
- * @param status            ICU in/out error code parameter.
- *                          U_INVALID_CHAR_FOUND if src contains
- *                          unmatched single surrogates.
- *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
- *                          too many code points.
- *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
- * @return The length of the result string, if successful - or in case of a buffer overflow,
- *         in which case it will be greater than destCapacity.
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-uidna_IDNToASCII(  const UChar* src, int32_t srcLength,
-                   UChar* dest, int32_t destCapacity,
-                   int32_t options,
-                   UParseError* parseError,
-                   UErrorCode* status);
-
-/**
- * IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
- * This operation is done on complete domain names, e.g: "www.example.com". 
- *
- * <b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
- * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, 
- * and then convert. This function does not offer that level of granularity. The options once  
- * set will apply to all labels in the domain name
- *
- * @param src               Input UChar array containing IDN in ASCII (ACE encoded) form.
- * @param srcLength         Number of UChars in src, or -1 if NUL-terminated.
- * @param dest Output       UChar array containing Unicode equivalent of source IDN.
- * @param destCapacity      Size of dest.
- * @param options           A bit set of options:
- *
- *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
- *                              and do not use STD3 ASCII rules
- *                              If unassigned code points are found the operation fails with 
- *                              U_UNASSIGNED_CODE_POINT_FOUND error code.
- *
- *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
- *                              If this option is set, the unassigned code points are in the input 
- *                              are treated as normal Unicode code points.
- *
- *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
- *                              If this option is set and the input does not satisfy STD3 rules,  
- *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
- *
- * @param parseError        Pointer to UParseError struct to receive information on position 
- *                          of error if an error is encountered. Can be NULL.
- * @param status            ICU in/out error code parameter.
- *                          U_INVALID_CHAR_FOUND if src contains
- *                          unmatched single surrogates.
- *                          U_INDEX_OUTOFBOUNDS_ERROR if src contains
- *                          too many code points.
- *                          U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough
- * @return The length of the result string, if successful - or in case of a buffer overflow,
- *         in which case it will be greater than destCapacity.
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-uidna_IDNToUnicode(  const UChar* src, int32_t srcLength,
-                     UChar* dest, int32_t destCapacity,
-                     int32_t options,
-                     UParseError* parseError,
-                     UErrorCode* status);
-
-/**
- * IDNA2003: Compare two IDN strings for equivalence.
- * This function splits the domain names into labels and compares them.
- * According to IDN RFC, whenever two labels are compared, they are 
- * considered equal if and only if their ASCII forms (obtained by 
- * applying toASCII) match using an case-insensitive ASCII comparison.
- * Two domain names are considered a match if and only if all labels 
- * match regardless of whether label separators match.
- *
- * @param s1                First source string.
- * @param length1           Length of first source string, or -1 if NUL-terminated.
- *
- * @param s2                Second source string.
- * @param length2           Length of second source string, or -1 if NUL-terminated.
- * @param options           A bit set of options:
- *
- *  - UIDNA_DEFAULT             Use default options, i.e., do not process unassigned code points
- *                              and do not use STD3 ASCII rules
- *                              If unassigned code points are found the operation fails with 
- *                              U_UNASSIGNED_CODE_POINT_FOUND error code.
- *
- *  - UIDNA_ALLOW_UNASSIGNED    Unassigned values can be converted to ASCII for query operations
- *                              If this option is set, the unassigned code points are in the input 
- *                              are treated as normal Unicode code points.
- *
- *  - UIDNA_USE_STD3_RULES      Use STD3 ASCII rules for host name syntax restrictions
- *                              If this option is set and the input does not satisfy STD3 rules,  
- *                              the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
- *
- * @param status            ICU error code in/out parameter.
- *                          Must fulfill U_SUCCESS before the function call.
- * @return <0 or 0 or >0 as usual for string comparisons
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-uidna_compare(  const UChar *s1, int32_t length1,
-                const UChar *s2, int32_t length2,
-                int32_t options,
-                UErrorCode* status);
-
-#endif /* #if !UCONFIG_NO_IDNA */
-
-#endif
diff --git a/Source/core/icu/unicode/uiter.h b/Source/core/icu/unicode/uiter.h
deleted file mode 100644
index b469e24..0000000
--- a/Source/core/icu/unicode/uiter.h
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2002-2006,2009 International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  uiter.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2002jan18
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __UITER_H__
-#define __UITER_H__
-
-/**
- * \file
- * \brief C API: Unicode Character Iteration
- *
- * @see UCharIterator
- */
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-    U_NAMESPACE_BEGIN
-
-    class CharacterIterator;
-    class Replaceable;
-
-    U_NAMESPACE_END
-#endif
-
-U_CDECL_BEGIN
-
-struct UCharIterator;
-typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */
-
-/**
- * Origin constants for UCharIterator.getIndex() and UCharIterator.move().
- * @see UCharIteratorMove
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef enum UCharIteratorOrigin {
-    UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH
-} UCharIteratorOrigin;
-
-/** Constants for UCharIterator. @stable ICU 2.6 */
-enum {
-    /**
-     * Constant value that may be returned by UCharIteratorMove
-     * indicating that the final UTF-16 index is not known, but that the move succeeded.
-     * This can occur when moving relative to limit or length, or
-     * when moving relative to the current index after a setState()
-     * when the current UTF-16 index is not known.
-     *
-     * It would be very inefficient to have to count from the beginning of the text
-     * just to get the current/limit/length index after moving relative to it.
-     * The actual index can be determined with getIndex(UITER_CURRENT)
-     * which will count the UChars if necessary.
-     *
-     * @stable ICU 2.6
-     */
-    UITER_UNKNOWN_INDEX=-2
-};
-
-
-/**
- * Constant for UCharIterator getState() indicating an error or
- * an unknown state.
- * Returned by uiter_getState()/UCharIteratorGetState
- * when an error occurs.
- * Also, some UCharIterator implementations may not be able to return
- * a valid state for each position. This will be clearly documented
- * for each such iterator (none of the public ones here).
- *
- * @stable ICU 2.6
- */
-#define UITER_NO_STATE ((uint32_t)0xffffffff)
-
-/**
- * Function type declaration for UCharIterator.getIndex().
- *
- * Gets the current position, or the start or limit of the
- * iteration range.
- *
- * This function may perform slowly for UITER_CURRENT after setState() was called,
- * or for UITER_LENGTH, because an iterator implementation may have to count
- * UChars if the underlying storage is not UTF-16.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @param origin get the 0, start, limit, length, or current index
- * @return the requested index, or U_SENTINEL in an error condition
- *
- * @see UCharIteratorOrigin
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef int32_t U_CALLCONV
-UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin);
-
-/**
- * Function type declaration for UCharIterator.move().
- *
- * Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index).
- *
- * Moves the current position relative to the start or limit of the
- * iteration range, or relative to the current position itself.
- * The movement is expressed in numbers of code units forward
- * or backward by specifying a positive or negative delta.
- * Out of bounds movement will be pinned to the start or limit.
- *
- * This function may perform slowly for moving relative to UITER_LENGTH
- * because an iterator implementation may have to count the rest of the
- * UChars if the native storage is not UTF-16.
- *
- * When moving relative to the limit or length, or
- * relative to the current position after setState() was called,
- * move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient
- * determination of the actual UTF-16 index.
- * The actual index can be determined with getIndex(UITER_CURRENT)
- * which will count the UChars if necessary.
- * See UITER_UNKNOWN_INDEX for details.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @param delta can be positive, zero, or negative
- * @param origin move relative to the 0, start, limit, length, or current index
- * @return the new index, or U_SENTINEL on an error condition,
- *         or UITER_UNKNOWN_INDEX when the index is not known.
- *
- * @see UCharIteratorOrigin
- * @see UCharIterator
- * @see UITER_UNKNOWN_INDEX
- * @stable ICU 2.1
- */
-typedef int32_t U_CALLCONV
-UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin);
-
-/**
- * Function type declaration for UCharIterator.hasNext().
- *
- * Check if current() and next() can still
- * return another code unit.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return boolean value for whether current() and next() can still return another code unit
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef UBool U_CALLCONV
-UCharIteratorHasNext(UCharIterator *iter);
-
-/**
- * Function type declaration for UCharIterator.hasPrevious().
- *
- * Check if previous() can still return another code unit.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return boolean value for whether previous() can still return another code unit
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef UBool U_CALLCONV
-UCharIteratorHasPrevious(UCharIterator *iter);
- 
-/**
- * Function type declaration for UCharIterator.current().
- *
- * Return the code unit at the current position,
- * or U_SENTINEL if there is none (index is at the limit).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the current code unit
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef UChar32 U_CALLCONV
-UCharIteratorCurrent(UCharIterator *iter);
-
-/**
- * Function type declaration for UCharIterator.next().
- *
- * Return the code unit at the current index and increment
- * the index (post-increment, like s[i++]),
- * or return U_SENTINEL if there is none (index is at the limit).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the current code unit (and post-increment the current index)
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef UChar32 U_CALLCONV
-UCharIteratorNext(UCharIterator *iter);
-
-/**
- * Function type declaration for UCharIterator.previous().
- *
- * Decrement the index and return the code unit from there
- * (pre-decrement, like s[--i]),
- * or return U_SENTINEL if there is none (index is at the start).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the previous code unit (after pre-decrementing the current index)
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef UChar32 U_CALLCONV
-UCharIteratorPrevious(UCharIterator *iter);
-
-/**
- * Function type declaration for UCharIterator.reservedFn().
- * Reserved for future use.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @param something some integer argument
- * @return some integer
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-typedef int32_t U_CALLCONV
-UCharIteratorReserved(UCharIterator *iter, int32_t something);
-
-/**
- * Function type declaration for UCharIterator.getState().
- *
- * Get the "state" of the iterator in the form of a single 32-bit word.
- * It is recommended that the state value be calculated to be as small as
- * is feasible. For strings with limited lengths, fewer than 32 bits may
- * be sufficient.
- *
- * This is used together with setState()/UCharIteratorSetState
- * to save and restore the iterator position more efficiently than with
- * getIndex()/move().
- *
- * The iterator state is defined as a uint32_t value because it is designed
- * for use in ucol_nextSortKeyPart() which provides 32 bits to store the state
- * of the character iterator.
- *
- * With some UCharIterator implementations (e.g., UTF-8),
- * getting and setting the UTF-16 index with existing functions
- * (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but
- * relatively slow because the iterator has to "walk" from a known index
- * to the requested one.
- * This takes more time the farther it needs to go.
- *
- * An opaque state value allows an iterator implementation to provide
- * an internal index (UTF-8: the source byte array index) for
- * fast, constant-time restoration.
- *
- * After calling setState(), a getIndex(UITER_CURRENT) may be slow because
- * the UTF-16 index may not be restored as well, but the iterator can deliver
- * the correct text contents and move relative to the current position
- * without performance degradation.
- *
- * Some UCharIterator implementations may not be able to return
- * a valid state for each position, in which case they return UITER_NO_STATE instead.
- * This will be clearly documented for each such iterator (none of the public ones here).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the state word
- *
- * @see UCharIterator
- * @see UCharIteratorSetState
- * @see UITER_NO_STATE
- * @stable ICU 2.6
- */
-typedef uint32_t U_CALLCONV
-UCharIteratorGetState(const UCharIterator *iter);
-
-/**
- * Function type declaration for UCharIterator.setState().
- *
- * Restore the "state" of the iterator using a state word from a getState() call.
- * The iterator object need not be the same one as for which getState() was called,
- * but it must be of the same type (set up using the same uiter_setXYZ function)
- * and it must iterate over the same string
- * (binary identical regardless of memory address).
- * For more about the state word see UCharIteratorGetState.
- *
- * After calling setState(), a getIndex(UITER_CURRENT) may be slow because
- * the UTF-16 index may not be restored as well, but the iterator can deliver
- * the correct text contents and move relative to the current position
- * without performance degradation.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @param state the state word from a getState() call
- *              on a same-type, same-string iterator
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                   which must not indicate a failure before the function call.
- *
- * @see UCharIterator
- * @see UCharIteratorGetState
- * @stable ICU 2.6
- */
-typedef void U_CALLCONV
-UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
-
-
-/**
- * C API for code unit iteration.
- * This can be used as a C wrapper around
- * CharacterIterator, Replaceable, or implemented using simple strings, etc.
- *
- * There are two roles for using UCharIterator:
- *
- * A "provider" sets the necessary function pointers and controls the "protected"
- * fields of the UCharIterator structure. A "provider" passes a UCharIterator
- * into C APIs that need a UCharIterator as an abstract, flexible string interface.
- *
- * Implementations of such C APIs are "callers" of UCharIterator functions;
- * they only use the "public" function pointers and never access the "protected"
- * fields directly.
- *
- * The current() and next() functions only check the current index against the
- * limit, and previous() only checks the current index against the start,
- * to see if the iterator already reached the end of the iteration range.
- *
- * The assumption - in all iterators - is that the index is moved via the API,
- * which means it won't go out of bounds, or the index is modified by
- * user code that knows enough about the iterator implementation to set valid
- * index values.
- *
- * UCharIterator functions return code unit values 0..0xffff,
- * or U_SENTINEL if the iteration bounds are reached.
- *
- * @stable ICU 2.1
- */
-struct UCharIterator {
-    /**
-     * (protected) Pointer to string or wrapped object or similar.
-     * Not used by caller.
-     * @stable ICU 2.1
-     */
-    const void *context;
-
-    /**
-     * (protected) Length of string or similar.
-     * Not used by caller.
-     * @stable ICU 2.1
-     */
-    int32_t length;
-
-    /**
-     * (protected) Start index or similar.
-     * Not used by caller.
-     * @stable ICU 2.1
-     */
-    int32_t start;
-
-    /**
-     * (protected) Current index or similar.
-     * Not used by caller.
-     * @stable ICU 2.1
-     */
-    int32_t index;
-
-    /**
-     * (protected) Limit index or similar.
-     * Not used by caller.
-     * @stable ICU 2.1
-     */
-    int32_t limit;
-
-    /**
-     * (protected) Used by UTF-8 iterators and possibly others.
-     * @stable ICU 2.1
-     */
-    int32_t reservedField;
-
-    /**
-     * (public) Returns the current position or the
-     * start or limit index of the iteration range.
-     *
-     * @see UCharIteratorGetIndex
-     * @stable ICU 2.1
-     */
-    UCharIteratorGetIndex *getIndex;
-
-    /**
-     * (public) Moves the current position relative to the start or limit of the
-     * iteration range, or relative to the current position itself.
-     * The movement is expressed in numbers of code units forward
-     * or backward by specifying a positive or negative delta.
-     *
-     * @see UCharIteratorMove
-     * @stable ICU 2.1
-     */
-    UCharIteratorMove *move;
-
-    /**
-     * (public) Check if current() and next() can still
-     * return another code unit.
-     *
-     * @see UCharIteratorHasNext
-     * @stable ICU 2.1
-     */
-    UCharIteratorHasNext *hasNext;
-
-    /**
-     * (public) Check if previous() can still return another code unit.
-     *
-     * @see UCharIteratorHasPrevious
-     * @stable ICU 2.1
-     */
-    UCharIteratorHasPrevious *hasPrevious;
-
-    /**
-     * (public) Return the code unit at the current position,
-     * or U_SENTINEL if there is none (index is at the limit).
-     *
-     * @see UCharIteratorCurrent
-     * @stable ICU 2.1
-     */
-    UCharIteratorCurrent *current;
-
-    /**
-     * (public) Return the code unit at the current index and increment
-     * the index (post-increment, like s[i++]),
-     * or return U_SENTINEL if there is none (index is at the limit).
-     *
-     * @see UCharIteratorNext
-     * @stable ICU 2.1
-     */
-    UCharIteratorNext *next;
-
-    /**
-     * (public) Decrement the index and return the code unit from there
-     * (pre-decrement, like s[--i]),
-     * or return U_SENTINEL if there is none (index is at the start).
-     *
-     * @see UCharIteratorPrevious
-     * @stable ICU 2.1
-     */
-    UCharIteratorPrevious *previous;
-
-    /**
-     * (public) Reserved for future use. Currently NULL.
-     *
-     * @see UCharIteratorReserved
-     * @stable ICU 2.1
-     */
-    UCharIteratorReserved *reservedFn;
-
-    /**
-     * (public) Return the state of the iterator, to be restored later with setState().
-     * This function pointer is NULL if the iterator does not implement it.
-     *
-     * @see UCharIteratorGet
-     * @stable ICU 2.6
-     */
-    UCharIteratorGetState *getState;
-
-    /**
-     * (public) Restore the iterator state from the state word from a call
-     * to getState().
-     * This function pointer is NULL if the iterator does not implement it.
-     *
-     * @see UCharIteratorSet
-     * @stable ICU 2.6
-     */
-    UCharIteratorSetState *setState;
-};
-
-/**
- * Helper function for UCharIterator to get the code point
- * at the current index.
- *
- * Return the code point that includes the code unit at the current position,
- * or U_SENTINEL if there is none (index is at the limit).
- * If the current code unit is a lead or trail surrogate,
- * then the following or preceding surrogate is used to form
- * the code point value.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the current code point
- *
- * @see UCharIterator
- * @see U16_GET
- * @see UnicodeString::char32At()
- * @stable ICU 2.1
- */
-U_STABLE UChar32 U_EXPORT2
-uiter_current32(UCharIterator *iter);
-
-/**
- * Helper function for UCharIterator to get the next code point.
- *
- * Return the code point at the current index and increment
- * the index (post-increment, like s[i++]),
- * or return U_SENTINEL if there is none (index is at the limit).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the current code point (and post-increment the current index)
- *
- * @see UCharIterator
- * @see U16_NEXT
- * @stable ICU 2.1
- */
-U_STABLE UChar32 U_EXPORT2
-uiter_next32(UCharIterator *iter);
-
-/**
- * Helper function for UCharIterator to get the previous code point.
- *
- * Decrement the index and return the code point from there
- * (pre-decrement, like s[--i]),
- * or return U_SENTINEL if there is none (index is at the start).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the previous code point (after pre-decrementing the current index)
- *
- * @see UCharIterator
- * @see U16_PREV
- * @stable ICU 2.1
- */
-U_STABLE UChar32 U_EXPORT2
-uiter_previous32(UCharIterator *iter);
-
-/**
- * Get the "state" of the iterator in the form of a single 32-bit word.
- * This is a convenience function that calls iter->getState(iter)
- * if iter->getState is not NULL;
- * if it is NULL or any other error occurs, then UITER_NO_STATE is returned.
- *
- * Some UCharIterator implementations may not be able to return
- * a valid state for each position, in which case they return UITER_NO_STATE instead.
- * This will be clearly documented for each such iterator (none of the public ones here).
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @return the state word
- *
- * @see UCharIterator
- * @see UCharIteratorGetState
- * @see UITER_NO_STATE
- * @stable ICU 2.6
- */
-U_STABLE uint32_t U_EXPORT2
-uiter_getState(const UCharIterator *iter);
-
-/**
- * Restore the "state" of the iterator using a state word from a getState() call.
- * This is a convenience function that calls iter->setState(iter, state, pErrorCode)
- * if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set.
- *
- * @param iter the UCharIterator structure ("this pointer")
- * @param state the state word from a getState() call
- *              on a same-type, same-string iterator
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                   which must not indicate a failure before the function call.
- *
- * @see UCharIterator
- * @see UCharIteratorSetState
- * @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
-uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
-
-/**
- * Set up a UCharIterator to iterate over a string.
- *
- * Sets the UCharIterator function pointers for iteration over the string s
- * with iteration boundaries start=index=0 and length=limit=string length.
- * The "provider" may set the start, index, and limit values at any time
- * within the range 0..length.
- * The length field will be ignored.
- *
- * The string pointer s is set into UCharIterator.context without copying
- * or reallocating the string contents.
- *
- * getState() simply returns the current index.
- * move() will always return the final index.
- *
- * @param iter UCharIterator structure to be set for iteration
- * @param s String to iterate over
- * @param length Length of s, or -1 if NUL-terminated
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-U_STABLE void U_EXPORT2
-uiter_setString(UCharIterator *iter, const UChar *s, int32_t length);
-
-/**
- * Set up a UCharIterator to iterate over a UTF-16BE string
- * (byte vector with a big-endian pair of bytes per UChar).
- *
- * Everything works just like with a normal UChar iterator (uiter_setString),
- * except that UChars are assembled from byte pairs,
- * and that the length argument here indicates an even number of bytes.
- *
- * getState() simply returns the current index.
- * move() will always return the final index.
- *
- * @param iter UCharIterator structure to be set for iteration
- * @param s UTF-16BE string to iterate over
- * @param length Length of s as an even number of bytes, or -1 if NUL-terminated
- *               (NUL means pair of 0 bytes at even index from s)
- *
- * @see UCharIterator
- * @see uiter_setString
- * @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
-uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length);
-
-/**
- * Set up a UCharIterator to iterate over a UTF-8 string.
- *
- * Sets the UCharIterator function pointers for iteration over the UTF-8 string s
- * with UTF-8 iteration boundaries 0 and length.
- * The implementation counts the UTF-16 index on the fly and
- * lazily evaluates the UTF-16 length of the text.
- *
- * The start field is used as the UTF-8 offset, the limit field as the UTF-8 length.
- * When the reservedField is not 0, then it contains a supplementary code point
- * and the UTF-16 index is between the two corresponding surrogates.
- * At that point, the UTF-8 index is behind that code point.
- *
- * The UTF-8 string pointer s is set into UCharIterator.context without copying
- * or reallocating the string contents.
- *
- * getState() returns a state value consisting of
- * - the current UTF-8 source byte index (bits 31..1)
- * - a flag (bit 0) that indicates whether the UChar position is in the middle
- *   of a surrogate pair
- *   (from a 4-byte UTF-8 sequence for the corresponding supplementary code point)
- *
- * getState() cannot also encode the UTF-16 index in the state value.
- * move(relative to limit or length), or
- * move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX.
- *
- * @param iter UCharIterator structure to be set for iteration
- * @param s UTF-8 string to iterate over
- * @param length Length of s in bytes, or -1 if NUL-terminated
- *
- * @see UCharIterator
- * @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
-uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length);
-
-#if U_SHOW_CPLUSPLUS_API
-
-/**
- * Set up a UCharIterator to wrap around a C++ CharacterIterator.
- *
- * Sets the UCharIterator function pointers for iteration using the
- * CharacterIterator charIter.
- *
- * The CharacterIterator pointer charIter is set into UCharIterator.context
- * without copying or cloning the CharacterIterator object.
- * The other "protected" UCharIterator fields are set to 0 and will be ignored.
- * The iteration index and boundaries are controlled by the CharacterIterator.
- *
- * getState() simply returns the current index.
- * move() will always return the final index.
- *
- * @param iter UCharIterator structure to be set for iteration
- * @param charIter CharacterIterator to wrap
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-U_STABLE void U_EXPORT2
-uiter_setCharacterIterator(UCharIterator *iter, U_NAMESPACE_QUALIFIER CharacterIterator *charIter);
-
-/**
- * Set up a UCharIterator to iterate over a C++ Replaceable.
- *
- * Sets the UCharIterator function pointers for iteration over the
- * Replaceable rep with iteration boundaries start=index=0 and
- * length=limit=rep->length().
- * The "provider" may set the start, index, and limit values at any time
- * within the range 0..length=rep->length().
- * The length field will be ignored.
- *
- * The Replaceable pointer rep is set into UCharIterator.context without copying
- * or cloning/reallocating the Replaceable object.
- *
- * getState() simply returns the current index.
- * move() will always return the final index.
- *
- * @param iter UCharIterator structure to be set for iteration
- * @param rep Replaceable to iterate over
- *
- * @see UCharIterator
- * @stable ICU 2.1
- */
-U_STABLE void U_EXPORT2
-uiter_setReplaceable(UCharIterator *iter, const U_NAMESPACE_QUALIFIER Replaceable *rep);
-
-#endif
-
-U_CDECL_END
-
-#endif
diff --git a/Source/core/icu/unicode/uloc.h b/Source/core/icu/unicode/uloc.h
deleted file mode 100644
index 95758c3..0000000
--- a/Source/core/icu/unicode/uloc.h
+++ /dev/null
@@ -1,1126 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1997-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*
-* File ULOC.H
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   04/01/97    aliu        Creation.
-*   08/22/98    stephen     JDK 1.2 sync.
-*   12/08/98    rtg         New C API for Locale
-*   03/30/99    damiba      overhaul
-*   03/31/99    helena      Javadoc for uloc functions.
-*   04/15/99    Madhu       Updated Javadoc
-********************************************************************************
-*/
-
-#ifndef ULOC_H
-#define ULOC_H
-
-#include "unicode/utypes.h"
-#include "unicode/uenum.h"
-
-/**    
- * \file
- * \brief  C API: Locale 
- *
- * <h2> ULoc C API for Locale </h2>
- * A <code>Locale</code> represents a specific geographical, political,
- * or cultural region. An operation that requires a <code>Locale</code> to perform
- * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
- * to tailor information for the user. For example, displaying a number
- * is a locale-sensitive operation--the number should be formatted
- * according to the customs/conventions of the user's native country,
- * region, or culture.  In the C APIs, a locales is simply a const char string.
- *
- * <P>
- * You create a <code>Locale</code> with one of the three options listed below.
- * Each of the component is separated by '_' in the locale string.
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * \code
- *       newLanguage
- * 
- *       newLanguage + newCountry
- * 
- *       newLanguage + newCountry + newVariant
- * \endcode
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * The first option is a valid <STRONG>ISO
- * Language Code.</STRONG> These codes are the lower-case two-letter
- * codes as defined by ISO-639.
- * You can find a full list of these codes at a number of sites, such as:
- * <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
- * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
- *
- * <P>
- * The second option includes an additonal <STRONG>ISO Country
- * Code.</STRONG> These codes are the upper-case two-letter codes
- * as defined by ISO-3166.
- * You can find a full list of these codes at a number of sites, such as:
- * <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
- * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
- *
- * <P>
- * The third option requires another additonal information--the 
- * <STRONG>Variant.</STRONG>
- * The Variant codes are vendor and browser-specific.
- * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
- * Where there are two variants, separate them with an underscore, and
- * put the most important one first. For
- * example, a Traditional Spanish collation might be referenced, with
- * "ES", "ES", "Traditional_WIN".
- *
- * <P>
- * Because a <code>Locale</code> is just an identifier for a region,
- * no validity check is performed when you specify a <code>Locale</code>.
- * If you want to see whether particular resources are available for the
- * <code>Locale</code> you asked for, you must query those resources. For
- * example, ask the <code>UNumberFormat</code> for the locales it supports
- * using its <code>getAvailable</code> method.
- * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
- * locale, you get back the best available match, not necessarily
- * precisely what you asked for. For more information, look at
- * <code>UResourceBundle</code>.
- *
- * <P>
- * The <code>Locale</code> provides a number of convenient constants
- * that you can use to specify the commonly used
- * locales. For example, the following refers to a locale
- * for the United States:
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * \code
- *       ULOC_US
- * \endcode
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- *
- * <P>
- * Once you've specified a locale you can query it for information about
- * itself. Use <code>uloc_getCountry</code> to get the ISO Country Code and
- * <code>uloc_getLanguage</code> to get the ISO Language Code. You can
- * use <code>uloc_getDisplayCountry</code> to get the
- * name of the country suitable for displaying to the user. Similarly,
- * you can use <code>uloc_getDisplayLanguage</code> to get the name of
- * the language suitable for displaying to the user. Interestingly,
- * the <code>uloc_getDisplayXXX</code> methods are themselves locale-sensitive
- * and have two versions: one that uses the default locale and one
- * that takes a locale as an argument and displays the name or country in
- * a language appropriate to that locale.
- *
- * <P>
- * The ICU provides a number of services that perform locale-sensitive
- * operations. For example, the <code>unum_xxx</code> functions format
- * numbers, currency, or percentages in a locale-sensitive manner. 
- * </P>
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * \code
- *     UErrorCode success = U_ZERO_ERROR;
- *     UNumberFormat *nf;
- *     const char* myLocale = "fr_FR";
- * 
- *     nf = unum_open( UNUM_DEFAULT, NULL, success );          
- *     unum_close(nf);
- *     nf = unum_open( UNUM_CURRENCY, NULL, success );
- *     unum_close(nf);
- *     nf = unum_open( UNUM_PERCENT, NULL, success );   
- *     unum_close(nf);
- * \endcode
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * Each of these methods has two variants; one with an explicit locale
- * and one without; the latter using the default locale.
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * \code 
- * 
- *     nf = unum_open( UNUM_DEFAULT, myLocale, success );          
- *     unum_close(nf);
- *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
- *     unum_close(nf);
- *     nf = unum_open( UNUM_PERCENT, myLocale, success );   
- *     unum_close(nf);
- * \endcode
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * A <code>Locale</code> is the mechanism for identifying the kind of services
- * (<code>UNumberFormat</code>) that you would like to get. The locale is
- * <STRONG>just</STRONG> a mechanism for identifying these services.
- *
- * <P>
- * Each international serivce that performs locale-sensitive operations 
- * allows you
- * to get all the available objects of that type. You can sift
- * through these objects by language, country, or variant,
- * and use the display names to present a menu to the user.
- * For example, you can create a menu of all the collation objects
- * suitable for a given language. Such classes implement these
- * three class methods:
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * \code
- *       const char* uloc_getAvailable(int32_t index);
- *       int32_t uloc_countAvailable();
- *       int32_t
- *       uloc_getDisplayName(const char* localeID,
- *                 const char* inLocaleID, 
- *                 UChar* result,
- *                 int32_t maxResultSize,
- *                  UErrorCode* err);
- * 
- * \endcode
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * <P>
- * Concerning POSIX/RFC1766 Locale IDs, 
- *  the getLanguage/getCountry/getVariant/getName functions do understand
- * the POSIX type form of  language_COUNTRY.ENCODING\@VARIANT
- * and if there is not an ICU-stype variant, uloc_getVariant() for example
- * will return the one listed after the \@at sign. As well, the hyphen
- * "-" is recognized as a country/variant separator similarly to RFC1766.
- * So for example, "en-us" will be interpreted as en_US.  
- * As a result, uloc_getName() is far from a no-op, and will have the
- * effect of converting POSIX/RFC1766 IDs into ICU form, although it does
- * NOT map any of the actual codes (i.e. russian->ru) in any way.
- * Applications should call uloc_getName() at the point where a locale ID
- * is coming from an external source (user entry, OS, web browser)
- * and pass the resulting string to other ICU functions.  For example,
- * don't use de-de\@EURO as an argument to resourcebundle.
- *
- * @see UResourceBundle
- */
-
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_CHINESE            "zh"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_ENGLISH            "en"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_FRENCH             "fr"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_GERMAN             "de"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_ITALIAN            "it"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_JAPANESE           "ja"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_KOREAN             "ko"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_SIMPLIFIED_CHINESE "zh_CN"
-/** Useful constant for this language. @stable ICU 2.0 */
-#define ULOC_TRADITIONAL_CHINESE "zh_TW"
-
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_CANADA         "en_CA"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_CANADA_FRENCH  "fr_CA"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_CHINA          "zh_CN"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_PRC            "zh_CN"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_FRANCE         "fr_FR"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_GERMANY        "de_DE"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_ITALY          "it_IT"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_JAPAN          "ja_JP"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_KOREA          "ko_KR"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_TAIWAN         "zh_TW"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_UK             "en_GB"
-/** Useful constant for this country/region. @stable ICU 2.0 */
-#define ULOC_US             "en_US"
-
-/**
- * Useful constant for the maximum size of the language part of a locale ID.
- * (including the terminating NULL).
- * @stable ICU 2.0
- */
-#define ULOC_LANG_CAPACITY 12
-
-/**
- * Useful constant for the maximum size of the country part of a locale ID
- * (including the terminating NULL).
- * @stable ICU 2.0
- */
-#define ULOC_COUNTRY_CAPACITY 4
-/**
- * Useful constant for the maximum size of the whole locale ID
- * (including the terminating NULL and all keywords).
- * @stable ICU 2.0
- */
-#define ULOC_FULLNAME_CAPACITY 157
-
-/**
- * Useful constant for the maximum size of the script part of a locale ID
- * (including the terminating NULL).
- * @stable ICU 2.8
- */
-#define ULOC_SCRIPT_CAPACITY 6
-
-/**
- * Useful constant for the maximum size of keywords in a locale
- * @stable ICU 2.8
- */
-#define ULOC_KEYWORDS_CAPACITY 50
-
-/**
- * Useful constant for the maximum total size of keywords and their values in a locale
- * @stable ICU 2.8
- */
-#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
-
-/**
- * Invariant character separating keywords from the locale string
- * @stable ICU 2.8
- */
-#define ULOC_KEYWORD_SEPARATOR '@'
-
-/**
-  * Unicode code point for '@' separating keywords from the locale string.
-  * @see ULOC_KEYWORD_SEPARATOR
-  * @draft ICU 4.6
-  */
-#define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
-
-/**
- * Invariant character for assigning value to a keyword
- * @stable ICU 2.8
- */
-#define ULOC_KEYWORD_ASSIGN '='
-
-/**
-  * Unicode code point for '=' for assigning value to a keyword.
-  * @see ULOC_KEYWORD_ASSIGN
-  * @draft ICU 4.6 
-  */
-#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
-
-/**
- * Invariant character separating keywords
- * @stable ICU 2.8
- */
-#define ULOC_KEYWORD_ITEM_SEPARATOR ';'
-
-/**
-  * Unicode code point for ';' separating keywords
-  * @see ULOC_KEYWORD_ITEM_SEPARATOR
-  * @draft ICU 4.6
-  */
-#define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
-
-/**
- * Constants for *_getLocale()
- * Allow user to select whether she wants information on 
- * requested, valid or actual locale.
- * For example, a collator for "en_US_CALIFORNIA" was
- * requested. In the current state of ICU (2.0), 
- * the requested locale is "en_US_CALIFORNIA",
- * the valid locale is "en_US" (most specific locale supported by ICU)
- * and the actual locale is "root" (the collation data comes unmodified 
- * from the UCA)
- * The locale is considered supported by ICU if there is a core ICU bundle 
- * for that locale (although it may be empty).
- * @stable ICU 2.1
- */
-typedef enum {
-  /** This is locale the data actually comes from 
-   * @stable ICU 2.1
-   */
-  ULOC_ACTUAL_LOCALE    = 0,
-  /** This is the most specific locale supported by ICU 
-   * @stable ICU 2.1
-   */
-  ULOC_VALID_LOCALE    = 1,
-
-#ifndef U_HIDE_DEPRECATED_API
-  /** This is the requested locale
-   *  @deprecated ICU 2.8 
-   */
-  ULOC_REQUESTED_LOCALE = 2,
-#endif /* U_HIDE_DEPRECATED_API */
-
-  ULOC_DATA_LOCALE_TYPE_LIMIT = 3
-} ULocDataLocaleType ;
-
-
-/**
- * Gets ICU's default locale.  
- * The returned string is a snapshot in time, and will remain valid
- *   and unchanged even when uloc_setDefault() is called.
- *   The returned storage is owned by ICU, and must not be altered or deleted
- *   by the caller.
- *  
- * @return the ICU default locale
- * @system
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2
-uloc_getDefault(void);
-
-/**
- * Sets ICU's default locale.  
- *    By default (without calling this function), ICU's default locale will be based
- *    on information obtained from the underlying system environment.
- *    <p>
- *    Changes to ICU's default locale do not propagate back to the
- *    system environment.
- *    <p>
- *    Changes to ICU's default locale to not affect any ICU services that
- *    may already be open based on the previous default locale value.
- *
- * @param localeID the new ICU default locale. A value of NULL will try to get
- *                 the system's default locale.
- * @param status the error information if the setting of default locale fails
- * @system
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-uloc_setDefault(const char* localeID,
-        UErrorCode*       status);
-
-/**
- * Gets the language code for the specified locale.
- *
- * @param localeID the locale to get the ISO language code with
- * @param language the language code for localeID
- * @param languageCapacity the size of the language buffer to store the  
- * language code with
- * @param err error information if retrieving the language code failed
- * @return the actual buffer size needed for the language code.  If it's greater 
- * than languageCapacity, the returned language code will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getLanguage(const char*    localeID,
-         char* language,
-         int32_t languageCapacity,
-         UErrorCode* err);
-
-/**
- * Gets the script code for the specified locale.
- *
- * @param localeID the locale to get the ISO language code with
- * @param script the language code for localeID
- * @param scriptCapacity the size of the language buffer to store the  
- * language code with
- * @param err error information if retrieving the language code failed
- * @return the actual buffer size needed for the language code.  If it's greater 
- * than scriptCapacity, the returned language code will be truncated.  
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getScript(const char*    localeID,
-         char* script,
-         int32_t scriptCapacity,
-         UErrorCode* err);
-
-/**
- * Gets the  country code for the specified locale.
- *
- * @param localeID the locale to get the country code with
- * @param country the country code for localeID
- * @param countryCapacity the size of the country buffer to store the  
- * country code with
- * @param err error information if retrieving the country code failed
- * @return the actual buffer size needed for the country code.  If it's greater 
- * than countryCapacity, the returned country code will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getCountry(const char*    localeID,
-        char* country,
-        int32_t countryCapacity,
-        UErrorCode* err);
-
-/**
- * Gets the variant code for the specified locale.
- *
- * @param localeID the locale to get the variant code with
- * @param variant the variant code for localeID
- * @param variantCapacity the size of the variant buffer to store the 
- * variant code with
- * @param err error information if retrieving the variant code failed
- * @return the actual buffer size needed for the variant code.  If it's greater 
- * than variantCapacity, the returned variant code will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getVariant(const char*    localeID,
-        char* variant,
-        int32_t variantCapacity,
-        UErrorCode* err);
-
-
-/**
- * Gets the full name for the specified locale.
- * Note: This has the effect of 'canonicalizing' the ICU locale ID to
- * a certain extent. Upper and lower case are set as needed.
- * It does NOT map aliased names in any way.
- * See the top of this header file.
- * This API supports preflighting.
- *
- * @param localeID the locale to get the full name with
- * @param name fill in buffer for the name without keywords.
- * @param nameCapacity capacity of the fill in buffer.
- * @param err error information if retrieving the full name failed
- * @return the actual buffer size needed for the full name.  If it's greater 
- * than nameCapacity, the returned full name will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getName(const char*    localeID,
-         char* name,
-         int32_t nameCapacity,
-         UErrorCode* err);
-
-/**
- * Gets the full name for the specified locale.
- * Note: This has the effect of 'canonicalizing' the string to
- * a certain extent. Upper and lower case are set as needed,
- * and if the components were in 'POSIX' format they are changed to
- * ICU format.  It does NOT map aliased names in any way.
- * See the top of this header file.
- *
- * @param localeID the locale to get the full name with
- * @param name the full name for localeID
- * @param nameCapacity the size of the name buffer to store the 
- * full name with
- * @param err error information if retrieving the full name failed
- * @return the actual buffer size needed for the full name.  If it's greater 
- * than nameCapacity, the returned full name will be truncated.  
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_canonicalize(const char*    localeID,
-         char* name,
-         int32_t nameCapacity,
-         UErrorCode* err);
-
-/**
- * Gets the ISO language code for the specified locale.
- *
- * @param localeID the locale to get the ISO language code with
- * @return language the ISO language code for localeID
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2
-uloc_getISO3Language(const char* localeID);
-
-
-/**
- * Gets the ISO country code for the specified locale.
- *
- * @param localeID the locale to get the ISO country code with
- * @return country the ISO country code for localeID
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2
-uloc_getISO3Country(const char* localeID);
-
-/**
- * Gets the Win32 LCID value for the specified locale.
- * If the ICU locale is not recognized by Windows, 0 will be returned.
- *
- * @param localeID the locale to get the Win32 LCID value with
- * @return country the Win32 LCID for localeID
- * @stable ICU 2.0
- */
-U_STABLE uint32_t U_EXPORT2
-uloc_getLCID(const char* localeID);
-
-/**
- * Gets the language name suitable for display for the specified locale.
- *
- * @param locale the locale to get the ISO language code with
- * @param displayLocale Specifies the locale to be used to display the name.  In other words,
- *                 if the locale's language code is "en", passing Locale::getFrench() for
- *                 inLocale would result in "Anglais", while passing Locale::getGerman()
- *                 for inLocale would result in "Englisch".
- * @param language the displayable language code for localeID
- * @param languageCapacity the size of the language buffer to store the  
- * displayable language code with
- * @param status error information if retrieving the displayable language code failed
- * @return the actual buffer size needed for the displayable language code.  If it's greater 
- * than languageCapacity, the returned language code will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayLanguage(const char* locale,
-            const char* displayLocale,
-            UChar* language,
-            int32_t languageCapacity,
-            UErrorCode* status);
-
-/**
- * Gets the script name suitable for display for the specified locale.
- *
- * @param locale the locale to get the displayable script code with. NULL may be used to specify the default.
- * @param displayLocale Specifies the locale to be used to display the name.  In other words,
- *                 if the locale's language code is "en", passing Locale::getFrench() for
- *                 inLocale would result in "", while passing Locale::getGerman()
- *                 for inLocale would result in "". NULL may be used to specify the default.
- * @param script the displayable country code for localeID
- * @param scriptCapacity the size of the script buffer to store the  
- * displayable script code with
- * @param status error information if retrieving the displayable script code failed
- * @return the actual buffer size needed for the displayable script code.  If it's greater 
- * than scriptCapacity, the returned displayable script code will be truncated.  
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayScript(const char* locale,
-            const char* displayLocale,
-            UChar* script,
-            int32_t scriptCapacity,
-            UErrorCode* status);
-
-/**
- * Gets the country name suitable for display for the specified locale.
- *
- * @param locale the locale to get the displayable country code with. NULL may be used to specify the default.
- * @param displayLocale Specifies the locale to be used to display the name.  In other words,
- *                 if the locale's language code is "en", passing Locale::getFrench() for
- *                 inLocale would result in "Anglais", while passing Locale::getGerman()
- *                 for inLocale would result in "Englisch". NULL may be used to specify the default.
- * @param country the displayable country code for localeID
- * @param countryCapacity the size of the country buffer to store the  
- * displayable country code with
- * @param status error information if retrieving the displayable country code failed
- * @return the actual buffer size needed for the displayable country code.  If it's greater 
- * than countryCapacity, the returned displayable country code will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayCountry(const char* locale,
-                       const char* displayLocale,
-                       UChar* country,
-                       int32_t countryCapacity,
-                       UErrorCode* status);
-
-
-/**
- * Gets the variant name suitable for display for the specified locale.
- *
- * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default.
- * @param displayLocale Specifies the locale to be used to display the name.  In other words,
- *                 if the locale's language code is "en", passing Locale::getFrench() for
- *                 inLocale would result in "Anglais", while passing Locale::getGerman()
- *                 for inLocale would result in "Englisch". NULL may be used to specify the default.
- * @param variant the displayable variant code for localeID
- * @param variantCapacity the size of the variant buffer to store the 
- * displayable variant code with
- * @param status error information if retrieving the displayable variant code failed
- * @return the actual buffer size needed for the displayable variant code.  If it's greater 
- * than variantCapacity, the returned displayable variant code will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayVariant(const char* locale,
-                       const char* displayLocale,
-                       UChar* variant,
-                       int32_t variantCapacity,
-                       UErrorCode* status);
-
-/**
- * Gets the keyword name suitable for display for the specified locale.
- * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display 
- * string for the keyword collation. 
- * Usage:
- * <code>
- *    UErrorCode status = U_ZERO_ERROR;
- *    const char* keyword =NULL;
- *    int32_t keywordLen = 0;
- *    int32_t keywordCount = 0;
- *    UChar displayKeyword[256];
- *    int32_t displayKeywordLen = 0;
- *    UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status);
- *    for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){
- *          if(U_FAILURE(status)){
- *              ...something went wrong so handle the error...
- *              break;
- *          }
- *          // the uenum_next returns NUL terminated string
- *          keyword = uenum_next(keywordEnum, &keywordLen, &status);
- *          displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256);
- *          ... do something interesting .....
- *    }
- *    uenum_close(keywordEnum);
- * </code>
- * @param keyword           The keyword whose display string needs to be returned.
- * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
- *                          if the locale's language code is "en", passing Locale::getFrench() for
- *                          inLocale would result in "Anglais", while passing Locale::getGerman()
- *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
- * @param dest              the buffer to which the displayable keyword should be written.
- * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
- *                          dest may be NULL and the function will only return the length of the 
- *                          result without writing any of the result string (pre-flighting).
- * @param status            error information if retrieving the displayable string failed. 
- *                          Should not be NULL and should not indicate failure on entry.
- * @return the actual buffer size needed for the displayable variant code.  
- * @see #uloc_openKeywords
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayKeyword(const char* keyword,
-                       const char* displayLocale,
-                       UChar* dest,
-                       int32_t destCapacity,
-                       UErrorCode* status);
-/**
- * Gets the value of the keyword suitable for display for the specified locale.
- * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display 
- * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
- *
- * @param locale            The locale to get the displayable variant code with. NULL may be used to specify the default.
- * @param keyword           The keyword for whose value should be used.
- * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
- *                          if the locale's language code is "en", passing Locale::getFrench() for
- *                          inLocale would result in "Anglais", while passing Locale::getGerman()
- *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
- * @param dest              the buffer to which the displayable keyword should be written.
- * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
- *                          dest may be NULL and the function will only return the length of the 
- *                          result without writing any of the result string (pre-flighting).
- * @param status            error information if retrieving the displayable string failed. 
- *                          Should not be NULL and must not indicate failure on entry.
- * @return the actual buffer size needed for the displayable variant code.  
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayKeywordValue(   const char* locale,
-                               const char* keyword,
-                               const char* displayLocale,
-                               UChar* dest,
-                               int32_t destCapacity,
-                               UErrorCode* status);
-/**
- * Gets the full name suitable for display for the specified locale.
- *
- * @param localeID the locale to get the displayable name with. NULL may be used to specify the default.
- * @param inLocaleID Specifies the locale to be used to display the name.  In other words,
- *                   if the locale's language code is "en", passing Locale::getFrench() for
- *                   inLocale would result in "Anglais", while passing Locale::getGerman()
- *                   for inLocale would result in "Englisch". NULL may be used to specify the default.
- * @param result the displayable name for localeID
- * @param maxResultSize the size of the name buffer to store the 
- * displayable full name with
- * @param err error information if retrieving the displayable name failed
- * @return the actual buffer size needed for the displayable name.  If it's greater 
- * than maxResultSize, the returned displayable name will be truncated.  
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getDisplayName(const char* localeID,
-            const char* inLocaleID,
-            UChar* result,
-            int32_t maxResultSize,
-            UErrorCode* err);
-
-
-/**
- * Gets the specified locale from a list of all available locales.  
- * The return value is a pointer to an item of 
- * a locale name array.  Both this array and the pointers
- * it contains are owned by ICU and should not be deleted or written through
- * by the caller.  The locale name is terminated by a null pointer.
- * @param n the specific locale name index of the available locale list
- * @return a specified locale name of all available locales
- * @stable ICU 2.0
- */
-U_STABLE const char* U_EXPORT2
-uloc_getAvailable(int32_t n);
-
-/**
- * Gets the size of the all available locale list.
- *
- * @return the size of the locale list
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
-
-/**
- *
- * Gets a list of all available language codes defined in ISO 639.  This is a pointer
- * to an array of pointers to arrays of char.  All of these pointers are owned
- * by ICU-- do not delete them, and do not write through them.  The array is
- * terminated with a null pointer.
- * @return a list of all available language codes
- * @stable ICU 2.0
- */
-U_STABLE const char* const* U_EXPORT2
-uloc_getISOLanguages(void);
-
-/**
- *
- * Gets a list of all available 2-letter country codes defined in ISO 639.  This is a
- * pointer to an array of pointers to arrays of char.  All of these pointers are
- * owned by ICU-- do not delete them, and do not write through them.  The array is
- * terminated with a null pointer.
- * @return a list of all available country codes
- * @stable ICU 2.0
- */
-U_STABLE const char* const* U_EXPORT2
-uloc_getISOCountries(void);
-
-/**
- * Truncate the locale ID string to get the parent locale ID.
- * Copies the part of the string before the last underscore.
- * The parent locale ID will be an empty string if there is no
- * underscore, or if there is only one underscore at localeID[0].
- *
- * @param localeID Input locale ID string.
- * @param parent   Output string buffer for the parent locale ID.
- * @param parentCapacity Size of the output buffer.
- * @param err A UErrorCode value.
- * @return The length of the parent locale ID.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getParent(const char*    localeID,
-                 char* parent,
-                 int32_t parentCapacity,
-                 UErrorCode* err);
-
-
-
-
-/**
- * Gets the full name for the specified locale.
- * Note: This has the effect of 'canonicalizing' the string to
- * a certain extent. Upper and lower case are set as needed,
- * and if the components were in 'POSIX' format they are changed to
- * ICU format.  It does NOT map aliased names in any way.
- * See the top of this header file.
- * This API strips off the keyword part, so "de_DE\@collation=phonebook" 
- * will become "de_DE". 
- * This API supports preflighting.
- *
- * @param localeID the locale to get the full name with
- * @param name fill in buffer for the name without keywords.
- * @param nameCapacity capacity of the fill in buffer.
- * @param err error information if retrieving the full name failed
- * @return the actual buffer size needed for the full name.  If it's greater 
- * than nameCapacity, the returned full name will be truncated.  
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getBaseName(const char*    localeID,
-         char* name,
-         int32_t nameCapacity,
-         UErrorCode* err);
-
-/**
- * Gets an enumeration of keywords for the specified locale. Enumeration
- * must get disposed of by the client using uenum_close function.
- *
- * @param localeID the locale to get the variant code with
- * @param status error information if retrieving the keywords failed
- * @return enumeration of keywords or NULL if there are no keywords.
- * @stable ICU 2.8
- */
-U_STABLE UEnumeration* U_EXPORT2
-uloc_openKeywords(const char* localeID,
-                        UErrorCode* status);
-
-/**
- * Get the value for a keyword. Locale name does not need to be normalized.
- * 
- * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
- * @param keywordName name of the keyword for which we want the value. Case insensitive.
- * @param buffer receiving buffer
- * @param bufferCapacity capacity of receiving buffer
- * @param status containing error code - buffer not big enough.
- * @return the length of keyword value
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getKeywordValue(const char* localeID,
-                     const char* keywordName,
-                     char* buffer, int32_t bufferCapacity,
-                     UErrorCode* status);
-
-
-/**
- * Set the value of the specified keyword.
- * NOTE: Unlike almost every other ICU function which takes a
- * buffer, this function will NOT truncate the output text. If a
- * BUFFER_OVERFLOW_ERROR is received, it means that the original
- * buffer is untouched. This is done to prevent incorrect or possibly
- * even malformed locales from being generated and used.
- * 
- * @param keywordName name of the keyword to be set. Case insensitive.
- * @param keywordValue value of the keyword to be set. If 0-length or
- *  NULL, will result in the keyword being removed. No error is given if 
- *  that keyword does not exist.
- * @param buffer input buffer containing locale to be modified.
- * @param bufferCapacity capacity of receiving buffer
- * @param status containing error code - buffer not big enough.
- * @return the length needed for the buffer
- * @see uloc_getKeywordValue
- * @stable ICU 3.2
- */
-U_STABLE int32_t U_EXPORT2
-uloc_setKeywordValue(const char* keywordName,
-                     const char* keywordValue,
-                     char* buffer, int32_t bufferCapacity,
-                     UErrorCode* status);
-
-/**
- * enums for the  return value for the character and line orientation
- * functions.
- * @stable ICU 4.0
- */
-typedef enum {
-  ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
-  ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
-  ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
-  ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
-  ULOC_LAYOUT_UNKNOWN
-} ULayoutType;
-
-/**
- * Get the layout character orientation for the specified locale.
- * 
- * @param localeId locale name
- * @param status Error status
- * @return an enum indicating the layout orientation for characters.
- * @stable ICU 4.0
- */
-U_STABLE ULayoutType U_EXPORT2
-uloc_getCharacterOrientation(const char* localeId,
-                             UErrorCode *status);
-
-/**
- * Get the layout line orientation for the specified locale.
- * 
- * @param localeId locale name
- * @param status Error status
- * @return an enum indicating the layout orientation for lines.
- * @stable ICU 4.0
- */
-U_STABLE ULayoutType U_EXPORT2
-uloc_getLineOrientation(const char* localeId,
-                        UErrorCode *status);
-
-/**
- * enums for the 'outResult' parameter return value
- * @see uloc_acceptLanguageFromHTTP
- * @see uloc_acceptLanguage
- * @stable ICU 3.2
- */
-typedef enum {
-  ULOC_ACCEPT_FAILED   = 0,  /* No exact match was found. */
-  ULOC_ACCEPT_VALID    = 1,  /* An exact match was found. */
-  ULOC_ACCEPT_FALLBACK = 2   /* A fallback was found, for example, 
-                                Accept list contained 'ja_JP'
-                                which matched available locale 'ja'. */
-} UAcceptResult;
-
-
-/**
- * Based on a HTTP header from a web browser and a list of available locales,
- * determine an acceptable locale for the user.
- * @param result - buffer to accept the result locale
- * @param resultAvailable the size of the result buffer.
- * @param outResult - An out parameter that contains the fallback status
- * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
- * @param availableLocales - list of available locales to match
- * @param status Error status, may be BUFFER_OVERFLOW_ERROR
- * @return length needed for the locale.
- * @stable ICU 3.2
- */
-U_STABLE int32_t U_EXPORT2
-uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
-                            UAcceptResult *outResult,
-                            const char *httpAcceptLanguage,
-                            UEnumeration* availableLocales,
-                            UErrorCode *status);
-
-/**
- * Based on a list of available locales,
- * determine an acceptable locale for the user.
- * @param result - buffer to accept the result locale
- * @param resultAvailable the size of the result buffer.
- * @param outResult - An out parameter that contains the fallback status
- * @param acceptList - list of acceptable languages
- * @param acceptListCount - count of acceptList items
- * @param availableLocales - list of available locales to match
- * @param status Error status, may be BUFFER_OVERFLOW_ERROR
- * @return length needed for the locale.
- * @stable ICU 3.2
- */
-U_STABLE int32_t U_EXPORT2
-uloc_acceptLanguage(char *result, int32_t resultAvailable, 
-                    UAcceptResult *outResult, const char **acceptList,
-                    int32_t acceptListCount,
-                    UEnumeration* availableLocales,
-                    UErrorCode *status);
-
-
-/**
- * Gets the ICU locale ID for the specified Win32 LCID value.
- *
- * @param hostID the Win32 LCID to translate
- * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated
- *  if there is room.
- * @param localeCapacity the size of the output buffer
- * @param status an error is returned if the LCID is unrecognized or the output buffer
- *  is too small
- * @return actual the actual size of the locale ID, not including NUL-termination 
- * @stable ICU 3.8
- */
-U_STABLE int32_t U_EXPORT2
-uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
-                    UErrorCode *status);
-
-
-/**
- * Add the likely subtags for a provided locale ID, per the algorithm described
- * in the following CLDR technical report:
- *
- *   http://www.unicode.org/reports/tr35/#Likely_Subtags
- *
- * If localeID is already in the maximal form, or there is no data available
- * for maximization, it will be copied to the output buffer.  For example,
- * "und-Zzzz" cannot be maximized, since there is no reasonable maximization.
- *
- * Examples:
- *
- * "en" maximizes to "en_Latn_US"
- *
- * "de" maximizes to "de_Latn_US"
- *
- * "sr" maximizes to "sr_Cyrl_RS"
- *
- * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
- *
- * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
- *
- * @param localeID The locale to maximize
- * @param maximizedLocaleID The maximized locale
- * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer
- * @param err Error information if maximizing the locale failed.  If the length
- * of the localeID and the null-terminator is greater than the maximum allowed size,
- * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
- * @return The actual buffer size needed for the maximized locale.  If it's
- * greater than maximizedLocaleIDCapacity, the returned ID will be truncated.
- * On error, the return value is -1.
- * @stable ICU 4.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_addLikelySubtags(const char*    localeID,
-         char* maximizedLocaleID,
-         int32_t maximizedLocaleIDCapacity,
-         UErrorCode* err);
-
-
-/**
- * Minimize the subtags for a provided locale ID, per the algorithm described
- * in the following CLDR technical report:
- *
- *   http://www.unicode.org/reports/tr35/#Likely_Subtags
- *
- * If localeID is already in the minimal form, or there is no data available
- * for minimization, it will be copied to the output buffer.  Since the
- * minimization algorithm relies on proper maximization, see the comments
- * for uloc_addLikelySubtags for reasons why there might not be any data.
- *
- * Examples:
- *
- * "en_Latn_US" minimizes to "en"
- *
- * "de_Latn_US" minimizes to "de"
- *
- * "sr_Cyrl_RS" minimizes to "sr"
- *
- * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
- * script, and minimizing to "zh" would imply "zh_Hans_CN".)
- *
- * @param localeID The locale to minimize
- * @param minimizedLocaleID The minimized locale
- * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer
- * @param err Error information if minimizing the locale failed.  If the length
- * of the localeID and the null-terminator is greater than the maximum allowed size,
- * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
- * @return The actual buffer size needed for the minimized locale.  If it's
- * greater than minimizedLocaleIDCapacity, the returned ID will be truncated.
- * On error, the return value is -1.
- * @stable ICU 4.0
- */
-U_STABLE int32_t U_EXPORT2
-uloc_minimizeSubtags(const char*    localeID,
-         char* minimizedLocaleID,
-         int32_t minimizedLocaleIDCapacity,
-         UErrorCode* err);
-
-/** 
- * Returns a locale ID for the specified BCP47 language tag string.
- * If the specified language tag contains any ill-formed subtags,
- * the first such subtag and all following subtags are ignored.
- * <p> 
- * This implements the 'Language-Tag' production of BCP47, and so
- * supports grandfathered (regular and irregular) as well as private
- * use language tags.  Private use tags are represented as 'x-whatever',
- * and grandfathered tags are converted to their canonical replacements
- * where they exist.  Note that a few grandfathered tags have no modern
- * replacement, these will be converted using the fallback described in
- * the first paragraph, so some information might be lost.
- * @param langtag   the input BCP47 language tag.
- * @param localeID  the output buffer receiving a locale ID for the
- *                  specified BCP47 language tag.
- * @param localeIDCapacity  the size of the locale ID output buffer.
- * @param parsedLength  if not NULL, succsessfully parsed length
- *                      for the input language tag is set.
- * @param err       error information if receiving the locald ID
- *                  failed.
- * @return          the length of the locale ID.
- * @draft ICU 4.2
- */
-U_DRAFT int32_t U_EXPORT2
-uloc_forLanguageTag(const char* langtag,
-                    char* localeID,
-                    int32_t localeIDCapacity,
-                    int32_t* parsedLength,
-                    UErrorCode* err);
-
-/** 
- * Returns a well-formed language tag for this locale ID. 
- * <p> 
- * <b>Note</b>: When <code>strict</code> is FALSE, any locale
- * fields which do not satisfy the BCP47 syntax requirement will
- * be omitted from the result.  When <code>strict</code> is
- * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the
- * <code>err</code> if any locale fields do not satisfy the
- * BCP47 syntax requirement.
- * @param localeID  the input lcoale ID
- * @param langtag   the output buffer receiving BCP47 language
- *                  tag for the locale ID.
- * @param langtagCapacity   the size of the BCP47 language tag
- *                          output buffer.
- * @param strict    boolean value indicating if the function returns
- *                  an error for an ill-formed input locale ID.
- * @param err       error information if receiving the language
- *                  tag failed.
- * @return          The length of the BCP47 language tag.
- * @draft ICU 4.2
- */
-U_DRAFT int32_t U_EXPORT2
-uloc_toLanguageTag(const char* localeID,
-                   char* langtag,
-                   int32_t langtagCapacity,
-                   UBool strict,
-                   UErrorCode* err);
-
-#endif /*_ULOC*/
diff --git a/Source/core/icu/unicode/umachine.h b/Source/core/icu/unicode/umachine.h
deleted file mode 100644
index abbdcb7..0000000
--- a/Source/core/icu/unicode/umachine.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
-******************************************************************************
-*
-*   Copyright (C) 1999-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-******************************************************************************
-*   file name:  umachine.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999sep13
-*   created by: Markus W. Scherer
-*
-*   This file defines basic types and constants for utf.h to be
-*   platform-independent. umachine.h and utf.h are included into
-*   utypes.h to provide all the general definitions for ICU.
-*   All of these definitions used to be in utypes.h before
-*   the UTF-handling macros made this unmaintainable.
-*/
-
-#ifndef __UMACHINE_H__
-#define __UMACHINE_H__
-
-
-/**
- * \file
- * \brief Basic types and constants for UTF
- *
- * <h2> Basic types and constants for UTF </h2>
- *   This file defines basic types and constants for utf.h to be
- *   platform-independent. umachine.h and utf.h are included into
- *   utypes.h to provide all the general definitions for ICU.
- *   All of these definitions used to be in utypes.h before
- *   the UTF-handling macros made this unmaintainable.
- *
- */
-/*==========================================================================*/
-/* Include platform-dependent definitions                                   */
-/* which are contained in the platform-specific file platform.h             */
-/*==========================================================================*/
-
-#if defined(U_PALMOS)
-#   include "unicode/ppalmos.h"
-#elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64))
-#ifdef CYGWINMSVC
-#   include "unicode/platform.h"
-#endif
-#   include "unicode/pwin32.h"
-#else
-#   include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
-#endif
-
-/*
- * ANSI C headers:
- * stddef.h defines wchar_t
- */
-#include <stddef.h>
-
-/*==========================================================================*/
-/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when     */
-/* using C++.  It should not be defined when compiling under C.             */
-/*==========================================================================*/
-
-#ifdef __cplusplus
-#   ifndef XP_CPLUSPLUS
-#       define XP_CPLUSPLUS
-#   endif
-#else
-#   undef XP_CPLUSPLUS
-#endif
-
-/*==========================================================================*/
-/* For C wrappers, we use the symbol U_STABLE.                                */
-/* This works properly if the includer is C or C++.                         */
-/* Functions are declared   U_STABLE return-type U_EXPORT2 function-name()... */
-/*==========================================================================*/
-
-/**
- * \def U_CFUNC
- * This is used in a declaration of a library private ICU C function.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_CDECL_BEGIN
- * This is used to begin a declaration of a library private ICU C API.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_CDECL_END
- * This is used to end a declaration of a library private ICU C API
- * @stable ICU 2.4
- */
-
-#ifdef XP_CPLUSPLUS
-#   define U_CFUNC extern "C"
-#   define U_CDECL_BEGIN extern "C" {
-#   define U_CDECL_END   }
-#else
-#   define U_CFUNC extern
-#   define U_CDECL_BEGIN
-#   define U_CDECL_END
-#endif
-
-/**
- * \def U_ATTRIBUTE_DEPRECATED
- *  This is used for GCC specific attributes
- * @internal
- */
-#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
-#    define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
-/**
- * \def U_ATTRIBUTE_DEPRECATED
- * This is used for Visual C++ specific attributes 
- * @internal
- */
-#elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
-#    define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
-#else
-#    define U_ATTRIBUTE_DEPRECATED
-#endif
-/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
-#define U_CAPI U_CFUNC U_EXPORT
-/** This is used to declare a function as a stable public ICU C API*/
-#define U_STABLE U_CAPI
-/** This is used to declare a function as a draft public ICU C API  */
-#define U_DRAFT  U_CAPI
-/** This is used to declare a function as a deprecated public ICU C API  */
-#define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
-/** This is used to declare a function as an obsolete public ICU C API  */
-#define U_OBSOLETE U_CAPI
-/** This is used to declare a function as an internal ICU C API  */
-#define U_INTERNAL U_CAPI
-
-/*==========================================================================*/
-/* limits for int32_t etc., like in POSIX inttypes.h                        */
-/*==========================================================================*/
-
-#ifndef INT8_MIN
-/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
-#   define INT8_MIN        ((int8_t)(-128))
-#endif
-#ifndef INT16_MIN
-/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
-#   define INT16_MIN       ((int16_t)(-32767-1))
-#endif
-#ifndef INT32_MIN
-/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
-#   define INT32_MIN       ((int32_t)(-2147483647-1))
-#endif
-
-#ifndef INT8_MAX
-/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
-#   define INT8_MAX        ((int8_t)(127))
-#endif
-#ifndef INT16_MAX
-/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
-#   define INT16_MAX       ((int16_t)(32767))
-#endif
-#ifndef INT32_MAX
-/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
-#   define INT32_MAX       ((int32_t)(2147483647))
-#endif
-
-#ifndef UINT8_MAX
-/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
-#   define UINT8_MAX       ((uint8_t)(255U))
-#endif
-#ifndef UINT16_MAX
-/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
-#   define UINT16_MAX      ((uint16_t)(65535U))
-#endif
-#ifndef UINT32_MAX
-/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
-#   define UINT32_MAX      ((uint32_t)(4294967295U))
-#endif
-
-#if defined(U_INT64_T_UNAVAILABLE)
-# error int64_t is required for decimal format and rule-based number format.
-#else
-# ifndef INT64_C
-/**
- * Provides a platform independent way to specify a signed 64-bit integer constant.
- * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
- * @stable ICU 2.8
- */
-#   define INT64_C(c) c ## LL
-# endif
-# ifndef UINT64_C
-/**
- * Provides a platform independent way to specify an unsigned 64-bit integer constant.
- * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
- * @stable ICU 2.8
- */
-#   define UINT64_C(c) c ## ULL
-# endif
-# ifndef U_INT64_MIN
-/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
-#     define U_INT64_MIN       ((int64_t)(INT64_C(-9223372036854775807)-1))
-# endif
-# ifndef U_INT64_MAX
-/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
-#     define U_INT64_MAX       ((int64_t)(INT64_C(9223372036854775807)))
-# endif
-# ifndef U_UINT64_MAX
-/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
-#     define U_UINT64_MAX      ((uint64_t)(UINT64_C(18446744073709551615)))
-# endif
-#endif
-
-/*==========================================================================*/
-/* Boolean data type                                                        */
-/*==========================================================================*/
-
-/** The ICU boolean type @stable ICU 2.0 */
-typedef int8_t UBool;
-
-#ifndef TRUE
-/** The TRUE value of a UBool @stable ICU 2.0 */
-#   define TRUE  1
-#endif
-#ifndef FALSE
-/** The FALSE value of a UBool @stable ICU 2.0 */
-#   define FALSE 0
-#endif
-
-
-/*==========================================================================*/
-/* Unicode data types                                                       */
-/*==========================================================================*/
-
-/* wchar_t-related definitions -------------------------------------------- */
-
-/**
- * \def U_HAVE_WCHAR_H
- * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
- *
- * @stable ICU 2.0
- */
-#ifndef U_HAVE_WCHAR_H
-#   define U_HAVE_WCHAR_H 1
-#endif
-
-/**
- * \def U_SIZEOF_WCHAR_T
- * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it)
- *
- * @stable ICU 2.0
- */
-#if U_SIZEOF_WCHAR_T==0
-#   undef U_SIZEOF_WCHAR_T
-#   define U_SIZEOF_WCHAR_T 4
-#endif
-
-/*
- * \def U_WCHAR_IS_UTF16
- * Defined if wchar_t uses UTF-16.
- *
- * @stable ICU 2.0
- */
-/*
- * \def U_WCHAR_IS_UTF32
- * Defined if wchar_t uses UTF-32.
- *
- * @stable ICU 2.0
- */
-#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
-#   ifdef __STDC_ISO_10646__
-#       if (U_SIZEOF_WCHAR_T==2)
-#           define U_WCHAR_IS_UTF16
-#       elif (U_SIZEOF_WCHAR_T==4)
-#           define  U_WCHAR_IS_UTF32
-#       endif
-#   elif defined __UCS2__
-#       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
-#           define U_WCHAR_IS_UTF16
-#       endif
-#   elif defined __UCS4__
-#       if (U_SIZEOF_WCHAR_T==4)
-#           define U_WCHAR_IS_UTF32
-#       endif
-#   elif defined(U_WINDOWS)
-#       define U_WCHAR_IS_UTF16
-#   endif
-#endif
-
-/* UChar and UChar32 definitions -------------------------------------------- */
-
-/** Number of bytes in a UChar. @stable ICU 2.0 */
-#define U_SIZEOF_UCHAR 2
-
-/**
- * \var UChar
- * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
- * If wchar_t is not 16 bits wide, then define UChar to be uint16_t or char16_t because GCC >=4.4
- * can handle UTF16 string literals.
- * This makes the definition of UChar platform-dependent
- * but allows direct string type compatibility with platforms with
- * 16-bit wchar_t types.
- *
- * @draft ICU 4.4
- */
-
-/* Define UChar to be compatible with wchar_t if possible. */
-#if U_SIZEOF_WCHAR_T==2
-    typedef wchar_t UChar;
-#elif U_GNUC_UTF16_STRING
-#if defined _GCC_
-    typedef __CHAR16_TYPE__ char16_t;
-#endif
-    typedef char16_t UChar;
-#else
-    typedef uint16_t UChar;
-#endif
-
-/**
- * Define UChar32 as a type for single Unicode code points.
- * UChar32 is a signed 32-bit integer (same as int32_t).
- *
- * The Unicode code point range is 0..0x10ffff.
- * All other values (negative or >=0x110000) are illegal as Unicode code points.
- * They may be used as sentinel values to indicate "done", "error"
- * or similar non-code point conditions.
- *
- * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
- * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
- * or else to be uint32_t.
- * That is, the definition of UChar32 was platform-dependent.
- *
- * @see U_SENTINEL
- * @stable ICU 2.4
- */
-typedef int32_t UChar32;
-
-/*==========================================================================*/
-/* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
-/*                             defined.  Definitions normally are in        */
-/*                             platform.h or the corresponding file for     */
-/*                             the OS in use.                               */
-/*==========================================================================*/
-
-#ifndef U_HIDE_INTERNAL_API
-
-/**
- * \def U_ALIGN_CODE
- * This is used to align code fragments to a specific byte boundary.
- * This is useful for getting consistent performance test results.
- * @internal
- */
-#ifndef U_ALIGN_CODE
-#   define U_ALIGN_CODE(n)
-#endif
-
-#endif /* U_HIDE_INTERNAL_API */
-
-/**
- * \def U_INLINE
- * This is used to request inlining of a function, on platforms and languages which support it.
- */
- 
-#ifndef U_INLINE
-#   ifdef XP_CPLUSPLUS
-#       define U_INLINE inline
-#   else
-#       define U_INLINE
-#   endif
-#endif
-
-#include "unicode/urename.h"
-
-#endif
diff --git a/Source/core/icu/unicode/unistr.h b/Source/core/icu/unicode/unistr.h
deleted file mode 100644
index 24d0351..0000000
--- a/Source/core/icu/unicode/unistr.h
+++ /dev/null
@@ -1,4440 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1998-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*
-* File unistr.h
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   09/25/98    stephen     Creation.
-*   11/11/98    stephen     Changed per 11/9 code review.
-*   04/20/99    stephen     Overhauled per 4/16 code review.
-*   11/18/99    aliu        Made to inherit from Replaceable.  Added method
-*                           handleReplaceBetween(); other methods unchanged.
-*   06/25/01    grhoten     Remove dependency on iostream.
-******************************************************************************
-*/
-
-#ifndef UNISTR_H
-#define UNISTR_H
-
-/**
- * \file 
- * \brief C++ API: Unicode String 
- */
-
-#include "unicode/utypes.h"
-#include "unicode/rep.h"
-#include "unicode/std_string.h"
-#include "unicode/stringpiece.h"
-#include "unicode/bytestream.h"
-
-struct UConverter;          // unicode/ucnv.h
-class  StringThreadTest;
-
-#ifndef U_COMPARE_CODE_POINT_ORDER
-/* see also ustring.h and unorm.h */
-/**
- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
- * Compare strings in code point order instead of code unit order.
- * @stable ICU 2.2
- */
-#define U_COMPARE_CODE_POINT_ORDER  0x8000
-#endif
-
-#ifndef USTRING_H
-/**
- * \ingroup ustring_ustrlen
- */
-U_STABLE int32_t U_EXPORT2
-u_strlen(const UChar *s);
-#endif
-
-U_NAMESPACE_BEGIN
-
-class Locale;               // unicode/locid.h
-class StringCharacterIterator;
-class BreakIterator;        // unicode/brkiter.h
-
-/* The <iostream> include has been moved to unicode/ustream.h */
-
-/**
- * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor
- * which constructs a Unicode string from an invariant-character char * string.
- * About invariant characters see utypes.h.
- * This constructor has no runtime dependency on conversion code and is
- * therefore recommended over ones taking a charset name string
- * (where the empty string "" indicates invariant-character conversion).
- *
- * @stable ICU 3.2
- */
-#define US_INV U_NAMESPACE_QUALIFIER UnicodeString::kInvariant
-
-/**
- * Unicode String literals in C++.
- * Dependent on the platform properties, different UnicodeString
- * constructors should be used to create a UnicodeString object from
- * a string literal.
- * The macros are defined for maximum performance.
- * They work only for strings that contain "invariant characters", i.e.,
- * only latin letters, digits, and some punctuation.
- * See utypes.h for details.
- *
- * The string parameter must be a C string literal.
- * The length of the string, not including the terminating
- * <code>NUL</code>, must be specified as a constant.
- * The U_STRING_DECL macro should be invoked exactly once for one
- * such string variable before it is used.
- * @stable ICU 2.0
- */
-#if defined(U_DECLARE_UTF16)
-#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)U_DECLARE_UTF16(cs), _length)
-#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
-#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)L ## cs, _length)
-#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
-#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)cs, _length)
-#else
-#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(cs, _length, US_INV)
-#endif
-
-/**
- * Unicode String literals in C++.
- * Dependent on the platform properties, different UnicodeString
- * constructors should be used to create a UnicodeString object from
- * a string literal.
- * The macros are defined for improved performance.
- * They work only for strings that contain "invariant characters", i.e.,
- * only latin letters, digits, and some punctuation.
- * See utypes.h for details.
- *
- * The string parameter must be a C string literal.
- * @stable ICU 2.0
- */
-#define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1)
-
-/**
- * UnicodeString is a string class that stores Unicode characters directly and provides
- * similar functionality as the Java String and StringBuffer classes.
- * It is a concrete implementation of the abstract class Replaceable (for transliteration).
- *
- * The UnicodeString class is not suitable for subclassing.
- *
- * <p>For an overview of Unicode strings in C and C++ see the
- * <a href="http://icu-project.org/userguide/strings.html">User Guide Strings chapter</a>.</p>
- *
- * <p>In ICU, a Unicode string consists of 16-bit Unicode <em>code units</em>.
- * A Unicode character may be stored with either one code unit
- * (the most common case) or with a matched pair of special code units
- * ("surrogates"). The data type for code units is UChar. 
- * For single-character handling, a Unicode character code <em>point</em> is a value
- * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.</p>
- *
- * <p>Indexes and offsets into and lengths of strings always count code units, not code points.
- * This is the same as with multi-byte char* strings in traditional string handling.
- * Operations on partial strings typically do not test for code point boundaries.
- * If necessary, the user needs to take care of such boundaries by testing for the code unit
- * values or by using functions like
- * UnicodeString::getChar32Start() and UnicodeString::getChar32Limit()
- * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h).</p>
- *
- * UnicodeString methods are more lenient with regard to input parameter values
- * than other ICU APIs. In particular:
- * - If indexes are out of bounds for a UnicodeString object
- *   (<0 or >length()) then they are "pinned" to the nearest boundary.
- * - If primitive string pointer values (e.g., const UChar * or char *)
- *   for input strings are NULL, then those input string parameters are treated
- *   as if they pointed to an empty string.
- *   However, this is <em>not</em> the case for char * parameters for charset names
- *   or other IDs.
- * - Most UnicodeString methods do not take a UErrorCode parameter because
- *   there are usually very few opportunities for failure other than a shortage
- *   of memory, error codes in low-level C++ string methods would be inconvenient,
- *   and the error code as the last parameter (ICU convention) would prevent
- *   the use of default parameter values.
- *   Instead, such methods set the UnicodeString into a "bogus" state
- *   (see isBogus()) if an error occurs.
- *
- * In string comparisons, two UnicodeString objects that are both "bogus"
- * compare equal (to be transitive and prevent endless loops in sorting),
- * and a "bogus" string compares less than any non-"bogus" one.
- *
- * Const UnicodeString methods are thread-safe. Multiple threads can use
- * const methods on the same UnicodeString object simultaneously,
- * but non-const methods must not be called concurrently (in multiple threads)
- * with any other (const or non-const) methods.
- *
- * Similarly, const UnicodeString & parameters are thread-safe.
- * One object may be passed in as such a parameter concurrently in multiple threads.
- * This includes the const UnicodeString & parameters for
- * copy construction, assignment, and cloning.
- *
- * <p>UnicodeString uses several storage methods.
- * String contents can be stored inside the UnicodeString object itself,
- * in an allocated and shared buffer, or in an outside buffer that is "aliased".
- * Most of this is done transparently, but careful aliasing in particular provides
- * significant performance improvements.
- * Also, the internal buffer is accessible via special functions.
- * For details see the
- * <a href="http://icu-project.org/userguide/strings.html">User Guide Strings chapter</a>.</p>
- *
- * @see utf.h
- * @see CharacterIterator
- * @stable ICU 2.0
- */
-class U_COMMON_API UnicodeString : public Replaceable
-{
-public:
-
-  /**
-   * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor
-   * which constructs a Unicode string from an invariant-character char * string.
-   * Use the macro US_INV instead of the full qualification for this value.
-   *
-   * @see US_INV
-   * @stable ICU 3.2
-   */
-  enum EInvariant {
-    /**
-     * @see EInvariant
-     * @stable ICU 3.2
-     */
-    kInvariant
-  };
-
-  //========================================
-  // Read-only operations
-  //========================================
-
-  /* Comparison - bitwise only - for international comparison use collation */
-
-  /**
-   * Equality operator. Performs only bitwise comparison.
-   * @param text The UnicodeString to compare to this one.
-   * @return TRUE if <TT>text</TT> contains the same characters as this one,
-   * FALSE otherwise.
-   * @stable ICU 2.0
-   */
-  inline UBool operator== (const UnicodeString& text) const;
-
-  /**
-   * Inequality operator. Performs only bitwise comparison.
-   * @param text The UnicodeString to compare to this one.
-   * @return FALSE if <TT>text</TT> contains the same characters as this one,
-   * TRUE otherwise.
-   * @stable ICU 2.0
-   */
-  inline UBool operator!= (const UnicodeString& text) const;
-
-  /**
-   * Greater than operator. Performs only bitwise comparison.
-   * @param text The UnicodeString to compare to this one.
-   * @return TRUE if the characters in this are bitwise
-   * greater than the characters in <code>text</code>, FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool operator> (const UnicodeString& text) const;
-
-  /**
-   * Less than operator. Performs only bitwise comparison.
-   * @param text The UnicodeString to compare to this one.
-   * @return TRUE if the characters in this are bitwise
-   * less than the characters in <code>text</code>, FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool operator< (const UnicodeString& text) const;
-
-  /**
-   * Greater than or equal operator. Performs only bitwise comparison.
-   * @param text The UnicodeString to compare to this one.
-   * @return TRUE if the characters in this are bitwise
-   * greater than or equal to the characters in <code>text</code>, FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool operator>= (const UnicodeString& text) const;
-
-  /**
-   * Less than or equal operator. Performs only bitwise comparison.
-   * @param text The UnicodeString to compare to this one.
-   * @return TRUE if the characters in this are bitwise
-   * less than or equal to the characters in <code>text</code>, FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool operator<= (const UnicodeString& text) const;
-
-  /**
-   * Compare the characters bitwise in this UnicodeString to
-   * the characters in <code>text</code>.
-   * @param text The UnicodeString to compare to this one.
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>text</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>text</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>text</code>.
-   * @stable ICU 2.0
-   */
-  inline int8_t compare(const UnicodeString& text) const;
-
-  /**
-   * Compare the characters bitwise in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the characters
-   * in <TT>text</TT>
-   * @param start the offset at which the compare operation begins
-   * @param length the number of characters of text to compare.
-   * @param text the other text to be compared against this string.
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>text</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>text</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>text</code>.
-   * @stable ICU 2.0
-   */
-  inline int8_t compare(int32_t start,
-         int32_t length,
-         const UnicodeString& text) const;
-
-  /**
-   * Compare the characters bitwise in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the characters
-   * in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * @param start the offset at which the compare operation begins
-   * @param length the number of characters in this to compare.
-   * @param srcText the text to be compared
-   * @param srcStart the offset into <TT>srcText</TT> to start comparison
-   * @param srcLength the number of characters in <TT>src</TT> to compare
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>srcText</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>srcText</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>srcText</code>.
-   * @stable ICU 2.0
-   */
-   inline int8_t compare(int32_t start,
-         int32_t length,
-         const UnicodeString& srcText,
-         int32_t srcStart,
-         int32_t srcLength) const;
-
-  /**
-   * Compare the characters bitwise in this UnicodeString with the first
-   * <TT>srcLength</TT> characters in <TT>srcChars</TT>.
-   * @param srcChars The characters to compare to this UnicodeString.
-   * @param srcLength the number of characters in <TT>srcChars</TT> to compare
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>srcChars</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>srcChars</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>srcChars</code>.
-   * @stable ICU 2.0
-   */
-  inline int8_t compare(const UChar *srcChars,
-         int32_t srcLength) const;
-
-  /**
-   * Compare the characters bitwise in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the first
-   * <TT>length</TT> characters in <TT>srcChars</TT>
-   * @param start the offset at which the compare operation begins
-   * @param length the number of characters to compare.
-   * @param srcChars the characters to be compared
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>srcChars</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>srcChars</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>srcChars</code>.
-   * @stable ICU 2.0
-   */
-  inline int8_t compare(int32_t start,
-         int32_t length,
-         const UChar *srcChars) const;
-
-  /**
-   * Compare the characters bitwise in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the characters
-   * in <TT>srcChars</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * @param start the offset at which the compare operation begins
-   * @param length the number of characters in this to compare
-   * @param srcChars the characters to be compared
-   * @param srcStart the offset into <TT>srcChars</TT> to start comparison
-   * @param srcLength the number of characters in <TT>srcChars</TT> to compare
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>srcChars</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>srcChars</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>srcChars</code>.
-   * @stable ICU 2.0
-   */
-  inline int8_t compare(int32_t start,
-         int32_t length,
-         const UChar *srcChars,
-         int32_t srcStart,
-         int32_t srcLength) const;
-
-  /**
-   * Compare the characters bitwise in the range
-   * [<TT>start</TT>, <TT>limit</TT>) with the characters
-   * in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcLimit</TT>).
-   * @param start the offset at which the compare operation begins
-   * @param limit the offset immediately following the compare operation
-   * @param srcText the text to be compared
-   * @param srcStart the offset into <TT>srcText</TT> to start comparison
-   * @param srcLimit the offset into <TT>srcText</TT> to limit comparison
-   * @return The result of bitwise character comparison: 0 if this
-   * contains the same characters as <code>srcText</code>, -1 if the characters in
-   * this are bitwise less than the characters in <code>srcText</code>, +1 if the
-   * characters in this are bitwise greater than the characters
-   * in <code>srcText</code>.
-   * @stable ICU 2.0
-   */
-  inline int8_t compareBetween(int32_t start,
-            int32_t limit,
-            const UnicodeString& srcText,
-            int32_t srcStart,
-            int32_t srcLimit) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param text Another string to compare this one to.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-  inline int8_t compareCodePointOrder(const UnicodeString& text) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcText Another string to compare this one to.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-  inline int8_t compareCodePointOrder(int32_t start,
-                                      int32_t length,
-                                      const UnicodeString& srcText) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcText Another string to compare this one to.
-   * @param srcStart The start offset in that string at which the compare operation begins.
-   * @param srcLength The number of code units from that string to compare.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-   inline int8_t compareCodePointOrder(int32_t start,
-                                       int32_t length,
-                                       const UnicodeString& srcText,
-                                       int32_t srcStart,
-                                       int32_t srcLength) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param srcChars A pointer to another string to compare this one to.
-   * @param srcLength The number of code units from that string to compare.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-  inline int8_t compareCodePointOrder(const UChar *srcChars,
-                                      int32_t srcLength) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcChars A pointer to another string to compare this one to.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-  inline int8_t compareCodePointOrder(int32_t start,
-                                      int32_t length,
-                                      const UChar *srcChars) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcChars A pointer to another string to compare this one to.
-   * @param srcStart The start offset in that string at which the compare operation begins.
-   * @param srcLength The number of code units from that string to compare.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-  inline int8_t compareCodePointOrder(int32_t start,
-                                      int32_t length,
-                                      const UChar *srcChars,
-                                      int32_t srcStart,
-                                      int32_t srcLength) const;
-
-  /**
-   * Compare two Unicode strings in code point order.
-   * The result may be different from the results of compare(), operator<, etc.
-   * if supplementary characters are present:
-   *
-   * In UTF-16, supplementary characters (with code points U+10000 and above) are
-   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
-   * which means that they compare as less than some other BMP characters like U+feff.
-   * This function compares Unicode strings in code point order.
-   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param limit The offset after the last code unit from this string to compare.
-   * @param srcText Another string to compare this one to.
-   * @param srcStart The start offset in that string at which the compare operation begins.
-   * @param srcLimit The offset after the last code unit from that string to compare.
-   * @return a negative/zero/positive integer corresponding to whether
-   * this string is less than/equal to/greater than the second one
-   * in code point order
-   * @stable ICU 2.0
-   */
-  inline int8_t compareCodePointOrderBetween(int32_t start,
-                                             int32_t limit,
-                                             const UnicodeString& srcText,
-                                             int32_t srcStart,
-                                             int32_t srcLimit) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compare(text.foldCase(options)).
-   *
-   * @param text Another string to compare this one to.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompare(const UnicodeString& text, uint32_t options) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)).
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcText Another string to compare this one to.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompare(int32_t start,
-         int32_t length,
-         const UnicodeString& srcText,
-         uint32_t options) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)).
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcText Another string to compare this one to.
-   * @param srcStart The start offset in that string at which the compare operation begins.
-   * @param srcLength The number of code units from that string to compare.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompare(int32_t start,
-         int32_t length,
-         const UnicodeString& srcText,
-         int32_t srcStart,
-         int32_t srcLength,
-         uint32_t options) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).
-   *
-   * @param srcChars A pointer to another string to compare this one to.
-   * @param srcLength The number of code units from that string to compare.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompare(const UChar *srcChars,
-         int32_t srcLength,
-         uint32_t options) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcChars A pointer to another string to compare this one to.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompare(int32_t start,
-         int32_t length,
-         const UChar *srcChars,
-         uint32_t options) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param length The number of code units from this string to compare.
-   * @param srcChars A pointer to another string to compare this one to.
-   * @param srcStart The start offset in that string at which the compare operation begins.
-   * @param srcLength The number of code units from that string to compare.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompare(int32_t start,
-         int32_t length,
-         const UChar *srcChars,
-         int32_t srcStart,
-         int32_t srcLength,
-         uint32_t options) const;
-
-  /**
-   * Compare two strings case-insensitively using full case folding.
-   * This is equivalent to this->foldCase(options).compareBetween(text.foldCase(options)).
-   *
-   * @param start The start offset in this string at which the compare operation begins.
-   * @param limit The offset after the last code unit from this string to compare.
-   * @param srcText Another string to compare this one to.
-   * @param srcStart The start offset in that string at which the compare operation begins.
-   * @param srcLimit The offset after the last code unit from that string to compare.
-   * @param options A bit set of options:
-   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
-   *     Comparison in code unit order with default case folding.
-   *
-   *   - U_COMPARE_CODE_POINT_ORDER
-   *     Set to choose code point order instead of code unit order
-   *     (see u_strCompare for details).
-   *
-   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   *
-   * @return A negative, zero, or positive integer indicating the comparison result.
-   * @stable ICU 2.0
-   */
-  inline int8_t caseCompareBetween(int32_t start,
-            int32_t limit,
-            const UnicodeString& srcText,
-            int32_t srcStart,
-            int32_t srcLimit,
-            uint32_t options) const;
-
-  /**
-   * Determine if this starts with the characters in <TT>text</TT>
-   * @param text The text to match.
-   * @return TRUE if this starts with the characters in <TT>text</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool startsWith(const UnicodeString& text) const;
-
-  /**
-   * Determine if this starts with the characters in <TT>srcText</TT>
-   * in the range [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * @param srcText The text to match.
-   * @param srcStart the offset into <TT>srcText</TT> to start matching
-   * @param srcLength the number of characters in <TT>srcText</TT> to match
-   * @return TRUE if this starts with the characters in <TT>text</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool startsWith(const UnicodeString& srcText,
-            int32_t srcStart,
-            int32_t srcLength) const;
-
-  /**
-   * Determine if this starts with the characters in <TT>srcChars</TT>
-   * @param srcChars The characters to match.
-   * @param srcLength the number of characters in <TT>srcChars</TT>
-   * @return TRUE if this starts with the characters in <TT>srcChars</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool startsWith(const UChar *srcChars,
-            int32_t srcLength) const;
-
-  /**
-   * Determine if this ends with the characters in <TT>srcChars</TT>
-   * in the range  [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * @param srcChars The characters to match.
-   * @param srcStart the offset into <TT>srcText</TT> to start matching
-   * @param srcLength the number of characters in <TT>srcChars</TT> to match
-   * @return TRUE if this ends with the characters in <TT>srcChars</TT>, FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool startsWith(const UChar *srcChars,
-            int32_t srcStart,
-            int32_t srcLength) const;
-
-  /**
-   * Determine if this ends with the characters in <TT>text</TT>
-   * @param text The text to match.
-   * @return TRUE if this ends with the characters in <TT>text</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool endsWith(const UnicodeString& text) const;
-
-  /**
-   * Determine if this ends with the characters in <TT>srcText</TT>
-   * in the range [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * @param srcText The text to match.
-   * @param srcStart the offset into <TT>srcText</TT> to start matching
-   * @param srcLength the number of characters in <TT>srcText</TT> to match
-   * @return TRUE if this ends with the characters in <TT>text</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool endsWith(const UnicodeString& srcText,
-          int32_t srcStart,
-          int32_t srcLength) const;
-
-  /**
-   * Determine if this ends with the characters in <TT>srcChars</TT>
-   * @param srcChars The characters to match.
-   * @param srcLength the number of characters in <TT>srcChars</TT>
-   * @return TRUE if this ends with the characters in <TT>srcChars</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool endsWith(const UChar *srcChars,
-          int32_t srcLength) const;
-
-  /**
-   * Determine if this ends with the characters in <TT>srcChars</TT>
-   * in the range  [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * @param srcChars The characters to match.
-   * @param srcStart the offset into <TT>srcText</TT> to start matching
-   * @param srcLength the number of characters in <TT>srcChars</TT> to match
-   * @return TRUE if this ends with the characters in <TT>srcChars</TT>,
-   * FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool endsWith(const UChar *srcChars,
-          int32_t srcStart,
-          int32_t srcLength) const;
-
-
-  /* Searching - bitwise only */
-
-  /**
-   * Locate in this the first occurrence of the characters in <TT>text</TT>,
-   * using bitwise comparison.
-   * @param text The text to search for.
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(const UnicodeString& text) const;
-
-  /**
-   * Locate in this the first occurrence of the characters in <TT>text</TT>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   * @param text The text to search for.
-   * @param start The offset at which searching will start.
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(const UnicodeString& text,
-              int32_t start) const;
-
-  /**
-   * Locate in this the first occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>text</TT>, using bitwise comparison.
-   * @param text The text to search for.
-   * @param start The offset at which searching will start.
-   * @param length The number of characters to search
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(const UnicodeString& text,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the first occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   *  in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
-   * using bitwise comparison.
-   * @param srcText The text to search for.
-   * @param srcStart the offset into <TT>srcText</TT> at which
-   * to start matching
-   * @param srcLength the number of characters in <TT>srcText</TT> to match
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(const UnicodeString& srcText,
-              int32_t srcStart,
-              int32_t srcLength,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the first occurrence of the characters in
-   * <TT>srcChars</TT>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   * @param srcChars The text to search for.
-   * @param srcLength the number of characters in <TT>srcChars</TT> to match
-   * @param start the offset into this at which to start matching
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(const UChar *srcChars,
-              int32_t srcLength,
-              int32_t start) const;
-
-  /**
-   * Locate in this the first occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>srcChars</TT>, using bitwise comparison.
-   * @param srcChars The text to search for.
-   * @param srcLength the number of characters in <TT>srcChars</TT>
-   * @param start The offset at which searching will start.
-   * @param length The number of characters to search
-   * @return The offset into this of the start of <TT>srcChars</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(const UChar *srcChars,
-              int32_t srcLength,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the first occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>srcChars</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
-   * using bitwise comparison.
-   * @param srcChars The text to search for.
-   * @param srcStart the offset into <TT>srcChars</TT> at which
-   * to start matching
-   * @param srcLength the number of characters in <TT>srcChars</TT> to match
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  int32_t indexOf(const UChar *srcChars,
-              int32_t srcStart,
-              int32_t srcLength,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the first occurrence of the BMP code point <code>c</code>,
-   * using bitwise comparison.
-   * @param c The code unit to search for.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(UChar c) const;
-
-  /**
-   * Locate in this the first occurrence of the code point <TT>c</TT>,
-   * using bitwise comparison.
-   *
-   * @param c The code point to search for.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(UChar32 c) const;
-
-  /**
-   * Locate in this the first occurrence of the BMP code point <code>c</code>,
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   * @param c The code unit to search for.
-   * @param start The offset at which searching will start.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(UChar c,
-              int32_t start) const;
-
-  /**
-   * Locate in this the first occurrence of the code point <TT>c</TT>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   *
-   * @param c The code point to search for.
-   * @param start The offset at which searching will start.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(UChar32 c,
-              int32_t start) const;
-
-  /**
-   * Locate in this the first occurrence of the BMP code point <code>c</code>
-   * in the range [<TT>start</TT>, <TT>start + length</TT>),
-   * using bitwise comparison.
-   * @param c The code unit to search for.
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(UChar c,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the first occurrence of the code point <TT>c</TT>
-   * in the range [<TT>start</TT>, <TT>start + length</TT>),
-   * using bitwise comparison.
-   *
-   * @param c The code point to search for.
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t indexOf(UChar32 c,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the last occurrence of the characters in <TT>text</TT>,
-   * using bitwise comparison.
-   * @param text The text to search for.
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(const UnicodeString& text) const;
-
-  /**
-   * Locate in this the last occurrence of the characters in <TT>text</TT>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   * @param text The text to search for.
-   * @param start The offset at which searching will start.
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(const UnicodeString& text,
-              int32_t start) const;
-
-  /**
-   * Locate in this the last occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>text</TT>, using bitwise comparison.
-   * @param text The text to search for.
-   * @param start The offset at which searching will start.
-   * @param length The number of characters to search
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(const UnicodeString& text,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the last occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
-   * using bitwise comparison.
-   * @param srcText The text to search for.
-   * @param srcStart the offset into <TT>srcText</TT> at which
-   * to start matching
-   * @param srcLength the number of characters in <TT>srcText</TT> to match
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(const UnicodeString& srcText,
-              int32_t srcStart,
-              int32_t srcLength,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the last occurrence of the characters in <TT>srcChars</TT>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   * @param srcChars The text to search for.
-   * @param srcLength the number of characters in <TT>srcChars</TT> to match
-   * @param start the offset into this at which to start matching
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(const UChar *srcChars,
-              int32_t srcLength,
-              int32_t start) const;
-
-  /**
-   * Locate in this the last occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>srcChars</TT>, using bitwise comparison.
-   * @param srcChars The text to search for.
-   * @param srcLength the number of characters in <TT>srcChars</TT>
-   * @param start The offset at which searching will start.
-   * @param length The number of characters to search
-   * @return The offset into this of the start of <TT>srcChars</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(const UChar *srcChars,
-              int32_t srcLength,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the last occurrence in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
-   * in <TT>srcChars</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
-   * using bitwise comparison.
-   * @param srcChars The text to search for.
-   * @param srcStart the offset into <TT>srcChars</TT> at which
-   * to start matching
-   * @param srcLength the number of characters in <TT>srcChars</TT> to match
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of the start of <TT>text</TT>,
-   * or -1 if not found.
-   * @stable ICU 2.0
-   */
-  int32_t lastIndexOf(const UChar *srcChars,
-              int32_t srcStart,
-              int32_t srcLength,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the last occurrence of the BMP code point <code>c</code>,
-   * using bitwise comparison.
-   * @param c The code unit to search for.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(UChar c) const;
-
-  /**
-   * Locate in this the last occurrence of the code point <TT>c</TT>,
-   * using bitwise comparison.
-   *
-   * @param c The code point to search for.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(UChar32 c) const;
-
-  /**
-   * Locate in this the last occurrence of the BMP code point <code>c</code>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   * @param c The code unit to search for.
-   * @param start The offset at which searching will start.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(UChar c,
-              int32_t start) const;
-
-  /**
-   * Locate in this the last occurrence of the code point <TT>c</TT>
-   * starting at offset <TT>start</TT>, using bitwise comparison.
-   *
-   * @param c The code point to search for.
-   * @param start The offset at which searching will start.
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(UChar32 c,
-              int32_t start) const;
-
-  /**
-   * Locate in this the last occurrence of the BMP code point <code>c</code>
-   * in the range [<TT>start</TT>, <TT>start + length</TT>),
-   * using bitwise comparison.
-   * @param c The code unit to search for.
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(UChar c,
-              int32_t start,
-              int32_t length) const;
-
-  /**
-   * Locate in this the last occurrence of the code point <TT>c</TT>
-   * in the range [<TT>start</TT>, <TT>start + length</TT>),
-   * using bitwise comparison.
-   *
-   * @param c The code point to search for.
-   * @param start the offset into this at which to start matching
-   * @param length the number of characters in this to search
-   * @return The offset into this of <TT>c</TT>, or -1 if not found.
-   * @stable ICU 2.0
-   */
-  inline int32_t lastIndexOf(UChar32 c,
-              int32_t start,
-              int32_t length) const;
-
-
-  /* Character access */
-
-  /**
-   * Return the code unit at offset <tt>offset</tt>.
-   * If the offset is not valid (0..length()-1) then U+ffff is returned.
-   * @param offset a valid offset into the text
-   * @return the code unit at offset <tt>offset</tt>
-   *         or 0xffff if the offset is not valid for this string
-   * @stable ICU 2.0
-   */
-  inline UChar charAt(int32_t offset) const;
-
-  /**
-   * Return the code unit at offset <tt>offset</tt>.
-   * If the offset is not valid (0..length()-1) then U+ffff is returned.
-   * @param offset a valid offset into the text
-   * @return the code unit at offset <tt>offset</tt>
-   * @stable ICU 2.0
-   */
-  inline UChar operator[] (int32_t offset) const;
-
-  /**
-   * Return the code point that contains the code unit
-   * at offset <tt>offset</tt>.
-   * If the offset is not valid (0..length()-1) then U+ffff is returned.
-   * @param offset a valid offset into the text
-   * that indicates the text offset of any of the code units
-   * that will be assembled into a code point (21-bit value) and returned
-   * @return the code point of text at <tt>offset</tt>
-   *         or 0xffff if the offset is not valid for this string
-   * @stable ICU 2.0
-   */
-  inline UChar32 char32At(int32_t offset) const;
-
-  /**
-   * Adjust a random-access offset so that
-   * it points to the beginning of a Unicode character.
-   * The offset that is passed in points to
-   * any code unit of a code point,
-   * while the returned offset will point to the first code unit
-   * of the same code point.
-   * In UTF-16, if the input offset points to a second surrogate
-   * of a surrogate pair, then the returned offset will point
-   * to the first surrogate.
-   * @param offset a valid offset into one code point of the text
-   * @return offset of the first code unit of the same code point
-   * @see U16_SET_CP_START
-   * @stable ICU 2.0
-   */
-  inline int32_t getChar32Start(int32_t offset) const;
-
-  /**
-   * Adjust a random-access offset so that
-   * it points behind a Unicode character.
-   * The offset that is passed in points behind
-   * any code unit of a code point,
-   * while the returned offset will point behind the last code unit
-   * of the same code point.
-   * In UTF-16, if the input offset points behind the first surrogate
-   * (i.e., to the second surrogate)
-   * of a surrogate pair, then the returned offset will point
-   * behind the second surrogate (i.e., to the first surrogate).
-   * @param offset a valid offset after any code unit of a code point of the text
-   * @return offset of the first code unit after the same code point
-   * @see U16_SET_CP_LIMIT
-   * @stable ICU 2.0
-   */
-  inline int32_t getChar32Limit(int32_t offset) const;
-
-  /**
-   * Move the code unit index along the string by delta code points.
-   * Interpret the input index as a code unit-based offset into the string,
-   * move the index forward or backward by delta code points, and
-   * return the resulting index.
-   * The input index should point to the first code unit of a code point,
-   * if there is more than one.
-   *
-   * Both input and output indexes are code unit-based as for all
-   * string indexes/offsets in ICU (and other libraries, like MBCS char*).
-   * If delta<0 then the index is moved backward (toward the start of the string).
-   * If delta>0 then the index is moved forward (toward the end of the string).
-   *
-   * This behaves like CharacterIterator::move32(delta, kCurrent).
-   *
-   * Behavior for out-of-bounds indexes:
-   * <code>moveIndex32</code> pins the input index to 0..length(), i.e.,
-   * if the input index<0 then it is pinned to 0;
-   * if it is index>length() then it is pinned to length().
-   * Afterwards, the index is moved by <code>delta</code> code points
-   * forward or backward,
-   * but no further backward than to 0 and no further forward than to length().
-   * The resulting index return value will be in between 0 and length(), inclusively.
-   *
-   * Examples:
-   * <pre>
-   * // s has code points 'a' U+10000 'b' U+10ffff U+2029
-   * UnicodeString s=UNICODE_STRING("a\\U00010000b\\U0010ffff\\u2029", 31).unescape();
-   *
-   * // initial index: position of U+10000
-   * int32_t index=1;
-   *
-   * // the following examples will all result in index==4, position of U+10ffff
-   *
-   * // skip 2 code points from some position in the string
-   * index=s.moveIndex32(index, 2); // skips U+10000 and 'b'
-   *
-   * // go to the 3rd code point from the start of s (0-based)
-   * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'
-   *
-   * // go to the next-to-last code point of s
-   * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
-   * </pre>
-   *
-   * @param index input code unit index
-   * @param delta (signed) code point count to move the index forward or backward
-   *        in the string
-   * @return the resulting code unit index
-   * @stable ICU 2.0
-   */
-  int32_t moveIndex32(int32_t index, int32_t delta) const;
-
-  /* Substring extraction */
-
-  /**
-   * Copy the characters in the range
-   * [<tt>start</tt>, <tt>start + length</tt>) into the array <tt>dst</tt>,
-   * beginning at <tt>dstStart</tt>.
-   * If the string aliases to <code>dst</code> itself as an external buffer,
-   * then extract() will not copy the contents.
-   *
-   * @param start offset of first character which will be copied into the array
-   * @param length the number of characters to extract
-   * @param dst array in which to copy characters.  The length of <tt>dst</tt>
-   * must be at least (<tt>dstStart + length</tt>).
-   * @param dstStart the offset in <TT>dst</TT> where the first character
-   * will be extracted
-   * @stable ICU 2.0
-   */
-  inline void extract(int32_t start,
-           int32_t length,
-           UChar *dst,
-           int32_t dstStart = 0) const;
-
-  /**
-   * Copy the contents of the string into dest.
-   * This is a convenience function that
-   * checks if there is enough space in dest,
-   * extracts the entire string if possible,
-   * and NUL-terminates dest if possible.
-   *
-   * If the string fits into dest but cannot be NUL-terminated
-   * (length()==destCapacity) then the error code is set to U_STRING_NOT_TERMINATED_WARNING.
-   * If the string itself does not fit into dest
-   * (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR.
-   *
-   * If the string aliases to <code>dest</code> itself as an external buffer,
-   * then extract() will not copy the contents.
-   *
-   * @param dest Destination string buffer.
-   * @param destCapacity Number of UChars available at dest.
-   * @param errorCode ICU error code.
-   * @return length()
-   * @stable ICU 2.0
-   */
-  int32_t
-  extract(UChar *dest, int32_t destCapacity,
-          UErrorCode &errorCode) const;
-
-  /**
-   * Copy the characters in the range
-   * [<tt>start</tt>, <tt>start + length</tt>) into the  UnicodeString
-   * <tt>target</tt>.
-   * @param start offset of first character which will be copied
-   * @param length the number of characters to extract
-   * @param target UnicodeString into which to copy characters.
-   * @return A reference to <TT>target</TT>
-   * @stable ICU 2.0
-   */
-  inline void extract(int32_t start,
-           int32_t length,
-           UnicodeString& target) const;
-
-  /**
-   * Copy the characters in the range [<tt>start</tt>, <tt>limit</tt>)
-   * into the array <tt>dst</tt>, beginning at <tt>dstStart</tt>.
-   * @param start offset of first character which will be copied into the array
-   * @param limit offset immediately following the last character to be copied
-   * @param dst array in which to copy characters.  The length of <tt>dst</tt>
-   * must be at least (<tt>dstStart + (limit - start)</tt>).
-   * @param dstStart the offset in <TT>dst</TT> where the first character
-   * will be extracted
-   * @stable ICU 2.0
-   */
-  inline void extractBetween(int32_t start,
-              int32_t limit,
-              UChar *dst,
-              int32_t dstStart = 0) const;
-
-  /**
-   * Copy the characters in the range [<tt>start</tt>, <tt>limit</tt>)
-   * into the UnicodeString <tt>target</tt>.  Replaceable API.
-   * @param start offset of first character which will be copied
-   * @param limit offset immediately following the last character to be copied
-   * @param target UnicodeString into which to copy characters.
-   * @return A reference to <TT>target</TT>
-   * @stable ICU 2.0
-   */
-  virtual void extractBetween(int32_t start,
-              int32_t limit,
-              UnicodeString& target) const;
-
-  /**
-   * Copy the characters in the range 
-   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters.
-   * All characters must be invariant (see utypes.h).
-   * Use US_INV as the last, signature-distinguishing parameter.
-   *
-   * This function does not write any more than <code>targetLength</code>
-   * characters but returns the length of the entire output string
-   * so that one can allocate a larger buffer and call the function again
-   * if necessary.
-   * The output string is NUL-terminated if possible.
-   *
-   * @param start offset of first character which will be copied
-   * @param startLength the number of characters to extract
-   * @param target the target buffer for extraction, can be NULL
-   *               if targetLength is 0
-   * @param targetCapacity the length of the target buffer
-   * @param inv Signature-distinguishing paramater, use US_INV.
-   * @return the output string length, not including the terminating NUL
-   * @stable ICU 3.2
-   */
-  int32_t extract(int32_t start,
-           int32_t startLength,
-           char *target,
-           int32_t targetCapacity,
-           enum EInvariant inv) const;
-
-#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
-
-  /**
-   * Copy the characters in the range
-   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters
-   * in the platform's default codepage.
-   * This function does not write any more than <code>targetLength</code>
-   * characters but returns the length of the entire output string
-   * so that one can allocate a larger buffer and call the function again
-   * if necessary.
-   * The output string is NUL-terminated if possible.
-   *
-   * @param start offset of first character which will be copied
-   * @param startLength the number of characters to extract
-   * @param target the target buffer for extraction
-   * @param targetLength the length of the target buffer
-   * If <TT>target</TT> is NULL, then the number of bytes required for
-   * <TT>target</TT> is returned.
-   * @return the output string length, not including the terminating NUL
-   * @stable ICU 2.0
-   */
-  int32_t extract(int32_t start,
-           int32_t startLength,
-           char *target,
-           uint32_t targetLength) const;
-
-#endif
-
-#if !UCONFIG_NO_CONVERSION
-
-  /**
-   * Copy the characters in the range
-   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters
-   * in a specified codepage.
-   * The output string is NUL-terminated.
-   *
-   * Recommendation: For invariant-character strings use
-   * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const
-   * because it avoids object code dependencies of UnicodeString on
-   * the conversion code.
-   *
-   * @param start offset of first character which will be copied
-   * @param startLength the number of characters to extract
-   * @param target the target buffer for extraction
-   * @param codepage the desired codepage for the characters.  0 has
-   * the special meaning of the default codepage
-   * If <code>codepage</code> is an empty string (<code>""</code>),
-   * then a simple conversion is performed on the codepage-invariant
-   * subset ("invariant characters") of the platform encoding. See utypes.h.
-   * If <TT>target</TT> is NULL, then the number of bytes required for
-   * <TT>target</TT> is returned. It is assumed that the target is big enough
-   * to fit all of the characters.
-   * @return the output string length, not including the terminating NUL
-   * @stable ICU 2.0
-   */
-  inline int32_t extract(int32_t start,
-                 int32_t startLength,
-                 char *target,
-                 const char *codepage = 0) const;
-
-  /**
-   * Copy the characters in the range
-   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters
-   * in a specified codepage.
-   * This function does not write any more than <code>targetLength</code>
-   * characters but returns the length of the entire output string
-   * so that one can allocate a larger buffer and call the function again
-   * if necessary.
-   * The output string is NUL-terminated if possible.
-   *
-   * Recommendation: For invariant-character strings use
-   * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const
-   * because it avoids object code dependencies of UnicodeString on
-   * the conversion code.
-   *
-   * @param start offset of first character which will be copied
-   * @param startLength the number of characters to extract
-   * @param target the target buffer for extraction
-   * @param targetLength the length of the target buffer
-   * @param codepage the desired codepage for the characters.  0 has
-   * the special meaning of the default codepage
-   * If <code>codepage</code> is an empty string (<code>""</code>),
-   * then a simple conversion is performed on the codepage-invariant
-   * subset ("invariant characters") of the platform encoding. See utypes.h.
-   * If <TT>target</TT> is NULL, then the number of bytes required for
-   * <TT>target</TT> is returned.
-   * @return the output string length, not including the terminating NUL
-   * @stable ICU 2.0
-   */
-  int32_t extract(int32_t start,
-           int32_t startLength,
-           char *target,
-           uint32_t targetLength,
-           const char *codepage) const;
-
-  /**
-   * Convert the UnicodeString into a codepage string using an existing UConverter.
-   * The output string is NUL-terminated if possible.
-   *
-   * This function avoids the overhead of opening and closing a converter if
-   * multiple strings are extracted.
-   *
-   * @param dest destination string buffer, can be NULL if destCapacity==0
-   * @param destCapacity the number of chars available at dest
-   * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called),
-   *        or NULL for the default converter
-   * @param errorCode normal ICU error code
-   * @return the length of the output string, not counting the terminating NUL;
-   *         if the length is greater than destCapacity, then the string will not fit
-   *         and a buffer of the indicated length would need to be passed in
-   * @stable ICU 2.0
-   */
-  int32_t extract(char *dest, int32_t destCapacity,
-                  UConverter *cnv,
-                  UErrorCode &errorCode) const;
-
-#endif
-
-  /**
-   * Create a temporary substring for the specified range.
-   * Unlike the substring constructor and setTo() functions,
-   * the object returned here will be a read-only alias (using getBuffer())
-   * rather than copying the text.
-   * As a result, this substring operation is much faster but requires
-   * that the original string not be modified or deleted during the lifetime
-   * of the returned substring object.
-   * @param start offset of the first character visible in the substring
-   * @param length length of the substring
-   * @return a read-only alias UnicodeString object for the substring
-   * @stable ICU 4.4
-   */
-  UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const;
-
-  /**
-   * Create a temporary substring for the specified range.
-   * Same as tempSubString(start, length) except that the substring range
-   * is specified as a (start, limit) pair (with an exclusive limit index)
-   * rather than a (start, length) pair.
-   * @param start offset of the first character visible in the substring
-   * @param limit offset immediately following the last character visible in the substring
-   * @return a read-only alias UnicodeString object for the substring
-   * @stable ICU 4.4
-   */
-  inline UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const;
-
-  /**
-   * Convert the UnicodeString to UTF-8 and write the result
-   * to a ByteSink. This is called by toUTF8String().
-   * Unpaired surrogates are replaced with U+FFFD.
-   * Calls u_strToUTF8WithSub().
-   *
-   * @param sink A ByteSink to which the UTF-8 version of the string is written.
-   *             sink.Flush() is called at the end.
-   * @stable ICU 4.2
-   * @see toUTF8String
-   */
-  void toUTF8(ByteSink &sink) const;
-
-#if U_HAVE_STD_STRING
-
-  /**
-   * Convert the UnicodeString to UTF-8 and append the result
-   * to a standard string.
-   * Unpaired surrogates are replaced with U+FFFD.
-   * Calls toUTF8().
-   *
-   * @param result A standard string (or a compatible object)
-   *        to which the UTF-8 version of the string is appended.
-   * @return The string object.
-   * @stable ICU 4.2
-   * @see toUTF8
-   */
-  template<typename StringClass>
-  StringClass &toUTF8String(StringClass &result) const {
-    StringByteSink<StringClass> sbs(&result);
-    toUTF8(sbs);
-    return result;
-  }
-
-#endif
-
-  /**
-   * Convert the UnicodeString to UTF-32.
-   * Unpaired surrogates are replaced with U+FFFD.
-   * Calls u_strToUTF32WithSub().
-   *
-   * @param utf32 destination string buffer, can be NULL if capacity==0
-   * @param capacity the number of UChar32s available at utf32
-   * @param errorCode Standard ICU error code. Its input value must
-   *                  pass the U_SUCCESS() test, or else the function returns
-   *                  immediately. Check for U_FAILURE() on output or use with
-   *                  function chaining. (See User Guide for details.)
-   * @return The length of the UTF-32 string.
-   * @see fromUTF32
-   * @stable ICU 4.2
-   */
-  int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const;
-
-  /* Length operations */
-
-  /**
-   * Return the length of the UnicodeString object.
-   * The length is the number of UChar code units are in the UnicodeString.
-   * If you want the number of code points, please use countChar32().
-   * @return the length of the UnicodeString object
-   * @see countChar32
-   * @stable ICU 2.0
-   */
-  inline int32_t length(void) const;
-
-  /**
-   * Count Unicode code points in the length UChar code units of the string.
-   * A code point may occupy either one or two UChar code units.
-   * Counting code points involves reading all code units.
-   *
-   * This functions is basically the inverse of moveIndex32().
-   *
-   * @param start the index of the first code unit to check
-   * @param length the number of UChar code units to check
-   * @return the number of code points in the specified code units
-   * @see length
-   * @stable ICU 2.0
-   */
-  int32_t
-  countChar32(int32_t start=0, int32_t length=INT32_MAX) const;
-
-  /**
-   * Check if the length UChar code units of the string
-   * contain more Unicode code points than a certain number.
-   * This is more efficient than counting all code points in this part of the string
-   * and comparing that number with a threshold.
-   * This function may not need to scan the string at all if the length
-   * falls within a certain range, and
-   * never needs to count more than 'number+1' code points.
-   * Logically equivalent to (countChar32(start, length)>number).
-   * A Unicode code point may occupy either one or two UChar code units.
-   *
-   * @param start the index of the first code unit to check (0 for the entire string)
-   * @param length the number of UChar code units to check
-   *               (use INT32_MAX for the entire string; remember that start/length
-   *                values are pinned)
-   * @param number The number of code points in the (sub)string is compared against
-   *               the 'number' parameter.
-   * @return Boolean value for whether the string contains more Unicode code points
-   *         than 'number'. Same as (u_countChar32(s, length)>number).
-   * @see countChar32
-   * @see u_strHasMoreChar32Than
-   * @stable ICU 2.4
-   */
-  UBool
-  hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const;
-
-  /**
-   * Determine if this string is empty.
-   * @return TRUE if this string contains 0 characters, FALSE otherwise.
-   * @stable ICU 2.0
-   */
-  inline UBool isEmpty(void) const;
-
-  /**
-   * Return the capacity of the internal buffer of the UnicodeString object.
-   * This is useful together with the getBuffer functions.
-   * See there for details.
-   *
-   * @return the number of UChars available in the internal buffer
-   * @see getBuffer
-   * @stable ICU 2.0
-   */
-  inline int32_t getCapacity(void) const;
-
-  /* Other operations */
-
-  /**
-   * Generate a hash code for this object.
-   * @return The hash code of this UnicodeString.
-   * @stable ICU 2.0
-   */
-  inline int32_t hashCode(void) const;
-
-  /**
-   * Determine if this object contains a valid string.
-   * A bogus string has no value. It is different from an empty string,
-   * although in both cases isEmpty() returns TRUE and length() returns 0.
-   * setToBogus() and isBogus() can be used to indicate that no string value is available.
-   * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and
-   * length() returns 0.
-   *
-   * @return TRUE if the string is valid, FALSE otherwise
-   * @see setToBogus()
-   * @stable ICU 2.0
-   */
-  inline UBool isBogus(void) const;
-
-
-  //========================================
-  // Write operations
-  //========================================
-
-  /* Assignment operations */
-
-  /**
-   * Assignment operator.  Replace the characters in this UnicodeString
-   * with the characters from <TT>srcText</TT>.
-   * @param srcText The text containing the characters to replace
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString &operator=(const UnicodeString &srcText);
-
-  /**
-   * Almost the same as the assignment operator.
-   * Replace the characters in this UnicodeString
-   * with the characters from <code>srcText</code>.
-   *
-   * This function works the same for all strings except for ones that
-   * are readonly aliases.
-   * Starting with ICU 2.4, the assignment operator and the copy constructor
-   * allocate a new buffer and copy the buffer contents even for readonly aliases.
-   * This function implements the old, more efficient but less safe behavior
-   * of making this string also a readonly alias to the same buffer.
-   * The fastCopyFrom function must be used only if it is known that the lifetime of
-   * this UnicodeString is at least as long as the lifetime of the aliased buffer
-   * including its contents, for example for strings from resource bundles
-   * or aliases to string contents.
-   *
-   * @param src The text containing the characters to replace.
-   * @return a reference to this
-   * @stable ICU 2.4
-   */
-  UnicodeString &fastCopyFrom(const UnicodeString &src);
-
-  /**
-   * Assignment operator.  Replace the characters in this UnicodeString
-   * with the code unit <TT>ch</TT>.
-   * @param ch the code unit to replace
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& operator= (UChar ch);
-
-  /**
-   * Assignment operator.  Replace the characters in this UnicodeString
-   * with the code point <TT>ch</TT>.
-   * @param ch the code point to replace
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& operator= (UChar32 ch);
-
-  /**
-   * Set the text in the UnicodeString object to the characters
-   * in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcText.length()</TT>).
-   * <TT>srcText</TT> is not modified.
-   * @param srcText the source for the new characters
-   * @param srcStart the offset into <TT>srcText</TT> where new characters
-   * will be obtained
-   * @return a reference to this
-   * @stable ICU 2.2
-   */
-  inline UnicodeString& setTo(const UnicodeString& srcText,
-               int32_t srcStart);
-
-  /**
-   * Set the text in the UnicodeString object to the characters
-   * in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * <TT>srcText</TT> is not modified.
-   * @param srcText the source for the new characters
-   * @param srcStart the offset into <TT>srcText</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcText</TT> in the
-   * replace string.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& setTo(const UnicodeString& srcText,
-               int32_t srcStart,
-               int32_t srcLength);
-
-  /**
-   * Set the text in the UnicodeString object to the characters in
-   * <TT>srcText</TT>.
-   * <TT>srcText</TT> is not modified.
-   * @param srcText the source for the new characters
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& setTo(const UnicodeString& srcText);
-
-  /**
-   * Set the characters in the UnicodeString object to the characters
-   * in <TT>srcChars</TT>. <TT>srcChars</TT> is not modified.
-   * @param srcChars the source for the new characters
-   * @param srcLength the number of Unicode characters in srcChars.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& setTo(const UChar *srcChars,
-               int32_t srcLength);
-
-  /**
-   * Set the characters in the UnicodeString object to the code unit
-   * <TT>srcChar</TT>.
-   * @param srcChar the code unit which becomes the UnicodeString's character
-   * content
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& setTo(UChar srcChar);
-
-  /**
-   * Set the characters in the UnicodeString object to the code point
-   * <TT>srcChar</TT>.
-   * @param srcChar the code point which becomes the UnicodeString's character
-   * content
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& setTo(UChar32 srcChar);
-
-  /**
-   * Aliasing setTo() function, analogous to the readonly-aliasing UChar* constructor.
-   * The text will be used for the UnicodeString object, but
-   * it will not be released when the UnicodeString is destroyed.
-   * This has copy-on-write semantics:
-   * When the string is modified, then the buffer is first copied into
-   * newly allocated memory.
-   * The aliased buffer is never modified.
-   * In an assignment to another UnicodeString, the text will be aliased again,
-   * so that both strings then alias the same readonly-text.
-   *
-   * @param isTerminated specifies if <code>text</code> is <code>NUL</code>-terminated.
-   *                     This must be true if <code>textLength==-1</code>.
-   * @param text The characters to alias for the UnicodeString.
-   * @param textLength The number of Unicode characters in <code>text</code> to alias.
-   *                   If -1, then this constructor will determine the length
-   *                   by calling <code>u_strlen()</code>.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString &setTo(UBool isTerminated,
-                       const UChar *text,
-                       int32_t textLength);
-
-  /**
-   * Aliasing setTo() function, analogous to the writable-aliasing UChar* constructor.
-   * The text will be used for the UnicodeString object, but
-   * it will not be released when the UnicodeString is destroyed.
-   * This has write-through semantics:
-   * For as long as the capacity of the buffer is sufficient, write operations
-   * will directly affect the buffer. When more capacity is necessary, then
-   * a new buffer will be allocated and the contents copied as with regularly
-   * constructed strings.
-   * In an assignment to another UnicodeString, the buffer will be copied.
-   * The extract(UChar *dst) function detects whether the dst pointer is the same
-   * as the string buffer itself and will in this case not copy the contents.
-   *
-   * @param buffer The characters to alias for the UnicodeString.
-   * @param buffLength The number of Unicode characters in <code>buffer</code> to alias.
-   * @param buffCapacity The size of <code>buffer</code> in UChars.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString &setTo(UChar *buffer,
-                       int32_t buffLength,
-                       int32_t buffCapacity);
-
-  /**
-   * Make this UnicodeString object invalid.
-   * The string will test TRUE with isBogus().
-   *
-   * A bogus string has no value. It is different from an empty string.
-   * It can be used to indicate that no string value is available.
-   * getBuffer() and getTerminatedBuffer() return NULL, and
-   * length() returns 0.
-   *
-   * This utility function is used throughout the UnicodeString
-   * implementation to indicate that a UnicodeString operation failed,
-   * and may be used in other functions,
-   * especially but not exclusively when such functions do not
-   * take a UErrorCode for simplicity.
-   *
-   * The following methods, and no others, will clear a string object's bogus flag:
-   * - remove()
-   * - remove(0, INT32_MAX)
-   * - truncate(0)
-   * - operator=() (assignment operator)
-   * - setTo(...)
-   *
-   * The simplest ways to turn a bogus string into an empty one
-   * is to use the remove() function.
-   * Examples for other functions that are equivalent to "set to empty string":
-   * \code
-   * if(s.isBogus()) {
-   *   s.remove();           // set to an empty string (remove all), or
-   *   s.remove(0, INT32_MAX); // set to an empty string (remove all), or
-   *   s.truncate(0);        // set to an empty string (complete truncation), or
-   *   s=UnicodeString();    // assign an empty string, or
-   *   s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or
-   *   static const UChar nul=0;
-   *   s.setTo(&nul, 0);     // set to an empty C Unicode string
-   * }
-   * \endcode
-   *
-   * @see isBogus()
-   * @stable ICU 2.0
-   */
-  void setToBogus();
-
-  /**
-   * Set the character at the specified offset to the specified character.
-   * @param offset A valid offset into the text of the character to set
-   * @param ch The new character
-   * @return A reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& setCharAt(int32_t offset,
-               UChar ch);
-
-
-  /* Append operations */
-
-  /**
-   * Append operator. Append the code unit <TT>ch</TT> to the UnicodeString
-   * object.
-   * @param ch the code unit to be appended
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
- inline  UnicodeString& operator+= (UChar ch);
-
-  /**
-   * Append operator. Append the code point <TT>ch</TT> to the UnicodeString
-   * object.
-   * @param ch the code point to be appended
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
- inline  UnicodeString& operator+= (UChar32 ch);
-
-  /**
-   * Append operator. Append the characters in <TT>srcText</TT> to the
-   * UnicodeString object at offset <TT>start</TT>. <TT>srcText</TT> is
-   * not modified.
-   * @param srcText the source for the new characters
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& operator+= (const UnicodeString& srcText);
-
-  /**
-   * Append the characters
-   * in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the
-   * UnicodeString object at offset <TT>start</TT>. <TT>srcText</TT>
-   * is not modified.
-   * @param srcText the source for the new characters
-   * @param srcStart the offset into <TT>srcText</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcText</TT> in
-   * the append string
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& append(const UnicodeString& srcText,
-            int32_t srcStart,
-            int32_t srcLength);
-
-  /**
-   * Append the characters in <TT>srcText</TT> to the UnicodeString object at
-   * offset <TT>start</TT>. <TT>srcText</TT> is not modified.
-   * @param srcText the source for the new characters
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& append(const UnicodeString& srcText);
-
-  /**
-   * Append the characters in <TT>srcChars</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the UnicodeString
-   * object at offset
-   * <TT>start</TT>. <TT>srcChars</TT> is not modified.
-   * @param srcChars the source for the new characters
-   * @param srcStart the offset into <TT>srcChars</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcChars</TT> in
-   * the append string
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& append(const UChar *srcChars,
-            int32_t srcStart,
-            int32_t srcLength);
-
-  /**
-   * Append the characters in <TT>srcChars</TT> to the UnicodeString object
-   * at offset <TT>start</TT>. <TT>srcChars</TT> is not modified.
-   * @param srcChars the source for the new characters
-   * @param srcLength the number of Unicode characters in <TT>srcChars</TT>
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& append(const UChar *srcChars,
-            int32_t srcLength);
-
-  /**
-   * Append the code unit <TT>srcChar</TT> to the UnicodeString object.
-   * @param srcChar the code unit to append
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& append(UChar srcChar);
-
-  /**
-   * Append the code point <TT>srcChar</TT> to the UnicodeString object.
-   * @param srcChar the code point to append
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& append(UChar32 srcChar);
-
-
-  /* Insert operations */
-
-  /**
-   * Insert the characters in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) into the UnicodeString
-   * object at offset <TT>start</TT>. <TT>srcText</TT> is not modified.
-   * @param start the offset where the insertion begins
-   * @param srcText the source for the new characters
-   * @param srcStart the offset into <TT>srcText</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcText</TT> in
-   * the insert string
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& insert(int32_t start,
-            const UnicodeString& srcText,
-            int32_t srcStart,
-            int32_t srcLength);
-
-  /**
-   * Insert the characters in <TT>srcText</TT> into the UnicodeString object
-   * at offset <TT>start</TT>. <TT>srcText</TT> is not modified.
-   * @param start the offset where the insertion begins
-   * @param srcText the source for the new characters
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& insert(int32_t start,
-            const UnicodeString& srcText);
-
-  /**
-   * Insert the characters in <TT>srcChars</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) into the UnicodeString
-   *  object at offset <TT>start</TT>. <TT>srcChars</TT> is not modified.
-   * @param start the offset at which the insertion begins
-   * @param srcChars the source for the new characters
-   * @param srcStart the offset into <TT>srcChars</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcChars</TT>
-   * in the insert string
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& insert(int32_t start,
-            const UChar *srcChars,
-            int32_t srcStart,
-            int32_t srcLength);
-
-  /**
-   * Insert the characters in <TT>srcChars</TT> into the UnicodeString object
-   * at offset <TT>start</TT>. <TT>srcChars</TT> is not modified.
-   * @param start the offset where the insertion begins
-   * @param srcChars the source for the new characters
-   * @param srcLength the number of Unicode characters in srcChars.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& insert(int32_t start,
-            const UChar *srcChars,
-            int32_t srcLength);
-
-  /**
-   * Insert the code unit <TT>srcChar</TT> into the UnicodeString object at
-   * offset <TT>start</TT>.
-   * @param start the offset at which the insertion occurs
-   * @param srcChar the code unit to insert
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& insert(int32_t start,
-            UChar srcChar);
-
-  /**
-   * Insert the code point <TT>srcChar</TT> into the UnicodeString object at
-   * offset <TT>start</TT>.
-   * @param start the offset at which the insertion occurs
-   * @param srcChar the code point to insert
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& insert(int32_t start,
-            UChar32 srcChar);
-
-
-  /* Replace operations */
-
-  /**
-   * Replace the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the characters in
-   * <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
-   * <TT>srcText</TT> is not modified.
-   * @param start the offset at which the replace operation begins
-   * @param length the number of characters to replace. The character at
-   * <TT>start + length</TT> is not modified.
-   * @param srcText the source for the new characters
-   * @param srcStart the offset into <TT>srcText</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcText</TT> in
-   * the replace string
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& replace(int32_t start,
-             int32_t length,
-             const UnicodeString& srcText,
-             int32_t srcStart,
-             int32_t srcLength);
-
-  /**
-   * Replace the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>)
-   * with the characters in <TT>srcText</TT>.  <TT>srcText</TT> is
-   *  not modified.
-   * @param start the offset at which the replace operation begins
-   * @param length the number of characters to replace. The character at
-   * <TT>start + length</TT> is not modified.
-   * @param srcText the source for the new characters
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& replace(int32_t start,
-             int32_t length,
-             const UnicodeString& srcText);
-
-  /**
-   * Replace the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the characters in
-   * <TT>srcChars</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>). <TT>srcChars</TT>
-   * is not modified.
-   * @param start the offset at which the replace operation begins
-   * @param length the number of characters to replace.  The character at
-   * <TT>start + length</TT> is not modified.
-   * @param srcChars the source for the new characters
-   * @param srcStart the offset into <TT>srcChars</TT> where new characters
-   * will be obtained
-   * @param srcLength the number of characters in <TT>srcChars</TT>
-   * in the replace string
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& replace(int32_t start,
-             int32_t length,
-             const UChar *srcChars,
-             int32_t srcStart,
-             int32_t srcLength);
-
-  /**
-   * Replace the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the characters in
-   * <TT>srcChars</TT>.  <TT>srcChars</TT> is not modified.
-   * @param start the offset at which the replace operation begins
-   * @param length number of characters to replace.  The character at
-   * <TT>start + length</TT> is not modified.
-   * @param srcChars the source for the new characters
-   * @param srcLength the number of Unicode characters in srcChars
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& replace(int32_t start,
-             int32_t length,
-             const UChar *srcChars,
-             int32_t srcLength);
-
-  /**
-   * Replace the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the code unit
-   * <TT>srcChar</TT>.
-   * @param start the offset at which the replace operation begins
-   * @param length the number of characters to replace.  The character at
-   * <TT>start + length</TT> is not modified.
-   * @param srcChar the new code unit
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& replace(int32_t start,
-             int32_t length,
-             UChar srcChar);
-
-  /**
-   * Replace the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) with the code point
-   * <TT>srcChar</TT>.
-   * @param start the offset at which the replace operation begins
-   * @param length the number of characters to replace.  The character at
-   * <TT>start + length</TT> is not modified.
-   * @param srcChar the new code point
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& replace(int32_t start,
-             int32_t length,
-             UChar32 srcChar);
-
-  /**
-   * Replace the characters in the range [<TT>start</TT>, <TT>limit</TT>)
-   * with the characters in <TT>srcText</TT>. <TT>srcText</TT> is not modified.
-   * @param start the offset at which the replace operation begins
-   * @param limit the offset immediately following the replace range
-   * @param srcText the source for the new characters
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& replaceBetween(int32_t start,
-                int32_t limit,
-                const UnicodeString& srcText);
-
-  /**
-   * Replace the characters in the range [<TT>start</TT>, <TT>limit</TT>)
-   * with the characters in <TT>srcText</TT> in the range
-   * [<TT>srcStart</TT>, <TT>srcLimit</TT>). <TT>srcText</TT> is not modified.
-   * @param start the offset at which the replace operation begins
-   * @param limit the offset immediately following the replace range
-   * @param srcText the source for the new characters
-   * @param srcStart the offset into <TT>srcChars</TT> where new characters
-   * will be obtained
-   * @param srcLimit the offset immediately following the range to copy
-   * in <TT>srcText</TT>
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& replaceBetween(int32_t start,
-                int32_t limit,
-                const UnicodeString& srcText,
-                int32_t srcStart,
-                int32_t srcLimit);
-
-  /**
-   * Replace a substring of this object with the given text.
-   * @param start the beginning index, inclusive; <code>0 <= start
-   * <= limit</code>.
-   * @param limit the ending index, exclusive; <code>start <= limit
-   * <= length()</code>.
-   * @param text the text to replace characters <code>start</code>
-   * to <code>limit - 1</code>
-   * @stable ICU 2.0
-   */
-  virtual void handleReplaceBetween(int32_t start,
-                                    int32_t limit,
-                                    const UnicodeString& text);
-
-  /**
-   * Replaceable API
-   * @return TRUE if it has MetaData
-   * @stable ICU 2.4
-   */
-  virtual UBool hasMetaData() const;
-
-  /**
-   * Copy a substring of this object, retaining attribute (out-of-band)
-   * information.  This method is used to duplicate or reorder substrings.
-   * The destination index must not overlap the source range.
-   *
-   * @param start the beginning index, inclusive; <code>0 <= start <=
-   * limit</code>.
-   * @param limit the ending index, exclusive; <code>start <= limit <=
-   * length()</code>.
-   * @param dest the destination index.  The characters from
-   * <code>start..limit-1</code> will be copied to <code>dest</code>.
-   * Implementations of this method may assume that <code>dest <= start ||
-   * dest >= limit</code>.
-   * @stable ICU 2.0
-   */
-  virtual void copy(int32_t start, int32_t limit, int32_t dest);
-
-  /* Search and replace operations */
-
-  /**
-   * Replace all occurrences of characters in oldText with the characters
-   * in newText
-   * @param oldText the text containing the search text
-   * @param newText the text containing the replacement text
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& findAndReplace(const UnicodeString& oldText,
-                const UnicodeString& newText);
-
-  /**
-   * Replace all occurrences of characters in oldText with characters
-   * in newText
-   * in the range [<TT>start</TT>, <TT>start + length</TT>).
-   * @param start the start of the range in which replace will performed
-   * @param length the length of the range in which replace will be performed
-   * @param oldText the text containing the search text
-   * @param newText the text containing the replacement text
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& findAndReplace(int32_t start,
-                int32_t length,
-                const UnicodeString& oldText,
-                const UnicodeString& newText);
-
-  /**
-   * Replace all occurrences of characters in oldText in the range
-   * [<TT>oldStart</TT>, <TT>oldStart + oldLength</TT>) with the characters
-   * in newText in the range
-   * [<TT>newStart</TT>, <TT>newStart + newLength</TT>)
-   * in the range [<TT>start</TT>, <TT>start + length</TT>).
-   * @param start the start of the range in which replace will performed
-   * @param length the length of the range in which replace will be performed
-   * @param oldText the text containing the search text
-   * @param oldStart the start of the search range in <TT>oldText</TT>
-   * @param oldLength the length of the search range in <TT>oldText</TT>
-   * @param newText the text containing the replacement text
-   * @param newStart the start of the replacement range in <TT>newText</TT>
-   * @param newLength the length of the replacement range in <TT>newText</TT>
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& findAndReplace(int32_t start,
-                int32_t length,
-                const UnicodeString& oldText,
-                int32_t oldStart,
-                int32_t oldLength,
-                const UnicodeString& newText,
-                int32_t newStart,
-                int32_t newLength);
-
-
-  /* Remove operations */
-
-  /**
-   * Remove all characters from the UnicodeString object.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& remove(void);
-
-  /**
-   * Remove the characters in the range
-   * [<TT>start</TT>, <TT>start + length</TT>) from the UnicodeString object.
-   * @param start the offset of the first character to remove
-   * @param length the number of characters to remove
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& remove(int32_t start,
-                               int32_t length = (int32_t)INT32_MAX);
-
-  /**
-   * Remove the characters in the range
-   * [<TT>start</TT>, <TT>limit</TT>) from the UnicodeString object.
-   * @param start the offset of the first character to remove
-   * @param limit the offset immediately following the range to remove
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& removeBetween(int32_t start,
-                                      int32_t limit = (int32_t)INT32_MAX);
-
-  /**
-   * Retain only the characters in the range
-   * [<code>start</code>, <code>limit</code>) from the UnicodeString object.
-   * Removes characters before <code>start</code> and at and after <code>limit</code>.
-   * @param start the offset of the first character to retain
-   * @param limit the offset immediately following the range to retain
-   * @return a reference to this
-   * @stable ICU 4.4
-   */
-  inline UnicodeString &retainBetween(int32_t start, int32_t limit = INT32_MAX);
-
-  /* Length operations */
-
-  /**
-   * Pad the start of this UnicodeString with the character <TT>padChar</TT>.
-   * If the length of this UnicodeString is less than targetLength,
-   * length() - targetLength copies of padChar will be added to the
-   * beginning of this UnicodeString.
-   * @param targetLength the desired length of the string
-   * @param padChar the character to use for padding. Defaults to
-   * space (U+0020)
-   * @return TRUE if the text was padded, FALSE otherwise.
-   * @stable ICU 2.0
-   */
-  UBool padLeading(int32_t targetLength,
-                    UChar padChar = 0x0020);
-
-  /**
-   * Pad the end of this UnicodeString with the character <TT>padChar</TT>.
-   * If the length of this UnicodeString is less than targetLength,
-   * length() - targetLength copies of padChar will be added to the
-   * end of this UnicodeString.
-   * @param targetLength the desired length of the string
-   * @param padChar the character to use for padding. Defaults to
-   * space (U+0020)
-   * @return TRUE if the text was padded, FALSE otherwise.
-   * @stable ICU 2.0
-   */
-  UBool padTrailing(int32_t targetLength,
-                     UChar padChar = 0x0020);
-
-  /**
-   * Truncate this UnicodeString to the <TT>targetLength</TT>.
-   * @param targetLength the desired length of this UnicodeString.
-   * @return TRUE if the text was truncated, FALSE otherwise
-   * @stable ICU 2.0
-   */
-  inline UBool truncate(int32_t targetLength);
-
-  /**
-   * Trims leading and trailing whitespace from this UnicodeString.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  UnicodeString& trim(void);
-
-
-  /* Miscellaneous operations */
-
-  /**
-   * Reverse this UnicodeString in place.
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& reverse(void);
-
-  /**
-   * Reverse the range [<TT>start</TT>, <TT>start + length</TT>) in
-   * this UnicodeString.
-   * @param start the start of the range to reverse
-   * @param length the number of characters to to reverse
-   * @return a reference to this
-   * @stable ICU 2.0
-   */
-  inline UnicodeString& reverse(int32_t start,
-             int32_t length);
-
-  /**
-   * Convert the characters in this to UPPER CASE following the conventions of
-   * the default locale.
-   * @return A reference to this.
-   * @stable ICU 2.0
-   */
-  UnicodeString& toUpper(void);
-
-  /**
-   * Convert the characters in this to UPPER CASE following the conventions of
-   * a specific locale.
-   * @param locale The locale containing the conventions to use.
-   * @return A reference to this.
-   * @stable ICU 2.0
-   */
-  UnicodeString& toUpper(const Locale& locale);
-
-  /**
-   * Convert the characters in this to lower case following the conventions of
-   * the default locale.
-   * @return A reference to this.
-   * @stable ICU 2.0
-   */
-  UnicodeString& toLower(void);
-
-  /**
-   * Convert the characters in this to lower case following the conventions of
-   * a specific locale.
-   * @param locale The locale containing the conventions to use.
-   * @return A reference to this.
-   * @stable ICU 2.0
-   */
-  UnicodeString& toLower(const Locale& locale);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-  /**
-   * Titlecase this string, convenience function using the default locale.
-   *
-   * Casing is locale-dependent and context-sensitive.
-   * Titlecasing uses a break iterator to find the first characters of words
-   * that are to be titlecased. It titlecases those characters and lowercases
-   * all others.
-   *
-   * The titlecase break iterator can be provided to customize for arbitrary
-   * styles, using rules and dictionaries beyond the standard iterators.
-   * It may be more efficient to always provide an iterator to avoid
-   * opening and closing one for each string.
-   * The standard titlecase iterator for the root locale implements the
-   * algorithm of Unicode TR 21.
-   *
-   * This function uses only the setText(), first() and next() methods of the
-   * provided break iterator.
-   *
-   * @param titleIter A break iterator to find the first characters of words
-   *                  that are to be titlecased.
-   *                  If none is provided (0), then a standard titlecase
-   *                  break iterator is opened.
-   *                  Otherwise the provided iterator is set to the string's text.
-   * @return A reference to this.
-   * @stable ICU 2.1
-   */
-  UnicodeString &toTitle(BreakIterator *titleIter);
-
-  /**
-   * Titlecase this string.
-   *
-   * Casing is locale-dependent and context-sensitive.
-   * Titlecasing uses a break iterator to find the first characters of words
-   * that are to be titlecased. It titlecases those characters and lowercases
-   * all others.
-   *
-   * The titlecase break iterator can be provided to customize for arbitrary
-   * styles, using rules and dictionaries beyond the standard iterators.
-   * It may be more efficient to always provide an iterator to avoid
-   * opening and closing one for each string.
-   * The standard titlecase iterator for the root locale implements the
-   * algorithm of Unicode TR 21.
-   *
-   * This function uses only the setText(), first() and next() methods of the
-   * provided break iterator.
-   *
-   * @param titleIter A break iterator to find the first characters of words
-   *                  that are to be titlecased.
-   *                  If none is provided (0), then a standard titlecase
-   *                  break iterator is opened.
-   *                  Otherwise the provided iterator is set to the string's text.
-   * @param locale    The locale to consider.
-   * @return A reference to this.
-   * @stable ICU 2.1
-   */
-  UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale);
-
-  /**
-   * Titlecase this string, with options.
-   *
-   * Casing is locale-dependent and context-sensitive.
-   * Titlecasing uses a break iterator to find the first characters of words
-   * that are to be titlecased. It titlecases those characters and lowercases
-   * all others. (This can be modified with options.)
-   *
-   * The titlecase break iterator can be provided to customize for arbitrary
-   * styles, using rules and dictionaries beyond the standard iterators.
-   * It may be more efficient to always provide an iterator to avoid
-   * opening and closing one for each string.
-   * The standard titlecase iterator for the root locale implements the
-   * algorithm of Unicode TR 21.
-   *
-   * This function uses only the setText(), first() and next() methods of the
-   * provided break iterator.
-   *
-   * @param titleIter A break iterator to find the first characters of words
-   *                  that are to be titlecased.
-   *                  If none is provided (0), then a standard titlecase
-   *                  break iterator is opened.
-   *                  Otherwise the provided iterator is set to the string's text.
-   * @param locale    The locale to consider.
-   * @param options Options bit set, see ucasemap_open().
-   * @return A reference to this.
-   * @see U_TITLECASE_NO_LOWERCASE
-   * @see U_TITLECASE_NO_BREAK_ADJUSTMENT
-   * @see ucasemap_open
-   * @stable ICU 3.8
-   */
-  UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options);
-
-#endif
-
-  /**
-   * Case-fold the characters in this string.
-   * Case-folding is locale-independent and not context-sensitive,
-   * but there is an option for whether to include or exclude mappings for dotted I
-   * and dotless i that are marked with 'I' in CaseFolding.txt.
-   * The result may be longer or shorter than the original.
-   *
-   * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
-   * @return A reference to this.
-   * @stable ICU 2.0
-   */
-  UnicodeString &foldCase(uint32_t options=0 /*U_FOLD_CASE_DEFAULT*/);
-
-  //========================================
-  // Access to the internal buffer
-  //========================================
-
-  /**
-   * Get a read/write pointer to the internal buffer.
-   * The buffer is guaranteed to be large enough for at least minCapacity UChars,
-   * writable, and is still owned by the UnicodeString object.
-   * Calls to getBuffer(minCapacity) must not be nested, and
-   * must be matched with calls to releaseBuffer(newLength).
-   * If the string buffer was read-only or shared,
-   * then it will be reallocated and copied.
-   *
-   * An attempted nested call will return 0, and will not further modify the
-   * state of the UnicodeString object.
-   * It also returns 0 if the string is bogus.
-   *
-   * The actual capacity of the string buffer may be larger than minCapacity.
-   * getCapacity() returns the actual capacity.
-   * For many operations, the full capacity should be used to avoid reallocations.
-   *
-   * While the buffer is "open" between getBuffer(minCapacity)
-   * and releaseBuffer(newLength), the following applies:
-   * - The string length is set to 0.
-   * - Any read API call on the UnicodeString object will behave like on a 0-length string.
-   * - Any write API call on the UnicodeString object is disallowed and will have no effect.
-   * - You can read from and write to the returned buffer.
-   * - The previous string contents will still be in the buffer;
-   *   if you want to use it, then you need to call length() before getBuffer(minCapacity).
-   *   If the length() was greater than minCapacity, then any contents after minCapacity
-   *   may be lost.
-   *   The buffer contents is not NUL-terminated by getBuffer().
-   *   If length()<getCapacity() then you can terminate it by writing a NUL
-   *   at index length().
-   * - You must call releaseBuffer(newLength) before and in order to
-   *   return to normal UnicodeString operation.
-   *
-   * @param minCapacity the minimum number of UChars that are to be available
-   *        in the buffer, starting at the returned pointer;
-   *        default to the current string capacity if minCapacity==-1
-   * @return a writable pointer to the internal string buffer,
-   *         or 0 if an error occurs (nested calls, out of memory)
-   *
-   * @see releaseBuffer
-   * @see getTerminatedBuffer()
-   * @stable ICU 2.0
-   */
-  UChar *getBuffer(int32_t minCapacity);
-
-  /**
-   * Release a read/write buffer on a UnicodeString object with an
-   * "open" getBuffer(minCapacity).
-   * This function must be called in a matched pair with getBuffer(minCapacity).
-   * releaseBuffer(newLength) must be called if and only if a getBuffer(minCapacity) is "open".
-   *
-   * It will set the string length to newLength, at most to the current capacity.
-   * If newLength==-1 then it will set the length according to the
-   * first NUL in the buffer, or to the capacity if there is no NUL.
-   *
-   * After calling releaseBuffer(newLength) the UnicodeString is back to normal operation.
-   *
-   * @param newLength the new length of the UnicodeString object;
-   *        defaults to the current capacity if newLength is greater than that;
-   *        if newLength==-1, it defaults to u_strlen(buffer) but not more than
-   *        the current capacity of the string
-   *
-   * @see getBuffer(int32_t minCapacity)
-   * @stable ICU 2.0
-   */
-  void releaseBuffer(int32_t newLength=-1);
-
-  /**
-   * Get a read-only pointer to the internal buffer.
-   * This can be called at any time on a valid UnicodeString.
-   *
-   * It returns 0 if the string is bogus, or
-   * during an "open" getBuffer(minCapacity).
-   *
-   * It can be called as many times as desired.
-   * The pointer that it returns will remain valid until the UnicodeString object is modified,
-   * at which time the pointer is semantically invalidated and must not be used any more.
-   *
-   * The capacity of the buffer can be determined with getCapacity().
-   * The part after length() may or may not be initialized and valid,
-   * depending on the history of the UnicodeString object.
-   *
-   * The buffer contents is (probably) not NUL-terminated.
-   * You can check if it is with
-   * <code>(s.length()<s.getCapacity() && buffer[s.length()]==0)</code>.
-   * (See getTerminatedBuffer().)
-   *
-   * The buffer may reside in read-only memory. Its contents must not
-   * be modified.
-   *
-   * @return a read-only pointer to the internal string buffer,
-   *         or 0 if the string is empty or bogus
-   *
-   * @see getBuffer(int32_t minCapacity)
-   * @see getTerminatedBuffer()
-   * @stable ICU 2.0
-   */
-  inline const UChar *getBuffer() const;
-
-  /**
-   * Get a read-only pointer to the internal buffer,
-   * making sure that it is NUL-terminated.
-   * This can be called at any time on a valid UnicodeString.
-   *
-   * It returns 0 if the string is bogus, or
-   * during an "open" getBuffer(minCapacity), or if the buffer cannot
-   * be NUL-terminated (because memory allocation failed).
-   *
-   * It can be called as many times as desired.
-   * The pointer that it returns will remain valid until the UnicodeString object is modified,
-   * at which time the pointer is semantically invalidated and must not be used any more.
-   *
-   * The capacity of the buffer can be determined with getCapacity().
-   * The part after length()+1 may or may not be initialized and valid,
-   * depending on the history of the UnicodeString object.
-   *
-   * The buffer contents is guaranteed to be NUL-terminated.
-   * getTerminatedBuffer() may reallocate the buffer if a terminating NUL
-   * is written.
-   * For this reason, this function is not const, unlike getBuffer().
-   * Note that a UnicodeString may also contain NUL characters as part of its contents.
-   *
-   * The buffer may reside in read-only memory. Its contents must not
-   * be modified.
-   *
-   * @return a read-only pointer to the internal string buffer,
-   *         or 0 if the string is empty or bogus
-   *
-   * @see getBuffer(int32_t minCapacity)
-   * @see getBuffer()
-   * @stable ICU 2.2
-   */
-  inline const UChar *getTerminatedBuffer();
-
-  //========================================
-  // Constructors
-  //========================================
-
-  /** Construct an empty UnicodeString.
-   * @stable ICU 2.0
-   */
-  UnicodeString();
-
-  /**
-   * Construct a UnicodeString with capacity to hold <TT>capacity</TT> UChars
-   * @param capacity the number of UChars this UnicodeString should hold
-   * before a resize is necessary; if count is greater than 0 and count
-   * code points c take up more space than capacity, then capacity is adjusted
-   * accordingly.
-   * @param c is used to initially fill the string
-   * @param count specifies how many code points c are to be written in the
-   *              string
-   * @stable ICU 2.0
-   */
-  UnicodeString(int32_t capacity, UChar32 c, int32_t count);
-
-  /**
-   * Single UChar (code unit) constructor.
-   * @param ch the character to place in the UnicodeString
-   * @stable ICU 2.0
-   */
-  UnicodeString(UChar ch);
-
-  /**
-   * Single UChar32 (code point) constructor.
-   * @param ch the character to place in the UnicodeString
-   * @stable ICU 2.0
-   */
-  UnicodeString(UChar32 ch);
-
-  /**
-   * UChar* constructor.
-   * @param text The characters to place in the UnicodeString.  <TT>text</TT>
-   * must be NULL (U+0000) terminated.
-   * @stable ICU 2.0
-   */
-  UnicodeString(const UChar *text);
-
-  /**
-   * UChar* constructor.
-   * @param text The characters to place in the UnicodeString.
-   * @param textLength The number of Unicode characters in <TT>text</TT>
-   * to copy.
-   * @stable ICU 2.0
-   */
-  UnicodeString(const UChar *text,
-        int32_t textLength);
-
-  /**
-   * Readonly-aliasing UChar* constructor.
-   * The text will be used for the UnicodeString object, but
-   * it will not be released when the UnicodeString is destroyed.
-   * This has copy-on-write semantics:
-   * When the string is modified, then the buffer is first copied into
-   * newly allocated memory.
-   * The aliased buffer is never modified.
-   * In an assignment to another UnicodeString, the text will be aliased again,
-   * so that both strings then alias the same readonly-text.
-   *
-   * @param isTerminated specifies if <code>text</code> is <code>NUL</code>-terminated.
-   *                     This must be true if <code>textLength==-1</code>.
-   * @param text The characters to alias for the UnicodeString.
-   * @param textLength The number of Unicode characters in <code>text</code> to alias.
-   *                   If -1, then this constructor will determine the length
-   *                   by calling <code>u_strlen()</code>.
-   * @stable ICU 2.0
-   */
-  UnicodeString(UBool isTerminated,
-                const UChar *text,
-                int32_t textLength);
-
-  /**
-   * Writable-aliasing UChar* constructor.
-   * The text will be used for the UnicodeString object, but
-   * it will not be released when the UnicodeString is destroyed.
-   * This has write-through semantics:
-   * For as long as the capacity of the buffer is sufficient, write operations
-   * will directly affect the buffer. When more capacity is necessary, then
-   * a new buffer will be allocated and the contents copied as with regularly
-   * constructed strings.
-   * In an assignment to another UnicodeString, the buffer will be copied.
-   * The extract(UChar *dst) function detects whether the dst pointer is the same
-   * as the string buffer itself and will in this case not copy the contents.
-   *
-   * @param buffer The characters to alias for the UnicodeString.
-   * @param buffLength The number of Unicode characters in <code>buffer</code> to alias.
-   * @param buffCapacity The size of <code>buffer</code> in UChars.
-   * @stable ICU 2.0
-   */
-  UnicodeString(UChar *buffer, int32_t buffLength, int32_t buffCapacity);
-
-#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
-
-  /**
-   * char* constructor.
-   * @param codepageData an array of bytes, null-terminated,
-   *                     in the platform's default codepage.
-   * @stable ICU 2.0
-   */
-  UnicodeString(const char *codepageData);
-
-  /**
-   * char* constructor.
-   * @param codepageData an array of bytes in the platform's default codepage.
-   * @param dataLength The number of bytes in <TT>codepageData</TT>.
-   * @stable ICU 2.0
-   */
-  UnicodeString(const char *codepageData, int32_t dataLength);
-
-#endif
-
-#if !UCONFIG_NO_CONVERSION
-
-  /**
-   * char* constructor.
-   * @param codepageData an array of bytes, null-terminated
-   * @param codepage the encoding of <TT>codepageData</TT>.  The special
-   * value 0 for <TT>codepage</TT> indicates that the text is in the
-   * platform's default codepage.
-   *
-   * If <code>codepage</code> is an empty string (<code>""</code>),
-   * then a simple conversion is performed on the codepage-invariant
-   * subset ("invariant characters") of the platform encoding. See utypes.h.
-   * Recommendation: For invariant-character strings use the constructor
-   * UnicodeString(const char *src, int32_t length, enum EInvariant inv)
-   * because it avoids object code dependencies of UnicodeString on
-   * the conversion code.
-   *
-   * @stable ICU 2.0
-   */
-  UnicodeString(const char *codepageData, const char *codepage);
-
-  /**
-   * char* constructor.
-   * @param codepageData an array of bytes.
-   * @param dataLength The number of bytes in <TT>codepageData</TT>.
-   * @param codepage the encoding of <TT>codepageData</TT>.  The special
-   * value 0 for <TT>codepage</TT> indicates that the text is in the
-   * platform's default codepage.
-   * If <code>codepage</code> is an empty string (<code>""</code>),
-   * then a simple conversion is performed on the codepage-invariant
-   * subset ("invariant characters") of the platform encoding. See utypes.h.
-   * Recommendation: For invariant-character strings use the constructor
-   * UnicodeString(const char *src, int32_t length, enum EInvariant inv)
-   * because it avoids object code dependencies of UnicodeString on
-   * the conversion code.
-   *
-   * @stable ICU 2.0
-   */
-  UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage);
-
-  /**
-   * char * / UConverter constructor.
-   * This constructor uses an existing UConverter object to
-   * convert the codepage string to Unicode and construct a UnicodeString
-   * from that.
-   *
-   * The converter is reset at first.
-   * If the error code indicates a failure before this constructor is called,
-   * or if an error occurs during conversion or construction,
-   * then the string will be bogus.
-   *
-   * This function avoids the overhead of opening and closing a converter if
-   * multiple strings are constructed.
-   *
-   * @param src input codepage string
-   * @param srcLength length of the input string, can be -1 for NUL-terminated strings
-   * @param cnv converter object (ucnv_resetToUnicode() will be called),
-   *        can be NULL for the default converter
-   * @param errorCode normal ICU error code
-   * @stable ICU 2.0
-   */
-  UnicodeString(
-        const char *src, int32_t srcLength,
-        UConverter *cnv,
-        UErrorCode &errorCode);
-
-#endif
-
-  /**
-   * Constructs a Unicode string from an invariant-character char * string.
-   * About invariant characters see utypes.h.
-   * This constructor has no runtime dependency on conversion code and is
-   * therefore recommended over ones taking a charset name string
-   * (where the empty string "" indicates invariant-character conversion).
-   *
-   * Use the macro US_INV as the third, signature-distinguishing parameter.
-   *
-   * For example:
-   * \code
-   * void fn(const char *s) {
-   *   UnicodeString ustr(s, -1, US_INV);
-   *   // use ustr ...
-   * }
-   * \endcode
-   *
-   * @param src String using only invariant characters.
-   * @param length Length of src, or -1 if NUL-terminated.
-   * @param inv Signature-distinguishing paramater, use US_INV.
-   *
-   * @see US_INV
-   * @stable ICU 3.2
-   */
-  UnicodeString(const char *src, int32_t length, enum EInvariant inv);
-
-
-  /**
-   * Copy constructor.
-   * @param that The UnicodeString object to copy.
-   * @stable ICU 2.0
-   */
-  UnicodeString(const UnicodeString& that);
-
-  /**
-   * 'Substring' constructor from tail of source string.
-   * @param src The UnicodeString object to copy.
-   * @param srcStart The offset into <tt>src</tt> at which to start copying.
-   * @stable ICU 2.2
-   */
-  UnicodeString(const UnicodeString& src, int32_t srcStart);
-
-  /**
-   * 'Substring' constructor from subrange of source string.
-   * @param src The UnicodeString object to copy.
-   * @param srcStart The offset into <tt>src</tt> at which to start copying.
-   * @param srcLength The number of characters from <tt>src</tt> to copy.
-   * @stable ICU 2.2
-   */
-  UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength);
-
-  /**
-   * Clone this object, an instance of a subclass of Replaceable.
-   * Clones can be used concurrently in multiple threads.
-   * If a subclass does not implement clone(), or if an error occurs,
-   * then NULL is returned.
-   * The clone functions in all subclasses return a pointer to a Replaceable
-   * because some compilers do not support covariant (same-as-this)
-   * return types; cast to the appropriate subclass if necessary.
-   * The caller must delete the clone.
-   *
-   * @return a clone of this object
-   *
-   * @see Replaceable::clone
-   * @see getDynamicClassID
-   * @stable ICU 2.6
-   */
-  virtual Replaceable *clone() const;
-
-  /** Destructor.
-   * @stable ICU 2.0
-   */
-  virtual ~UnicodeString();
-
-  /**
-   * Create a UnicodeString from a UTF-8 string.
-   * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string.
-   * Calls u_strFromUTF8WithSub().
-   *
-   * @param utf8 UTF-8 input string.
-   *             Note that a StringPiece can be implicitly constructed
-   *             from a std::string or a NUL-terminated const char * string.
-   * @return A UnicodeString with equivalent UTF-16 contents.
-   * @see toUTF8
-   * @see toUTF8String
-   * @stable ICU 4.2
-   */
-  static UnicodeString fromUTF8(const StringPiece &utf8);
-
-  /**
-   * Create a UnicodeString from a UTF-32 string.
-   * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string.
-   * Calls u_strFromUTF32WithSub().
-   *
-   * @param utf32 UTF-32 input string. Must not be NULL.
-   * @param length Length of the input string, or -1 if NUL-terminated.
-   * @return A UnicodeString with equivalent UTF-16 contents.
-   * @see toUTF32
-   * @stable ICU 4.2
-   */
-  static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length);
-
-  /* Miscellaneous operations */
-
-  /**
-   * Unescape a string of characters and return a string containing
-   * the result.  The following escape sequences are recognized:
-   *
-   * \\uhhhh       4 hex digits; h in [0-9A-Fa-f]
-   * \\Uhhhhhhhh   8 hex digits
-   * \\xhh         1-2 hex digits
-   * \\ooo         1-3 octal digits; o in [0-7]
-   * \\cX          control-X; X is masked with 0x1F
-   *
-   * as well as the standard ANSI C escapes:
-   *
-   * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
-   * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
-   * \\&quot; => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
-   *
-   * Anything else following a backslash is generically escaped.  For
-   * example, "[a\\-z]" returns "[a-z]".
-   *
-   * If an escape sequence is ill-formed, this method returns an empty
-   * string.  An example of an ill-formed sequence is "\\u" followed by
-   * fewer than 4 hex digits.
-   *
-   * This function is similar to u_unescape() but not identical to it.
-   * The latter takes a source char*, so it does escape recognition
-   * and also invariant conversion.
-   *
-   * @return a string with backslash escapes interpreted, or an
-   * empty string on error.
-   * @see UnicodeString#unescapeAt()
-   * @see u_unescape()
-   * @see u_unescapeAt()
-   * @stable ICU 2.0
-   */
-  UnicodeString unescape() const;
-
-  /**
-   * Unescape a single escape sequence and return the represented
-   * character.  See unescape() for a listing of the recognized escape
-   * sequences.  The character at offset-1 is assumed (without
-   * checking) to be a backslash.  If the escape sequence is
-   * ill-formed, or the offset is out of range, (UChar32)0xFFFFFFFF is
-   * returned.
-   *
-   * @param offset an input output parameter.  On input, it is the
-   * offset into this string where the escape sequence is located,
-   * after the initial backslash.  On output, it is advanced after the
-   * last character parsed.  On error, it is not advanced at all.
-   * @return the character represented by the escape sequence at
-   * offset, or (UChar32)0xFFFFFFFF on error.
-   * @see UnicodeString#unescape()
-   * @see u_unescape()
-   * @see u_unescapeAt()
-   * @stable ICU 2.0
-   */
-  UChar32 unescapeAt(int32_t &offset) const;
-
-  /**
-   * ICU "poor man's RTTI", returns a UClassID for this class.
-   *
-   * @stable ICU 2.2
-   */
-  static UClassID U_EXPORT2 getStaticClassID();
-
-  /**
-   * ICU "poor man's RTTI", returns a UClassID for the actual class.
-   *
-   * @stable ICU 2.2
-   */
-  virtual UClassID getDynamicClassID() const;
-
-  //========================================
-  // Implementation methods
-  //========================================
-
-protected:
-  /**
-   * Implement Replaceable::getLength() (see jitterbug 1027).
-   * @stable ICU 2.4
-   */
-  virtual int32_t getLength() const;
-
-  /**
-   * The change in Replaceable to use virtual getCharAt() allows
-   * UnicodeString::charAt() to be inline again (see jitterbug 709).
-   * @stable ICU 2.4
-   */
-  virtual UChar getCharAt(int32_t offset) const;
-
-  /**
-   * The change in Replaceable to use virtual getChar32At() allows
-   * UnicodeString::char32At() to be inline again (see jitterbug 709).
-   * @stable ICU 2.4
-   */
-  virtual UChar32 getChar32At(int32_t offset) const;
-
-private:
-  // For char* constructors. Could be made public.
-  UnicodeString &setToUTF8(const StringPiece &utf8);
-  // For extract(char*).
-  // We could make a toUTF8(target, capacity, errorCode) public but not
-  // this version: New API will be cleaner if we make callers create substrings
-  // rather than having start+length on every method,
-  // and it should take a UErrorCode&.
-  int32_t
-  toUTF8(int32_t start, int32_t len,
-         char *target, int32_t capacity) const;
-
-
-  inline int8_t
-  doCompare(int32_t start,
-           int32_t length,
-           const UnicodeString& srcText,
-           int32_t srcStart,
-           int32_t srcLength) const;
-
-  int8_t doCompare(int32_t start,
-           int32_t length,
-           const UChar *srcChars,
-           int32_t srcStart,
-           int32_t srcLength) const;
-
-  inline int8_t
-  doCompareCodePointOrder(int32_t start,
-                          int32_t length,
-                          const UnicodeString& srcText,
-                          int32_t srcStart,
-                          int32_t srcLength) const;
-
-  int8_t doCompareCodePointOrder(int32_t start,
-                                 int32_t length,
-                                 const UChar *srcChars,
-                                 int32_t srcStart,
-                                 int32_t srcLength) const;
-
-  inline int8_t
-  doCaseCompare(int32_t start,
-                int32_t length,
-                const UnicodeString &srcText,
-                int32_t srcStart,
-                int32_t srcLength,
-                uint32_t options) const;
-
-  int8_t
-  doCaseCompare(int32_t start,
-                int32_t length,
-                const UChar *srcChars,
-                int32_t srcStart,
-                int32_t srcLength,
-                uint32_t options) const;
-
-  int32_t doIndexOf(UChar c,
-            int32_t start,
-            int32_t length) const;
-
-  int32_t doIndexOf(UChar32 c,
-                        int32_t start,
-                        int32_t length) const;
-
-  int32_t doLastIndexOf(UChar c,
-                int32_t start,
-                int32_t length) const;
-
-  int32_t doLastIndexOf(UChar32 c,
-                            int32_t start,
-                            int32_t length) const;
-
-  void doExtract(int32_t start,
-         int32_t length,
-         UChar *dst,
-         int32_t dstStart) const;
-
-  inline void doExtract(int32_t start,
-         int32_t length,
-         UnicodeString& target) const;
-
-  inline UChar doCharAt(int32_t offset)  const;
-
-  UnicodeString& doReplace(int32_t start,
-               int32_t length,
-               const UnicodeString& srcText,
-               int32_t srcStart,
-               int32_t srcLength);
-
-  UnicodeString& doReplace(int32_t start,
-               int32_t length,
-               const UChar *srcChars,
-               int32_t srcStart,
-               int32_t srcLength);
-
-  UnicodeString& doReverse(int32_t start,
-               int32_t length);
-
-  // calculate hash code
-  int32_t doHashCode(void) const;
-
-  // get pointer to start of array
-  // these do not check for kOpenGetBuffer, unlike the public getBuffer() function
-  inline UChar* getArrayStart(void);
-  inline const UChar* getArrayStart(void) const;
-
-  // A UnicodeString object (not necessarily its current buffer)
-  // is writable unless it isBogus() or it has an "open" getBuffer(minCapacity).
-  inline UBool isWritable() const;
-
-  // Is the current buffer writable?
-  inline UBool isBufferWritable() const;
-
-  // None of the following does releaseArray().
-  inline void setLength(int32_t len);        // sets only fShortLength and fLength
-  inline void setToEmpty();                  // sets fFlags=kShortString
-  inline void setArray(UChar *array, int32_t len, int32_t capacity); // does not set fFlags
-
-  // allocate the array; result may be fStackBuffer
-  // sets refCount to 1 if appropriate
-  // sets fArray, fCapacity, and fFlags
-  // returns boolean for success or failure
-  UBool allocate(int32_t capacity);
-
-  // release the array if owned
-  void releaseArray(void);
-
-  // turn a bogus string into an empty one
-  void unBogus();
-
-  // implements assigment operator, copy constructor, and fastCopyFrom()
-  UnicodeString &copyFrom(const UnicodeString &src, UBool fastCopy=FALSE);
-
-  // Pin start and limit to acceptable values.
-  inline void pinIndex(int32_t& start) const;
-  inline void pinIndices(int32_t& start,
-                         int32_t& length) const;
-
-#if !UCONFIG_NO_CONVERSION
-
-  /* Internal extract() using UConverter. */
-  int32_t doExtract(int32_t start, int32_t length,
-                    char *dest, int32_t destCapacity,
-                    UConverter *cnv,
-                    UErrorCode &errorCode) const;
-
-  /*
-   * Real constructor for converting from codepage data.
-   * It assumes that it is called with !fRefCounted.
-   *
-   * If <code>codepage==0</code>, then the default converter
-   * is used for the platform encoding.
-   * If <code>codepage</code> is an empty string (<code>""</code>),
-   * then a simple conversion is performed on the codepage-invariant
-   * subset ("invariant characters") of the platform encoding. See utypes.h.
-   */
-  void doCodepageCreate(const char *codepageData,
-                        int32_t dataLength,
-                        const char *codepage);
-
-  /*
-   * Worker function for creating a UnicodeString from
-   * a codepage string using a UConverter.
-   */
-  void
-  doCodepageCreate(const char *codepageData,
-                   int32_t dataLength,
-                   UConverter *converter,
-                   UErrorCode &status);
-
-#endif
-
-  /*
-   * This function is called when write access to the array
-   * is necessary.
-   *
-   * We need to make a copy of the array if
-   * the buffer is read-only, or
-   * the buffer is refCounted (shared), and refCount>1, or
-   * the buffer is too small.
-   *
-   * Return FALSE if memory could not be allocated.
-   */
-  UBool cloneArrayIfNeeded(int32_t newCapacity = -1,
-                            int32_t growCapacity = -1,
-                            UBool doCopyArray = TRUE,
-                            int32_t **pBufferToDelete = 0,
-                            UBool forceClone = FALSE);
-
-  // common function for case mappings
-  UnicodeString &
-  caseMap(BreakIterator *titleIter,
-          const char *locale,
-          uint32_t options,
-          int32_t toWhichCase);
-
-  // ref counting
-  void addRef(void);
-  int32_t removeRef(void);
-  int32_t refCount(void) const;
-
-  // constants
-  enum {
-    // Set the stack buffer size so that sizeof(UnicodeString) is a multiple of sizeof(pointer):
-    // 32-bit pointers: 4+1+1+13*2 = 32 bytes
-    // 64-bit pointers: 8+1+1+15*2 = 40 bytes
-    US_STACKBUF_SIZE= sizeof(void *)==4 ? 13 : 15, // Size of stack buffer for small strings
-    kInvalidUChar=0xffff, // invalid UChar index
-    kGrowSize=128, // grow size for this buffer
-    kInvalidHashCode=0, // invalid hash code
-    kEmptyHashCode=1, // hash code for empty string
-
-    // bit flag values for fFlags
-    kIsBogus=1,         // this string is bogus, i.e., not valid or NULL
-    kUsingStackBuffer=2,// fArray==fStackBuffer
-    kRefCounted=4,      // there is a refCount field before the characters in fArray
-    kBufferIsReadonly=8,// do not write to this buffer
-    kOpenGetBuffer=16,  // getBuffer(minCapacity) was called (is "open"),
-                        // and releaseBuffer(newLength) must be called
-
-    // combined values for convenience
-    kShortString=kUsingStackBuffer,
-    kLongString=kRefCounted,
-    kReadonlyAlias=kBufferIsReadonly,
-    kWritableAlias=0
-  };
-
-  friend class StringThreadTest;
-
-  union StackBufferOrFields;        // forward declaration necessary before friend declaration
-  friend union StackBufferOrFields; // make US_STACKBUF_SIZE visible inside fUnion
-
-  /*
-   * The following are all the class fields that are stored
-   * in each UnicodeString object.
-   * Note that UnicodeString has virtual functions,
-   * therefore there is an implicit vtable pointer
-   * as the first real field.
-   * The fields should be aligned such that no padding is
-   * necessary, mostly by having larger types first.
-   * On 32-bit machines, the size should be 32 bytes,
-   * on 64-bit machines (8-byte pointers), it should be 40 bytes.
-   */
-  // (implicit) *vtable;
-  int8_t    fShortLength;   // 0..127: length  <0: real length is in fUnion.fFields.fLength
-  uint8_t   fFlags;         // bit flags: see constants above
-  union StackBufferOrFields {
-    // fStackBuffer is used iff (fFlags&kUsingStackBuffer)
-    // else fFields is used
-    UChar     fStackBuffer [US_STACKBUF_SIZE]; // buffer for small strings
-    struct {
-      uint16_t  fPadding;   // align the following field at 8B (32b pointers) or 12B (64b)
-      int32_t   fLength;    // number of characters in fArray if >127; else undefined
-      UChar     *fArray;    // the Unicode data (aligned at 12B (32b pointers) or 16B (64b))
-      int32_t   fCapacity;  // sizeof fArray
-    } fFields;
-  } fUnion;
-};
-
-/**
- * Create a new UnicodeString with the concatenation of two others.
- *
- * @param s1 The first string to be copied to the new one.
- * @param s2 The second string to be copied to the new one, after s1.
- * @return UnicodeString(s1).append(s2)
- * @stable ICU 2.8
- */
-U_COMMON_API UnicodeString U_EXPORT2
-operator+ (const UnicodeString &s1, const UnicodeString &s2);
-
-//========================================
-// Inline members
-//========================================
-
-//========================================
-// Privates
-//========================================
-
-inline void
-UnicodeString::pinIndex(int32_t& start) const
-{
-  // pin index
-  if(start < 0) {
-    start = 0;
-  } else if(start > length()) {
-    start = length();
-  }
-}
-
-inline void
-UnicodeString::pinIndices(int32_t& start,
-                          int32_t& _length) const
-{
-  // pin indices
-  int32_t len = length();
-  if(start < 0) {
-    start = 0;
-  } else if(start > len) {
-    start = len;
-  }
-  if(_length < 0) {
-    _length = 0;
-  } else if(_length > (len - start)) {
-    _length = (len - start);
-  }
-}
-
-inline UChar*
-UnicodeString::getArrayStart()
-{ return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; }
-
-inline const UChar*
-UnicodeString::getArrayStart() const
-{ return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; }
-
-//========================================
-// Read-only implementation methods
-//========================================
-inline int32_t
-UnicodeString::length() const
-{ return fShortLength>=0 ? fShortLength : fUnion.fFields.fLength; }
-
-inline int32_t
-UnicodeString::getCapacity() const
-{ return (fFlags&kUsingStackBuffer) ? US_STACKBUF_SIZE : fUnion.fFields.fCapacity; }
-
-inline int32_t
-UnicodeString::hashCode() const
-{ return doHashCode(); }
-
-inline UBool
-UnicodeString::isBogus() const
-{ return (UBool)(fFlags & kIsBogus); }
-
-inline UBool
-UnicodeString::isWritable() const
-{ return (UBool)!(fFlags&(kOpenGetBuffer|kIsBogus)); }
-
-inline UBool
-UnicodeString::isBufferWritable() const
-{
-  return (UBool)(
-      !(fFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) &&
-      (!(fFlags&kRefCounted) || refCount()==1));
-}
-
-inline const UChar *
-UnicodeString::getBuffer() const {
-  if(fFlags&(kIsBogus|kOpenGetBuffer)) {
-    return 0;
-  } else if(fFlags&kUsingStackBuffer) {
-    return fUnion.fStackBuffer;
-  } else {
-    return fUnion.fFields.fArray;
-  }
-}
-
-//========================================
-// Read-only alias methods
-//========================================
-inline int8_t
-UnicodeString::doCompare(int32_t start,
-              int32_t thisLength,
-              const UnicodeString& srcText,
-              int32_t srcStart,
-              int32_t srcLength) const
-{
-  if(srcText.isBogus()) {
-    return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise
-  } else {
-    srcText.pinIndices(srcStart, srcLength);
-    return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
-  }
-}
-
-inline UBool
-UnicodeString::operator== (const UnicodeString& text) const
-{
-  if(isBogus()) {
-    return text.isBogus();
-  } else {
-    int32_t len = length(), textLength = text.length();
-    return
-      !text.isBogus() &&
-      len == textLength &&
-      doCompare(0, len, text, 0, textLength) == 0;
-  }
-}
-
-inline UBool
-UnicodeString::operator!= (const UnicodeString& text) const
-{ return (! operator==(text)); }
-
-inline UBool
-UnicodeString::operator> (const UnicodeString& text) const
-{ return doCompare(0, length(), text, 0, text.length()) == 1; }
-
-inline UBool
-UnicodeString::operator< (const UnicodeString& text) const
-{ return doCompare(0, length(), text, 0, text.length()) == -1; }
-
-inline UBool
-UnicodeString::operator>= (const UnicodeString& text) const
-{ return doCompare(0, length(), text, 0, text.length()) != -1; }
-
-inline UBool
-UnicodeString::operator<= (const UnicodeString& text) const
-{ return doCompare(0, length(), text, 0, text.length()) != 1; }
-
-inline int8_t
-UnicodeString::compare(const UnicodeString& text) const
-{ return doCompare(0, length(), text, 0, text.length()); }
-
-inline int8_t
-UnicodeString::compare(int32_t start,
-               int32_t _length,
-               const UnicodeString& srcText) const
-{ return doCompare(start, _length, srcText, 0, srcText.length()); }
-
-inline int8_t
-UnicodeString::compare(const UChar *srcChars,
-               int32_t srcLength) const
-{ return doCompare(0, length(), srcChars, 0, srcLength); }
-
-inline int8_t
-UnicodeString::compare(int32_t start,
-               int32_t _length,
-               const UnicodeString& srcText,
-               int32_t srcStart,
-               int32_t srcLength) const
-{ return doCompare(start, _length, srcText, srcStart, srcLength); }
-
-inline int8_t
-UnicodeString::compare(int32_t start,
-               int32_t _length,
-               const UChar *srcChars) const
-{ return doCompare(start, _length, srcChars, 0, _length); }
-
-inline int8_t
-UnicodeString::compare(int32_t start,
-               int32_t _length,
-               const UChar *srcChars,
-               int32_t srcStart,
-               int32_t srcLength) const
-{ return doCompare(start, _length, srcChars, srcStart, srcLength); }
-
-inline int8_t
-UnicodeString::compareBetween(int32_t start,
-                  int32_t limit,
-                  const UnicodeString& srcText,
-                  int32_t srcStart,
-                  int32_t srcLimit) const
-{ return doCompare(start, limit - start,
-           srcText, srcStart, srcLimit - srcStart); }
-
-inline int8_t
-UnicodeString::doCompareCodePointOrder(int32_t start,
-                                       int32_t thisLength,
-                                       const UnicodeString& srcText,
-                                       int32_t srcStart,
-                                       int32_t srcLength) const
-{
-  if(srcText.isBogus()) {
-    return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise
-  } else {
-    srcText.pinIndices(srcStart, srcLength);
-    return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
-  }
-}
-
-inline int8_t
-UnicodeString::compareCodePointOrder(const UnicodeString& text) const
-{ return doCompareCodePointOrder(0, length(), text, 0, text.length()); }
-
-inline int8_t
-UnicodeString::compareCodePointOrder(int32_t start,
-                                     int32_t _length,
-                                     const UnicodeString& srcText) const
-{ return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); }
-
-inline int8_t
-UnicodeString::compareCodePointOrder(const UChar *srcChars,
-                                     int32_t srcLength) const
-{ return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); }
-
-inline int8_t
-UnicodeString::compareCodePointOrder(int32_t start,
-                                     int32_t _length,
-                                     const UnicodeString& srcText,
-                                     int32_t srcStart,
-                                     int32_t srcLength) const
-{ return doCompareCodePointOrder(start, _length, srcText, srcStart, srcLength); }
-
-inline int8_t
-UnicodeString::compareCodePointOrder(int32_t start,
-                                     int32_t _length,
-                                     const UChar *srcChars) const
-{ return doCompareCodePointOrder(start, _length, srcChars, 0, _length); }
-
-inline int8_t
-UnicodeString::compareCodePointOrder(int32_t start,
-                                     int32_t _length,
-                                     const UChar *srcChars,
-                                     int32_t srcStart,
-                                     int32_t srcLength) const
-{ return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); }
-
-inline int8_t
-UnicodeString::compareCodePointOrderBetween(int32_t start,
-                                            int32_t limit,
-                                            const UnicodeString& srcText,
-                                            int32_t srcStart,
-                                            int32_t srcLimit) const
-{ return doCompareCodePointOrder(start, limit - start,
-           srcText, srcStart, srcLimit - srcStart); }
-
-inline int8_t
-UnicodeString::doCaseCompare(int32_t start,
-                             int32_t thisLength,
-                             const UnicodeString &srcText,
-                             int32_t srcStart,
-                             int32_t srcLength,
-                             uint32_t options) const
-{
-  if(srcText.isBogus()) {
-    return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise
-  } else {
-    srcText.pinIndices(srcStart, srcLength);
-    return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options);
-  }
-}
-
-inline int8_t
-UnicodeString::caseCompare(const UnicodeString &text, uint32_t options) const {
-  return doCaseCompare(0, length(), text, 0, text.length(), options);
-}
-
-inline int8_t
-UnicodeString::caseCompare(int32_t start,
-                           int32_t _length,
-                           const UnicodeString &srcText,
-                           uint32_t options) const {
-  return doCaseCompare(start, _length, srcText, 0, srcText.length(), options);
-}
-
-inline int8_t
-UnicodeString::caseCompare(const UChar *srcChars,
-                           int32_t srcLength,
-                           uint32_t options) const {
-  return doCaseCompare(0, length(), srcChars, 0, srcLength, options);
-}
-
-inline int8_t
-UnicodeString::caseCompare(int32_t start,
-                           int32_t _length,
-                           const UnicodeString &srcText,
-                           int32_t srcStart,
-                           int32_t srcLength,
-                           uint32_t options) const {
-  return doCaseCompare(start, _length, srcText, srcStart, srcLength, options);
-}
-
-inline int8_t
-UnicodeString::caseCompare(int32_t start,
-                           int32_t _length,
-                           const UChar *srcChars,
-                           uint32_t options) const {
-  return doCaseCompare(start, _length, srcChars, 0, _length, options);
-}
-
-inline int8_t
-UnicodeString::caseCompare(int32_t start,
-                           int32_t _length,
-                           const UChar *srcChars,
-                           int32_t srcStart,
-                           int32_t srcLength,
-                           uint32_t options) const {
-  return doCaseCompare(start, _length, srcChars, srcStart, srcLength, options);
-}
-
-inline int8_t
-UnicodeString::caseCompareBetween(int32_t start,
-                                  int32_t limit,
-                                  const UnicodeString &srcText,
-                                  int32_t srcStart,
-                                  int32_t srcLimit,
-                                  uint32_t options) const {
-  return doCaseCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart, options);
-}
-
-inline int32_t
-UnicodeString::indexOf(const UnicodeString& srcText,
-               int32_t srcStart,
-               int32_t srcLength,
-               int32_t start,
-               int32_t _length) const
-{
-  if(!srcText.isBogus()) {
-    srcText.pinIndices(srcStart, srcLength);
-    if(srcLength > 0) {
-      return indexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length);
-    }
-  }
-  return -1;
-}
-
-inline int32_t
-UnicodeString::indexOf(const UnicodeString& text) const
-{ return indexOf(text, 0, text.length(), 0, length()); }
-
-inline int32_t
-UnicodeString::indexOf(const UnicodeString& text,
-               int32_t start) const {
-  pinIndex(start);
-  return indexOf(text, 0, text.length(), start, length() - start);
-}
-
-inline int32_t
-UnicodeString::indexOf(const UnicodeString& text,
-               int32_t start,
-               int32_t _length) const
-{ return indexOf(text, 0, text.length(), start, _length); }
-
-inline int32_t
-UnicodeString::indexOf(const UChar *srcChars,
-               int32_t srcLength,
-               int32_t start) const {
-  pinIndex(start);
-  return indexOf(srcChars, 0, srcLength, start, length() - start);
-}
-
-inline int32_t
-UnicodeString::indexOf(const UChar *srcChars,
-               int32_t srcLength,
-               int32_t start,
-               int32_t _length) const
-{ return indexOf(srcChars, 0, srcLength, start, _length); }
-
-inline int32_t
-UnicodeString::indexOf(UChar c,
-               int32_t start,
-               int32_t _length) const
-{ return doIndexOf(c, start, _length); }
-
-inline int32_t
-UnicodeString::indexOf(UChar32 c,
-               int32_t start,
-               int32_t _length) const
-{ return doIndexOf(c, start, _length); }
-
-inline int32_t
-UnicodeString::indexOf(UChar c) const
-{ return doIndexOf(c, 0, length()); }
-
-inline int32_t
-UnicodeString::indexOf(UChar32 c) const
-{ return indexOf(c, 0, length()); }
-
-inline int32_t
-UnicodeString::indexOf(UChar c,
-               int32_t start) const {
-  pinIndex(start);
-  return doIndexOf(c, start, length() - start);
-}
-
-inline int32_t
-UnicodeString::indexOf(UChar32 c,
-               int32_t start) const {
-  pinIndex(start);
-  return indexOf(c, start, length() - start);
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(const UChar *srcChars,
-               int32_t srcLength,
-               int32_t start,
-               int32_t _length) const
-{ return lastIndexOf(srcChars, 0, srcLength, start, _length); }
-
-inline int32_t
-UnicodeString::lastIndexOf(const UChar *srcChars,
-               int32_t srcLength,
-               int32_t start) const {
-  pinIndex(start);
-  return lastIndexOf(srcChars, 0, srcLength, start, length() - start);
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(const UnicodeString& srcText,
-               int32_t srcStart,
-               int32_t srcLength,
-               int32_t start,
-               int32_t _length) const
-{
-  if(!srcText.isBogus()) {
-    srcText.pinIndices(srcStart, srcLength);
-    if(srcLength > 0) {
-      return lastIndexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length);
-    }
-  }
-  return -1;
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(const UnicodeString& text,
-               int32_t start,
-               int32_t _length) const
-{ return lastIndexOf(text, 0, text.length(), start, _length); }
-
-inline int32_t
-UnicodeString::lastIndexOf(const UnicodeString& text,
-               int32_t start) const {
-  pinIndex(start);
-  return lastIndexOf(text, 0, text.length(), start, length() - start);
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(const UnicodeString& text) const
-{ return lastIndexOf(text, 0, text.length(), 0, length()); }
-
-inline int32_t
-UnicodeString::lastIndexOf(UChar c,
-               int32_t start,
-               int32_t _length) const
-{ return doLastIndexOf(c, start, _length); }
-
-inline int32_t
-UnicodeString::lastIndexOf(UChar32 c,
-               int32_t start,
-               int32_t _length) const {
-  return doLastIndexOf(c, start, _length);
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(UChar c) const
-{ return doLastIndexOf(c, 0, length()); }
-
-inline int32_t
-UnicodeString::lastIndexOf(UChar32 c) const {
-  return lastIndexOf(c, 0, length());
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(UChar c,
-               int32_t start) const {
-  pinIndex(start);
-  return doLastIndexOf(c, start, length() - start);
-}
-
-inline int32_t
-UnicodeString::lastIndexOf(UChar32 c,
-               int32_t start) const {
-  pinIndex(start);
-  return lastIndexOf(c, start, length() - start);
-}
-
-inline UBool
-UnicodeString::startsWith(const UnicodeString& text) const
-{ return compare(0, text.length(), text, 0, text.length()) == 0; }
-
-inline UBool
-UnicodeString::startsWith(const UnicodeString& srcText,
-              int32_t srcStart,
-              int32_t srcLength) const
-{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; }
-
-inline UBool
-UnicodeString::startsWith(const UChar *srcChars,
-              int32_t srcLength) const
-{ return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; }
-
-inline UBool
-UnicodeString::startsWith(const UChar *srcChars,
-              int32_t srcStart,
-              int32_t srcLength) const
-{ return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;}
-
-inline UBool
-UnicodeString::endsWith(const UnicodeString& text) const
-{ return doCompare(length() - text.length(), text.length(),
-           text, 0, text.length()) == 0; }
-
-inline UBool
-UnicodeString::endsWith(const UnicodeString& srcText,
-            int32_t srcStart,
-            int32_t srcLength) const {
-  srcText.pinIndices(srcStart, srcLength);
-  return doCompare(length() - srcLength, srcLength,
-                   srcText, srcStart, srcLength) == 0;
-}
-
-inline UBool
-UnicodeString::endsWith(const UChar *srcChars,
-            int32_t srcLength) const {
-  if(srcLength < 0) {
-    srcLength = u_strlen(srcChars);
-  }
-  return doCompare(length() - srcLength, srcLength,
-                   srcChars, 0, srcLength) == 0;
-}
-
-inline UBool
-UnicodeString::endsWith(const UChar *srcChars,
-            int32_t srcStart,
-            int32_t srcLength) const {
-  if(srcLength < 0) {
-    srcLength = u_strlen(srcChars + srcStart);
-  }
-  return doCompare(length() - srcLength, srcLength,
-                   srcChars, srcStart, srcLength) == 0;
-}
-
-//========================================
-// replace
-//========================================
-inline UnicodeString&
-UnicodeString::replace(int32_t start,
-               int32_t _length,
-               const UnicodeString& srcText)
-{ return doReplace(start, _length, srcText, 0, srcText.length()); }
-
-inline UnicodeString&
-UnicodeString::replace(int32_t start,
-               int32_t _length,
-               const UnicodeString& srcText,
-               int32_t srcStart,
-               int32_t srcLength)
-{ return doReplace(start, _length, srcText, srcStart, srcLength); }
-
-inline UnicodeString&
-UnicodeString::replace(int32_t start,
-               int32_t _length,
-               const UChar *srcChars,
-               int32_t srcLength)
-{ return doReplace(start, _length, srcChars, 0, srcLength); }
-
-inline UnicodeString&
-UnicodeString::replace(int32_t start,
-               int32_t _length,
-               const UChar *srcChars,
-               int32_t srcStart,
-               int32_t srcLength)
-{ return doReplace(start, _length, srcChars, srcStart, srcLength); }
-
-inline UnicodeString&
-UnicodeString::replace(int32_t start,
-               int32_t _length,
-               UChar srcChar)
-{ return doReplace(start, _length, &srcChar, 0, 1); }
-
-inline UnicodeString&
-UnicodeString::replace(int32_t start,
-               int32_t _length,
-               UChar32 srcChar) {
-  UChar buffer[U16_MAX_LENGTH];
-  int32_t count = 0;
-  UBool isError = FALSE;
-  U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError);
-  return doReplace(start, _length, buffer, 0, count);
-}
-
-inline UnicodeString&
-UnicodeString::replaceBetween(int32_t start,
-                  int32_t limit,
-                  const UnicodeString& srcText)
-{ return doReplace(start, limit - start, srcText, 0, srcText.length()); }
-
-inline UnicodeString&
-UnicodeString::replaceBetween(int32_t start,
-                  int32_t limit,
-                  const UnicodeString& srcText,
-                  int32_t srcStart,
-                  int32_t srcLimit)
-{ return doReplace(start, limit - start, srcText, srcStart, srcLimit - srcStart); }
-
-inline UnicodeString&
-UnicodeString::findAndReplace(const UnicodeString& oldText,
-                  const UnicodeString& newText)
-{ return findAndReplace(0, length(), oldText, 0, oldText.length(),
-            newText, 0, newText.length()); }
-
-inline UnicodeString&
-UnicodeString::findAndReplace(int32_t start,
-                  int32_t _length,
-                  const UnicodeString& oldText,
-                  const UnicodeString& newText)
-{ return findAndReplace(start, _length, oldText, 0, oldText.length(),
-            newText, 0, newText.length()); }
-
-// ============================
-// extract
-// ============================
-inline void
-UnicodeString::doExtract(int32_t start,
-             int32_t _length,
-             UnicodeString& target) const
-{ target.replace(0, target.length(), *this, start, _length); }
-
-inline void
-UnicodeString::extract(int32_t start,
-               int32_t _length,
-               UChar *target,
-               int32_t targetStart) const
-{ doExtract(start, _length, target, targetStart); }
-
-inline void
-UnicodeString::extract(int32_t start,
-               int32_t _length,
-               UnicodeString& target) const
-{ doExtract(start, _length, target); }
-
-#if !UCONFIG_NO_CONVERSION
-
-inline int32_t
-UnicodeString::extract(int32_t start,
-               int32_t _length,
-               char *dst,
-               const char *codepage) const
-
-{
-  // This dstSize value will be checked explicitly
-  // Removed #if defined(__GNUC__) per ICU defect http://bugs.icu-project.org/trac/ticket/8197
-  return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
-}
-#endif
-
-inline void
-UnicodeString::extractBetween(int32_t start,
-                  int32_t limit,
-                  UChar *dst,
-                  int32_t dstStart) const {
-  pinIndex(start);
-  pinIndex(limit);
-  doExtract(start, limit - start, dst, dstStart);
-}
-
-inline UnicodeString
-UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const {
-    return tempSubString(start, limit - start);
-}
-
-inline UChar
-UnicodeString::doCharAt(int32_t offset) const
-{
-  if((uint32_t)offset < (uint32_t)length()) {
-    return getArrayStart()[offset];
-  } else {
-    return kInvalidUChar;
-  }
-}
-
-inline UChar
-UnicodeString::charAt(int32_t offset) const
-{ return doCharAt(offset); }
-
-inline UChar
-UnicodeString::operator[] (int32_t offset) const
-{ return doCharAt(offset); }
-
-inline UChar32
-UnicodeString::char32At(int32_t offset) const
-{
-  int32_t len = length();
-  if((uint32_t)offset < (uint32_t)len) {
-    const UChar *array = getArrayStart();
-    UChar32 c;
-    U16_GET(array, 0, offset, len, c);
-    return c;
-  } else {
-    return kInvalidUChar;
-  }
-}
-
-inline int32_t
-UnicodeString::getChar32Start(int32_t offset) const {
-  if((uint32_t)offset < (uint32_t)length()) {
-    const UChar *array = getArrayStart();
-    U16_SET_CP_START(array, 0, offset);
-    return offset;
-  } else {
-    return 0;
-  }
-}
-
-inline int32_t
-UnicodeString::getChar32Limit(int32_t offset) const {
-  int32_t len = length();
-  if((uint32_t)offset < (uint32_t)len) {
-    const UChar *array = getArrayStart();
-    U16_SET_CP_LIMIT(array, 0, offset, len);
-    return offset;
-  } else {
-    return len;
-  }
-}
-
-inline UBool
-UnicodeString::isEmpty() const {
-  return fShortLength == 0;
-}
-
-//========================================
-// Write implementation methods
-//========================================
-inline void
-UnicodeString::setLength(int32_t len) {
-  if(len <= 127) {
-    fShortLength = (int8_t)len;
-  } else {
-    fShortLength = (int8_t)-1;
-    fUnion.fFields.fLength = len;
-  }
-}
-
-inline void
-UnicodeString::setToEmpty() {
-  fShortLength = 0;
-  fFlags = kShortString;
-}
-
-inline void
-UnicodeString::setArray(UChar *array, int32_t len, int32_t capacity) {
-  setLength(len);
-  fUnion.fFields.fArray = array;
-  fUnion.fFields.fCapacity = capacity;
-}
-
-inline const UChar *
-UnicodeString::getTerminatedBuffer() {
-  if(!isWritable()) {
-    return 0;
-  } else {
-    UChar *array = getArrayStart();
-    int32_t len = length();
-    if(len < getCapacity() && ((fFlags&kRefCounted) == 0 || refCount() == 1)) {
-      /*
-       * kRefCounted: Do not write the NUL if the buffer is shared.
-       * That is mostly safe, except when the length of one copy was modified
-       * without copy-on-write, e.g., via truncate(newLength) or remove(void).
-       * Then the NUL would be written into the middle of another copy's string.
-       */
-      if(!(fFlags&kBufferIsReadonly)) {
-        /*
-         * We must not write to a readonly buffer, but it is known to be
-         * NUL-terminated if len<capacity.
-         * A shared, allocated buffer (refCount()>1) must not have its contents
-         * modified, but the NUL at [len] is beyond the string contents,
-         * and multiple string objects and threads writing the same NUL into the
-         * same location is harmless.
-         * In all other cases, the buffer is fully writable and it is anyway safe
-         * to write the NUL.
-         *
-         * Note: An earlier version of this code tested whether there is a NUL
-         * at [len] already, but, while safe, it generated lots of warnings from
-         * tools like valgrind and Purify.
-         */
-        array[len] = 0;
-      }
-      return array;
-    } else if(cloneArrayIfNeeded(len+1)) {
-      array = getArrayStart();
-      array[len] = 0;
-      return array;
-    } else {
-      return 0;
-    }
-  }
-}
-
-inline UnicodeString&
-UnicodeString::operator= (UChar ch)
-{ return doReplace(0, length(), &ch, 0, 1); }
-
-inline UnicodeString&
-UnicodeString::operator= (UChar32 ch)
-{ return replace(0, length(), ch); }
-
-inline UnicodeString&
-UnicodeString::setTo(const UnicodeString& srcText,
-             int32_t srcStart,
-             int32_t srcLength)
-{
-  unBogus();
-  return doReplace(0, length(), srcText, srcStart, srcLength);
-}
-
-inline UnicodeString&
-UnicodeString::setTo(const UnicodeString& srcText,
-             int32_t srcStart)
-{
-  unBogus();
-  srcText.pinIndex(srcStart);
-  return doReplace(0, length(), srcText, srcStart, srcText.length() - srcStart);
-}
-
-inline UnicodeString&
-UnicodeString::setTo(const UnicodeString& srcText)
-{
-  unBogus();
-  return doReplace(0, length(), srcText, 0, srcText.length());
-}
-
-inline UnicodeString&
-UnicodeString::setTo(const UChar *srcChars,
-             int32_t srcLength)
-{
-  unBogus();
-  return doReplace(0, length(), srcChars, 0, srcLength);
-}
-
-inline UnicodeString&
-UnicodeString::setTo(UChar srcChar)
-{
-  unBogus();
-  return doReplace(0, length(), &srcChar, 0, 1);
-}
-
-inline UnicodeString&
-UnicodeString::setTo(UChar32 srcChar)
-{
-  unBogus();
-  return replace(0, length(), srcChar);
-}
-
-inline UnicodeString&
-UnicodeString::append(const UnicodeString& srcText,
-              int32_t srcStart,
-              int32_t srcLength)
-{ return doReplace(length(), 0, srcText, srcStart, srcLength); }
-
-inline UnicodeString&
-UnicodeString::append(const UnicodeString& srcText)
-{ return doReplace(length(), 0, srcText, 0, srcText.length()); }
-
-inline UnicodeString&
-UnicodeString::append(const UChar *srcChars,
-              int32_t srcStart,
-              int32_t srcLength)
-{ return doReplace(length(), 0, srcChars, srcStart, srcLength); }
-
-inline UnicodeString&
-UnicodeString::append(const UChar *srcChars,
-              int32_t srcLength)
-{ return doReplace(length(), 0, srcChars, 0, srcLength); }
-
-inline UnicodeString&
-UnicodeString::append(UChar srcChar)
-{ return doReplace(length(), 0, &srcChar, 0, 1); }
-
-inline UnicodeString&
-UnicodeString::append(UChar32 srcChar) {
-  UChar buffer[U16_MAX_LENGTH];
-  int32_t _length = 0;
-  UBool isError = FALSE;
-  U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError);
-  return doReplace(length(), 0, buffer, 0, _length);
-}
-
-inline UnicodeString&
-UnicodeString::operator+= (UChar ch)
-{ return doReplace(length(), 0, &ch, 0, 1); }
-
-inline UnicodeString&
-UnicodeString::operator+= (UChar32 ch) {
-  return append(ch);
-}
-
-inline UnicodeString&
-UnicodeString::operator+= (const UnicodeString& srcText)
-{ return doReplace(length(), 0, srcText, 0, srcText.length()); }
-
-inline UnicodeString&
-UnicodeString::insert(int32_t start,
-              const UnicodeString& srcText,
-              int32_t srcStart,
-              int32_t srcLength)
-{ return doReplace(start, 0, srcText, srcStart, srcLength); }
-
-inline UnicodeString&
-UnicodeString::insert(int32_t start,
-              const UnicodeString& srcText)
-{ return doReplace(start, 0, srcText, 0, srcText.length()); }
-
-inline UnicodeString&
-UnicodeString::insert(int32_t start,
-              const UChar *srcChars,
-              int32_t srcStart,
-              int32_t srcLength)
-{ return doReplace(start, 0, srcChars, srcStart, srcLength); }
-
-inline UnicodeString&
-UnicodeString::insert(int32_t start,
-              const UChar *srcChars,
-              int32_t srcLength)
-{ return doReplace(start, 0, srcChars, 0, srcLength); }
-
-inline UnicodeString&
-UnicodeString::insert(int32_t start,
-              UChar srcChar)
-{ return doReplace(start, 0, &srcChar, 0, 1); }
-
-inline UnicodeString&
-UnicodeString::insert(int32_t start,
-              UChar32 srcChar)
-{ return replace(start, 0, srcChar); }
-
-
-inline UnicodeString&
-UnicodeString::remove()
-{
-  // remove() of a bogus string makes the string empty and non-bogus
-  // we also un-alias a read-only alias to deal with NUL-termination
-  // issues with getTerminatedBuffer()
-  if(fFlags & (kIsBogus|kBufferIsReadonly)) {
-    setToEmpty();
-  } else {
-    fShortLength = 0;
-  }
-  return *this;
-}
-
-inline UnicodeString&
-UnicodeString::remove(int32_t start,
-             int32_t _length)
-{
-    if(start <= 0 && _length == INT32_MAX) {
-        // remove(guaranteed everything) of a bogus string makes the string empty and non-bogus
-        return remove();
-    }
-    return doReplace(start, _length, NULL, 0, 0);
-}
-
-inline UnicodeString&
-UnicodeString::removeBetween(int32_t start,
-                int32_t limit)
-{ return doReplace(start, limit - start, NULL, 0, 0); }
-
-inline UnicodeString &
-UnicodeString::retainBetween(int32_t start, int32_t limit) {
-  truncate(limit);
-  return doReplace(0, start, NULL, 0, 0);
-}
-
-inline UBool
-UnicodeString::truncate(int32_t targetLength)
-{
-  if(isBogus() && targetLength == 0) {
-    // truncate(0) of a bogus string makes the string empty and non-bogus
-    unBogus();
-    return FALSE;
-  } else if((uint32_t)targetLength < (uint32_t)length()) {
-    setLength(targetLength);
-    if(fFlags&kBufferIsReadonly) {
-      fUnion.fFields.fCapacity = targetLength;  // not NUL-terminated any more
-    }
-    return TRUE;
-  } else {
-    return FALSE;
-  }
-}
-
-inline UnicodeString&
-UnicodeString::reverse()
-{ return doReverse(0, length()); }
-
-inline UnicodeString&
-UnicodeString::reverse(int32_t start,
-               int32_t _length)
-{ return doReverse(start, _length); }
-
-U_NAMESPACE_END
-
-#endif
diff --git a/Source/core/icu/unicode/unorm.h b/Source/core/icu/unicode/unorm.h
deleted file mode 100644
index fbb7b49..0000000
--- a/Source/core/icu/unicode/unorm.h
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
-*******************************************************************************
-* Copyright (c) 1996-2010, International Business Machines Corporation
-*               and others. All Rights Reserved.
-*******************************************************************************
-* File unorm.h
-*
-* Created by: Vladimir Weinstein 12052000
-*
-* Modification history :
-*
-* Date        Name        Description
-* 02/01/01    synwee      Added normalization quickcheck enum and method.
-*/
-#ifndef UNORM_H
-#define UNORM_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_NORMALIZATION
-
-#include "unicode/uiter.h"
-#include "unicode/unorm2.h"
-
-/**
- * \file
- * \brief C API: Unicode Normalization 
- *
- * <h2>Unicode normalization API</h2>
- *
- * Note: This API has been replaced by the unorm2.h API and is only available
- * for backward compatibility. The functions here simply delegate to the
- * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize().
- * There is one exception: The new API does not provide a replacement for unorm_compare().
- *
- * <code>unorm_normalize</code> transforms Unicode text into an equivalent composed or
- * decomposed form, allowing for easier sorting and searching of text.
- * <code>unorm_normalize</code> supports the standard normalization forms described in
- * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode">
- * Unicode Standard Annex #15: Unicode Normalization Forms</a>.
- *
- * Characters with accents or other adornments can be encoded in
- * several different ways in Unicode.  For example, take the character A-acute.
- * In Unicode, this can be encoded as a single character (the
- * "composed" form):
- *
- * \code
- *      00C1    LATIN CAPITAL LETTER A WITH ACUTE
- * \endcode
- *
- * or as two separate characters (the "decomposed" form):
- *
- * \code
- *      0041    LATIN CAPITAL LETTER A
- *      0301    COMBINING ACUTE ACCENT
- * \endcode
- *
- * To a user of your program, however, both of these sequences should be
- * treated as the same "user-level" character "A with acute accent".  When you are searching or
- * comparing text, you must ensure that these two sequences are treated 
- * equivalently.  In addition, you must handle characters with more than one
- * accent.  Sometimes the order of a character's combining accents is
- * significant, while in other cases accent sequences in different orders are
- * really equivalent.
- *
- * Similarly, the string "ffi" can be encoded as three separate letters:
- *
- * \code
- *      0066    LATIN SMALL LETTER F
- *      0066    LATIN SMALL LETTER F
- *      0069    LATIN SMALL LETTER I
- * \endcode
- *
- * or as the single character
- *
- * \code
- *      FB03    LATIN SMALL LIGATURE FFI
- * \endcode
- *
- * The ffi ligature is not a distinct semantic character, and strictly speaking
- * it shouldn't be in Unicode at all, but it was included for compatibility
- * with existing character sets that already provided it.  The Unicode standard
- * identifies such characters by giving them "compatibility" decompositions
- * into the corresponding semantic characters.  When sorting and searching, you
- * will often want to use these mappings.
- *
- * <code>unorm_normalize</code> helps solve these problems by transforming text into the
- * canonical composed and decomposed forms as shown in the first example above.  
- * In addition, you can have it perform compatibility decompositions so that 
- * you can treat compatibility characters the same as their equivalents.
- * Finally, <code>unorm_normalize</code> rearranges accents into the proper canonical
- * order, so that you do not have to worry about accent rearrangement on your
- * own.
- *
- * Form FCD, "Fast C or D", is also designed for collation.
- * It allows to work on strings that are not necessarily normalized
- * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed
- * characters and their decomposed equivalents the same.
- *
- * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings
- * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical
- * themselves.
- *
- * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character,
- * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long
- * as their decompositions do not need canonical reordering.
- *
- * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts -
- * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will
- * return UNORM_YES for most strings in practice.
- *
- * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD.
- *
- * For more details on FCD see the collation design document:
- * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm
- *
- * ICU collation performs either NFD or FCD normalization automatically if normalization
- * is turned on for the collator object.
- * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons,
- * transliteration/transcription, unique representations, etc.
- *
- * The W3C generally recommends to exchange texts in NFC.
- * Note also that most legacy character encodings use only precomposed forms and often do not
- * encode any combining marks by themselves. For conversion to such character encodings the
- * Unicode text needs to be normalized to NFC.
- * For more usage examples, see the Unicode Standard Annex.
- */
-
-/**
- * Constants for normalization modes.
- * @stable ICU 2.0
- */
-typedef enum {
-  /** No decomposition/composition. @stable ICU 2.0 */
-  UNORM_NONE = 1, 
-  /** Canonical decomposition. @stable ICU 2.0 */
-  UNORM_NFD = 2,
-  /** Compatibility decomposition. @stable ICU 2.0 */
-  UNORM_NFKD = 3,
-  /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */
-  UNORM_NFC = 4,
-  /** Default normalization. @stable ICU 2.0 */
-  UNORM_DEFAULT = UNORM_NFC, 
-  /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */
-  UNORM_NFKC =5,
-  /** "Fast C or D" form. @stable ICU 2.0 */
-  UNORM_FCD = 6,
-
-  /** One more than the highest normalization mode constant. @stable ICU 2.0 */
-  UNORM_MODE_COUNT
-} UNormalizationMode;
-
-/**
- * Constants for options flags for normalization.
- * Use 0 for default options,
- * including normalization according to the Unicode version
- * that is currently supported by ICU (see u_getUnicodeVersion).
- * @stable ICU 2.6
- */
-enum {
-    /**
-     * Options bit set value to select Unicode 3.2 normalization
-     * (except NormalizationCorrections).
-     * At most one Unicode version can be selected at a time.
-     * @stable ICU 2.6
-     */
-    UNORM_UNICODE_3_2=0x20
-};
-
-/**
- * Lowest-order bit number of unorm_compare() options bits corresponding to
- * normalization options bits.
- *
- * The options parameter for unorm_compare() uses most bits for
- * itself and for various comparison and folding flags.
- * The most significant bits, however, are shifted down and passed on
- * to the normalization implementation.
- * (That is, from unorm_compare(..., options, ...),
- * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the
- * internal normalization functions.)
- *
- * @see unorm_compare
- * @stable ICU 2.6
- */
-#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
-
-/**
- * Normalize a string.
- * The string will be normalized according the specified normalization mode
- * and options.
- * The source and result buffers must not be the same, nor overlap.
- *
- * @param source The string to normalize.
- * @param sourceLength The length of source, or -1 if NUL-terminated.
- * @param mode The normalization mode; one of UNORM_NONE, 
- *             UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT.
- * @param options The normalization options, ORed together (0 for no options).
- * @param result A pointer to a buffer to receive the result string.
- *               The result string is NUL-terminated if possible.
- * @param resultLength The maximum size of result.
- * @param status A pointer to a UErrorCode to receive any errors.
- * @return The total buffer size needed; if greater than resultLength,
- *         the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2 
-unorm_normalize(const UChar *source, int32_t sourceLength,
-                UNormalizationMode mode, int32_t options,
-                UChar *result, int32_t resultLength,
-                UErrorCode *status);
-
-/**
- * Performing quick check on a string, to quickly determine if the string is 
- * in a particular normalization format.
- * Three types of result can be returned UNORM_YES, UNORM_NO or
- * UNORM_MAYBE. Result UNORM_YES indicates that the argument
- * string is in the desired normalized format, UNORM_NO determines that
- * argument string is not in the desired normalized format. A 
- * UNORM_MAYBE result indicates that a more thorough check is required, 
- * the user may have to put the string in its normalized form and compare the 
- * results.
- *
- * @param source       string for determining if it is in a normalized format
- * @param sourcelength length of source to test, or -1 if NUL-terminated
- * @param mode         which normalization form to test for
- * @param status       a pointer to a UErrorCode to receive any errors
- * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
- *
- * @see unorm_isNormalized
- * @stable ICU 2.0
- */
-U_STABLE UNormalizationCheckResult U_EXPORT2
-unorm_quickCheck(const UChar *source, int32_t sourcelength,
-                 UNormalizationMode mode,
-                 UErrorCode *status);
-
-/**
- * Performing quick check on a string; same as unorm_quickCheck but
- * takes an extra options parameter like most normalization functions.
- *
- * @param src        String that is to be tested if it is in a normalization format.
- * @param srcLength  Length of source to test, or -1 if NUL-terminated.
- * @param mode       Which normalization form to test for.
- * @param options    The normalization options, ORed together (0 for no options).
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
- *
- * @see unorm_quickCheck
- * @see unorm_isNormalized
- * @stable ICU 2.6
- */
-U_STABLE UNormalizationCheckResult U_EXPORT2
-unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, 
-                            UNormalizationMode mode, int32_t options,
-                            UErrorCode *pErrorCode);
-
-/**
- * Test if a string is in a given normalization form.
- * This is semantically equivalent to source.equals(normalize(source, mode)) .
- *
- * Unlike unorm_quickCheck(), this function returns a definitive result,
- * never a "maybe".
- * For NFD, NFKD, and FCD, both functions work exactly the same.
- * For NFC and NFKC where quickCheck may return "maybe", this function will
- * perform further tests to arrive at a TRUE/FALSE result.
- *
- * @param src        String that is to be tested if it is in a normalization format.
- * @param srcLength  Length of source to test, or -1 if NUL-terminated.
- * @param mode       Which normalization form to test for.
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return Boolean value indicating whether the source string is in the
- *         "mode" normalization form.
- *
- * @see unorm_quickCheck
- * @stable ICU 2.2
- */
-U_STABLE UBool U_EXPORT2
-unorm_isNormalized(const UChar *src, int32_t srcLength,
-                   UNormalizationMode mode,
-                   UErrorCode *pErrorCode);
-
-/**
- * Test if a string is in a given normalization form; same as unorm_isNormalized but
- * takes an extra options parameter like most normalization functions.
- *
- * @param src        String that is to be tested if it is in a normalization format.
- * @param srcLength  Length of source to test, or -1 if NUL-terminated.
- * @param mode       Which normalization form to test for.
- * @param options    The normalization options, ORed together (0 for no options).
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return Boolean value indicating whether the source string is in the
- *         "mode/options" normalization form.
- *
- * @see unorm_quickCheck
- * @see unorm_isNormalized
- * @stable ICU 2.6
- */
-U_STABLE UBool U_EXPORT2
-unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
-                              UNormalizationMode mode, int32_t options,
-                              UErrorCode *pErrorCode);
-
-/**
- * Iterative normalization forward.
- * This function (together with unorm_previous) is somewhat
- * similar to the C++ Normalizer class (see its non-static functions).
- *
- * Iterative normalization is useful when only a small portion of a longer
- * string/text needs to be processed.
- *
- * For example, the likelihood may be high that processing the first 10% of some
- * text will be sufficient to find certain data.
- * Another example: When one wants to concatenate two normalized strings and get a
- * normalized result, it is much more efficient to normalize just a small part of
- * the result around the concatenation place instead of re-normalizing everything.
- *
- * The input text is an instance of the C character iteration API UCharIterator.
- * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any
- * other kind of text object.
- *
- * If a buffer overflow occurs, then the caller needs to reset the iterator to the
- * old index and call the function again with a larger buffer - if the caller cares
- * for the actual output.
- * Regardless of the output buffer, the iterator will always be moved to the next
- * normalization boundary.
- *
- * This function (like unorm_previous) serves two purposes:
- *
- * 1) To find the next boundary so that the normalization of the part of the text
- * from the current position to that boundary does not affect and is not affected
- * by the part of the text beyond that boundary.
- *
- * 2) To normalize the text up to the boundary.
- *
- * The second step is optional, per the doNormalize parameter.
- * It is omitted for operations like string concatenation, where the two adjacent
- * string ends need to be normalized together.
- * In such a case, the output buffer will just contain a copy of the text up to the
- * boundary.
- *
- * pNeededToNormalize is an output-only parameter. Its output value is only defined
- * if normalization was requested (doNormalize) and successful (especially, no
- * buffer overflow).
- * It is useful for operations like a normalizing transliterator, where one would
- * not want to replace a piece of text if it is not modified.
- *
- * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE
- * if the normalization was necessary.
- *
- * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE.
- *
- * If the buffer overflows, then *pNeededToNormalize will be undefined;
- * essentially, whenever U_FAILURE is true (like in buffer overflows), this result
- * will be undefined.
- *
- * @param src The input text in the form of a C character iterator.
- * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
- * @param destCapacity The number of UChars that fit into dest.
- * @param mode The normalization mode.
- * @param options The normalization options, ORed together (0 for no options).
- * @param doNormalize Indicates if the source text up to the next boundary
- *                    is to be normalized (TRUE) or just copied (FALSE).
- * @param pNeededToNormalize Output flag indicating if the normalization resulted in
- *                           different text from the input.
- *                           Not defined if an error occurs including buffer overflow.
- *                           Always FALSE if !doNormalize.
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return Length of output (number of UChars) when successful or buffer overflow.
- *
- * @see unorm_previous
- * @see unorm_normalize
- *
- * @stable ICU 2.1
- */
-U_STABLE int32_t U_EXPORT2
-unorm_next(UCharIterator *src,
-           UChar *dest, int32_t destCapacity,
-           UNormalizationMode mode, int32_t options,
-           UBool doNormalize, UBool *pNeededToNormalize,
-           UErrorCode *pErrorCode);
-
-/**
- * Iterative normalization backward.
- * This function (together with unorm_next) is somewhat
- * similar to the C++ Normalizer class (see its non-static functions).
- * For all details see unorm_next.
- *
- * @param src The input text in the form of a C character iterator.
- * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
- * @param destCapacity The number of UChars that fit into dest.
- * @param mode The normalization mode.
- * @param options The normalization options, ORed together (0 for no options).
- * @param doNormalize Indicates if the source text up to the next boundary
- *                    is to be normalized (TRUE) or just copied (FALSE).
- * @param pNeededToNormalize Output flag indicating if the normalization resulted in
- *                           different text from the input.
- *                           Not defined if an error occurs including buffer overflow.
- *                           Always FALSE if !doNormalize.
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return Length of output (number of UChars) when successful or buffer overflow.
- *
- * @see unorm_next
- * @see unorm_normalize
- *
- * @stable ICU 2.1
- */
-U_STABLE int32_t U_EXPORT2
-unorm_previous(UCharIterator *src,
-               UChar *dest, int32_t destCapacity,
-               UNormalizationMode mode, int32_t options,
-               UBool doNormalize, UBool *pNeededToNormalize,
-               UErrorCode *pErrorCode);
-
-/**
- * Concatenate normalized strings, making sure that the result is normalized as well.
- *
- * If both the left and the right strings are in
- * the normalization form according to "mode/options",
- * then the result will be
- *
- * \code
- *     dest=normalize(left+right, mode, options)
- * \endcode
- *
- * With the input strings already being normalized,
- * this function will use unorm_next() and unorm_previous()
- * to find the adjacent end pieces of the input strings.
- * Only the concatenation of these end pieces will be normalized and
- * then concatenated with the remaining parts of the input strings.
- *
- * It is allowed to have dest==left to avoid copying the entire left string.
- *
- * @param left Left source string, may be same as dest.
- * @param leftLength Length of left source string, or -1 if NUL-terminated.
- * @param right Right source string. Must not be the same as dest, nor overlap.
- * @param rightLength Length of right source string, or -1 if NUL-terminated.
- * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
- * @param destCapacity The number of UChars that fit into dest.
- * @param mode The normalization mode.
- * @param options The normalization options, ORed together (0 for no options).
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return Length of output (number of UChars) when successful or buffer overflow.
- *
- * @see unorm_normalize
- * @see unorm_next
- * @see unorm_previous
- *
- * @stable ICU 2.1
- */
-U_STABLE int32_t U_EXPORT2
-unorm_concatenate(const UChar *left, int32_t leftLength,
-                  const UChar *right, int32_t rightLength,
-                  UChar *dest, int32_t destCapacity,
-                  UNormalizationMode mode, int32_t options,
-                  UErrorCode *pErrorCode);
-
-/**
- * Option bit for unorm_compare:
- * Both input strings are assumed to fulfill FCD conditions.
- * @stable ICU 2.2
- */
-#define UNORM_INPUT_IS_FCD          0x20000
-
-/**
- * Option bit for unorm_compare:
- * Perform case-insensitive comparison.
- * @stable ICU 2.2
- */
-#define U_COMPARE_IGNORE_CASE       0x10000
-
-#ifndef U_COMPARE_CODE_POINT_ORDER
-/* see also unistr.h and ustring.h */
-/**
- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
- * Compare strings in code point order instead of code unit order.
- * @stable ICU 2.2
- */
-#define U_COMPARE_CODE_POINT_ORDER  0x8000
-#endif
-
-/**
- * Compare two strings for canonical equivalence.
- * Further options include case-insensitive comparison and
- * code point order (as opposed to code unit order).
- *
- * Canonical equivalence between two strings is defined as their normalized
- * forms (NFD or NFC) being identical.
- * This function compares strings incrementally instead of normalizing
- * (and optionally case-folding) both strings entirely,
- * improving performance significantly.
- *
- * Bulk normalization is only necessary if the strings do not fulfill the FCD
- * conditions. Only in this case, and only if the strings are relatively long,
- * is memory allocated temporarily.
- * For FCD strings and short non-FCD strings there is no memory allocation.
- *
- * Semantically, this is equivalent to
- *   strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
- * where code point order and foldCase are all optional.
- *
- * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
- * the case folding must be performed first, then the normalization.
- *
- * @param s1 First source string.
- * @param length1 Length of first source string, or -1 if NUL-terminated.
- *
- * @param s2 Second source string.
- * @param length2 Length of second source string, or -1 if NUL-terminated.
- *
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Case-sensitive comparison in code unit order, and the input strings
- *     are quick-checked for FCD.
- *
- *   - UNORM_INPUT_IS_FCD
- *     Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
- *     If not set, the function will quickCheck for FCD
- *     and normalize if necessary.
- *
- *   - U_COMPARE_CODE_POINT_ORDER
- *     Set to choose code point order instead of code unit order
- *     (see u_strCompare for details).
- *
- *   - U_COMPARE_IGNORE_CASE
- *     Set to compare strings case-insensitively using case folding,
- *     instead of case-sensitively.
- *     If set, then the following case folding options are used.
- *
- *   - Options as used with case-insensitive comparisons, currently:
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *    (see u_strCaseCompare for details)
- *
- *   - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
- *
- * @param pErrorCode ICU error code in/out parameter.
- *                   Must fulfill U_SUCCESS before the function call.
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @see unorm_normalize
- * @see UNORM_FCD
- * @see u_strCompare
- * @see u_strCaseCompare
- *
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-unorm_compare(const UChar *s1, int32_t length1,
-              const UChar *s2, int32_t length2,
-              uint32_t options,
-              UErrorCode *pErrorCode);
-
-#endif /* #if !UCONFIG_NO_NORMALIZATION */
-
-#endif
diff --git a/Source/core/icu/unicode/unorm2.h b/Source/core/icu/unicode/unorm2.h
deleted file mode 100644
index a522b47..0000000
--- a/Source/core/icu/unicode/unorm2.h
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2009-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  unorm2.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2009dec15
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __UNORM2_H__
-#define __UNORM2_H__
-
-/**
- * \file
- * \brief C API: New API for Unicode Normalization.
- *
- * Unicode normalization functionality for standard Unicode normalization or
- * for using custom mapping tables.
- * All instances of UNormalizer2 are unmodifiable/immutable.
- * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller.
- * For more details see the Normalizer2 C++ class.
- */
-
-#include "unicode/utypes.h"
-#include "unicode/localpointer.h"
-#include "unicode/uset.h"
-
-/**
- * Constants for normalization modes.
- * For details about standard Unicode normalization forms
- * and about the algorithms which are also used with custom mapping tables
- * see http://www.unicode.org/unicode/reports/tr15/
- * @stable ICU 4.4
- */
-typedef enum {
-    /**
-     * Decomposition followed by composition.
-     * Same as standard NFC when using an "nfc" instance.
-     * Same as standard NFKC when using an "nfkc" instance.
-     * For details about standard Unicode normalization forms
-     * see http://www.unicode.org/unicode/reports/tr15/
-     * @stable ICU 4.4
-     */
-    UNORM2_COMPOSE,
-    /**
-     * Map, and reorder canonically.
-     * Same as standard NFD when using an "nfc" instance.
-     * Same as standard NFKD when using an "nfkc" instance.
-     * For details about standard Unicode normalization forms
-     * see http://www.unicode.org/unicode/reports/tr15/
-     * @stable ICU 4.4
-     */
-    UNORM2_DECOMPOSE,
-    /**
-     * "Fast C or D" form.
-     * If a string is in this form, then further decomposition <i>without reordering</i>
-     * would yield the same form as DECOMPOSE.
-     * Text in "Fast C or D" form can be processed efficiently with data tables
-     * that are "canonically closed", that is, that provide equivalent data for
-     * equivalent text, without having to be fully normalized.
-     * Not a standard Unicode normalization form.
-     * Not a unique form: Different FCD strings can be canonically equivalent.
-     * For details see http://www.unicode.org/notes/tn5/#FCD
-     * @stable ICU 4.4
-     */
-    UNORM2_FCD,
-    /**
-     * Compose only contiguously.
-     * Also known as "FCC" or "Fast C Contiguous".
-     * The result will often but not always be in NFC.
-     * The result will conform to FCD which is useful for processing.
-     * Not a standard Unicode normalization form.
-     * For details see http://www.unicode.org/notes/tn5/#FCC
-     * @stable ICU 4.4
-     */
-    UNORM2_COMPOSE_CONTIGUOUS
-} UNormalization2Mode;
-
-/**
- * Result values for normalization quick check functions.
- * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
- * @stable ICU 2.0
- */
-typedef enum UNormalizationCheckResult {
-  /**
-   * The input string is not in the normalization form.
-   * @stable ICU 2.0
-   */
-  UNORM_NO,
-  /**
-   * The input string is in the normalization form.
-   * @stable ICU 2.0
-   */
-  UNORM_YES,
-  /**
-   * The input string may or may not be in the normalization form.
-   * This value is only returned for composition forms like NFC and FCC,
-   * when a backward-combining character is found for which the surrounding text
-   * would have to be analyzed further.
-   * @stable ICU 2.0
-   */
-  UNORM_MAYBE
-} UNormalizationCheckResult;
-
-/**
- * Opaque C service object type for the new normalization API.
- * @stable ICU 4.4
- */
-struct UNormalizer2;
-typedef struct UNormalizer2 UNormalizer2;  /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */
-
-#if !UCONFIG_NO_NORMALIZATION
-
-/**
- * Returns a UNormalizer2 instance which uses the specified data file
- * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
- * and which composes or decomposes text according to the specified mode.
- * Returns an unmodifiable singleton instance. Do not delete it.
- *
- * Use packageName=NULL for data files that are part of ICU's own data.
- * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
- * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
- * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
- *
- * @param packageName NULL for ICU built-in data, otherwise application data package name
- * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file
- * @param mode normalization mode (compose or decompose etc.)
- * @param pErrorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return the requested UNormalizer2, if successful
- * @stable ICU 4.4
- */
-U_STABLE const UNormalizer2 * U_EXPORT2
-unorm2_getInstance(const char *packageName,
-                   const char *name,
-                   UNormalization2Mode mode,
-                   UErrorCode *pErrorCode);
-
-/**
- * Constructs a filtered normalizer wrapping any UNormalizer2 instance
- * and a filter set.
- * Both are aliased and must not be modified or deleted while this object
- * is used.
- * The filter set should be frozen; otherwise the performance will suffer greatly.
- * @param norm2 wrapped UNormalizer2 instance
- * @param filterSet USet which determines the characters to be normalized
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return the requested UNormalizer2, if successful
- * @stable ICU 4.4
- */
-U_STABLE UNormalizer2 * U_EXPORT2
-unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
-
-/**
- * Closes a UNormalizer2 instance from unorm2_openFiltered().
- * Do not close instances from unorm2_getInstance()!
- * @param norm2 UNormalizer2 instance to be closed
- * @stable ICU 4.4
- */
-U_STABLE void U_EXPORT2
-unorm2_close(UNormalizer2 *norm2);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUNormalizer2Pointer
- * "Smart pointer" class, closes a UNormalizer2 via unorm2_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Writes the normalized form of the source string to the destination string
- * (replacing its contents) and returns the length of the destination string.
- * The source and destination strings must be different buffers.
- * @param norm2 UNormalizer2 instance
- * @param src source string
- * @param length length of the source string, or -1 if NUL-terminated
- * @param dest destination string; its contents is replaced with normalized src
- * @param capacity number of UChars that can be written to dest
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return dest
- * @stable ICU 4.4
- */
-U_STABLE int32_t U_EXPORT2
-unorm2_normalize(const UNormalizer2 *norm2,
-                 const UChar *src, int32_t length,
-                 UChar *dest, int32_t capacity,
-                 UErrorCode *pErrorCode);
-/**
- * Appends the normalized form of the second string to the first string
- * (merging them at the boundary) and returns the length of the first string.
- * The result is normalized if the first string was normalized.
- * The first and second strings must be different buffers.
- * @param norm2 UNormalizer2 instance
- * @param first string, should be normalized
- * @param firstLength length of the first string, or -1 if NUL-terminated
- * @param firstCapacity number of UChars that can be written to first
- * @param second string, will be normalized
- * @param secondLength length of the source string, or -1 if NUL-terminated
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return first
- * @stable ICU 4.4
- */
-U_STABLE int32_t U_EXPORT2
-unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
-                                UChar *first, int32_t firstLength, int32_t firstCapacity,
-                                const UChar *second, int32_t secondLength,
-                                UErrorCode *pErrorCode);
-/**
- * Appends the second string to the first string
- * (merging them at the boundary) and returns the length of the first string.
- * The result is normalized if both the strings were normalized.
- * The first and second strings must be different buffers.
- * @param norm2 UNormalizer2 instance
- * @param first string, should be normalized
- * @param firstLength length of the first string, or -1 if NUL-terminated
- * @param firstCapacity number of UChars that can be written to first
- * @param second string, should be normalized
- * @param secondLength length of the source string, or -1 if NUL-terminated
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return first
- * @stable ICU 4.4
- */
-U_STABLE int32_t U_EXPORT2
-unorm2_append(const UNormalizer2 *norm2,
-              UChar *first, int32_t firstLength, int32_t firstCapacity,
-              const UChar *second, int32_t secondLength,
-              UErrorCode *pErrorCode);
-
-/**
- * Gets the decomposition mapping of c. Equivalent to unorm2_normalize(string(c))
- * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster.
- * This function is independent of the mode of the UNormalizer2.
- * @param norm2 UNormalizer2 instance
- * @param c code point
- * @param decomposition String buffer which will be set to c's
- *                      decomposition mapping, if there is one.
- * @param capacity number of UChars that can be written to decomposition
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-unorm2_getDecomposition(const UNormalizer2 *norm2,
-                        UChar32 c, UChar *decomposition, int32_t capacity,
-                        UErrorCode *pErrorCode);
-
-/**
- * Tests if the string is normalized.
- * Internally, in cases where the quickCheck() method would return "maybe"
- * (which is only possible for the two COMPOSE modes) this method
- * resolves to "yes" or "no" to provide a definitive result,
- * at the cost of doing more work in those cases.
- * @param norm2 UNormalizer2 instance
- * @param s input string
- * @param length length of the string, or -1 if NUL-terminated
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return TRUE if s is normalized
- * @stable ICU 4.4
- */
-U_STABLE UBool U_EXPORT2
-unorm2_isNormalized(const UNormalizer2 *norm2,
-                    const UChar *s, int32_t length,
-                    UErrorCode *pErrorCode);
-
-/**
- * Tests if the string is normalized.
- * For the two COMPOSE modes, the result could be "maybe" in cases that
- * would take a little more work to resolve definitively.
- * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster
- * combination of quick check + normalization, to avoid
- * re-checking the "yes" prefix.
- * @param norm2 UNormalizer2 instance
- * @param s input string
- * @param length length of the string, or -1 if NUL-terminated
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return UNormalizationCheckResult
- * @stable ICU 4.4
- */
-U_STABLE UNormalizationCheckResult U_EXPORT2
-unorm2_quickCheck(const UNormalizer2 *norm2,
-                  const UChar *s, int32_t length,
-                  UErrorCode *pErrorCode);
-
-/**
- * Returns the end of the normalized substring of the input string.
- * In other words, with <code>end=spanQuickCheckYes(s, ec);</code>
- * the substring <code>UnicodeString(s, 0, end)</code>
- * will pass the quick check with a "yes" result.
- *
- * The returned end index is usually one or more characters before the
- * "no" or "maybe" character: The end index is at a normalization boundary.
- * (See the class documentation for more about normalization boundaries.)
- *
- * When the goal is a normalized string and most input strings are expected
- * to be normalized already, then call this method,
- * and if it returns a prefix shorter than the input string,
- * copy that prefix and use normalizeSecondAndAppend() for the remainder.
- * @param norm2 UNormalizer2 instance
- * @param s input string
- * @param length length of the string, or -1 if NUL-terminated
- * @param pErrorCode Standard ICU error code. Its input value must
- *                   pass the U_SUCCESS() test, or else the function returns
- *                   immediately. Check for U_FAILURE() on output or use with
- *                   function chaining. (See User Guide for details.)
- * @return "yes" span end index
- * @stable ICU 4.4
- */
-U_STABLE int32_t U_EXPORT2
-unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
-                         const UChar *s, int32_t length,
-                         UErrorCode *pErrorCode);
-
-/**
- * Tests if the character always has a normalization boundary before it,
- * regardless of context.
- * For details see the Normalizer2 base class documentation.
- * @param norm2 UNormalizer2 instance
- * @param c character to test
- * @return TRUE if c has a normalization boundary before it
- * @stable ICU 4.4
- */
-U_STABLE UBool U_EXPORT2
-unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
-
-/**
- * Tests if the character always has a normalization boundary after it,
- * regardless of context.
- * For details see the Normalizer2 base class documentation.
- * @param norm2 UNormalizer2 instance
- * @param c character to test
- * @return TRUE if c has a normalization boundary after it
- * @stable ICU 4.4
- */
-U_STABLE UBool U_EXPORT2
-unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
-
-/**
- * Tests if the character is normalization-inert.
- * For details see the Normalizer2 base class documentation.
- * @param norm2 UNormalizer2 instance
- * @param c character to test
- * @return TRUE if c is normalization-inert
- * @stable ICU 4.4
- */
-U_STABLE UBool U_EXPORT2
-unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
-
-#endif  /* !UCONFIG_NO_NORMALIZATION */
-#endif  /* __UNORM2_H__ */
diff --git a/Source/core/icu/unicode/uobject.h b/Source/core/icu/unicode/uobject.h
deleted file mode 100644
index 27d4c84..0000000
--- a/Source/core/icu/unicode/uobject.h
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
-******************************************************************************
-*
-*   Copyright (C) 2002-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-******************************************************************************
-*   file name:  uobject.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2002jun26
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __UOBJECT_H__
-#define __UOBJECT_H__
-
-#include "unicode/utypes.h"
-
-U_NAMESPACE_BEGIN
-
-/**
- * \file
- * \brief C++ API: Common ICU base class UObject.
- */
-
-/**  U_OVERRIDE_CXX_ALLOCATION - Define this to override operator new and
- *                               delete in UMemory. Enabled by default for ICU.
- *
- *         Enabling forces all allocation of ICU object types to use ICU's
- *         memory allocation. On Windows, this allows the ICU DLL to be used by
- *         applications that statically link the C Runtime library, meaning that
- *         the app and ICU will be using different heaps.
- *
- * @stable ICU 2.2
- */                              
-#ifndef U_OVERRIDE_CXX_ALLOCATION
-#define U_OVERRIDE_CXX_ALLOCATION 1
-#endif
-
-/** 
- * \def U_HAVE_PLACEMENT_NEW
- *  Define this to define the placement new and
- *                          delete in UMemory for STL.
- *
- * @stable ICU 2.6
- */                              
-#ifndef U_HAVE_PLACEMENT_NEW
-#define U_HAVE_PLACEMENT_NEW 1
-#endif
-
-
-/** 
- * \def U_HAVE_DEBUG_LOCATION_NEW 
- * Define this to define the MFC debug
- * version of the operator new.
- *
- * @stable ICU 3.4
- */                              
-#ifndef U_HAVE_DEBUG_LOCATION_NEW
-#define U_HAVE_DEBUG_LOCATION_NEW 0
-#endif
-
-/**
- * @{
- * \def U_NO_THROW
- *         Define this to define the throw() specification so
- *                 certain functions do not throw any exceptions
- *
- *         UMemory operator new methods should have the throw() specification 
- *         appended to them, so that the compiler adds the additional NULL check 
- *         before calling constructors. Without, if <code>operator new</code> returns NULL the 
- *         constructor is still called, and if the constructor references member 
- *         data, (which it typically does), the result is a segmentation violation.
- *
- * @draft ICU 4.2
- */                              
-#ifndef U_NO_THROW
-#define U_NO_THROW throw()
-#endif
-
-/** @} */
-
-/**
- * UMemory is the common ICU base class.
- * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4).
- *
- * This is primarily to make it possible and simple to override the
- * C++ memory management by adding new/delete operators to this base class.
- *
- * To override ALL ICU memory management, including that from plain C code,
- * replace the allocation functions declared in cmemory.h
- *
- * UMemory does not contain any virtual functions.
- * Common "boilerplate" functions are defined in UObject.
- *
- * @stable ICU 2.4
- */
-class U_COMMON_API UMemory {
-public:
-
-/* test versions for debugging shaper heap memory problems */
-#ifdef SHAPER_MEMORY_DEBUG  
-    static void * NewArray(int size, int count);
-    static void * GrowArray(void * array, int newSize );
-    static void   FreeArray(void * array );
-#endif
-
-#if U_OVERRIDE_CXX_ALLOCATION
-    /**
-     * Override for ICU4C C++ memory management.
-     * simple, non-class types are allocated using the macros in common/cmemory.h
-     * (uprv_malloc(), uprv_free(), uprv_realloc());
-     * they or something else could be used here to implement C++ new/delete
-     * for ICU4C C++ classes
-     * @stable ICU 2.4
-     */
-    static void * U_EXPORT2 operator new(size_t size) U_NO_THROW;
-
-    /**
-     * Override for ICU4C C++ memory management.
-     * See new().
-     * @stable ICU 2.4
-     */
-    static void * U_EXPORT2 operator new[](size_t size) U_NO_THROW;
-
-    /**
-     * Override for ICU4C C++ memory management.
-     * simple, non-class types are allocated using the macros in common/cmemory.h
-     * (uprv_malloc(), uprv_free(), uprv_realloc());
-     * they or something else could be used here to implement C++ new/delete
-     * for ICU4C C++ classes
-     * @stable ICU 2.4
-     */
-    static void U_EXPORT2 operator delete(void *p) U_NO_THROW;
-
-    /**
-     * Override for ICU4C C++ memory management.
-     * See delete().
-     * @stable ICU 2.4
-     */
-    static void U_EXPORT2 operator delete[](void *p) U_NO_THROW;
-
-#if U_HAVE_PLACEMENT_NEW
-    /**
-     * Override for ICU4C C++ memory management for STL.
-     * See new().
-     * @stable ICU 2.6
-     */
-    static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NO_THROW { return ptr; }
-
-    /**
-     * Override for ICU4C C++ memory management for STL.
-     * See delete().
-     * @stable ICU 2.6
-     */
-    static inline void U_EXPORT2 operator delete(void *, void *) U_NO_THROW {}
-#endif /* U_HAVE_PLACEMENT_NEW */
-#if U_HAVE_DEBUG_LOCATION_NEW
-    /**
-      * This method overrides the MFC debug version of the operator new
-      * 
-      * @param size   The requested memory size
-      * @param file   The file where the allocation was requested
-      * @param line   The line where the allocation was requested 
-      */ 
-    static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NO_THROW;
-    /**
-      * This method provides a matching delete for the MFC debug new
-      * 
-      * @param p      The pointer to the allocated memory
-      * @param file   The file where the allocation was requested
-      * @param line   The line where the allocation was requested 
-      */ 
-    static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NO_THROW;
-#endif /* U_HAVE_DEBUG_LOCATION_NEW */
-#endif /* U_OVERRIDE_CXX_ALLOCATION */
-
-    /*
-     * Assignment operator not declared. The compiler will provide one
-     * which does nothing since this class does not contain any data members.
-     * API/code coverage may show the assignment operator as present and
-     * untested - ignore.
-     * Subclasses need this assignment operator if they use compiler-provided
-     * assignment operators of their own. An alternative to not declaring one
-     * here would be to declare and empty-implement a protected or public one.
-    UMemory &UMemory::operator=(const UMemory &);
-     */
-};
-
-/**
- * UObject is the common ICU "boilerplate" class.
- * UObject inherits UMemory (starting with ICU 2.4),
- * and all other public ICU C++ classes
- * are derived from UObject (starting with ICU 2.2).
- *
- * UObject contains common virtual functions like for ICU's "poor man's RTTI".
- * It does not contain default implementations of virtual methods
- * like getDynamicClassID to allow derived classes such as Format
- * to declare these as pure virtual.
- *
- * The clone() function is not available in UObject because it is not
- * implemented by all ICU classes.
- * Many ICU services provide a clone() function for their class trees,
- * defined on the service's C++ base class, and all subclasses within that
- * service class tree return a pointer to the service base class
- * (which itself is a subclass of UObject).
- * This is because some compilers do not support covariant (same-as-this)
- * return types; cast to the appropriate subclass if necessary.
- *
- * @stable ICU 2.2
- */
-class U_COMMON_API UObject : public UMemory {
-public:
-    /**
-     * Destructor.
-     *
-     * @stable ICU 2.2
-     */
-    virtual ~UObject();
-
-    /**
-     * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
-     *
-     * @stable ICU 2.2
-     */
-    virtual UClassID getDynamicClassID() const = 0;
-
-protected:
-    // the following functions are protected to prevent instantiation and
-    // direct use of UObject itself
-
-    // default constructor
-    // commented out because UObject is abstract (see getDynamicClassID)
-    // inline UObject() {}
-
-    // copy constructor
-    // commented out because UObject is abstract (see getDynamicClassID)
-    // inline UObject(const UObject &other) {}
-
-#if 0
-    // TODO Sometime in the future. Implement operator==().
-    // (This comment inserted in 2.2)
-    // some or all of the following "boilerplate" functions may be made public
-    // in a future ICU4C release when all subclasses implement them
-
-    // assignment operator
-    // (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74)
-    // commented out because the implementation is the same as a compiler's default
-    // UObject &operator=(const UObject &other) { return *this; }
-
-    // comparison operators
-    virtual inline UBool operator==(const UObject &other) const { return this==&other; }
-    inline UBool operator!=(const UObject &other) const { return !operator==(other); }
-
-    // clone() commented out from the base class:
-    // some compilers do not support co-variant return types
-    // (i.e., subclasses would have to return UObject * as well, instead of SubClass *)
-    // see also UObject class documentation.
-    // virtual UObject *clone() const;
-#endif
-
-    /*
-     * Assignment operator not declared. The compiler will provide one
-     * which does nothing since this class does not contain any data members.
-     * API/code coverage may show the assignment operator as present and
-     * untested - ignore.
-     * Subclasses need this assignment operator if they use compiler-provided
-     * assignment operators of their own. An alternative to not declaring one
-     * here would be to declare and empty-implement a protected or public one.
-    UObject &UObject::operator=(const UObject &);
-     */
-
-// Future implementation for RTTI that support subtyping. [alan]
-// 
-//  public:
-//     /**
-//      * @internal
-//      */
-//     static UClassID getStaticClassID();
-// 
-//     /**
-//      * @internal
-//      */
-//     UBool instanceOf(UClassID type) const;
-};
-
-/**
- * This is a simple macro to add ICU RTTI to an ICU object implementation.
- * This does not go into the header. This should only be used in *.cpp files.
- *
- * @param myClass The name of the class that needs RTTI defined.
- * @internal
- */
-#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \
-    UClassID U_EXPORT2 myClass::getStaticClassID() { \
-        static char classID = 0; \
-        return (UClassID)&classID; \
-    } \
-    UClassID myClass::getDynamicClassID() const \
-    { return myClass::getStaticClassID(); }
-
-
-/**
- * This macro adds ICU RTTI to an ICU abstract class implementation.
- * This macro should be invoked in *.cpp files.  The corresponding
- * header should declare getStaticClassID.
- *
- * @param myClass The name of the class that needs RTTI defined.
- * @internal
- */
-#define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass) \
-    UClassID U_EXPORT2 myClass::getStaticClassID() { \
-        static char classID = 0; \
-        return (UClassID)&classID; \
-    }
-
-/**
- * This is a simple macro to express that a class and its subclasses do not offer
- * ICU's "poor man's RTTI".
- * Beginning with ICU 4.6, ICU requires C++ compiler RTTI.
- * This does not go into the header. This should only be used in *.cpp files.
- * Use this with a private getDynamicClassID() in an immediate subclass of UObject.
- *
- * @param myClass The name of the class that needs RTTI defined.
- * @internal
- */
-#define UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(myClass) \
-    UClassID myClass::getDynamicClassID() const { return NULL; }
-
-// /**
-//  * This macro adds ICU RTTI to an ICU concrete class implementation.
-//  * This macro should be invoked in *.cpp files.  The corresponding
-//  * header should declare getDynamicClassID and getStaticClassID.
-//  *
-//  * @param myClass The name of the class that needs RTTI defined.
-//  * @param myParent The name of the myClass's parent.
-//  * @internal
-//  */
-/*#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass, myParent) \
-    UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass, myParent) \
-    UClassID myClass::getDynamicClassID() const { \
-        return myClass::getStaticClassID(); \
-    }
-*/
-
-
-U_NAMESPACE_END
-
-#endif
diff --git a/Source/core/icu/unicode/urename.h b/Source/core/icu/unicode/urename.h
deleted file mode 100644
index 468bdbd..0000000
--- a/Source/core/icu/unicode/urename.h
+++ /dev/null
@@ -1,2241 +0,0 @@
-/*
-*******************************************************************************
-*   Copyright (C) 2002-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*******************************************************************************
-*
-*   file name:  urename.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   Created by: Perl script written by Vladimir Weinstein
-*
-*  Contains data for renaming ICU exports.
-*  Gets included by umachine.h
-*
-*  THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT
-*  YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN!
-*/
-
-#ifndef URENAME_H
-#define URENAME_H
-
-/* Uncomment the following line to disable renaming on platforms
-   that do not use Autoconf. */
-/* #define U_DISABLE_RENAMING 1 */
-
-#if !U_DISABLE_RENAMING
-
-/* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give
-   the platform a chance to define it first.
-   Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined.
- */
-#ifndef U_ICU_ENTRY_POINT_RENAME
-#include "unicode/umachine.h"
-#endif
-
-/* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */
-#ifndef U_ICU_ENTRY_POINT_RENAME
-#include "unicode/uvernum.h"
-#endif
-
-/* Error out before the following defines cause very strange and unexpected code breakage */
-#ifndef U_ICU_ENTRY_POINT_RENAME
-#error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used.
-#endif
-
-
-/* C exports renaming data */
-
-#define DECPOWERS U_ICU_ENTRY_POINT_RENAME(DECPOWERS)
-#define DECSTICKYTAB U_ICU_ENTRY_POINT_RENAME(DECSTICKYTAB)
-#define LNnn U_ICU_ENTRY_POINT_RENAME(LNnn)
-#define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString)
-#define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString)
-#define T_CString_stricmp U_ICU_ENTRY_POINT_RENAME(T_CString_stricmp)
-#define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger)
-#define T_CString_strnicmp U_ICU_ENTRY_POINT_RENAME(T_CString_strnicmp)
-#define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase)
-#define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase)
-#define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE)
-#define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP)
-#define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP)
-#define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE)
-#define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE)
-#define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP)
-#define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP)
-#define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE)
-#define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance)
-#define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init)
-#define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded)
-#define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer)
-#define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData)
-#define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign)
-#define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData)
-#define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data)
-#define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data)
-#define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData)
-#define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData)
-#define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData)
-#define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data)
-#define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1)
-#define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11)
-#define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16)
-#define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17)
-#define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18)
-#define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19)
-#define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2)
-#define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3)
-#define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4)
-#define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5)
-#define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6)
-#define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8)
-#define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data)
-#define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData)
-#define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData)
-#define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData)
-#define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data)
-#define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData)
-#define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData)
-#define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data)
-#define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData)
-#define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data)
-#define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data)
-#define bms_close U_ICU_ENTRY_POINT_RENAME(bms_close)
-#define bms_empty U_ICU_ENTRY_POINT_RENAME(bms_empty)
-#define bms_getData U_ICU_ENTRY_POINT_RENAME(bms_getData)
-#define bms_open U_ICU_ENTRY_POINT_RENAME(bms_open)
-#define bms_search U_ICU_ENTRY_POINT_RENAME(bms_search)
-#define bms_setTargetString U_ICU_ENTRY_POINT_RENAME(bms_setTargetString)
-#define buildWSConfusableData U_ICU_ENTRY_POINT_RENAME(buildWSConfusableData)
-#define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup)
-#define cmemory_inUse U_ICU_ENTRY_POINT_RENAME(cmemory_inUse)
-#define d2utable U_ICU_ENTRY_POINT_RENAME(d2utable)
-#define deleteCEList U_ICU_ENTRY_POINT_RENAME(deleteCEList)
-#define deleteChars U_ICU_ENTRY_POINT_RENAME(deleteChars)
-#define deleteCollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(deleteCollDataCacheEntry)
-#define deleteStringList U_ICU_ENTRY_POINT_RENAME(deleteStringList)
-#define deleteUnicodeStringKey U_ICU_ENTRY_POINT_RENAME(deleteUnicodeStringKey)
-#define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone)
-#define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close)
-#define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals)
-#define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings)
-#define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID)
-#define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart)
-#define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart)
-#define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName)
-#define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart)
-#define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart)
-#define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset)
-#define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID)
-#define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo)
-#define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open)
-#define le_close U_ICU_ENTRY_POINT_RENAME(le_close)
-#define le_create U_ICU_ENTRY_POINT_RENAME(le_create)
-#define le_getCharIndices U_ICU_ENTRY_POINT_RENAME(le_getCharIndices)
-#define le_getCharIndicesWithBase U_ICU_ENTRY_POINT_RENAME(le_getCharIndicesWithBase)
-#define le_getGlyphCount U_ICU_ENTRY_POINT_RENAME(le_getGlyphCount)
-#define le_getGlyphPosition U_ICU_ENTRY_POINT_RENAME(le_getGlyphPosition)
-#define le_getGlyphPositions U_ICU_ENTRY_POINT_RENAME(le_getGlyphPositions)
-#define le_getGlyphs U_ICU_ENTRY_POINT_RENAME(le_getGlyphs)
-#define le_layoutChars U_ICU_ENTRY_POINT_RENAME(le_layoutChars)
-#define le_reset U_ICU_ENTRY_POINT_RENAME(le_reset)
-#define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords)
-#define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart)
-#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default)
-#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default)
-#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun)
-#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun)
-#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun)
-#define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close)
-#define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns)
-#define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine)
-#define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns)
-#define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns)
-#define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns)
-#define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create)
-#define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent)
-#define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent)
-#define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount)
-#define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont)
-#define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit)
-#define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit)
-#define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading)
-#define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent)
-#define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent)
-#define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading)
-#define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun)
-#define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth)
-#define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount)
-#define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit)
-#define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit)
-#define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale)
-#define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel)
-#define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection)
-#define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount)
-#define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit)
-#define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit)
-#define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue)
-#define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent)
-#define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent)
-#define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection)
-#define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont)
-#define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount)
-#define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap)
-#define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs)
-#define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading)
-#define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions)
-#define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex)
-#define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine)
-#define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns)
-#define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns)
-#define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns)
-#define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns)
-#define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns)
-#define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns)
-#define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow)
-#define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns)
-#define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns)
-#define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns)
-#define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems)
-#define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource)
-#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias)
-#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem)
-#define res_getBinary U_ICU_ENTRY_POINT_RENAME(res_getBinary)
-#define res_getIntVector U_ICU_ENTRY_POINT_RENAME(res_getIntVector)
-#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType)
-#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource)
-#define res_getString U_ICU_ENTRY_POINT_RENAME(res_getString)
-#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex)
-#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey)
-#define res_load U_ICU_ENTRY_POINT_RENAME(res_load)
-#define res_read U_ICU_ENTRY_POINT_RENAME(res_read)
-#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload)
-#define tmutfmtHashTableValueComparator U_ICU_ENTRY_POINT_RENAME(tmutfmtHashTableValueComparator)
-#define triedict_swap U_ICU_ENTRY_POINT_RENAME(triedict_swap)
-#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars)
-#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy)
-#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy)
-#define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose)
-#define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets)
-#define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen)
-#define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge)
-#define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue)
-#define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection)
-#define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName)
-#define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror)
-#define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName)
-#define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType)
-#define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars)
-#define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup)
-#define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32)
-#define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit)
-#define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames)
-#define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes)
-#define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName)
-#define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt)
-#define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose)
-#define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof)
-#define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush)
-#define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter)
-#define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc)
-#define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage)
-#define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx)
-#define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile)
-#define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale)
-#define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets)
-#define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read)
-#define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write)
-#define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush)
-#define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit)
-#define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter)
-#define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase)
-#define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen)
-#define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit)
-#define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage)
-#define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError)
-#define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf)
-#define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u)
-#define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc)
-#define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs)
-#define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind)
-#define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf)
-#define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u)
-#define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage)
-#define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale)
-#define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator)
-#define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen)
-#define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc)
-#define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass)
-#define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory)
-#define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion)
-#define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter)
-#define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure)
-#define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment)
-#define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue)
-#define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue)
-#define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue)
-#define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue)
-#define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum)
-#define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName)
-#define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum)
-#define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName)
-#define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties)
-#define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion)
-#define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion)
-#define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty)
-#define u_init U_ICU_ENTRY_POINT_RENAME(u_init)
-#define u_isDataOlder U_ICU_ENTRY_POINT_RENAME(u_isDataOlder)
-#define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable)
-#define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart)
-#define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart)
-#define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl)
-#define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart)
-#define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart)
-#define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar)
-#define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored)
-#define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic)
-#define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase)
-#define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase)
-#define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace)
-#define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace)
-#define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum)
-#define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX)
-#define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha)
-#define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase)
-#define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank)
-#define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl)
-#define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined)
-#define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit)
-#define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph)
-#define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX)
-#define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower)
-#define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint)
-#define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX)
-#define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct)
-#define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace)
-#define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle)
-#define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper)
-#define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit)
-#define u_lengthOfIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_lengthOfIdenticalLevelRun)
-#define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close)
-#define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat)
-#define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init)
-#define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp)
-#define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr)
-#define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32)
-#define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp)
-#define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder)
-#define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy)
-#define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove)
-#define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr)
-#define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32)
-#define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset)
-#define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage)
-#define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError)
-#define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse)
-#define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter)
-#define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse)
-#define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions)
-#define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory)
-#define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions)
-#define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions)
-#define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic)
-#define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf)
-#define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u)
-#define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf)
-#define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u)
-#define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf)
-#define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u)
-#define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare)
-#define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare)
-#define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter)
-#define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst)
-#define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast)
-#define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase)
-#define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub)
-#define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode)
-#define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32)
-#define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub)
-#define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8)
-#define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient)
-#define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub)
-#define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS)
-#define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than)
-#define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8)
-#define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower)
-#define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode)
-#define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle)
-#define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32)
-#define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub)
-#define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8)
-#define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub)
-#define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper)
-#define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS)
-#define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp)
-#define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat)
-#define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr)
-#define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32)
-#define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp)
-#define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder)
-#define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold)
-#define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy)
-#define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn)
-#define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen)
-#define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp)
-#define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat)
-#define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp)
-#define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder)
-#define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy)
-#define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk)
-#define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr)
-#define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32)
-#define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr)
-#define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn)
-#define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr)
-#define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r)
-#define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars)
-#define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s)
-#define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars)
-#define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars)
-#define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower)
-#define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle)
-#define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper)
-#define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy)
-#define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy)
-#define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape)
-#define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt)
-#define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString)
-#define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString)
-#define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString)
-#define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage)
-#define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError)
-#define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf)
-#define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u)
-#define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf)
-#define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u)
-#define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage)
-#define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError)
-#define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf)
-#define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u)
-#define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf)
-#define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u)
-#define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf)
-#define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u)
-#define u_writeDiff U_ICU_ENTRY_POINT_RENAME(u_writeDiff)
-#define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun)
-#define u_writeIdenticalLevelRunTwoChars U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRunTwoChars)
-#define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts)
-#define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close)
-#define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs)
-#define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns)
-#define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection)
-#define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass)
-#define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback)
-#define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass)
-#define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection)
-#define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup)
-#define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType)
-#define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength)
-#define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt)
-#define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels)
-#define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex)
-#define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap)
-#define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun)
-#define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue)
-#define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory)
-#define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror)
-#define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel)
-#define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph)
-#define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex)
-#define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength)
-#define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode)
-#define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions)
-#define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength)
-#define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns)
-#define ubidi_getSingleton U_ICU_ENTRY_POINT_RENAME(ubidi_getSingleton)
-#define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText)
-#define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex)
-#define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap)
-#define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun)
-#define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap)
-#define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl)
-#define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse)
-#define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl)
-#define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored)
-#define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR)
-#define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open)
-#define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized)
-#define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR)
-#define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical)
-#define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual)
-#define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback)
-#define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse)
-#define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine)
-#define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara)
-#define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode)
-#define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions)
-#define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered)
-#define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse)
-#define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode)
-#define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close)
-#define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable)
-#define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current)
-#define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first)
-#define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following)
-#define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable)
-#define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType)
-#define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus)
-#define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec)
-#define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary)
-#define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last)
-#define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next)
-#define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open)
-#define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules)
-#define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding)
-#define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous)
-#define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone)
-#define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText)
-#define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText)
-#define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap)
-#define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add)
-#define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear)
-#define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField)
-#define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone)
-#define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close)
-#define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable)
-#define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo)
-#define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get)
-#define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute)
-#define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable)
-#define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID)
-#define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings)
-#define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType)
-#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone)
-#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange)
-#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale)
-#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit)
-#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType)
-#define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis)
-#define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow)
-#define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion)
-#define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName)
-#define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType)
-#define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition)
-#define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime)
-#define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet)
-#define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend)
-#define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open)
-#define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones)
-#define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones)
-#define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll)
-#define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set)
-#define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute)
-#define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate)
-#define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime)
-#define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone)
-#define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange)
-#define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis)
-#define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone)
-#define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure)
-#define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts)
-#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure)
-#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold)
-#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale)
-#define ucase_getSingleton U_ICU_ENTRY_POINT_RENAME(ucase_getSingleton)
-#define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType)
-#define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable)
-#define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty)
-#define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive)
-#define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted)
-#define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding)
-#define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower)
-#define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle)
-#define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper)
-#define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower)
-#define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle)
-#define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper)
-#define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close)
-#define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator)
-#define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale)
-#define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions)
-#define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open)
-#define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator)
-#define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale)
-#define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions)
-#define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle)
-#define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase)
-#define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower)
-#define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle)
-#define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper)
-#define ucd_close U_ICU_ENTRY_POINT_RENAME(ucd_close)
-#define ucd_flushCache U_ICU_ENTRY_POINT_RENAME(ucd_flushCache)
-#define ucd_freeCache U_ICU_ENTRY_POINT_RENAME(ucd_freeCache)
-#define ucd_getCollator U_ICU_ENTRY_POINT_RENAME(ucd_getCollator)
-#define ucd_open U_ICU_ENTRY_POINT_RENAME(ucd_open)
-#define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts)
-#define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames)
-#define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne)
-#define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup)
-#define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup)
-#define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup)
-#define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup)
-#define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup)
-#define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32)
-#define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets)
-#define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode)
-#define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType)
-#define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode)
-#define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte)
-#define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar)
-#define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets)
-#define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters)
-#define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter)
-#define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter)
-#define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes)
-#define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub)
-#define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars)
-#define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub)
-#define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars)
-#define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close)
-#define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames)
-#define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert)
-#define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx)
-#define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases)
-#define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable)
-#define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards)
-#define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter)
-#define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter)
-#define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage)
-#define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData)
-#define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature)
-#define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU)
-#define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU)
-#define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet)
-#define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU)
-#define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU)
-#define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU)
-#define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU)
-#define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator)
-#define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache)
-#define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic)
-#define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars)
-#define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending)
-#define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes)
-#define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode)
-#define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8)
-#define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC)
-#define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias)
-#define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases)
-#define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName)
-#define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID)
-#define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName)
-#define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet)
-#define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName)
-#define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName)
-#define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack)
-#define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars)
-#define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars)
-#define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize)
-#define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize)
-#define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName)
-#define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar)
-#define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet)
-#define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform)
-#define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard)
-#define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName)
-#define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters)
-#define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars)
-#define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack)
-#define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType)
-#define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet)
-#define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount)
-#define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters)
-#define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName)
-#define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare)
-#define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare)
-#define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous)
-#define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load)
-#define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData)
-#define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open)
-#define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames)
-#define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID)
-#define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage)
-#define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames)
-#define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU)
-#define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset)
-#define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode)
-#define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode)
-#define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone)
-#define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName)
-#define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback)
-#define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack)
-#define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars)
-#define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString)
-#define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack)
-#define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap)
-#define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases)
-#define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic)
-#define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars)
-#define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending)
-#define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint)
-#define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars)
-#define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode)
-#define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload)
-#define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady)
-#define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback)
-#define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close)
-#define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open)
-#define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized)
-#define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString)
-#define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8)
-#define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize)
-#define ucol_allocWeights U_ICU_ENTRY_POINT_RENAME(ucol_allocWeights)
-#define ucol_assembleTailoringTable U_ICU_ENTRY_POINT_RENAME(ucol_assembleTailoringTable)
-#define ucol_buildPermutationTable U_ICU_ENTRY_POINT_RENAME(ucol_buildPermutationTable)
-#define ucol_calcSortKey U_ICU_ENTRY_POINT_RENAME(ucol_calcSortKey)
-#define ucol_calcSortKeySimpleTertiary U_ICU_ENTRY_POINT_RENAME(ucol_calcSortKeySimpleTertiary)
-#define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary)
-#define ucol_cloneRuleData U_ICU_ENTRY_POINT_RENAME(ucol_cloneRuleData)
-#define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close)
-#define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements)
-#define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable)
-#define ucol_createElements U_ICU_ENTRY_POINT_RENAME(ucol_createElements)
-#define ucol_doCE U_ICU_ENTRY_POINT_RENAME(ucol_doCE)
-#define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal)
-#define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals)
-#define ucol_findReorderingEntry U_ICU_ENTRY_POINT_RENAME(ucol_findReorderingEntry)
-#define ucol_forceHanImplicit U_ICU_ENTRY_POINT_RENAME(ucol_forceHanImplicit)
-#define ucol_forgetUCA U_ICU_ENTRY_POINT_RENAME(ucol_forgetUCA)
-#define ucol_freeOffsetBuffer U_ICU_ENTRY_POINT_RENAME(ucol_freeOffsetBuffer)
-#define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute)
-#define ucol_getAttributeOrDefault U_ICU_ENTRY_POINT_RENAME(ucol_getAttributeOrDefault)
-#define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable)
-#define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound)
-#define ucol_getCEStrengthDifference U_ICU_ENTRY_POINT_RENAME(ucol_getCEStrengthDifference)
-#define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions)
-#define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions)
-#define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName)
-#define ucol_getFirstCE U_ICU_ENTRY_POINT_RENAME(ucol_getFirstCE)
-#define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent)
-#define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues)
-#define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale)
-#define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords)
-#define ucol_getLeadBytesForReorderCode U_ICU_ENTRY_POINT_RENAME(ucol_getLeadBytesForReorderCode)
-#define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale)
-#define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType)
-#define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion)
-#define ucol_getNextCE U_ICU_ENTRY_POINT_RENAME(ucol_getNextCE)
-#define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset)
-#define ucol_getPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_getPrevCE)
-#define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes)
-#define ucol_getReorderCodesForLeadByte U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodesForLeadByte)
-#define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules)
-#define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx)
-#define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString)
-#define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey)
-#define ucol_getSortKeySize U_ICU_ENTRY_POINT_RENAME(ucol_getSortKeySize)
-#define ucol_getSortKeyWithAllocation U_ICU_ENTRY_POINT_RENAME(ucol_getSortKeyWithAllocation)
-#define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength)
-#define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet)
-#define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion)
-#define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet)
-#define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop)
-#define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion)
-#define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater)
-#define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual)
-#define ucol_initBuffers U_ICU_ENTRY_POINT_RENAME(ucol_initBuffers)
-#define ucol_initCollator U_ICU_ENTRY_POINT_RENAME(ucol_initCollator)
-#define ucol_initInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_initInverseUCA)
-#define ucol_initUCA U_ICU_ENTRY_POINT_RENAME(ucol_initUCA)
-#define ucol_inv_getNextCE U_ICU_ENTRY_POINT_RENAME(ucol_inv_getNextCE)
-#define ucol_inv_getPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_inv_getPrevCE)
-#define ucol_isTailored U_ICU_ENTRY_POINT_RENAME(ucol_isTailored)
-#define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode)
-#define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary)
-#define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys)
-#define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next)
-#define ucol_nextProcessed U_ICU_ENTRY_POINT_RENAME(ucol_nextProcessed)
-#define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart)
-#define ucol_nextWeight U_ICU_ENTRY_POINT_RENAME(ucol_nextWeight)
-#define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString)
-#define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open)
-#define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales)
-#define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary)
-#define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements)
-#define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString)
-#define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules)
-#define ucol_openRulesForImport U_ICU_ENTRY_POINT_RENAME(ucol_openRulesForImport)
-#define ucol_open_internal U_ICU_ENTRY_POINT_RENAME(ucol_open_internal)
-#define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen)
-#define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous)
-#define ucol_previousProcessed U_ICU_ENTRY_POINT_RENAME(ucol_previousProcessed)
-#define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder)
-#define ucol_prv_getSpecialCE U_ICU_ENTRY_POINT_RENAME(ucol_prv_getSpecialCE)
-#define ucol_prv_getSpecialPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_prv_getSpecialPrevCE)
-#define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset)
-#define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop)
-#define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone)
-#define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder)
-#define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute)
-#define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset)
-#define ucol_setOptionsFromHeader U_ICU_ENTRY_POINT_RENAME(ucol_setOptionsFromHeader)
-#define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes)
-#define ucol_setReqValidLocales U_ICU_ENTRY_POINT_RENAME(ucol_setReqValidLocales)
-#define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength)
-#define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText)
-#define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop)
-#define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll)
-#define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter)
-#define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap)
-#define ucol_swapBinary U_ICU_ENTRY_POINT_RENAME(ucol_swapBinary)
-#define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA)
-#define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder)
-#define ucol_tok_assembleTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_assembleTokenList)
-#define ucol_tok_closeTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_closeTokenList)
-#define ucol_tok_getNextArgument U_ICU_ENTRY_POINT_RENAME(ucol_tok_getNextArgument)
-#define ucol_tok_getRulesFromBundle U_ICU_ENTRY_POINT_RENAME(ucol_tok_getRulesFromBundle)
-#define ucol_tok_initTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_initTokenList)
-#define ucol_tok_parseNextToken U_ICU_ENTRY_POINT_RENAME(ucol_tok_parseNextToken)
-#define ucol_updateInternalState U_ICU_ENTRY_POINT_RENAME(ucol_updateInternalState)
-#define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close)
-#define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect)
-#define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll)
-#define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter)
-#define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets)
-#define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence)
-#define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage)
-#define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName)
-#define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars)
-#define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled)
-#define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open)
-#define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding)
-#define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText)
-#define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies)
-#define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale)
-#define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate)
-#define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits)
-#define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale)
-#define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName)
-#define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName)
-#define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement)
-#define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies)
-#define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register)
-#define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister)
-#define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern)
-#define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative)
-#define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone)
-#define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close)
-#define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable)
-#define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols)
-#define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format)
-#define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart)
-#define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable)
-#define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar)
-#define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType)
-#define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat)
-#define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols)
-#define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient)
-#define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open)
-#define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse)
-#define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar)
-#define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart)
-#define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar)
-#define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient)
-#define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat)
-#define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols)
-#define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField)
-#define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern)
-#define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate)
-#define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime)
-#define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData)
-#define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close)
-#define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper)
-#define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize)
-#define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo)
-#define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize)
-#define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength)
-#define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory)
-#define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory)
-#define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open)
-#define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice)
-#define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper)
-#define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData)
-#define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError)
-#define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16)
-#define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32)
-#define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData)
-#define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData)
-#define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess)
-#define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader)
-#define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock)
-#define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern)
-#define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone)
-#define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close)
-#define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat)
-#define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName)
-#define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton)
-#define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern)
-#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions)
-#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat)
-#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal)
-#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton)
-#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton)
-#define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open)
-#define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons)
-#define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty)
-#define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons)
-#define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes)
-#define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions)
-#define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat)
-#define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName)
-#define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat)
-#define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal)
-#define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close)
-#define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count)
-#define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next)
-#define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault)
-#define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration)
-#define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration)
-#define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset)
-#define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext)
-#define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault)
-#define ufile_close_translit U_ICU_ENTRY_POINT_RENAME(ufile_close_translit)
-#define ufile_fill_uchar_buffer U_ICU_ENTRY_POINT_RENAME(ufile_fill_uchar_buffer)
-#define ufile_flush_io U_ICU_ENTRY_POINT_RENAME(ufile_flush_io)
-#define ufile_flush_translit U_ICU_ENTRY_POINT_RENAME(ufile_flush_translit)
-#define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch)
-#define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32)
-#define ufmt_64tou U_ICU_ENTRY_POINT_RENAME(ufmt_64tou)
-#define ufmt_defaultCPToUnicode U_ICU_ENTRY_POINT_RENAME(ufmt_defaultCPToUnicode)
-#define ufmt_digitvalue U_ICU_ENTRY_POINT_RENAME(ufmt_digitvalue)
-#define ufmt_isdigit U_ICU_ENTRY_POINT_RENAME(ufmt_isdigit)
-#define ufmt_ptou U_ICU_ENTRY_POINT_RENAME(ufmt_ptou)
-#define ufmt_uto64 U_ICU_ENTRY_POINT_RENAME(ufmt_uto64)
-#define ufmt_utop U_ICU_ENTRY_POINT_RENAME(ufmt_utop)
-#define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close)
-#define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString)
-#define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars)
-#define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars)
-#define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong)
-#define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars)
-#define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString)
-#define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count)
-#define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable)
-#define uhash_deleteUObject U_ICU_ENTRY_POINT_RENAME(uhash_deleteUObject)
-#define uhash_deleteUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_deleteUnicodeString)
-#define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals)
-#define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find)
-#define uhash_freeBlock U_ICU_ENTRY_POINT_RENAME(uhash_freeBlock)
-#define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get)
-#define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti)
-#define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString)
-#define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars)
-#define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars)
-#define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong)
-#define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars)
-#define uhash_hashUCharsN U_ICU_ENTRY_POINT_RENAME(uhash_hashUCharsN)
-#define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString)
-#define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget)
-#define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti)
-#define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init)
-#define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput)
-#define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi)
-#define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove)
-#define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei)
-#define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement)
-#define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open)
-#define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize)
-#define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put)
-#define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti)
-#define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove)
-#define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll)
-#define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement)
-#define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei)
-#define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator)
-#define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter)
-#define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher)
-#define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy)
-#define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator)
-#define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter)
-#define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII)
-#define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode)
-#define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close)
-#define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare)
-#define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII)
-#define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8)
-#define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode)
-#define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8)
-#define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII)
-#define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8)
-#define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode)
-#define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8)
-#define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46)
-#define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII)
-#define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode)
-#define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32)
-#define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState)
-#define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32)
-#define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32)
-#define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator)
-#define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable)
-#define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState)
-#define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString)
-#define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE)
-#define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8)
-#define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close)
-#define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling)
-#define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale)
-#define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName)
-#define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName)
-#define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName)
-#define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName)
-#define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open)
-#define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName)
-#define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName)
-#define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName)
-#define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName)
-#define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList)
-#define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList)
-#define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator)
-#define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString)
-#define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values)
-#define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList)
-#define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList)
-#define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum)
-#define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize)
-#define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext)
-#define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value)
-#define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList)
-#define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator)
-#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage)
-#define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP)
-#define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags)
-#define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize)
-#define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable)
-#define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag)
-#define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable)
-#define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName)
-#define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation)
-#define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry)
-#define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID)
-#define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID)
-#define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault)
-#define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry)
-#define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword)
-#define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue)
-#define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage)
-#define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName)
-#define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript)
-#define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant)
-#define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country)
-#define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language)
-#define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries)
-#define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages)
-#define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue)
-#define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID)
-#define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage)
-#define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation)
-#define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID)
-#define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName)
-#define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent)
-#define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript)
-#define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback)
-#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant)
-#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags)
-#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList)
-#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords)
-#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault)
-#define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue)
-#define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag)
-#define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close)
-#define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion)
-#define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter)
-#define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet)
-#define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern)
-#define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator)
-#define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem)
-#define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute)
-#define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize)
-#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open)
-#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute)
-#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry)
-#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage)
-#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript)
-#define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern)
-#define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe)
-#define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone)
-#define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close)
-#define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format)
-#define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale)
-#define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open)
-#define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse)
-#define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale)
-#define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern)
-#define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat)
-#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse)
-#define umtx_atomic_dec U_ICU_ENTRY_POINT_RENAME(umtx_atomic_dec)
-#define umtx_atomic_inc U_ICU_ENTRY_POINT_RENAME(umtx_atomic_inc)
-#define umtx_cleanup U_ICU_ENTRY_POINT_RENAME(umtx_cleanup)
-#define umtx_destroy U_ICU_ENTRY_POINT_RENAME(umtx_destroy)
-#define umtx_init U_ICU_ENTRY_POINT_RENAME(umtx_init)
-#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock)
-#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock)
-#define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance)
-#define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append)
-#define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close)
-#define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition)
-#define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance)
-#define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter)
-#define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore)
-#define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert)
-#define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized)
-#define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize)
-#define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend)
-#define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered)
-#define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck)
-#define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes)
-#define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap)
-#define unorm_closeIter U_ICU_ENTRY_POINT_RENAME(unorm_closeIter)
-#define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare)
-#define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate)
-#define unorm_getFCDTrieIndex U_ICU_ENTRY_POINT_RENAME(unorm_getFCDTrieIndex)
-#define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck)
-#define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized)
-#define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions)
-#define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next)
-#define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize)
-#define unorm_openIter U_ICU_ENTRY_POINT_RENAME(unorm_openIter)
-#define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous)
-#define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck)
-#define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions)
-#define unorm_setIter U_ICU_ENTRY_POINT_RENAME(unorm_setIter)
-#define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern)
-#define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone)
-#define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close)
-#define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable)
-#define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format)
-#define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal)
-#define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble)
-#define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency)
-#define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64)
-#define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute)
-#define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable)
-#define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute)
-#define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType)
-#define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol)
-#define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute)
-#define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open)
-#define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse)
-#define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal)
-#define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble)
-#define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency)
-#define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64)
-#define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute)
-#define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute)
-#define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol)
-#define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute)
-#define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern)
-#define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary)
-#define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary)
-#define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration)
-#define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext)
-#define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel)
-#define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary)
-#define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName)
-#define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal)
-#define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel)
-#define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus)
-#define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName)
-#define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile)
-#define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName)
-#define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init)
-#define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint)
-#define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary)
-#define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug)
-#define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary)
-#define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug)
-#define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext)
-#define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel)
-#define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName)
-#define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload)
-#define upname_swap U_ICU_ENTRY_POINT_RENAME(upname_swap)
-#define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource)
-#define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts)
-#define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy)
-#define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic)
-#define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower)
-#define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil)
-#define uprv_cnttab_addContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_addContraction)
-#define uprv_cnttab_changeContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_changeContraction)
-#define uprv_cnttab_changeLastCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_changeLastCE)
-#define uprv_cnttab_clone U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_clone)
-#define uprv_cnttab_close U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_close)
-#define uprv_cnttab_constructTable U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_constructTable)
-#define uprv_cnttab_findCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_findCE)
-#define uprv_cnttab_findCP U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_findCP)
-#define uprv_cnttab_getCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_getCE)
-#define uprv_cnttab_insertContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_insertContraction)
-#define uprv_cnttab_isTailored U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_isTailored)
-#define uprv_cnttab_open U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_open)
-#define uprv_cnttab_setContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_setContraction)
-#define uprv_collIterateAtEnd U_ICU_ENTRY_POINT_RENAME(uprv_collIterateAtEnd)
-#define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames)
-#define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames)
-#define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii)
-#define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic)
-#define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii)
-#define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID)
-#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix)
-#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii)
-#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic)
-#define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus)
-#define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault)
-#define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding)
-#define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus)
-#define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus)
-#define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus)
-#define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding)
-#define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus)
-#define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString)
-#define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet)
-#define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet)
-#define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString)
-#define uprv_decContextTestEndian U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestEndian)
-#define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus)
-#define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus)
-#define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus)
-#define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs)
-#define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd)
-#define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd)
-#define uprv_decNumberClass U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClass)
-#define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString)
-#define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare)
-#define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal)
-#define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal)
-#define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag)
-#define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy)
-#define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs)
-#define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate)
-#define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign)
-#define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide)
-#define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger)
-#define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp)
-#define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA)
-#define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32)
-#define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString)
-#define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32)
-#define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD)
-#define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert)
-#define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal)
-#define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal)
-#define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn)
-#define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10)
-#define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB)
-#define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax)
-#define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag)
-#define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin)
-#define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag)
-#define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus)
-#define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply)
-#define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus)
-#define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus)
-#define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward)
-#define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize)
-#define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr)
-#define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus)
-#define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower)
-#define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize)
-#define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce)
-#define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder)
-#define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear)
-#define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale)
-#define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate)
-#define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum)
-#define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB)
-#define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD)
-#define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift)
-#define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot)
-#define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract)
-#define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString)
-#define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32)
-#define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact)
-#define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue)
-#define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString)
-#define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32)
-#define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim)
-#define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion)
-#define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor)
-#define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero)
-#define uprv_delete_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_delete_collIterate)
-#define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close)
-#define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open)
-#define uprv_dl_sym U_ICU_ENTRY_POINT_RENAME(uprv_dl_sym)
-#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy)
-#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii)
-#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower)
-#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs)
-#define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor)
-#define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax)
-#define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin)
-#define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod)
-#define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free)
-#define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters)
-#define uprv_getDefaultCodepage U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultCodepage)
-#define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID)
-#define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity)
-#define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength)
-#define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues)
-#define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN)
-#define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime)
-#define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName)
-#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime)
-#define uprv_haveProperties U_ICU_ENTRY_POINT_RENAME(uprv_haveProperties)
-#define uprv_init_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_init_collIterate)
-#define uprv_init_pce U_ICU_ENTRY_POINT_RENAME(uprv_init_pce)
-#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator)
-#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite)
-#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString)
-#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString)
-#define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN)
-#define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity)
-#define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity)
-#define uprv_isRuleWhiteSpace U_ICU_ENTRY_POINT_RENAME(uprv_isRuleWhiteSpace)
-#define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou)
-#define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log)
-#define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc)
-#define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile)
-#define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max)
-#define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa)
-#define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr)
-#define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min)
-#define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf)
-#define uprv_new_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_new_collIterate)
-#define uprv_openRuleWhiteSpaceSet U_ICU_ENTRY_POINT_RENAME(uprv_openRuleWhiteSpaceSet)
-#define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency)
-#define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute)
-#define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow)
-#define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10)
-#define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc)
-#define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round)
-#define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray)
-#define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare)
-#define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup)
-#define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup)
-#define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError)
-#define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone)
-#define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper)
-#define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc)
-#define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname)
-#define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset)
-#define uprv_uca_addAnElement U_ICU_ENTRY_POINT_RENAME(uprv_uca_addAnElement)
-#define uprv_uca_assembleTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_assembleTable)
-#define uprv_uca_canonicalClosure U_ICU_ENTRY_POINT_RENAME(uprv_uca_canonicalClosure)
-#define uprv_uca_closeTempTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_closeTempTable)
-#define uprv_uca_getCodePointFromRaw U_ICU_ENTRY_POINT_RENAME(uprv_uca_getCodePointFromRaw)
-#define uprv_uca_getImplicitFromRaw U_ICU_ENTRY_POINT_RENAME(uprv_uca_getImplicitFromRaw)
-#define uprv_uca_getRawFromCodePoint U_ICU_ENTRY_POINT_RENAME(uprv_uca_getRawFromCodePoint)
-#define uprv_uca_getRawFromImplicit U_ICU_ENTRY_POINT_RENAME(uprv_uca_getRawFromImplicit)
-#define uprv_uca_initImplicitConstants U_ICU_ENTRY_POINT_RENAME(uprv_uca_initImplicitConstants)
-#define uprv_uca_initTempTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_initTempTable)
-#define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator)
-#define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator)
-#define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile)
-#define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray)
-#define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close)
-#define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact)
-#define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler)
-#define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes)
-#define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray)
-#define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow)
-#define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue)
-#define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open)
-#define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue)
-#define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement)
-#define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText)
-#define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail)
-#define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText)
-#define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone)
-#define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close)
-#define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end)
-#define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64)
-#define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find)
-#define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64)
-#define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext)
-#define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags)
-#define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback)
-#define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback)
-#define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit)
-#define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText)
-#define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit)
-#define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText)
-#define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group)
-#define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount)
-#define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText)
-#define uregex_groupUTextDeep U_ICU_ENTRY_POINT_RENAME(uregex_groupUTextDeep)
-#define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds)
-#define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds)
-#define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd)
-#define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt)
-#define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64)
-#define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches)
-#define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64)
-#define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open)
-#define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC)
-#define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText)
-#define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern)
-#define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText)
-#define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd)
-#define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64)
-#define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart)
-#define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64)
-#define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll)
-#define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText)
-#define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst)
-#define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText)
-#define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd)
-#define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset)
-#define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64)
-#define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback)
-#define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback)
-#define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion)
-#define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64)
-#define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart)
-#define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit)
-#define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText)
-#define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit)
-#define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText)
-#define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split)
-#define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText)
-#define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start)
-#define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64)
-#define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt)
-#define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds)
-#define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds)
-#define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt)
-#define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close)
-#define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb)
-#define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems)
-#define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource)
-#define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource)
-#define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary)
-#define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex)
-#define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey)
-#define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback)
-#define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent)
-#define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt)
-#define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector)
-#define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey)
-#define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues)
-#define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale)
-#define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType)
-#define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal)
-#define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName)
-#define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource)
-#define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString)
-#define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize)
-#define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString)
-#define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex)
-#define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey)
-#define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback)
-#define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType)
-#define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt)
-#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String)
-#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex)
-#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey)
-#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion)
-#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey)
-#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber)
-#define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal)
-#define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext)
-#define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject)
-#define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open)
-#define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales)
-#define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect)
-#define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn)
-#define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU)
-#define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator)
-#define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap)
-#define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun)
-#define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode)
-#define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName)
-#define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript)
-#define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions)
-#define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName)
-#define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript)
-#define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun)
-#define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun)
-#define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun)
-#define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText)
-#define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close)
-#define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first)
-#define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following)
-#define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute)
-#define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator)
-#define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator)
-#define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength)
-#define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart)
-#define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText)
-#define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset)
-#define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern)
-#define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText)
-#define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical)
-#define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact)
-#define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical)
-#define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact)
-#define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last)
-#define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next)
-#define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open)
-#define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator)
-#define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding)
-#define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous)
-#define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset)
-#define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search)
-#define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards)
-#define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute)
-#define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator)
-#define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator)
-#define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset)
-#define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern)
-#define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText)
-#define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add)
-#define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll)
-#define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints)
-#define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange)
-#define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString)
-#define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue)
-#define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern)
-#define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias)
-#define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt)
-#define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear)
-#define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone)
-#define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed)
-#define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close)
-#define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver)
-#define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact)
-#define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement)
-#define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll)
-#define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains)
-#define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll)
-#define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints)
-#define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone)
-#define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange)
-#define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome)
-#define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString)
-#define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals)
-#define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze)
-#define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem)
-#define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount)
-#define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange)
-#define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount)
-#define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet)
-#define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf)
-#define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty)
-#define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen)
-#define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open)
-#define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty)
-#define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern)
-#define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions)
-#define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove)
-#define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll)
-#define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings)
-#define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange)
-#define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString)
-#define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern)
-#define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain)
-#define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll)
-#define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize)
-#define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains)
-#define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set)
-#define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne)
-#define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size)
-#define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span)
-#define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack)
-#define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8)
-#define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8)
-#define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern)
-#define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable)
-#define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8)
-#define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString)
-#define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check)
-#define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8)
-#define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString)
-#define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone)
-#define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close)
-#define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars)
-#define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales)
-#define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet)
-#define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks)
-#define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton)
-#define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8)
-#define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString)
-#define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open)
-#define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized)
-#define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource)
-#define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize)
-#define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars)
-#define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales)
-#define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet)
-#define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks)
-#define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap)
-#define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close)
-#define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open)
-#define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType)
-#define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare)
-#define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap)
-#define ustr_foldCase U_ICU_ENTRY_POINT_RENAME(ustr_foldCase)
-#define ustr_toLower U_ICU_ENTRY_POINT_RENAME(ustr_toLower)
-#define ustr_toTitle U_ICU_ENTRY_POINT_RENAME(ustr_toTitle)
-#define ustr_toUpper U_ICU_ENTRY_POINT_RENAME(ustr_toUpper)
-#define utext_caseCompare U_ICU_ENTRY_POINT_RENAME(utext_caseCompare)
-#define utext_caseCompareNativeLimit U_ICU_ENTRY_POINT_RENAME(utext_caseCompareNativeLimit)
-#define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At)
-#define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone)
-#define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close)
-#define utext_compare U_ICU_ENTRY_POINT_RENAME(utext_compare)
-#define utext_compareNativeLimit U_ICU_ENTRY_POINT_RENAME(utext_compareNativeLimit)
-#define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy)
-#define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32)
-#define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals)
-#define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract)
-#define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze)
-#define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex)
-#define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex)
-#define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData)
-#define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive)
-#define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable)
-#define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32)
-#define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength)
-#define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32)
-#define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From)
-#define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator)
-#define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString)
-#define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable)
-#define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars)
-#define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8)
-#define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString)
-#define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32)
-#define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From)
-#define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace)
-#define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex)
-#define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup)
-#define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody)
-#define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody)
-#define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes)
-#define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody)
-#define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody)
-#define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64)
-#define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue)
-#define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64)
-#define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup)
-#define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data)
-#define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry)
-#define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit)
-#define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format)
-#define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName)
-#define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions)
-#define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel)
-#define utrace_level U_ICU_ENTRY_POINT_RENAME(utrace_level)
-#define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions)
-#define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel)
-#define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat)
-#define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone)
-#define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close)
-#define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs)
-#define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID)
-#define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID)
-#define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID)
-#define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open)
-#define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs)
-#define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse)
-#define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU)
-#define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register)
-#define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator)
-#define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter)
-#define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules)
-#define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans)
-#define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental)
-#define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars)
-#define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars)
-#define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup)
-#define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister)
-#define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID)
-#define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone)
-#define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed)
-#define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close)
-#define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum)
-#define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate)
-#define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze)
-#define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie)
-#define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32)
-#define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit)
-#define utrie2_getVersion U_ICU_ENTRY_POINT_RENAME(utrie2_getVersion)
-#define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex)
-#define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex)
-#define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen)
-#define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open)
-#define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy)
-#define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized)
-#define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize)
-#define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32)
-#define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit)
-#define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32)
-#define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap)
-#define utrie2_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie2_swapAnyVersion)
-#define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone)
-#define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close)
-#define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset)
-#define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum)
-#define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32)
-#define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData)
-#define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open)
-#define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize)
-#define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32)
-#define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32)
-#define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap)
-#define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize)
-#define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy)
-#define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone)
-#define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close)
-#define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules)
-#define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals)
-#define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID)
-#define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified)
-#define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition)
-#define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset)
-#define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2)
-#define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3)
-#define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition)
-#define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset)
-#define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID)
-#define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL)
-#define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules)
-#define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime)
-#define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData)
-#define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID)
-#define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified)
-#define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset)
-#define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL)
-#define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime)
-#define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write)
-#define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart)
-#define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple)
-#define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close)
-#define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals)
-#define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings)
-#define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName)
-#define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset)
-#define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo)
-#define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom)
-#define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo)
-#define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone)
-#define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close)
-#define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals)
-#define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID)
-#define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom)
-#define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID)
-#define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime)
-#define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo)
-#define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open)
-#define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty)
-#define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom)
-#define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime)
-#define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo)
-
-
-/* C++ class names renaming defines */
-
-#ifdef XP_CPLUSPLUS
-#if !U_HAVE_NAMESPACE
-
-#define AbsoluteValueSubstitution U_ICU_ENTRY_POINT_RENAME(AbsoluteValueSubstitution)
-#define AlternateSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(AlternateSubstitutionSubtable)
-#define AnchorTable U_ICU_ENTRY_POINT_RENAME(AnchorTable)
-#define AndConstraint U_ICU_ENTRY_POINT_RENAME(AndConstraint)
-#define AnnualTimeZoneRule U_ICU_ENTRY_POINT_RENAME(AnnualTimeZoneRule)
-#define AnyTransliterator U_ICU_ENTRY_POINT_RENAME(AnyTransliterator)
-#define ArabicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(ArabicOpenTypeLayoutEngine)
-#define ArabicShaping U_ICU_ENTRY_POINT_RENAME(ArabicShaping)
-#define ArgExtractor U_ICU_ENTRY_POINT_RENAME(ArgExtractor)
-#define BMPSet U_ICU_ENTRY_POINT_RENAME(BMPSet)
-#define BackwardUTrie2StringIterator U_ICU_ENTRY_POINT_RENAME(BackwardUTrie2StringIterator)
-#define BadCharacterTable U_ICU_ENTRY_POINT_RENAME(BadCharacterTable)
-#define BasicCalendarFactory U_ICU_ENTRY_POINT_RENAME(BasicCalendarFactory)
-#define BasicTimeZone U_ICU_ENTRY_POINT_RENAME(BasicTimeZone)
-#define BinarySearchLookupTable U_ICU_ENTRY_POINT_RENAME(BinarySearchLookupTable)
-#define BoyerMooreSearch U_ICU_ENTRY_POINT_RENAME(BoyerMooreSearch)
-#define BreakIterator U_ICU_ENTRY_POINT_RENAME(BreakIterator)
-#define BreakTransliterator U_ICU_ENTRY_POINT_RENAME(BreakTransliterator)
-#define BuddhistCalendar U_ICU_ENTRY_POINT_RENAME(BuddhistCalendar)
-#define BuildCompactTrieHorizontalNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieHorizontalNode)
-#define BuildCompactTrieNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieNode)
-#define BuildCompactTrieVerticalNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieVerticalNode)
-#define BuilderScriptSet U_ICU_ENTRY_POINT_RENAME(BuilderScriptSet)
-#define ByteSink U_ICU_ENTRY_POINT_RENAME(ByteSink)
-#define CEBuffer U_ICU_ENTRY_POINT_RENAME(CEBuffer)
-#define CECalendar U_ICU_ENTRY_POINT_RENAME(CECalendar)
-#define CEList U_ICU_ENTRY_POINT_RENAME(CEList)
-#define CEToStringsMap U_ICU_ENTRY_POINT_RENAME(CEToStringsMap)
-#define CFactory U_ICU_ENTRY_POINT_RENAME(CFactory)
-#define Calendar U_ICU_ENTRY_POINT_RENAME(Calendar)
-#define CalendarAstronomer U_ICU_ENTRY_POINT_RENAME(CalendarAstronomer)
-#define CalendarCache U_ICU_ENTRY_POINT_RENAME(CalendarCache)
-#define CalendarData U_ICU_ENTRY_POINT_RENAME(CalendarData)
-#define CalendarService U_ICU_ENTRY_POINT_RENAME(CalendarService)
-#define CanonIterData U_ICU_ENTRY_POINT_RENAME(CanonIterData)
-#define CanonIterDataSingleton U_ICU_ENTRY_POINT_RENAME(CanonIterDataSingleton)
-#define CanonMarkFilter U_ICU_ENTRY_POINT_RENAME(CanonMarkFilter)
-#define CanonShaping U_ICU_ENTRY_POINT_RENAME(CanonShaping)
-#define CanonicalIterator U_ICU_ENTRY_POINT_RENAME(CanonicalIterator)
-#define CaseMapTransliterator U_ICU_ENTRY_POINT_RENAME(CaseMapTransliterator)
-#define ChainingContextualSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat1Subtable)
-#define ChainingContextualSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat2Subtable)
-#define ChainingContextualSubstitutionFormat3Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat3Subtable)
-#define ChainingContextualSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionSubtable)
-#define CharString U_ICU_ENTRY_POINT_RENAME(CharString)
-#define CharSubstitutionFilter U_ICU_ENTRY_POINT_RENAME(CharSubstitutionFilter)
-#define CharacterIterator U_ICU_ENTRY_POINT_RENAME(CharacterIterator)
-#define CharacterNode U_ICU_ENTRY_POINT_RENAME(CharacterNode)
-#define CharsetDetector U_ICU_ENTRY_POINT_RENAME(CharsetDetector)
-#define CharsetMatch U_ICU_ENTRY_POINT_RENAME(CharsetMatch)
-#define CharsetRecog_2022 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022)
-#define CharsetRecog_2022CN U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022CN)
-#define CharsetRecog_2022JP U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022JP)
-#define CharsetRecog_2022KR U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022KR)
-#define CharsetRecog_8859_1 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1)
-#define CharsetRecog_8859_1_da U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_da)
-#define CharsetRecog_8859_1_de U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_de)
-#define CharsetRecog_8859_1_en U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_en)
-#define CharsetRecog_8859_1_es U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_es)
-#define CharsetRecog_8859_1_fr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_fr)
-#define CharsetRecog_8859_1_it U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_it)
-#define CharsetRecog_8859_1_nl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_nl)
-#define CharsetRecog_8859_1_no U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_no)
-#define CharsetRecog_8859_1_pt U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_pt)
-#define CharsetRecog_8859_1_sv U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_sv)
-#define CharsetRecog_8859_2 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2)
-#define CharsetRecog_8859_2_cs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_cs)
-#define CharsetRecog_8859_2_hu U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_hu)
-#define CharsetRecog_8859_2_pl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_pl)
-#define CharsetRecog_8859_2_ro U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_ro)
-#define CharsetRecog_8859_5 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_5)
-#define CharsetRecog_8859_5_ru U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_5_ru)
-#define CharsetRecog_8859_6 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_6)
-#define CharsetRecog_8859_6_ar U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_6_ar)
-#define CharsetRecog_8859_7 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_7)
-#define CharsetRecog_8859_7_el U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_7_el)
-#define CharsetRecog_8859_8 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8)
-#define CharsetRecog_8859_8_I_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8_I_he)
-#define CharsetRecog_8859_8_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8_he)
-#define CharsetRecog_8859_9 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_9)
-#define CharsetRecog_8859_9_tr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_9_tr)
-#define CharsetRecog_IBM420_ar U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar)
-#define CharsetRecog_IBM420_ar_ltr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar_ltr)
-#define CharsetRecog_IBM420_ar_rtl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar_rtl)
-#define CharsetRecog_IBM424_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he)
-#define CharsetRecog_IBM424_he_ltr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he_ltr)
-#define CharsetRecog_IBM424_he_rtl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he_rtl)
-#define CharsetRecog_KOI8_R U_ICU_ENTRY_POINT_RENAME(CharsetRecog_KOI8_R)
-#define CharsetRecog_UTF8 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF8)
-#define CharsetRecog_UTF_16_BE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_16_BE)
-#define CharsetRecog_UTF_16_LE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_16_LE)
-#define CharsetRecog_UTF_32 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32)
-#define CharsetRecog_UTF_32_BE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32_BE)
-#define CharsetRecog_UTF_32_LE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32_LE)
-#define CharsetRecog_Unicode U_ICU_ENTRY_POINT_RENAME(CharsetRecog_Unicode)
-#define CharsetRecog_big5 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_big5)
-#define CharsetRecog_euc U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc)
-#define CharsetRecog_euc_jp U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc_jp)
-#define CharsetRecog_euc_kr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc_kr)
-#define CharsetRecog_gb_18030 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_gb_18030)
-#define CharsetRecog_mbcs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_mbcs)
-#define CharsetRecog_sbcs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_sbcs)
-#define CharsetRecog_sjis U_ICU_ENTRY_POINT_RENAME(CharsetRecog_sjis)
-#define CharsetRecog_windows_1251 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_windows_1251)
-#define CharsetRecog_windows_1256 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_windows_1256)
-#define CharsetRecognizer U_ICU_ENTRY_POINT_RENAME(CharsetRecognizer)
-#define CheckedArrayByteSink U_ICU_ENTRY_POINT_RENAME(CheckedArrayByteSink)
-#define ChineseCalendar U_ICU_ENTRY_POINT_RENAME(ChineseCalendar)
-#define ChoiceFormat U_ICU_ENTRY_POINT_RENAME(ChoiceFormat)
-#define ClassDefFormat1Table U_ICU_ENTRY_POINT_RENAME(ClassDefFormat1Table)
-#define ClassDefFormat2Table U_ICU_ENTRY_POINT_RENAME(ClassDefFormat2Table)
-#define ClassDefinitionTable U_ICU_ENTRY_POINT_RENAME(ClassDefinitionTable)
-#define ClockMath U_ICU_ENTRY_POINT_RENAME(ClockMath)
-#define CollData U_ICU_ENTRY_POINT_RENAME(CollData)
-#define CollDataCache U_ICU_ENTRY_POINT_RENAME(CollDataCache)
-#define CollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(CollDataCacheEntry)
-#define CollationElementIterator U_ICU_ENTRY_POINT_RENAME(CollationElementIterator)
-#define CollationKey U_ICU_ENTRY_POINT_RENAME(CollationKey)
-#define CollationLocaleListEnumeration U_ICU_ENTRY_POINT_RENAME(CollationLocaleListEnumeration)
-#define Collator U_ICU_ENTRY_POINT_RENAME(Collator)
-#define CollatorFactory U_ICU_ENTRY_POINT_RENAME(CollatorFactory)
-#define CompactTrieDictionary U_ICU_ENTRY_POINT_RENAME(CompactTrieDictionary)
-#define CompactTrieEnumeration U_ICU_ENTRY_POINT_RENAME(CompactTrieEnumeration)
-#define ComposeNormalizer2 U_ICU_ENTRY_POINT_RENAME(ComposeNormalizer2)
-#define CompoundTransliterator U_ICU_ENTRY_POINT_RENAME(CompoundTransliterator)
-#define ConfusabledataBuilder U_ICU_ENTRY_POINT_RENAME(ConfusabledataBuilder)
-#define ContextualGlyphSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(ContextualGlyphSubstitutionProcessor)
-#define ContextualSubstitutionBase U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionBase)
-#define ContextualSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat1Subtable)
-#define ContextualSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat2Subtable)
-#define ContextualSubstitutionFormat3Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat3Subtable)
-#define ContextualSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionSubtable)
-#define CopticCalendar U_ICU_ENTRY_POINT_RENAME(CopticCalendar)
-#define CoverageFormat1Table U_ICU_ENTRY_POINT_RENAME(CoverageFormat1Table)
-#define CoverageFormat2Table U_ICU_ENTRY_POINT_RENAME(CoverageFormat2Table)
-#define CoverageTable U_ICU_ENTRY_POINT_RENAME(CoverageTable)
-#define CurrencyAmount U_ICU_ENTRY_POINT_RENAME(CurrencyAmount)
-#define CurrencyFormat U_ICU_ENTRY_POINT_RENAME(CurrencyFormat)
-#define CurrencyPluralInfo U_ICU_ENTRY_POINT_RENAME(CurrencyPluralInfo)
-#define CurrencyUnit U_ICU_ENTRY_POINT_RENAME(CurrencyUnit)
-#define CursiveAttachmentSubtable U_ICU_ENTRY_POINT_RENAME(CursiveAttachmentSubtable)
-#define DTRedundantEnumeration U_ICU_ENTRY_POINT_RENAME(DTRedundantEnumeration)
-#define DTSkeletonEnumeration U_ICU_ENTRY_POINT_RENAME(DTSkeletonEnumeration)
-#define DateFormat U_ICU_ENTRY_POINT_RENAME(DateFormat)
-#define DateFormatSymbols U_ICU_ENTRY_POINT_RENAME(DateFormatSymbols)
-#define DateInterval U_ICU_ENTRY_POINT_RENAME(DateInterval)
-#define DateIntervalFormat U_ICU_ENTRY_POINT_RENAME(DateIntervalFormat)
-#define DateIntervalInfo U_ICU_ENTRY_POINT_RENAME(DateIntervalInfo)
-#define DateTimeMatcher U_ICU_ENTRY_POINT_RENAME(DateTimeMatcher)
-#define DateTimePatternGenerator U_ICU_ENTRY_POINT_RENAME(DateTimePatternGenerator)
-#define DateTimeRule U_ICU_ENTRY_POINT_RENAME(DateTimeRule)
-#define DecimalFormat U_ICU_ENTRY_POINT_RENAME(DecimalFormat)
-#define DecimalFormatSymbols U_ICU_ENTRY_POINT_RENAME(DecimalFormatSymbols)
-#define DecomposeNormalizer2 U_ICU_ENTRY_POINT_RENAME(DecomposeNormalizer2)
-#define DefaultCalendarFactory U_ICU_ENTRY_POINT_RENAME(DefaultCalendarFactory)
-#define DefaultCharMapper U_ICU_ENTRY_POINT_RENAME(DefaultCharMapper)
-#define DeviceTable U_ICU_ENTRY_POINT_RENAME(DeviceTable)
-#define DictionaryBreakEngine U_ICU_ENTRY_POINT_RENAME(DictionaryBreakEngine)
-#define DigitList U_ICU_ENTRY_POINT_RENAME(DigitList)
-#define DistanceInfo U_ICU_ENTRY_POINT_RENAME(DistanceInfo)
-#define EnumToOffset U_ICU_ENTRY_POINT_RENAME(EnumToOffset)
-#define ErrorCode U_ICU_ENTRY_POINT_RENAME(ErrorCode)
-#define EscapeTransliterator U_ICU_ENTRY_POINT_RENAME(EscapeTransliterator)
-#define EthiopicCalendar U_ICU_ENTRY_POINT_RENAME(EthiopicCalendar)
-#define EventListener U_ICU_ENTRY_POINT_RENAME(EventListener)
-#define ExtensionSubtable U_ICU_ENTRY_POINT_RENAME(ExtensionSubtable)
-#define FCDNormalizer2 U_ICU_ENTRY_POINT_RENAME(FCDNormalizer2)
-#define FCDTrieSingleton U_ICU_ENTRY_POINT_RENAME(FCDTrieSingleton)
-#define FeatureListTable U_ICU_ENTRY_POINT_RENAME(FeatureListTable)
-#define FieldPosition U_ICU_ENTRY_POINT_RENAME(FieldPosition)
-#define FieldPositionHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionHandler)
-#define FieldPositionIterator U_ICU_ENTRY_POINT_RENAME(FieldPositionIterator)
-#define FieldPositionIteratorHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionIteratorHandler)
-#define FieldPositionOnlyHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionOnlyHandler)
-#define FilteredNormalizer2 U_ICU_ENTRY_POINT_RENAME(FilteredNormalizer2)
-#define FontRuns U_ICU_ENTRY_POINT_RENAME(FontRuns)
-#define Format U_ICU_ENTRY_POINT_RENAME(Format)
-#define Format1AnchorTable U_ICU_ENTRY_POINT_RENAME(Format1AnchorTable)
-#define Format2AnchorTable U_ICU_ENTRY_POINT_RENAME(Format2AnchorTable)
-#define Format3AnchorTable U_ICU_ENTRY_POINT_RENAME(Format3AnchorTable)
-#define FormatNameEnumeration U_ICU_ENTRY_POINT_RENAME(FormatNameEnumeration)
-#define FormatParser U_ICU_ENTRY_POINT_RENAME(FormatParser)
-#define Formattable U_ICU_ENTRY_POINT_RENAME(Formattable)
-#define ForwardCharacterIterator U_ICU_ENTRY_POINT_RENAME(ForwardCharacterIterator)
-#define ForwardUTrie2StringIterator U_ICU_ENTRY_POINT_RENAME(ForwardUTrie2StringIterator)
-#define FractionalPartSubstitution U_ICU_ENTRY_POINT_RENAME(FractionalPartSubstitution)
-#define FunctionReplacer U_ICU_ENTRY_POINT_RENAME(FunctionReplacer)
-#define GDEFMarkFilter U_ICU_ENTRY_POINT_RENAME(GDEFMarkFilter)
-#define GXLayoutEngine U_ICU_ENTRY_POINT_RENAME(GXLayoutEngine)
-#define GlyphDefinitionTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphDefinitionTableHeader)
-#define GlyphIterator U_ICU_ENTRY_POINT_RENAME(GlyphIterator)
-#define GlyphLookupTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphLookupTableHeader)
-#define GlyphPositionAdjustments U_ICU_ENTRY_POINT_RENAME(GlyphPositionAdjustments)
-#define GlyphPositioningLookupProcessor U_ICU_ENTRY_POINT_RENAME(GlyphPositioningLookupProcessor)
-#define GlyphPositioningTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphPositioningTableHeader)
-#define GlyphSubstitutionLookupProcessor U_ICU_ENTRY_POINT_RENAME(GlyphSubstitutionLookupProcessor)
-#define GlyphSubstitutionTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphSubstitutionTableHeader)
-#define GoodSuffixTable U_ICU_ENTRY_POINT_RENAME(GoodSuffixTable)
-#define Grego U_ICU_ENTRY_POINT_RENAME(Grego)
-#define GregorianCalendar U_ICU_ENTRY_POINT_RENAME(GregorianCalendar)
-#define HanOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(HanOpenTypeLayoutEngine)
-#define HangulOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(HangulOpenTypeLayoutEngine)
-#define HebrewCalendar U_ICU_ENTRY_POINT_RENAME(HebrewCalendar)
-#define ICUBreakIteratorFactory U_ICU_ENTRY_POINT_RENAME(ICUBreakIteratorFactory)
-#define ICUBreakIteratorService U_ICU_ENTRY_POINT_RENAME(ICUBreakIteratorService)
-#define ICUCollatorFactory U_ICU_ENTRY_POINT_RENAME(ICUCollatorFactory)
-#define ICUCollatorService U_ICU_ENTRY_POINT_RENAME(ICUCollatorService)
-#define ICUDataTable U_ICU_ENTRY_POINT_RENAME(ICUDataTable)
-#define ICULanguageBreakFactory U_ICU_ENTRY_POINT_RENAME(ICULanguageBreakFactory)
-#define ICULocaleService U_ICU_ENTRY_POINT_RENAME(ICULocaleService)
-#define ICUNotifier U_ICU_ENTRY_POINT_RENAME(ICUNotifier)
-#define ICUNumberFormatFactory U_ICU_ENTRY_POINT_RENAME(ICUNumberFormatFactory)
-#define ICUNumberFormatService U_ICU_ENTRY_POINT_RENAME(ICUNumberFormatService)
-#define ICUResourceBundleFactory U_ICU_ENTRY_POINT_RENAME(ICUResourceBundleFactory)
-#define ICUService U_ICU_ENTRY_POINT_RENAME(ICUService)
-#define ICUServiceFactory U_ICU_ENTRY_POINT_RENAME(ICUServiceFactory)
-#define ICUServiceKey U_ICU_ENTRY_POINT_RENAME(ICUServiceKey)
-#define ICU_Utility U_ICU_ENTRY_POINT_RENAME(ICU_Utility)
-#define IDNA U_ICU_ENTRY_POINT_RENAME(IDNA)
-#define IndianCalendar U_ICU_ENTRY_POINT_RENAME(IndianCalendar)
-#define IndicClassTable U_ICU_ENTRY_POINT_RENAME(IndicClassTable)
-#define IndicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(IndicOpenTypeLayoutEngine)
-#define IndicRearrangementProcessor U_ICU_ENTRY_POINT_RENAME(IndicRearrangementProcessor)
-#define IndicReordering U_ICU_ENTRY_POINT_RENAME(IndicReordering)
-#define InitialTimeZoneRule U_ICU_ENTRY_POINT_RENAME(InitialTimeZoneRule)
-#define InputText U_ICU_ENTRY_POINT_RENAME(InputText)
-#define IntegralPartSubstitution U_ICU_ENTRY_POINT_RENAME(IntegralPartSubstitution)
-#define IslamicCalendar U_ICU_ENTRY_POINT_RENAME(IslamicCalendar)
-#define IteratedChar U_ICU_ENTRY_POINT_RENAME(IteratedChar)
-#define JapaneseCalendar U_ICU_ENTRY_POINT_RENAME(JapaneseCalendar)
-#define KernTable U_ICU_ENTRY_POINT_RENAME(KernTable)
-#define KeywordEnumeration U_ICU_ENTRY_POINT_RENAME(KeywordEnumeration)
-#define KhmerClassTable U_ICU_ENTRY_POINT_RENAME(KhmerClassTable)
-#define KhmerOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(KhmerOpenTypeLayoutEngine)
-#define KhmerReordering U_ICU_ENTRY_POINT_RENAME(KhmerReordering)
-#define LECharMapper U_ICU_ENTRY_POINT_RENAME(LECharMapper)
-#define LEFontInstance U_ICU_ENTRY_POINT_RENAME(LEFontInstance)
-#define LEGlyphFilter U_ICU_ENTRY_POINT_RENAME(LEGlyphFilter)
-#define LEGlyphStorage U_ICU_ENTRY_POINT_RENAME(LEGlyphStorage)
-#define LEInsertionCallback U_ICU_ENTRY_POINT_RENAME(LEInsertionCallback)
-#define LEInsertionList U_ICU_ENTRY_POINT_RENAME(LEInsertionList)
-#define LXUtilities U_ICU_ENTRY_POINT_RENAME(LXUtilities)
-#define LanguageBreakEngine U_ICU_ENTRY_POINT_RENAME(LanguageBreakEngine)
-#define LanguageBreakFactory U_ICU_ENTRY_POINT_RENAME(LanguageBreakFactory)
-#define LayoutEngine U_ICU_ENTRY_POINT_RENAME(LayoutEngine)
-#define LigatureSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(LigatureSubstitutionProcessor)
-#define LigatureSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(LigatureSubstitutionSubtable)
-#define LocDataParser U_ICU_ENTRY_POINT_RENAME(LocDataParser)
-#define Locale U_ICU_ENTRY_POINT_RENAME(Locale)
-#define LocaleBased U_ICU_ENTRY_POINT_RENAME(LocaleBased)
-#define LocaleDisplayNames U_ICU_ENTRY_POINT_RENAME(LocaleDisplayNames)
-#define LocaleDisplayNamesImpl U_ICU_ENTRY_POINT_RENAME(LocaleDisplayNamesImpl)
-#define LocaleKey U_ICU_ENTRY_POINT_RENAME(LocaleKey)
-#define LocaleKeyFactory U_ICU_ENTRY_POINT_RENAME(LocaleKeyFactory)
-#define LocaleRuns U_ICU_ENTRY_POINT_RENAME(LocaleRuns)
-#define LocaleUtility U_ICU_ENTRY_POINT_RENAME(LocaleUtility)
-#define LocalizationInfo U_ICU_ENTRY_POINT_RENAME(LocalizationInfo)
-#define LookupListTable U_ICU_ENTRY_POINT_RENAME(LookupListTable)
-#define LookupProcessor U_ICU_ENTRY_POINT_RENAME(LookupProcessor)
-#define LookupSubtable U_ICU_ENTRY_POINT_RENAME(LookupSubtable)
-#define LookupTable U_ICU_ENTRY_POINT_RENAME(LookupTable)
-#define LowercaseTransliterator U_ICU_ENTRY_POINT_RENAME(LowercaseTransliterator)
-#define MPreFixups U_ICU_ENTRY_POINT_RENAME(MPreFixups)
-#define MarkArray U_ICU_ENTRY_POINT_RENAME(MarkArray)
-#define MarkToBasePositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToBasePositioningSubtable)
-#define MarkToLigaturePositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToLigaturePositioningSubtable)
-#define MarkToMarkPositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToMarkPositioningSubtable)
-#define Measure U_ICU_ENTRY_POINT_RENAME(Measure)
-#define MeasureFormat U_ICU_ENTRY_POINT_RENAME(MeasureFormat)
-#define MeasureUnit U_ICU_ENTRY_POINT_RENAME(MeasureUnit)
-#define MessageFormat U_ICU_ENTRY_POINT_RENAME(MessageFormat)
-#define MessageFormatAdapter U_ICU_ENTRY_POINT_RENAME(MessageFormatAdapter)
-#define ModulusSubstitution U_ICU_ENTRY_POINT_RENAME(ModulusSubstitution)
-#define MoonRiseSetCoordFunc U_ICU_ENTRY_POINT_RENAME(MoonRiseSetCoordFunc)
-#define MoonTimeAngleFunc U_ICU_ENTRY_POINT_RENAME(MoonTimeAngleFunc)
-#define MorphSubtableHeader U_ICU_ENTRY_POINT_RENAME(MorphSubtableHeader)
-#define MorphTableHeader U_ICU_ENTRY_POINT_RENAME(MorphTableHeader)
-#define MultipleSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(MultipleSubstitutionSubtable)
-#define MultiplierSubstitution U_ICU_ENTRY_POINT_RENAME(MultiplierSubstitution)
-#define MutableTrieDictionary U_ICU_ENTRY_POINT_RENAME(MutableTrieDictionary)
-#define MutableTrieEnumeration U_ICU_ENTRY_POINT_RENAME(MutableTrieEnumeration)
-#define NFFactory U_ICU_ENTRY_POINT_RENAME(NFFactory)
-#define NFKDBuffer U_ICU_ENTRY_POINT_RENAME(NFKDBuffer)
-#define NFRule U_ICU_ENTRY_POINT_RENAME(NFRule)
-#define NFRuleSet U_ICU_ENTRY_POINT_RENAME(NFRuleSet)
-#define NFSubstitution U_ICU_ENTRY_POINT_RENAME(NFSubstitution)
-#define NGramParser U_ICU_ENTRY_POINT_RENAME(NGramParser)
-#define NameToEnum U_ICU_ENTRY_POINT_RENAME(NameToEnum)
-#define NameUnicodeTransliterator U_ICU_ENTRY_POINT_RENAME(NameUnicodeTransliterator)
-#define NonContextualGlyphSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(NonContextualGlyphSubstitutionProcessor)
-#define NonContiguousEnumToOffset U_ICU_ENTRY_POINT_RENAME(NonContiguousEnumToOffset)
-#define NoopNormalizer2 U_ICU_ENTRY_POINT_RENAME(NoopNormalizer2)
-#define Norm2AllModes U_ICU_ENTRY_POINT_RENAME(Norm2AllModes)
-#define NormalizationTransliterator U_ICU_ENTRY_POINT_RENAME(NormalizationTransliterator)
-#define Normalizer U_ICU_ENTRY_POINT_RENAME(Normalizer)
-#define Normalizer2 U_ICU_ENTRY_POINT_RENAME(Normalizer2)
-#define Normalizer2Factory U_ICU_ENTRY_POINT_RENAME(Normalizer2Factory)
-#define Normalizer2Impl U_ICU_ENTRY_POINT_RENAME(Normalizer2Impl)
-#define Normalizer2WithImpl U_ICU_ENTRY_POINT_RENAME(Normalizer2WithImpl)
-#define NullSubstitution U_ICU_ENTRY_POINT_RENAME(NullSubstitution)
-#define NullTransliterator U_ICU_ENTRY_POINT_RENAME(NullTransliterator)
-#define NumberFormat U_ICU_ENTRY_POINT_RENAME(NumberFormat)
-#define NumberFormatFactory U_ICU_ENTRY_POINT_RENAME(NumberFormatFactory)
-#define NumberingSystem U_ICU_ENTRY_POINT_RENAME(NumberingSystem)
-#define NumeratorSubstitution U_ICU_ENTRY_POINT_RENAME(NumeratorSubstitution)
-#define OlsonTimeZone U_ICU_ENTRY_POINT_RENAME(OlsonTimeZone)
-#define OpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(OpenTypeLayoutEngine)
-#define OpenTypeUtilities U_ICU_ENTRY_POINT_RENAME(OpenTypeUtilities)
-#define OrConstraint U_ICU_ENTRY_POINT_RENAME(OrConstraint)
-#define PCEBuffer U_ICU_ENTRY_POINT_RENAME(PCEBuffer)
-#define PairPositioningFormat1Subtable U_ICU_ENTRY_POINT_RENAME(PairPositioningFormat1Subtable)
-#define PairPositioningFormat2Subtable U_ICU_ENTRY_POINT_RENAME(PairPositioningFormat2Subtable)
-#define PairPositioningSubtable U_ICU_ENTRY_POINT_RENAME(PairPositioningSubtable)
-#define ParagraphLayout U_ICU_ENTRY_POINT_RENAME(ParagraphLayout)
-#define ParseData U_ICU_ENTRY_POINT_RENAME(ParseData)
-#define ParsePosition U_ICU_ENTRY_POINT_RENAME(ParsePosition)
-#define PatternMap U_ICU_ENTRY_POINT_RENAME(PatternMap)
-#define PatternMapIterator U_ICU_ENTRY_POINT_RENAME(PatternMapIterator)
-#define PersianCalendar U_ICU_ENTRY_POINT_RENAME(PersianCalendar)
-#define PluralFormat U_ICU_ENTRY_POINT_RENAME(PluralFormat)
-#define PluralKeywordEnumeration U_ICU_ENTRY_POINT_RENAME(PluralKeywordEnumeration)
-#define PluralRules U_ICU_ENTRY_POINT_RENAME(PluralRules)
-#define PropertyAliases U_ICU_ENTRY_POINT_RENAME(PropertyAliases)
-#define PtnElem U_ICU_ENTRY_POINT_RENAME(PtnElem)
-#define PtnSkeleton U_ICU_ENTRY_POINT_RENAME(PtnSkeleton)
-#define Quantifier U_ICU_ENTRY_POINT_RENAME(Quantifier)
-#define RBBIDataWrapper U_ICU_ENTRY_POINT_RENAME(RBBIDataWrapper)
-#define RBBINode U_ICU_ENTRY_POINT_RENAME(RBBINode)
-#define RBBIRuleBuilder U_ICU_ENTRY_POINT_RENAME(RBBIRuleBuilder)
-#define RBBIRuleScanner U_ICU_ENTRY_POINT_RENAME(RBBIRuleScanner)
-#define RBBISetBuilder U_ICU_ENTRY_POINT_RENAME(RBBISetBuilder)
-#define RBBIStateDescriptor U_ICU_ENTRY_POINT_RENAME(RBBIStateDescriptor)
-#define RBBISymbolTable U_ICU_ENTRY_POINT_RENAME(RBBISymbolTable)
-#define RBBISymbolTableEntry U_ICU_ENTRY_POINT_RENAME(RBBISymbolTableEntry)
-#define RBBITableBuilder U_ICU_ENTRY_POINT_RENAME(RBBITableBuilder)
-#define RCEBuffer U_ICU_ENTRY_POINT_RENAME(RCEBuffer)
-#define RangeDescriptor U_ICU_ENTRY_POINT_RENAME(RangeDescriptor)
-#define RegexCompile U_ICU_ENTRY_POINT_RENAME(RegexCompile)
-#define RegexMatcher U_ICU_ENTRY_POINT_RENAME(RegexMatcher)
-#define RegexPattern U_ICU_ENTRY_POINT_RENAME(RegexPattern)
-#define RegexStaticSets U_ICU_ENTRY_POINT_RENAME(RegexStaticSets)
-#define RegularExpression U_ICU_ENTRY_POINT_RENAME(RegularExpression)
-#define RelativeDateFormat U_ICU_ENTRY_POINT_RENAME(RelativeDateFormat)
-#define RemoveTransliterator U_ICU_ENTRY_POINT_RENAME(RemoveTransliterator)
-#define ReorderingBuffer U_ICU_ENTRY_POINT_RENAME(ReorderingBuffer)
-#define Replaceable U_ICU_ENTRY_POINT_RENAME(Replaceable)
-#define ReplaceableGlue U_ICU_ENTRY_POINT_RENAME(ReplaceableGlue)
-#define ResourceBundle U_ICU_ENTRY_POINT_RENAME(ResourceBundle)
-#define RiseSetCoordFunc U_ICU_ENTRY_POINT_RENAME(RiseSetCoordFunc)
-#define RuleBasedBreakIterator U_ICU_ENTRY_POINT_RENAME(RuleBasedBreakIterator)
-#define RuleBasedCollator U_ICU_ENTRY_POINT_RENAME(RuleBasedCollator)
-#define RuleBasedNumberFormat U_ICU_ENTRY_POINT_RENAME(RuleBasedNumberFormat)
-#define RuleBasedTimeZone U_ICU_ENTRY_POINT_RENAME(RuleBasedTimeZone)
-#define RuleBasedTransliterator U_ICU_ENTRY_POINT_RENAME(RuleBasedTransliterator)
-#define RuleChain U_ICU_ENTRY_POINT_RENAME(RuleChain)
-#define RuleCharacterIterator U_ICU_ENTRY_POINT_RENAME(RuleCharacterIterator)
-#define RuleHalf U_ICU_ENTRY_POINT_RENAME(RuleHalf)
-#define RuleParser U_ICU_ENTRY_POINT_RENAME(RuleParser)
-#define RunArray U_ICU_ENTRY_POINT_RENAME(RunArray)
-#define SPUString U_ICU_ENTRY_POINT_RENAME(SPUString)
-#define SPUStringPool U_ICU_ENTRY_POINT_RENAME(SPUStringPool)
-#define SafeZoneStringFormatPtr U_ICU_ENTRY_POINT_RENAME(SafeZoneStringFormatPtr)
-#define SameValueSubstitution U_ICU_ENTRY_POINT_RENAME(SameValueSubstitution)
-#define ScriptListTable U_ICU_ENTRY_POINT_RENAME(ScriptListTable)
-#define ScriptRunIterator U_ICU_ENTRY_POINT_RENAME(ScriptRunIterator)
-#define ScriptSet U_ICU_ENTRY_POINT_RENAME(ScriptSet)
-#define ScriptTable U_ICU_ENTRY_POINT_RENAME(ScriptTable)
-#define SearchIterator U_ICU_ENTRY_POINT_RENAME(SearchIterator)
-#define SegmentArrayProcessor U_ICU_ENTRY_POINT_RENAME(SegmentArrayProcessor)
-#define SegmentSingleProcessor U_ICU_ENTRY_POINT_RENAME(SegmentSingleProcessor)
-#define SelectFormat U_ICU_ENTRY_POINT_RENAME(SelectFormat)
-#define ServiceEnumeration U_ICU_ENTRY_POINT_RENAME(ServiceEnumeration)
-#define ServiceListener U_ICU_ENTRY_POINT_RENAME(ServiceListener)
-#define SimpleArrayProcessor U_ICU_ENTRY_POINT_RENAME(SimpleArrayProcessor)
-#define SimpleDateFormat U_ICU_ENTRY_POINT_RENAME(SimpleDateFormat)
-#define SimpleFactory U_ICU_ENTRY_POINT_RENAME(SimpleFactory)
-#define SimpleLocaleKeyFactory U_ICU_ENTRY_POINT_RENAME(SimpleLocaleKeyFactory)
-#define SimpleNumberFormatFactory U_ICU_ENTRY_POINT_RENAME(SimpleNumberFormatFactory)
-#define SimpleSingleton U_ICU_ENTRY_POINT_RENAME(SimpleSingleton)
-#define SimpleTimeZone U_ICU_ENTRY_POINT_RENAME(SimpleTimeZone)
-#define SinglePositioningFormat1Subtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningFormat1Subtable)
-#define SinglePositioningFormat2Subtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningFormat2Subtable)
-#define SinglePositioningSubtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningSubtable)
-#define SingleSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionFormat1Subtable)
-#define SingleSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionFormat2Subtable)
-#define SingleSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionSubtable)
-#define SingleTableProcessor U_ICU_ENTRY_POINT_RENAME(SingleTableProcessor)
-#define SpoofData U_ICU_ENTRY_POINT_RENAME(SpoofData)
-#define SpoofImpl U_ICU_ENTRY_POINT_RENAME(SpoofImpl)
-#define StateTableProcessor U_ICU_ENTRY_POINT_RENAME(StateTableProcessor)
-#define StringCharacterIterator U_ICU_ENTRY_POINT_RENAME(StringCharacterIterator)
-#define StringEnumeration U_ICU_ENTRY_POINT_RENAME(StringEnumeration)
-#define StringList U_ICU_ENTRY_POINT_RENAME(StringList)
-#define StringLocalizationInfo U_ICU_ENTRY_POINT_RENAME(StringLocalizationInfo)
-#define StringMatcher U_ICU_ENTRY_POINT_RENAME(StringMatcher)
-#define StringPair U_ICU_ENTRY_POINT_RENAME(StringPair)
-#define StringPiece U_ICU_ENTRY_POINT_RENAME(StringPiece)
-#define StringReplacer U_ICU_ENTRY_POINT_RENAME(StringReplacer)
-#define StringSearch U_ICU_ENTRY_POINT_RENAME(StringSearch)
-#define StringToCEsMap U_ICU_ENTRY_POINT_RENAME(StringToCEsMap)
-#define StyleRuns U_ICU_ENTRY_POINT_RENAME(StyleRuns)
-#define SubstitutionLookup U_ICU_ENTRY_POINT_RENAME(SubstitutionLookup)
-#define SubtableProcessor U_ICU_ENTRY_POINT_RENAME(SubtableProcessor)
-#define SunTimeAngleFunc U_ICU_ENTRY_POINT_RENAME(SunTimeAngleFunc)
-#define SymbolTable U_ICU_ENTRY_POINT_RENAME(SymbolTable)
-#define TZEnumeration U_ICU_ENTRY_POINT_RENAME(TZEnumeration)
-#define TaiwanCalendar U_ICU_ENTRY_POINT_RENAME(TaiwanCalendar)
-#define Target U_ICU_ENTRY_POINT_RENAME(Target)
-#define TernaryNode U_ICU_ENTRY_POINT_RENAME(TernaryNode)
-#define TextTrieMap U_ICU_ENTRY_POINT_RENAME(TextTrieMap)
-#define TextTrieMapSearchResultHandler U_ICU_ENTRY_POINT_RENAME(TextTrieMapSearchResultHandler)
-#define ThaiBreakEngine U_ICU_ENTRY_POINT_RENAME(ThaiBreakEngine)
-#define ThaiLayoutEngine U_ICU_ENTRY_POINT_RENAME(ThaiLayoutEngine)
-#define ThaiShaping U_ICU_ENTRY_POINT_RENAME(ThaiShaping)
-#define TibetanClassTable U_ICU_ENTRY_POINT_RENAME(TibetanClassTable)
-#define TibetanOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(TibetanOpenTypeLayoutEngine)
-#define TibetanReordering U_ICU_ENTRY_POINT_RENAME(TibetanReordering)
-#define TimeArrayTimeZoneRule U_ICU_ENTRY_POINT_RENAME(TimeArrayTimeZoneRule)
-#define TimeUnit U_ICU_ENTRY_POINT_RENAME(TimeUnit)
-#define TimeUnitAmount U_ICU_ENTRY_POINT_RENAME(TimeUnitAmount)
-#define TimeUnitFormat U_ICU_ENTRY_POINT_RENAME(TimeUnitFormat)
-#define TimeZone U_ICU_ENTRY_POINT_RENAME(TimeZone)
-#define TimeZoneRule U_ICU_ENTRY_POINT_RENAME(TimeZoneRule)
-#define TimeZoneTransition U_ICU_ENTRY_POINT_RENAME(TimeZoneTransition)
-#define TitlecaseTransliterator U_ICU_ENTRY_POINT_RENAME(TitlecaseTransliterator)
-#define TransliterationRule U_ICU_ENTRY_POINT_RENAME(TransliterationRule)
-#define TransliterationRuleData U_ICU_ENTRY_POINT_RENAME(TransliterationRuleData)
-#define TransliterationRuleSet U_ICU_ENTRY_POINT_RENAME(TransliterationRuleSet)
-#define Transliterator U_ICU_ENTRY_POINT_RENAME(Transliterator)
-#define TransliteratorAlias U_ICU_ENTRY_POINT_RENAME(TransliteratorAlias)
-#define TransliteratorEntry U_ICU_ENTRY_POINT_RENAME(TransliteratorEntry)
-#define TransliteratorIDParser U_ICU_ENTRY_POINT_RENAME(TransliteratorIDParser)
-#define TransliteratorParser U_ICU_ENTRY_POINT_RENAME(TransliteratorParser)
-#define TransliteratorRegistry U_ICU_ENTRY_POINT_RENAME(TransliteratorRegistry)
-#define TransliteratorSpec U_ICU_ENTRY_POINT_RENAME(TransliteratorSpec)
-#define TriStateSingleton U_ICU_ENTRY_POINT_RENAME(TriStateSingleton)
-#define TrieWordDictionary U_ICU_ENTRY_POINT_RENAME(TrieWordDictionary)
-#define TrimmedArrayProcessor U_ICU_ENTRY_POINT_RENAME(TrimmedArrayProcessor)
-#define UCharCharacterIterator U_ICU_ENTRY_POINT_RENAME(UCharCharacterIterator)
-#define UCollationPCE U_ICU_ENTRY_POINT_RENAME(UCollationPCE)
-#define UDataPathIterator U_ICU_ENTRY_POINT_RENAME(UDataPathIterator)
-#define ULocRuns U_ICU_ENTRY_POINT_RENAME(ULocRuns)
-#define UMemory U_ICU_ENTRY_POINT_RENAME(UMemory)
-#define UObject U_ICU_ENTRY_POINT_RENAME(UObject)
-#define UStack U_ICU_ENTRY_POINT_RENAME(UStack)
-#define UStringEnumeration U_ICU_ENTRY_POINT_RENAME(UStringEnumeration)
-#define UTS46 U_ICU_ENTRY_POINT_RENAME(UTS46)
-#define UTrie2Singleton U_ICU_ENTRY_POINT_RENAME(UTrie2Singleton)
-#define UVector U_ICU_ENTRY_POINT_RENAME(UVector)
-#define UVector32 U_ICU_ENTRY_POINT_RENAME(UVector32)
-#define UVector64 U_ICU_ENTRY_POINT_RENAME(UVector64)
-#define UnescapeTransliterator U_ICU_ENTRY_POINT_RENAME(UnescapeTransliterator)
-#define UnhandledEngine U_ICU_ENTRY_POINT_RENAME(UnhandledEngine)
-#define UnicodeArabicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(UnicodeArabicOpenTypeLayoutEngine)
-#define UnicodeFilter U_ICU_ENTRY_POINT_RENAME(UnicodeFilter)
-#define UnicodeFunctor U_ICU_ENTRY_POINT_RENAME(UnicodeFunctor)
-#define UnicodeMatcher U_ICU_ENTRY_POINT_RENAME(UnicodeMatcher)
-#define UnicodeNameTransliterator U_ICU_ENTRY_POINT_RENAME(UnicodeNameTransliterator)
-#define UnicodeReplacer U_ICU_ENTRY_POINT_RENAME(UnicodeReplacer)
-#define UnicodeSet U_ICU_ENTRY_POINT_RENAME(UnicodeSet)
-#define UnicodeSetIterator U_ICU_ENTRY_POINT_RENAME(UnicodeSetIterator)
-#define UnicodeSetStringSpan U_ICU_ENTRY_POINT_RENAME(UnicodeSetStringSpan)
-#define UnicodeString U_ICU_ENTRY_POINT_RENAME(UnicodeString)
-#define UppercaseTransliterator U_ICU_ENTRY_POINT_RENAME(UppercaseTransliterator)
-#define VTZReader U_ICU_ENTRY_POINT_RENAME(VTZReader)
-#define VTZWriter U_ICU_ENTRY_POINT_RENAME(VTZWriter)
-#define VTimeZone U_ICU_ENTRY_POINT_RENAME(VTimeZone)
-#define ValueRecord U_ICU_ENTRY_POINT_RENAME(ValueRecord)
-#define ValueRuns U_ICU_ENTRY_POINT_RENAME(ValueRuns)
-#define ZSFCache U_ICU_ENTRY_POINT_RENAME(ZSFCache)
-#define ZSFCacheEntry U_ICU_ENTRY_POINT_RENAME(ZSFCacheEntry)
-#define ZSFStringPool U_ICU_ENTRY_POINT_RENAME(ZSFStringPool)
-#define ZSFStringPoolChunk U_ICU_ENTRY_POINT_RENAME(ZSFStringPoolChunk)
-#define ZoneMeta U_ICU_ENTRY_POINT_RENAME(ZoneMeta)
-#define ZoneStringFormat U_ICU_ENTRY_POINT_RENAME(ZoneStringFormat)
-#define ZoneStringInfo U_ICU_ENTRY_POINT_RENAME(ZoneStringInfo)
-#define ZoneStringSearchResultHandler U_ICU_ENTRY_POINT_RENAME(ZoneStringSearchResultHandler)
-#define ZoneStrings U_ICU_ENTRY_POINT_RENAME(ZoneStrings)
-#define collIterate U_ICU_ENTRY_POINT_RENAME(collIterate)
-#define locale_set_default_internal U_ICU_ENTRY_POINT_RENAME(locale_set_default_internal)
-#define util64_fromDouble U_ICU_ENTRY_POINT_RENAME(util64_fromDouble)
-#define util64_pow U_ICU_ENTRY_POINT_RENAME(util64_pow)
-#define util64_tou U_ICU_ENTRY_POINT_RENAME(util64_tou)
-
-#endif
-#endif
-
-#endif
-
-#endif
diff --git a/Source/core/icu/unicode/uscript.h b/Source/core/icu/unicode/uscript.h
deleted file mode 100644
index ee21c74..0000000
--- a/Source/core/icu/unicode/uscript.h
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- **********************************************************************
- *   Copyright (C) 1997-2010, International Business Machines
- *   Corporation and others.  All Rights Reserved.
- **********************************************************************
- *
- * File USCRIPT.H
- *
- * Modification History:
- *
- *   Date        Name        Description
- *   07/06/2001    Ram         Creation.
- ******************************************************************************
- */
-
-#ifndef USCRIPT_H
-#define USCRIPT_H
-#include "unicode/utypes.h"
-
-/**
- * \file
- * \brief C API: Unicode Script Information
- */
- 
-/**
- * Constants for ISO 15924 script codes.
- *
- * Many of these script codes - those from Unicode's ScriptNames.txt -
- * are character property values for Unicode's Script property.
- * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/).
- *
- * Starting with ICU 3.6, constants for most ISO 15924 script codes
- * are included (currently excluding private-use codes Qaaa..Qabx).
- * For scripts for which there are codes in ISO 15924 but which are not
- * used in the Unicode Character Database (UCD), there are no Unicode characters
- * associated with those scripts.
- *
- * For example, there are no characters that have a UCD script code of
- * Hans or Hant. All Han ideographs have the Hani script code.
- * The Hans and Hant script codes are used with CLDR data.
- *
- * ISO 15924 script codes are included for use with CLDR and similar.
- *
- * @stable ICU 2.2
- */
-typedef enum UScriptCode {
-      USCRIPT_INVALID_CODE = -1,
-      USCRIPT_COMMON       =  0,  /* Zyyy */
-      USCRIPT_INHERITED    =  1,  /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */
-      USCRIPT_ARABIC       =  2,  /* Arab */
-      USCRIPT_ARMENIAN     =  3,  /* Armn */
-      USCRIPT_BENGALI      =  4,  /* Beng */
-      USCRIPT_BOPOMOFO     =  5,  /* Bopo */
-      USCRIPT_CHEROKEE     =  6,  /* Cher */
-      USCRIPT_COPTIC       =  7,  /* Copt */
-      USCRIPT_CYRILLIC     =  8,  /* Cyrl */
-      USCRIPT_DESERET      =  9,  /* Dsrt */
-      USCRIPT_DEVANAGARI   = 10,  /* Deva */
-      USCRIPT_ETHIOPIC     = 11,  /* Ethi */
-      USCRIPT_GEORGIAN     = 12,  /* Geor */
-      USCRIPT_GOTHIC       = 13,  /* Goth */
-      USCRIPT_GREEK        = 14,  /* Grek */
-      USCRIPT_GUJARATI     = 15,  /* Gujr */
-      USCRIPT_GURMUKHI     = 16,  /* Guru */
-      USCRIPT_HAN          = 17,  /* Hani */
-      USCRIPT_HANGUL       = 18,  /* Hang */
-      USCRIPT_HEBREW       = 19,  /* Hebr */
-      USCRIPT_HIRAGANA     = 20,  /* Hira */
-      USCRIPT_KANNADA      = 21,  /* Knda */
-      USCRIPT_KATAKANA     = 22,  /* Kana */
-      USCRIPT_KHMER        = 23,  /* Khmr */
-      USCRIPT_LAO          = 24,  /* Laoo */
-      USCRIPT_LATIN        = 25,  /* Latn */
-      USCRIPT_MALAYALAM    = 26,  /* Mlym */
-      USCRIPT_MONGOLIAN    = 27,  /* Mong */
-      USCRIPT_MYANMAR      = 28,  /* Mymr */
-      USCRIPT_OGHAM        = 29,  /* Ogam */
-      USCRIPT_OLD_ITALIC   = 30,  /* Ital */
-      USCRIPT_ORIYA        = 31,  /* Orya */
-      USCRIPT_RUNIC        = 32,  /* Runr */
-      USCRIPT_SINHALA      = 33,  /* Sinh */
-      USCRIPT_SYRIAC       = 34,  /* Syrc */
-      USCRIPT_TAMIL        = 35,  /* Taml */
-      USCRIPT_TELUGU       = 36,  /* Telu */
-      USCRIPT_THAANA       = 37,  /* Thaa */
-      USCRIPT_THAI         = 38,  /* Thai */
-      USCRIPT_TIBETAN      = 39,  /* Tibt */
-      /** Canadian_Aboriginal script. @stable ICU 2.6 */
-      USCRIPT_CANADIAN_ABORIGINAL = 40,  /* Cans */
-      /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
-      USCRIPT_UCAS         = USCRIPT_CANADIAN_ABORIGINAL,
-      USCRIPT_YI           = 41,  /* Yiii */
-      USCRIPT_TAGALOG      = 42,  /* Tglg */
-      USCRIPT_HANUNOO      = 43,  /* Hano */
-      USCRIPT_BUHID        = 44,  /* Buhd */
-      USCRIPT_TAGBANWA     = 45,  /* Tagb */
-
-      /* New scripts in Unicode 4 @stable ICU 2.6 */
-      USCRIPT_BRAILLE      = 46,  /* Brai */
-      USCRIPT_CYPRIOT      = 47,  /* Cprt */
-      USCRIPT_LIMBU        = 48,  /* Limb */
-      USCRIPT_LINEAR_B     = 49,  /* Linb */
-      USCRIPT_OSMANYA      = 50,  /* Osma */
-      USCRIPT_SHAVIAN      = 51,  /* Shaw */
-      USCRIPT_TAI_LE       = 52,  /* Tale */
-      USCRIPT_UGARITIC     = 53,  /* Ugar */
-
-      /** New script code in Unicode 4.0.1 @stable ICU 3.0 */
-      USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */
-
-      /* New scripts in Unicode 4.1 @stable ICU 3.4 */
-      USCRIPT_BUGINESE      = 55, /* Bugi */
-      USCRIPT_GLAGOLITIC    = 56, /* Glag */
-      USCRIPT_KHAROSHTHI    = 57, /* Khar */
-      USCRIPT_SYLOTI_NAGRI  = 58, /* Sylo */
-      USCRIPT_NEW_TAI_LUE   = 59, /* Talu */
-      USCRIPT_TIFINAGH      = 60, /* Tfng */
-      USCRIPT_OLD_PERSIAN   = 61, /* Xpeo */
-
-      /* New script codes from ISO 15924 @stable ICU 3.6 */
-      USCRIPT_BALINESE                      = 62, /* Bali */
-      USCRIPT_BATAK                         = 63, /* Batk */
-      USCRIPT_BLISSYMBOLS                   = 64, /* Blis */
-      USCRIPT_BRAHMI                        = 65, /* Brah */
-      USCRIPT_CHAM                          = 66, /* Cham */
-      USCRIPT_CIRTH                         = 67, /* Cirt */
-      USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC  = 68, /* Cyrs */
-      USCRIPT_DEMOTIC_EGYPTIAN              = 69, /* Egyd */
-      USCRIPT_HIERATIC_EGYPTIAN             = 70, /* Egyh */
-      USCRIPT_EGYPTIAN_HIEROGLYPHS          = 71, /* Egyp */
-      USCRIPT_KHUTSURI                      = 72, /* Geok */
-      USCRIPT_SIMPLIFIED_HAN                = 73, /* Hans */
-      USCRIPT_TRADITIONAL_HAN               = 74, /* Hant */
-      USCRIPT_PAHAWH_HMONG                  = 75, /* Hmng */
-      USCRIPT_OLD_HUNGARIAN                 = 76, /* Hung */
-      USCRIPT_HARAPPAN_INDUS                = 77, /* Inds */
-      USCRIPT_JAVANESE                      = 78, /* Java */
-      USCRIPT_KAYAH_LI                      = 79, /* Kali */
-      USCRIPT_LATIN_FRAKTUR                 = 80, /* Latf */
-      USCRIPT_LATIN_GAELIC                  = 81, /* Latg */
-      USCRIPT_LEPCHA                        = 82, /* Lepc */
-      USCRIPT_LINEAR_A                      = 83, /* Lina */
-      /** @stable ICU 4.6 */
-      USCRIPT_MANDAIC                       = 84, /* Mand */
-      /** @stable ICU 3.6 */
-      USCRIPT_MANDAEAN                      = USCRIPT_MANDAIC,
-      USCRIPT_MAYAN_HIEROGLYPHS             = 85, /* Maya */
-      /** @stable ICU 4.6 */
-      USCRIPT_MEROITIC_HIEROGLYPHS          = 86, /* Mero */
-      /** @stable ICU 3.6 */
-      USCRIPT_MEROITIC                      = USCRIPT_MEROITIC_HIEROGLYPHS,
-      USCRIPT_NKO                           = 87, /* Nkoo */
-      USCRIPT_ORKHON                        = 88, /* Orkh */
-      USCRIPT_OLD_PERMIC                    = 89, /* Perm */
-      USCRIPT_PHAGS_PA                      = 90, /* Phag */
-      USCRIPT_PHOENICIAN                    = 91, /* Phnx */
-      USCRIPT_PHONETIC_POLLARD              = 92, /* Plrd */
-      USCRIPT_RONGORONGO                    = 93, /* Roro */
-      USCRIPT_SARATI                        = 94, /* Sara */
-      USCRIPT_ESTRANGELO_SYRIAC             = 95, /* Syre */
-      USCRIPT_WESTERN_SYRIAC                = 96, /* Syrj */
-      USCRIPT_EASTERN_SYRIAC                = 97, /* Syrn */
-      USCRIPT_TENGWAR                       = 98, /* Teng */
-      USCRIPT_VAI                           = 99, /* Vaii */
-      USCRIPT_VISIBLE_SPEECH                = 100,/* Visp */
-      USCRIPT_CUNEIFORM                     = 101,/* Xsux */
-      USCRIPT_UNWRITTEN_LANGUAGES           = 102,/* Zxxx */
-      USCRIPT_UNKNOWN                       = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
-
-      /* New script codes from ISO 15924 @stable ICU 3.8 */
-      USCRIPT_CARIAN                        = 104,/* Cari */
-      USCRIPT_JAPANESE                      = 105,/* Jpan */
-      USCRIPT_LANNA                         = 106,/* Lana */
-      USCRIPT_LYCIAN                        = 107,/* Lyci */
-      USCRIPT_LYDIAN                        = 108,/* Lydi */
-      USCRIPT_OL_CHIKI                      = 109,/* Olck */
-      USCRIPT_REJANG                        = 110,/* Rjng */
-      USCRIPT_SAURASHTRA                    = 111,/* Saur */
-      USCRIPT_SIGN_WRITING                  = 112,/* Sgnw */
-      USCRIPT_SUNDANESE                     = 113,/* Sund */
-      USCRIPT_MOON                          = 114,/* Moon */
-      USCRIPT_MEITEI_MAYEK                  = 115,/* Mtei */
-
-      /* New script codes from ISO 15924 @stable ICU 4.0 */
-      USCRIPT_IMPERIAL_ARAMAIC              = 116,/* Armi */
-      USCRIPT_AVESTAN                       = 117,/* Avst */
-      USCRIPT_CHAKMA                        = 118,/* Cakm */
-      USCRIPT_KOREAN                        = 119,/* Kore */
-      USCRIPT_KAITHI                        = 120,/* Kthi */
-      USCRIPT_MANICHAEAN                    = 121,/* Mani */
-      USCRIPT_INSCRIPTIONAL_PAHLAVI         = 122,/* Phli */
-      USCRIPT_PSALTER_PAHLAVI               = 123,/* Phlp */
-      USCRIPT_BOOK_PAHLAVI                  = 124,/* Phlv */
-      USCRIPT_INSCRIPTIONAL_PARTHIAN        = 125,/* Prti */
-      USCRIPT_SAMARITAN                     = 126,/* Samr */
-      USCRIPT_TAI_VIET                      = 127,/* Tavt */
-      USCRIPT_MATHEMATICAL_NOTATION         = 128,/* Zmth */
-      USCRIPT_SYMBOLS                       = 129,/* Zsym */
-
-      /* New script codes from ISO 15924 @stable ICU 4.4 */
-      USCRIPT_BAMUM                         = 130,/* Bamu */
-      USCRIPT_LISU                          = 131,/* Lisu */
-      USCRIPT_NAKHI_GEBA                    = 132,/* Nkgb */
-      USCRIPT_OLD_SOUTH_ARABIAN             = 133,/* Sarb */
-
-      /* New script codes from ISO 15924 @stable ICU 4.6 */
-      USCRIPT_BASSA_VAH                     = 134,/* Bass */
-      USCRIPT_DUPLOYAN_SHORTAND             = 135,/* Dupl */
-      USCRIPT_ELBASAN                       = 136,/* Elba */
-      USCRIPT_GRANTHA                       = 137,/* Gran */
-      USCRIPT_KPELLE                        = 138,/* Kpel */
-      USCRIPT_LOMA                          = 139,/* Loma */
-      USCRIPT_MENDE                         = 140,/* Mend */
-      USCRIPT_MEROITIC_CURSIVE              = 141,/* Merc */
-      USCRIPT_OLD_NORTH_ARABIAN             = 142,/* Narb */
-      USCRIPT_NABATAEAN                     = 143,/* Nbat */
-      USCRIPT_PALMYRENE                     = 144,/* Palm */
-      USCRIPT_SINDHI                        = 145,/* Sind */
-      USCRIPT_WARANG_CITI                   = 146,/* Wara */
-
-      /* Private use codes from Qaaa - Qabx are not supported */
-      USCRIPT_CODE_LIMIT    = 147
-} UScriptCode;
-
-/**
- * Gets script codes associated with the given locale or ISO 15924 abbreviation or name. 
- * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym".
- * Fills in USCRIPT_LATIN given "en" OR "en_US" 
- * If required capacity is greater than capacity of the destination buffer then the error code
- * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned
- *
- * <p>Note: To search by short or long script alias only, use
- * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead.  This does
- * a fast lookup with no access of the locale data.
- * @param nameOrAbbrOrLocale name of the script, as given in
- * PropertyValueAliases.txt, or ISO 15924 code or locale
- * @param fillIn the UScriptCode buffer to fill in the script code
- * @param capacity the capacity (size) fo UScriptCode buffer passed in.
- * @param err the error status code.
- * @return The number of script codes filled in the buffer passed in 
- * @stable ICU 2.4
- */
-U_STABLE int32_t  U_EXPORT2 
-uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err);
-
-/**
- * Gets a script name associated with the given script code. 
- * Returns  "Malayam" given USCRIPT_MALAYALAM
- * @param scriptCode UScriptCode enum
- * @return script long name as given in
- * PropertyValueAliases.txt, or NULL if scriptCode is invalid
- * @stable ICU 2.4
- */
-U_STABLE const char*  U_EXPORT2 
-uscript_getName(UScriptCode scriptCode);
-
-/**
- * Gets a script name associated with the given script code. 
- * Returns  "Mlym" given USCRIPT_MALAYALAM
- * @param scriptCode UScriptCode enum
- * @return script abbreviated name as given in
- * PropertyValueAliases.txt, or NULL if scriptCode is invalid
- * @stable ICU 2.4
- */
-U_STABLE const char*  U_EXPORT2 
-uscript_getShortName(UScriptCode scriptCode);
-
-/**
- * Gets the script code associated with the given codepoint.
- * Returns USCRIPT_MALAYALAM given 0x0D02 
- * @param codepoint UChar32 codepoint
- * @param err the error status code.
- * @return The UScriptCode, or 0 if codepoint is invalid 
- * @stable ICU 2.4
- */
-U_STABLE UScriptCode  U_EXPORT2 
-uscript_getScript(UChar32 codepoint, UErrorCode *err);
-
-/**
- * Is code point c used in script sc?
- * That is, does code point c have the Script property value sc,
- * or do code point c's Script_Extensions include script code sc?
- *
- * Some characters are commonly used in multiple scripts.
- * For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
- *
- * The Script_Extensions property is provisional. It may be modified or removed
- * in future versions of the Unicode Standard, and thus in ICU.
- * @param c code point
- * @param sc script code
- * @return TRUE if Script(c)==sc or sc is in Script_Extensions(c)
- * @draft ICU 4.6
- */
-U_DRAFT UBool U_EXPORT2
-uscript_hasScript(UChar32 c, UScriptCode sc);
-
-/**
- * Writes code point c's Script_Extensions as a list of UScriptCode values
- * to the output scripts array.
- *
- * Some characters are commonly used in multiple scripts.
- * For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
- *
- * If there are more than capacity script codes to be written, then
- * U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned.
- * (Usual ICU buffer handling behavior.)
- *
- * The Script_Extensions property is provisional. It may be modified or removed
- * in future versions of the Unicode Standard, and thus in ICU.
- * @param c code point
- * @param scripts output script code array
- * @param capacity capacity of the scripts array
- * @param errorCode Standard ICU error code. Its input value must
- *                  pass the U_SUCCESS() test, or else the function returns
- *                  immediately. Check for U_FAILURE() on output or use with
- *                  function chaining. (See User Guide for details.)
- * @return number of script codes in c's Script_Extensions,
- *         written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity
- * @draft ICU 4.6
- */
-U_DRAFT int32_t U_EXPORT2
-uscript_getScriptExtensions(UChar32 c,
-                            UScriptCode *scripts, int32_t capacity,
-                            UErrorCode *pErrorCode);
-
-#endif
diff --git a/Source/core/icu/unicode/usearch.h b/Source/core/icu/unicode/usearch.h
deleted file mode 100644
index 2f3d563..0000000
--- a/Source/core/icu/unicode/usearch.h
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 2001-2010 IBM and others. All rights reserved.
-**********************************************************************
-*   Date        Name        Description
-*  06/28/2001   synwee      Creation.
-**********************************************************************
-*/
-#ifndef USEARCH_H
-#define USEARCH_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
-
-#include "unicode/localpointer.h"
-#include "unicode/ucol.h"
-#include "unicode/ucoleitr.h"
-#include "unicode/ubrk.h"
-
-/**
- * \file
- * \brief C API: StringSearch
- *
- * C Apis for an engine that provides language-sensitive text searching based 
- * on the comparison rules defined in a <tt>UCollator</tt> data struct,
- * see <tt>ucol.h</tt>. This ensures that language eccentricity can be 
- * handled, e.g. for the German collator, characters &szlig; and SS will be matched 
- * if case is chosen to be ignored. 
- * See the <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
- * "ICU Collation Design Document"</a> for more information.
- * <p> 
- * The algorithm implemented is a modified form of the Boyer Moore's search.
- * For more information  see 
- * <a href="http://icu-project.org/docs/papers/efficient_text_searching_in_java.html">
- * "Efficient Text Searching in Java"</a>, published in <i>Java Report</i> 
- * in February, 1999, for further information on the algorithm.
- * <p>
- * There are 2 match options for selection:<br>
- * Let S' be the sub-string of a text string S between the offsets start and 
- * end <start, end>.
- * <br>
- * A pattern string P matches a text string S at the offsets <start, end> 
- * if
- * <pre> 
- * option 1. Some canonical equivalent of P matches some canonical equivalent 
- *           of S'
- * option 2. P matches S' and if P starts or ends with a combining mark, 
- *           there exists no non-ignorable combining mark before or after S' 
- *           in S respectively. 
- * </pre>
- * Option 2. will be the default.
- * <p>
- * This search has APIs similar to that of other text iteration mechanisms 
- * such as the break iterators in <tt>ubrk.h</tt>. Using these 
- * APIs, it is easy to scan through text looking for all occurances of 
- * a given pattern. This search iterator allows changing of direction by 
- * calling a <tt>reset</tt> followed by a <tt>next</tt> or <tt>previous</tt>. 
- * Though a direction change can occur without calling <tt>reset</tt> first,  
- * this operation comes with some speed penalty.
- * Generally, match results in the forward direction will match the result 
- * matches in the backwards direction in the reverse order
- * <p>
- * <tt>usearch.h</tt> provides APIs to specify the starting position 
- * within the text string to be searched, e.g. <tt>usearch_setOffset</tt>,
- * <tt>usearch_preceding</tt> and <tt>usearch_following</tt>. Since the 
- * starting position will be set as it is specified, please take note that 
- * there are some dangerous positions which the search may render incorrect 
- * results:
- * <ul>
- * <li> The midst of a substring that requires normalization.
- * <li> If the following match is to be found, the position should not be the
- *      second character which requires to be swapped with the preceding 
- *      character. Vice versa, if the preceding match is to be found, 
- *      position to search from should not be the first character which 
- *      requires to be swapped with the next character. E.g certain Thai and
- *      Lao characters require swapping.
- * <li> If a following pattern match is to be found, any position within a 
- *      contracting sequence except the first will fail. Vice versa if a 
- *      preceding pattern match is to be found, a invalid starting point 
- *      would be any character within a contracting sequence except the last.
- * </ul>
- * <p>
- * A breakiterator can be used if only matches at logical breaks are desired.
- * Using a breakiterator will only give you results that exactly matches the
- * boundaries given by the breakiterator. For instance the pattern "e" will
- * not be found in the string "\u00e9" if a character break iterator is used.
- * <p>
- * Options are provided to handle overlapping matches. 
- * E.g. In English, overlapping matches produces the result 0 and 2 
- * for the pattern "abab" in the text "ababab", where else mutually 
- * exclusive matches only produce the result of 0.
- * <p>
- * Though collator attributes will be taken into consideration while 
- * performing matches, there are no APIs here for setting and getting the 
- * attributes. These attributes can be set by getting the collator
- * from <tt>usearch_getCollator</tt> and using the APIs in <tt>ucol.h</tt>.
- * Lastly to update String Search to the new collator attributes, 
- * usearch_reset() has to be called.
- * <p> 
- * Restriction: <br>
- * Currently there are no composite characters that consists of a
- * character with combining class > 0 before a character with combining 
- * class == 0. However, if such a character exists in the future, the 
- * search mechanism does not guarantee the results for option 1.
- * 
- * <p>
- * Example of use:<br>
- * <pre><code>
- * char *tgtstr = "The quick brown fox jumped over the lazy fox";
- * char *patstr = "fox";
- * UChar target[64];
- * UChar pattern[16];
- * UErrorCode status = U_ZERO_ERROR;
- * u_uastrcpy(target, tgtstr);
- * u_uastrcpy(pattern, patstr);
- *
- * UStringSearch *search = usearch_open(pattern, -1, target, -1, "en_US", 
- *                                  NULL, &status);
- * if (U_SUCCESS(status)) {
- *     for (int pos = usearch_first(search, &status); 
- *          pos != USEARCH_DONE; 
- *          pos = usearch_next(search, &status))
- *     {
- *         printf("Found match at %d pos, length is %d\n", pos, 
- *                                        usearch_getMatchLength(search));
- *     }
- * }
- *
- * usearch_close(search);
- * </code></pre>
- * @stable ICU 2.4
- */
-
-/**
-* DONE is returned by previous() and next() after all valid matches have 
-* been returned, and by first() and last() if there are no matches at all.
-* @stable ICU 2.4
-*/
-#define USEARCH_DONE -1
-
-/**
-* Data structure for searching
-* @stable ICU 2.4
-*/
-struct UStringSearch;
-/**
-* Data structure for searching
-* @stable ICU 2.4
-*/
-typedef struct UStringSearch UStringSearch;
-
-/**
-* @stable ICU 2.4
-*/
-typedef enum {
-    /** Option for overlapping matches */
-    USEARCH_OVERLAP,
-    /** 
-     * Option for canonical matches. option 1 in header documentation.
-     * The default value will be USEARCH_OFF
-     */
-    USEARCH_CANONICAL_MATCH,
-    /** 
-     * Option to control how collation elements are compared.
-     * The default value will be USEARCH_STANDARD_ELEMENT_COMPARISON.
-     * @stable ICU 4.4
-     */
-    USEARCH_ELEMENT_COMPARISON,
-
-    USEARCH_ATTRIBUTE_COUNT
-} USearchAttribute;
-
-/**
-* @stable ICU 2.4
-*/
-typedef enum {
-    /** Default value for any USearchAttribute */
-    USEARCH_DEFAULT = -1,
-    /** Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
-    USEARCH_OFF, 
-    /** Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
-    USEARCH_ON,
-    /** 
-     * Value (default) for USEARCH_ELEMENT_COMPARISON;
-     * standard collation element comparison at the specified collator
-     * strength.
-     * @stable ICU 4.4
-     */
-    USEARCH_STANDARD_ELEMENT_COMPARISON,
-    /** 
-     * Value for USEARCH_ELEMENT_COMPARISON;
-     * collation element comparison is modified to effectively provide
-     * behavior between the specified strength and strength - 1. Collation
-     * elements in the pattern that have the base weight for the specified
-     * strength are treated as "wildcards" that match an element with any
-     * other weight at that collation level in the searched text. For
-     * example, with a secondary-strength English collator, a plain 'e' in
-     * the pattern will match a plain e or an e with any diacritic in the
-     * searched text, but an e with diacritic in the pattern will only
-     * match an e with the same diacritic in the searched text.
-     * @stable ICU 4.4
-     */
-    USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD,
-    /** 
-     * Value for USEARCH_ELEMENT_COMPARISON.
-     * collation element comparison is modified to effectively provide
-     * behavior between the specified strength and strength - 1. Collation
-     * elements in either the pattern or the searched text that have the
-     * base weight for the specified strength are treated as "wildcards"
-     * that match an element with any other weight at that collation level.
-     * For example, with a secondary-strength English collator, a plain 'e'
-     * in the pattern will match a plain e or an e with any diacritic in the
-     * searched text, but an e with diacritic in the pattern will only
-     * match an e with the same diacritic or a plain e in the searched text.
-     * @stable ICU 4.4
-     */
-    USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD,
-
-    USEARCH_ATTRIBUTE_VALUE_COUNT
-} USearchAttributeValue;
-
-/* open and close ------------------------------------------------------ */
-
-/**
-* Creating a search iterator data struct using the argument locale language
-* rule set. A collator will be created in the process, which will be owned by
-* this search and will be deleted in <tt>usearch_close</tt>.
-* @param pattern for matching
-* @param patternlength length of the pattern, -1 for null-termination
-* @param text text string
-* @param textlength length of the text string, -1 for null-termination
-* @param locale name of locale for the rules to be used
-* @param breakiter A BreakIterator that will be used to restrict the points
-*                  at which matches are detected. If a match is found, but 
-*                  the match's start or end index is not a boundary as 
-*                  determined by the <tt>BreakIterator</tt>, the match will 
-*                  be rejected and another will be searched for. 
-*                  If this parameter is <tt>NULL</tt>, no break detection is 
-*                  attempted.
-* @param status for errors if it occurs. If pattern or text is NULL, or if
-*               patternlength or textlength is 0 then an 
-*               U_ILLEGAL_ARGUMENT_ERROR is returned.
-* @return search iterator data structure, or NULL if there is an error.
-* @stable ICU 2.4
-*/
-U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar          *pattern, 
-                                              int32_t         patternlength, 
-                                        const UChar          *text, 
-                                              int32_t         textlength,
-                                        const char           *locale,
-                                              UBreakIterator *breakiter,
-                                              UErrorCode     *status);
-
-/**
-* Creating a search iterator data struct using the argument collator language
-* rule set. Note, user retains the ownership of this collator, thus the 
-* responsibility of deletion lies with the user.
-* NOTE: string search cannot be instantiated from a collator that has 
-* collate digits as numbers (CODAN) turned on.
-* @param pattern for matching
-* @param patternlength length of the pattern, -1 for null-termination
-* @param text text string
-* @param textlength length of the text string, -1 for null-termination
-* @param collator used for the language rules
-* @param breakiter A BreakIterator that will be used to restrict the points
-*                  at which matches are detected. If a match is found, but 
-*                  the match's start or end index is not a boundary as 
-*                  determined by the <tt>BreakIterator</tt>, the match will 
-*                  be rejected and another will be searched for. 
-*                  If this parameter is <tt>NULL</tt>, no break detection is 
-*                  attempted.
-* @param status for errors if it occurs. If collator, pattern or text is NULL, 
-*               or if patternlength or textlength is 0 then an 
-*               U_ILLEGAL_ARGUMENT_ERROR is returned.
-* @return search iterator data structure, or NULL if there is an error.
-* @stable ICU 2.4
-*/
-U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
-                                         const UChar *pattern, 
-                                               int32_t         patternlength,
-                                         const UChar          *text, 
-                                               int32_t         textlength,
-                                         const UCollator      *collator,
-                                               UBreakIterator *breakiter,
-                                               UErrorCode     *status);
-
-/**
-* Destroying and cleaning up the search iterator data struct.
-* If a collator is created in <tt>usearch_open</tt>, it will be destroyed here.
-* @param searchiter data struct to clean up
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUStringSearchPointer
- * "Smart pointer" class, closes a UStringSearch via usearch_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/* get and set methods -------------------------------------------------- */
-
-/**
-* Sets the current position in the text string which the next search will 
-* start from. Clears previous states. 
-* This method takes the argument index and sets the position in the text 
-* string accordingly without checking if the index is pointing to a 
-* valid starting point to begin searching. 
-* Search positions that may render incorrect results are highlighted in the
-* header comments
-* @param strsrch search iterator data struct
-* @param position position to start next search from. If position is less
-*          than or greater than the text range for searching, 
-*          an U_INDEX_OUTOFBOUNDS_ERROR will be returned
-* @param status error status if any.
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, 
-                                        int32_t    position,
-                                        UErrorCode    *status);
-
-/**
-* Return the current index in the string text being searched.
-* If the iteration has gone past the end of the text (or past the beginning 
-* for a backwards search), <tt>USEARCH_DONE</tt> is returned.
-* @param strsrch search iterator data struct
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
-    
-/**
-* Sets the text searching attributes located in the enum USearchAttribute
-* with values from the enum USearchAttributeValue.
-* <tt>USEARCH_DEFAULT</tt> can be used for all attributes for resetting.
-* @param strsrch search iterator data struct
-* @param attribute text attribute to be set
-* @param value text attribute value
-* @param status for errors if it occurs
-* @see #usearch_getAttribute
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch         *strsrch, 
-                                           USearchAttribute       attribute,
-                                           USearchAttributeValue  value,
-                                           UErrorCode            *status);
-
-/**    
-* Gets the text searching attributes.
-* @param strsrch search iterator data struct
-* @param attribute text attribute to be retrieve
-* @return text attribute value
-* @see #usearch_setAttribute
-* @stable ICU 2.4
-*/
-U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
-                                         const UStringSearch    *strsrch,
-                                               USearchAttribute  attribute);
-
-/**
-* Returns the index to the match in the text string that was searched.
-* This call returns a valid result only after a successful call to 
-* <tt>usearch_first</tt>, <tt>usearch_next</tt>, <tt>usearch_previous</tt>, 
-* or <tt>usearch_last</tt>.
-* Just after construction, or after a searching method returns 
-* <tt>USEARCH_DONE</tt>, this method will return <tt>USEARCH_DONE</tt>.
-* <p>
-* Use <tt>usearch_getMatchedLength</tt> to get the matched string length.
-* @param strsrch search iterator data struct
-* @return index to a substring within the text string that is being 
-*         searched.
-* @see #usearch_first
-* @see #usearch_next
-* @see #usearch_previous
-* @see #usearch_last
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
-                                               const UStringSearch *strsrch);
-    
-/**
-* Returns the length of text in the string which matches the search pattern. 
-* This call returns a valid result only after a successful call to 
-* <tt>usearch_first</tt>, <tt>usearch_next</tt>, <tt>usearch_previous</tt>, 
-* or <tt>usearch_last</tt>.
-* Just after construction, or after a searching method returns 
-* <tt>USEARCH_DONE</tt>, this method will return 0.
-* @param strsrch search iterator data struct
-* @return The length of the match in the string text, or 0 if there is no 
-*         match currently.
-* @see #usearch_first
-* @see #usearch_next
-* @see #usearch_previous
-* @see #usearch_last
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
-                                               const UStringSearch *strsrch);
-
-/**
-* Returns the text that was matched by the most recent call to 
-* <tt>usearch_first</tt>, <tt>usearch_next</tt>, <tt>usearch_previous</tt>, 
-* or <tt>usearch_last</tt>.
-* If the iterator is not pointing at a valid match (e.g. just after 
-* construction or after <tt>USEARCH_DONE</tt> has been returned, returns
-* an empty string. If result is not large enough to store the matched text,
-* result will be filled with the partial text and an U_BUFFER_OVERFLOW_ERROR 
-* will be returned in status. result will be null-terminated whenever 
-* possible. If the buffer fits the matched text exactly, a null-termination 
-* is not possible, then a U_STRING_NOT_TERMINATED_ERROR set in status.
-* Pre-flighting can be either done with length = 0 or the API 
-* <tt>usearch_getMatchLength</tt>.
-* @param strsrch search iterator data struct
-* @param result UChar buffer to store the matched string
-* @param resultCapacity length of the result buffer
-* @param status error returned if result is not large enough
-* @return exact length of the matched text, not counting the null-termination
-* @see #usearch_first
-* @see #usearch_next
-* @see #usearch_previous
-* @see #usearch_last
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, 
-                                            UChar         *result, 
-                                            int32_t        resultCapacity, 
-                                            UErrorCode    *status);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-/**
-* Set the BreakIterator that will be used to restrict the points at which 
-* matches are detected.
-* @param strsrch search iterator data struct
-* @param breakiter A BreakIterator that will be used to restrict the points
-*                  at which matches are detected. If a match is found, but 
-*                  the match's start or end index is not a boundary as 
-*                  determined by the <tt>BreakIterator</tt>, the match will 
-*                  be rejected and another will be searched for. 
-*                  If this parameter is <tt>NULL</tt>, no break detection is 
-*                  attempted.
-* @param status for errors if it occurs
-* @see #usearch_getBreakIterator
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch  *strsrch, 
-                                               UBreakIterator *breakiter,
-                                               UErrorCode     *status);
-
-/**
-* Returns the BreakIterator that is used to restrict the points at which 
-* matches are detected. This will be the same object that was passed to the 
-* constructor or to <tt>usearch_setBreakIterator</tt>. Note that 
-* <tt>NULL</tt> 
-* is a legal value; it means that break detection should not be attempted.
-* @param strsrch search iterator data struct
-* @return break iterator used
-* @see #usearch_setBreakIterator
-* @stable ICU 2.4
-*/
-U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
-                                              const UStringSearch *strsrch);
-    
-#endif
-    
-/**
-* Set the string text to be searched. Text iteration will hence begin at the 
-* start of the text string. This method is useful if you want to re-use an 
-* iterator to search for the same pattern within a different body of text.
-* @param strsrch search iterator data struct
-* @param text new string to look for match
-* @param textlength length of the new string, -1 for null-termination
-* @param status for errors if it occurs. If text is NULL, or textlength is 0 
-*               then an U_ILLEGAL_ARGUMENT_ERROR is returned with no change
-*               done to strsrch.
-* @see #usearch_getText
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_setText(      UStringSearch *strsrch, 
-                                      const UChar         *text,
-                                            int32_t        textlength,
-                                            UErrorCode    *status);
-
-/**
-* Return the string text to be searched.
-* @param strsrch search iterator data struct
-* @param length returned string text length
-* @return string text 
-* @see #usearch_setText
-* @stable ICU 2.4
-*/
-U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, 
-                                               int32_t       *length);
-
-/**
-* Gets the collator used for the language rules. 
-* <p>
-* Deleting the returned <tt>UCollator</tt> before calling 
-* <tt>usearch_close</tt> would cause the string search to fail.
-* <tt>usearch_close</tt> will delete the collator if this search owns it.
-* @param strsrch search iterator data struct
-* @return collator
-* @stable ICU 2.4
-*/
-U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
-                                               const UStringSearch *strsrch);
-
-/**
-* Sets the collator used for the language rules. User retains the ownership 
-* of this collator, thus the responsibility of deletion lies with the user.
-* This method causes internal data such as Boyer-Moore shift tables to  
-* be recalculated, but the iterator's position is unchanged.
-* @param strsrch search iterator data struct
-* @param collator to be used
-* @param status for errors if it occurs
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_setCollator(      UStringSearch *strsrch, 
-                                          const UCollator     *collator,
-                                                UErrorCode    *status);
-
-/**
-* Sets the pattern used for matching.
-* Internal data like the Boyer Moore table will be recalculated, but the 
-* iterator's position is unchanged.
-* @param strsrch search iterator data struct
-* @param pattern string
-* @param patternlength pattern length, -1 for null-terminated string
-* @param status for errors if it occurs. If text is NULL, or textlength is 0 
-*               then an U_ILLEGAL_ARGUMENT_ERROR is returned with no change
-*               done to strsrch.
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_setPattern(      UStringSearch *strsrch, 
-                                         const UChar         *pattern,
-                                               int32_t        patternlength,
-                                               UErrorCode    *status);
-
-/**
-* Gets the search pattern
-* @param strsrch search iterator data struct
-* @param length return length of the pattern, -1 indicates that the pattern 
-*               is null-terminated
-* @return pattern string
-* @stable ICU 2.4
-*/
-U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
-                                               const UStringSearch *strsrch, 
-                                                     int32_t       *length);
-
-/* methods ------------------------------------------------------------- */
-
-/**
-* Returns the first index at which the string text matches the search 
-* pattern.  
-* The iterator is adjusted so that its current index (as returned by 
-* <tt>usearch_getOffset</tt>) is the match position if one was found.
-* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
-* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>.
-* @param strsrch search iterator data struct
-* @param status for errors if it occurs
-* @return The character index of the first match, or 
-* <tt>USEARCH_DONE</tt> if there are no matches.
-* @see #usearch_getOffset
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, 
-                                           UErrorCode    *status);
-
-/**
-* Returns the first index greater than <tt>position</tt> at which the string 
-* text 
-* matches the search pattern. The iterator is adjusted so that its current 
-* index (as returned by <tt>usearch_getOffset</tt>) is the match position if 
-* one was found.
-* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
-* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
-* <p>
-* Search positions that may render incorrect results are highlighted in the
-* header comments. If position is less than or greater than the text range 
-* for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned
-* @param strsrch search iterator data struct
-* @param position to start the search at
-* @param status for errors if it occurs
-* @return The character index of the first match following <tt>pos</tt>,
-*         or <tt>USEARCH_DONE</tt> if there are no matches.
-* @see #usearch_getOffset
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, 
-                                               int32_t    position, 
-                                               UErrorCode    *status);
-    
-/**
-* Returns the last index in the target text at which it matches the search 
-* pattern. The iterator is adjusted so that its current 
-* index (as returned by <tt>usearch_getOffset</tt>) is the match position if 
-* one was found.
-* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
-* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>.
-* @param strsrch search iterator data struct
-* @param status for errors if it occurs
-* @return The index of the first match, or <tt>USEARCH_DONE</tt> if there 
-*         are no matches.
-* @see #usearch_getOffset
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, 
-                                          UErrorCode    *status);
-
-/**
-* Returns the first index less than <tt>position</tt> at which the string text 
-* matches the search pattern. The iterator is adjusted so that its current 
-* index (as returned by <tt>usearch_getOffset</tt>) is the match position if 
-* one was found.
-* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
-* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
-* <p>
-* Search positions that may render incorrect results are highlighted in the
-* header comments. If position is less than or greater than the text range 
-* for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned
-* @param strsrch search iterator data struct
-* @param position index position the search is to begin at
-* @param status for errors if it occurs
-* @return The character index of the first match preceding <tt>pos</tt>,
-*         or <tt>USEARCH_DONE</tt> if there are no matches.
-* @see #usearch_getOffset
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, 
-                                               int32_t    position, 
-                                               UErrorCode    *status);
-    
-/**
-* Returns the index of the next point at which the string text matches the
-* search pattern, starting from the current position.
-* The iterator is adjusted so that its current 
-* index (as returned by <tt>usearch_getOffset</tt>) is the match position if 
-* one was found.
-* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
-* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
-* @param strsrch search iterator data struct
-* @param status for errors if it occurs
-* @return The index of the next match after the current position, or 
-*         <tt>USEARCH_DONE</tt> if there are no more matches.
-* @see #usearch_first
-* @see #usearch_getOffset
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, 
-                                          UErrorCode    *status);
-
-/**
-* Returns the index of the previous point at which the string text matches
-* the search pattern, starting at the current position.
-* The iterator is adjusted so that its current 
-* index (as returned by <tt>usearch_getOffset</tt>) is the match position if 
-* one was found.
-* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
-* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
-* @param strsrch search iterator data struct
-* @param status for errors if it occurs
-* @return The index of the previous match before the current position,
-*         or <tt>USEARCH_DONE</tt> if there are no more matches.
-* @see #usearch_last
-* @see #usearch_getOffset
-* @see #USEARCH_DONE
-* @stable ICU 2.4
-*/
-U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, 
-                                              UErrorCode    *status);
-    
-/** 
-* Reset the iteration.
-* Search will begin at the start of the text string if a forward iteration 
-* is initiated before a backwards iteration. Otherwise if a backwards 
-* iteration is initiated before a forwards iteration, the search will begin
-* at the end of the text string.
-* @param strsrch search iterator data struct
-* @see #usearch_first
-* @stable ICU 2.4
-*/
-U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
-
-/**
-  *  Simple forward search for the pattern, starting at a specified index,
-  *     and using using a default set search options.
-  *
-  *  This is an experimental function, and is not an official part of the
-  *      ICU API.
-  *
-  *  The collator options, such as UCOL_STRENGTH and UCOL_NORMALIZTION, are honored.
-  *
-  *  The UStringSearch options USEARCH_CANONICAL_MATCH, USEARCH_OVERLAP and
-  *  any Break Iterator are ignored.
-  *
-  *  Matches obey the following constraints:
-  *
-  *      Characters at the start or end positions of a match that are ignorable
-  *      for collation are not included as part of the match, unless they
-  *      are part of a combining sequence, as described below.
-  *
-  *      A match will not include a partial combining sequence.  Combining
-  *      character sequences  are considered to be  inseperable units,
-  *      and either match the pattern completely, or are considered to not match
-  *      at all.  Thus, for example, an A followed a combining accent mark will 
-  *      not be found when searching for a plain (unaccented) A.   (unless
-  *      the collation strength has been set to ignore all accents).
-  *
-  *      When beginning a search, the initial starting position, startIdx,
-  *      is assumed to be an acceptable match boundary with respect to
-  *      combining characters.  A combining sequence that spans across the
-  *      starting point will not supress a match beginning at startIdx.
-  *
-  *      Characters that expand to multiple collation elements
-  *      (German sharp-S becoming 'ss', or the composed forms of accented
-  *      characters, for example) also must match completely.
-  *      Searching for a single 's' in a string containing only a sharp-s will 
-  *      find no match.
-  *
-  *
-  *  @param strsrch    the UStringSearch struct, which references both
-  *                    the text to be searched  and the pattern being sought.
-  *  @param startIdx   The index into the text to begin the search.
-  *  @param matchStart An out parameter, the starting index of the matched text.
-  *                    This parameter may be NULL.
-  *                    A value of -1 will be returned if no match was found.
-  *  @param matchLimit Out parameter, the index of the first position following the matched text.
-  *                    The matchLimit will be at a suitable position for beginning a subsequent search
-  *                    in the input text.
-  *                    This parameter may be NULL.
-  *                    A value of -1 will be returned if no match was found.
-  *          
-  *  @param status     Report any errors.  Note that no match found is not an error.
-  *  @return           TRUE if a match was found, FALSE otherwise.
-  *
-  *  @internal
-  */
-U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
-                                          int32_t        startIdx,
-                                          int32_t        *matchStart,
-                                          int32_t        *matchLimit,
-                                          UErrorCode     *status);
-
-/**
-  *  Simple backwards search for the pattern, starting at a specified index,
-  *     and using using a default set search options.
-  *
-  *  This is an experimental function, and is not an official part of the
-  *      ICU API.
-  *
-  *  The collator options, such as UCOL_STRENGTH and UCOL_NORMALIZTION, are honored.
-  *
-  *  The UStringSearch options USEARCH_CANONICAL_MATCH, USEARCH_OVERLAP and
-  *  any Break Iterator are ignored.
-  *
-  *  Matches obey the following constraints:
-  *
-  *      Characters at the start or end positions of a match that are ignorable
-  *      for collation are not included as part of the match, unless they
-  *      are part of a combining sequence, as described below.
-  *
-  *      A match will not include a partial combining sequence.  Combining
-  *      character sequences  are considered to be  inseperable units,
-  *      and either match the pattern completely, or are considered to not match
-  *      at all.  Thus, for example, an A followed a combining accent mark will 
-  *      not be found when searching for a plain (unaccented) A.   (unless
-  *      the collation strength has been set to ignore all accents).
-  *
-  *      When beginning a search, the initial starting position, startIdx,
-  *      is assumed to be an acceptable match boundary with respect to
-  *      combining characters.  A combining sequence that spans across the
-  *      starting point will not supress a match beginning at startIdx.
-  *
-  *      Characters that expand to multiple collation elements
-  *      (German sharp-S becoming 'ss', or the composed forms of accented
-  *      characters, for example) also must match completely.
-  *      Searching for a single 's' in a string containing only a sharp-s will 
-  *      find no match.
-  *
-  *
-  *  @param strsrch    the UStringSearch struct, which references both
-  *                    the text to be searched  and the pattern being sought.
-  *  @param startIdx   The index into the text to begin the search.
-  *  @param matchStart An out parameter, the starting index of the matched text.
-  *                    This parameter may be NULL.
-  *                    A value of -1 will be returned if no match was found.
-  *  @param matchLimit Out parameter, the index of the first position following the matched text.
-  *                    The matchLimit will be at a suitable position for beginning a subsequent search
-  *                    in the input text.
-  *                    This parameter may be NULL.
-  *                    A value of -1 will be returned if no match was found.
-  *          
-  *  @param status     Report any errors.  Note that no match found is not an error.
-  *  @return           TRUE if a match was found, FALSE otherwise.
-  *
-  *  @internal
-  */
-U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
-                                                   int32_t        startIdx,
-                                                   int32_t        *matchStart,
-                                                   int32_t        *matchLimit,
-                                                   UErrorCode     *status);
-
-#endif /* #if !UCONFIG_NO_COLLATION  && !UCONFIG_NO_BREAK_ITERATION */
-
-#endif
diff --git a/Source/core/icu/unicode/uset.h b/Source/core/icu/unicode/uset.h
deleted file mode 100644
index 77ab063..0000000
--- a/Source/core/icu/unicode/uset.h
+++ /dev/null
@@ -1,1120 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2002-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  uset.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2002mar07
-*   created by: Markus W. Scherer
-*
-*   C version of UnicodeSet.
-*/
-
-
-/**
- * \file
- * \brief C API: Unicode Set
- *
- * <p>This is a C wrapper around the C++ UnicodeSet class.</p>
- */
-
-#ifndef __USET_H__
-#define __USET_H__
-
-#include "unicode/utypes.h"
-#include "unicode/uchar.h"
-#include "unicode/localpointer.h"
-
-#ifndef UCNV_H
-struct USet;
-/**
- * A UnicodeSet.  Use the uset_* API to manipulate.  Create with
- * uset_open*, and destroy with uset_close.
- * @stable ICU 2.4
- */
-typedef struct USet USet;
-#endif
-
-/**
- * Bitmask values to be passed to uset_openPatternOptions() or
- * uset_applyPattern() taking an option parameter.
- * @stable ICU 2.4
- */
-enum {
-    /**
-     * Ignore white space within patterns unless quoted or escaped.
-     * @stable ICU 2.4
-     */
-    USET_IGNORE_SPACE = 1,  
-
-    /**
-     * Enable case insensitive matching.  E.g., "[ab]" with this flag
-     * will match 'a', 'A', 'b', and 'B'.  "[^ab]" with this flag will
-     * match all except 'a', 'A', 'b', and 'B'. This performs a full
-     * closure over case mappings, e.g. U+017F for s.
-     *
-     * The resulting set is a superset of the input for the code points but
-     * not for the strings.
-     * It performs a case mapping closure of the code points and adds
-     * full case folding strings for the code points, and reduces strings of
-     * the original set to their full case folding equivalents.
-     *
-     * This is designed for case-insensitive matches, for example
-     * in regular expressions. The full code point case closure allows checking of
-     * an input character directly against the closure set.
-     * Strings are matched by comparing the case-folded form from the closure
-     * set with an incremental case folding of the string in question.
-     *
-     * The closure set will also contain single code points if the original
-     * set contained case-equivalent strings (like U+00DF for "ss" or "Ss" etc.).
-     * This is not necessary (that is, redundant) for the above matching method
-     * but results in the same closure sets regardless of whether the original
-     * set contained the code point or a string.
-     *
-     * @stable ICU 2.4
-     */
-    USET_CASE_INSENSITIVE = 2,  
-
-    /**
-     * Enable case insensitive matching.  E.g., "[ab]" with this flag
-     * will match 'a', 'A', 'b', and 'B'.  "[^ab]" with this flag will
-     * match all except 'a', 'A', 'b', and 'B'. This adds the lower-,
-     * title-, and uppercase mappings as well as the case folding
-     * of each existing element in the set.
-     * @stable ICU 3.2
-     */
-    USET_ADD_CASE_MAPPINGS = 4,
-    
-    /**
-     * Enough for any single-code point set
-     * @internal
-     */
-    USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8
-};
-
-/**
- * Argument values for whether span() and similar functions continue while
- * the current character is contained vs. not contained in the set.
- *
- * The functionality is straightforward for sets with only single code points,
- * without strings (which is the common case):
- * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE
- *   work the same.
- * - span() and spanBack() partition any string the same way when
- *   alternating between span(USET_SPAN_NOT_CONTAINED) and
- *   span(either "contained" condition).
- * - Using a complemented (inverted) set and the opposite span conditions
- *   yields the same results.
- *
- * When a set contains multi-code point strings, then these statements may not
- * be true, depending on the strings in the set (for example, whether they
- * overlap with each other) and the string that is processed.
- * For a set with strings:
- * - The complement of the set contains the opposite set of code points,
- *   but the same set of strings.
- *   Therefore, complementing both the set and the span conditions
- *   may yield different results.
- * - When starting spans at different positions in a string
- *   (span(s, ...) vs. span(s+1, ...)) the ends of the spans may be different
- *   because a set string may start before the later position.
- * - span(USET_SPAN_SIMPLE) may be shorter than
- *   span(USET_SPAN_CONTAINED) because it will not recursively try
- *   all possible paths.
- *   For example, with a set which contains the three strings "xy", "xya" and "ax",
- *   span("xyax", USET_SPAN_CONTAINED) will return 4 but
- *   span("xyax", USET_SPAN_SIMPLE) will return 3.
- *   span(USET_SPAN_SIMPLE) will never be longer than
- *   span(USET_SPAN_CONTAINED).
- * - With either "contained" condition, span() and spanBack() may partition
- *   a string in different ways.
- *   For example, with a set which contains the two strings "ab" and "ba",
- *   and when processing the string "aba",
- *   span() will yield contained/not-contained boundaries of { 0, 2, 3 }
- *   while spanBack() will yield boundaries of { 0, 1, 3 }.
- *
- * Note: If it is important to get the same boundaries whether iterating forward
- * or backward through a string, then either only span() should be used and
- * the boundaries cached for backward operation, or an ICU BreakIterator
- * could be used.
- *
- * Note: Unpaired surrogates are treated like surrogate code points.
- * Similarly, set strings match only on code point boundaries,
- * never in the middle of a surrogate pair.
- * Illegal UTF-8 sequences are treated like U+FFFD.
- * When processing UTF-8 strings, malformed set strings
- * (strings with unpaired surrogates which cannot be converted to UTF-8)
- * are ignored.
- *
- * @stable ICU 3.8
- */
-typedef enum USetSpanCondition {
-    /**
-     * Continue a span() while there is no set element at the current position.
-     * Stops before the first set element (character or string).
-     * (For code points only, this is like while contains(current)==FALSE).
-     *
-     * When span() returns, the substring between where it started and the position
-     * it returned consists only of characters that are not in the set,
-     * and none of its strings overlap with the span.
-     *
-     * @stable ICU 3.8
-     */
-    USET_SPAN_NOT_CONTAINED = 0,
-    /**
-     * Continue a span() while there is a set element at the current position.
-     * (For characters only, this is like while contains(current)==TRUE).
-     *
-     * When span() returns, the substring between where it started and the position
-     * it returned consists only of set elements (characters or strings) that are in the set.
-     *
-     * If a set contains strings, then the span will be the longest substring
-     * matching any of the possible concatenations of set elements (characters or strings).
-     * (There must be a single, non-overlapping concatenation of characters or strings.)
-     * This is equivalent to a POSIX regular expression for (OR of each set element)*.
-     *
-     * @stable ICU 3.8
-     */
-    USET_SPAN_CONTAINED = 1,
-    /**
-     * Continue a span() while there is a set element at the current position.
-     * (For characters only, this is like while contains(current)==TRUE).
-     *
-     * When span() returns, the substring between where it started and the position
-     * it returned consists only of set elements (characters or strings) that are in the set.
-     *
-     * If a set only contains single characters, then this is the same
-     * as USET_SPAN_CONTAINED.
-     *
-     * If a set contains strings, then the span will be the longest substring
-     * with a match at each position with the longest single set element (character or string).
-     *
-     * Use this span condition together with other longest-match algorithms,
-     * such as ICU converters (ucnv_getUnicodeSet()).
-     *
-     * @stable ICU 3.8
-     */
-    USET_SPAN_SIMPLE = 2,
-    /**
-     * One more than the last span condition.
-     * @stable ICU 3.8
-     */
-    USET_SPAN_CONDITION_COUNT
-} USetSpanCondition;
-
-/**
- * A serialized form of a Unicode set.  Limited manipulations are
- * possible directly on a serialized set.  See below.
- * @stable ICU 2.4
- */
-typedef struct USerializedSet {
-    /**
-     * The serialized Unicode Set.
-     * @stable ICU 2.4
-     */
-    const uint16_t *array;
-    /**
-     * The length of the array that contains BMP characters.
-     * @stable ICU 2.4
-     */
-    int32_t bmpLength;
-    /**
-     * The total length of the array.
-     * @stable ICU 2.4
-     */
-    int32_t length;
-    /**
-     * A small buffer for the array to reduce memory allocations.
-     * @stable ICU 2.4
-     */
-    uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY];
-} USerializedSet;
-
-/*********************************************************************
- * USet API
- *********************************************************************/
-
-/**
- * Create an empty USet object.
- * Equivalent to uset_open(1, 0).
- * @return a newly created USet.  The caller must call uset_close() on
- * it when done.
- * @stable ICU 4.2
- */
-U_STABLE USet* U_EXPORT2
-uset_openEmpty();
-
-/**
- * Creates a USet object that contains the range of characters
- * start..end, inclusive.  If <code>start > end</code> 
- * then an empty set is created (same as using uset_openEmpty()).
- * @param start first character of the range, inclusive
- * @param end last character of the range, inclusive
- * @return a newly created USet.  The caller must call uset_close() on
- * it when done.
- * @stable ICU 2.4
- */
-U_STABLE USet* U_EXPORT2
-uset_open(UChar32 start, UChar32 end);
-
-/**
- * Creates a set from the given pattern.  See the UnicodeSet class
- * description for the syntax of the pattern language.
- * @param pattern a string specifying what characters are in the set
- * @param patternLength the length of the pattern, or -1 if null
- * terminated
- * @param ec the error code
- * @stable ICU 2.4
- */
-U_STABLE USet* U_EXPORT2
-uset_openPattern(const UChar* pattern, int32_t patternLength,
-                 UErrorCode* ec);
-
-/**
- * Creates a set from the given pattern.  See the UnicodeSet class
- * description for the syntax of the pattern language.
- * @param pattern a string specifying what characters are in the set
- * @param patternLength the length of the pattern, or -1 if null
- * terminated
- * @param options bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
- * @param ec the error code
- * @stable ICU 2.4
- */
-U_STABLE USet* U_EXPORT2
-uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
-                 uint32_t options,
-                 UErrorCode* ec);
-
-/**
- * Disposes of the storage used by a USet object.  This function should
- * be called exactly once for objects returned by uset_open().
- * @param set the object to dispose of
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_close(USet* set);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUSetPointer
- * "Smart pointer" class, closes a USet via uset_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Returns a copy of this object.
- * If this set is frozen, then the clone will be frozen as well.
- * Use uset_cloneAsThawed() for a mutable clone of a frozen set.
- * @param set the original set
- * @return the newly allocated copy of the set
- * @see uset_cloneAsThawed
- * @stable ICU 3.8
- */
-U_STABLE USet * U_EXPORT2
-uset_clone(const USet *set);
-
-/**
- * Determines whether the set has been frozen (made immutable) or not.
- * See the ICU4J Freezable interface for details.
- * @param set the set
- * @return TRUE/FALSE for whether the set has been frozen
- * @see uset_freeze
- * @see uset_cloneAsThawed
- * @stable ICU 3.8
- */
-U_STABLE UBool U_EXPORT2
-uset_isFrozen(const USet *set);
-
-/**
- * Freeze the set (make it immutable).
- * Once frozen, it cannot be unfrozen and is therefore thread-safe
- * until it is deleted.
- * See the ICU4J Freezable interface for details.
- * Freezing the set may also make some operations faster, for example
- * uset_contains() and uset_span().
- * A frozen set will not be modified. (It remains frozen.)
- * @param set the set
- * @return the same set, now frozen
- * @see uset_isFrozen
- * @see uset_cloneAsThawed
- * @stable ICU 3.8
- */
-U_STABLE void U_EXPORT2
-uset_freeze(USet *set);
-
-/**
- * Clone the set and make the clone mutable.
- * See the ICU4J Freezable interface for details.
- * @param set the set
- * @return the mutable clone
- * @see uset_freeze
- * @see uset_isFrozen
- * @see uset_clone
- * @stable ICU 3.8
- */
-U_STABLE USet * U_EXPORT2
-uset_cloneAsThawed(const USet *set);
-
-/**
- * Causes the USet object to represent the range <code>start - end</code>.
- * If <code>start > end</code> then this USet is set to an empty range.
- * A frozen set will not be modified.
- * @param set the object to set to the given range
- * @param start first character in the set, inclusive
- * @param end last character in the set, inclusive
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_set(USet* set,
-         UChar32 start, UChar32 end);
-
-/**
- * Modifies the set to represent the set specified by the given
- * pattern. See the UnicodeSet class description for the syntax of 
- * the pattern language. See also the User Guide chapter about UnicodeSet.
- * <em>Empties the set passed before applying the pattern.</em>
- * A frozen set will not be modified.
- * @param set               The set to which the pattern is to be applied. 
- * @param pattern           A pointer to UChar string specifying what characters are in the set.
- *                          The character at pattern[0] must be a '['.
- * @param patternLength     The length of the UChar string. -1 if NUL terminated.
- * @param options           A bitmask for options to apply to the pattern.
- *                          Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
- * @param status            Returns an error if the pattern cannot be parsed.
- * @return                  Upon successful parse, the value is either
- *                          the index of the character after the closing ']' 
- *                          of the parsed pattern.
- *                          If the status code indicates failure, then the return value 
- *                          is the index of the error in the source.
- *
- * @stable ICU 2.8
- */
-U_STABLE int32_t U_EXPORT2 
-uset_applyPattern(USet *set,
-                  const UChar *pattern, int32_t patternLength,
-                  uint32_t options,
-                  UErrorCode *status);
-
-/**
- * Modifies the set to contain those code points which have the given value
- * for the given binary or enumerated property, as returned by
- * u_getIntPropertyValue.  Prior contents of this set are lost.
- * A frozen set will not be modified.
- *
- * @param set the object to contain the code points defined by the property
- *
- * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1
- * or UCHAR_INT_START..UCHAR_INT_LIMIT-1
- * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1.
- *
- * @param value a value in the range u_getIntPropertyMinValue(prop)..
- * u_getIntPropertyMaxValue(prop), with one exception.  If prop is
- * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but
- * rather a mask value produced by U_GET_GC_MASK().  This allows grouped
- * categories such as [:L:] to be represented.
- *
- * @param ec error code input/output parameter
- *
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_applyIntPropertyValue(USet* set,
-                           UProperty prop, int32_t value, UErrorCode* ec);
-
-/**
- * Modifies the set to contain those code points which have the
- * given value for the given property.  Prior contents of this
- * set are lost.
- * A frozen set will not be modified.
- *
- * @param set the object to contain the code points defined by the given
- * property and value alias
- *
- * @param prop a string specifying a property alias, either short or long.
- * The name is matched loosely.  See PropertyAliases.txt for names and a
- * description of loose matching.  If the value string is empty, then this
- * string is interpreted as either a General_Category value alias, a Script
- * value alias, a binary property alias, or a special ID.  Special IDs are
- * matched loosely and correspond to the following sets:
- *
- * "ANY" = [\\u0000-\\U0010FFFF],
- * "ASCII" = [\\u0000-\\u007F],
- * "Assigned" = [:^Cn:].
- *
- * @param propLength the length of the prop, or -1 if NULL
- *
- * @param value a string specifying a value alias, either short or long.
- * The name is matched loosely.  See PropertyValueAliases.txt for names
- * and a description of loose matching.  In addition to aliases listed,
- * numeric values and canonical combining classes may be expressed
- * numerically, e.g., ("nv", "0.5") or ("ccc", "220").  The value string
- * may also be empty.
- *
- * @param valueLength the length of the value, or -1 if NULL
- *
- * @param ec error code input/output parameter
- *
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_applyPropertyAlias(USet* set,
-                        const UChar *prop, int32_t propLength,
-                        const UChar *value, int32_t valueLength,
-                        UErrorCode* ec);
-
-/**
- * Return true if the given position, in the given pattern, appears
- * to be the start of a UnicodeSet pattern.
- *
- * @param pattern a string specifying the pattern
- * @param patternLength the length of the pattern, or -1 if NULL
- * @param pos the given position
- * @stable ICU 3.2
- */
-U_STABLE UBool U_EXPORT2
-uset_resemblesPattern(const UChar *pattern, int32_t patternLength,
-                      int32_t pos);
-
-/**
- * Returns a string representation of this set.  If the result of
- * calling this function is passed to a uset_openPattern(), it
- * will produce another set that is equal to this one.
- * @param set the set
- * @param result the string to receive the rules, may be NULL
- * @param resultCapacity the capacity of result, may be 0 if result is NULL
- * @param escapeUnprintable if TRUE then convert unprintable
- * character to their hex escape representations, \\uxxxx or
- * \\Uxxxxxxxx.  Unprintable characters are those other than
- * U+000A, U+0020..U+007E.
- * @param ec error code.
- * @return length of string, possibly larger than resultCapacity
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-uset_toPattern(const USet* set,
-               UChar* result, int32_t resultCapacity,
-               UBool escapeUnprintable,
-               UErrorCode* ec);
-
-/**
- * Adds the given character to the given USet.  After this call,
- * uset_contains(set, c) will return TRUE.
- * A frozen set will not be modified.
- * @param set the object to which to add the character
- * @param c the character to add
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_add(USet* set, UChar32 c);
-
-/**
- * Adds all of the elements in the specified set to this set if
- * they're not already present.  This operation effectively
- * modifies this set so that its value is the <i>union</i> of the two
- * sets.  The behavior of this operation is unspecified if the specified
- * collection is modified while the operation is in progress.
- * A frozen set will not be modified.
- *
- * @param set the object to which to add the set
- * @param additionalSet the source set whose elements are to be added to this set.
- * @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
-uset_addAll(USet* set, const USet *additionalSet);
-
-/**
- * Adds the given range of characters to the given USet.  After this call,
- * uset_contains(set, start, end) will return TRUE.
- * A frozen set will not be modified.
- * @param set the object to which to add the character
- * @param start the first character of the range to add, inclusive
- * @param end the last character of the range to add, inclusive
- * @stable ICU 2.2
- */
-U_STABLE void U_EXPORT2
-uset_addRange(USet* set, UChar32 start, UChar32 end);
-
-/**
- * Adds the given string to the given USet.  After this call,
- * uset_containsString(set, str, strLen) will return TRUE.
- * A frozen set will not be modified.
- * @param set the object to which to add the character
- * @param str the string to add
- * @param strLen the length of the string or -1 if null terminated.
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_addString(USet* set, const UChar* str, int32_t strLen);
-
-/**
- * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"}
- * If this set already any particular character, it has no effect on that character.
- * A frozen set will not be modified.
- * @param set the object to which to add the character
- * @param str the source string
- * @param strLen the length of the string or -1 if null terminated.
- * @stable ICU 3.4
- */
-U_STABLE void U_EXPORT2
-uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen);
-
-/**
- * Removes the given character from the given USet.  After this call,
- * uset_contains(set, c) will return FALSE.
- * A frozen set will not be modified.
- * @param set the object from which to remove the character
- * @param c the character to remove
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_remove(USet* set, UChar32 c);
-
-/**
- * Removes the given range of characters from the given USet.  After this call,
- * uset_contains(set, start, end) will return FALSE.
- * A frozen set will not be modified.
- * @param set the object to which to add the character
- * @param start the first character of the range to remove, inclusive
- * @param end the last character of the range to remove, inclusive
- * @stable ICU 2.2
- */
-U_STABLE void U_EXPORT2
-uset_removeRange(USet* set, UChar32 start, UChar32 end);
-
-/**
- * Removes the given string to the given USet.  After this call,
- * uset_containsString(set, str, strLen) will return FALSE.
- * A frozen set will not be modified.
- * @param set the object to which to add the character
- * @param str the string to remove
- * @param strLen the length of the string or -1 if null terminated.
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_removeString(USet* set, const UChar* str, int32_t strLen);
-
-/**
- * Removes from this set all of its elements that are contained in the
- * specified set.  This operation effectively modifies this
- * set so that its value is the <i>asymmetric set difference</i> of
- * the two sets.
- * A frozen set will not be modified.
- * @param set the object from which the elements are to be removed
- * @param removeSet the object that defines which elements will be
- * removed from this set
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_removeAll(USet* set, const USet* removeSet);
-
-/**
- * Retain only the elements in this set that are contained in the
- * specified range.  If <code>start > end</code> then an empty range is
- * retained, leaving the set empty.  This is equivalent to
- * a boolean logic AND, or a set INTERSECTION.
- * A frozen set will not be modified.
- *
- * @param set the object for which to retain only the specified range
- * @param start first character, inclusive, of range to be retained
- * to this set.
- * @param end last character, inclusive, of range to be retained
- * to this set.
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_retain(USet* set, UChar32 start, UChar32 end);
-
-/**
- * Retains only the elements in this set that are contained in the
- * specified set.  In other words, removes from this set all of
- * its elements that are not contained in the specified set.  This
- * operation effectively modifies this set so that its value is
- * the <i>intersection</i> of the two sets.
- * A frozen set will not be modified.
- *
- * @param set the object on which to perform the retain
- * @param retain set that defines which elements this set will retain
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_retainAll(USet* set, const USet* retain);
-
-/**
- * Reallocate this objects internal structures to take up the least
- * possible space, without changing this object's value.
- * A frozen set will not be modified.
- *
- * @param set the object on which to perfrom the compact
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_compact(USet* set);
-
-/**
- * Inverts this set.  This operation modifies this set so that
- * its value is its complement.  This operation does not affect
- * the multicharacter strings, if any.
- * A frozen set will not be modified.
- * @param set the set
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_complement(USet* set);
-
-/**
- * Complements in this set all elements contained in the specified
- * set.  Any character in the other set will be removed if it is
- * in this set, or will be added if it is not in this set.
- * A frozen set will not be modified.
- *
- * @param set the set with which to complement
- * @param complement set that defines which elements will be xor'ed
- * from this set.
- * @stable ICU 3.2
- */
-U_STABLE void U_EXPORT2
-uset_complementAll(USet* set, const USet* complement);
-
-/**
- * Removes all of the elements from this set.  This set will be
- * empty after this call returns.
- * A frozen set will not be modified.
- * @param set the set
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_clear(USet* set);
-
-/**
- * Close this set over the given attribute.  For the attribute
- * USET_CASE, the result is to modify this set so that:
- *
- * 1. For each character or string 'a' in this set, all strings or
- * characters 'b' such that foldCase(a) == foldCase(b) are added
- * to this set.
- *
- * 2. For each string 'e' in the resulting set, if e !=
- * foldCase(e), 'e' will be removed.
- *
- * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}]
- *
- * (Here foldCase(x) refers to the operation u_strFoldCase, and a
- * == b denotes that the contents are the same, not pointer
- * comparison.)
- *
- * A frozen set will not be modified.
- *
- * @param set the set
- *
- * @param attributes bitmask for attributes to close over.
- * Currently only the USET_CASE bit is supported.  Any undefined bits
- * are ignored.
- * @stable ICU 4.2
- */
-U_STABLE void U_EXPORT2
-uset_closeOver(USet* set, int32_t attributes);
-
-/**
- * Remove all strings from this set.
- *
- * @param set the set
- * @stable ICU 4.2
- */
-U_STABLE void U_EXPORT2
-uset_removeAllStrings(USet* set);
-
-/**
- * Returns TRUE if the given USet contains no characters and no
- * strings.
- * @param set the set
- * @return true if set is empty
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-uset_isEmpty(const USet* set);
-
-/**
- * Returns TRUE if the given USet contains the given character.
- * This function works faster with a frozen set.
- * @param set the set
- * @param c The codepoint to check for within the set
- * @return true if set contains c
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-uset_contains(const USet* set, UChar32 c);
-
-/**
- * Returns TRUE if the given USet contains all characters c
- * where start <= c && c <= end.
- * @param set the set
- * @param start the first character of the range to test, inclusive
- * @param end the last character of the range to test, inclusive
- * @return TRUE if set contains the range
- * @stable ICU 2.2
- */
-U_STABLE UBool U_EXPORT2
-uset_containsRange(const USet* set, UChar32 start, UChar32 end);
-
-/**
- * Returns TRUE if the given USet contains the given string.
- * @param set the set
- * @param str the string
- * @param strLen the length of the string or -1 if null terminated.
- * @return true if set contains str
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-uset_containsString(const USet* set, const UChar* str, int32_t strLen);
-
-/**
- * Returns the index of the given character within this set, where
- * the set is ordered by ascending code point.  If the character
- * is not in this set, return -1.  The inverse of this method is
- * <code>charAt()</code>.
- * @param set the set
- * @param c the character to obtain the index for
- * @return an index from 0..size()-1, or -1
- * @stable ICU 3.2
- */
-U_STABLE int32_t U_EXPORT2
-uset_indexOf(const USet* set, UChar32 c);
-
-/**
- * Returns the character at the given index within this set, where
- * the set is ordered by ascending code point.  If the index is
- * out of range, return (UChar32)-1.  The inverse of this method is
- * <code>indexOf()</code>.
- * @param set the set
- * @param charIndex an index from 0..size()-1 to obtain the char for
- * @return the character at the given index, or (UChar32)-1.
- * @stable ICU 3.2
- */
-U_STABLE UChar32 U_EXPORT2
-uset_charAt(const USet* set, int32_t charIndex);
-
-/**
- * Returns the number of characters and strings contained in the given
- * USet.
- * @param set the set
- * @return a non-negative integer counting the characters and strings
- * contained in set
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-uset_size(const USet* set);
-
-/**
- * Returns the number of items in this set.  An item is either a range
- * of characters or a single multicharacter string.
- * @param set the set
- * @return a non-negative integer counting the character ranges
- * and/or strings contained in set
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-uset_getItemCount(const USet* set);
-
-/**
- * Returns an item of this set.  An item is either a range of
- * characters or a single multicharacter string.
- * @param set the set
- * @param itemIndex a non-negative integer in the range 0..
- * uset_getItemCount(set)-1
- * @param start pointer to variable to receive first character
- * in range, inclusive
- * @param end pointer to variable to receive last character in range,
- * inclusive
- * @param str buffer to receive the string, may be NULL
- * @param strCapacity capacity of str, or 0 if str is NULL
- * @param ec error code
- * @return the length of the string (>= 2), or 0 if the item is a
- * range, in which case it is the range *start..*end, or -1 if
- * itemIndex is out of range
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-uset_getItem(const USet* set, int32_t itemIndex,
-             UChar32* start, UChar32* end,
-             UChar* str, int32_t strCapacity,
-             UErrorCode* ec);
-
-/**
- * Returns true if set1 contains all the characters and strings
- * of set2. It answers the question, 'Is set1 a superset of set2?'
- * @param set1 set to be checked for containment
- * @param set2 set to be checked for containment
- * @return true if the test condition is met
- * @stable ICU 3.2
- */
-U_STABLE UBool U_EXPORT2
-uset_containsAll(const USet* set1, const USet* set2);
-
-/**
- * Returns true if this set contains all the characters
- * of the given string. This is does not check containment of grapheme
- * clusters, like uset_containsString.
- * @param set set of characters to be checked for containment
- * @param str string containing codepoints to be checked for containment
- * @param strLen the length of the string or -1 if null terminated.
- * @return true if the test condition is met
- * @stable ICU 3.4
- */
-U_STABLE UBool U_EXPORT2
-uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen);
-
-/**
- * Returns true if set1 contains none of the characters and strings
- * of set2. It answers the question, 'Is set1 a disjoint set of set2?'
- * @param set1 set to be checked for containment
- * @param set2 set to be checked for containment
- * @return true if the test condition is met
- * @stable ICU 3.2
- */
-U_STABLE UBool U_EXPORT2
-uset_containsNone(const USet* set1, const USet* set2);
-
-/**
- * Returns true if set1 contains some of the characters and strings
- * of set2. It answers the question, 'Does set1 and set2 have an intersection?'
- * @param set1 set to be checked for containment
- * @param set2 set to be checked for containment
- * @return true if the test condition is met
- * @stable ICU 3.2
- */
-U_STABLE UBool U_EXPORT2
-uset_containsSome(const USet* set1, const USet* set2);
-
-/**
- * Returns the length of the initial substring of the input string which
- * consists only of characters and strings that are contained in this set
- * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
- * or only of characters and strings that are not contained
- * in this set (USET_SPAN_NOT_CONTAINED).
- * See USetSpanCondition for details.
- * Similar to the strspn() C library function.
- * Unpaired surrogates are treated according to contains() of their surrogate code points.
- * This function works faster with a frozen set and with a non-negative string length argument.
- * @param set the set
- * @param s start of the string
- * @param length of the string; can be -1 for NUL-terminated
- * @param spanCondition specifies the containment condition
- * @return the length of the initial substring according to the spanCondition;
- *         0 if the start of the string does not fit the spanCondition
- * @stable ICU 3.8
- * @see USetSpanCondition
- */
-U_STABLE int32_t U_EXPORT2
-uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition);
-
-/**
- * Returns the start of the trailing substring of the input string which
- * consists only of characters and strings that are contained in this set
- * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
- * or only of characters and strings that are not contained
- * in this set (USET_SPAN_NOT_CONTAINED).
- * See USetSpanCondition for details.
- * Unpaired surrogates are treated according to contains() of their surrogate code points.
- * This function works faster with a frozen set and with a non-negative string length argument.
- * @param set the set
- * @param s start of the string
- * @param length of the string; can be -1 for NUL-terminated
- * @param spanCondition specifies the containment condition
- * @return the start of the trailing substring according to the spanCondition;
- *         the string length if the end of the string does not fit the spanCondition
- * @stable ICU 3.8
- * @see USetSpanCondition
- */
-U_STABLE int32_t U_EXPORT2
-uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition);
-
-/**
- * Returns the length of the initial substring of the input string which
- * consists only of characters and strings that are contained in this set
- * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
- * or only of characters and strings that are not contained
- * in this set (USET_SPAN_NOT_CONTAINED).
- * See USetSpanCondition for details.
- * Similar to the strspn() C library function.
- * Malformed byte sequences are treated according to contains(0xfffd).
- * This function works faster with a frozen set and with a non-negative string length argument.
- * @param set the set
- * @param s start of the string (UTF-8)
- * @param length of the string; can be -1 for NUL-terminated
- * @param spanCondition specifies the containment condition
- * @return the length of the initial substring according to the spanCondition;
- *         0 if the start of the string does not fit the spanCondition
- * @stable ICU 3.8
- * @see USetSpanCondition
- */
-U_STABLE int32_t U_EXPORT2
-uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition);
-
-/**
- * Returns the start of the trailing substring of the input string which
- * consists only of characters and strings that are contained in this set
- * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
- * or only of characters and strings that are not contained
- * in this set (USET_SPAN_NOT_CONTAINED).
- * See USetSpanCondition for details.
- * Malformed byte sequences are treated according to contains(0xfffd).
- * This function works faster with a frozen set and with a non-negative string length argument.
- * @param set the set
- * @param s start of the string (UTF-8)
- * @param length of the string; can be -1 for NUL-terminated
- * @param spanCondition specifies the containment condition
- * @return the start of the trailing substring according to the spanCondition;
- *         the string length if the end of the string does not fit the spanCondition
- * @stable ICU 3.8
- * @see USetSpanCondition
- */
-U_STABLE int32_t U_EXPORT2
-uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition);
-
-/**
- * Returns true if set1 contains all of the characters and strings
- * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?'
- * @param set1 set to be checked for containment
- * @param set2 set to be checked for containment
- * @return true if the test condition is met
- * @stable ICU 3.2
- */
-U_STABLE UBool U_EXPORT2
-uset_equals(const USet* set1, const USet* set2);
-
-/*********************************************************************
- * Serialized set API
- *********************************************************************/
-
-/**
- * Serializes this set into an array of 16-bit integers.  Serialization
- * (currently) only records the characters in the set; multicharacter
- * strings are ignored.
- *
- * The array
- * has following format (each line is one 16-bit integer):
- *
- *  length     = (n+2*m) | (m!=0?0x8000:0)
- *  bmpLength  = n; present if m!=0
- *  bmp[0]
- *  bmp[1]
- *  ...
- *  bmp[n-1]
- *  supp-high[0]
- *  supp-low[0]
- *  supp-high[1]
- *  supp-low[1]
- *  ...
- *  supp-high[m-1]
- *  supp-low[m-1]
- *
- * The array starts with a header.  After the header are n bmp
- * code points, then m supplementary code points.  Either n or m
- * or both may be zero.  n+2*m is always <= 0x7FFF.
- *
- * If there are no supplementary characters (if m==0) then the
- * header is one 16-bit integer, 'length', with value n.
- *
- * If there are supplementary characters (if m!=0) then the header
- * is two 16-bit integers.  The first, 'length', has value
- * (n+2*m)|0x8000.  The second, 'bmpLength', has value n.
- *
- * After the header the code points are stored in ascending order.
- * Supplementary code points are stored as most significant 16
- * bits followed by least significant 16 bits.
- *
- * @param set the set
- * @param dest pointer to buffer of destCapacity 16-bit integers.
- * May be NULL only if destCapacity is zero.
- * @param destCapacity size of dest, or zero.  Must not be negative.
- * @param pErrorCode pointer to the error code.  Will be set to
- * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF.  Will be set to
- * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity.
- * @return the total length of the serialized format, including
- * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other
- * than U_BUFFER_OVERFLOW_ERROR.
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode);
-
-/**
- * Given a serialized array, fill in the given serialized set object.
- * @param fillSet pointer to result
- * @param src pointer to start of array
- * @param srcLength length of array
- * @return true if the given array is valid, otherwise false
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength);
-
-/**
- * Set the USerializedSet to contain the given character (and nothing
- * else).
- * @param fillSet pointer to result
- * @param c The codepoint to set
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c);
-
-/**
- * Returns TRUE if the given USerializedSet contains the given
- * character.
- * @param set the serialized set
- * @param c The codepoint to check for within the set
- * @return true if set contains c
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-uset_serializedContains(const USerializedSet* set, UChar32 c);
-
-/**
- * Returns the number of disjoint ranges of characters contained in
- * the given serialized set.  Ignores any strings contained in the
- * set.
- * @param set the serialized set
- * @return a non-negative integer counting the character ranges
- * contained in set
- * @stable ICU 2.4
- */
-U_STABLE int32_t U_EXPORT2
-uset_getSerializedRangeCount(const USerializedSet* set);
-
-/**
- * Returns a range of characters contained in the given serialized
- * set.
- * @param set the serialized set
- * @param rangeIndex a non-negative integer in the range 0..
- * uset_getSerializedRangeCount(set)-1
- * @param pStart pointer to variable to receive first character
- * in range, inclusive
- * @param pEnd pointer to variable to receive last character in range,
- * inclusive
- * @return true if rangeIndex is valid, otherwise false
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
-                        UChar32* pStart, UChar32* pEnd);
-
-#endif
diff --git a/Source/core/icu/unicode/ushape.h b/Source/core/icu/unicode/ushape.h
deleted file mode 100644
index 6c3655f..0000000
--- a/Source/core/icu/unicode/ushape.h
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
-******************************************************************************
-*
-*   Copyright (C) 2000-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-******************************************************************************
-*   file name:  ushape.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2000jun29
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __USHAPE_H__
-#define __USHAPE_H__
-
-#include "unicode/utypes.h"
-
-/**
- * \file
- * \brief C API:  Arabic shaping
- * 
- */
-
-/**
- * Shape Arabic text on a character basis.
- *
- * <p>This function performs basic operations for "shaping" Arabic text. It is most
- * useful for use with legacy data formats and legacy display technology
- * (simple terminals). All operations are performed on Unicode characters.</p>
- *
- * <p>Text-based shaping means that some character code points in the text are
- * replaced by others depending on the context. It transforms one kind of text
- * into another. In comparison, modern displays for Arabic text select
- * appropriate, context-dependent font glyphs for each text element, which means
- * that they transform text into a glyph vector.</p>
- *
- * <p>Text transformations are necessary when modern display technology is not
- * available or when text needs to be transformed to or from legacy formats that
- * use "shaped" characters. Since the Arabic script is cursive, connecting
- * adjacent letters to each other, computers select images for each letter based
- * on the surrounding letters. This usually results in four images per Arabic
- * letter: initial, middle, final, and isolated forms. In Unicode, on the other
- * hand, letters are normally stored abstract, and a display system is expected
- * to select the necessary glyphs. (This makes searching and other text
- * processing easier because the same letter has only one code.) It is possible
- * to mimic this with text transformations because there are characters in
- * Unicode that are rendered as letters with a specific shape
- * (or cursive connectivity). They were included for interoperability with
- * legacy systems and codepages, and for unsophisticated display systems.</p>
- *
- * <p>A second kind of text transformations is supported for Arabic digits:
- * For compatibility with legacy codepages that only include European digits,
- * it is possible to replace one set of digits by another, changing the
- * character code points. These operations can be performed for either
- * Arabic-Indic Digits (U+0660...U+0669) or Eastern (Extended) Arabic-Indic
- * digits (U+06f0...U+06f9).</p>
- *
- * <p>Some replacements may result in more or fewer characters (code points).
- * By default, this means that the destination buffer may receive text with a
- * length different from the source length. Some legacy systems rely on the
- * length of the text to be constant. They expect extra spaces to be added
- * or consumed either next to the affected character or at the end of the
- * text.</p>
- *
- * <p>For details about the available operations, see the description of the
- * <code>U_SHAPE_...</code> options.</p>
- *
- * @param source The input text.
- *
- * @param sourceLength The number of UChars in <code>source</code>.
- *
- * @param dest The destination buffer that will receive the results of the
- *             requested operations. It may be <code>NULL</code> only if
- *             <code>destSize</code> is 0. The source and destination must not
- *             overlap.
- *
- * @param destSize The size (capacity) of the destination buffer in UChars.
- *                 If <code>destSize</code> is 0, then no output is produced,
- *                 but the necessary buffer size is returned ("preflighting").
- *
- * @param options This is a 32-bit set of flags that specify the operations
- *                that are performed on the input text. If no error occurs,
- *                then the result will always be written to the destination
- *                buffer.
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @return The number of UChars written to the destination buffer.
- *         If an error occured, then no output was written, or it may be
- *         incomplete. If <code>U_BUFFER_OVERFLOW_ERROR</code> is set, then
- *         the return value indicates the necessary destination buffer size.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_shapeArabic(const UChar *source, int32_t sourceLength,
-              UChar *dest, int32_t destSize,
-              uint32_t options,
-              UErrorCode *pErrorCode);
-
-/**
- * Memory option: allow the result to have a different length than the source.
- * Affects: LamAlef options
- * @stable ICU 2.0
- */
-#define U_SHAPE_LENGTH_GROW_SHRINK              0
-
-/**
- * Memory option: allow the result to have a different length than the source.
- * Affects: LamAlef options
- * This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK
- * @stable ICU 4.2
- */
-#define U_SHAPE_LAMALEF_RESIZE                  0 
-
-/**
- * Memory option: the result must have the same length as the source.
- * If more room is necessary, then try to consume spaces next to modified characters.
- * @stable ICU 2.0
- */
-#define U_SHAPE_LENGTH_FIXED_SPACES_NEAR        1
-
-/**
- * Memory option: the result must have the same length as the source.
- * If more room is necessary, then try to consume spaces next to modified characters.
- * Affects: LamAlef options
- * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR
- * @stable ICU 4.2
- */
-#define U_SHAPE_LAMALEF_NEAR                    1 
-
-/**
- * Memory option: the result must have the same length as the source.
- * If more room is necessary, then try to consume spaces at the end of the text.
- * @stable ICU 2.0
- */
-#define U_SHAPE_LENGTH_FIXED_SPACES_AT_END      2
-
-/**
- * Memory option: the result must have the same length as the source.
- * If more room is necessary, then try to consume spaces at the end of the text.
- * Affects: LamAlef options
- * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END
- * @stable ICU 4.2
- */
-#define U_SHAPE_LAMALEF_END                     2 
-
-/**
- * Memory option: the result must have the same length as the source.
- * If more room is necessary, then try to consume spaces at the beginning of the text.
- * @stable ICU 2.0
- */
-#define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3
-
-/**
- * Memory option: the result must have the same length as the source.
- * If more room is necessary, then try to consume spaces at the beginning of the text.
- * Affects: LamAlef options
- * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING
- * @stable ICU 4.2
- */
-#define U_SHAPE_LAMALEF_BEGIN                    3 
-
-
-/**
- * Memory option: the result must have the same length as the source.
- * Shaping Mode: For each LAMALEF character found, expand LAMALEF using space at end.
- *               If there is no space at end, use spaces at beginning of the buffer. If there
- *               is no space at beginning of the buffer, use spaces at the near (i.e. the space
- *               after the LAMALEF character).
- *               If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) 
- *               will be set in pErrorCode
- *
- * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END. 
- * Affects: LamAlef options
- * @stable ICU 4.2
- */
-#define U_SHAPE_LAMALEF_AUTO                     0x10000 
-
-/** Bit mask for memory options. @stable ICU 2.0 */
-#define U_SHAPE_LENGTH_MASK                      0x10003 /* Changed old value 3 */
-
-
-/**
- * Bit mask for LamAlef memory options.
- * @stable ICU 4.2
- */
-#define U_SHAPE_LAMALEF_MASK                     0x10003 /* updated */
-
-/** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */
-#define U_SHAPE_TEXT_DIRECTION_LOGICAL          0
-
-/**
- * Direction indicator:
- * the source is in visual RTL order,
- * the rightmost displayed character stored first.
- * This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL
- * @stable ICU 4.2
- */
-#define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL       0
-
-/**
- * Direction indicator:
- * the source is in visual LTR order,
- * the leftmost displayed character stored first.
- * @stable ICU 2.0
- */
-#define U_SHAPE_TEXT_DIRECTION_VISUAL_LTR       4
-
-/** Bit mask for direction indicators. @stable ICU 2.0 */
-#define U_SHAPE_TEXT_DIRECTION_MASK             4
-
-
-/** Letter shaping option: do not perform letter shaping. @stable ICU 2.0 */
-#define U_SHAPE_LETTERS_NOOP                    0
-
-/** Letter shaping option: replace abstract letter characters by "shaped" ones. @stable ICU 2.0 */
-#define U_SHAPE_LETTERS_SHAPE                   8
-
-/** Letter shaping option: replace "shaped" letter characters by abstract ones. @stable ICU 2.0 */
-#define U_SHAPE_LETTERS_UNSHAPE                 0x10
-
-/**
- * Letter shaping option: replace abstract letter characters by "shaped" ones.
- * The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters
- * are always "shaped" into the isolated form instead of the medial form
- * (selecting code points from the Arabic Presentation Forms-B block).
- * @stable ICU 2.0
- */
-#define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18
-
-
-/** Bit mask for letter shaping options. @stable ICU 2.0 */
-#define U_SHAPE_LETTERS_MASK                        0x18
-
-
-/** Digit shaping option: do not perform digit shaping. @stable ICU 2.0 */
-#define U_SHAPE_DIGITS_NOOP                     0
-
-/**
- * Digit shaping option:
- * Replace European digits (U+0030...) by Arabic-Indic digits.
- * @stable ICU 2.0
- */
-#define U_SHAPE_DIGITS_EN2AN                    0x20
-
-/**
- * Digit shaping option:
- * Replace Arabic-Indic digits by European digits (U+0030...).
- * @stable ICU 2.0
- */
-#define U_SHAPE_DIGITS_AN2EN                    0x40
-
-/**
- * Digit shaping option:
- * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent
- * strongly directional character is an Arabic letter
- * (<code>u_charDirection()</code> result <code>U_RIGHT_TO_LEFT_ARABIC</code> [AL]).<br>
- * The direction of "preceding" depends on the direction indicator option.
- * For the first characters, the preceding strongly directional character
- * (initial state) is assumed to be not an Arabic letter
- * (it is <code>U_LEFT_TO_RIGHT</code> [L] or <code>U_RIGHT_TO_LEFT</code> [R]).
- * @stable ICU 2.0
- */
-#define U_SHAPE_DIGITS_ALEN2AN_INIT_LR          0x60
-
-/**
- * Digit shaping option:
- * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent
- * strongly directional character is an Arabic letter
- * (<code>u_charDirection()</code> result <code>U_RIGHT_TO_LEFT_ARABIC</code> [AL]).<br>
- * The direction of "preceding" depends on the direction indicator option.
- * For the first characters, the preceding strongly directional character
- * (initial state) is assumed to be an Arabic letter.
- * @stable ICU 2.0
- */
-#define U_SHAPE_DIGITS_ALEN2AN_INIT_AL          0x80
-
-/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */
-#define U_SHAPE_DIGITS_RESERVED                 0xa0
-
-/** Bit mask for digit shaping options. @stable ICU 2.0 */
-#define U_SHAPE_DIGITS_MASK                     0xe0
-
-
-/** Digit type option: Use Arabic-Indic digits (U+0660...U+0669). @stable ICU 2.0 */
-#define U_SHAPE_DIGIT_TYPE_AN                   0
-
-/** Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). @stable ICU 2.0 */
-#define U_SHAPE_DIGIT_TYPE_AN_EXTENDED          0x100
-
-/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */
-#define U_SHAPE_DIGIT_TYPE_RESERVED             0x200
-
-/** Bit mask for digit type options. @stable ICU 2.0 */
-#define U_SHAPE_DIGIT_TYPE_MASK                 0x300 /* I need to change this from 0x3f00 to 0x300 */
-
-/** 
- * Tashkeel aggregation option:
- * Replaces any combination of U+0651 with one of
- * U+064C, U+064D, U+064E, U+064F, U+0650 with
- * U+FC5E, U+FC5F, U+FC60, U+FC61, U+FC62 consecutively.
- * @stable ICU 3.6
- */
-#define U_SHAPE_AGGREGATE_TASHKEEL              0x4000
-/** Tashkeel aggregation option: do not aggregate tashkeels. @stable ICU 3.6 */
-#define U_SHAPE_AGGREGATE_TASHKEEL_NOOP         0
-/** Bit mask for tashkeel aggregation. @stable ICU 3.6 */
-#define U_SHAPE_AGGREGATE_TASHKEEL_MASK         0x4000
-
-/** 
- * Presentation form option:
- * Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B
- * characters with 0+06xx characters, before shaping.
- * @stable ICU 3.6
- */
-#define U_SHAPE_PRESERVE_PRESENTATION           0x8000
-/** Presentation form option: 
- * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with 
- * their unshaped correspondants in range 0+06xx, before shaping.
- * @stable ICU 3.6 
- */
-#define U_SHAPE_PRESERVE_PRESENTATION_NOOP      0
-/** Bit mask for preserve presentation form. @stable ICU 3.6 */
-#define U_SHAPE_PRESERVE_PRESENTATION_MASK      0x8000
-
-/* Seen Tail option */ 
-/**
- * Memory option: the result must have the same length as the source.
- * Shaping mode: The SEEN family character will expand into two characters using space near 
- *               the SEEN family character(i.e. the space after the character).
- *               If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) 
- *               will be set in pErrorCode
- *
- * De-shaping mode: Any Seen character followed by Tail character will be
- *                  replaced by one cell Seen and a space will replace the Tail.
- * Affects: Seen options
- * @stable ICU 4.2
- */
-#define U_SHAPE_SEEN_TWOCELL_NEAR     0x200000
-
-/**
- * Bit mask for Seen memory options. 
- * @stable ICU 4.2
- */
-#define U_SHAPE_SEEN_MASK             0x700000
-
-/* YehHamza option */ 
-/**
- * Memory option: the result must have the same length as the source.
- * Shaping mode: The YEHHAMZA character will expand into two characters using space near it 
- *              (i.e. the space after the character
- *               If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) 
- *               will be set in pErrorCode
- *
- * De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be
- *                  replaced by one cell YehHamza and space will replace the Hamza.
- * Affects: YehHamza options
- * @stable ICU 4.2
- */
-#define U_SHAPE_YEHHAMZA_TWOCELL_NEAR      0x1000000
-
-
-/**
- * Bit mask for YehHamza memory options. 
- * @stable ICU 4.2
- */
-#define U_SHAPE_YEHHAMZA_MASK              0x3800000
-
-/* New Tashkeel options */ 
-/**
- * Memory option: the result must have the same length as the source.
- * Shaping mode: Tashkeel characters will be replaced by spaces. 
- *               Spaces will be placed at beginning of the buffer
- *
- * De-shaping mode: N/A
- * Affects: Tashkeel options
- * @stable ICU 4.2
- */
-#define U_SHAPE_TASHKEEL_BEGIN                      0x40000
-
-/**
- * Memory option: the result must have the same length as the source.
- * Shaping mode: Tashkeel characters will be replaced by spaces. 
- *               Spaces will be placed at end of the buffer
- *
- * De-shaping mode: N/A
- * Affects: Tashkeel options
- * @stable ICU 4.2
- */
-#define U_SHAPE_TASHKEEL_END                        0x60000
-
-/**
- * Memory option: allow the result to have a different length than the source.
- * Shaping mode: Tashkeel characters will be removed, buffer length will shrink. 
- * De-shaping mode: N/A 
- *
- * Affect: Tashkeel options
- * @stable ICU 4.2
- */
-#define U_SHAPE_TASHKEEL_RESIZE                     0x80000
-
-/**
- * Memory option: the result must have the same length as the source.
- * Shaping mode: Tashkeel characters will be replaced by Tatweel if it is connected to adjacent
- *               characters (i.e. shaped on Tatweel) or replaced by space if it is not connected.
- *
- * De-shaping mode: N/A
- * Affects: YehHamza options
- * @stable ICU 4.2
- */
-#define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL         0xC0000
-
-/** 
- * Bit mask for Tashkeel replacement with Space or Tatweel memory options. 
- * @stable ICU 4.2
- */
-#define U_SHAPE_TASHKEEL_MASK                       0xE0000
-
-
-/* Space location Control options */ 
-/**
- * This option affect the meaning of BEGIN and END options. if this option is not used the default
- * for BEGIN and END will be as following: 
- * The Default (for both Visual LTR, Visual RTL and Logical Text)
- *           1. BEGIN always refers to the start address of physical memory.
- *           2. END always refers to the end address of physical memory.
- *
- * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text. 
- *
- * The effect on BEGIN and END Memory Options will be as following:
- *    A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text(
- *       corresponding to the physical memory address end for Visual LTR text, Same as END in 
- *       default behavior)
- *    B. BEGIN For Logical text: Same as BEGIN in default behavior. 
- *    C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding
- *       to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior.
- *    D. END For Logical text: Same as END in default behavior). 
- * Affects: All LamAlef BEGIN, END and AUTO options.
- * @stable ICU 4.2
- */
-#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000
-
-/**
- * Bit mask for swapping BEGIN and END for Visual LTR text 
- * @stable ICU 4.2
- */
-#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK      0x4000000
-
-/**
- * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73). 
- * If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B)
- * De-shaping will not use this option as it will always search for both the new Unicode code point for the 
- * TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the
- * Seen-Family letter accordingly.
- *
- * Shaping Mode: Only shaping.
- * De-shaping Mode: N/A.
- * Affects: All Seen options
- * @draft ICU 4.2
- */
-#define SHAPE_TAIL_NEW_UNICODE        0x8000000
-
-/**
- * Bit mask for new Unicode Tail option 
- * @draft ICU 4.2
- */
-#define SHAPE_TAIL_TYPE_MASK          0x8000000
-
-#endif
diff --git a/Source/core/icu/unicode/ustring.h b/Source/core/icu/unicode/ustring.h
deleted file mode 100644
index 2ee16e9..0000000
--- a/Source/core/icu/unicode/ustring.h
+++ /dev/null
@@ -1,1696 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1998-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*
-* File ustring.h
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   12/07/98    bertrand    Creation.
-******************************************************************************
-*/
-
-#ifndef USTRING_H
-#define USTRING_H
-
-#include "unicode/utypes.h"
-#include "unicode/putil.h"
-#include "unicode/uiter.h"
-
-/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/
-#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
-#   define UBRK_TYPEDEF_UBREAK_ITERATOR
-    typedef struct UBreakIterator UBreakIterator;
-#endif
-
-/**
- * \file
- * \brief C API: Unicode string handling functions
- *
- * These C API functions provide general Unicode string handling.
- *
- * Some functions are equivalent in name, signature, and behavior to the ANSI C <string.h>
- * functions. (For example, they do not check for bad arguments like NULL string pointers.)
- * In some cases, only the thread-safe variant of such a function is implemented here
- * (see u_strtok_r()).
- *
- * Other functions provide more Unicode-specific functionality like locale-specific
- * upper/lower-casing and string comparison in code point order.
- *
- * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units.
- * UTF-16 encodes each Unicode code point with either one or two UChar code units.
- * (This is the default form of Unicode, and a forward-compatible extension of the original,
- * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0
- * in 1996.)
- *
- * Some APIs accept a 32-bit UChar32 value for a single code point.
- *
- * ICU also handles 16-bit Unicode text with unpaired surrogates.
- * Such text is not well-formed UTF-16.
- * Code-point-related functions treat unpaired surrogates as surrogate code points,
- * i.e., as separate units.
- *
- * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings),
- * it is much more efficient even for random access because the code unit values
- * for single-unit characters vs. lead units vs. trail units are completely disjoint.
- * This means that it is easy to determine character (code point) boundaries from
- * random offsets in the string.
- *
- * Unicode (UTF-16) string processing is optimized for the single-unit case.
- * Although it is important to support supplementary characters
- * (which use pairs of lead/trail code units called "surrogates"),
- * their occurrence is rare. Almost all characters in modern use require only
- * a single UChar code unit (i.e., their code point values are <=0xffff).
- *
- * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html).
- * For a discussion of the handling of unpaired surrogates see also
- * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18.
- */
-
-/**
- * \defgroup ustring_ustrlen String Length
- * \ingroup ustring_strlen
- */
-/*@{*/
-/**
- * Determine the length of an array of UChar.
- *
- * @param s The array of UChars, NULL (U+0000) terminated.
- * @return The number of UChars in <code>chars</code>, minus the terminator.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strlen(const UChar *s);
-/*@}*/
-
-/**
- * Count Unicode code points in the length UChar code units of the string.
- * A code point may occupy either one or two UChar code units.
- * Counting code points involves reading all code units.
- *
- * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h).
- *
- * @param s The input string.
- * @param length The number of UChar code units to be checked, or -1 to count all
- *               code points before the first NUL (U+0000).
- * @return The number of code points in the specified code units.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_countChar32(const UChar *s, int32_t length);
-
-/**
- * Check if the string contains more Unicode code points than a certain number.
- * This is more efficient than counting all code points in the entire string
- * and comparing that number with a threshold.
- * This function may not need to scan the string at all if the length is known
- * (not -1 for NUL-termination) and falls within a certain range, and
- * never needs to count more than 'number+1' code points.
- * Logically equivalent to (u_countChar32(s, length)>number).
- * A Unicode code point may occupy either one or two UChar code units.
- *
- * @param s The input string.
- * @param length The length of the string, or -1 if it is NUL-terminated.
- * @param number The number of code points in the string is compared against
- *               the 'number' parameter.
- * @return Boolean value for whether the string contains more Unicode code points
- *         than 'number'. Same as (u_countChar32(s, length)>number).
- * @stable ICU 2.4
- */
-U_STABLE UBool U_EXPORT2
-u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
-
-/**
- * Concatenate two ustrings.  Appends a copy of <code>src</code>,
- * including the null terminator, to <code>dst</code>. The initial copied
- * character from <code>src</code> overwrites the null terminator in <code>dst</code>.
- *
- * @param dst The destination string.
- * @param src The source string.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_strcat(UChar     *dst, 
-    const UChar     *src);
-
-/**
- * Concatenate two ustrings.  
- * Appends at most <code>n</code> characters from <code>src</code> to <code>dst</code>.
- * Adds a terminating NUL.
- * If src is too long, then only <code>n-1</code> characters will be copied
- * before the terminating NUL.
- * If <code>n&lt;=0</code> then dst is not modified.
- *
- * @param dst The destination string.
- * @param src The source string.
- * @param n The maximum number of characters to append.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_strncat(UChar     *dst, 
-     const UChar     *src, 
-     int32_t     n);
-
-/**
- * Find the first occurrence of a substring in a string.
- * The substring is found at code point boundaries.
- * That means that if the substring begins with
- * a trail surrogate or ends with a lead surrogate,
- * then it is found only if these surrogates stand alone in the text.
- * Otherwise, the substring edge units would be matched against
- * halves of surrogate pairs.
- *
- * @param s The string to search (NUL-terminated).
- * @param substring The substring to find (NUL-terminated).
- * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>,
- *         or <code>s</code> itself if the <code>substring</code> is empty,
- *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
- * @stable ICU 2.0
- *
- * @see u_strrstr
- * @see u_strFindFirst
- * @see u_strFindLast
- */
-U_STABLE UChar * U_EXPORT2
-u_strstr(const UChar *s, const UChar *substring);
-
-/**
- * Find the first occurrence of a substring in a string.
- * The substring is found at code point boundaries.
- * That means that if the substring begins with
- * a trail surrogate or ends with a lead surrogate,
- * then it is found only if these surrogates stand alone in the text.
- * Otherwise, the substring edge units would be matched against
- * halves of surrogate pairs.
- *
- * @param s The string to search.
- * @param length The length of s (number of UChars), or -1 if it is NUL-terminated.
- * @param substring The substring to find (NUL-terminated).
- * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated.
- * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>,
- *         or <code>s</code> itself if the <code>substring</code> is empty,
- *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strstr
- * @see u_strFindLast
- */
-U_STABLE UChar * U_EXPORT2
-u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
-
-/**
- * Find the first occurrence of a BMP code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (NUL-terminated).
- * @param c The BMP code point to find.
- * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.0
- *
- * @see u_strchr32
- * @see u_memchr
- * @see u_strstr
- * @see u_strFindFirst
- */
-U_STABLE UChar * U_EXPORT2
-u_strchr(const UChar *s, UChar c);
-
-/**
- * Find the first occurrence of a code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (NUL-terminated).
- * @param c The code point to find.
- * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.0
- *
- * @see u_strchr
- * @see u_memchr32
- * @see u_strstr
- * @see u_strFindFirst
- */
-U_STABLE UChar * U_EXPORT2
-u_strchr32(const UChar *s, UChar32 c);
-
-/**
- * Find the last occurrence of a substring in a string.
- * The substring is found at code point boundaries.
- * That means that if the substring begins with
- * a trail surrogate or ends with a lead surrogate,
- * then it is found only if these surrogates stand alone in the text.
- * Otherwise, the substring edge units would be matched against
- * halves of surrogate pairs.
- *
- * @param s The string to search (NUL-terminated).
- * @param substring The substring to find (NUL-terminated).
- * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>,
- *         or <code>s</code> itself if the <code>substring</code> is empty,
- *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strstr
- * @see u_strFindFirst
- * @see u_strFindLast
- */
-U_STABLE UChar * U_EXPORT2
-u_strrstr(const UChar *s, const UChar *substring);
-
-/**
- * Find the last occurrence of a substring in a string.
- * The substring is found at code point boundaries.
- * That means that if the substring begins with
- * a trail surrogate or ends with a lead surrogate,
- * then it is found only if these surrogates stand alone in the text.
- * Otherwise, the substring edge units would be matched against
- * halves of surrogate pairs.
- *
- * @param s The string to search.
- * @param length The length of s (number of UChars), or -1 if it is NUL-terminated.
- * @param substring The substring to find (NUL-terminated).
- * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated.
- * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>,
- *         or <code>s</code> itself if the <code>substring</code> is empty,
- *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strstr
- * @see u_strFindLast
- */
-U_STABLE UChar * U_EXPORT2
-u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
-
-/**
- * Find the last occurrence of a BMP code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (NUL-terminated).
- * @param c The BMP code point to find.
- * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strrchr32
- * @see u_memrchr
- * @see u_strrstr
- * @see u_strFindLast
- */
-U_STABLE UChar * U_EXPORT2
-u_strrchr(const UChar *s, UChar c);
-
-/**
- * Find the last occurrence of a code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (NUL-terminated).
- * @param c The code point to find.
- * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strrchr
- * @see u_memchr32
- * @see u_strrstr
- * @see u_strFindLast
- */
-U_STABLE UChar * U_EXPORT2
-u_strrchr32(const UChar *s, UChar32 c);
-
-/**
- * Locates the first occurrence in the string <code>string</code> of any of the characters
- * in the string <code>matchSet</code>.
- * Works just like C's strpbrk but with Unicode.
- *
- * @param string The string in which to search, NUL-terminated.
- * @param matchSet A NUL-terminated string defining a set of code points
- *                 for which to search in the text string.
- * @return A pointer to the  character in <code>string</code> that matches one of the
- *         characters in <code>matchSet</code>, or NULL if no such character is found.
- * @stable ICU 2.0
- */
-U_STABLE UChar * U_EXPORT2
-u_strpbrk(const UChar *string, const UChar *matchSet);
-
-/**
- * Returns the number of consecutive characters in <code>string</code>,
- * beginning with the first, that do not occur somewhere in <code>matchSet</code>.
- * Works just like C's strcspn but with Unicode.
- *
- * @param string The string in which to search, NUL-terminated.
- * @param matchSet A NUL-terminated string defining a set of code points
- *                 for which to search in the text string.
- * @return The number of initial characters in <code>string</code> that do not
- *         occur in <code>matchSet</code>.
- * @see u_strspn
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strcspn(const UChar *string, const UChar *matchSet);
-
-/**
- * Returns the number of consecutive characters in <code>string</code>,
- * beginning with the first, that occur somewhere in <code>matchSet</code>.
- * Works just like C's strspn but with Unicode.
- *
- * @param string The string in which to search, NUL-terminated.
- * @param matchSet A NUL-terminated string defining a set of code points
- *                 for which to search in the text string.
- * @return The number of initial characters in <code>string</code> that do
- *         occur in <code>matchSet</code>.
- * @see u_strcspn
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strspn(const UChar *string, const UChar *matchSet);
-
-/**
- * The string tokenizer API allows an application to break a string into
- * tokens. Unlike strtok(), the saveState (the current pointer within the
- * original string) is maintained in saveState. In the first call, the
- * argument src is a pointer to the string. In subsequent calls to
- * return successive tokens of that string, src must be specified as
- * NULL. The value saveState is set by this function to maintain the
- * function's position within the string, and on each subsequent call
- * you must give this argument the same variable. This function does
- * handle surrogate pairs. This function is similar to the strtok_r()
- * the POSIX Threads Extension (1003.1c-1995) version.
- *
- * @param src String containing token(s). This string will be modified.
- *            After the first call to u_strtok_r(), this argument must
- *            be NULL to get to the next token.
- * @param delim Set of delimiter characters (Unicode code points).
- * @param saveState The current pointer within the original string,
- *              which is set by this function. The saveState
- *              parameter should the address of a local variable of type
- *              UChar *. (i.e. defined "Uhar *myLocalSaveState" and use
- *              &myLocalSaveState for this parameter).
- * @return A pointer to the next token found in src, or NULL
- *         when there are no more tokens.
- * @stable ICU 2.0
- */
-U_STABLE UChar * U_EXPORT2
-u_strtok_r(UChar    *src, 
-     const UChar    *delim,
-           UChar   **saveState);
-
-/**
- * Compare two Unicode strings for bitwise equality (code unit order).
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative
- * value if <code>s1</code> is bitwise less than <code>s2,</code>; a positive
- * value if <code>s1</code> is bitwise greater than <code>s2</code>.
- * @stable ICU 2.0
- */
-U_STABLE int32_t  U_EXPORT2
-u_strcmp(const UChar     *s1, 
-         const UChar     *s2);
-
-/**
- * Compare two Unicode strings in code point order.
- * See u_strCompare for details.
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @return a negative/zero/positive integer corresponding to whether
- * the first string is less than/equal to/greater than the second one
- * in code point order
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
-
-/**
- * Compare two Unicode strings (binary order).
- *
- * The comparison can be done in code unit order or in code point order.
- * They differ only in UTF-16 when
- * comparing supplementary code points (U+10000..U+10ffff)
- * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).
- * In code unit order, high BMP code points sort after supplementary code points
- * because they are stored as pairs of surrogates which are at U+d800..U+dfff.
- *
- * This functions works with strings of different explicitly specified lengths
- * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
- * NUL-terminated strings are possible with length arguments of -1.
- *
- * @param s1 First source string.
- * @param length1 Length of first source string, or -1 if NUL-terminated.
- *
- * @param s2 Second source string.
- * @param length2 Length of second source string, or -1 if NUL-terminated.
- *
- * @param codePointOrder Choose between code unit order (FALSE)
- *                       and code point order (TRUE).
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_strCompare(const UChar *s1, int32_t length1,
-             const UChar *s2, int32_t length2,
-             UBool codePointOrder);
-
-/**
- * Compare two Unicode strings (binary order)
- * as presented by UCharIterator objects.
- * Works otherwise just like u_strCompare().
- *
- * Both iterators are reset to their start positions.
- * When the function returns, it is undefined where the iterators
- * have stopped.
- *
- * @param iter1 First source string iterator.
- * @param iter2 Second source string iterator.
- * @param codePointOrder Choose between code unit order (FALSE)
- *                       and code point order (TRUE).
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @see u_strCompare
- *
- * @stable ICU 2.6
- */
-U_STABLE int32_t U_EXPORT2
-u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
-
-#ifndef U_COMPARE_CODE_POINT_ORDER
-/* see also unistr.h and unorm.h */
-/**
- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
- * Compare strings in code point order instead of code unit order.
- * @stable ICU 2.2
- */
-#define U_COMPARE_CODE_POINT_ORDER  0x8000
-#endif
-
-/**
- * Compare two strings case-insensitively using full case folding.
- * This is equivalent to
- *   u_strCompare(u_strFoldCase(s1, options),
- *                u_strFoldCase(s2, options),
- *                (options&U_COMPARE_CODE_POINT_ORDER)!=0).
- *
- * The comparison can be done in UTF-16 code unit order or in code point order.
- * They differ only when comparing supplementary code points (U+10000..U+10ffff)
- * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).
- * In code unit order, high BMP code points sort after supplementary code points
- * because they are stored as pairs of surrogates which are at U+d800..U+dfff.
- *
- * This functions works with strings of different explicitly specified lengths
- * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
- * NUL-terminated strings are possible with length arguments of -1.
- *
- * @param s1 First source string.
- * @param length1 Length of first source string, or -1 if NUL-terminated.
- *
- * @param s2 Second source string.
- * @param length2 Length of second source string, or -1 if NUL-terminated.
- *
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Comparison in code unit order with default case folding.
- *
- *   - U_COMPARE_CODE_POINT_ORDER
- *     Set to choose code point order instead of code unit order
- *     (see u_strCompare for details).
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @stable ICU 2.2
- */
-U_STABLE int32_t U_EXPORT2
-u_strCaseCompare(const UChar *s1, int32_t length1,
-                 const UChar *s2, int32_t length2,
-                 uint32_t options,
-                 UErrorCode *pErrorCode);
-
-/**
- * Compare two ustrings for bitwise equality. 
- * Compares at most <code>n</code> characters.
- *
- * @param ucs1 A string to compare.
- * @param ucs2 A string to compare.
- * @param n The maximum number of characters to compare.
- * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative
- * value if <code>s1</code> is bitwise less than <code>s2</code>; a positive
- * value if <code>s1</code> is bitwise greater than <code>s2</code>.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strncmp(const UChar     *ucs1, 
-     const UChar     *ucs2, 
-     int32_t     n);
-
-/**
- * Compare two Unicode strings in code point order.
- * This is different in UTF-16 from u_strncmp() if supplementary characters are present.
- * For details, see u_strCompare().
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @param n The maximum number of characters to compare.
- * @return a negative/zero/positive integer corresponding to whether
- * the first string is less than/equal to/greater than the second one
- * in code point order
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
-
-/**
- * Compare two strings case-insensitively using full case folding.
- * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)).
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Comparison in code unit order with default case folding.
- *
- *   - U_COMPARE_CODE_POINT_ORDER
- *     Set to choose code point order instead of code unit order
- *     (see u_strCompare for details).
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *
- * @return A negative, zero, or positive integer indicating the comparison result.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
-
-/**
- * Compare two strings case-insensitively using full case folding.
- * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options),
- * u_strFoldCase(s2, at most n, options)).
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @param n The maximum number of characters each string to case-fold and then compare.
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Comparison in code unit order with default case folding.
- *
- *   - U_COMPARE_CODE_POINT_ORDER
- *     Set to choose code point order instead of code unit order
- *     (see u_strCompare for details).
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *
- * @return A negative, zero, or positive integer indicating the comparison result.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
-
-/**
- * Compare two strings case-insensitively using full case folding.
- * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options),
- * u_strFoldCase(s2, n, options)).
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @param length The number of characters in each string to case-fold and then compare.
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Comparison in code unit order with default case folding.
- *
- *   - U_COMPARE_CODE_POINT_ORDER
- *     Set to choose code point order instead of code unit order
- *     (see u_strCompare for details).
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *
- * @return A negative, zero, or positive integer indicating the comparison result.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
-
-/**
- * Copy a ustring. Adds a null terminator.
- *
- * @param dst The destination string.
- * @param src The source string.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_strcpy(UChar     *dst, 
-    const UChar     *src);
-
-/**
- * Copy a ustring.
- * Copies at most <code>n</code> characters.  The result will be null terminated
- * if the length of <code>src</code> is less than <code>n</code>.
- *
- * @param dst The destination string.
- * @param src The source string.
- * @param n The maximum number of characters to copy.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_strncpy(UChar     *dst, 
-     const UChar     *src, 
-     int32_t     n);
-
-#if !UCONFIG_NO_CONVERSION
-
-/**
- * Copy a byte string encoded in the default codepage to a ustring.
- * Adds a null terminator.
- * Performs a host byte to UChar conversion
- *
- * @param dst The destination string.
- * @param src The source string.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
-               const char *src );
-
-/**
- * Copy a byte string encoded in the default codepage to a ustring.
- * Copies at most <code>n</code> characters.  The result will be null terminated
- * if the length of <code>src</code> is less than <code>n</code>.
- * Performs a host byte to UChar conversion
- *
- * @param dst The destination string.
- * @param src The source string.
- * @param n The maximum number of characters to copy.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
-            const char *src,
-            int32_t n);
-
-/**
- * Copy ustring to a byte string encoded in the default codepage.
- * Adds a null terminator.
- * Performs a UChar to host byte conversion
- *
- * @param dst The destination string.
- * @param src The source string.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
-            const UChar *src );
-
-/**
- * Copy ustring to a byte string encoded in the default codepage.
- * Copies at most <code>n</code> characters.  The result will be null terminated
- * if the length of <code>src</code> is less than <code>n</code>.
- * Performs a UChar to host byte conversion
- *
- * @param dst The destination string.
- * @param src The source string.
- * @param n The maximum number of characters to copy.
- * @return A pointer to <code>dst</code>.
- * @stable ICU 2.0
- */
-U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
-            const UChar *src,
-            int32_t n );
-
-#endif
-
-/**
- * Synonym for memcpy(), but with UChars only.
- * @param dest The destination string
- * @param src The source string
- * @param count The number of characters to copy
- * @return A pointer to <code>dest</code>
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_memcpy(UChar *dest, const UChar *src, int32_t count);
-
-/**
- * Synonym for memmove(), but with UChars only.
- * @param dest The destination string
- * @param src The source string
- * @param count The number of characters to move
- * @return A pointer to <code>dest</code>
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_memmove(UChar *dest, const UChar *src, int32_t count);
-
-/**
- * Initialize <code>count</code> characters of <code>dest</code> to <code>c</code>.
- *
- * @param dest The destination string.
- * @param c The character to initialize the string.
- * @param count The maximum number of characters to set.
- * @return A pointer to <code>dest</code>.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_memset(UChar *dest, UChar c, int32_t count);
-
-/**
- * Compare the first <code>count</code> UChars of each buffer.
- *
- * @param buf1 The first string to compare.
- * @param buf2 The second string to compare.
- * @param count The maximum number of UChars to compare.
- * @return When buf1 < buf2, a negative number is returned.
- *      When buf1 == buf2, 0 is returned.
- *      When buf1 > buf2, a positive number is returned.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
-
-/**
- * Compare two Unicode strings in code point order.
- * This is different in UTF-16 from u_memcmp() if supplementary characters are present.
- * For details, see u_strCompare().
- *
- * @param s1 A string to compare.
- * @param s2 A string to compare.
- * @param count The maximum number of characters to compare.
- * @return a negative/zero/positive integer corresponding to whether
- * the first string is less than/equal to/greater than the second one
- * in code point order
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
-
-/**
- * Find the first occurrence of a BMP code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (contains <code>count</code> UChars).
- * @param c The BMP code point to find.
- * @param count The length of the string.
- * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.0
- *
- * @see u_strchr
- * @see u_memchr32
- * @see u_strFindFirst
- */
-U_STABLE UChar* U_EXPORT2
-u_memchr(const UChar *s, UChar c, int32_t count);
-
-/**
- * Find the first occurrence of a code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (contains <code>count</code> UChars).
- * @param c The code point to find.
- * @param count The length of the string.
- * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.0
- *
- * @see u_strchr32
- * @see u_memchr
- * @see u_strFindFirst
- */
-U_STABLE UChar* U_EXPORT2
-u_memchr32(const UChar *s, UChar32 c, int32_t count);
-
-/**
- * Find the last occurrence of a BMP code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (contains <code>count</code> UChars).
- * @param c The BMP code point to find.
- * @param count The length of the string.
- * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strrchr
- * @see u_memrchr32
- * @see u_strFindLast
- */
-U_STABLE UChar* U_EXPORT2
-u_memrchr(const UChar *s, UChar c, int32_t count);
-
-/**
- * Find the last occurrence of a code point in a string.
- * A surrogate code point is found only if its match in the text is not
- * part of a surrogate pair.
- * A NUL character is found at the string terminator.
- *
- * @param s The string to search (contains <code>count</code> UChars).
- * @param c The code point to find.
- * @param count The length of the string.
- * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
- *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
- * @stable ICU 2.4
- *
- * @see u_strrchr32
- * @see u_memrchr
- * @see u_strFindLast
- */
-U_STABLE UChar* U_EXPORT2
-u_memrchr32(const UChar *s, UChar32 c, int32_t count);
-
-/**
- * Unicode String literals in C.
- * We need one macro to declare a variable for the string
- * and to statically preinitialize it if possible,
- * and a second macro to dynamically intialize such a string variable if necessary.
- *
- * The macros are defined for maximum performance.
- * They work only for strings that contain "invariant characters", i.e.,
- * only latin letters, digits, and some punctuation.
- * See utypes.h for details.
- *
- * A pair of macros for a single string must be used with the same
- * parameters.
- * The string parameter must be a C string literal.
- * The length of the string, not including the terminating
- * <code>NUL</code>, must be specified as a constant.
- * The U_STRING_DECL macro should be invoked exactly once for one
- * such string variable before it is used.
- *
- * Usage:
- * <pre>
- *    U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
- *    U_STRING_DECL(ustringVar2, "jumps 5%", 8);
- *    static UBool didInit=FALSE;
- * 
- *    int32_t function() {
- *        if(!didInit) {
- *            U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
- *            U_STRING_INIT(ustringVar2, "jumps 5%", 8);
- *            didInit=TRUE;
- *        }
- *        return u_strcmp(ustringVar1, ustringVar2);
- *    }
- * </pre>
- * 
- * Note that the macros will NOT consistently work if their argument is another #define. 
- *  The following will not work on all platforms, don't use it.
- * 
- * <pre>
- *     #define GLUCK "Mr. Gluck"
- *     U_STRING_DECL(var, GLUCK, 9)
- *     U_STRING_INIT(var, GLUCK, 9)
- * </pre>
- * 
- * Instead, use the string literal "Mr. Gluck"  as the argument to both macro
- * calls.
- *
- *
- * @stable ICU 2.0
- */
-#if defined(U_DECLARE_UTF16)
-#   define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs)
-    /**@stable ICU 2.0 */
-#   define U_STRING_INIT(var, cs, length)
-#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
-#   define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
-    /**@stable ICU 2.0 */
-#   define U_STRING_INIT(var, cs, length)
-#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
-#   define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]={ (const UChar *)cs }
-    /**@stable ICU 2.0 */
-#   define U_STRING_INIT(var, cs, length)
-#else
-#   define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
-    /**@stable ICU 2.0 */
-#   define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
-#endif
-
-/**
- * Unescape a string of characters and write the resulting
- * Unicode characters to the destination buffer.  The following escape
- * sequences are recognized:
- *
- * \\uhhhh       4 hex digits; h in [0-9A-Fa-f]
- * \\Uhhhhhhhh   8 hex digits
- * \\xhh         1-2 hex digits
- * \\x{h...}     1-8 hex digits
- * \\ooo         1-3 octal digits; o in [0-7]
- * \\cX          control-X; X is masked with 0x1F
- *
- * as well as the standard ANSI C escapes:
- *
- * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
- * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
- * \\&quot; => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
- *
- * Anything else following a backslash is generically escaped.  For
- * example, "[a\\-z]" returns "[a-z]".
- *
- * If an escape sequence is ill-formed, this method returns an empty
- * string.  An example of an ill-formed sequence is "\\u" followed by
- * fewer than 4 hex digits.
- *
- * The above characters are recognized in the compiler's codepage,
- * that is, they are coded as 'u', '\\', etc.  Characters that are
- * not parts of escape sequences are converted using u_charsToUChars().
- *
- * This function is similar to UnicodeString::unescape() but not
- * identical to it.  The latter takes a source UnicodeString, so it
- * does escape recognition but no conversion.
- *
- * @param src a zero-terminated string of invariant characters
- * @param dest pointer to buffer to receive converted and unescaped
- * text and, if there is room, a zero terminator.  May be NULL for
- * preflighting, in which case no UChars will be written, but the
- * return value will still be valid.  On error, an empty string is
- * stored here (if possible).
- * @param destCapacity the number of UChars that may be written at
- * dest.  Ignored if dest == NULL.
- * @return the length of unescaped string.
- * @see u_unescapeAt
- * @see UnicodeString#unescape()
- * @see UnicodeString#unescapeAt()
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_unescape(const char *src,
-           UChar *dest, int32_t destCapacity);
-
-U_CDECL_BEGIN
-/**
- * Callback function for u_unescapeAt() that returns a character of
- * the source text given an offset and a context pointer.  The context
- * pointer will be whatever is passed into u_unescapeAt().
- *
- * @param offset pointer to the offset that will be passed to u_unescapeAt().
- * @param context an opaque pointer passed directly into u_unescapeAt()
- * @return the character represented by the escape sequence at
- * offset
- * @see u_unescapeAt
- * @stable ICU 2.0
- */
-typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
-U_CDECL_END
-
-/**
- * Unescape a single sequence. The character at offset-1 is assumed
- * (without checking) to be a backslash.  This method takes a callback
- * pointer to a function that returns the UChar at a given offset.  By
- * varying this callback, ICU functions are able to unescape char*
- * strings, UnicodeString objects, and UFILE pointers.
- *
- * If offset is out of range, or if the escape sequence is ill-formed,
- * (UChar32)0xFFFFFFFF is returned.  See documentation of u_unescape()
- * for a list of recognized sequences.
- *
- * @param charAt callback function that returns a UChar of the source
- * text given an offset and a context pointer.
- * @param offset pointer to the offset that will be passed to charAt.
- * The offset value will be updated upon return to point after the
- * last parsed character of the escape sequence.  On error the offset
- * is unchanged.
- * @param length the number of characters in the source text.  The
- * last character of the source text is considered to be at offset
- * length-1.
- * @param context an opaque pointer passed directly into charAt.
- * @return the character represented by the escape sequence at
- * offset, or (UChar32)0xFFFFFFFF on error.
- * @see u_unescape()
- * @see UnicodeString#unescape()
- * @see UnicodeString#unescapeAt()
- * @stable ICU 2.0
- */
-U_STABLE UChar32 U_EXPORT2
-u_unescapeAt(UNESCAPE_CHAR_AT charAt,
-             int32_t *offset,
-             int32_t length,
-             void *context);
-
-/**
- * Uppercase the characters in a string.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer are allowed to overlap.
- *
- * @param dest      A buffer for the result string. The result will be zero-terminated if
- *                  the buffer is large enough.
- * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- *                  dest may be NULL and the function will only return the length of the result
- *                  without writing any of the result string.
- * @param src       The original string
- * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
- * @param locale    The locale to consider, or "" for the root locale or NULL for the default locale.
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- * @return The length of the result string. It may be greater than destCapacity. In that case,
- *         only some of the result was written to the destination buffer.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strToUpper(UChar *dest, int32_t destCapacity,
-             const UChar *src, int32_t srcLength,
-             const char *locale,
-             UErrorCode *pErrorCode);
-
-/**
- * Lowercase the characters in a string.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer are allowed to overlap.
- *
- * @param dest      A buffer for the result string. The result will be zero-terminated if
- *                  the buffer is large enough.
- * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- *                  dest may be NULL and the function will only return the length of the result
- *                  without writing any of the result string.
- * @param src       The original string
- * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
- * @param locale    The locale to consider, or "" for the root locale or NULL for the default locale.
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- * @return The length of the result string. It may be greater than destCapacity. In that case,
- *         only some of the result was written to the destination buffer.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strToLower(UChar *dest, int32_t destCapacity,
-             const UChar *src, int32_t srcLength,
-             const char *locale,
-             UErrorCode *pErrorCode);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-/**
- * Titlecase a string.
- * Casing is locale-dependent and context-sensitive.
- * Titlecasing uses a break iterator to find the first characters of words
- * that are to be titlecased. It titlecases those characters and lowercases
- * all others.
- *
- * The titlecase break iterator can be provided to customize for arbitrary
- * styles, using rules and dictionaries beyond the standard iterators.
- * It may be more efficient to always provide an iterator to avoid
- * opening and closing one for each string.
- * The standard titlecase iterator for the root locale implements the
- * algorithm of Unicode TR 21.
- *
- * This function uses only the setText(), first() and next() methods of the
- * provided break iterator.
- *
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer are allowed to overlap.
- *
- * @param dest      A buffer for the result string. The result will be zero-terminated if
- *                  the buffer is large enough.
- * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- *                  dest may be NULL and the function will only return the length of the result
- *                  without writing any of the result string.
- * @param src       The original string
- * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
- * @param titleIter A break iterator to find the first characters of words
- *                  that are to be titlecased.
- *                  If none is provided (NULL), then a standard titlecase
- *                  break iterator is opened.
- * @param locale    The locale to consider, or "" for the root locale or NULL for the default locale.
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- * @return The length of the result string. It may be greater than destCapacity. In that case,
- *         only some of the result was written to the destination buffer.
- * @stable ICU 2.1
- */
-U_STABLE int32_t U_EXPORT2
-u_strToTitle(UChar *dest, int32_t destCapacity,
-             const UChar *src, int32_t srcLength,
-             UBreakIterator *titleIter,
-             const char *locale,
-             UErrorCode *pErrorCode);
-
-#endif
-
-/**
- * Case-fold the characters in a string.
- * Case-folding is locale-independent and not context-sensitive,
- * but there is an option for whether to include or exclude mappings for dotted I
- * and dotless i that are marked with 'I' in CaseFolding.txt.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer are allowed to overlap.
- *
- * @param dest      A buffer for the result string. The result will be zero-terminated if
- *                  the buffer is large enough.
- * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- *                  dest may be NULL and the function will only return the length of the result
- *                  without writing any of the result string.
- * @param src       The original string
- * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
- * @param options   Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- * @return The length of the result string. It may be greater than destCapacity. In that case,
- *         only some of the result was written to the destination buffer.
- * @stable ICU 2.0
- */
-U_STABLE int32_t U_EXPORT2
-u_strFoldCase(UChar *dest, int32_t destCapacity,
-              const UChar *src, int32_t srcLength,
-              uint32_t options,
-              UErrorCode *pErrorCode);
-
-#if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
-/**
- * Convert a UTF-16 string to a wchar_t string.
- * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then
- * this function simply calls the fast, dedicated function for that.
- * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of wchar_t's). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Must be a valid pointer to an error code value,
- *                      which must not indicate a failure before the function call.
- * @return The pointer to destination buffer.
- * @stable ICU 2.0
- */
-U_STABLE wchar_t* U_EXPORT2
-u_strToWCS(wchar_t *dest, 
-           int32_t destCapacity,
-           int32_t *pDestLength,
-           const UChar *src, 
-           int32_t srcLength,
-           UErrorCode *pErrorCode);
-/**
- * Convert a wchar_t string to UTF-16.
- * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then
- * this function simply calls the fast, dedicated function for that.
- * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Must be a valid pointer to an error code value,
- *                      which must not indicate a failure before the function call.
- * @return The pointer to destination buffer.
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2
-u_strFromWCS(UChar   *dest,
-             int32_t destCapacity, 
-             int32_t *pDestLength,
-             const wchar_t *src,
-             int32_t srcLength,
-             UErrorCode *pErrorCode);
-#endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */
-
-/**
- * Convert a UTF-16 string to UTF-8.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of chars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Must be a valid pointer to an error code value,
- *                      which must not indicate a failure before the function call.
- * @return The pointer to destination buffer.
- * @stable ICU 2.0
- * @see u_strToUTF8WithSub
- * @see u_strFromUTF8
- */
-U_STABLE char* U_EXPORT2 
-u_strToUTF8(char *dest,           
-            int32_t destCapacity,
-            int32_t *pDestLength,
-            const UChar *src, 
-            int32_t srcLength,
-            UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-8 string to UTF-16.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Must be a valid pointer to an error code value,
- *                      which must not indicate a failure before the function call.
- * @return The pointer to destination buffer.
- * @stable ICU 2.0
- * @see u_strFromUTF8WithSub
- * @see u_strFromUTF8Lenient
- */
-U_STABLE UChar* U_EXPORT2
-u_strFromUTF8(UChar *dest,             
-              int32_t destCapacity,
-              int32_t *pDestLength,
-              const char *src, 
-              int32_t srcLength,
-              UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-16 string to UTF-8.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * Same as u_strToUTF8() except for the additional subchar which is output for
- * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
- * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8().
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of chars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param subchar       The substitution character to use in place of an illegal input sequence,
- *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
- *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
- *                      except for surrogate code points (U+D800..U+DFFF).
- *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
- * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
- *                      Set to 0 if no substitutions occur or subchar<0.
- *                      pNumSubstitutions can be NULL.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @see u_strToUTF8
- * @see u_strFromUTF8WithSub
- * @stable ICU 3.6
- */
-U_STABLE char* U_EXPORT2
-u_strToUTF8WithSub(char *dest,
-            int32_t destCapacity,
-            int32_t *pDestLength,
-            const UChar *src,
-            int32_t srcLength,
-            UChar32 subchar, int32_t *pNumSubstitutions,
-            UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-8 string to UTF-16.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * Same as u_strFromUTF8() except for the additional subchar which is output for
- * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
- * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8().
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param subchar       The substitution character to use in place of an illegal input sequence,
- *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
- *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
- *                      except for surrogate code points (U+D800..U+DFFF).
- *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
- * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
- *                      Set to 0 if no substitutions occur or subchar<0.
- *                      pNumSubstitutions can be NULL.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @see u_strFromUTF8
- * @see u_strFromUTF8Lenient
- * @see u_strToUTF8WithSub
- * @stable ICU 3.6
- */
-U_STABLE UChar* U_EXPORT2
-u_strFromUTF8WithSub(UChar *dest,
-              int32_t destCapacity,
-              int32_t *pDestLength,
-              const char *src,
-              int32_t srcLength,
-              UChar32 subchar, int32_t *pNumSubstitutions,
-              UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-8 string to UTF-16.
- *
- * Same as u_strFromUTF8() except that this function is designed to be very fast,
- * which it achieves by being lenient about malformed UTF-8 sequences.
- * This function is intended for use in environments where UTF-8 text is
- * expected to be well-formed.
- *
- * Its semantics are:
- * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text.
- * - The function will not read beyond the input string, nor write beyond
- *   the destCapacity.
- * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not
- *   be well-formed UTF-16.
- *   The function will resynchronize to valid code point boundaries
- *   within a small number of code points after an illegal sequence.
- * - Non-shortest forms are not detected and will result in "spoofing" output.
- *
- * For further performance improvement, if srcLength is given (>=0),
- * then it must be destCapacity>=srcLength.
- *
- * There is no inverse u_strToUTF8Lenient() function because there is practically
- * no performance gain from not checking that a UTF-16 string is well-formed.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- *                      Unlike for other ICU functions, if srcLength>=0 then it
- *                      must be destCapacity>=srcLength.
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- *                      Unlike for other ICU functions, if srcLength>=0 but
- *                      destCapacity<srcLength, then *pDestLength will be set to srcLength
- *                      (and U_BUFFER_OVERFLOW_ERROR will be set)
- *                      regardless of the actual result length.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @see u_strFromUTF8
- * @see u_strFromUTF8WithSub
- * @see u_strToUTF8WithSub
- * @stable ICU 3.6
- */
-U_STABLE UChar * U_EXPORT2
-u_strFromUTF8Lenient(UChar *dest,
-                     int32_t destCapacity,
-                     int32_t *pDestLength,
-                     const char *src,
-                     int32_t srcLength,
-                     UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-16 string to UTF-32.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChar32s). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Must be a valid pointer to an error code value,
- *                      which must not indicate a failure before the function call.
- * @return The pointer to destination buffer.
- * @see u_strToUTF32WithSub
- * @see u_strFromUTF32
- * @stable ICU 2.0
- */
-U_STABLE UChar32* U_EXPORT2 
-u_strToUTF32(UChar32 *dest, 
-             int32_t  destCapacity,
-             int32_t  *pDestLength,
-             const UChar *src, 
-             int32_t  srcLength,
-             UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-32 string to UTF-16.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Must be a valid pointer to an error code value,
- *                      which must not indicate a failure before the function call.
- * @return The pointer to destination buffer.
- * @see u_strFromUTF32WithSub
- * @see u_strToUTF32
- * @stable ICU 2.0
- */
-U_STABLE UChar* U_EXPORT2 
-u_strFromUTF32(UChar   *dest,
-               int32_t destCapacity, 
-               int32_t *pDestLength,
-               const UChar32 *src,
-               int32_t srcLength,
-               UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-16 string to UTF-32.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * Same as u_strToUTF32() except for the additional subchar which is output for
- * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
- * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF32().
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChar32s). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If
- *                      pDestLength!=NULL then *pDestLength is always set to the
- *                      number of output units corresponding to the transformation of
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param subchar       The substitution character to use in place of an illegal input sequence,
- *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
- *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
- *                      except for surrogate code points (U+D800..U+DFFF).
- *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
- * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
- *                      Set to 0 if no substitutions occur or subchar<0.
- *                      pNumSubstitutions can be NULL.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @see u_strToUTF32
- * @see u_strFromUTF32WithSub
- * @stable ICU 4.2
- */
-U_STABLE UChar32* U_EXPORT2
-u_strToUTF32WithSub(UChar32 *dest,
-             int32_t destCapacity,
-             int32_t *pDestLength,
-             const UChar *src,
-             int32_t srcLength,
-             UChar32 subchar, int32_t *pNumSubstitutions,
-             UErrorCode *pErrorCode);
-
-/**
- * Convert a UTF-32 string to UTF-16.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * Same as u_strFromUTF32() except for the additional subchar which is output for
- * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
- * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32().
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If
- *                      pDestLength!=NULL then *pDestLength is always set to the
- *                      number of output units corresponding to the transformation of
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param subchar       The substitution character to use in place of an illegal input sequence,
- *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
- *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
- *                      except for surrogate code points (U+D800..U+DFFF).
- *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
- * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
- *                      Set to 0 if no substitutions occur or subchar<0.
- *                      pNumSubstitutions can be NULL.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @see u_strFromUTF32
- * @see u_strToUTF32WithSub
- * @stable ICU 4.2
- */
-U_STABLE UChar* U_EXPORT2
-u_strFromUTF32WithSub(UChar *dest,
-               int32_t destCapacity,
-               int32_t *pDestLength,
-               const UChar32 *src,
-               int32_t srcLength,
-               UChar32 subchar, int32_t *pNumSubstitutions,
-               UErrorCode *pErrorCode);
-
-/**
- * Convert a 16-bit Unicode string to Java Modified UTF-8.
- * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8
- *
- * This function behaves according to the documentation for Java DataOutput.writeUTF()
- * except that it does not encode the output length in the destination buffer
- * and does not have an output length restriction.
- * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String)
- *
- * The input string need not be well-formed UTF-16.
- * (Therefore there is no subchar parameter.)
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of chars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @stable ICU 4.4
- * @see u_strToUTF8WithSub
- * @see u_strFromJavaModifiedUTF8WithSub
- */
-U_STABLE char* U_EXPORT2 
-u_strToJavaModifiedUTF8(
-        char *dest,
-        int32_t destCapacity,
-        int32_t *pDestLength,
-        const UChar *src, 
-        int32_t srcLength,
-        UErrorCode *pErrorCode);
-
-/**
- * Convert a Java Modified UTF-8 string to a 16-bit Unicode string.
- * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
- *
- * This function behaves according to the documentation for Java DataInput.readUTF()
- * except that it takes a length parameter rather than
- * interpreting the first two input bytes as the length.
- * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF()
- *
- * The output string may not be well-formed UTF-16.
- *
- * @param dest          A buffer for the result string. The result will be zero-terminated if
- *                      the buffer is large enough.
- * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
- *                      dest may be NULL and the function will only return the length of the 
- *                      result without writing any of the result string (pre-flighting).
- * @param pDestLength   A pointer to receive the number of units written to the destination. If 
- *                      pDestLength!=NULL then *pDestLength is always set to the 
- *                      number of output units corresponding to the transformation of 
- *                      all the input units, even in case of a buffer overflow.
- * @param src           The original source string
- * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
- * @param subchar       The substitution character to use in place of an illegal input sequence,
- *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
- *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
- *                      except for surrogate code points (U+D800..U+DFFF).
- *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
- * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
- *                      Set to 0 if no substitutions occur or subchar<0.
- *                      pNumSubstitutions can be NULL.
- * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
- *                      pass the U_SUCCESS() test, or else the function returns
- *                      immediately. Check for U_FAILURE() on output or use with
- *                      function chaining. (See User Guide for details.)
- * @return The pointer to destination buffer.
- * @see u_strFromUTF8WithSub
- * @see u_strFromUTF8Lenient
- * @see u_strToJavaModifiedUTF8
- * @stable ICU 4.4
- */
-U_STABLE UChar* U_EXPORT2
-u_strFromJavaModifiedUTF8WithSub(
-        UChar *dest,
-        int32_t destCapacity,
-        int32_t *pDestLength,
-        const char *src,
-        int32_t srcLength,
-        UChar32 subchar, int32_t *pNumSubstitutions,
-        UErrorCode *pErrorCode);
-
-#endif
diff --git a/Source/core/icu/unicode/utext.h b/Source/core/icu/unicode/utext.h
deleted file mode 100644
index 088a532..0000000
--- a/Source/core/icu/unicode/utext.h
+++ /dev/null
@@ -1,1737 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 2004-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  utext.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2004oct06
-*   created by: Markus W. Scherer
-*/
-
-#ifndef __UTEXT_H__
-#define __UTEXT_H__
-
-/**
- * \file
- * \brief C API: Abstract Unicode Text API
- *
- * The Text Access API provides a means to allow text that is stored in alternative
- * formats to work with ICU services.  ICU normally operates on text that is
- * stored in UTF-16 format, in (UChar *) arrays for the C APIs or as type
- * UnicodeString for C++ APIs.
- *
- * ICU Text Access allows other formats, such as UTF-8 or non-contiguous
- * UTF-16 strings, to be placed in a UText wrapper and then passed to ICU services.
- *
- * There are three general classes of usage for UText:
- *
- *     Application Level Use.  This is the simplest usage - applications would
- *     use one of the utext_open() functions on their input text, and pass
- *     the resulting UText to the desired ICU service.
- *
- *     Second is usage in ICU Services, such as break iteration, that will need to
- *     operate on input presented to them as a UText.  These implementations
- *     will need to use the iteration and related UText functions to gain
- *     access to the actual text.
- *
- *     The third class of UText users are "text providers."  These are the
- *     UText implementations for the various text storage formats.  An application
- *     or system with a unique text storage format can implement a set of
- *     UText provider functions for that format, which will then allow
- *     ICU services to operate on that format.
- *
- *
- * <em>Iterating over text</em>
- *
- * Here is sample code for a forward iteration over the contents of a UText
- *
- * \code
- *    UChar32  c;
- *    UText    *ut = whatever();
- *
- *    for (c=utext_next32From(ut, 0); c>=0; c=utext_next32(ut)) {
- *       // do whatever with the codepoint c here.
- *    }
- * \endcode
- *
- * And here is similar code to iterate in the reverse direction, from the end
- * of the text towards the beginning.
- *
- * \code
- *    UChar32  c;
- *    UText    *ut = whatever();
- *    int      textLength = utext_nativeLength(ut);
- *    for (c=utext_previous32From(ut, textLength); c>=0; c=utext_previous32(ut)) {
- *       // do whatever with the codepoint c here.
- *    }
- * \endcode
- *
- * <em>Characters and Indexing</em>
- *
- * Indexing into text by UText functions is nearly always in terms of the native
- * indexing of the underlying text storage.  The storage format could be UTF-8
- * or UTF-32, for example.  When coding to the UText access API, no assumptions
- * can be made regarding the size of characters, or how far an index
- * may move when iterating between characters.
- *
- * All indices supplied to UText functions are pinned to the length of the
- * text.  An out-of-bounds index is not considered to be an error, but is
- * adjusted to be in the range  0 <= index <= length of input text.
- *
- *
- * When an index position is returned from a UText function, it will be
- * a native index to the underlying text.  In the case of multi-unit characters,
- * it will  always refer to the first position of the character,
- * never to the interior.  This is essentially the same thing as saying that
- * a returned index will always point to a boundary between characters.
- *
- * When a native index is supplied to a UText function, all indices that
- * refer to any part of a multi-unit character representation are considered
- * to be equivalent.  In the case of multi-unit characters, an incoming index
- * will be logically normalized to refer to the start of the character.
- * 
- * It is possible to test whether a native index is on a code point boundary
- * by doing a utext_setNativeIndex() followed by a utext_getNativeIndex().
- * If the index is returned unchanged, it was on a code point boundary.  If
- * an adjusted index is returned, the original index referred to the
- * interior of a character.
- *
- * <em>Conventions for calling UText functions</em>
- *
- * Most UText access functions have as their first parameter a (UText *) pointer,
- * which specifies the UText to be used.  Unless otherwise noted, the
- * pointer must refer to a valid, open UText.  Attempting to
- * use a closed UText or passing a NULL pointer is a programming error and
- * will produce undefined results or NULL pointer exceptions.
- * 
- * The UText_Open family of functions can either open an existing (closed)
- * UText, or heap allocate a new UText.  Here is sample code for creating
- * a stack-allocated UText.
- *
- * \code
- *    char     *s = whatever();  // A utf-8 string 
- *    U_ErrorCode status = U_ZERO_ERROR;
- *    UText    ut = UTEXT_INITIALIZER;
- *    utext_openUTF8(ut, s, -1, &status);
- *    if (U_FAILURE(status)) {
- *        // error handling
- *    } else {
- *        // work with the UText
- *    }
- * \endcode
- *
- * Any existing UText passed to an open function _must_ have been initialized, 
- * either by the UTEXT_INITIALIZER, or by having been originally heap-allocated
- * by an open function.  Passing NULL will cause the open function to
- * heap-allocate and fully initialize a new UText.
- *
- */
-
-
-
-#include "unicode/utypes.h"
-#include "unicode/uchar.h"
-#if U_SHOW_CPLUSPLUS_API
-#include "unicode/localpointer.h"
-#include "unicode/rep.h"
-#include "unicode/unistr.h"
-#include "unicode/chariter.h"
-#endif
-
-
-U_CDECL_BEGIN
-
-struct UText;
-typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */
-
-
-/***************************************************************************************
- *
- *   C Functions for creating UText wrappers around various kinds of text strings.
- *
- ****************************************************************************************/
-
-
-/**
-  * Close function for UText instances.
-  * Cleans up, releases any resources being held by an open UText.
-  * <p>
-  *   If the UText was originally allocated by one of the utext_open functions,
-  *   the storage associated with the utext will also be freed.
-  *   If the UText storage originated with the application, as it would with
-  *   a local or static instance, the storage will not be deleted.
-  *
-  *   An open UText can be reset to refer to new string by using one of the utext_open()
-  *   functions without first closing the UText.  
-  *
-  * @param ut  The UText to be closed.
-  * @return    NULL if the UText struct was deleted by the close.  If the UText struct
-  *            was originally provided by the caller to the open function, it is
-  *            returned by this function, and may be safely used again in
-  *            a subsequent utext_open.
-  *
-  * @stable ICU 3.4
-  */
-U_STABLE UText * U_EXPORT2
-utext_close(UText *ut);
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUTextPointer
- * "Smart pointer" class, closes a UText via utext_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Open a read-only UText implementation for UTF-8 strings.
- * 
- * \htmlonly
- * Any invalid UTF-8 in the input will be handled in this way:
- * a sequence of bytes that has the form of a truncated, but otherwise valid,
- * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. 
- * Any other illegal bytes will each be replaced by a \uFFFD.
- * \endhtmlonly
- * 
- * @param ut     Pointer to a UText struct.  If NULL, a new UText will be created.
- *               If non-NULL, must refer to an initialized UText struct, which will then
- *               be reset to reference the specified UTF-8 string.
- * @param s      A UTF-8 string.  Must not be NULL.
- * @param length The length of the UTF-8 string in bytes, or -1 if the string is
- *               zero terminated.
- * @param status Errors are returned here.
- * @return       A pointer to the UText.  If a pre-allocated UText was provided, it
- *               will always be used and returned.
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status);
-
-
-/**
- * Open a read-only UText for UChar * string.
- * 
- * @param ut     Pointer to a UText struct.  If NULL, a new UText will be created.
- *               If non-NULL, must refer to an initialized UText struct, which will then
- *               be reset to reference the specified UChar string.
- * @param s      A UChar (UTF-16) string
- * @param length The number of UChars in the input string, or -1 if the string is
- *               zero terminated.
- * @param status Errors are returned here.
- * @return       A pointer to the UText.  If a pre-allocated UText was provided, it
- *               will always be used and returned.
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status);
-
-
-#if U_SHOW_CPLUSPLUS_API
-/**
- * Open a writable UText for a non-const UnicodeString. 
- * 
- * @param ut      Pointer to a UText struct.  If NULL, a new UText will be created.
- *                 If non-NULL, must refer to an initialized UText struct, which will then
- *                 be reset to reference the specified input string.
- * @param s       A UnicodeString.
- * @param status Errors are returned here.
- * @return        Pointer to the UText.  If a UText was supplied as input, this
- *                 will always be used and returned.
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_openUnicodeString(UText *ut, U_NAMESPACE_QUALIFIER UnicodeString *s, UErrorCode *status);
-
-
-/**
- * Open a UText for a const UnicodeString.   The resulting UText will not be writable.
- * 
- * @param ut    Pointer to a UText struct.  If NULL, a new UText will be created.
- *               If non-NULL, must refer to an initialized UText struct, which will then
- *               be reset to reference the specified input string.
- * @param s      A const UnicodeString to be wrapped.
- * @param status Errors are returned here.
- * @return       Pointer to the UText.  If a UText was supplied as input, this
- *               will always be used and returned.
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_openConstUnicodeString(UText *ut, const U_NAMESPACE_QUALIFIER UnicodeString *s, UErrorCode *status);
-
-
-/**
- * Open a writable UText implementation for an ICU Replaceable object.
- * @param ut    Pointer to a UText struct.  If NULL, a new UText will be created.
- *               If non-NULL, must refer to an already existing UText, which will then
- *               be reset to reference the specified replaceable text.
- * @param rep    A Replaceable text object.
- * @param status Errors are returned here.
- * @return       Pointer to the UText.  If a UText was supplied as input, this
- *               will always be used and returned.
- * @see Replaceable
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_openReplaceable(UText *ut, U_NAMESPACE_QUALIFIER Replaceable *rep, UErrorCode *status);
-
-/**
- * Open a  UText implementation over an ICU CharacterIterator.
- * @param ut    Pointer to a UText struct.  If NULL, a new UText will be created.
- *               If non-NULL, must refer to an already existing UText, which will then
- *               be reset to reference the specified replaceable text.
- * @param ci     A Character Iterator.
- * @param status Errors are returned here.
- * @return       Pointer to the UText.  If a UText was supplied as input, this
- *               will always be used and returned.
- * @see Replaceable
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_openCharacterIterator(UText *ut, U_NAMESPACE_QUALIFIER CharacterIterator *ic, UErrorCode *status);
-
-#endif
-
-
-/**
-  *  Clone a UText.  This is much like opening a UText where the source text is itself
-  *  another UText.
-  *
-  *  A deep clone will copy both the UText data structures and the underlying text.
-  *  The original and cloned UText will operate completely independently; modifications
-  *  made to the text in one will not affect the other.  Text providers are not
-  *  required to support deep clones.  The user of clone() must check the status return
-  *  and be prepared to handle failures.
-  *
-  *  The standard UText implementations for UTF8, UChar *, UnicodeString and
-  *  Replaceable all support deep cloning.
-  *
-  *  The UText returned from a deep clone will be writable, assuming that the text
-  *  provider is able to support writing, even if the source UText had been made
-  *  non-writable by means of UText_freeze().
-  *
-  *  A shallow clone replicates only the UText data structures; it does not make
-  *  a copy of the underlying text.  Shallow clones can be used as an efficient way to 
-  *  have multiple iterators active in a single text string that is not being
-  *  modified.
-  *
-  *  A shallow clone operation will not fail, barring truly exceptional conditions such
-  *  as memory allocation failures.
-  *
-  *  Shallow UText clones should be avoided if the UText functions that modify the
-  *  text are expected to be used, either on the original or the cloned UText.
-  *  Any such modifications  can cause unpredictable behavior.  Read Only
-  *  shallow clones provide some protection against errors of this type by
-  *  disabling text modification via the cloned UText.
-  *
-  *  A shallow clone made with the readOnly parameter == FALSE will preserve the 
-  *  utext_isWritable() state of the source object.  Note, however, that
-  *  write operations must be avoided while more than one UText exists that refer
-  *  to the same underlying text.
-  *
-  *  A UText and its clone may be safely concurrently accessed by separate threads.
-  *  This is true for read access only with shallow clones, and for both read and
-  *  write access with deep clones.
-  *  It is the responsibility of the Text Provider to ensure that this thread safety
-  *  constraint is met.
-  *
-  *  @param dest   A UText struct to be filled in with the result of the clone operation,
-  *                or NULL if the clone function should heap-allocate a new UText struct.
-  *                If non-NULL, must refer to an already existing UText, which will then
-  *                be reset to become the clone.
-  *  @param src    The UText to be cloned.
-  *  @param deep   TRUE to request a deep clone, FALSE for a shallow clone.
-  *  @param readOnly TRUE to request that the cloned UText have read only access to the 
-  *                underlying text.  
-
-  *  @param status Errors are returned here.  For deep clones, U_UNSUPPORTED_ERROR
-  *                will be returned if the text provider is unable to clone the
-  *                original text.
-  *  @return       The newly created clone, or NULL if the clone operation failed.
-  *  @stable ICU 3.4
-  */
-U_STABLE UText * U_EXPORT2
-utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status);
-
-
-/**
-  *  Compare two UText objects for equality.
-  *  UTexts are equal if they are iterating over the same text, and
-  *    have the same iteration position within the text.
-  *    If either or both of the parameters are NULL, the comparison is FALSE.
-  *
-  *  @param a   The first of the two UTexts to compare.
-  *  @param b   The other UText to be compared.
-  *  @return    TRUE if the two UTexts are equal.
-  *  @stable ICU 3.6
-  */
-U_STABLE UBool U_EXPORT2
-utext_equals(const UText *a, const UText *b);
-
-
-/*****************************************************************************
- *
- *   Functions to work with the text represeted by a UText wrapper
- *
- *****************************************************************************/
-
-/**
-  * Get the length of the text.  Depending on the characteristics
-  * of the underlying text representation, this may be expensive.  
-  * @see  utext_isLengthExpensive()
-  *
-  *
-  * @param ut  the text to be accessed.
-  * @return the length of the text, expressed in native units.
-  *
-  * @stable ICU 3.4
-  */
-U_STABLE int64_t U_EXPORT2
-utext_nativeLength(UText *ut);
-
-/**
- *  Return TRUE if calculating the length of the text could be expensive.
- *  Finding the length of NUL terminated strings is considered to be expensive.
- *
- *  Note that the value of this function may change
- *  as the result of other operations on a UText.
- *  Once the length of a string has been discovered, it will no longer
- *  be expensive to report it.
- *
- * @param ut the text to be accessed.
- * @return TRUE if determining the length of the text could be time consuming.
- * @stable ICU 3.4
- */
-U_STABLE UBool U_EXPORT2
-utext_isLengthExpensive(const UText *ut);
-
-/**
- * Returns the code point at the requested index,
- * or U_SENTINEL (-1) if it is out of bounds.
- *
- * If the specified index points to the interior of a multi-unit
- * character - one of the trail bytes of a UTF-8 sequence, for example -
- * the complete code point will be returned.
- *
- * The iteration position will be set to the start of the returned code point.
- *
- * This function is roughly equivalent to the the sequence
- *    utext_setNativeIndex(index);
- *    utext_current32();
- * (There is a subtle difference if the index is out of bounds by being less than zero - 
- * utext_setNativeIndex(negative value) sets the index to zero, after which utext_current()
- * will return the char at zero.  utext_char32At(negative index), on the other hand, will
- * return the U_SENTINEL value of -1.)
- * 
- * @param ut the text to be accessed
- * @param nativeIndex the native index of the character to be accessed.  If the index points
- *        to other than the first unit of a multi-unit character, it will be adjusted
- *        to the start of the character.
- * @return the code point at the specified index.
- * @stable ICU 3.4
- */
-U_STABLE UChar32 U_EXPORT2
-utext_char32At(UText *ut, int64_t nativeIndex);
-
-
-/**
- *
- * Get the code point at the current iteration position,
- * or U_SENTINEL (-1) if the iteration has reached the end of
- * the input text.
- *
- * @param ut the text to be accessed.
- * @return the Unicode code point at the current iterator position.
- * @stable ICU 3.4
- */
-U_STABLE UChar32 U_EXPORT2
-utext_current32(UText *ut);
-
-
-/**
- * Get the code point at the current iteration position of the UText, and
- * advance the position to the first index following the character.
- *
- * If the position is at the end of the text (the index following
- * the last character, which is also the length of the text), 
- * return U_SENTINEL (-1) and do not advance the index. 
- *
- * This is a post-increment operation.
- *
- * An inline macro version of this function, UTEXT_NEXT32(), 
- * is available for performance critical use.
- *
- * @param ut the text to be accessed.
- * @return the Unicode code point at the iteration position.
- * @see UTEXT_NEXT32
- * @stable ICU 3.4
- */
-U_STABLE UChar32 U_EXPORT2
-utext_next32(UText *ut);
-
-
-/**
- *  Move the iterator position to the character (code point) whose
- *  index precedes the current position, and return that character.
- *  This is a pre-decrement operation.
- *
- *  If the initial position is at the start of the text (index of 0) 
- *  return U_SENTINEL (-1), and leave the position unchanged.
- *
- *  An inline macro version of this function, UTEXT_PREVIOUS32(), 
- *  is available for performance critical use.
- *
- *  @param ut the text to be accessed.
- *  @return the previous UChar32 code point, or U_SENTINEL (-1) 
- *          if the iteration has reached the start of the text.
- *  @see UTEXT_PREVIOUS32
- *  @stable ICU 3.4
- */
-U_STABLE UChar32 U_EXPORT2
-utext_previous32(UText *ut);
-
-
-/**
-  * Set the iteration index and return the code point at that index. 
-  * Leave the iteration index at the start of the following code point.
-  *
-  * This function is the most efficient and convenient way to
-  * begin a forward iteration.  The results are identical to the those
-  * from the sequence
-  * \code
-  *    utext_setIndex();
-  *    utext_next32();
-  * \endcode
-  *
-  *  @param ut the text to be accessed.
-  *  @param nativeIndex Iteration index, in the native units of the text provider.
-  *  @return Code point which starts at or before index,
-  *         or U_SENTINEL (-1) if it is out of bounds.
-  * @stable ICU 3.4
-  */
-U_STABLE UChar32 U_EXPORT2
-utext_next32From(UText *ut, int64_t nativeIndex);
-
-
-
-/**
-  * Set the iteration index, and return the code point preceding the
-  * one specified by the initial index.  Leave the iteration position
-  * at the start of the returned code point.
-  *
-  * This function is the most efficient and convenient way to
-  * begin a backwards iteration.
-  *
-  * @param ut the text to be accessed.
-  * @param nativeIndex Iteration index in the native units of the text provider.
-  * @return Code point preceding the one at the initial index,
-  *         or U_SENTINEL (-1) if it is out of bounds.
-  *
-  * @stable ICU 3.4
-  */
-U_STABLE UChar32 U_EXPORT2
-utext_previous32From(UText *ut, int64_t nativeIndex);
-
-/**
-  * Get the current iterator position, which can range from 0 to 
-  * the length of the text.
-  * The position is a native index into the input text, in whatever format it
-  * may have (possibly UTF-8 for example), and may not always be the same as
-  * the corresponding UChar (UTF-16) index.
-  * The returned position will always be aligned to a code point boundary. 
-  *
-  * @param ut the text to be accessed.
-  * @return the current index position, in the native units of the text provider.
-  * @stable ICU 3.4
-  */
-U_STABLE int64_t U_EXPORT2
-utext_getNativeIndex(const UText *ut);
-
-/**
- * Set the current iteration position to the nearest code point
- * boundary at or preceding the specified index.
- * The index is in the native units of the original input text.
- * If the index is out of range, it will be pinned to be within
- * the range of the input text.
- * <p>
- * It will usually be more efficient to begin an iteration
- * using the functions utext_next32From() or utext_previous32From()
- * rather than setIndex().
- * <p>
- * Moving the index position to an adjacent character is best done
- * with utext_next32(), utext_previous32() or utext_moveIndex32().
- * Attempting to do direct arithmetic on the index position is
- * complicated by the fact that the size (in native units) of a
- * character depends on the underlying representation of the character
- * (UTF-8, UTF-16, UTF-32, arbitrary codepage), and is not
- * easily knowable.
- *
- * @param ut the text to be accessed.
- * @param nativeIndex the native unit index of the new iteration position.
- * @stable ICU 3.4
- */
-U_STABLE void U_EXPORT2
-utext_setNativeIndex(UText *ut, int64_t nativeIndex);
-
-/**
- * Move the iterator postion by delta code points.  The number of code points
- * is a signed number; a negative delta will move the iterator backwards,
- * towards the start of the text.
- * <p>
- * The index is moved by <code>delta</code> code points
- * forward or backward, but no further backward than to 0 and
- * no further forward than to utext_nativeLength().
- * The resulting index value will be in between 0 and length, inclusive.
- *
- * @param ut the text to be accessed.
- * @param delta the signed number of code points to move the iteration position.
- * @return TRUE if the position could be moved the requested number of positions while
- *              staying within the range [0 - text length].
- * @stable ICU 3.4
- */
-U_STABLE UBool U_EXPORT2
-utext_moveIndex32(UText *ut, int32_t delta);
-
-/**
- * Get the native index of the character preceeding the current position.
- * If the iteration position is already at the start of the text, zero
- * is returned.
- * The value returned is the same as that obtained from the following sequence,
- * but without the side effect of changing the iteration position.
- *   
- * \code
- *    UText  *ut = whatever;
- *      ...
- *    utext_previous(ut)
- *    utext_getNativeIndex(ut);
- * \endcode
- *
- * This function is most useful during forwards iteration, where it will get the
- *   native index of the character most recently returned from utext_next().
- *
- * @param ut the text to be accessed
- * @return the native index of the character preceeding the current index position,
- *         or zero if the current position is at the start of the text.
- * @stable ICU 3.6
- */
-U_STABLE int64_t U_EXPORT2
-utext_getPreviousNativeIndex(UText *ut); 
-
-
-/**
- *
- * Extract text from a UText into a UChar buffer.  The range of text to be extracted
- * is specified in the native indices of the UText provider.  These may not necessarily
- * be UTF-16 indices.
- * <p>
- * The size (number of 16 bit UChars) of the data to be extracted is returned.  The
- * full number of UChars is returned, even when the extracted text is truncated
- * because the specified buffer size is too small.
- * <p>
- * The extracted string will (if you are a user) / must (if you are a text provider)
- * be NUL-terminated if there is sufficient space in the destination buffer.  This
- * terminating NUL is not included in the returned length.
- * <p>
- * The iteration index is left at the position following the last extracted character.
- *
- * @param  ut    the UText from which to extract data.
- * @param  nativeStart the native index of the first character to extract.\
- *               If the specified index is out of range,
- *               it will be pinned to to be within 0 <= index <= textLength
- * @param  nativeLimit the native string index of the position following the last
- *               character to extract.  If the specified index is out of range,
- *               it will be pinned to to be within 0 <= index <= textLength.
- *               nativeLimit must be >= nativeStart.
- * @param  dest  the UChar (UTF-16) buffer into which the extracted text is placed
- * @param  destCapacity  The size, in UChars, of the destination buffer.  May be zero
- *               for precomputing the required size.
- * @param  status receives any error status.
- *         U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the 
- *         buffer was too small.  Returns number of UChars for preflighting.
- * @return Number of UChars in the data to be extracted.  Does not include a trailing NUL.
- *
- * @stable ICU 3.4
- */
-U_STABLE int32_t U_EXPORT2
-utext_extract(UText *ut,
-             int64_t nativeStart, int64_t nativeLimit,
-             UChar *dest, int32_t destCapacity,
-             UErrorCode *status);
-
-
-/**
- * Compare two UTexts (binary order). The comparison begins at each source text's
- * iteration position. The iteration position of each UText will be left following
- * the last character compared.
- *
- * The comparison is done in code point order; unlike u_strCompare, you
- * cannot choose to use code unit order. This is because the characters
- * in a UText are accessed one code point at a time, and may not be from a UTF-16
- * context.
- *
- * This functions works with strings of different explicitly specified lengths
- * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
- * A length argument of -1 signifies that as much of the string should be used as
- * is necessary to compare with the other string. If both length arguments are -1,
- * the entire remaining portionss of both strings are used.
- *
- * @param s1 First source string.
- * @param length1 Length of first source string in UTF-32 code points.
- *
- * @param s2 Second source string.
- * @param length2 Length of second source string in UTF-32 code points.
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @internal ICU 4.4 technology preview
- */
-U_INTERNAL int32_t U_EXPORT2
-utext_compare(UText *s1, int32_t length1,
-              UText *s2, int32_t length2);    
-
-/**
- * Compare two UTexts (binary order). The comparison begins at each source text's
- * iteration position. The iteration position of each UText will be left following
- * the last character compared. This method differs from utext_compare in that
- * it accepts native limits rather than lengths for each string.
- *
- * The comparison is done in code point order; unlike u_strCompare, you
- * cannot choose to use code unit order. This is because the characters
- * in a UText are accessed one code point at a time, and may not be from a UTF-16
- * context.
- *
- * This functions works with strings of different explicitly specified lengths
- * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
- * A limit argument of -1 signifies that as much of the string should be used as
- * is necessary to compare with the other string. If both limit arguments are -1,
- * the entire remaining portionss of both strings are used.
- *
- * @param s1 First source string.
- * @param limit1 Native index of the last character in the first source string to be considered.
- *
- * @param s2 Second source string.
- * @param limit2 Native index of the last character in the second source string to be considered.
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @internal ICU 4.4 technology preview
- */
-U_INTERNAL int32_t U_EXPORT2
-utext_compareNativeLimit(UText *s1, int64_t limit1,
-                         UText *s2, int64_t limit2);    
-
-/**
- * Compare two UTexts case-insensitively using full case folding. The comparison
- * begins at each source text's iteration position. The iteration position of each
- * UText will be left following the last character compared.
- *
- * The comparison is done in code point order; this is because the characters
- * in a UText are accessed one code point at a time, and may not be from a UTF-16
- * context.
- *
- * This functions works with strings of different explicitly specified lengths
- * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
- * A length argument of -1 signifies that as much of the string should be used as
- * is necessary to compare with the other string. If both length arguments are -1,
- * the entire remaining portionss of both strings are used.
- *
- * @param s1 First source string.
- * @param length1 Length of first source string in UTF-32 code points.
- *
- * @param s2 Second source string.
- * @param length2 Length of second source string in UTF-32 code points.
- *
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Comparison in code point order with default case folding.
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @internal ICU 4.4 technology preview
- */
-U_INTERNAL int32_t U_EXPORT2
-utext_caseCompare(UText *s1, int32_t length1,
-                  UText *s2, int32_t length2,
-                  uint32_t options, UErrorCode *pErrorCode);    
-
-/**
- * Compare two UTexts case-insensitively using full case folding. The comparison
- * begins at each source text's iteration position. The iteration position of each
- * UText will be left following the last character compared. This method differs from
- * utext_caseCompare in that it accepts native limits rather than lengths for each
- * string.
- *
- * The comparison is done in code point order; this is because the characters
- * in a UText are accessed one code point at a time, and may not be from a UTF-16
- * context.
- *
- * This functions works with strings of different explicitly specified lengths
- * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
- * A limit argument of -1 signifies that as much of the string should be used as
- * is necessary to compare with the other string. If both length arguments are -1,
- * the entire remaining portionss of both strings are used.
- *
- * @param s1 First source string.
- * @param limit1 Native index of the last character in the first source string to be considered.
- *
- * @param s2 Second source string.
- * @param limit2 Native index of the last character in the second source string to be considered.
- *
- * @param options A bit set of options:
- *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
- *     Comparison in code point order with default case folding.
- *
- *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
- *
- * @param pErrorCode Must be a valid pointer to an error code value,
- *                  which must not indicate a failure before the function call.
- *
- * @return <0 or 0 or >0 as usual for string comparisons
- *
- * @internal ICU 4.4 technology preview
- */
-U_INTERNAL int32_t U_EXPORT2
-utext_caseCompareNativeLimit(UText *s1, int64_t limit1,
-                             UText *s2, int64_t limit2,
-                             uint32_t options, UErrorCode *pErrorCode);    
-
-
-/************************************************************************************
- *
- *  #define inline versions of selected performance-critical text access functions
- *          Caution:  do not use auto increment++ or decrement-- expressions
- *                    as parameters to these macros.
- *
- *          For most use, where there is no extreme performance constraint, the
- *          normal, non-inline functions are a better choice.  The resulting code
- *          will be smaller, and, if the need ever arises, easier to debug.
- *
- *          These are implemented as #defines rather than real functions
- *          because there is no fully portable way to do inline functions in plain C.
- *
- ************************************************************************************/
-
-/**
- * inline version of utext_current32(), for performance-critical situations.
- *
- * Get the code point at the current iteration position of the UText.
- * Returns U_SENTINEL (-1) if the position is at the end of the
- * text.
- *
- * @internal ICU 4.4 technology preview
- */
-#define UTEXT_CURRENT32(ut)  \
-    ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
-    ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut))
-
-/**
- * inline version of utext_next32(), for performance-critical situations.
- *
- * Get the code point at the current iteration position of the UText, and
- * advance the position to the first index following the character.
- * This is a post-increment operation.
- * Returns U_SENTINEL (-1) if the position is at the end of the
- * text.
- *
- * @stable ICU 3.4
- */
-#define UTEXT_NEXT32(ut)  \
-    ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
-    ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut))
-
-/**
- * inline version of utext_previous32(), for performance-critical situations.
- *
- *  Move the iterator position to the character (code point) whose
- *  index precedes the current position, and return that character.
- *  This is a pre-decrement operation.
- *  Returns U_SENTINEL (-1) if the position is at the start of the  text.
- *
- * @stable ICU 3.4
- */
-#define UTEXT_PREVIOUS32(ut)  \
-    ((ut)->chunkOffset > 0 && \
-     (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \
-          (ut)->chunkContents[--((ut)->chunkOffset)]  :  utext_previous32(ut))
-
-/**
-  *  inline version of utext_getNativeIndex(), for performance-critical situations.
-  *
-  * Get the current iterator position, which can range from 0 to 
-  * the length of the text.
-  * The position is a native index into the input text, in whatever format it
-  * may have (possibly UTF-8 for example), and may not always be the same as
-  * the corresponding UChar (UTF-16) index.
-  * The returned position will always be aligned to a code point boundary. 
-  *
-  * @stable ICU 3.6
-  */
-#define UTEXT_GETNATIVEINDEX(ut)                       \
-    ((ut)->chunkOffset <= (ut)->nativeIndexingLimit?   \
-        (ut)->chunkNativeStart+(ut)->chunkOffset :     \
-        (ut)->pFuncs->mapOffsetToNative(ut))    
-
-/**
-  *  inline version of utext_setNativeIndex(), for performance-critical situations.
-  *
-  * Set the current iteration position to the nearest code point
-  * boundary at or preceding the specified index.
-  * The index is in the native units of the original input text.
-  * If the index is out of range, it will be pinned to be within
-  * the range of the input text.
-  *
-  * @stable ICU 3.8
-  */
-#define UTEXT_SETNATIVEINDEX(ut, ix)                       \
-    { int64_t __offset = (ix) - (ut)->chunkNativeStart; \
-      if (__offset>=0 && __offset<=(int64_t)(ut)->nativeIndexingLimit) { \
-          (ut)->chunkOffset=(int32_t)__offset; \
-      } else { \
-          utext_setNativeIndex((ut), (ix)); } }
-
-
-
-/************************************************************************************
- *
- *   Functions related to writing or modifying the text.
- *   These will work only with modifiable UTexts.  Attempting to
- *   modify a read-only UText will return an error status.
- *
- ************************************************************************************/
-
-
-/**
- *  Return TRUE if the text can be written (modified) with utext_replace() or
- *  utext_copy().  For the text to be writable, the text provider must
- *  be of a type that supports writing and the UText must not be frozen.
- *
- *  Attempting to modify text when utext_isWriteable() is FALSE will fail -
- *  the text will not be modified, and an error will be returned from the function
- *  that attempted the modification.
- *
- * @param  ut   the UText to be tested.
- * @return TRUE if the text is modifiable.
- *
- * @see    utext_freeze()
- * @see    utext_replace()
- * @see    utext_copy()
- * @stable ICU 3.4
- *
- */
-U_STABLE UBool U_EXPORT2
-utext_isWritable(const UText *ut);
-
-
-/**
-  * Test whether there is meta data associated with the text.
-  * @see Replaceable::hasMetaData()
-  *
-  * @param ut The UText to be tested
-  * @return TRUE if the underlying text includes meta data.
-  * @stable ICU 3.4
-  */
-U_STABLE UBool U_EXPORT2
-utext_hasMetaData(const UText *ut);
-
-
-/**
- * Replace a range of the original text with a replacement text.
- *
- * Leaves the current iteration position at the position following the
- *  newly inserted replacement text.
- *
- * This function is only available on UText types that support writing,
- * that is, ones where utext_isWritable() returns TRUE.
- *
- * When using this function, there should be only a single UText opened onto the
- * underlying native text string.  Behavior after a replace operation
- * on a UText is undefined for any other additional UTexts that refer to the
- * modified string.
- *
- * @param ut               the UText representing the text to be operated on.
- * @param nativeStart      the native index of the start of the region to be replaced
- * @param nativeLimit      the native index of the character following the region to be replaced.
- * @param replacementText  pointer to the replacement text
- * @param replacementLength length of the replacement text, or -1 if the text is NUL terminated.
- * @param status           receives any error status.  Possible errors include
- *                         U_NO_WRITE_PERMISSION
- *
- * @return The signed number of (native) storage units by which
- *         the length of the text expanded or contracted.
- *
- * @stable ICU 3.4
- */
-U_STABLE int32_t U_EXPORT2
-utext_replace(UText *ut,
-             int64_t nativeStart, int64_t nativeLimit,
-             const UChar *replacementText, int32_t replacementLength,
-             UErrorCode *status);
-
-
-
-/**
- *
- * Copy or move a substring from one position to another within the text,
- * while retaining any metadata associated with the text.
- * This function is used to duplicate or reorder substrings.
- * The destination index must not overlap the source range.
- *
- * The text to be copied or moved is inserted at destIndex;
- * it does not replace or overwrite any existing text.
- *
- * The iteration position is left following the newly inserted text
- * at the destination position.
- *
- * This function is only available on UText types that support writing,
- * that is, ones where utext_isWritable() returns TRUE.
- *
- * When using this function, there should be only a single UText opened onto the
- * underlying native text string.  Behavior after a copy operation
- * on a UText is undefined in any other additional UTexts that refer to the
- * modified string.
- *
- * @param ut           The UText representing the text to be operated on.
- * @param nativeStart  The native index of the start of the region to be copied or moved
- * @param nativeLimit  The native index of the character position following the region
- *                     to be copied.
- * @param destIndex    The native destination index to which the source substring is
- *                     copied or moved.
- * @param move         If TRUE, then the substring is moved, not copied/duplicated.
- * @param status       receives any error status.  Possible errors include U_NO_WRITE_PERMISSION
- *                       
- * @stable ICU 3.4
- */
-U_STABLE void U_EXPORT2
-utext_copy(UText *ut,
-          int64_t nativeStart, int64_t nativeLimit,
-          int64_t destIndex,
-          UBool move,
-          UErrorCode *status);
-
-
-/**
-  *  <p>
-  *  Freeze a UText.  This prevents any modification to the underlying text itself
-  *  by means of functions operating on this UText.
-  *  </p>
-  *  <p>
-  *  Once frozen, a UText can not be unfrozen.  The intent is to ensure
-  *  that a the text underlying a frozen UText wrapper cannot be modified via that UText.
-  *  </p>
-  *  <p>
-  *  Caution:  freezing a UText will disable changes made via the specific
-  *   frozen UText wrapper only; it will not have any effect on the ability to
-  *   directly modify the text by bypassing the UText.  Any such backdoor modifications
-  *   are always an error while UText access is occuring because the underlying
-  *   text can get out of sync with UText's buffering.
-  *  </p>
-  *
-  *  @param ut  The UText to be frozen.
-  *  @see   utext_isWritable()
-  *  @stable ICU 3.6
-  */
-U_STABLE void U_EXPORT2
-utext_freeze(UText *ut);
-
-
-/**
- * UText provider properties (bit field indexes).
- *
- * @see UText
- * @stable ICU 3.4
- */
-enum {
-    /**
-     * It is potentially time consuming for the provider to determine the length of the text.
-     * @stable ICU 3.4
-     */
-    UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1,
-    /**
-     * Text chunks remain valid and usable until the text object is modified or
-     * deleted, not just until the next time the access() function is called
-     * (which is the default).
-     * @stable ICU 3.4
-     */
-    UTEXT_PROVIDER_STABLE_CHUNKS = 2,
-    /**
-     * The provider supports modifying the text via the replace() and copy()
-     * functions.
-     * @see Replaceable
-     * @stable ICU 3.4
-     */
-    UTEXT_PROVIDER_WRITABLE = 3,
-    /**
-     * There is meta data associated with the text.
-     * @see Replaceable::hasMetaData()
-     * @stable ICU 3.4
-     */ 
-    UTEXT_PROVIDER_HAS_META_DATA = 4,
-    /**
-     * Text provider owns the text storage.
-     *  Generally occurs as the result of a deep clone of the UText.
-     *  When closing the UText, the associated text must
-     *  also be closed/deleted/freed/ whatever is appropriate.
-     * @stable ICU 3.6
-     */
-     UTEXT_PROVIDER_OWNS_TEXT = 5
-};
-
-/**
-  * Function type declaration for UText.clone().
-  *
-  *  clone a UText.  Much like opening a UText where the source text is itself
-  *  another UText.
-  *
-  *  A deep clone will copy both the UText data structures and the underlying text.
-  *  The original and cloned UText will operate completely independently; modifications
-  *  made to the text in one will not effect the other.  Text providers are not
-  *  required to support deep clones.  The user of clone() must check the status return
-  *  and be prepared to handle failures.
-  *
-  *  A shallow clone replicates only the UText data structures; it does not make
-  *  a copy of the underlying text.  Shallow clones can be used as an efficient way to 
-  *  have multiple iterators active in a single text string that is not being
-  *  modified.
-  *
-  *  A shallow clone operation must not fail except for truly exceptional conditions such
-  *  as memory allocation failures.
-  *
-  *  A UText and its clone may be safely concurrently accessed by separate threads.
-  *  This is true for both shallow and deep clones.
-  *  It is the responsibility of the Text Provider to ensure that this thread safety
-  *  constraint is met.
-
-  *
-  *  @param dest   A UText struct to be filled in with the result of the clone operation,
-  *                or NULL if the clone function should heap-allocate a new UText struct.
-  *  @param src    The UText to be cloned.
-  *  @param deep   TRUE to request a deep clone, FALSE for a shallow clone.
-  *  @param status Errors are returned here.  For deep clones, U_UNSUPPORTED_ERROR
-  *                should be returned if the text provider is unable to clone the
-  *                original text.
-  *  @return       The newly created clone, or NULL if the clone operation failed.
-  *
-  * @stable ICU 3.4
-  */
-typedef UText * U_CALLCONV
-UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status);
-
-
-/**
- * Function type declaration for UText.nativeLength().
- *
- * @param ut the UText to get the length of.
- * @return the length, in the native units of the original text string.
- * @see UText
- * @stable ICU 3.4
- */
-typedef int64_t U_CALLCONV
-UTextNativeLength(UText *ut);
-
-/**
- * Function type declaration for UText.access().  Get the description of the text chunk
- *  containing the text at a requested native index.  The UText's iteration
- *  position will be left at the requested index.  If the index is out
- *  of bounds, the iteration position will be left at the start or end
- *  of the string, as appropriate.
- *
- *  Chunks must begin and end on code point boundaries.  A single code point
- *  comprised of multiple storage units must never span a chunk boundary.
- *
- *
- * @param ut          the UText being accessed.
- * @param nativeIndex Requested index of the text to be accessed.
- * @param forward     If TRUE, then the returned chunk must contain text
- *                    starting from the index, so that start<=index<limit.
- *                    If FALSE, then the returned chunk must contain text
- *                    before the index, so that start<index<=limit.
- * @return            True if the requested index could be accessed.  The chunk
- *                    will contain the requested text.
- *                    False value if a chunk cannot be accessed
- *                    (the requested index is out of bounds).
- *
- * @see UText
- * @stable ICU 3.4
- */
-typedef UBool U_CALLCONV
-UTextAccess(UText *ut, int64_t nativeIndex, UBool forward);
-
-/**
- * Function type declaration for UText.extract().
- *
- * Extract text from a UText into a UChar buffer.  The range of text to be extracted
- * is specified in the native indices of the UText provider.  These may not necessarily
- * be UTF-16 indices.
- * <p>
- * The size (number of 16 bit UChars) in the data to be extracted is returned.  The
- * full amount is returned, even when the specified buffer size is smaller.
- * <p>
- * The extracted string will (if you are a user) / must (if you are a text provider)
- * be NUL-terminated if there is sufficient space in the destination buffer.
- *
- * @param  ut            the UText from which to extract data.
- * @param  nativeStart   the native index of the first characer to extract.
- * @param  nativeLimit   the native string index of the position following the last
- *                       character to extract.
- * @param  dest          the UChar (UTF-16) buffer into which the extracted text is placed
- * @param  destCapacity  The size, in UChars, of the destination buffer.  May be zero
- *                       for precomputing the required size.
- * @param  status        receives any error status.
- *                       If U_BUFFER_OVERFLOW_ERROR: Returns number of UChars for
- *                       preflighting.
- * @return Number of UChars in the data.  Does not include a trailing NUL.
- *
- * @stable ICU 3.4
- */
-typedef int32_t U_CALLCONV
-UTextExtract(UText *ut,
-             int64_t nativeStart, int64_t nativeLimit,
-             UChar *dest, int32_t destCapacity,
-             UErrorCode *status);
-
-/**
- * Function type declaration for UText.replace().
- *
- * Replace a range of the original text with a replacement text.
- *
- * Leaves the current iteration position at the position following the
- *  newly inserted replacement text.
- *
- * This function need only be implemented on UText types that support writing.
- *
- * When using this function, there should be only a single UText opened onto the
- * underlying native text string.  The function is responsible for updating the
- * text chunk within the UText to reflect the updated iteration position,
- * taking into account any changes to the underlying string's structure caused
- * by the replace operation.
- *
- * @param ut               the UText representing the text to be operated on.
- * @param nativeStart      the index of the start of the region to be replaced
- * @param nativeLimit      the index of the character following the region to be replaced.
- * @param replacementText  pointer to the replacement text
- * @param replacmentLength length of the replacement text in UChars, or -1 if the text is NUL terminated.
- * @param status           receives any error status.  Possible errors include
- *                         U_NO_WRITE_PERMISSION
- *
- * @return The signed number of (native) storage units by which
- *         the length of the text expanded or contracted.
- *
- * @stable ICU 3.4
- */
-typedef int32_t U_CALLCONV
-UTextReplace(UText *ut,
-             int64_t nativeStart, int64_t nativeLimit,
-             const UChar *replacementText, int32_t replacmentLength,
-             UErrorCode *status);
-
-/**
- * Function type declaration for UText.copy().
- *
- * Copy or move a substring from one position to another within the text,
- * while retaining any metadata associated with the text.
- * This function is used to duplicate or reorder substrings.
- * The destination index must not overlap the source range.
- *
- * The text to be copied or moved is inserted at destIndex;
- * it does not replace or overwrite any existing text.
- *
- * This function need only be implemented for UText types that support writing.
- *
- * When using this function, there should be only a single UText opened onto the
- * underlying native text string.  The function is responsible for updating the
- * text chunk within the UText to reflect the updated iteration position,
- * taking into account any changes to the underlying string's structure caused
- * by the replace operation.
- *
- * @param ut           The UText representing the text to be operated on.
- * @param nativeStart  The index of the start of the region to be copied or moved
- * @param nativeLimit  The index of the character following the region to be replaced.
- * @param nativeDest   The destination index to which the source substring is copied or moved.
- * @param move         If TRUE, then the substring is moved, not copied/duplicated.
- * @param status       receives any error status.  Possible errors include U_NO_WRITE_PERMISSION
- *
- * @stable ICU 3.4
- */
-typedef void U_CALLCONV
-UTextCopy(UText *ut,
-          int64_t nativeStart, int64_t nativeLimit,
-          int64_t nativeDest,
-          UBool move,
-          UErrorCode *status);
-
-/**
- * Function type declaration for UText.mapOffsetToNative().
- * Map from the current UChar offset within the current text chunk to
- *  the corresponding native index in the original source text.
- *
- * This is required only for text providers that do not use native UTF-16 indexes.
- *
- * @param ut     the UText.
- * @return Absolute (native) index corresponding to chunkOffset in the current chunk.
- *         The returned native index should always be to a code point boundary.
- *
- * @stable ICU 3.4
- */
-typedef int64_t U_CALLCONV
-UTextMapOffsetToNative(const UText *ut);
-
-/**
- * Function type declaration for UText.mapIndexToUTF16().
- * Map from a native index to a UChar offset within a text chunk.
- * Behavior is undefined if the native index does not fall within the
- *   current chunk.
- *
- * This function is required only for text providers that do not use native UTF-16 indexes.
- *
- * @param ut          The UText containing the text chunk.
- * @param nativeIndex Absolute (native) text index, chunk->start<=index<=chunk->limit.
- * @return            Chunk-relative UTF-16 offset corresponding to the specified native
- *                    index.
- *
- * @stable ICU 3.4
- */
-typedef int32_t U_CALLCONV
-UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex);
-
-
-/**
- * Function type declaration for UText.utextClose().
- *
- * A Text Provider close function is only required for provider types that make
- *  allocations in their open function (or other functions) that must be 
- *  cleaned when the UText is closed.
- *
- * The allocation of the UText struct itself and any "extra" storage
- * associated with the UText is handled by the common UText implementation
- * and does not require provider specific cleanup in a close function.
- *
- * Most UText provider implementations do not need to implement this function.
- *
- * @param ut A UText object to be closed.
- *
- * @stable ICU 3.4
- */
-typedef void U_CALLCONV
-UTextClose(UText *ut);
-
-
-/**
-  *   (public)  Function dispatch table for UText.
-  *             Conceptually very much like a C++ Virtual Function Table.
-  *             This struct defines the organization of the table.
-  *             Each text provider implementation must provide an
-  *              actual table that is initialized with the appropriate functions
-  *              for the type of text being handled.
-  *   @stable ICU 3.6
-  */
-struct UTextFuncs {
-    /**
-     *   (public)  Function table size, sizeof(UTextFuncs)
-     *             Intended for use should the table grow to accomodate added
-     *             functions in the future, to allow tests for older format
-     *             function tables that do not contain the extensions.
-     *
-     *             Fields are placed for optimal alignment on
-     *             32/64/128-bit-pointer machines, by normally grouping together
-     *             4 32-bit fields,
-     *             4 pointers,
-     *             2 64-bit fields
-     *             in sequence.
-     *   @stable ICU 3.6
-     */
-    int32_t       tableSize;
-
-    /**
-      *   (private)  Alignment padding.
-      *              Do not use, reserved for use by the UText framework only.
-      *   @internal
-      */
-    int32_t       reserved1, /** @internal */ reserved2, /** @internal */ reserved3;
-
-
-    /**
-     * (public) Function pointer for UTextClone
-     *
-     * @see UTextClone
-     * @stable ICU 3.6
-     */
-    UTextClone *clone;
-
-    /**
-     * (public) function pointer for UTextLength
-     * May be expensive to compute!
-     *
-     * @see UTextLength
-     * @stable ICU 3.6
-     */
-    UTextNativeLength *nativeLength;
-
-    /**
-     * (public) Function pointer for UTextAccess.
-     *
-     * @see UTextAccess
-     * @stable ICU 3.6
-     */
-    UTextAccess *access;
-
-    /**
-     * (public) Function pointer for UTextExtract.
-     *
-     * @see UTextExtract
-     * @stable ICU 3.6
-     */
-    UTextExtract *extract;
-
-    /**
-     * (public) Function pointer for UTextReplace.
-     *
-     * @see UTextReplace
-     * @stable ICU 3.6
-     */
-    UTextReplace *replace;
-
-    /**
-     * (public) Function pointer for UTextCopy.
-     *
-     * @see UTextCopy
-     * @stable ICU 3.6
-     */
-    UTextCopy *copy;
-
-    /**
-     * (public) Function pointer for UTextMapOffsetToNative.
-     *
-     * @see UTextMapOffsetToNative
-     * @stable ICU 3.6
-     */
-    UTextMapOffsetToNative *mapOffsetToNative;
-
-    /**
-     * (public) Function pointer for UTextMapNativeIndexToUTF16.
-     *
-     * @see UTextMapNativeIndexToUTF16
-     * @stable ICU 3.6
-     */
-    UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16;
-
-    /**
-     * (public) Function pointer for UTextClose.
-      *
-      * @see UTextClose
-      * @stable ICU 3.6
-      */
-    UTextClose  *close;
-
-    /**
-      * (private)  Spare function pointer
-      * @internal
-      */
-    UTextClose  *spare1;
-    
-    /**
-      * (private)  Spare function pointer
-      * @internal
-      */
-    UTextClose  *spare2;
-
-    /**
-      * (private)  Spare function pointer
-      * @internal
-      */
-    UTextClose  *spare3;
-
-};
-/**
- * Function dispatch table for UText
- * @see UTextFuncs
- */
-typedef struct UTextFuncs UTextFuncs;
-
- /**
-  *   UText struct.  Provides the interface between the generic UText access code
-  *                  and the UText provider code that works on specific kinds of
-  *                  text  (UTF-8, noncontiguous UTF-16, whatever.)
-  *
-  *                  Applications that are using predefined types of text providers
-  *                  to pass text data to ICU services will have no need to view the
-  *                  internals of the UText structs that they open.
-  *
-  * @stable ICU 3.6
-  */
-struct UText {
-    /**
-     *     (private)  Magic.  Used to help detect when UText functions are handed
-     *                        invalid or unitialized UText structs.
-     *                        utext_openXYZ() functions take an initialized,
-     *                        but not necessarily open, UText struct as an
-     *                        optional fill-in parameter.  This magic field
-     *                        is used to check for that initialization.
-     *                        Text provider close functions must NOT clear
-     *                        the magic field because that would prevent
-     *                        reuse of the UText struct.
-     * @internal
-     */
-    uint32_t       magic;
-
-
-    /**
-     *     (private)  Flags for managing the allocation and freeing of
-     *                memory associated with this UText.
-     * @internal
-     */
-    int32_t        flags;
-
-
-    /**
-      *  Text provider properties.  This set of flags is maintainted by the
-      *                             text provider implementation.
-      *  @stable ICU 3.4
-      */
-    int32_t         providerProperties;
-
-    /**
-     * (public) sizeOfStruct=sizeof(UText)
-     * Allows possible backward compatible extension.
-     *
-     * @stable ICU 3.4
-     */
-    int32_t         sizeOfStruct;
-    
-    /* ------ 16 byte alignment boundary -----------  */
-    
-
-    /**
-      *  (protected) Native index of the first character position following
-      *              the current chunk.
-      *  @stable ICU 3.6
-      */
-    int64_t         chunkNativeLimit;
-
-    /**
-     *   (protected)  Size in bytes of the extra space (pExtra).
-     *  @stable ICU 3.4
-     */
-    int32_t        extraSize;
-
-    /**
-      *    (protected) The highest chunk offset where native indexing and
-      *    chunk (UTF-16) indexing correspond.  For UTF-16 sources, value
-      *    will be equal to chunkLength.
-      *
-      *    @stable ICU 3.6
-      */
-    int32_t         nativeIndexingLimit;
-
-    /* ---- 16 byte alignment boundary------ */
-    
-    /**
-     *  (protected) Native index of the first character in the text chunk.
-     *  @stable ICU 3.6
-     */
-    int64_t         chunkNativeStart;
-
-    /**
-     *  (protected) Current iteration position within the text chunk (UTF-16 buffer).
-     *  This is the index to the character that will be returned by utext_next32().
-     *  @stable ICU 3.6
-     */
-    int32_t         chunkOffset;
-
-    /**
-     *  (protected) Length the text chunk (UTF-16 buffer), in UChars.
-     *  @stable ICU 3.6
-     */
-    int32_t         chunkLength;
-
-    /* ---- 16  byte alignment boundary-- */
-    
-
-    /**
-     *  (protected)  pointer to a chunk of text in UTF-16 format.
-     *  May refer either to original storage of the source of the text, or
-     *  if conversion was required, to a buffer owned by the UText.
-     *  @stable ICU 3.6
-     */
-    const UChar    *chunkContents;
-
-     /**
-      * (public)     Pointer to Dispatch table for accessing functions for this UText.
-      * @stable ICU 3.6
-      */
-    const UTextFuncs     *pFuncs;
-
-    /**
-     *  (protected)  Pointer to additional space requested by the
-     *               text provider during the utext_open operation.
-     * @stable ICU 3.4
-     */
-    void          *pExtra;
-
-    /**
-     * (protected) Pointer to string or text-containin object or similar.
-     * This is the source of the text that this UText is wrapping, in a format
-     *  that is known to the text provider functions.
-     * @stable ICU 3.4
-     */
-    const void   *context;
-
-    /* --- 16 byte alignment boundary--- */
-
-    /**
-     * (protected) Pointer fields available for use by the text provider.
-     * Not used by UText common code.
-     * @stable ICU 3.6
-     */
-    const void     *p; 
-    /**
-     * (protected) Pointer fields available for use by the text provider.
-     * Not used by UText common code.
-     * @stable ICU 3.6
-     */
-    const void     *q;
-     /**
-     * (protected) Pointer fields available for use by the text provider.
-     * Not used by UText common code.
-     * @stable ICU 3.6
-      */
-    const void     *r;
-
-    /**
-      *  Private field reserved for future use by the UText framework
-      *     itself.  This is not to be touched by the text providers.
-      * @internal ICU 3.4
-      */
-    void           *privP;
-
-
-    /* --- 16 byte alignment boundary--- */
-    
-
-    /**
-      * (protected) Integer field reserved for use by the text provider.
-      * Not used by the UText framework, or by the client (user) of the UText.
-      * @stable ICU 3.4
-      */
-    int64_t         a;
-
-    /**
-      * (protected) Integer field reserved for use by the text provider.
-      * Not used by the UText framework, or by the client (user) of the UText.
-      * @stable ICU 3.4
-      */
-    int32_t         b;
-
-    /**
-      * (protected) Integer field reserved for use by the text provider.
-      * Not used by the UText framework, or by the client (user) of the UText.
-      * @stable ICU 3.4
-      */
-    int32_t         c;
-
-    /*  ---- 16 byte alignment boundary---- */
-
-
-    /**
-      *  Private field reserved for future use by the UText framework
-      *     itself.  This is not to be touched by the text providers.
-      * @internal ICU 3.4
-      */
-    int64_t         privA;
-    /**
-      *  Private field reserved for future use by the UText framework
-      *     itself.  This is not to be touched by the text providers.
-      * @internal ICU 3.4
-      */
-    int32_t         privB;
-    /**
-      *  Private field reserved for future use by the UText framework
-      *     itself.  This is not to be touched by the text providers.
-      * @internal ICU 3.4
-      */
-    int32_t         privC;
-};
-
-
-/**
- *  Common function for use by Text Provider implementations to allocate and/or initialize
- *  a new UText struct.  To be called in the implementation of utext_open() functions.
- *  If the supplied UText parameter is null, a new UText struct will be allocated on the heap.
- *  If the supplied UText is already open, the provider's close function will be called
- *  so that the struct can be reused by the open that is in progress.
- *
- * @param ut   pointer to a UText struct to be re-used, or null if a new UText
- *             should be allocated.
- * @param extraSpace The amount of additional space to be allocated as part
- *             of this UText, for use by types of providers that require
- *             additional storage.
- * @param status Errors are returned here.
- * @return pointer to the UText, allocated if necessary, with extra space set up if requested.
- * @stable ICU 3.4
- */
-U_STABLE UText * U_EXPORT2
-utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status);
-
-/**
-  * @internal
-  *  Value used to help identify correctly initialized UText structs.
-  *  Note:  must be publicly visible so that UTEXT_INITIALIZER can access it.
-  */
-enum {
-    UTEXT_MAGIC = 0x345ad82c
-};
-
-/**
- * initializer to be used with local (stack) instances of a UText
- *  struct.  UText structs must be initialized before passing
- *  them to one of the utext_open functions.
- *
- * @stable ICU 3.6
- */
-#define UTEXT_INITIALIZER {                                        \
-                  UTEXT_MAGIC,          /* magic                */ \
-                  0,                    /* flags                */ \
-                  0,                    /* providerProps        */ \
-                  sizeof(UText),        /* sizeOfStruct         */ \
-                  0,                    /* chunkNativeLimit     */ \
-                  0,                    /* extraSize            */ \
-                  0,                    /* nativeIndexingLimit  */ \
-                  0,                    /* chunkNativeStart     */ \
-                  0,                    /* chunkOffset          */ \
-                  0,                    /* chunkLength          */ \
-                  NULL,                 /* chunkContents        */ \
-                  NULL,                 /* pFuncs               */ \
-                  NULL,                 /* pExtra               */ \
-                  NULL,                 /* context              */ \
-                  NULL, NULL, NULL,     /* p, q, r              */ \
-                  NULL,                 /* privP                */ \
-                  0, 0, 0,              /* a, b, c              */ \
-                  0, 0, 0               /* privA,B,C,           */ \
-                  }
-
-
-U_CDECL_END
-
-
-
-#endif
diff --git a/Source/core/icu/unicode/utf.h b/Source/core/icu/unicode/utf.h
deleted file mode 100644
index f794799..0000000
--- a/Source/core/icu/unicode/utf.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 1999-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  utf.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999sep09
-*   created by: Markus W. Scherer
-*/
-
-/**
- * \file
- * \brief C API: Code point macros
- *
- * This file defines macros for checking whether a code point is
- * a surrogate or a non-character etc.
- *
- * The UChar and UChar32 data types for Unicode code units and code points
- * are defined in umachines.h because they can be machine-dependent.
- *
- * utf.h is included by utypes.h and itself includes utf8.h and utf16.h after some
- * common definitions. Those files define macros for efficiently getting code points
- * in and out of UTF-8/16 strings.
- * utf16.h macros have "U16_" prefixes.
- * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling.
- *
- * ICU processes 16-bit Unicode strings.
- * Most of the time, such strings are well-formed UTF-16.
- * Single, unpaired surrogates must be handled as well, and are treated in ICU
- * like regular code points where possible.
- * (Pairs of surrogate code points are indistinguishable from supplementary
- * code points encoded as pairs of supplementary code units.)
- *
- * In fact, almost all Unicode code points in normal text (>99%)
- * are on the BMP (<=U+ffff) and even <=U+d7ff.
- * ICU functions handle supplementary code points (U+10000..U+10ffff)
- * but are optimized for the much more frequently occurring BMP code points.
- *
- * utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then
- * UChar is defined to be exactly wchar_t, otherwise uint16_t.
- *
- * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit
- * Unicode code point (Unicode scalar value, 0..0x10ffff).
- * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as
- * the definition of UChar. For details see the documentation for UChar32 itself.
- *
- * utf.h also defines a small number of C macros for single Unicode code points.
- * These are simple checks for surrogates and non-characters.
- * For actual Unicode character properties see uchar.h.
- *
- * By default, string operations must be done with error checking in case
- * a string is not well-formed UTF-16.
- * The macros will detect if a surrogate code unit is unpaired
- * (lead unit without trail unit or vice versa) and just return the unit itself
- * as the code point.
- * (It is an accidental property of Unicode and UTF-16 that all
- * malformed sequences can be expressed unambiguously with a distinct subrange
- * of Unicode code points.)
- *
- * The regular "safe" macros require that the initial, passed-in string index
- * is within bounds. They only check the index when they read more than one
- * code unit. This is usually done with code similar to the following loop:
- * <pre>while(i<length) {
- *   U16_NEXT(s, i, length, c);
- *   // use c
- * }</pre>
- *
- * When it is safe to assume that text is well-formed UTF-16
- * (does not contain single, unpaired surrogates), then one can use
- * U16_..._UNSAFE macros.
- * These do not check for proper code unit sequences or truncated text and may
- * yield wrong results or even cause a crash if they are used with "malformed"
- * text.
- * In practice, U16_..._UNSAFE macros will produce slightly less code but
- * should not be faster because the processing is only different when a
- * surrogate code unit is detected, which will be rare.
- *
- * Similarly for UTF-8, there are "safe" macros without a suffix,
- * and U8_..._UNSAFE versions.
- * The performance differences are much larger here because UTF-8 provides so
- * many opportunities for malformed sequences.
- * The unsafe UTF-8 macros are entirely implemented inside the macro definitions
- * and are fast, while the safe UTF-8 macros call functions for all but the
- * trivial (ASCII) cases.
- * (ICU 3.6 optimizes U8_NEXT() and U8_APPEND() to handle most other common
- * characters inline as well.)
- *
- * Unlike with UTF-16, malformed sequences cannot be expressed with distinct
- * code point values (0..U+10ffff). They are indicated with negative values instead.
- *
- * For more information see the ICU User Guide Strings chapter
- * (http://icu-project.org/userguide/strings.html).
- *
- * <em>Usage:</em>
- * ICU coding guidelines for if() statements should be followed when using these macros.
- * Compound statements (curly braces {}) must be used  for if-else-while... 
- * bodies and all macro statements should be terminated with semicolon.
- *
- * @stable ICU 2.4
- */
-
-#ifndef __UTF_H__
-#define __UTF_H__
-
-#include "unicode/utypes.h"
-/* include the utfXX.h after the following definitions */
-
-/* single-code point definitions -------------------------------------------- */
-
-/**
- * This value is intended for sentinel values for APIs that
- * (take or) return single code points (UChar32).
- * It is outside of the Unicode code point range 0..0x10ffff.
- * 
- * For example, a "done" or "error" value in a new API
- * could be indicated with U_SENTINEL.
- *
- * ICU APIs designed before ICU 2.4 usually define service-specific "done"
- * values, mostly 0xffff.
- * Those may need to be distinguished from
- * actual U+ffff text contents by calling functions like
- * CharacterIterator::hasNext() or UnicodeString::length().
- *
- * @return -1
- * @see UChar32
- * @stable ICU 2.4
- */
-#define U_SENTINEL (-1)
-
-/**
- * Is this code point a Unicode noncharacter?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U_IS_UNICODE_NONCHAR(c) \
-    ((c)>=0xfdd0 && \
-     ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
-     (uint32_t)(c)<=0x10ffff)
-
-/**
- * Is c a Unicode code point value (0..U+10ffff)
- * that can be assigned a character?
- *
- * Code points that are not characters include:
- * - single surrogate code points (U+d800..U+dfff, 2048 code points)
- * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
- * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
- * - the highest Unicode code point value is U+10ffff
- *
- * This means that all code points below U+d800 are character code points,
- * and that boundary is tested first for performance.
- *
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U_IS_UNICODE_CHAR(c) \
-    ((uint32_t)(c)<0xd800 || \
-        ((uint32_t)(c)>0xdfff && \
-         (uint32_t)(c)<=0x10ffff && \
-         !U_IS_UNICODE_NONCHAR(c)))
-
-/**
- * Is this code point a BMP code point (U+0000..U+ffff)?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.8
- */
-#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
-
-/**
- * Is this code point a supplementary code point (U+10000..U+10ffff)?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.8
- */
-#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
- 
-/**
- * Is this code point a lead surrogate (U+d800..U+dbff)?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
-
-/**
- * Is this code point a trail surrogate (U+dc00..U+dfff)?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
-
-/**
- * Is this code point a surrogate (U+d800..U+dfff)?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
-
-/**
- * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
- * is it a lead surrogate?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
-
-/**
- * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
- * is it a trail surrogate?
- * @param c 32-bit code point
- * @return TRUE or FALSE
- * @stable ICU 4.2
- */
-#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
-
-/* include the utfXX.h ------------------------------------------------------ */
-
-#include "unicode/utf8.h"
-#include "unicode/utf16.h"
-
-/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
-#include "unicode/utf_old.h"
-
-#endif
diff --git a/Source/core/icu/unicode/utf16.h b/Source/core/icu/unicode/utf16.h
deleted file mode 100644
index 5079c11..0000000
--- a/Source/core/icu/unicode/utf16.h
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 1999-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  utf16.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999sep09
-*   created by: Markus W. Scherer
-*/
-
-/**
- * \file
- * \brief C API: 16-bit Unicode handling macros
- * 
- * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
- * utf16.h is included by utf.h after unicode/umachine.h
- * and some common definitions.
- *
- * For more information see utf.h and the ICU User Guide Strings chapter
- * (http://icu-project.org/userguide/strings.html).
- *
- * <em>Usage:</em>
- * ICU coding guidelines for if() statements should be followed when using these macros.
- * Compound statements (curly braces {}) must be used  for if-else-while... 
- * bodies and all macro statements should be terminated with semicolon.
- */
-
-#ifndef __UTF16_H__
-#define __UTF16_H__
-
-/* utf.h must be included first. */
-#ifndef __UTF_H__
-#   include "unicode/utf.h"
-#endif
-
-/* single-code point definitions -------------------------------------------- */
-
-/**
- * Does this code unit alone encode a code point (BMP, not a surrogate)?
- * @param c 16-bit code unit
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
-
-/**
- * Is this code unit a lead surrogate (U+d800..U+dbff)?
- * @param c 16-bit code unit
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
-
-/**
- * Is this code unit a trail surrogate (U+dc00..U+dfff)?
- * @param c 16-bit code unit
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
-
-/**
- * Is this code unit a surrogate (U+d800..U+dfff)?
- * @param c 16-bit code unit
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
-
-/**
- * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
- * is it a lead surrogate?
- * @param c 16-bit code unit
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
-
-/**
- * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
- * is it a trail surrogate?
- * @param c 16-bit code unit
- * @return TRUE or FALSE
- * @stable ICU 4.2
- */
-#define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
-
-/**
- * Helper constant for U16_GET_SUPPLEMENTARY.
- * @internal
- */
-#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
-
-/**
- * Get a supplementary code point value (U+10000..U+10ffff)
- * from its lead and trail surrogates.
- * The result is undefined if the input values are not
- * lead and trail surrogates.
- *
- * @param lead lead surrogate (U+d800..U+dbff)
- * @param trail trail surrogate (U+dc00..U+dfff)
- * @return supplementary code point (U+10000..U+10ffff)
- * @stable ICU 2.4
- */
-#define U16_GET_SUPPLEMENTARY(lead, trail) \
-    (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
-
-
-/**
- * Get the lead surrogate (0xd800..0xdbff) for a
- * supplementary code point (0x10000..0x10ffff).
- * @param supplementary 32-bit code point (U+10000..U+10ffff)
- * @return lead surrogate (U+d800..U+dbff) for supplementary
- * @stable ICU 2.4
- */
-#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
-
-/**
- * Get the trail surrogate (0xdc00..0xdfff) for a
- * supplementary code point (0x10000..0x10ffff).
- * @param supplementary 32-bit code point (U+10000..U+10ffff)
- * @return trail surrogate (U+dc00..U+dfff) for supplementary
- * @stable ICU 2.4
- */
-#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
-
-/**
- * How many 16-bit code units are used to encode this Unicode code point? (1 or 2)
- * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff).
- * @param c 32-bit code point
- * @return 1 or 2
- * @stable ICU 2.4
- */
-#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2)
-
-/**
- * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
- * @return 2
- * @stable ICU 2.4
- */
-#define U16_MAX_LENGTH 2
-
-/**
- * Get a code point from a string at a random-access offset,
- * without changing the offset.
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * The offset may point to either the lead or trail surrogate unit
- * for a supplementary code point, in which case the macro will read
- * the adjacent matching surrogate as well.
- * The result is undefined if the offset points to a single, unpaired surrogate.
- * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
- *
- * @param s const UChar * string
- * @param i string offset
- * @param c output UChar32 variable
- * @see U16_GET
- * @stable ICU 2.4
- */
-#define U16_GET_UNSAFE(s, i, c) { \
-    (c)=(s)[i]; \
-    if(U16_IS_SURROGATE(c)) { \
-        if(U16_IS_SURROGATE_LEAD(c)) { \
-            (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \
-        } else { \
-            (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
-        } \
-    } \
-}
-
-/**
- * Get a code point from a string at a random-access offset,
- * without changing the offset.
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * The offset may point to either the lead or trail surrogate unit
- * for a supplementary code point, in which case the macro will read
- * the adjacent matching surrogate as well.
- * If the offset points to a single, unpaired surrogate, then that itself
- * will be returned as the code point.
- * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<=i<length
- * @param length string length
- * @param c output UChar32 variable
- * @see U16_GET_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_GET(s, start, i, length, c) { \
-    (c)=(s)[i]; \
-    if(U16_IS_SURROGATE(c)) { \
-        uint16_t __c2; \
-        if(U16_IS_SURROGATE_LEAD(c)) { \
-            if((i)+1<(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
-                (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
-            } \
-        } else { \
-            if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
-                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
-            } \
-        } \
-    } \
-}
-
-/* definitions with forward iteration --------------------------------------- */
-
-/**
- * Get a code point from a string at a code point boundary offset,
- * and advance the offset to the next code point boundary.
- * (Post-incrementing forward iteration.)
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * The offset may point to the lead surrogate unit
- * for a supplementary code point, in which case the macro will read
- * the following trail surrogate as well.
- * If the offset points to a trail surrogate, then that itself
- * will be returned as the code point.
- * The result is undefined if the offset points to a single, unpaired lead surrogate.
- *
- * @param s const UChar * string
- * @param i string offset
- * @param c output UChar32 variable
- * @see U16_NEXT
- * @stable ICU 2.4
- */
-#define U16_NEXT_UNSAFE(s, i, c) { \
-    (c)=(s)[(i)++]; \
-    if(U16_IS_LEAD(c)) { \
-        (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
-    } \
-}
-
-/**
- * Get a code point from a string at a code point boundary offset,
- * and advance the offset to the next code point boundary.
- * (Post-incrementing forward iteration.)
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * The offset may point to the lead surrogate unit
- * for a supplementary code point, in which case the macro will read
- * the following trail surrogate as well.
- * If the offset points to a trail surrogate or
- * to a single, unpaired lead surrogate, then that itself
- * will be returned as the code point.
- *
- * @param s const UChar * string
- * @param i string offset, must be i<length
- * @param length string length
- * @param c output UChar32 variable
- * @see U16_NEXT_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_NEXT(s, i, length, c) { \
-    (c)=(s)[(i)++]; \
-    if(U16_IS_LEAD(c)) { \
-        uint16_t __c2; \
-        if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
-            ++(i); \
-            (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
-        } \
-    } \
-}
-
-/**
- * Append a code point to a string, overwriting 1 or 2 code units.
- * The offset points to the current end of the string contents
- * and is advanced (post-increment).
- * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
- * Otherwise, the result is undefined.
- *
- * @param s const UChar * string buffer
- * @param i string offset
- * @param c code point to append
- * @see U16_APPEND
- * @stable ICU 2.4
- */
-#define U16_APPEND_UNSAFE(s, i, c) { \
-    if((uint32_t)(c)<=0xffff) { \
-        (s)[(i)++]=(uint16_t)(c); \
-    } else { \
-        (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
-        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
-    } \
-}
-
-/**
- * Append a code point to a string, overwriting 1 or 2 code units.
- * The offset points to the current end of the string contents
- * and is advanced (post-increment).
- * "Safe" macro, checks for a valid code point.
- * If a surrogate pair is written, checks for sufficient space in the string.
- * If the code point is not valid or a trail surrogate does not fit,
- * then isError is set to TRUE.
- *
- * @param s const UChar * string buffer
- * @param i string offset, must be i<capacity
- * @param capacity size of the string buffer
- * @param c code point to append
- * @param isError output UBool set to TRUE if an error occurs, otherwise not modified
- * @see U16_APPEND_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_APPEND(s, i, capacity, c, isError) { \
-    if((uint32_t)(c)<=0xffff) { \
-        (s)[(i)++]=(uint16_t)(c); \
-    } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
-        (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
-        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
-    } else /* c>0x10ffff or not enough space */ { \
-        (isError)=TRUE; \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the next.
- * (Post-incrementing iteration.)
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * @param s const UChar * string
- * @param i string offset
- * @see U16_FWD_1
- * @stable ICU 2.4
- */
-#define U16_FWD_1_UNSAFE(s, i) { \
-    if(U16_IS_LEAD((s)[(i)++])) { \
-        ++(i); \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the next.
- * (Post-incrementing iteration.)
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * @param s const UChar * string
- * @param i string offset, must be i<length
- * @param length string length
- * @see U16_FWD_1_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_FWD_1(s, i, length) { \
-    if(U16_IS_LEAD((s)[(i)++]) && (i)<(length) && U16_IS_TRAIL((s)[i])) { \
-        ++(i); \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the n-th next one,
- * i.e., move forward by n code points.
- * (Post-incrementing iteration.)
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * @param s const UChar * string
- * @param i string offset
- * @param n number of code points to skip
- * @see U16_FWD_N
- * @stable ICU 2.4
- */
-#define U16_FWD_N_UNSAFE(s, i, n) { \
-    int32_t __N=(n); \
-    while(__N>0) { \
-        U16_FWD_1_UNSAFE(s, i); \
-        --__N; \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the n-th next one,
- * i.e., move forward by n code points.
- * (Post-incrementing iteration.)
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * @param s const UChar * string
- * @param i string offset, must be i<length
- * @param length string length
- * @param n number of code points to skip
- * @see U16_FWD_N_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_FWD_N(s, i, length, n) { \
-    int32_t __N=(n); \
-    while(__N>0 && (i)<(length)) { \
-        U16_FWD_1(s, i, length); \
-        --__N; \
-    } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary
- * at the start of a code point.
- * If the offset points to the trail surrogate of a surrogate pair,
- * then the offset is decremented.
- * Otherwise, it is not modified.
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * @param s const UChar * string
- * @param i string offset
- * @see U16_SET_CP_START
- * @stable ICU 2.4
- */
-#define U16_SET_CP_START_UNSAFE(s, i) { \
-    if(U16_IS_TRAIL((s)[i])) { \
-        --(i); \
-    } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary
- * at the start of a code point.
- * If the offset points to the trail surrogate of a surrogate pair,
- * then the offset is decremented.
- * Otherwise, it is not modified.
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<=i
- * @see U16_SET_CP_START_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_SET_CP_START(s, start, i) { \
-    if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
-        --(i); \
-    } \
-}
-
-/* definitions with backward iteration -------------------------------------- */
-
-/**
- * Move the string offset from one code point boundary to the previous one
- * and get the code point between them.
- * (Pre-decrementing backward iteration.)
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * The input offset may be the same as the string length.
- * If the offset is behind a trail surrogate unit
- * for a supplementary code point, then the macro will read
- * the preceding lead surrogate as well.
- * If the offset is behind a lead surrogate, then that itself
- * will be returned as the code point.
- * The result is undefined if the offset is behind a single, unpaired trail surrogate.
- *
- * @param s const UChar * string
- * @param i string offset
- * @param c output UChar32 variable
- * @see U16_PREV
- * @stable ICU 2.4
- */
-#define U16_PREV_UNSAFE(s, i, c) { \
-    (c)=(s)[--(i)]; \
-    if(U16_IS_TRAIL(c)) { \
-        (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the previous one
- * and get the code point between them.
- * (Pre-decrementing backward iteration.)
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * The input offset may be the same as the string length.
- * If the offset is behind a trail surrogate unit
- * for a supplementary code point, then the macro will read
- * the preceding lead surrogate as well.
- * If the offset is behind a lead surrogate or behind a single, unpaired
- * trail surrogate, then that itself
- * will be returned as the code point.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<i
- * @param c output UChar32 variable
- * @see U16_PREV_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_PREV(s, start, i, c) { \
-    (c)=(s)[--(i)]; \
-    if(U16_IS_TRAIL(c)) { \
-        uint16_t __c2; \
-        if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
-            --(i); \
-            (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
-        } \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the previous one.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * @param s const UChar * string
- * @param i string offset
- * @see U16_BACK_1
- * @stable ICU 2.4
- */
-#define U16_BACK_1_UNSAFE(s, i) { \
-    if(U16_IS_TRAIL((s)[--(i)])) { \
-        --(i); \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the previous one.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<i
- * @see U16_BACK_1_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_BACK_1(s, start, i) { \
-    if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
-        --(i); \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the n-th one before it,
- * i.e., move backward by n code points.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * @param s const UChar * string
- * @param i string offset
- * @param n number of code points to skip
- * @see U16_BACK_N
- * @stable ICU 2.4
- */
-#define U16_BACK_N_UNSAFE(s, i, n) { \
-    int32_t __N=(n); \
-    while(__N>0) { \
-        U16_BACK_1_UNSAFE(s, i); \
-        --__N; \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the n-th one before it,
- * i.e., move backward by n code points.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * @param s const UChar * string
- * @param start start of string
- * @param i string offset, must be start<i
- * @param n number of code points to skip
- * @see U16_BACK_N_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_BACK_N(s, start, i, n) { \
-    int32_t __N=(n); \
-    while(__N>0 && (i)>(start)) { \
-        U16_BACK_1(s, start, i); \
-        --__N; \
-    } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary after a code point.
- * If the offset is behind the lead surrogate of a surrogate pair,
- * then the offset is incremented.
- * Otherwise, it is not modified.
- * The input offset may be the same as the string length.
- * "Unsafe" macro, assumes well-formed UTF-16.
- *
- * @param s const UChar * string
- * @param i string offset
- * @see U16_SET_CP_LIMIT
- * @stable ICU 2.4
- */
-#define U16_SET_CP_LIMIT_UNSAFE(s, i) { \
-    if(U16_IS_LEAD((s)[(i)-1])) { \
-        ++(i); \
-    } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary after a code point.
- * If the offset is behind the lead surrogate of a surrogate pair,
- * then the offset is incremented.
- * Otherwise, it is not modified.
- * The input offset may be the same as the string length.
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, start<=i<=length
- * @param length string length
- * @see U16_SET_CP_LIMIT_UNSAFE
- * @stable ICU 2.4
- */
-#define U16_SET_CP_LIMIT(s, start, i, length) { \
-    if((start)<(i) && (i)<(length) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
-        ++(i); \
-    } \
-}
-
-#endif
diff --git a/Source/core/icu/unicode/utf8.h b/Source/core/icu/unicode/utf8.h
deleted file mode 100644
index 6405795..0000000
--- a/Source/core/icu/unicode/utf8.h
+++ /dev/null
@@ -1,683 +0,0 @@
-/*
-*******************************************************************************
-*
-*   Copyright (C) 1999-2009, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*
-*******************************************************************************
-*   file name:  utf8.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999sep13
-*   created by: Markus W. Scherer
-*/
-
-/**
- * \file
- * \brief C API: 8-bit Unicode handling macros
- * 
- * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
- * utf8.h is included by utf.h after unicode/umachine.h
- * and some common definitions.
- *
- * For more information see utf.h and the ICU User Guide Strings chapter
- * (http://icu-project.org/userguide/strings.html).
- *
- * <em>Usage:</em>
- * ICU coding guidelines for if() statements should be followed when using these macros.
- * Compound statements (curly braces {}) must be used  for if-else-while... 
- * bodies and all macro statements should be terminated with semicolon.
- */
-
-#ifndef __UTF8_H__
-#define __UTF8_H__
-
-/* utf.h must be included first. */
-#ifndef __UTF_H__
-#   include "unicode/utf.h"
-#endif
-
-/* internal definitions ----------------------------------------------------- */
-
-/**
- * \var utf8_countTrailBytes
- * Internal array with numbers of trail bytes for any given byte used in
- * lead byte position.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is called by public macros in this file and thus must remain stable,
- * and should not be hidden when other internal functions are hidden (otherwise
- * public macros would fail to compile).
- * @internal
- */
-#ifdef U_UTF8_IMPL
-U_EXPORT const uint8_t 
-#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION)
-U_CFUNC const uint8_t
-#else
-U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/ 
-#endif
-utf8_countTrailBytes[256];
-
-/**
- * Count the trail bytes for a UTF-8 lead byte.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is called by public macros in this file and thus must remain stable.
- * @internal
- */
-#define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte])
-
-/**
- * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is called by public macros in this file and thus must remain stable.
- * @internal
- */
-#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
-
-/**
- * Function for handling "next code point" with error-checking.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
- * file and thus must remain stable, and should not be hidden when other internal
- * functions are hidden (otherwise public macros would fail to compile).
- * @internal
- */
-U_STABLE UChar32 U_EXPORT2
-utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
-
-/**
- * Function for handling "append code point" with error-checking.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
- * file and thus must remain stable, and should not be hidden when other internal
- * functions are hidden (otherwise public macros would fail to compile).
- * @internal
- */
-U_STABLE int32_t U_EXPORT2
-utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
-
-/**
- * Function for handling "previous code point" with error-checking.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
- * file and thus must remain stable, and should not be hidden when other internal
- * functions are hidden (otherwise public macros would fail to compile).
- * @internal
- */
-U_STABLE UChar32 U_EXPORT2
-utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
-
-/**
- * Function for handling "skip backward one code point" with error-checking.
- *
- * This is internal since it is not meant to be called directly by external clients;
- * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
- * file and thus must remain stable, and should not be hidden when other internal
- * functions are hidden (otherwise public macros would fail to compile).
- * @internal
- */
-U_STABLE int32_t U_EXPORT2
-utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
-
-/* single-code point definitions -------------------------------------------- */
-
-/**
- * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)?
- * @param c 8-bit code unit (byte)
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U8_IS_SINGLE(c) (((c)&0x80)==0)
-
-/**
- * Is this code unit (byte) a UTF-8 lead byte?
- * @param c 8-bit code unit (byte)
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc0)<0x3e)
-
-/**
- * Is this code unit (byte) a UTF-8 trail byte?
- * @param c 8-bit code unit (byte)
- * @return TRUE or FALSE
- * @stable ICU 2.4
- */
-#define U8_IS_TRAIL(c) (((c)&0xc0)==0x80)
-
-/**
- * How many code units (bytes) are used for the UTF-8 encoding
- * of this Unicode code point?
- * @param c 32-bit code point
- * @return 1..4, or 0 if c is a surrogate or not a Unicode code point
- * @stable ICU 2.4
- */
-#define U8_LENGTH(c) \
-    ((uint32_t)(c)<=0x7f ? 1 : \
-        ((uint32_t)(c)<=0x7ff ? 2 : \
-            ((uint32_t)(c)<=0xd7ff ? 3 : \
-                ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \
-                    ((uint32_t)(c)<=0xffff ? 3 : 4)\
-                ) \
-            ) \
-        ) \
-    )
-
-/**
- * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff).
- * @return 4
- * @stable ICU 2.4
- */
-#define U8_MAX_LENGTH 4
-
-/**
- * Get a code point from a string at a random-access offset,
- * without changing the offset.
- * The offset may point to either the lead byte or one of the trail bytes
- * for a code point, in which case the macro will read all of the bytes
- * for the code point.
- * The result is undefined if the offset points to an illegal UTF-8
- * byte sequence.
- * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @param c output UChar32 variable
- * @see U8_GET
- * @stable ICU 2.4
- */
-#define U8_GET_UNSAFE(s, i, c) { \
-    int32_t _u8_get_unsafe_index=(int32_t)(i); \
-    U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
-    U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
-}
-
-/**
- * Get a code point from a string at a random-access offset,
- * without changing the offset.
- * The offset may point to either the lead byte or one of the trail bytes
- * for a code point, in which case the macro will read all of the bytes
- * for the code point.
- * If the offset points to an illegal UTF-8 byte sequence, then
- * c is set to a negative value.
- * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
- *
- * @param s const uint8_t * string
- * @param start starting string offset
- * @param i string offset, must be start<=i<length
- * @param length string length
- * @param c output UChar32 variable, set to <0 in case of an error
- * @see U8_GET_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_GET(s, start, i, length, c) { \
-    int32_t _u8_get_index=(int32_t)(i); \
-    U8_SET_CP_START(s, start, _u8_get_index); \
-    U8_NEXT(s, _u8_get_index, length, c); \
-}
-
-/* definitions with forward iteration --------------------------------------- */
-
-/**
- * Get a code point from a string at a code point boundary offset,
- * and advance the offset to the next code point boundary.
- * (Post-incrementing forward iteration.)
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * The offset may point to the lead byte of a multi-byte sequence,
- * in which case the macro will read the whole sequence.
- * The result is undefined if the offset points to a trail byte
- * or an illegal UTF-8 sequence.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @param c output UChar32 variable
- * @see U8_NEXT
- * @stable ICU 2.4
- */
-#define U8_NEXT_UNSAFE(s, i, c) { \
-    (c)=(uint8_t)(s)[(i)++]; \
-    if((uint8_t)((c)-0xc0)<0x35) { \
-        uint8_t __count=U8_COUNT_TRAIL_BYTES(c); \
-        U8_MASK_LEAD_BYTE(c, __count); \
-        switch(__count) { \
-        /* each following branch falls through to the next one */ \
-        case 3: \
-            (c)=((c)<<6)|((s)[(i)++]&0x3f); \
-        case 2: \
-            (c)=((c)<<6)|((s)[(i)++]&0x3f); \
-        case 1: \
-            (c)=((c)<<6)|((s)[(i)++]&0x3f); \
-        /* no other branches to optimize switch() */ \
-            break; \
-        } \
-    } \
-}
-
-/**
- * Get a code point from a string at a code point boundary offset,
- * and advance the offset to the next code point boundary.
- * (Post-incrementing forward iteration.)
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * The offset may point to the lead byte of a multi-byte sequence,
- * in which case the macro will read the whole sequence.
- * If the offset points to a trail byte or an illegal UTF-8 sequence, then
- * c is set to a negative value.
- *
- * @param s const uint8_t * string
- * @param i string offset, must be i<length
- * @param length string length
- * @param c output UChar32 variable, set to <0 in case of an error
- * @see U8_NEXT_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_NEXT(s, i, length, c) { \
-    (c)=(uint8_t)(s)[(i)++]; \
-    if((c)>=0x80) { \
-        uint8_t __t1, __t2; \
-        if( /* handle U+1000..U+CFFF inline */ \
-            (0xe0<(c) && (c)<=0xec) && \
-            (((i)+1)<(length)) && \
-            (__t1=(uint8_t)((s)[i]-0x80))<=0x3f && \
-            (__t2=(uint8_t)((s)[(i)+1]-0x80))<= 0x3f \
-        ) { \
-            /* no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ \
-            (c)=(UChar)(((c)<<12)|(__t1<<6)|__t2); \
-            (i)+=2; \
-        } else if( /* handle U+0080..U+07FF inline */ \
-            ((c)<0xe0 && (c)>=0xc2) && \
-            ((i)<(length)) && \
-            (__t1=(uint8_t)((s)[i]-0x80))<=0x3f \
-        ) { \
-            (c)=(UChar)((((c)&0x1f)<<6)|__t1); \
-            ++(i); \
-        } else if(U8_IS_LEAD(c)) { \
-            /* function call for "complicated" and error cases */ \
-            (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (int32_t)(length), c, -1); \
-        } else { \
-            (c)=U_SENTINEL; \
-        } \
-    } \
-}
-
-/**
- * Append a code point to a string, overwriting 1 to 4 bytes.
- * The offset points to the current end of the string contents
- * and is advanced (post-increment).
- * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
- * Otherwise, the result is undefined.
- *
- * @param s const uint8_t * string buffer
- * @param i string offset
- * @param c code point to append
- * @see U8_APPEND
- * @stable ICU 2.4
- */
-#define U8_APPEND_UNSAFE(s, i, c) { \
-    if((uint32_t)(c)<=0x7f) { \
-        (s)[(i)++]=(uint8_t)(c); \
-    } else { \
-        if((uint32_t)(c)<=0x7ff) { \
-            (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
-        } else { \
-            if((uint32_t)(c)<=0xffff) { \
-                (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
-            } else { \
-                (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \
-                (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \
-            } \
-            (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
-        } \
-        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
-    } \
-}
-
-/**
- * Append a code point to a string, overwriting 1 to 4 bytes.
- * The offset points to the current end of the string contents
- * and is advanced (post-increment).
- * "Safe" macro, checks for a valid code point.
- * If a non-ASCII code point is written, checks for sufficient space in the string.
- * If the code point is not valid or trail bytes do not fit,
- * then isError is set to TRUE.
- *
- * @param s const uint8_t * string buffer
- * @param i string offset, must be i<capacity
- * @param capacity size of the string buffer
- * @param c code point to append
- * @param isError output UBool set to TRUE if an error occurs, otherwise not modified
- * @see U8_APPEND_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_APPEND(s, i, capacity, c, isError) { \
-    if((uint32_t)(c)<=0x7f) { \
-        (s)[(i)++]=(uint8_t)(c); \
-    } else if((uint32_t)(c)<=0x7ff && (i)+1<(capacity)) { \
-        (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
-        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
-    } else if((uint32_t)(c)<=0xd7ff && (i)+2<(capacity)) { \
-        (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
-        (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
-        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
-    } else { \
-        (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(capacity), c, &(isError)); \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the next.
- * (Post-incrementing iteration.)
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @see U8_FWD_1
- * @stable ICU 2.4
- */
-#define U8_FWD_1_UNSAFE(s, i) { \
-    (i)+=1+U8_COUNT_TRAIL_BYTES((s)[i]); \
-}
-
-/**
- * Advance the string offset from one code point boundary to the next.
- * (Post-incrementing iteration.)
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * @param s const uint8_t * string
- * @param i string offset, must be i<length
- * @param length string length
- * @see U8_FWD_1_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_FWD_1(s, i, length) { \
-    uint8_t __b=(uint8_t)(s)[(i)++]; \
-    if(U8_IS_LEAD(__b)) { \
-        uint8_t __count=U8_COUNT_TRAIL_BYTES(__b); \
-        if((i)+__count>(length)) { \
-            __count=(uint8_t)((length)-(i)); \
-        } \
-        while(__count>0 && U8_IS_TRAIL((s)[i])) { \
-            ++(i); \
-            --__count; \
-        } \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the n-th next one,
- * i.e., move forward by n code points.
- * (Post-incrementing iteration.)
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @param n number of code points to skip
- * @see U8_FWD_N
- * @stable ICU 2.4
- */
-#define U8_FWD_N_UNSAFE(s, i, n) { \
-    int32_t __N=(n); \
-    while(__N>0) { \
-        U8_FWD_1_UNSAFE(s, i); \
-        --__N; \
-    } \
-}
-
-/**
- * Advance the string offset from one code point boundary to the n-th next one,
- * i.e., move forward by n code points.
- * (Post-incrementing iteration.)
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * @param s const uint8_t * string
- * @param i string offset, must be i<length
- * @param length string length
- * @param n number of code points to skip
- * @see U8_FWD_N_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_FWD_N(s, i, length, n) { \
-    int32_t __N=(n); \
-    while(__N>0 && (i)<(length)) { \
-        U8_FWD_1(s, i, length); \
-        --__N; \
-    } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary
- * at the start of a code point.
- * If the offset points to a UTF-8 trail byte,
- * then the offset is moved backward to the corresponding lead byte.
- * Otherwise, it is not modified.
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @see U8_SET_CP_START
- * @stable ICU 2.4
- */
-#define U8_SET_CP_START_UNSAFE(s, i) { \
-    while(U8_IS_TRAIL((s)[i])) { --(i); } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary
- * at the start of a code point.
- * If the offset points to a UTF-8 trail byte,
- * then the offset is moved backward to the corresponding lead byte.
- * Otherwise, it is not modified.
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * @param s const uint8_t * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<=i
- * @see U8_SET_CP_START_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_SET_CP_START(s, start, i) { \
-    if(U8_IS_TRAIL((s)[(i)])) { \
-        (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \
-    } \
-}
-
-/* definitions with backward iteration -------------------------------------- */
-
-/**
- * Move the string offset from one code point boundary to the previous one
- * and get the code point between them.
- * (Pre-decrementing backward iteration.)
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * The input offset may be the same as the string length.
- * If the offset is behind a multi-byte sequence, then the macro will read
- * the whole sequence.
- * If the offset is behind a lead byte, then that itself
- * will be returned as the code point.
- * The result is undefined if the offset is behind an illegal UTF-8 sequence.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @param c output UChar32 variable
- * @see U8_PREV
- * @stable ICU 2.4
- */
-#define U8_PREV_UNSAFE(s, i, c) { \
-    (c)=(uint8_t)(s)[--(i)]; \
-    if(U8_IS_TRAIL(c)) { \
-        uint8_t __b, __count=1, __shift=6; \
-\
-        /* c is a trail byte */ \
-        (c)&=0x3f; \
-        for(;;) { \
-            __b=(uint8_t)(s)[--(i)]; \
-            if(__b>=0xc0) { \
-                U8_MASK_LEAD_BYTE(__b, __count); \
-                (c)|=(UChar32)__b<<__shift; \
-                break; \
-            } else { \
-                (c)|=(UChar32)(__b&0x3f)<<__shift; \
-                ++__count; \
-                __shift+=6; \
-            } \
-        } \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the previous one
- * and get the code point between them.
- * (Pre-decrementing backward iteration.)
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * The input offset may be the same as the string length.
- * If the offset is behind a multi-byte sequence, then the macro will read
- * the whole sequence.
- * If the offset is behind a lead byte, then that itself
- * will be returned as the code point.
- * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.
- *
- * @param s const uint8_t * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<i
- * @param c output UChar32 variable, set to <0 in case of an error
- * @see U8_PREV_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_PREV(s, start, i, c) { \
-    (c)=(uint8_t)(s)[--(i)]; \
-    if((c)>=0x80) { \
-        if((c)<=0xbf) { \
-            (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \
-        } else { \
-            (c)=U_SENTINEL; \
-        } \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the previous one.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @see U8_BACK_1
- * @stable ICU 2.4
- */
-#define U8_BACK_1_UNSAFE(s, i) { \
-    while(U8_IS_TRAIL((s)[--(i)])) {} \
-}
-
-/**
- * Move the string offset from one code point boundary to the previous one.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * @param s const uint8_t * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<i
- * @see U8_BACK_1_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_BACK_1(s, start, i) { \
-    if(U8_IS_TRAIL((s)[--(i)])) { \
-        (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the n-th one before it,
- * i.e., move backward by n code points.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @param n number of code points to skip
- * @see U8_BACK_N
- * @stable ICU 2.4
- */
-#define U8_BACK_N_UNSAFE(s, i, n) { \
-    int32_t __N=(n); \
-    while(__N>0) { \
-        U8_BACK_1_UNSAFE(s, i); \
-        --__N; \
-    } \
-}
-
-/**
- * Move the string offset from one code point boundary to the n-th one before it,
- * i.e., move backward by n code points.
- * (Pre-decrementing backward iteration.)
- * The input offset may be the same as the string length.
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * @param s const uint8_t * string
- * @param start index of the start of the string
- * @param i string offset, must be start<i
- * @param n number of code points to skip
- * @see U8_BACK_N_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_BACK_N(s, start, i, n) { \
-    int32_t __N=(n); \
-    while(__N>0 && (i)>(start)) { \
-        U8_BACK_1(s, start, i); \
-        --__N; \
-    } \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary after a code point.
- * If the offset is behind a partial multi-byte sequence,
- * then the offset is incremented to behind the whole sequence.
- * Otherwise, it is not modified.
- * The input offset may be the same as the string length.
- * "Unsafe" macro, assumes well-formed UTF-8.
- *
- * @param s const uint8_t * string
- * @param i string offset
- * @see U8_SET_CP_LIMIT
- * @stable ICU 2.4
- */
-#define U8_SET_CP_LIMIT_UNSAFE(s, i) { \
-    U8_BACK_1_UNSAFE(s, i); \
-    U8_FWD_1_UNSAFE(s, i); \
-}
-
-/**
- * Adjust a random-access offset to a code point boundary after a code point.
- * If the offset is behind a partial multi-byte sequence,
- * then the offset is incremented to behind the whole sequence.
- * Otherwise, it is not modified.
- * The input offset may be the same as the string length.
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- *
- * @param s const uint8_t * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<=i<=length
- * @param length string length
- * @see U8_SET_CP_LIMIT_UNSAFE
- * @stable ICU 2.4
- */
-#define U8_SET_CP_LIMIT(s, start, i, length) { \
-    if((start)<(i) && (i)<(length)) { \
-        U8_BACK_1(s, start, i); \
-        U8_FWD_1(s, i, length); \
-    } \
-}
-
-#endif
diff --git a/Source/core/icu/unicode/utf_old.h b/Source/core/icu/unicode/utf_old.h
deleted file mode 100644
index 8504a03..0000000
--- a/Source/core/icu/unicode/utf_old.h
+++ /dev/null
@@ -1 +0,0 @@
-/* This file is intentionally left blank. */
diff --git a/Source/core/icu/unicode/utypes.h b/Source/core/icu/unicode/utypes.h
deleted file mode 100644
index 00bf14c..0000000
--- a/Source/core/icu/unicode/utypes.h
+++ /dev/null
@@ -1,865 +0,0 @@
-/*
-**********************************************************************
-*   Copyright (C) 1996-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-**********************************************************************
-*
-*  FILE NAME : UTYPES.H (formerly ptypes.h)
-*
-*   Date        Name        Description
-*   12/11/96    helena      Creation.
-*   02/27/97    aliu        Added typedefs for UClassID, int8, int16, int32,
-*                           uint8, uint16, and uint32.
-*   04/01/97    aliu        Added XP_CPLUSPLUS and modified to work under C as
-*                            well as C++.
-*                           Modified to use memcpy() for uprv_arrayCopy() fns.
-*   04/14/97    aliu        Added TPlatformUtilities.
-*   05/07/97    aliu        Added import/export specifiers (replacing the old
-*                           broken EXT_CLASS).  Added version number for our
-*                           code.  Cleaned up header.
-*    6/20/97    helena      Java class name change.
-*   08/11/98    stephen     UErrorCode changed from typedef to enum
-*   08/12/98    erm         Changed T_ANALYTIC_PACKAGE_VERSION to 3
-*   08/14/98    stephen     Added uprv_arrayCopy() for int8_t, int16_t, int32_t
-*   12/09/98    jfitz       Added BUFFER_OVERFLOW_ERROR (bug 1100066)
-*   04/20/99    stephen     Cleaned up & reworked for autoconf.
-*                           Renamed to utypes.h.
-*   05/05/99    stephen     Changed to use <inttypes.h>
-*   12/07/99    helena      Moved copyright notice string from ucnv_bld.h here.
-*******************************************************************************
-*/
-
-#ifndef UTYPES_H
-#define UTYPES_H
-
-
-#include "unicode/umachine.h"
-#include "unicode/utf.h"
-#include "unicode/uversion.h"
-#include "unicode/uconfig.h"
-
-/*!
- * \file
- * \brief Basic definitions for ICU, for both C and C++ APIs
- *
- * This file defines basic types, constants, and enumerations directly or
- * indirectly by including other header files, especially utf.h for the
- * basic character and string definitions and umachine.h for consistent
- * integer and other types.
- */
-
-
-/**
- * \def U_SHOW_CPLUSPLUS_API
- * @internal
- */
-#ifdef XP_CPLUSPLUS
-#   ifndef U_SHOW_CPLUSPLUS_API
-#       define U_SHOW_CPLUSPLUS_API 1
-#   endif
-#else
-#   undef U_SHOW_CPLUSPLUS_API
-#   define U_SHOW_CPLUSPLUS_API 0
-#endif
-
-/** @{ API visibility control */
-
-/**
- * \def U_HIDE_DRAFT_API
- * Define this to 1 to request that draft API be "hidden"
- */
-#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API)
-#define U_HIDE_DRAFT_API 1
-#endif
-#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API)
-#define U_HIDE_INTERNAL_API 1
-#endif
-
-#ifdef U_HIDE_DRAFT_API
-#include "unicode/udraft.h"
-#endif
-
-#ifdef U_HIDE_DEPRECATED_API
-#include "unicode/udeprctd.h"
-#endif
-
-#ifdef U_HIDE_DEPRECATED_API
-#include "unicode/uobslete.h"
-#endif
-
-#ifdef U_HIDE_INTERNAL_API
-#include "unicode/uintrnal.h"
-#endif
-
-#ifdef U_HIDE_SYSTEM_API
-#include "unicode/usystem.h"
-#endif
-
-/** @} */
-
-
-/*===========================================================================*/
-/* char Character set family                                                 */
-/*===========================================================================*/
-
-/**
- * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
- * @stable ICU 2.0
- */
-#define U_ASCII_FAMILY 0
-
-/**
- * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
- * @stable ICU 2.0
- */
-#define U_EBCDIC_FAMILY 1
-
-/**
- * \def U_CHARSET_FAMILY
- *
- * <p>These definitions allow to specify the encoding of text
- * in the char data type as defined by the platform and the compiler.
- * It is enough to determine the code point values of "invariant characters",
- * which are the ones shared by all encodings that are in use
- * on a given platform.</p>
- *
- * <p>Those "invariant characters" should be all the uppercase and lowercase
- * latin letters, the digits, the space, and "basic punctuation".
- * Also, '\\n', '\\r', '\\t' should be available.</p>
- *
- * <p>The list of "invariant characters" is:<br>
- * \code
- *    A-Z  a-z  0-9  SPACE  "  %  &amp;  '  (  )  *  +  ,  -  .  /  :  ;  <  =  >  ?  _
- * \endcode
- * <br>
- * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
- *
- * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
- *
- * <p>In other words, all the graphic characters in 7-bit ASCII should
- * be safely accessible except the following:</p>
- *
- * \code
- *    '\' <backslash>
- *    '[' <left bracket>
- *    ']' <right bracket>
- *    '{' <left brace>
- *    '}' <right brace>
- *    '^' <circumflex>
- *    '~' <tilde>
- *    '!' <exclamation mark>
- *    '#' <number sign>
- *    '|' <vertical line>
- *    '$' <dollar sign>
- *    '@' <commercial at>
- *    '`' <grave accent>
- * \endcode
- * @stable ICU 2.0
- */
-
-#ifndef U_CHARSET_FAMILY
-#   define U_CHARSET_FAMILY 0
-#endif
-
-/**
- * \def U_CHARSET_IS_UTF8
- *
- * Hardcode the default charset to UTF-8.
- *
- * If this is set to 1, then
- * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
- *   contain UTF-8 text, regardless of what the system API uses
- * - some ICU code will use fast functions like u_strFromUTF8()
- *   rather than the more general and more heavy-weight conversion API (ucnv.h)
- * - ucnv_getDefaultName() always returns "UTF-8"
- * - ucnv_setDefaultName() is disabled and will not change the default charset
- * - static builds of ICU are smaller
- * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
- *   configuration option (see unicode/uconfig.h)
- * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
- *
- * @stable ICU 4.2
- * @see UCONFIG_NO_CONVERSION
- */
-#ifndef U_CHARSET_IS_UTF8
-#   define U_CHARSET_IS_UTF8 0
-#endif
-
-/*===========================================================================*/
-/* ICUDATA naming scheme                                                     */
-/*===========================================================================*/
-
-/**
- * \def U_ICUDATA_TYPE_LETTER
- *
- * This is a platform-dependent string containing one letter:
- * - b for big-endian, ASCII-family platforms
- * - l for little-endian, ASCII-family platforms
- * - e for big-endian, EBCDIC-family platforms
- * This letter is part of the common data file name.
- * @stable ICU 2.0
- */
-
-/**
- * \def U_ICUDATA_TYPE_LITLETTER
- * The non-string form of U_ICUDATA_TYPE_LETTER
- * @stable ICU 2.0
- */
-#if U_CHARSET_FAMILY
-#   if U_IS_BIG_ENDIAN
-   /* EBCDIC - should always be BE */
-#     define U_ICUDATA_TYPE_LETTER "e"
-#     define U_ICUDATA_TYPE_LITLETTER e
-#   else
-#     error "Don't know what to do with little endian EBCDIC!"
-#     define U_ICUDATA_TYPE_LETTER "x"
-#     define U_ICUDATA_TYPE_LITLETTER x
-#   endif
-#else
-#   if U_IS_BIG_ENDIAN
-      /* Big-endian ASCII */
-#     define U_ICUDATA_TYPE_LETTER "b"
-#     define U_ICUDATA_TYPE_LITLETTER b
-#   else
-      /* Little-endian ASCII */
-#     define U_ICUDATA_TYPE_LETTER "l"
-#     define U_ICUDATA_TYPE_LITLETTER l
-#   endif
-#endif
-
-/**
- * A single string literal containing the icudata stub name. i.e. 'icudt18e' for
- * ICU 1.8.x on EBCDIC, etc..
- * @stable ICU 2.0
- */
-#define U_ICUDATA_NAME    "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER  /**< @internal */
-#define U_USRDATA_NAME    "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER  /**< @internal */
-#define U_USE_USRDATA     0  /**< @internal */
-
-/**
- *  U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library.
- *    Defined as a literal, not a string.
- *    Tricky Preprocessor use - ## operator replaces macro paramters with the literal string
- *                              from the corresponding macro invocation, _before_ other macro substitutions.
- *                              Need a nested \#defines to get the actual version numbers rather than
- *                              the literal text U_ICU_VERSION_MAJOR_NUM into the name.
- *                              The net result will be something of the form
- *                                  \#define U_ICU_ENTRY_POINT icudt19_dat
- * @stable ICU 2.4
- */
-#define U_ICUDATA_ENTRY_POINT  U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM)
-
-/**
- * Do not use.
- * @internal
- */
-#define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor)
-/**
- * Do not use.
- * @internal
- */
-#ifndef U_DEF_ICUDATA_ENTRY_POINT
-/* affected by symbol renaming. See platform.h */
-#define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat
-#endif
-
-/**
- * \def U_CALLCONV
- * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
- * in callback function typedefs to make sure that the calling convention
- * is compatible.
- *
- * This is only used for non-ICU-API functions.
- * When a function is a public ICU API,
- * you must use the U_CAPI and U_EXPORT2 qualifiers.
- * @stable ICU 2.0
- */
-#if defined(OS390) && defined(XP_CPLUSPLUS)
-#    define U_CALLCONV __cdecl
-#else
-#    define U_CALLCONV U_EXPORT2
-#endif
-
-/**
- * \def NULL
- * Define NULL if necessary, to 0 for C++ and to ((void *)0) for C.
- * @stable ICU 2.0
- */
-#ifndef NULL
-#ifdef XP_CPLUSPLUS
-#define NULL    0
-#else
-#define NULL    ((void *)0)
-#endif
-#endif
-
-/*===========================================================================*/
-/* Calendar/TimeZone data types                                              */
-/*===========================================================================*/
-
-/**
- * Date and Time data type.
- * This is a primitive data type that holds the date and time
- * as the number of milliseconds since 1970-jan-01, 00:00 UTC.
- * UTC leap seconds are ignored.
- * @stable ICU 2.0
- */
-typedef double UDate;
-
-/** The number of milliseconds per second @stable ICU 2.0 */
-#define U_MILLIS_PER_SECOND        (1000)
-/** The number of milliseconds per minute @stable ICU 2.0 */
-#define U_MILLIS_PER_MINUTE       (60000)
-/** The number of milliseconds per hour @stable ICU 2.0 */
-#define U_MILLIS_PER_HOUR       (3600000)
-/** The number of milliseconds per day @stable ICU 2.0 */
-#define U_MILLIS_PER_DAY       (86400000)
-
-
-/*===========================================================================*/
-/* UClassID-based RTTI */
-/*===========================================================================*/
-
-/**
- * UClassID is used to identify classes without using RTTI, since RTTI
- * is not yet supported by all C++ compilers.  Each class hierarchy which needs
- * to implement polymorphic clone() or operator==() defines two methods,
- * described in detail below.  UClassID values can be compared using
- * operator==(). Nothing else should be done with them.
- *
- * \par
- * getDynamicClassID() is declared in the base class of the hierarchy as
- * a pure virtual.  Each concrete subclass implements it in the same way:
- *
- * \code
- *      class Base {
- *      public:
- *          virtual UClassID getDynamicClassID() const = 0;
- *      }
- *
- *      class Derived {
- *      public:
- *          virtual UClassID getDynamicClassID() const
- *            { return Derived::getStaticClassID(); }
- *      }
- * \endcode
- *
- * Each concrete class implements getStaticClassID() as well, which allows
- * clients to test for a specific type.
- *
- * \code
- *      class Derived {
- *      public:
- *          static UClassID U_EXPORT2 getStaticClassID();
- *      private:
- *          static char fgClassID;
- *      }
- *
- *      // In Derived.cpp:
- *      UClassID Derived::getStaticClassID()
- *        { return (UClassID)&Derived::fgClassID; }
- *      char Derived::fgClassID = 0; // Value is irrelevant
- * \endcode
- * @stable ICU 2.0
- */
-typedef void* UClassID;
-
-/*===========================================================================*/
-/* Shared library/DLL import-export API control                              */
-/*===========================================================================*/
-
-/*
- * Control of symbol import/export.
- * ICU is separated into three libraries.
- */
-
-/*
- * \def U_COMBINED_IMPLEMENTATION
- * Set to export library symbols from inside the ICU library
- * when all of ICU is in a single library.
- * This can be set as a compiler option while building ICU, and it
- * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc.
- * @stable ICU 2.0
- */
-
-/**
- * \def U_DATA_API
- * Set to export library symbols from inside the stubdata library,
- * and to import them from outside.
- * @stable ICU 3.0
- */
-
-/**
- * \def U_COMMON_API
- * Set to export library symbols from inside the common library,
- * and to import them from outside.
- * @stable ICU 2.0
- */
-
-/**
- * \def U_I18N_API
- * Set to export library symbols from inside the i18n library,
- * and to import them from outside.
- * @stable ICU 2.0
- */
-
-/**
- * \def U_LAYOUT_API
- * Set to export library symbols from inside the layout engine library,
- * and to import them from outside.
- * @stable ICU 2.0
- */
-
-/**
- * \def U_LAYOUTEX_API
- * Set to export library symbols from inside the layout extensions library,
- * and to import them from outside.
- * @stable ICU 2.6
- */
-
-/**
- * \def U_IO_API
- * Set to export library symbols from inside the ustdio library,
- * and to import them from outside.
- * @stable ICU 2.0
- */
-
-/**
- * \def U_TOOLUTIL_API
- * Set to export library symbols from inside the toolutil library,
- * and to import them from outside.
- * @stable ICU 3.4
- */
-
-#if defined(U_COMBINED_IMPLEMENTATION)
-#define U_DATA_API     U_EXPORT
-#define U_COMMON_API   U_EXPORT
-#define U_I18N_API     U_EXPORT
-#define U_LAYOUT_API   U_EXPORT
-#define U_LAYOUTEX_API U_EXPORT
-#define U_IO_API       U_EXPORT
-#define U_TOOLUTIL_API U_EXPORT
-#elif defined(U_STATIC_IMPLEMENTATION)
-#define U_DATA_API
-#define U_COMMON_API
-#define U_I18N_API
-#define U_LAYOUT_API
-#define U_LAYOUTEX_API
-#define U_IO_API
-#define U_TOOLUTIL_API
-#elif defined(U_COMMON_IMPLEMENTATION)
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_EXPORT
-#define U_I18N_API     U_IMPORT
-#define U_LAYOUT_API   U_IMPORT
-#define U_LAYOUTEX_API U_IMPORT
-#define U_IO_API       U_IMPORT
-#define U_TOOLUTIL_API U_IMPORT
-#elif defined(U_I18N_IMPLEMENTATION)
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_IMPORT
-#define U_I18N_API     U_EXPORT
-#define U_LAYOUT_API   U_IMPORT
-#define U_LAYOUTEX_API U_IMPORT
-#define U_IO_API       U_IMPORT
-#define U_TOOLUTIL_API U_IMPORT
-#elif defined(U_LAYOUT_IMPLEMENTATION)
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_IMPORT
-#define U_I18N_API     U_IMPORT
-#define U_LAYOUT_API   U_EXPORT
-#define U_LAYOUTEX_API U_IMPORT
-#define U_IO_API       U_IMPORT
-#define U_TOOLUTIL_API U_IMPORT
-#elif defined(U_LAYOUTEX_IMPLEMENTATION)
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_IMPORT
-#define U_I18N_API     U_IMPORT
-#define U_LAYOUT_API   U_IMPORT
-#define U_LAYOUTEX_API U_EXPORT
-#define U_IO_API       U_IMPORT
-#define U_TOOLUTIL_API U_IMPORT
-#elif defined(U_IO_IMPLEMENTATION)
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_IMPORT
-#define U_I18N_API     U_IMPORT
-#define U_LAYOUT_API   U_IMPORT
-#define U_LAYOUTEX_API U_IMPORT
-#define U_IO_API       U_EXPORT
-#define U_TOOLUTIL_API U_IMPORT
-#elif defined(U_TOOLUTIL_IMPLEMENTATION)
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_IMPORT
-#define U_I18N_API     U_IMPORT
-#define U_LAYOUT_API   U_IMPORT
-#define U_LAYOUTEX_API U_IMPORT
-#define U_IO_API       U_IMPORT
-#define U_TOOLUTIL_API U_EXPORT
-#else
-#define U_DATA_API     U_IMPORT
-#define U_COMMON_API   U_IMPORT
-#define U_I18N_API     U_IMPORT
-#define U_LAYOUT_API   U_IMPORT
-#define U_LAYOUTEX_API U_IMPORT
-#define U_IO_API       U_IMPORT
-#define U_TOOLUTIL_API U_IMPORT
-#endif
-
-/**
- * \def U_STANDARD_CPP_NAMESPACE
- * Control of C++ Namespace
- * @stable ICU 2.0
- */
-#ifdef __cplusplus
-#define U_STANDARD_CPP_NAMESPACE        ::
-#else
-#define U_STANDARD_CPP_NAMESPACE
-#endif
-
-
-/*===========================================================================*/
-/* Global delete operator                                                    */
-/*===========================================================================*/
-
-/*
- * The ICU4C library must not use the global new and delete operators.
- * These operators here are defined to enable testing for this.
- * See Jitterbug 2581 for details of why this is necessary.
- *
- * Verification that ICU4C's memory usage is correct, i.e.,
- * that global new/delete are not used:
- *
- * a) Check for imports of global new/delete (see uobject.cpp for details)
- * b) Verify that new is never imported.
- * c) Verify that delete is only imported from object code for interface/mixin classes.
- * d) Add global delete and delete[] only for the ICU4C library itself
- *    and define them in a way that crashes or otherwise easily shows a problem.
- *
- * The following implements d).
- * The operator implementations crash; this is intentional and used for library debugging.
- *
- * Note: This is currently only done on Windows because
- * some Linux/Unix compilers have problems with defining global new/delete.
- * On Windows, U_WINDOWS is defined, and it is _MSC_VER>=1200 for MSVC 6.0 and higher.
- */
-#if defined(XP_CPLUSPLUS) && defined(WIN32) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION))
-
-#ifndef U_HIDE_INTERNAL_API
-/**
- * Global operator new, defined only inside ICU4C, must not be used.
- * Crashes intentionally.
- * @internal
- */
-inline void *
-operator new(size_t /*size*/) {
-    char *q=NULL;
-    *q=5; /* break it */
-    return q;
-}
-
-#ifdef _Ret_bytecap_
-/* This is only needed to suppress a Visual C++ 2008 warning for operator new[]. */
-_Ret_bytecap_(_Size)
-#endif
-/**
- * Global operator new[], defined only inside ICU4C, must not be used.
- * Crashes intentionally.
- * @internal
- */
-inline void *
-operator new[](size_t /*size*/) {
-    char *q=NULL;
-    *q=5; /* break it */
-    return q;
-}
-
-/**
- * Global operator delete, defined only inside ICU4C, must not be used.
- * Crashes intentionally.
- * @internal
- */
-inline void
-operator delete(void * /*p*/) {
-    char *q=NULL;
-    *q=5; /* break it */
-}
-
-/**
- * Global operator delete[], defined only inside ICU4C, must not be used.
- * Crashes intentionally.
- * @internal
- */
-inline void
-operator delete[](void * /*p*/) {
-    char *q=NULL;
-    *q=5; /* break it */
-}
-
-#endif /* U_HIDE_INTERNAL_API */
-#endif
-
-/*===========================================================================*/
-/* UErrorCode */
-/*===========================================================================*/
-
-/**
- * Error code to replace exception handling, so that the code is compatible with all C++ compilers,
- * and to use the same mechanism for C and C++.
- *
- * \par
- * ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode
- * first test if(U_FAILURE(errorCode)) { return immediately; }
- * so that in a chain of such functions the first one that sets an error code
- * causes the following ones to not perform any operations.
- *
- * \par
- * Error codes should be tested using U_FAILURE() and U_SUCCESS().
- * @stable ICU 2.0
- */
-typedef enum UErrorCode {
-    /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird
-     * and is that way because VC++ debugger displays first encountered constant,
-     * which is not the what the code is used for
-     */
-
-    U_USING_FALLBACK_WARNING  = -128,   /**< A resource bundle lookup returned a fallback result (not an error) */
-
-    U_ERROR_WARNING_START     = -128,   /**< Start of information results (semantically successful) */
-
-    U_USING_DEFAULT_WARNING   = -127,   /**< A resource bundle lookup returned a result from the root locale (not an error) */
-
-    U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */
-
-    U_STATE_OLD_WARNING       = -125,   /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */
-
-    U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */
-
-    U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */
-
-    U_AMBIGUOUS_ALIAS_WARNING = -122,   /**< This converter alias can go to different converter implementations */
-
-    U_DIFFERENT_UCA_VERSION = -121,     /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
-    
-    U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */
-
-    U_ERROR_WARNING_LIMIT,              /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */
-
-
-    U_ZERO_ERROR              =  0,     /**< No error, no warning. */
-
-    U_ILLEGAL_ARGUMENT_ERROR  =  1,     /**< Start of codes indicating failure */
-    U_MISSING_RESOURCE_ERROR  =  2,     /**< The requested resource cannot be found */
-    U_INVALID_FORMAT_ERROR    =  3,     /**< Data format is not what is expected */
-    U_FILE_ACCESS_ERROR       =  4,     /**< The requested file cannot be found */
-    U_INTERNAL_PROGRAM_ERROR  =  5,     /**< Indicates a bug in the library code */
-    U_MESSAGE_PARSE_ERROR     =  6,     /**< Unable to parse a message (message format) */
-    U_MEMORY_ALLOCATION_ERROR =  7,     /**< Memory allocation error */
-    U_INDEX_OUTOFBOUNDS_ERROR =  8,     /**< Trying to access the index that is out of bounds */
-    U_PARSE_ERROR             =  9,     /**< Equivalent to Java ParseException */
-    U_INVALID_CHAR_FOUND      = 10,     /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */
-    U_TRUNCATED_CHAR_FOUND    = 11,     /**< Character conversion: Incomplete input sequence. */
-    U_ILLEGAL_CHAR_FOUND      = 12,     /**< Character conversion: Illegal input sequence/combination of input units. */
-    U_INVALID_TABLE_FORMAT    = 13,     /**< Conversion table file found, but corrupted */
-    U_INVALID_TABLE_FILE      = 14,     /**< Conversion table file not found */
-    U_BUFFER_OVERFLOW_ERROR   = 15,     /**< A result would not fit in the supplied buffer */
-    U_UNSUPPORTED_ERROR       = 16,     /**< Requested operation not supported in current context */
-    U_RESOURCE_TYPE_MISMATCH  = 17,     /**< an operation is requested over a resource that does not support it */
-    U_ILLEGAL_ESCAPE_SEQUENCE = 18,     /**< ISO-2022 illlegal escape sequence */
-    U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */
-    U_NO_SPACE_AVAILABLE      = 20,     /**< No space available for in-buffer expansion for Arabic shaping */
-    U_CE_NOT_FOUND_ERROR      = 21,     /**< Currently used only while setting variable top, but can be used generally */
-    U_PRIMARY_TOO_LONG_ERROR  = 22,     /**< User tried to set variable top to a primary that is longer than two bytes */
-    U_STATE_TOO_OLD_ERROR     = 23,     /**< ICU cannot construct a service from this state, as it is no longer supported */
-    U_TOO_MANY_ALIASES_ERROR  = 24,     /**< There are too many aliases in the path to the requested resource.
-                                             It is very possible that a circular alias definition has occured */
-    U_ENUM_OUT_OF_SYNC_ERROR  = 25,     /**< UEnumeration out of sync with underlying collection */
-    U_INVARIANT_CONVERSION_ERROR = 26,  /**< Unable to convert a UChar* string to char* with the invariant converter. */
-    U_INVALID_STATE_ERROR     = 27,     /**< Requested operation can not be completed with ICU in its current state */
-    U_COLLATOR_VERSION_MISMATCH = 28,   /**< Collator version is not compatible with the base version */
-    U_USELESS_COLLATOR_ERROR  = 29,     /**< Collator is options only and no base is specified */
-    U_NO_WRITE_PERMISSION     = 30,     /**< Attempt to modify read-only or constant data. */
-
-    U_STANDARD_ERROR_LIMIT,             /**< This must always be the last value to indicate the limit for standard errors */
-    /*
-     * the error code range 0x10000 0x10100 are reserved for Transliterator
-     */
-    U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */
-    U_PARSE_ERROR_START = 0x10000,    /**< Start of Transliterator errors */
-    U_MALFORMED_RULE,                 /**< Elements of a rule are misplaced */
-    U_MALFORMED_SET,                  /**< A UnicodeSet pattern is invalid*/
-    U_MALFORMED_SYMBOL_REFERENCE,     /**< UNUSED as of ICU 2.4 */
-    U_MALFORMED_UNICODE_ESCAPE,       /**< A Unicode escape pattern is invalid*/
-    U_MALFORMED_VARIABLE_DEFINITION,  /**< A variable definition is invalid */
-    U_MALFORMED_VARIABLE_REFERENCE,   /**< A variable reference is invalid */
-    U_MISMATCHED_SEGMENT_DELIMITERS,  /**< UNUSED as of ICU 2.4 */
-    U_MISPLACED_ANCHOR_START,         /**< A start anchor appears at an illegal position */
-    U_MISPLACED_CURSOR_OFFSET,        /**< A cursor offset occurs at an illegal position */
-    U_MISPLACED_QUANTIFIER,           /**< A quantifier appears after a segment close delimiter */
-    U_MISSING_OPERATOR,               /**< A rule contains no operator */
-    U_MISSING_SEGMENT_CLOSE,          /**< UNUSED as of ICU 2.4 */
-    U_MULTIPLE_ANTE_CONTEXTS,         /**< More than one ante context */
-    U_MULTIPLE_CURSORS,               /**< More than one cursor */
-    U_MULTIPLE_POST_CONTEXTS,         /**< More than one post context */
-    U_TRAILING_BACKSLASH,             /**< A dangling backslash */
-    U_UNDEFINED_SEGMENT_REFERENCE,    /**< A segment reference does not correspond to a defined segment */
-    U_UNDEFINED_VARIABLE,             /**< A variable reference does not correspond to a defined variable */
-    U_UNQUOTED_SPECIAL,               /**< A special character was not quoted or escaped */
-    U_UNTERMINATED_QUOTE,             /**< A closing single quote is missing */
-    U_RULE_MASK_ERROR,                /**< A rule is hidden by an earlier more general rule */
-    U_MISPLACED_COMPOUND_FILTER,      /**< A compound filter is in an invalid location */
-    U_MULTIPLE_COMPOUND_FILTERS,      /**< More than one compound filter */
-    U_INVALID_RBT_SYNTAX,             /**< A "::id" rule was passed to the RuleBasedTransliterator parser */
-    U_INVALID_PROPERTY_PATTERN,       /**< UNUSED as of ICU 2.4 */
-    U_MALFORMED_PRAGMA,               /**< A 'use' pragma is invlalid */
-    U_UNCLOSED_SEGMENT,               /**< A closing ')' is missing */
-    U_ILLEGAL_CHAR_IN_SEGMENT,        /**< UNUSED as of ICU 2.4 */
-    U_VARIABLE_RANGE_EXHAUSTED,       /**< Too many stand-ins generated for the given variable range */
-    U_VARIABLE_RANGE_OVERLAP,         /**< The variable range overlaps characters used in rules */
-    U_ILLEGAL_CHARACTER,              /**< A special character is outside its allowed context */
-    U_INTERNAL_TRANSLITERATOR_ERROR,  /**< Internal transliterator system error */
-    U_INVALID_ID,                     /**< A "::id" rule specifies an unknown transliterator */
-    U_INVALID_FUNCTION,               /**< A "&fn()" rule specifies an unknown transliterator */
-    U_PARSE_ERROR_LIMIT,              /**< The limit for Transliterator errors */
-
-    /*
-     * the error code range 0x10100 0x10200 are reserved for formatting API parsing error
-     */
-    U_UNEXPECTED_TOKEN=0x10100,       /**< Syntax error in format pattern */
-    U_FMT_PARSE_ERROR_START=0x10100,  /**< Start of format library errors */
-    U_MULTIPLE_DECIMAL_SEPARATORS,    /**< More than one decimal separator in number pattern */
-    U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */
-    U_MULTIPLE_EXPONENTIAL_SYMBOLS,   /**< More than one exponent symbol in number pattern */
-    U_MALFORMED_EXPONENTIAL_PATTERN,  /**< Grouping symbol in exponent pattern */
-    U_MULTIPLE_PERCENT_SYMBOLS,       /**< More than one percent symbol in number pattern */
-    U_MULTIPLE_PERMILL_SYMBOLS,       /**< More than one permill symbol in number pattern */
-    U_MULTIPLE_PAD_SPECIFIERS,        /**< More than one pad symbol in number pattern */
-    U_PATTERN_SYNTAX_ERROR,           /**< Syntax error in format pattern */
-    U_ILLEGAL_PAD_POSITION,           /**< Pad symbol misplaced in number pattern */
-    U_UNMATCHED_BRACES,               /**< Braces do not match in message pattern */
-    U_UNSUPPORTED_PROPERTY,           /**< UNUSED as of ICU 2.4 */
-    U_UNSUPPORTED_ATTRIBUTE,          /**< UNUSED as of ICU 2.4 */
-    U_ARGUMENT_TYPE_MISMATCH,         /**< Argument name and argument index mismatch in MessageFormat functions */
-    U_DUPLICATE_KEYWORD,              /**< Duplicate keyword in PluralFormat */
-    U_UNDEFINED_KEYWORD,              /**< Undefined Plural keyword */
-    U_DEFAULT_KEYWORD_MISSING,        /**< Missing DEFAULT rule in plural rules */
-    U_DECIMAL_NUMBER_SYNTAX_ERROR,    /**< Decimal number syntax error */
-    U_FMT_PARSE_ERROR_LIMIT,          /**< The limit for format library errors */
-
-    /*
-     * the error code range 0x10200 0x102ff are reserved for Break Iterator related error
-     */
-    U_BRK_INTERNAL_ERROR=0x10200,          /**< An internal error (bug) was detected.             */
-    U_BRK_ERROR_START=0x10200,             /**< Start of codes indicating Break Iterator failures */
-    U_BRK_HEX_DIGITS_EXPECTED,             /**< Hex digits expected as part of a escaped char in a rule. */
-    U_BRK_SEMICOLON_EXPECTED,              /**< Missing ';' at the end of a RBBI rule.            */
-    U_BRK_RULE_SYNTAX,                     /**< Syntax error in RBBI rule.                        */
-    U_BRK_UNCLOSED_SET,                    /**< UnicodeSet witing an RBBI rule missing a closing ']'.  */
-    U_BRK_ASSIGN_ERROR,                    /**< Syntax error in RBBI rule assignment statement.   */
-    U_BRK_VARIABLE_REDFINITION,            /**< RBBI rule $Variable redefined.                    */
-    U_BRK_MISMATCHED_PAREN,                /**< Mis-matched parentheses in an RBBI rule.          */
-    U_BRK_NEW_LINE_IN_QUOTED_STRING,       /**< Missing closing quote in an RBBI rule.            */
-    U_BRK_UNDEFINED_VARIABLE,              /**< Use of an undefined $Variable in an RBBI rule.    */
-    U_BRK_INIT_ERROR,                      /**< Initialization failure.  Probable missing ICU Data. */
-    U_BRK_RULE_EMPTY_SET,                  /**< Rule contains an empty Unicode Set.               */
-    U_BRK_UNRECOGNIZED_OPTION,             /**< !!option in RBBI rules not recognized.            */
-    U_BRK_MALFORMED_RULE_TAG,              /**< The {nnn} tag on a rule is mal formed             */
-    U_BRK_ERROR_LIMIT,                     /**< This must always be the last value to indicate the limit for Break Iterator failures */
-
-    /*
-     * The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs
-     */
-    U_REGEX_INTERNAL_ERROR=0x10300,       /**< An internal error (bug) was detected.              */
-    U_REGEX_ERROR_START=0x10300,          /**< Start of codes indicating Regexp failures          */
-    U_REGEX_RULE_SYNTAX,                  /**< Syntax error in regexp pattern.                    */
-    U_REGEX_INVALID_STATE,                /**< RegexMatcher in invalid state for requested operation */
-    U_REGEX_BAD_ESCAPE_SEQUENCE,          /**< Unrecognized backslash escape sequence in pattern  */
-    U_REGEX_PROPERTY_SYNTAX,              /**< Incorrect Unicode property                         */
-    U_REGEX_UNIMPLEMENTED,                /**< Use of regexp feature that is not yet implemented. */
-    U_REGEX_MISMATCHED_PAREN,             /**< Incorrectly nested parentheses in regexp pattern.  */
-    U_REGEX_NUMBER_TOO_BIG,               /**< Decimal number is too large.                       */
-    U_REGEX_BAD_INTERVAL,                 /**< Error in {min,max} interval                        */
-    U_REGEX_MAX_LT_MIN,                   /**< In {min,max}, max is less than min.                */
-    U_REGEX_INVALID_BACK_REF,             /**< Back-reference to a non-existent capture group.    */
-    U_REGEX_INVALID_FLAG,                 /**< Invalid value for match mode flags.                */
-    U_REGEX_LOOK_BEHIND_LIMIT,            /**< Look-Behind pattern matches must have a bounded maximum length.    */
-    U_REGEX_SET_CONTAINS_STRING,          /**< Regexps cannot have UnicodeSets containing strings.*/
-    U_REGEX_OCTAL_TOO_BIG,                /**< Octal character constants must be <= 0377.         */
-    U_REGEX_MISSING_CLOSE_BRACKET,        /**< Missing closing bracket on a bracket expression.   */
-    U_REGEX_INVALID_RANGE,                /**< In a character range [x-y], x is greater than y.   */
-    U_REGEX_STACK_OVERFLOW,               /**< Regular expression backtrack stack overflow.       */
-    U_REGEX_TIME_OUT,                     /**< Maximum allowed match time exceeded                */
-    U_REGEX_STOPPED_BY_CALLER,            /**< Matching operation aborted by user callback fn.    */
-    U_REGEX_ERROR_LIMIT,                  /**< This must always be the last value to indicate the limit for regexp errors */
-
-    /*
-     * The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes
-     */
-    U_IDNA_PROHIBITED_ERROR=0x10400,
-    U_IDNA_ERROR_START=0x10400,
-    U_IDNA_UNASSIGNED_ERROR,
-    U_IDNA_CHECK_BIDI_ERROR,
-    U_IDNA_STD3_ASCII_RULES_ERROR,
-    U_IDNA_ACE_PREFIX_ERROR,
-    U_IDNA_VERIFICATION_ERROR,
-    U_IDNA_LABEL_TOO_LONG_ERROR,
-    U_IDNA_ZERO_LENGTH_LABEL_ERROR,
-    U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR,
-    U_IDNA_ERROR_LIMIT,
-    /*
-     * Aliases for StringPrep
-     */
-    U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
-    U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
-    U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
-    
-    /*
-     * The error code in the range 0x10500-0x105ff are reserved for Plugin related error codes
-     */
-    U_PLUGIN_ERROR_START=0x10500,         /**< Start of codes indicating plugin failures */
-    U_PLUGIN_TOO_HIGH=0x10500,            /**< The plugin's level is too high to be loaded right now. */
-    U_PLUGIN_DIDNT_SET_LEVEL,             /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */
-    U_PLUGIN_ERROR_LIMIT,                 /**< This must always be the last value to indicate the limit for plugin errors */
-
-    U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT      /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
-} UErrorCode;
-
-/* Use the following to determine if an UErrorCode represents */
-/* operational success or failure. */
-
-#ifdef XP_CPLUSPLUS
-    /**
-     * Does the error code indicate success?
-     * @stable ICU 2.0
-     */
-    static
-    inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); }
-    /**
-     * Does the error code indicate a failure?
-     * @stable ICU 2.0
-     */
-    static
-    inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); }
-#else
-    /**
-     * Does the error code indicate success?
-     * @stable ICU 2.0
-     */
-#   define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
-    /**
-     * Does the error code indicate a failure?
-     * @stable ICU 2.0
-     */
-#   define U_FAILURE(x) ((x)>U_ZERO_ERROR)
-#endif
-
-/**
- * Return a string for a UErrorCode value.
- * The string will be the same as the name of the error code constant
- * in the UErrorCode enum above.
- * @stable ICU 2.0
- */
-U_STABLE const char * U_EXPORT2
-u_errorName(UErrorCode code);
-
-
-#endif /* _UTYPES */
diff --git a/Source/core/icu/unicode/uvernum.h b/Source/core/icu/unicode/uvernum.h
deleted file mode 100644
index 7221612..0000000
--- a/Source/core/icu/unicode/uvernum.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-*******************************************************************************
-*   Copyright (C) 2000-2011, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*******************************************************************************
-*
-*   file name:  uvernum.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   Created by: Vladimir Weinstein
-*   Updated by: Steven R. Loomis
-*
-*  Gets included by uversion.h and other files.
-*
-* IMPORTANT: When updating version, the following things need to be done:
-* source/common/unicode/uvernum.h - this file: update major, minor,
-*        patchlevel, suffix, version, short version constants, namespace,
-*                    renaming macro, and copyright
-*
-* The following files need to be updated as well, which can be done
-*  by running the UNIX makefile target 'update-windows-makefiles' in icu/source.
-*
-*
-* source/common/common.vcproj - update 'Output file name' on the link tab so
-*                   that it contains the new major/minor combination
-* source/i18n/i18n.vcproj - same as for the common.vcproj
-* source/layout/layout.vcproj - same as for the common.vcproj
-* source/layoutex/layoutex.vcproj - same
-* source/stubdata/stubdata.vcproj - same as for the common.vcproj
-* source/io/io.vcproj - same as for the common.vcproj
-* source/data/makedata.mak - change U_ICUDATA_NAME so that it contains
-*                            the new major/minor combination and the Unicode version.
-*/
-
-#ifndef UVERNUM_H
-#define UVERNUM_H
-
-/** The standard copyright notice that gets compiled into each library. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_COPYRIGHT_STRING \
-  " Copyright (C) 2011, International Business Machines Corporation and others. All Rights Reserved. "
-
-/** The current ICU major version as an integer. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_ICU_VERSION_MAJOR_NUM 4
-
-/** The current ICU minor version as an integer. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.6
- */
-#define U_ICU_VERSION_MINOR_NUM 6
-
-/** The current ICU patchlevel version as an integer.  
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_ICU_VERSION_PATCHLEVEL_NUM 1
-
-/** The current ICU build level version as an integer.  
- *  This value is for use by ICU clients. It defaults to 0.
- *  @stable ICU 4.0
- */
-#ifndef U_ICU_VERSION_BUILDLEVEL_NUM
-#define U_ICU_VERSION_BUILDLEVEL_NUM 0
-#endif
-
-/** Glued version suffix for renamers 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.6
- */
-#define U_ICU_VERSION_SUFFIX _46
-
-/** Glued version suffix function for renamers 
- *  This value will change in the subsequent releases of ICU.
- *  If a custom suffix (such as matching library suffixes) is desired, this can be modified.
- *  Note that if present, platform.h may contain an earlier definition of this macro.
- *  @stable ICU 4.2
- */
-#ifndef U_ICU_ENTRY_POINT_RENAME
-#define U_ICU_ENTRY_POINT_RENAME(x)    x ## _46
-#endif
-
-/** The current ICU library version as a dotted-decimal string. The patchlevel
- *  only appears in this string if it non-zero. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_ICU_VERSION "4.6.1"
-
-/** The current ICU library major/minor version as a string without dots, for library name suffixes. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.6
- */
-#define U_ICU_VERSION_SHORT "46"
-
-/** Data version in ICU4C.
- * @internal ICU 4.4 Internal Use Only
- **/
-#define U_ICU_DATA_VERSION "4.6"
-
-/*===========================================================================
- * ICU collation framework version information
- * Version info that can be obtained from a collator is affected by these
- * numbers in a secret and magic way. Please use collator version as whole
- *===========================================================================
- */
-
-/**
- * Collation runtime version (sort key generator, strcoll).
- * If the version is different, sort keys for the same string could be different.
- * This value may change in subsequent releases of ICU.
- * @stable ICU 2.4
- */
-#define UCOL_RUNTIME_VERSION 7
-
-/**
- * Collation builder code version.
- * When this is different, the same tailoring might result
- * in assigning different collation elements to code points.
- * This value may change in subsequent releases of ICU.
- * @stable ICU 2.4
- */
-#define UCOL_BUILDER_VERSION 8
-
-/**
- * This is the version of collation tailorings.
- * This value may change in subsequent releases of ICU.
- * @stable ICU 2.4
- */
-#define UCOL_TAILORINGS_VERSION 1
-
-#endif
diff --git a/Source/core/icu/unicode/uversion.h b/Source/core/icu/unicode/uversion.h
deleted file mode 100644
index e54cd55..0000000
--- a/Source/core/icu/unicode/uversion.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-*******************************************************************************
-*   Copyright (C) 2000-2010, International Business Machines
-*   Corporation and others.  All Rights Reserved.
-*******************************************************************************
-*
-*   file name:  uversion.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   Created by: Vladimir Weinstein
-*
-*  Gets included by utypes.h and Windows .rc files
-*/
-
-/**
- * \file
- * \brief C API: API for accessing ICU version numbers. 
- */
-/*===========================================================================*/
-/* Main ICU version information                                              */
-/*===========================================================================*/
-
-#ifndef UVERSION_H
-#define UVERSION_H
-
-#include "unicode/umachine.h"
-
-/* Actual version info lives in uvernum.h */
-#include "unicode/uvernum.h"
-
-/** Maximum length of the copyright string.
- *  @stable ICU 2.4
- */
-#define U_COPYRIGHT_STRING_LENGTH  128
-
-/** An ICU version consists of up to 4 numbers from 0..255.
- *  @stable ICU 2.4
- */
-#define U_MAX_VERSION_LENGTH 4
-
-/** In a string, ICU version fields are delimited by dots.
- *  @stable ICU 2.4
- */
-#define U_VERSION_DELIMITER '.'
-
-/** The maximum length of an ICU version string.
- *  @stable ICU 2.4
- */
-#define U_MAX_VERSION_STRING_LENGTH 20
-
-/** The binary form of a version on ICU APIs is an array of 4 uint8_t.
- *  To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
- *  @stable ICU 2.4
- */
-typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
-
-/*===========================================================================*/
-/* C++ namespace if supported. Versioned unless versioning is disabled.      */
-/*===========================================================================*/
-
-/**
- * \def U_NAMESPACE_BEGIN
- * This is used to begin a declaration of a public ICU C++ API.
- * When not compiling for C++, it does nothing.
- * When compiling for C++, it begins an extern "C++" linkage block (to protect
- * against cases in which an external client includes ICU header files inside
- * an extern "C" linkage block).
- * If the C++ compiler supports namespaces, it also begins a namespace block.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_NAMESPACE_END
- * This is used to end a declaration of a public ICU C++ API.
- * When not compiling for C++, it does nothing.
- * When compiling for C++, it ends the extern "C++" block begun by
- * U_NAMESPACE_BEGIN.
- * If the C++ compiler supports namespaces, it also ends the namespace block
- * begun by U_NAMESPACE_BEGIN.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_NAMESPACE_USE
- * This is used to specify that the rest of the code uses the
- * public ICU C++ API namespace.
- * If the compiler doesn't support namespaces, this does nothing.
- * @stable ICU 2.4
- */
-
-/**
- * \def U_NAMESPACE_QUALIFIER
- * This is used to qualify that a function or class is part of
- * the public ICU C++ API namespace.
- * If the compiler doesn't support namespaces, this does nothing.
- * @stable ICU 2.4
- */
-
-/* Define namespace symbols if the compiler supports it. */
-#ifdef XP_CPLUSPLUS
-#if U_HAVE_NAMESPACE
-#   if U_DISABLE_RENAMING
-#       define U_ICU_NAMESPACE icu
-        namespace U_ICU_NAMESPACE { }
-#   else
-#       define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
-        namespace U_ICU_NAMESPACE { }
-        namespace icu = U_ICU_NAMESPACE;
-#   endif
-
-#   define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
-#   define U_NAMESPACE_END } }
-#   define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
-#   define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
-
-#   ifndef U_USING_ICU_NAMESPACE
-#       define U_USING_ICU_NAMESPACE 1
-#   endif
-#   if U_USING_ICU_NAMESPACE
-        U_NAMESPACE_USE
-#   endif
-#else
-#   define U_NAMESPACE_BEGIN extern "C++" {
-#   define U_NAMESPACE_END }
-#   define U_NAMESPACE_USE
-#   define U_NAMESPACE_QUALIFIER
-#endif
-#else
-#   define U_NAMESPACE_BEGIN
-#   define U_NAMESPACE_END
-#   define U_NAMESPACE_USE
-#   define U_NAMESPACE_QUALIFIER
-#endif
-
-/*===========================================================================*/
-/* General version helper functions. Definitions in putil.c                  */
-/*===========================================================================*/
-
-/**
- * Parse a string with dotted-decimal version information and
- * fill in a UVersionInfo structure with the result.
- * Definition of this function lives in putil.c
- *
- * @param versionArray The destination structure for the version information.
- * @param versionString A string with dotted-decimal version information,
- *                      with up to four non-negative number fields with
- *                      values of up to 255 each.
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-u_versionFromString(UVersionInfo versionArray, const char *versionString);
-
-/**
- * Parse a Unicode string with dotted-decimal version information and
- * fill in a UVersionInfo structure with the result.
- * Definition of this function lives in putil.c
- *
- * @param versionArray The destination structure for the version information.
- * @param versionString A Unicode string with dotted-decimal version
- *                      information, with up to four non-negative number
- *                      fields with values of up to 255 each.
- * @stable ICU 4.2
- */
-U_STABLE void U_EXPORT2
-u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
-
-
-/**
- * Write a string with dotted-decimal version information according
- * to the input UVersionInfo.
- * Definition of this function lives in putil.c
- *
- * @param versionArray The version information to be written as a string.
- * @param versionString A string buffer that will be filled in with
- *                      a string corresponding to the numeric version
- *                      information in versionArray.
- *                      The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
- * @stable ICU 2.4
- */
-U_STABLE void U_EXPORT2
-u_versionToString(UVersionInfo versionArray, char *versionString);
-
-/**
- * Gets the ICU release version.  The version array stores the version information
- * for ICU.  For example, release "1.3.31.2" is then represented as 0x01031F02.
- * Definition of this function lives in putil.c
- *
- * @param versionArray the version # information, the result will be filled in
- * @stable ICU 2.0
- */
-U_STABLE void U_EXPORT2
-u_getVersion(UVersionInfo versionArray);
-#endif
diff --git a/Source/core/inspector/CodeGeneratorInspector.py b/Source/core/inspector/CodeGeneratorInspector.py
index 4c81796..233d7fa 100755
--- a/Source/core/inspector/CodeGeneratorInspector.py
+++ b/Source/core/inspector/CodeGeneratorInspector.py
@@ -49,7 +49,7 @@
 
 TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", "Runtime.InternalPropertyDescriptor",
                                          "Debugger.FunctionDetails", "Debugger.CallFrame",
-                                         "Canvas.TraceLog", "Canvas.ResourceInfo", "Canvas.ResourceState",
+                                         "Canvas.TraceLog", "Canvas.ResourceState",
                                          # This should be a temporary hack. TimelineEvent should be created via generated C++ API.
                                          "Timeline.TimelineEvent"])
 
@@ -62,25 +62,21 @@
 EXACTLY_INT_SUPPORTED = False
 
 cmdline_parser = optparse.OptionParser()
-cmdline_parser.add_option("--output_h_dir")
-cmdline_parser.add_option("--output_cpp_dir")
+cmdline_parser.add_option("--output_dir")
 
 try:
     arg_options, arg_values = cmdline_parser.parse_args()
     if (len(arg_values) != 1):
         raise Exception("Exactly one plain argument expected (found %s)" % len(arg_values))
     input_json_filename = arg_values[0]
-    output_header_dirname = arg_options.output_h_dir
-    output_cpp_dirname = arg_options.output_cpp_dir
-    if not output_header_dirname:
-        raise Exception("Output .h directory must be specified")
-    if not output_cpp_dirname:
-        raise Exception("Output .cpp directory must be specified")
+    output_dirname = arg_options.output_dir
+    if not output_dirname:
+        raise Exception("Output directory must be specified")
 except Exception:
     # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html
     exc = sys.exc_info()[1]
     sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
-    sys.stderr.write("Usage: <script> protocol.json --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir>\n")
+    sys.stderr.write("Usage: <script> --output_dir <output_dir> protocol.json\n")
     exit(1)
 
 
@@ -2291,14 +2287,14 @@
 
 Generator.go()
 
-backend_h_file = output_file(output_header_dirname + "/InspectorBackendDispatcher.h")
-backend_cpp_file = output_file(output_cpp_dirname + "/InspectorBackendDispatcher.cpp")
+backend_h_file = output_file(output_dirname + "/InspectorBackendDispatcher.h")
+backend_cpp_file = output_file(output_dirname + "/InspectorBackendDispatcher.cpp")
 
-frontend_h_file = output_file(output_header_dirname + "/InspectorFrontend.h")
-frontend_cpp_file = output_file(output_cpp_dirname + "/InspectorFrontend.cpp")
+frontend_h_file = output_file(output_dirname + "/InspectorFrontend.h")
+frontend_cpp_file = output_file(output_dirname + "/InspectorFrontend.cpp")
 
-typebuilder_h_file = output_file(output_header_dirname + "/InspectorTypeBuilder.h")
-typebuilder_cpp_file = output_file(output_cpp_dirname + "/InspectorTypeBuilder.cpp")
+typebuilder_h_file = output_file(output_dirname + "/InspectorTypeBuilder.h")
+typebuilder_cpp_file = output_file(output_dirname + "/InspectorTypeBuilder.cpp")
 
 
 backend_h_file.write(Templates.backend_h.substitute(None,
diff --git a/Source/core/inspector/CodeGeneratorInspectorStrings.py b/Source/core/inspector/CodeGeneratorInspectorStrings.py
index 8759b2f..b7e7422 100644
--- a/Source/core/inspector/CodeGeneratorInspectorStrings.py
+++ b/Source/core/inspector/CodeGeneratorInspectorStrings.py
@@ -130,9 +130,9 @@
 
 #include "InspectorTypeBuilder.h"
 
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/CodeGeneratorInstrumentation.py b/Source/core/inspector/CodeGeneratorInstrumentation.py
index b72cb5d..5cfe1f9 100644
--- a/Source/core/inspector/CodeGeneratorInstrumentation.py
+++ b/Source/core/inspector/CodeGeneratorInstrumentation.py
@@ -115,10 +115,10 @@
 #ifndef InstrumentingAgentsInl_h
 #define InstrumentingAgentsInl_h
 
-#include <wtf/FastAllocBase.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "wtf/FastAllocBase.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
@@ -469,7 +469,7 @@
     return header_lines, cpp_lines
 
 
-def generate(input_path, output_h_dir, output_cpp_dir):
+def generate(input_path, output_dir):
     fin = open(input_path, "r")
     files = load_model_from_idl(fin.read())
     fin.close()
@@ -480,7 +480,7 @@
     for f in files:
         cpp_includes.append(include_header(f.header_name))
 
-        fout = open(output_h_dir + "/" + f.header_name + ".h", "w")
+        fout = open(output_dir + "/" + f.header_name + ".h", "w")
         fout.write(f.generate(cpp_lines, used_agents))
         fout.close()
 
@@ -491,11 +491,11 @@
 
     instrumenting_agents_header, instrumenting_agents_cpp = generate_instrumenting_agents(used_agents)
 
-    fout = open(output_h_dir + "/" + "InstrumentingAgentsInl.h", "w")
+    fout = open(output_dir + "/" + "InstrumentingAgentsInl.h", "w")
     fout.write(instrumenting_agents_header)
     fout.close()
 
-    fout = open(output_cpp_dir + "/InspectorInstrumentationImpl.cpp", "w")
+    fout = open(output_dir + "/InspectorInstrumentationImpl.cpp", "w")
     fout.write(template_cpp.substitute(None,
                                        includes="\n".join(cpp_includes),
                                        extra_definitions=instrumenting_agents_cpp,
@@ -504,25 +504,21 @@
 
 
 cmdline_parser = optparse.OptionParser()
-cmdline_parser.add_option("--output_h_dir")
-cmdline_parser.add_option("--output_cpp_dir")
+cmdline_parser.add_option("--output_dir")
 
 try:
     arg_options, arg_values = cmdline_parser.parse_args()
     if (len(arg_values) != 1):
         raise Exception("Exactly one plain argument expected (found %s)" % len(arg_values))
     input_path = arg_values[0]
-    output_header_dirpath = arg_options.output_h_dir
-    output_cpp_dirpath = arg_options.output_cpp_dir
-    if not output_header_dirpath:
-        raise Exception("Output .h directory must be specified")
-    if not output_cpp_dirpath:
-        raise Exception("Output .cpp directory must be specified")
+    output_dirpath = arg_options.output_dir
+    if not output_dirpath:
+        raise Exception("Output directory must be specified")
 except Exception:
     # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html
     exc = sys.exc_info()[1]
     sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
-    sys.stderr.write("Usage: <script> InspectorInstrumentation.idl --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir>\n")
+    sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrumentation.idl\n")
     exit(1)
 
-generate(input_path, output_header_dirpath, output_cpp_dirpath)
+generate(input_path, output_dirpath)
diff --git a/Source/core/inspector/ContentSearchUtils.h b/Source/core/inspector/ContentSearchUtils.h
index eb189ae..7900e34 100644
--- a/Source/core/inspector/ContentSearchUtils.h
+++ b/Source/core/inspector/ContentSearchUtils.h
@@ -29,12 +29,11 @@
 #ifndef ContentSearchUtils_h
 #define ContentSearchUtils_h
 
-
 #include "InspectorTypeBuilder.h"
-#include <wtf/Vector.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/TextPosition.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/DOMEditor.cpp b/Source/core/inspector/DOMEditor.cpp
index 55fc766..3dd881c 100644
--- a/Source/core/inspector/DOMEditor.cpp
+++ b/Source/core/inspector/DOMEditor.cpp
@@ -29,8 +29,6 @@
  */
 
 #include "config.h"
-
-
 #include "core/inspector/DOMEditor.h"
 
 #include "core/dom/DOMException.h"
@@ -38,12 +36,10 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/Node.h"
 #include "core/dom/Text.h"
+#include "core/editing/markup.h"
 #include "core/inspector/DOMPatchSupport.h"
 #include "core/inspector/InspectorHistory.h"
-
-#include "core/editing/markup.h"
-
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 using namespace std;
 
@@ -67,12 +63,14 @@
 
     virtual bool undo(ExceptionCode& ec)
     {
-        return m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
+        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
+        return !ec;
     }
 
     virtual bool redo(ExceptionCode& ec)
     {
-        return m_parentNode->removeChild(m_node.get(), ec);
+        m_parentNode->removeChild(m_node.get(), ec);
+        return !ec;
     }
 
 private:
@@ -99,12 +97,14 @@
             if (!m_removeChildAction->perform(ec))
                 return false;
         }
-        return m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
+        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
+        return !ec;
     }
 
     virtual bool undo(ExceptionCode& ec)
     {
-        if (!m_parentNode->removeChild(m_node.get(), ec))
+        m_parentNode->removeChild(m_node.get(), ec);
+        if (ec)
             return false;
         if (m_removeChildAction)
             return m_removeChildAction->undo(ec);
@@ -115,7 +115,8 @@
     {
         if (m_removeChildAction && !m_removeChildAction->redo(ec))
             return false;
-        return m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
+        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
+        return !ec;
     }
 
 private:
@@ -301,12 +302,14 @@
 
     virtual bool undo(ExceptionCode& ec)
     {
-        return m_parentNode->replaceChild(m_oldNode, m_newNode.get(), ec);
+        m_parentNode->replaceChild(m_oldNode, m_newNode.get(), ec);
+        return !ec;
     }
 
     virtual bool redo(ExceptionCode& ec)
     {
-        return m_parentNode->replaceChild(m_newNode, m_oldNode.get(), ec);
+        m_parentNode->replaceChild(m_newNode, m_oldNode.get(), ec);
+        return !ec;
     }
 
 private:
@@ -325,22 +328,22 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionCode&)
     {
         m_oldValue = m_node->nodeValue();
-        return redo(ec);
+        return redo(IGNORE_EXCEPTION);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionCode&)
     {
-        m_node->setNodeValue(m_oldValue, ec);
-        return !ec;
+        m_node->setNodeValue(m_oldValue);
+        return true;
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionCode&)
     {
-        m_node->setNodeValue(m_value, ec);
-        return !ec;
+        m_node->setNodeValue(m_value);
+        return true;
     }
 
 private:
diff --git a/Source/core/inspector/DOMEditor.h b/Source/core/inspector/DOMEditor.h
index 7691588..aef98b5 100644
--- a/Source/core/inspector/DOMEditor.h
+++ b/Source/core/inspector/DOMEditor.h
@@ -32,8 +32,7 @@
 #define DOMEditor_h
 
 #include "core/dom/ExceptionCode.h"
-
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/DOMPatchSupport.cpp b/Source/core/inspector/DOMPatchSupport.cpp
index 06736e9..60978ab 100644
--- a/Source/core/inspector/DOMPatchSupport.cpp
+++ b/Source/core/inspector/DOMPatchSupport.cpp
@@ -29,8 +29,6 @@
  */
 
 #include "config.h"
-
-
 #include "core/inspector/DOMPatchSupport.h"
 
 #include "HTMLNames.h"
@@ -44,13 +42,12 @@
 #include "core/inspector/DOMEditor.h"
 #include "core/inspector/InspectorHistory.h"
 #include "core/xml/parser/XMLDocumentParser.h"
-
-#include <wtf/Deque.h>
-#include <wtf/HashTraits.h>
-#include <wtf/RefPtr.h>
-#include <wtf/SHA1.h>
-#include <wtf/text/Base64.h>
-#include <wtf/text/CString.h>
+#include "wtf/Deque.h"
+#include "wtf/HashTraits.h"
+#include "wtf/RefPtr.h"
+#include "wtf/SHA1.h"
+#include "wtf/text/Base64.h"
+#include "wtf/text/CString.h"
 
 using namespace std;
 
@@ -89,11 +86,11 @@
 {
     RefPtr<Document> newDocument;
     if (m_document->isHTMLDocument())
-        newDocument = HTMLDocument::create(0, KURL());
+        newDocument = HTMLDocument::create();
     else if (m_document->isXHTMLDocument())
-        newDocument = HTMLDocument::createXHTML(0, KURL());
+        newDocument = HTMLDocument::createXHTML();
     else if (m_document->isSVGDocument())
-        newDocument = Document::create(0, KURL());
+        newDocument = Document::create();
 
     ASSERT(newDocument);
     newDocument->setContextFeatures(m_document->contextFeatures());
diff --git a/Source/core/inspector/DOMPatchSupport.h b/Source/core/inspector/DOMPatchSupport.h
index 7e53a3e..f261ecf 100644
--- a/Source/core/inspector/DOMPatchSupport.h
+++ b/Source/core/inspector/DOMPatchSupport.h
@@ -32,12 +32,11 @@
 #define DOMPatchSupport_h
 
 #include "core/dom/ExceptionCode.h"
-
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/HeapGraphSerializer.h b/Source/core/inspector/HeapGraphSerializer.h
index e1be9f4..862dbfd 100644
--- a/Source/core/inspector/HeapGraphSerializer.h
+++ b/Source/core/inspector/HeapGraphSerializer.h
@@ -31,14 +31,13 @@
 #ifndef HeapGraphSerializer_h
 #define HeapGraphSerializer_h
 
-
 #include "InspectorFrontend.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/MemoryInstrumentation.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/MemoryInstrumentation.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/IdentifiersFactory.cpp b/Source/core/inspector/IdentifiersFactory.cpp
index f0c2b18..0526d78 100644
--- a/Source/core/inspector/IdentifiersFactory.cpp
+++ b/Source/core/inspector/IdentifiersFactory.cpp
@@ -24,11 +24,9 @@
  */
 
 #include "config.h"
-
-
 #include "core/inspector/IdentifiersFactory.h"
 
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/IdentifiersFactory.h b/Source/core/inspector/IdentifiersFactory.h
index 6ec416c..0b6c596 100644
--- a/Source/core/inspector/IdentifiersFactory.h
+++ b/Source/core/inspector/IdentifiersFactory.h
@@ -26,8 +26,7 @@
 #ifndef IdentifiersFactory_h
 #define IdentifiersFactory_h
 
-#include <wtf/text/WTFString.h>
-
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InjectedScriptCanvasModule.cpp b/Source/core/inspector/InjectedScriptCanvasModule.cpp
index ec892d4..88faf8a 100644
--- a/Source/core/inspector/InjectedScriptCanvasModule.cpp
+++ b/Source/core/inspector/InjectedScriptCanvasModule.cpp
@@ -37,7 +37,6 @@
 
 using WebCore::TypeBuilder::Array;
 using WebCore::TypeBuilder::Canvas::ResourceId;
-using WebCore::TypeBuilder::Canvas::ResourceInfo;
 using WebCore::TypeBuilder::Canvas::ResourceState;
 using WebCore::TypeBuilder::Canvas::TraceLog;
 using WebCore::TypeBuilder::Canvas::TraceLogId;
@@ -166,20 +165,6 @@
     *result = ResourceState::runtimeCast(resultValue);
 }
 
-void InjectedScriptCanvasModule::resourceInfo(ErrorString* errorString, const ResourceId& resourceId, RefPtr<ResourceInfo>* result)
-{
-    ScriptFunctionCall function(injectedScriptObject(), "resourceInfo");
-    function.appendArgument(resourceId);
-    RefPtr<JSONValue> resultValue;
-    makeCall(function, &resultValue);
-    if (!resultValue || resultValue->type() != JSONValue::TypeObject) {
-        if (!resultValue->asString(errorString))
-            *errorString = "Internal error: resourceInfo";
-        return;
-    }
-    *result = ResourceInfo::runtimeCast(resultValue);
-}
-
 void InjectedScriptCanvasModule::resourceState(ErrorString* errorString, const TraceLogId& traceLogId, const ResourceId& resourceId, RefPtr<ResourceState>* result)
 {
     ScriptFunctionCall function(injectedScriptObject(), "resourceState");
diff --git a/Source/core/inspector/InjectedScriptCanvasModule.h b/Source/core/inspector/InjectedScriptCanvasModule.h
index c34aab8..27f9d8b 100644
--- a/Source/core/inspector/InjectedScriptCanvasModule.h
+++ b/Source/core/inspector/InjectedScriptCanvasModule.h
@@ -59,7 +59,6 @@
     void dropTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId&);
     void traceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
     void replayTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, int, RefPtr<TypeBuilder::Canvas::ResourceState>*);
-    void resourceInfo(ErrorString*, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::ResourceInfo>*);
     void resourceState(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::ResourceState>*);
     void evaluateTraceLogCallArgument(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, int, int, const String&, RefPtr<TypeBuilder::Runtime::RemoteObject>*, RefPtr<TypeBuilder::Canvas::ResourceState>*);
 
diff --git a/Source/core/inspector/InjectedScriptCanvasModuleSource.js b/Source/core/inspector/InjectedScriptCanvasModuleSource.js
index 98c489e..f26c811 100644
--- a/Source/core/inspector/InjectedScriptCanvasModuleSource.js
+++ b/Source/core/inspector/InjectedScriptCanvasModuleSource.js
@@ -2731,9 +2731,9 @@
 
 /**
  * @param {!ReplayableCall} replayableCall
- * @return {!Object}
+ * @return {!CallFormatter}
  */
-CallFormatter.formatCall = function(replayableCall)
+CallFormatter.forReplayableCall = function(replayableCall)
 {
     var resource = replayableCall.replayableResource();
     var formatter = CallFormatter._formatters[resource.name()];
@@ -2741,7 +2741,7 @@
         var contextResource = resource.replayableContextResource();
         formatter = CallFormatter._formatters[contextResource.name()] || new CallFormatter();
     }
-    return formatter.formatCall(replayableCall);
+    return formatter;
 }
 
 /**
@@ -3438,22 +3438,30 @@
             id: id,
             /** @type {Array.<CanvasAgent.Call>} */
             calls: [],
+            /** @type {Array.<CanvasAgent.CallArgument>} */
+            contexts: [],
             alive: alive,
             startOffset: fromIndex,
             totalAvailableCalls: replayableCalls.length
         };
+        /** @type {!Object.<string, boolean>} */
+        var contextIds = {};
         for (var i = fromIndex; i <= toIndex; ++i) {
             var call = replayableCalls[i];
             var contextResource = call.replayableResource().replayableContextResource();
             var stackTrace = call.stackTrace();
             var callFrame = stackTrace ? stackTrace.callFrame(0) || {} : {};
-            var item = CallFormatter.formatCall(call);
+            var item = CallFormatter.forReplayableCall(call).formatCall(call);
             item.contextId = CallFormatter.makeStringResourceId(contextResource.id());
             item.sourceURL = callFrame.sourceURL;
             item.lineNumber = callFrame.lineNumber;
             item.columnNumber = callFrame.columnNumber;
             item.isFrameEndCall = traceLog.isFrameEndCallAt(i);
             result.calls.push(item);
+            if (!contextIds[item.contextId]) {
+                contextIds[item.contextId] = true;
+                result.contexts.push(CallFormatter.forReplayableCall(call).formatValue(contextResource));
+            }
         }
         return result;
     },
@@ -3480,28 +3488,6 @@
     },
 
     /**
-     * @param {CanvasAgent.ResourceId} stringResourceId
-     * @return {!CanvasAgent.ResourceInfo|string}
-     */
-    resourceInfo: function(stringResourceId)
-    {
-        var resourceId = this._parseStringId(stringResourceId).resourceId;
-        if (!resourceId)
-            return "Error: Wrong resource ID: " + stringResourceId;
-
-        var replayableResource = null;
-        for (var id in this._traceLogs) {
-            replayableResource = this._traceLogs[id].replayableResource(resourceId);
-            if (replayableResource)
-                break;
-        }
-        if (!replayableResource)
-            return "Error: Resource with the given ID not found.";
-
-        return this._makeResourceInfo(stringResourceId, replayableResource.description());
-    },
-
-    /**
      * @param {CanvasAgent.TraceLogId} traceLogId
      * @param {CanvasAgent.ResourceId} stringResourceId
      * @return {!CanvasAgent.ResourceState|string}
@@ -3512,10 +3498,6 @@
         if (!traceLog)
             return "Error: Trace log with the given ID not found.";
 
-        var traceLogPlayer = this._traceLogPlayers[traceLogId];
-        if (!traceLogPlayer)
-            return "Error: Trace log replay has not started yet.";
-
         var parsedStringId1 = this._parseStringId(traceLogId);
         var parsedStringId2 = this._parseStringId(stringResourceId);
         if (parsedStringId1.injectedScriptId !== parsedStringId2.injectedScriptId)
@@ -3525,11 +3507,9 @@
         if (!resourceId)
             return "Error: Wrong resource ID: " + stringResourceId;
 
-        var resource = traceLogPlayer.replayWorldResource(resourceId);
-        if (!resource)
-            return "Error: Resource with the given ID has not been replayed yet.";
-
-        return this._makeResourceState(stringResourceId, traceLogId, resource.toDataURL());
+        var traceLogPlayer = this._traceLogPlayers[traceLogId];
+        var resource = traceLogPlayer && traceLogPlayer.replayWorldResource(resourceId);
+        return this._makeResourceState(stringResourceId, traceLogId, resource ? resource.toDataURL() : "");
     },
 
     /**
@@ -3582,19 +3562,6 @@
 
     /**
      * @param {CanvasAgent.ResourceId} stringResourceId
-     * @param {string} description
-     * @return {!CanvasAgent.ResourceInfo}
-     */
-    _makeResourceInfo: function(stringResourceId, description)
-    {
-        return {
-            id: stringResourceId,
-            description: description
-        };
-    },
-
-    /**
-     * @param {CanvasAgent.ResourceId} stringResourceId
      * @param {CanvasAgent.TraceLogId} traceLogId
      * @param {string} imageURL
      * @return {!CanvasAgent.ResourceState}
diff --git a/Source/core/inspector/InjectedScriptManager.h b/Source/core/inspector/InjectedScriptManager.h
index 6bd5958..e513651 100644
--- a/Source/core/inspector/InjectedScriptManager.h
+++ b/Source/core/inspector/InjectedScriptManager.h
@@ -31,9 +31,9 @@
 #define InjectedScriptManager_h
 
 #include "bindings/v8/ScriptState.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InjectedScriptModule.h b/Source/core/inspector/InjectedScriptModule.h
index b4295a2..997df7f 100644
--- a/Source/core/inspector/InjectedScriptModule.h
+++ b/Source/core/inspector/InjectedScriptModule.h
@@ -33,7 +33,7 @@
 
 #include "bindings/v8/ScriptState.h"
 #include "core/inspector/InjectedScriptBase.h"
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorAgent.h b/Source/core/inspector/InspectorAgent.h
index d1e56c1..5b07482 100644
--- a/Source/core/inspector/InspectorAgent.h
+++ b/Source/core/inspector/InspectorAgent.h
@@ -31,11 +31,11 @@
 #define InspectorAgent_h
 
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorApplicationCacheAgent.h b/Source/core/inspector/InspectorApplicationCacheAgent.h
index 922c302..558f2d5 100644
--- a/Source/core/inspector/InspectorApplicationCacheAgent.h
+++ b/Source/core/inspector/InspectorApplicationCacheAgent.h
@@ -25,12 +25,11 @@
 #ifndef InspectorApplicationCacheAgent_h
 #define InspectorApplicationCacheAgent_h
 
-
 #include "InspectorFrontend.h"
 #include "core/inspector/InspectorBaseAgent.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorBaseAgent.h b/Source/core/inspector/InspectorBaseAgent.h
index e372bd9..c88ac92 100644
--- a/Source/core/inspector/InspectorBaseAgent.h
+++ b/Source/core/inspector/InspectorBaseAgent.h
@@ -32,9 +32,9 @@
 #define InspectorBaseAgent_h
 
 #include "InspectorBackendDispatcher.h"
-#include <wtf/Forward.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index 74059b5..5eae158 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -1345,7 +1345,7 @@
         m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState);
     else
         m_nodeIdToForcedPseudoState.remove(nodeId);
-    element->ownerDocument()->styleResolverChanged(RecalcStyleImmediately);
+    element->ownerDocument()->scheduleForcedStyleRecalc();
 }
 
 void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int documentNodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> >& result)
@@ -1864,7 +1864,7 @@
 
     m_nodeIdToForcedPseudoState.clear();
     for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = documentsToChange.end(); it != end; ++it)
-        (*it)->styleResolverChanged(RecalcStyleImmediately);
+        (*it)->scheduleForcedStyleRecalc();
 }
 
 } // namespace WebCore
diff --git a/Source/core/inspector/InspectorCanvasAgent.cpp b/Source/core/inspector/InspectorCanvasAgent.cpp
index 64f6a08..cee235c 100644
--- a/Source/core/inspector/InspectorCanvasAgent.cpp
+++ b/Source/core/inspector/InspectorCanvasAgent.cpp
@@ -50,7 +50,6 @@
 
 using WebCore::TypeBuilder::Array;
 using WebCore::TypeBuilder::Canvas::ResourceId;
-using WebCore::TypeBuilder::Canvas::ResourceInfo;
 using WebCore::TypeBuilder::Canvas::ResourceState;
 using WebCore::TypeBuilder::Canvas::TraceLog;
 using WebCore::TypeBuilder::Canvas::TraceLogId;
@@ -177,13 +176,6 @@
         module.replayTraceLog(errorString, traceLogId, stepNo, &result);
 }
 
-void InspectorCanvasAgent::getResourceInfo(ErrorString* errorString, const ResourceId& resourceId, RefPtr<ResourceInfo>& result)
-{
-    InjectedScriptCanvasModule module = injectedScriptCanvasModule(errorString, resourceId);
-    if (!module.hasNoValue())
-        module.resourceInfo(errorString, resourceId, &result);
-}
-
 void InspectorCanvasAgent::getResourceState(ErrorString* errorString, const TraceLogId& traceLogId, const ResourceId& resourceId, RefPtr<ResourceState>& result)
 {
     InjectedScriptCanvasModule module = injectedScriptCanvasModule(errorString, traceLogId);
@@ -287,8 +279,7 @@
             if (frame->page() != m_page)
                 return;
 
-            HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(node);
-            if (canvas->renderingContext())
+            if (toHTMLCanvasElement(node)->renderingContext())
                 m_framesWithUninstrumentedCanvases.set(frame, true);
         }
 
diff --git a/Source/core/inspector/InspectorCanvasAgent.h b/Source/core/inspector/InspectorCanvasAgent.h
index b5a7fe0..e7ba554 100644
--- a/Source/core/inspector/InspectorCanvasAgent.h
+++ b/Source/core/inspector/InspectorCanvasAgent.h
@@ -83,7 +83,6 @@
     virtual void stopCapturing(ErrorString*, const TypeBuilder::Canvas::TraceLogId&);
     virtual void getTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
     virtual void replayTraceLog(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&);
-    virtual void getResourceInfo(ErrorString*, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::ResourceInfo>&);
     virtual void getResourceState(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, const TypeBuilder::Canvas::ResourceId&, RefPtr<TypeBuilder::Canvas::ResourceState>&);
     virtual void evaluateTraceLogCallArgument(ErrorString*, const TypeBuilder::Canvas::TraceLogId&, int, int, const String*, RefPtr<TypeBuilder::Runtime::RemoteObject>&, RefPtr<TypeBuilder::Canvas::ResourceState>&);
 
diff --git a/Source/core/inspector/InspectorClient.h b/Source/core/inspector/InspectorClient.h
index 6fa61c7..d34542a 100644
--- a/Source/core/inspector/InspectorClient.h
+++ b/Source/core/inspector/InspectorClient.h
@@ -28,9 +28,9 @@
 #define InspectorClient_h
 
 #include "core/inspector/InspectorStateClient.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
 
 namespace WebCore {
 
@@ -39,6 +39,7 @@
 class Frame;
 class Page;
 class PlatformKeyboardEvent;
+class PlatformMouseEvent;
 
 class InspectorClient : public InspectorStateClient {
 public:
@@ -67,6 +68,7 @@
     virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&) { }
 
     virtual void dispatchKeyEvent(const PlatformKeyboardEvent&) { }
+    virtual void dispatchMouseEvent(const PlatformMouseEvent&) { }
 
     static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
 
diff --git a/Source/core/inspector/InspectorConsoleAgent.h b/Source/core/inspector/InspectorConsoleAgent.h
index 3d08e74..f233ddc 100644
--- a/Source/core/inspector/InspectorConsoleAgent.h
+++ b/Source/core/inspector/InspectorConsoleAgent.h
@@ -31,11 +31,11 @@
 #include "core/inspector/ConsoleAPITypes.h"
 #include "core/inspector/InspectorBaseAgent.h"
 #include "core/page/ConsoleTypes.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/text/StringHash.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorController.cpp b/Source/core/inspector/InspectorController.cpp
index 196c876..d5def10 100644
--- a/Source/core/inspector/InspectorController.cpp
+++ b/Source/core/inspector/InspectorController.cpp
@@ -107,10 +107,12 @@
     m_memoryAgent = memoryAgentPtr.get();
     m_agents.append(memoryAgentPtr.release());
 
-    m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, domAgent, m_state.get(), InspectorTimelineAgent::PageInspector,
-       inspectorClient));
-    m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));
+    OwnPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, domAgent, m_state.get(),
+        InspectorTimelineAgent::PageInspector, inspectorClient));
+    m_timelineAgent = timelineAgentPtr.get();
+    m_agents.append(timelineAgentPtr.release());
 
+    m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));
     m_agents.append(InspectorResourceAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get(), m_overlay.get()));
 
     PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::shared();
@@ -242,6 +244,11 @@
     IdentifiersFactory::setProcessId(processId);
 }
 
+void InspectorController::setLayerTreeId(int id)
+{
+    m_timelineAgent->setLayerTreeId(id);
+}
+
 void InspectorController::webViewResized(const IntSize& size)
 {
     if (InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent())
diff --git a/Source/core/inspector/InspectorController.h b/Source/core/inspector/InspectorController.h
index 5b20612..ae84e37 100644
--- a/Source/core/inspector/InspectorController.h
+++ b/Source/core/inspector/InspectorController.h
@@ -31,12 +31,11 @@
 #ifndef InspectorController_h
 #define InspectorController_h
 
-
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -50,6 +49,7 @@
 class InspectorFrontendChannel;
 class InspectorFrontendClient;
 class InspectorMemoryAgent;
+class InspectorTimelineAgent;
 class InspectorOverlay;
 class InspectorState;
 class InstrumentingAgents;
@@ -85,6 +85,7 @@
     void reconnectFrontend();
     void reuseFrontend(InspectorFrontendChannel*, const String& inspectorStateCookie);
     void setProcessId(long);
+    void setLayerTreeId(int);
     void webViewResized(const IntSize&);
 
     void inspect(Node*);
@@ -129,6 +130,7 @@
     OwnPtr<InspectorOverlay> m_overlay;
 
     InspectorMemoryAgent* m_memoryAgent;
+    InspectorTimelineAgent* m_timelineAgent;
 
     RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
     OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index c9a1674..9b73579 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -50,6 +50,7 @@
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ElementShadow.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/editing/markup.h"
 #include "core/fileapi/File.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/HTMLFrameOwnerElement.h"
@@ -72,16 +73,14 @@
 #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 "core/editing/markup.h"
-
-#include <wtf/HashSet.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/HashSet.h"
+#include "wtf/ListHashSet.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -230,7 +229,7 @@
     , m_domListener(0)
     , m_lastNodeId(1)
     , m_lastBackendNodeId(-1)
-    , m_searchingForNode(false)
+    , m_searchingForNode(NotSearching)
     , m_suppressAttributeModifiedEvent(false)
 {
 }
@@ -238,7 +237,7 @@
 InspectorDOMAgent::~InspectorDOMAgent()
 {
     reset();
-    ASSERT(!m_searchingForNode);
+    ASSERT(m_searchingForNode == NotSearching);
 }
 
 void InspectorDOMAgent::setFrontend(InspectorFrontend* frontend)
@@ -260,7 +259,7 @@
     m_domEditor.clear();
 
     ErrorString error;
-    setSearchingForNode(&error, false, 0);
+    setSearchingForNode(&error, NotSearching, 0);
     hideHighlight(&error);
 
     m_frontend = 0;
@@ -982,7 +981,7 @@
         for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++it) {
             Document* document = *it;
             ExceptionCode ec = 0;
-            RefPtr<XPathResult> result = document->evaluate(whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, 0, ec);
+            RefPtr<XPathResult> result = DocumentXPathEvaluator::evaluate(document, whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, 0, ec);
             if (ec || !result)
                 continue;
 
@@ -1047,7 +1046,7 @@
 
 bool InspectorDOMAgent::handleMousePress()
 {
-    if (!m_searchingForNode)
+    if (m_searchingForNode == NotSearching)
         return false;
 
     if (Node* node = m_overlay->highlightedNode()) {
@@ -1059,7 +1058,7 @@
 
 bool InspectorDOMAgent::handleTouchEvent(Frame* frame, const PlatformTouchEvent& event)
 {
-    if (!m_searchingForNode)
+    if (m_searchingForNode == NotSearching)
         return false;
     Node* node = hoveredNodeForEvent(frame, event, false);
     if (node && m_inspectModeHighlightConfig) {
@@ -1086,12 +1085,16 @@
 
 void InspectorDOMAgent::handleMouseMove(Frame* frame, const PlatformMouseEvent& event)
 {
-    if (!m_searchingForNode)
+    if (m_searchingForNode == NotSearching)
         return;
 
     if (!frame->view() || !frame->contentRenderer())
         return;
     Node* node = hoveredNodeForEvent(frame, event, event.shiftKey());
+
+    while (m_searchingForNode != SearchingForShadow && node && node->isInShadowTree())
+        node = node->parentOrShadowHostNode();
+
     Node* eventTarget = event.shiftKey() ? hoveredNodeForEvent(frame, event, false) : 0;
     if (eventTarget == node)
         eventTarget = 0;
@@ -1100,13 +1103,13 @@
         m_overlay->highlightNode(node, eventTarget, *m_inspectModeHighlightConfig);
 }
 
-void InspectorDOMAgent::setSearchingForNode(ErrorString* errorString, bool enabled, JSONObject* highlightInspectorObject)
+void InspectorDOMAgent::setSearchingForNode(ErrorString* errorString, SearchMode searchMode, JSONObject* highlightInspectorObject)
 {
-    if (m_searchingForNode == enabled)
+    if (m_searchingForNode == searchMode)
         return;
-    m_searchingForNode = enabled;
-    m_overlay->setInspectModeEnabled(enabled);
-    if (enabled) {
+    m_searchingForNode = searchMode;
+    m_overlay->setInspectModeEnabled(searchMode != NotSearching);
+    if (searchMode != NotSearching) {
         m_inspectModeHighlightConfig = highlightConfigFromInspectorObject(errorString, highlightInspectorObject);
         if (!m_inspectModeHighlightConfig)
             return;
@@ -1137,9 +1140,10 @@
     return highlightConfig.release();
 }
 
-void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool enabled, const RefPtr<JSONObject>* highlightConfig)
+void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool enabled, const bool* inspectShadowDOM, const RefPtr<JSONObject>* highlightConfig)
 {
-    setSearchingForNode(errorString, enabled, highlightConfig ? highlightConfig->get() : 0);
+    SearchMode searchMode = enabled ? (inspectShadowDOM && *inspectShadowDOM ? SearchingForShadow : SearchingForNormal) : NotSearching;
+    setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConfig->get() : 0);
 }
 
 void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<JSONObject>* color, const RefPtr<JSONObject>* outlineColor)
diff --git a/Source/core/inspector/InspectorDOMAgent.h b/Source/core/inspector/InspectorDOMAgent.h
index a7aed5d..17e7a5e 100644
--- a/Source/core/inspector/InspectorDOMAgent.h
+++ b/Source/core/inspector/InspectorDOMAgent.h
@@ -133,7 +133,7 @@
     virtual void discardSearchResults(ErrorString*, const String& searchId);
     virtual void resolveNode(ErrorString*, int nodeId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& result);
     virtual void getAttributes(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<String> >& result);
-    virtual void setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<JSONObject>* highlightConfig);
+    virtual void setInspectModeEnabled(ErrorString*, bool enabled, const bool* inspectShadowDOM, const RefPtr<JSONObject>* highlightConfig);
     virtual void requestNode(ErrorString*, const String& objectId, int* nodeId);
     virtual void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId);
     virtual void pushNodeByBackendIdToFrontend(ErrorString*, BackendNodeId, int* nodeId);
@@ -205,9 +205,11 @@
     InspectorPageAgent* pageAgent() { return m_pageAgent; }
 
 private:
+    enum SearchMode { NotSearching, SearchingForNormal, SearchingForShadow };
+
     InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorCompositeState*, InjectedScriptManager*, InspectorOverlay*, InspectorClient*);
 
-    void setSearchingForNode(ErrorString*, bool enabled, JSONObject* highlightConfig);
+    void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConfig);
     PassOwnPtr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString*, JSONObject* highlightInspectorObject);
 
     // Node-related methods.
@@ -260,7 +262,7 @@
     typedef HashMap<String, Vector<RefPtr<Node> > > SearchResults;
     SearchResults m_searchResults;
     OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask;
-    bool m_searchingForNode;
+    SearchMode m_searchingForNode;
     OwnPtr<HighlightConfig> m_inspectModeHighlightConfig;
     OwnPtr<InspectorHistory> m_history;
     OwnPtr<DOMEditor> m_domEditor;
diff --git a/Source/core/inspector/InspectorDOMDebuggerAgent.cpp b/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
index 5d76e88..c6eb6fa 100644
--- a/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
@@ -66,6 +66,8 @@
 static const char* const clearTimerEventName = "clearTimer";
 static const char* const timerFiredEventName = "timerFired";
 static const char* const webglErrorFiredEventName = "webglErrorFired";
+static const char* const webglWarningFiredEventName = "webglWarningFired";
+static const char* const webglErrorNameProperty = "webglErrorName";
 
 namespace DOMDebuggerAgentState {
 static const char eventListenerBreakpoints[] = "eventListenerBreakpoints";
@@ -445,10 +447,24 @@
     RefPtr<JSONObject> eventData = preparePauseOnNativeEventData(false, webglErrorFiredEventName);
     if (!eventData)
         return;
-    eventData->setString("webglErrorName", errorName);
+    if (!errorName.isEmpty())
+        eventData->setString(webglErrorNameProperty, errorName);
     pauseOnNativeEventIfNeeded(eventData.release(), m_debuggerAgent->canBreakProgram());
 }
 
+void InspectorDOMDebuggerAgent::didFireWebGLWarning()
+{
+    pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(false, webglWarningFiredEventName), m_debuggerAgent->canBreakProgram());
+}
+
+void InspectorDOMDebuggerAgent::didFireWebGLErrorOrWarning(const String& message)
+{
+    if (message.findIgnoringCase("error") != WTF::notFound)
+        didFireWebGLError(String());
+    else
+        didFireWebGLWarning();
+}
+
 void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString*, const String& url)
 {
     if (url.isEmpty()) {
diff --git a/Source/core/inspector/InspectorDOMDebuggerAgent.h b/Source/core/inspector/InspectorDOMDebuggerAgent.h
index 18d3698..5715851 100644
--- a/Source/core/inspector/InspectorDOMDebuggerAgent.h
+++ b/Source/core/inspector/InspectorDOMDebuggerAgent.h
@@ -86,6 +86,8 @@
     void willFireAnimationFrame(Document*, int callbackId);
     void willHandleEvent(Event*);
     void didFireWebGLError(const String& errorName);
+    void didFireWebGLWarning();
+    void didFireWebGLErrorOrWarning(const String& message);
 
     void didProcessTask();
 
diff --git a/Source/core/inspector/InspectorDOMStorageAgent.cpp b/Source/core/inspector/InspectorDOMStorageAgent.cpp
index 65f4812..2fae759 100644
--- a/Source/core/inspector/InspectorDOMStorageAgent.cpp
+++ b/Source/core/inspector/InspectorDOMStorageAgent.cpp
@@ -60,7 +60,7 @@
     switch (ec) {
     case 0:
         return false;
-    case SECURITY_ERR:
+    case SecurityError:
         *errorString = "Security error";
         return true;
     default:
diff --git a/Source/core/inspector/InspectorDatabaseAgent.cpp b/Source/core/inspector/InspectorDatabaseAgent.cpp
index 2fbc619..2b3ad25 100644
--- a/Source/core/inspector/InspectorDatabaseAgent.cpp
+++ b/Source/core/inspector/InspectorDatabaseAgent.cpp
@@ -27,7 +27,6 @@
  */
 
 #include "config.h"
-
 #include "core/inspector/InspectorDatabaseAgent.h"
 
 #include "InspectorFrontend.h"
@@ -50,8 +49,7 @@
 #include "modules/webdatabase/SQLTransaction.h"
 #include "modules/webdatabase/SQLTransactionCallback.h"
 #include "modules/webdatabase/SQLTransactionErrorCallback.h"
-
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 typedef WebCore::InspectorBackendDispatcher::DatabaseCommandHandler::ExecuteSQLCallback ExecuteSQLCallback;
 
diff --git a/Source/core/inspector/InspectorDatabaseAgent.h b/Source/core/inspector/InspectorDatabaseAgent.h
index 39eb8ed..eca0474 100644
--- a/Source/core/inspector/InspectorDatabaseAgent.h
+++ b/Source/core/inspector/InspectorDatabaseAgent.h
@@ -31,9 +31,9 @@
 
 #include "InspectorFrontend.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/HashMap.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorDatabaseResource.h b/Source/core/inspector/InspectorDatabaseResource.h
index 6644fa2..24c1fd8 100644
--- a/Source/core/inspector/InspectorDatabaseResource.h
+++ b/Source/core/inspector/InspectorDatabaseResource.h
@@ -32,10 +32,10 @@
 #define InspectorDatabaseResource_h
 
 #include "InspectorFrontend.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 class Database;
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index b3e2640..3b63ded 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -29,6 +29,7 @@
 
 #include "config.h"
 #include "core/inspector/InspectorDebuggerAgent.h"
+#include "core/inspector/JavaScriptCallFrame.h"
 
 #include "InspectorFrontend.h"
 #include "bindings/v8/ScriptDebugServer.h"
@@ -59,6 +60,14 @@
 static const char debuggerEnabled[] = "debuggerEnabled";
 static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState";
+
+// Breakpoint properties.
+static const char url[] = "url";
+static const char isRegex[] = "isRegex";
+static const char lineNumber[] = "lineNumber";
+static const char columnNumber[] = "columnNumber";
+static const char condition[] = "condition";
+static const char isAnti[] = "isAnti";
 };
 
 const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace";
@@ -199,7 +208,7 @@
 
 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageType type)
 {
-    if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions && source == ConsoleAPIMessageSource && type == AssertMessageType)
+    if (source == ConsoleAPIMessageSource && type == AssertMessageType && scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions)
         breakProgram(InspectorFrontend::Debugger::Reason::Assert, 0);
 }
 
@@ -214,14 +223,15 @@
 }
 
 
-static PassRefPtr<JSONObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, bool isRegex)
+static PassRefPtr<JSONObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, bool isRegex, bool isAnti)
 {
     RefPtr<JSONObject> breakpointObject = JSONObject::create();
-    breakpointObject->setString("url", url);
-    breakpointObject->setNumber("lineNumber", lineNumber);
-    breakpointObject->setNumber("columnNumber", columnNumber);
-    breakpointObject->setString("condition", condition);
-    breakpointObject->setBoolean("isRegex", isRegex);
+    breakpointObject->setString(DebuggerAgentState::url, url);
+    breakpointObject->setNumber(DebuggerAgentState::lineNumber, lineNumber);
+    breakpointObject->setNumber(DebuggerAgentState::columnNumber, columnNumber);
+    breakpointObject->setString(DebuggerAgentState::condition, condition);
+    breakpointObject->setBoolean(DebuggerAgentState::isRegex, isRegex);
+    breakpointObject->setBoolean(DebuggerAgentState::isAnti, isAnti);
     return breakpointObject;
 }
 
@@ -234,7 +244,7 @@
     return url == pattern;
 }
 
-void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, TypeBuilder::Debugger::BreakpointId* outBreakpointId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations)
+void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, const bool* isAntiBreakpoint, TypeBuilder::Debugger::BreakpointId* outBreakpointId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations)
 {
     locations = Array<TypeBuilder::Debugger::Location>::create();
     if (!optionalURL == !optionalURLRegex) {
@@ -242,6 +252,8 @@
         return;
     }
 
+    bool isAntiBreakpointValue = isAntiBreakpoint && *isAntiBreakpoint;
+
     String url = optionalURL ? *optionalURL : *optionalURLRegex;
     int columnNumber = optionalColumnNumber ? *optionalColumnNumber : 0;
     String condition = optionalCondition ? *optionalCondition : "";
@@ -254,16 +266,18 @@
         return;
     }
 
-    breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(url, lineNumber, columnNumber, condition, isRegex));
+    breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(url, lineNumber, columnNumber, condition, isRegex, isAntiBreakpointValue));
     m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie);
 
-    ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
-    for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) {
-        if (!matches(it->value.url, url, isRegex))
-            continue;
-        RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(breakpointId, it->key, breakpoint, UserBreakpointSource);
-        if (location)
-            locations->addItem(location);
+    if (!isAntiBreakpointValue) {
+        ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
+        for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) {
+            if (!matches(it->value.url, url, isRegex))
+                continue;
+            RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(breakpointId, it->key, breakpoint, UserBreakpointSource);
+            if (location)
+                locations->addItem(location);
+        }
     }
     *outBreakpointId = breakpointId;
 }
@@ -307,10 +321,17 @@
 void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakpointId)
 {
     RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints);
-    breakpointsCookie->remove(breakpointId);
-    m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie);
+    JSONObject::iterator it = breakpointsCookie->find(breakpointId);
+    bool isAntibreakpoint = false;
+    if (it != breakpointsCookie->end()) {
+        RefPtr<JSONObject> breakpointObject = it->value->asObject();
+        breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoint);
+        breakpointsCookie->remove(breakpointId);
+        m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie);
+    }
 
-    removeBreakpoint(breakpointId);
+    if (!isAntibreakpoint)
+        removeBreakpoint(breakpointId);
 }
 
 void InspectorDebuggerAgent::removeBreakpoint(const String& breakpointId)
@@ -326,8 +347,9 @@
     m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIterator);
 }
 
-void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<JSONObject>& location)
+void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<JSONObject>& location, const bool* interstateLocationOpt)
 {
+    bool interstateLocation = interstateLocationOpt ? *interstateLocationOpt : false;
     if (!m_continueToLocationBreakpointId.isEmpty()) {
         scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
         m_continueToLocationBreakpointId = "";
@@ -341,10 +363,56 @@
         return;
 
     ScriptBreakpoint breakpoint(lineNumber, columnNumber, "");
-    m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber);
+    m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber, interstateLocation);
     resume(errorString);
 }
 
+bool InspectorDebuggerAgent::shouldSkipPause(RefPtr<JavaScriptCallFrame>& topFrame)
+{
+    // Prepare top frame parameters;
+    int topFrameLineNumber = topFrame->line();
+    int topFrameColumnNumber = topFrame->column();
+    String topFrameScriptIdString = String::number(topFrame->sourceID());
+    String topFrameScriptUrl;
+    {
+        ScriptsMap::iterator it = m_scripts.find(topFrameScriptIdString);
+        if (it != m_scripts.end())
+            topFrameScriptUrl = it->value.url;
+    }
+
+    // Match against breakpoints.
+    if (topFrameScriptUrl.isEmpty())
+        return false;
+
+    RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints);
+    for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpointsCookie->end(); ++it) {
+        RefPtr<JSONObject> breakpointObject = it->value->asObject();
+        bool isAntibreakpoint;
+        breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoint);
+        if (!isAntibreakpoint)
+            continue;
+
+        int breakLineNumber;
+        breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakLineNumber);
+        int breakColumnNumber;
+        breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakColumnNumber);
+
+        if (breakLineNumber != topFrameLineNumber || breakColumnNumber != topFrameColumnNumber)
+            continue;
+
+        bool isRegex;
+        breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
+        String url;
+        breakpointObject->getString(DebuggerAgentState::url, &url);
+        if (!matches(topFrameScriptUrl, url, isRegex))
+            continue;
+
+        return true;
+    }
+
+    return false;
+}
+
 PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint& breakpoint, BreakpointSource source)
 {
     ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId);
@@ -356,7 +424,7 @@
 
     int actualLineNumber;
     int actualColumnNumber;
-    String debugServerBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber);
+    String debugServerBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber, false);
     if (debugServerBreakpointId.isEmpty())
         return 0;
 
@@ -706,16 +774,20 @@
     RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints);
     for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpointsCookie->end(); ++it) {
         RefPtr<JSONObject> breakpointObject = it->value->asObject();
+        bool isAntibreakpoint;
+        breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoint);
+        if (isAntibreakpoint)
+            continue;
         bool isRegex;
-        breakpointObject->getBoolean("isRegex", &isRegex);
+        breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
         String url;
-        breakpointObject->getString("url", &url);
+        breakpointObject->getString(DebuggerAgentState::url, &url);
         if (!matches(scriptURL, url, isRegex))
             continue;
         ScriptBreakpoint breakpoint;
-        breakpointObject->getNumber("lineNumber", &breakpoint.lineNumber);
-        breakpointObject->getNumber("columnNumber", &breakpoint.columnNumber);
-        breakpointObject->getString("condition", &breakpoint.condition);
+        breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.lineNumber);
+        breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoint.columnNumber);
+        breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.condition);
         RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it->key, scriptId, breakpoint, UserBreakpointSource);
         if (location)
             m_frontend->breakpointResolved(it->key, location);
diff --git a/Source/core/inspector/InspectorDebuggerAgent.h b/Source/core/inspector/InspectorDebuggerAgent.h
index d34cff0..082d040 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.h
+++ b/Source/core/inspector/InspectorDebuggerAgent.h
@@ -87,10 +87,10 @@
     virtual void disable(ErrorString*);
     virtual void setBreakpointsActive(ErrorString*, bool active);
 
-    virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const String* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations);
+    virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const String* optionalCondition, const bool* isAntiBreakpoint, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations);
     virtual void setBreakpoint(ErrorString*, const RefPtr<JSONObject>& location, const String* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder::Debugger::Location>& actualLocation);
     virtual void removeBreakpoint(ErrorString*, const String& breakpointId);
-    virtual void continueToLocation(ErrorString*, const RefPtr<JSONObject>& location);
+    virtual void continueToLocation(ErrorString*, const RefPtr<JSONObject>& location, const bool* interstateLocationOpt);
 
     virtual void searchInContent(ErrorString*, const String& scriptId, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&);
     virtual void setScriptSource(ErrorString*, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, const String& scriptId, const String& newContent, const bool* preview, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<JSONObject>& result);
@@ -153,6 +153,8 @@
     virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0;
     virtual void addConsoleMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL) = 0;
 
+    virtual bool shouldSkipPause(RefPtr<JavaScriptCallFrame>& topFrame);
+
     virtual void enable();
     virtual void disable();
     virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints);
diff --git a/Source/core/inspector/InspectorFileSystemAgent.h b/Source/core/inspector/InspectorFileSystemAgent.h
index 4b38b8c..5406b90 100644
--- a/Source/core/inspector/InspectorFileSystemAgent.h
+++ b/Source/core/inspector/InspectorFileSystemAgent.h
@@ -32,9 +32,8 @@
 #define InspectorFileSystemAgent_h
 
 #include "core/inspector/InspectorBaseAgent.h"
-
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorFrontendChannel.h b/Source/core/inspector/InspectorFrontendChannel.h
index b3214ef..f5a19a1 100644
--- a/Source/core/inspector/InspectorFrontendChannel.h
+++ b/Source/core/inspector/InspectorFrontendChannel.h
@@ -26,7 +26,7 @@
 #ifndef InspectorFrontendChannel_h
 #define InspectorFrontendChannel_h
 
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorFrontendClient.h b/Source/core/inspector/InspectorFrontendClient.h
index 88f4df3..2116969 100644
--- a/Source/core/inspector/InspectorFrontendClient.h
+++ b/Source/core/inspector/InspectorFrontendClient.h
@@ -31,8 +31,8 @@
 #ifndef InspectorFrontendClient_h
 #define InspectorFrontendClient_h
 
-#include <wtf/Forward.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorHeapProfilerAgent.cpp b/Source/core/inspector/InspectorHeapProfilerAgent.cpp
index 382b2c6..4418eaf 100644
--- a/Source/core/inspector/InspectorHeapProfilerAgent.cpp
+++ b/Source/core/inspector/InspectorHeapProfilerAgent.cpp
@@ -37,8 +37,8 @@
 #include "core/inspector/InjectedScriptHost.h"
 #include "core/inspector/InspectorState.h"
 #include "core/platform/Timer.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/MemoryInstrumentationHashMap.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorHeapProfilerAgent.h b/Source/core/inspector/InspectorHeapProfilerAgent.h
index 03ac560..b613a23 100644
--- a/Source/core/inspector/InspectorHeapProfilerAgent.h
+++ b/Source/core/inspector/InspectorHeapProfilerAgent.h
@@ -31,15 +31,14 @@
 #ifndef InspectorHeapProfilerAgent_h
 #define InspectorHeapProfilerAgent_h
 
-
 #include "InspectorFrontend.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorHistory.h b/Source/core/inspector/InspectorHistory.h
index 36504ce..72fd5bc 100644
--- a/Source/core/inspector/InspectorHistory.h
+++ b/Source/core/inspector/InspectorHistory.h
@@ -32,10 +32,9 @@
 #define InspectorHistory_h
 
 #include "core/dom/ExceptionCode.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/OwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorIndexedDBAgent.cpp b/Source/core/inspector/InspectorIndexedDBAgent.cpp
index d138931..41db3ba 100644
--- a/Source/core/inspector/InspectorIndexedDBAgent.cpp
+++ b/Source/core/inspector/InspectorIndexedDBAgent.cpp
@@ -29,9 +29,10 @@
  */
 
 #include "config.h"
-
 #include "core/inspector/InspectorIndexedDBAgent.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/DOMStringList.h"
 #include "core/dom/Document.h"
@@ -58,8 +59,7 @@
 #include "modules/indexeddb/IDBRequest.h"
 #include "modules/indexeddb/IDBTransaction.h"
 #include "weborigin/SecurityOrigin.h"
-
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 using WebCore::TypeBuilder::Array;
 using WebCore::TypeBuilder::IndexedDB::DatabaseWithObjectStores;
@@ -109,9 +109,9 @@
         }
 
         IDBRequest* idbRequest = static_cast<IDBRequest*>(event->target());
-        ExceptionCode ec = 0;
-        RefPtr<IDBAny> requestResult = idbRequest->result(ec);
-        if (ec) {
+        NonThrowExceptionState es;
+        RefPtr<IDBAny> requestResult = idbRequest->result(es);
+        if (es.hadException()) {
             m_requestCallback->sendFailure("Could not get result in callback.");
             return;
         }
@@ -171,9 +171,9 @@
         }
 
         IDBOpenDBRequest* idbOpenDBRequest = static_cast<IDBOpenDBRequest*>(event->target());
-        ExceptionCode ec = 0;
-        RefPtr<IDBAny> requestResult = idbOpenDBRequest->result(ec);
-        if (ec) {
+        NonThrowExceptionState es;
+        RefPtr<IDBAny> requestResult = idbOpenDBRequest->result(es);
+        if (es.hadException()) {
             m_executableWithDatabase->requestCallback()->sendFailure("Could not get result in callback.");
             return;
         }
@@ -198,9 +198,9 @@
 void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, const String& databaseName)
 {
     RefPtr<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this);
-    ExceptionCode ec = 0;
-    RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(context(), databaseName, ec);
-    if (ec) {
+    NonThrowExceptionState es;
+    RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(context(), databaseName, es);
+    if (es.hadException()) {
         requestCallback()->sendFailure("Could not open database.");
         return;
     }
@@ -209,27 +209,27 @@
 
 static PassRefPtr<IDBTransaction> transactionForDatabase(ScriptExecutionContext* scriptExecutionContext, IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())
 {
-    ExceptionCode ec = 0;
-    RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(scriptExecutionContext, objectStoreName, mode, ec);
-    if (ec)
+    NonThrowExceptionState es;
+    RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(scriptExecutionContext, objectStoreName, mode, es);
+    if (es.hadException())
         return 0;
     return idbTransaction;
 }
 
 static PassRefPtr<IDBObjectStore> objectStoreForTransaction(IDBTransaction* idbTransaction, const String& objectStoreName)
 {
-    ExceptionCode ec = 0;
-    RefPtr<IDBObjectStore> idbObjectStore = idbTransaction->objectStore(objectStoreName, ec);
-    if (ec)
+    NonThrowExceptionState es;
+    RefPtr<IDBObjectStore> idbObjectStore = idbTransaction->objectStore(objectStoreName, es);
+    if (es.hadException())
         return 0;
     return idbObjectStore;
 }
 
 static PassRefPtr<IDBIndex> indexForObjectStore(IDBObjectStore* idbObjectStore, const String& indexName)
 {
-    ExceptionCode ec = 0;
-    RefPtr<IDBIndex> idbIndex = idbObjectStore->index(indexName, ec);
-    if (ec)
+    NonThrowExceptionState es;
+    RefPtr<IDBIndex> idbIndex = idbObjectStore->index(indexName, es);
+    if (es.hadException())
         return 0;
     return idbIndex;
 }
@@ -415,9 +415,9 @@
         }
 
         IDBRequest* idbRequest = static_cast<IDBRequest*>(event->target());
-        ExceptionCode ec = 0;
-        RefPtr<IDBAny> requestResult = idbRequest->result(ec);
-        if (ec) {
+        NonThrowExceptionState es;
+        RefPtr<IDBAny> requestResult = idbRequest->result(es);
+        if (es.hadException()) {
             m_requestCallback->sendFailure("Could not get result in callback.");
             return;
         }
@@ -433,9 +433,9 @@
         RefPtr<IDBCursorWithValue> idbCursor = requestResult->idbCursorWithValue();
 
         if (m_skipCount) {
-            ExceptionCode ec = 0;
-            idbCursor->advance(m_skipCount, ec);
-            if (ec)
+            NonThrowExceptionState es;
+            idbCursor->advance(m_skipCount, es);
+            if (es.hadException())
                 m_requestCallback->sendFailure("Could not advance cursor.");
             m_skipCount = 0;
             return;
@@ -447,8 +447,8 @@
         }
 
         // Continue cursor before making injected script calls, otherwise transaction might be finished.
-        idbCursor->continueFunction(0, ec);
-        if (ec) {
+        idbCursor->continueFunction(0, es);
+        if (es.hadException()) {
             m_requestCallback->sendFailure("Could not continue cursor.");
             return;
         }
@@ -512,7 +512,6 @@
 
         RefPtr<OpenCursorCallback> openCursorCallback = OpenCursorCallback::create(m_injectedScript, m_requestCallback, m_skipCount, m_pageSize);
 
-        ExceptionCode ec = 0;
         RefPtr<IDBRequest> idbRequest;
         if (!m_indexName.isEmpty()) {
             RefPtr<IDBIndex> idbIndex = indexForObjectStore(idbObjectStore.get(), m_indexName);
@@ -521,9 +520,10 @@
                 return;
             }
 
-            idbRequest = idbIndex->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), ec);
-        } else
-            idbRequest = idbObjectStore->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), ec);
+            idbRequest = idbIndex->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), IGNORE_EXCEPTION_STATE);
+        } else {
+            idbRequest = idbObjectStore->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IDBCursor::directionNext(), IGNORE_EXCEPTION_STATE);
+        }
         idbRequest->addEventListener(eventNames().successEvent, openCursorCallback, false);
     }
 
@@ -623,9 +623,9 @@
     ASSERT(!context.IsEmpty());
     v8::Context::Scope contextScope(context);
 
-    ExceptionCode ec = 0;
-    RefPtr<IDBRequest> idbRequest = idbFactory->getDatabaseNames(document, ec);
-    if (ec) {
+    NonThrowExceptionState es;
+    RefPtr<IDBRequest> idbRequest = idbFactory->getDatabaseNames(document, es);
+    if (es.hadException()) {
         requestCallback->sendFailure("Could not obtain database names.");
         return;
     }
@@ -747,10 +747,11 @@
             return;
         }
 
-        ExceptionCode ec = 0;
-        RefPtr<IDBRequest> idbRequest = idbObjectStore->clear(context(), ec);
-        ASSERT(!ec);
-        if (ec) {
+        NonThrowExceptionState es;
+        RefPtr<IDBRequest> idbRequest = idbObjectStore->clear(context(), es);
+        ASSERT(!es.hadException());
+        if (es.hadException()) {
+            ExceptionCode ec = es;
             m_requestCallback->sendFailure(String::format("Could not clear object store '%s': %d", m_objectStoreName.utf8().data(), ec));
             return;
         }
diff --git a/Source/core/inspector/InspectorIndexedDBAgent.h b/Source/core/inspector/InspectorIndexedDBAgent.h
index f008585..237af20 100644
--- a/Source/core/inspector/InspectorIndexedDBAgent.h
+++ b/Source/core/inspector/InspectorIndexedDBAgent.h
@@ -32,8 +32,8 @@
 #define InspectorIndexedDBAgent_h
 
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorInputAgent.cpp b/Source/core/inspector/InspectorInputAgent.cpp
index 0f179bf..e3886e3 100644
--- a/Source/core/inspector/InspectorInputAgent.cpp
+++ b/Source/core/inspector/InspectorInputAgent.cpp
@@ -33,7 +33,6 @@
 
 #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/page/Page.h"
@@ -43,9 +42,8 @@
 #include "core/platform/graphics/IntPoint.h"
 #include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/IntSize.h"
-
-#include <wtf/CurrentTime.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -138,20 +136,7 @@
         convertedModifiers & PlatformEvent::MetaKey,
         timestamp ? *timestamp : currentTime());
 
-    EventHandler* handler = m_page->mainFrame()->eventHandler();
-    switch (convertedType) {
-    case PlatformEvent::MousePressed:
-        handler->handleMousePressEvent(event);
-        break;
-    case PlatformEvent::MouseReleased:
-        handler->handleMouseReleaseEvent(event);
-        break;
-    case PlatformEvent::MouseMoved:
-        handler->handleMouseMoveEvent(event);
-        break;
-    default:
-        *error = "Unhandled type: " + type;
-    }
+    m_client->dispatchMouseEvent(event);
 }
 
 } // namespace WebCore
diff --git a/Source/core/inspector/InspectorInputAgent.h b/Source/core/inspector/InspectorInputAgent.h
index d329529..ecd0d84 100644
--- a/Source/core/inspector/InspectorInputAgent.h
+++ b/Source/core/inspector/InspectorInputAgent.h
@@ -31,12 +31,10 @@
 #ifndef InspectorInputAgent_h
 #define InspectorInputAgent_h
 
-
 #include "core/inspector/InspectorBaseAgent.h"
-
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 class InspectorClient;
diff --git a/Source/core/inspector/InspectorInstrumentation.cpp b/Source/core/inspector/InspectorInstrumentation.cpp
index fc2937f..462ba0b 100644
--- a/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/Source/core/inspector/InspectorInstrumentation.cpp
@@ -234,12 +234,14 @@
 const char Paint[] = "Paint";
 const char Layer[] = "Layer";
 const char BeginFrame[] = "BeginFrame";
+const char UpdateLayer[] = "UpdateLayer";
 };
 
 namespace InstrumentationEventArguments {
 const char LayerId[] = "layerId";
-const char PageId[] = "pageId";
+const char LayerTreeId[] = "layerTreeId";
 const char NodeId[] = "nodeId";
+const char PageId[] = "pageId";
 };
 
 InstrumentingAgents* instrumentationForPage(Page* page)
diff --git a/Source/core/inspector/InspectorInstrumentation.h b/Source/core/inspector/InspectorInstrumentation.h
index 85421bf..4b0b37d 100644
--- a/Source/core/inspector/InspectorInstrumentation.h
+++ b/Source/core/inspector/InspectorInstrumentation.h
@@ -151,12 +151,14 @@
 extern const char Paint[];
 extern const char Layer[];
 extern const char BeginFrame[];
+extern const char UpdateLayer[];
 };
 
 namespace InstrumentationEventArguments {
 extern const char LayerId[];
-extern const char PageId[];
+extern const char LayerTreeId[];
 extern const char NodeId[];
+extern const char PageId[];
 };
 
 namespace InspectorInstrumentation {
@@ -172,9 +174,7 @@
 
 inline InstrumentingAgents* instrumentingAgentsForFrame(Frame* frame)
 {
-    if (frame)
-        return instrumentingAgentsForPage(frame->page());
-    return 0;
+    return frame ? instrumentingAgentsForPage(frame->page()) : 0;
 }
 
 inline InstrumentingAgents* instrumentingAgentsForDocument(Document* document)
@@ -190,7 +190,7 @@
 
 inline InstrumentingAgents* instrumentingAgentsForElement(Element* element)
 {
-    return instrumentingAgentsForDocument(element->document());
+    return element ? instrumentingAgentsForDocument(element->document()) : 0;
 }
 
 bool cssErrorFilter(const CSSParserString& content, int propertyId, int errorType);
diff --git a/Source/core/inspector/InspectorInstrumentation.idl b/Source/core/inspector/InspectorInstrumentation.idl
index f90e47e..4b01aad 100644
--- a/Source/core/inspector/InspectorInstrumentation.idl
+++ b/Source/core/inspector/InspectorInstrumentation.idl
@@ -119,7 +119,13 @@
     void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
 
     [DOMDebugger, Inline=FastReturn]
-    void didFireWebGLError(Document*, const String& errorName);
+    void didFireWebGLError(Element*, const String& errorName);
+
+    [DOMDebugger, Inline=FastReturn]
+    void didFireWebGLWarning(Element*);
+
+    [DOMDebugger, Inline=FastReturn]
+    void didFireWebGLErrorOrWarning(Element*, const String& message);
 
     [Timeline, Inline=FastReturn]
     void didScheduleResourceRequest([Keep] Document*, const String& url);
diff --git a/Source/core/inspector/InspectorMemoryAgent.h b/Source/core/inspector/InspectorMemoryAgent.h
index bc39faa..5be09e0 100644
--- a/Source/core/inspector/InspectorMemoryAgent.h
+++ b/Source/core/inspector/InspectorMemoryAgent.h
@@ -31,11 +31,10 @@
 #ifndef InspectorMemoryAgent_h
 #define InspectorMemoryAgent_h
 
-
 #include "InspectorFrontend.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorOverlay.h b/Source/core/inspector/InspectorOverlay.h
index 574222e..ca1f411 100644
--- a/Source/core/inspector/InspectorOverlay.h
+++ b/Source/core/inspector/InspectorOverlay.h
@@ -33,12 +33,11 @@
 #include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/LayoutRect.h"
 #include "core/platform/Timer.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 7c33d1b..cafe343 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -51,6 +51,7 @@
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/CookieJar.h"
 #include "core/loader/DocumentLoader.h"
+#include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/TextResourceDecoder.h"
 #include "core/loader/cache/CachedCSSStyleSheet.h"
@@ -454,7 +455,8 @@
 {
     UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture);
     Frame* frame = m_page->mainFrame();
-    frame->loader()->changeLocation(frame->document()->securityOrigin(), frame->document()->completeURL(url), "", false);
+    FrameLoadRequest request(frame->document()->securityOrigin(), ResourceRequest(frame->document()->completeURL(url)));
+    frame->loader()->load(request);
 }
 
 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
diff --git a/Source/core/inspector/InspectorProfilerAgent.h b/Source/core/inspector/InspectorProfilerAgent.h
index d30be1e..a04b432 100644
--- a/Source/core/inspector/InspectorProfilerAgent.h
+++ b/Source/core/inspector/InspectorProfilerAgent.h
@@ -30,14 +30,13 @@
 #ifndef InspectorProfilerAgent_h
 #define InspectorProfilerAgent_h
 
-
 #include "InspectorFrontend.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorResourceAgent.cpp b/Source/core/inspector/InspectorResourceAgent.cpp
index 9b15d6e..e0459b4 100644
--- a/Source/core/inspector/InspectorResourceAgent.cpp
+++ b/Source/core/inspector/InspectorResourceAgent.cpp
@@ -703,8 +703,9 @@
         memoryCache()->evictResources();
 }
 
-void InspectorResourceAgent::loadResourceForFrontend(ErrorString* errorString, const String& frameId, const String& url, const RefPtr<JSONObject>* requestHeaders, PassRefPtr<LoadResourceForFrontendCallback> callback)
+void InspectorResourceAgent::loadResourceForFrontend(ErrorString* errorString, const String& frameId, const String& url, const RefPtr<JSONObject>* requestHeaders, PassRefPtr<LoadResourceForFrontendCallback> prpCallback)
 {
+    RefPtr<LoadResourceForFrontendCallback> callback = prpCallback;
     Frame* frame = m_pageAgent->assertFrame(errorString, frameId);
     if (!frame)
         return;
@@ -739,6 +740,7 @@
     ThreadableLoaderOptions options;
     options.allowCredentials = DoNotAllowStoredCredentials;
     options.crossOriginRequestPolicy = AllowCrossOriginRequests;
+    options.sendLoadCallbacks = SendCallbacks;
 
     InspectorThreadableLoaderClient* inspectorThreadableLoaderClient = new InspectorThreadableLoaderClient(callback);
     RefPtr<DocumentThreadableLoader> loader = DocumentThreadableLoader::create(document, inspectorThreadableLoaderClient, request, options);
@@ -747,6 +749,8 @@
         return;
     }
     loader->setDefersLoading(false);
+    if (!callback->isActive())
+        return;
     inspectorThreadableLoaderClient->setLoader(loader.release());
 }
 
diff --git a/Source/core/inspector/InspectorStateClient.h b/Source/core/inspector/InspectorStateClient.h
index 214c707..4719d12 100644
--- a/Source/core/inspector/InspectorStateClient.h
+++ b/Source/core/inspector/InspectorStateClient.h
@@ -26,7 +26,7 @@
 #ifndef InspectorStateClient_h
 #define InspectorStateClient_h
 
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
index e001e72..c46fff1 100644
--- a/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/Source/core/inspector/InspectorStyleSheet.cpp
@@ -556,7 +556,7 @@
     DEFINE_STATIC_LOCAL(String, bogusPropertyName, (ASCIILiteral("-webkit-boguz-propertee")));
 
     if (!m_parentStyleSheet->ensureParsedDataReady()) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -574,34 +574,34 @@
 
         // At least one property + the bogus property added just above should be present.
         if (propertyCount < 2) {
-            ec = SYNTAX_ERR;
+            ec = SyntaxError;
             return false;
         }
 
         // Check for the proper propertyText termination (the parser could at least restore to the PROPERTY_NAME state).
         if (propertyData.at(propertyCount - 1).name != bogusPropertyName) {
-            ec = SYNTAX_ERR;
+            ec = SyntaxError;
             return false;
         }
     }
 
     RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
     if (!sourceData) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     String text;
     bool success = styleText(&text);
     if (!success) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     InspectorStyleTextEditor editor(&allProperties, text, newLineAndWhitespaceDelimiters());
     if (overwrite) {
         if (index >= allProperties.size()) {
-            ec = INDEX_SIZE_ERR;
+            ec = IndexSizeError;
             return false;
         }
         *oldText = allProperties.at(index).rawText;
@@ -616,27 +616,27 @@
 {
     ASSERT(m_parentStyleSheet);
     if (!m_parentStyleSheet->ensureParsedDataReady()) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
+        ec = NoModificationAllowedError;
         return false;
     }
 
     RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
     if (!sourceData) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     String text;
     bool success = styleText(&text);
     if (!success) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     Vector<InspectorStyleProperty> allProperties;
     populateAllProperties(allProperties);
     if (index >= allProperties.size()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return false;
     }
 
@@ -1041,7 +1041,7 @@
 {
     CSSStyleRule* rule = ruleForId(id);
     if (!rule) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return "";
     }
     return rule->selectorText();
@@ -1053,19 +1053,19 @@
         return false;
     CSSStyleRule* rule = ruleForId(id);
     if (!rule) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
     CSSStyleSheet* styleSheet = rule->parentStyleSheet();
     if (!styleSheet || !ensureParsedDataReady()) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     rule->setSelectorText(selector);
     RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
     if (!sourceData) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -1088,14 +1088,14 @@
     if (!checkPageStyleSheet(ec))
         return 0;
     if (!checkStyleRuleSelector(m_pageStyleSheet->ownerDocument(), selector)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
     String text;
     bool success = getText(&text);
     if (!success) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return 0;
     }
     StringBuilder styleSheetText;
@@ -1114,7 +1114,7 @@
         // What we just added has to be a CSSStyleRule - we cannot handle other types of rules yet.
         // If it is not a style rule, pretend we never touched the stylesheet.
         m_pageStyleSheet->deleteRule(lastRuleIndex, ASSERT_NO_EXCEPTION);
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -1137,18 +1137,18 @@
         return false;
     RefPtr<CSSStyleRule> rule = ruleForId(id);
     if (!rule) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
     CSSStyleSheet* styleSheet = rule->parentStyleSheet();
     if (!styleSheet || !ensureParsedDataReady()) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
     if (!sourceData) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -1328,13 +1328,13 @@
 {
     RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     if (!inspectorStyle || !inspectorStyle->cssStyle()) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
     bool success = inspectorStyle->styleText(oldText);
     if (!success) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -1342,7 +1342,7 @@
     if (success)
         fireStyleSheetChanged();
     else
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
     return success;
 }
 
@@ -1350,7 +1350,7 @@
 {
     RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     if (!inspectorStyle) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -1364,7 +1364,7 @@
 {
     RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     if (!inspectorStyle) {
-        ec = NOT_FOUND_ERR;
+        ec = NotFoundError;
         return false;
     }
 
@@ -1538,7 +1538,7 @@
 bool InspectorStyleSheet::checkPageStyleSheet(ExceptionCode& ec) const
 {
     if (!m_pageStyleSheet) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return false;
     }
     return true;
@@ -1576,7 +1576,7 @@
     RefPtr<StyleSheetContents> newStyleSheet = StyleSheetContents::create();
     OwnPtr<RuleSourceDataList> result = adoptPtr(new RuleSourceDataList());
     StyleSheetHandler handler(m_parsedStyleSheet->text(), m_pageStyleSheet->ownerDocument(), newStyleSheet.get(), result.get());
-    createCSSParser(m_pageStyleSheet->ownerDocument())->parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, &handler);
+    createCSSParser(m_pageStyleSheet->ownerDocument())->parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), TextPosition::minimumPosition(), &handler);
     m_parsedStyleSheet->setSourceData(result.release());
     return m_parsedStyleSheet->hasSourceData();
 }
diff --git a/Source/core/inspector/InspectorTimelineAgent.cpp b/Source/core/inspector/InspectorTimelineAgent.cpp
index 0ea8f7f..e8f6a3e 100644
--- a/Source/core/inspector/InspectorTimelineAgent.cpp
+++ b/Source/core/inspector/InspectorTimelineAgent.cpp
@@ -231,8 +231,10 @@
     if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled))
         return;
 
-    m_traceEventProcessor->shutdown();
-    m_traceEventProcessor.clear();
+    if (m_traceEventProcessor) {
+        m_traceEventProcessor->shutdown();
+        m_traceEventProcessor.clear();
+    }
     m_weakFactory.revokeAll();
     m_instrumentingAgents->setInspectorTimelineAgent(0);
     ScriptGCEvent::removeEventListener(this);
@@ -724,7 +726,7 @@
         entry.record->setObject("data", entry.data);
         entry.record->setArray("children", entry.children);
         entry.record->setNumber("endTime", timestamp());
-        size_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart;
+        ptrdiff_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart;
         if (usedHeapSizeDelta)
             entry.record->setNumber("usedHeapSizeDelta", usedHeapSizeDelta);
         addRecordToTimeline(entry.record);
@@ -744,6 +746,7 @@
     , m_client(client)
     , m_weakFactory(this)
     , m_styleRecalcElementCounter(0)
+    , m_layerTreeId(0)
 {
 }
 
diff --git a/Source/core/inspector/InspectorTimelineAgent.h b/Source/core/inspector/InspectorTimelineAgent.h
index b589156..574a4cb 100644
--- a/Source/core/inspector/InspectorTimelineAgent.h
+++ b/Source/core/inspector/InspectorTimelineAgent.h
@@ -121,6 +121,8 @@
     virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* includeDomCounters, const bool* includeNativeMemoryStatistics);
     virtual void stop(ErrorString*);
 
+    void setLayerTreeId(int layerTreeId) { m_layerTreeId = layerTreeId; }
+    int layerTreeId() const { return m_layerTreeId; }
     int id() const { return m_id; }
 
     void didCommitLoad();
@@ -285,6 +287,7 @@
     WeakPtrFactory<InspectorTimelineAgent> m_weakFactory;
     RefPtr<TimelineTraceEventProcessor> m_traceEventProcessor;
     unsigned m_styleRecalcElementCounter;
+    int m_layerTreeId;
 };
 
 } // namespace WebCore
diff --git a/Source/core/inspector/InspectorWorkerAgent.h b/Source/core/inspector/InspectorWorkerAgent.h
index 74146aa..8db76fa 100644
--- a/Source/core/inspector/InspectorWorkerAgent.h
+++ b/Source/core/inspector/InspectorWorkerAgent.h
@@ -32,8 +32,8 @@
 #define InspectorWorkerAgent_h
 
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
 
 namespace WebCore {
 class InspectorFrontend;
diff --git a/Source/core/inspector/MemoryInstrumentationImpl.h b/Source/core/inspector/MemoryInstrumentationImpl.h
index aae2772..0143d91 100644
--- a/Source/core/inspector/MemoryInstrumentationImpl.h
+++ b/Source/core/inspector/MemoryInstrumentationImpl.h
@@ -31,13 +31,12 @@
 #ifndef MemoryInstrumentationImpl_h
 #define MemoryInstrumentationImpl_h
 
-
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/MemoryInstrumentation.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/MemoryInstrumentation.h"
+#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
 
 using WTF::MemoryObjectType;
 using WTF::MemberType;
diff --git a/Source/core/inspector/NetworkResourcesData.cpp b/Source/core/inspector/NetworkResourcesData.cpp
index efb6932..8324829 100644
--- a/Source/core/inspector/NetworkResourcesData.cpp
+++ b/Source/core/inspector/NetworkResourcesData.cpp
@@ -34,7 +34,7 @@
 #include "core/loader/cache/CachedResource.h"
 #include "core/platform/SharedBuffer.h"
 #include "core/platform/network/ResourceResponse.h"
-#include <wtf/MemoryInstrumentationHashMap.h>
+#include "wtf/MemoryInstrumentationHashMap.h"
 
 namespace {
 // 100MB
diff --git a/Source/core/inspector/PageConsoleAgent.h b/Source/core/inspector/PageConsoleAgent.h
index 59a2e5b..ed9f713 100644
--- a/Source/core/inspector/PageConsoleAgent.h
+++ b/Source/core/inspector/PageConsoleAgent.h
@@ -32,8 +32,7 @@
 #define PageConsoleAgent_h
 
 #include "core/inspector/InspectorConsoleAgent.h"
-#include <wtf/PassOwnPtr.h>
-
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/PageRuntimeAgent.h b/Source/core/inspector/PageRuntimeAgent.h
index 30be7c3..27e635b 100644
--- a/Source/core/inspector/PageRuntimeAgent.h
+++ b/Source/core/inspector/PageRuntimeAgent.h
@@ -31,11 +31,10 @@
 #ifndef PageRuntimeAgent_h
 #define PageRuntimeAgent_h
 
-
 #include "InspectorFrontend.h"
 #include "bindings/v8/ScriptState.h"
 #include "core/inspector/InspectorRuntimeAgent.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/ScriptArguments.h b/Source/core/inspector/ScriptArguments.h
index e8d5443..8f83bd3 100644
--- a/Source/core/inspector/ScriptArguments.h
+++ b/Source/core/inspector/ScriptArguments.h
@@ -32,10 +32,10 @@
 #define ScriptArguments_h
 
 #include "bindings/v8/ScriptState.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/ScriptBreakpoint.h b/Source/core/inspector/ScriptBreakpoint.h
index 11e8d51..bda77e8 100644
--- a/Source/core/inspector/ScriptBreakpoint.h
+++ b/Source/core/inspector/ScriptBreakpoint.h
@@ -30,7 +30,7 @@
 #ifndef ScriptBreakpoint_h
 #define ScriptBreakpoint_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/ScriptCallFrame.h b/Source/core/inspector/ScriptCallFrame.h
index 941c549..7ec5343 100644
--- a/Source/core/inspector/ScriptCallFrame.h
+++ b/Source/core/inspector/ScriptCallFrame.h
@@ -32,9 +32,8 @@
 #define ScriptCallFrame_h
 
 #include "InspectorTypeBuilder.h"
-
-#include <wtf/Forward.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Forward.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/ScriptCallStack.h b/Source/core/inspector/ScriptCallStack.h
index ce605ea..5d5d0f6 100644
--- a/Source/core/inspector/ScriptCallStack.h
+++ b/Source/core/inspector/ScriptCallStack.h
@@ -32,11 +32,10 @@
 #define ScriptCallStack_h
 
 #include "InspectorTypeBuilder.h"
-
 #include "core/inspector/ScriptCallFrame.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/ScriptDebugListener.h b/Source/core/inspector/ScriptDebugListener.h
index bfa6bab..17ddcc7 100644
--- a/Source/core/inspector/ScriptDebugListener.h
+++ b/Source/core/inspector/ScriptDebugListener.h
@@ -38,6 +38,7 @@
 
 namespace WebCore {
 class ScriptValue;
+class JavaScriptCallFrame;
 
 class ScriptDebugListener {
 public:
@@ -70,6 +71,8 @@
     virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0;
     virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints) = 0;
     virtual void didContinue() = 0;
+
+    virtual bool shouldSkipPause(RefPtr<JavaScriptCallFrame>& topFrame) = 0;
 };
 
 } // namespace WebCore
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.cpp b/Source/core/inspector/TimelineTraceEventProcessor.cpp
index a2323e0..ba28720 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.cpp
+++ b/Source/core/inspector/TimelineTraceEventProcessor.cpp
@@ -152,15 +152,18 @@
     , m_timeConverter(timelineAgent.get()->timeConverter())
     , m_inspectorClient(client)
     , m_pageId(reinterpret_cast<unsigned long long>(m_timelineAgent.get()->page()))
+    , m_layerTreeId(m_timelineAgent.get()->layerTreeId())
     , m_layerId(0)
     , m_paintSetupStart(0)
     , m_paintSetupEnd(0)
 {
     registerHandler(InstrumentationEvents::BeginFrame, TracePhaseInstant, &TimelineTraceEventProcessor::onBeginFrame);
-    registerHandler(InstrumentationEvents::PaintSetup, TracePhaseBegin, &TimelineTraceEventProcessor::onPaintSetupBegin);
-    registerHandler(InstrumentationEvents::PaintSetup, TracePhaseEnd, &TimelineTraceEventProcessor::onPaintSetupEnd);
+    registerHandler(InstrumentationEvents::UpdateLayer, TracePhaseBegin, &TimelineTraceEventProcessor::onUpdateLayerBegin);
+    registerHandler(InstrumentationEvents::UpdateLayer, TracePhaseEnd, &TimelineTraceEventProcessor::onUpdateLayerEnd);
     registerHandler(InstrumentationEvents::PaintLayer, TracePhaseBegin, &TimelineTraceEventProcessor::onPaintLayerBegin);
     registerHandler(InstrumentationEvents::PaintLayer, TracePhaseEnd, &TimelineTraceEventProcessor::onPaintLayerEnd);
+    registerHandler(InstrumentationEvents::PaintSetup, TracePhaseBegin, &TimelineTraceEventProcessor::onPaintSetupBegin);
+    registerHandler(InstrumentationEvents::PaintSetup, TracePhaseEnd, &TimelineTraceEventProcessor::onPaintSetupEnd);
     registerHandler(InstrumentationEvents::RasterTask, TracePhaseBegin, &TimelineTraceEventProcessor::onRasterTaskBegin);
     registerHandler(InstrumentationEvents::RasterTask, TracePhaseEnd, &TimelineTraceEventProcessor::onRasterTaskEnd);
     registerHandler(InstrumentationEvents::ImageDecodeTask, TracePhaseBegin, &TimelineTraceEventProcessor::onImageDecodeTaskBegin);
@@ -230,6 +233,36 @@
     processBackgroundEvents();
 }
 
+void TimelineTraceEventProcessor::onUpdateLayerBegin(const TraceEvent& event)
+{
+    unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments::LayerTreeId);
+    if (layerTreeId != m_layerTreeId)
+        return;
+    m_layerId = event.asUInt(InstrumentationEventArguments::LayerId);
+    // We don't know the node yet. For content layers, the node will be updated
+    // by paint. For others, let it remain 0 -- we just need the fact that
+    // the layer belongs to the page (see cookie check).
+    m_layerToNodeMap.add(m_layerId, 0);
+}
+
+void TimelineTraceEventProcessor::onUpdateLayerEnd(const TraceEvent& event)
+{
+    m_layerId = 0;
+}
+
+void TimelineTraceEventProcessor::onPaintLayerBegin(const TraceEvent& event)
+{
+    m_layerId = event.asUInt(InstrumentationEventArguments::LayerId);
+    ASSERT(m_layerId);
+    ASSERT(!m_paintSetupStart);
+}
+
+void TimelineTraceEventProcessor::onPaintLayerEnd(const TraceEvent& event)
+{
+    m_layerId = 0;
+    ASSERT(m_paintSetupStart);
+}
+
 void TimelineTraceEventProcessor::onPaintSetupBegin(const TraceEvent& event)
 {
     ASSERT(!m_paintSetupStart);
@@ -242,17 +275,6 @@
     m_paintSetupEnd = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
 }
 
-void TimelineTraceEventProcessor::onPaintLayerBegin(const TraceEvent& event)
-{
-    m_layerId = event.asUInt(InstrumentationEventArguments::LayerId);
-    ASSERT(m_layerId);
-}
-
-void TimelineTraceEventProcessor::onPaintLayerEnd(const TraceEvent&)
-{
-    m_layerId = 0;
-}
-
 void TimelineTraceEventProcessor::onRasterTaskBegin(const TraceEvent& event)
 {
     TimelineThreadState& state = threadState(event.threadIdentifier());
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.h b/Source/core/inspector/TimelineTraceEventProcessor.h
index 48edc09..e45eb0c 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.h
+++ b/Source/core/inspector/TimelineTraceEventProcessor.h
@@ -228,23 +228,26 @@
     void registerHandler(const char* name, TraceEventPhase, TraceEventHandler);
 
     void onBeginFrame(const TraceEvent&);
-    void onPaintSetupBegin(const TraceEvent&);
-    void onPaintSetupEnd(const TraceEvent&);
+    void onUpdateLayerBegin(const TraceEvent&);
+    void onUpdateLayerEnd(const TraceEvent&);
     void onPaintLayerBegin(const TraceEvent&);
     void onPaintLayerEnd(const TraceEvent&);
+    void onPaintSetupBegin(const TraceEvent&);
+    void onPaintSetupEnd(const TraceEvent&);
     void onRasterTaskBegin(const TraceEvent&);
     void onRasterTaskEnd(const TraceEvent&);
+    void onPaint(const TraceEvent&);
     void onImageDecodeTaskBegin(const TraceEvent&);
     void onImageDecodeTaskEnd(const TraceEvent&);
     void onImageDecodeBegin(const TraceEvent&);
     void onImageDecodeEnd(const TraceEvent&);
     void onLayerDeleted(const TraceEvent&);
-    void onPaint(const TraceEvent&);
 
     WeakPtr<InspectorTimelineAgent> m_timelineAgent;
     TimelineTimeConverter m_timeConverter;
     InspectorClient* m_inspectorClient;
     unsigned long long m_pageId;
+    int m_layerTreeId;
 
     typedef HashMap<std::pair<String, int>, TraceEventHandler> HandlersMap;
     HandlersMap m_handlersByType;
diff --git a/Source/core/inspector/WorkerConsoleAgent.h b/Source/core/inspector/WorkerConsoleAgent.h
index 27ec0ac..24f72eb 100644
--- a/Source/core/inspector/WorkerConsoleAgent.h
+++ b/Source/core/inspector/WorkerConsoleAgent.h
@@ -32,7 +32,7 @@
 #define WorkerConsoleAgent_h
 
 #include "core/inspector/InspectorConsoleAgent.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/WorkerDebuggerAgent.cpp b/Source/core/inspector/WorkerDebuggerAgent.cpp
index b30b39a..89ee4b8 100644
--- a/Source/core/inspector/WorkerDebuggerAgent.cpp
+++ b/Source/core/inspector/WorkerDebuggerAgent.cpp
@@ -29,13 +29,12 @@
  */
 
 #include "config.h"
-
 #include "core/inspector/WorkerDebuggerAgent.h"
 
 #include "bindings/v8/ScriptDebugServer.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerThread.h"
-#include <wtf/MessageQueue.h>
+#include "wtf/MessageQueue.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/WorkerInspectorController.cpp b/Source/core/inspector/WorkerInspectorController.cpp
index 397b443..283ee77 100644
--- a/Source/core/inspector/WorkerInspectorController.cpp
+++ b/Source/core/inspector/WorkerInspectorController.cpp
@@ -50,7 +50,7 @@
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerReportingProxy.h"
 #include "core/workers/WorkerThread.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/WorkerInspectorController.h b/Source/core/inspector/WorkerInspectorController.h
index 4c70063..cc639e9 100644
--- a/Source/core/inspector/WorkerInspectorController.h
+++ b/Source/core/inspector/WorkerInspectorController.h
@@ -32,11 +32,11 @@
 #define WorkerInspectorController_h
 
 #include "core/inspector/InspectorBaseAgent.h"
-#include <wtf/FastAllocBase.h>
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/FastAllocBase.h"
+#include "wtf/Forward.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/WorkerRuntimeAgent.h b/Source/core/inspector/WorkerRuntimeAgent.h
index 226c135..745baf2 100644
--- a/Source/core/inspector/WorkerRuntimeAgent.h
+++ b/Source/core/inspector/WorkerRuntimeAgent.h
@@ -32,7 +32,7 @@
 #define WorkerRuntimeAgent_h
 
 #include "core/inspector/InspectorRuntimeAgent.h"
-#include <wtf/PassOwnPtr.h>
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/generate-inspector-protocol-version b/Source/core/inspector/generate-inspector-protocol-version
index 12f4298..bde2fa9 100755
--- a/Source/core/inspector/generate-inspector-protocol-version
+++ b/Source/core/inspector/generate-inspector-protocol-version
@@ -435,8 +435,8 @@
 #ifndef InspectorProtocolVersion_h
 #define InspectorProtocolVersion_h
 
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector_instrumentation_sources.target.darwin-arm.mk b/Source/core/inspector_instrumentation_sources.target.darwin-arm.mk
index 2d6bdb1..992ba6d 100644
--- a/Source/core/inspector_instrumentation_sources.target.darwin-arm.mk
+++ b/Source/core/inspector_instrumentation_sources.target.darwin-arm.mk
@@ -20,14 +20,14 @@
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInstrumentation.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector instrumentation code from InspectorInstrumentation.idl ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
 $(gyp_shared_intermediate_dir)/webkit/InspectorConsoleInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorDatabaseInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 
 
 GYP_GENERATED_OUTPUTS := \
@@ -37,7 +37,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 
 # Make sure our deps and generated files are built first.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
diff --git a/Source/core/inspector_instrumentation_sources.target.darwin-mips.mk b/Source/core/inspector_instrumentation_sources.target.darwin-mips.mk
index 2d6bdb1..992ba6d 100644
--- a/Source/core/inspector_instrumentation_sources.target.darwin-mips.mk
+++ b/Source/core/inspector_instrumentation_sources.target.darwin-mips.mk
@@ -20,14 +20,14 @@
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInstrumentation.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector instrumentation code from InspectorInstrumentation.idl ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
 $(gyp_shared_intermediate_dir)/webkit/InspectorConsoleInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorDatabaseInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 
 
 GYP_GENERATED_OUTPUTS := \
@@ -37,7 +37,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 
 # Make sure our deps and generated files are built first.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
diff --git a/Source/core/inspector_instrumentation_sources.target.darwin-x86.mk b/Source/core/inspector_instrumentation_sources.target.darwin-x86.mk
index 2d6bdb1..992ba6d 100644
--- a/Source/core/inspector_instrumentation_sources.target.darwin-x86.mk
+++ b/Source/core/inspector_instrumentation_sources.target.darwin-x86.mk
@@ -20,14 +20,14 @@
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInstrumentation.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector instrumentation code from InspectorInstrumentation.idl ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
 $(gyp_shared_intermediate_dir)/webkit/InspectorConsoleInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorDatabaseInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 
 
 GYP_GENERATED_OUTPUTS := \
@@ -37,7 +37,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 
 # Make sure our deps and generated files are built first.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
diff --git a/Source/core/inspector_instrumentation_sources.target.linux-arm.mk b/Source/core/inspector_instrumentation_sources.target.linux-arm.mk
index 2d6bdb1..992ba6d 100644
--- a/Source/core/inspector_instrumentation_sources.target.linux-arm.mk
+++ b/Source/core/inspector_instrumentation_sources.target.linux-arm.mk
@@ -20,14 +20,14 @@
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInstrumentation.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector instrumentation code from InspectorInstrumentation.idl ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
 $(gyp_shared_intermediate_dir)/webkit/InspectorConsoleInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorDatabaseInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 
 
 GYP_GENERATED_OUTPUTS := \
@@ -37,7 +37,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 
 # Make sure our deps and generated files are built first.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
diff --git a/Source/core/inspector_instrumentation_sources.target.linux-mips.mk b/Source/core/inspector_instrumentation_sources.target.linux-mips.mk
index 2d6bdb1..992ba6d 100644
--- a/Source/core/inspector_instrumentation_sources.target.linux-mips.mk
+++ b/Source/core/inspector_instrumentation_sources.target.linux-mips.mk
@@ -20,14 +20,14 @@
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInstrumentation.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector instrumentation code from InspectorInstrumentation.idl ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
 $(gyp_shared_intermediate_dir)/webkit/InspectorConsoleInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorDatabaseInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 
 
 GYP_GENERATED_OUTPUTS := \
@@ -37,7 +37,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 
 # Make sure our deps and generated files are built first.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
diff --git a/Source/core/inspector_instrumentation_sources.target.linux-x86.mk b/Source/core/inspector_instrumentation_sources.target.linux-x86.mk
index 2d6bdb1..992ba6d 100644
--- a/Source/core/inspector_instrumentation_sources.target.linux-x86.mk
+++ b/Source/core/inspector_instrumentation_sources.target.linux-x86.mk
@@ -20,14 +20,14 @@
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInstrumentation.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector instrumentation code from InspectorInstrumentation.idl ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInstrumentation.py inspector/InspectorInstrumentation.idl --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
 $(gyp_shared_intermediate_dir)/webkit/InspectorConsoleInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorDatabaseInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 $(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorCanvasInstrumentationInl.h ;
 
 
 GYP_GENERATED_OUTPUTS := \
@@ -37,7 +37,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorOverridesInl.h \
 	$(gyp_shared_intermediate_dir)/webkit/InstrumentingAgentsInl.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+	$(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 
 # Make sure our deps and generated files are built first.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
diff --git a/Source/core/inspector_protocol_sources.target.darwin-arm.mk b/Source/core/inspector_protocol_sources.target.darwin-arm.mk
index 067de7d..c003a0c 100644
--- a/Source/core/inspector_protocol_sources.target.darwin-arm.mk
+++ b/Source/core/inspector_protocol_sources.target.darwin-arm.mk
@@ -15,27 +15,27 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp
 
 ### Rules for action "generateInspectorProtocolBackendSources":
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector protocol backend sources from protocol.json ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
-$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
 
 
 GYP_GENERATED_OUTPUTS := \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h
 
 # Make sure our deps and generated files are built first.
diff --git a/Source/core/inspector_protocol_sources.target.darwin-mips.mk b/Source/core/inspector_protocol_sources.target.darwin-mips.mk
index 067de7d..c003a0c 100644
--- a/Source/core/inspector_protocol_sources.target.darwin-mips.mk
+++ b/Source/core/inspector_protocol_sources.target.darwin-mips.mk
@@ -15,27 +15,27 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp
 
 ### Rules for action "generateInspectorProtocolBackendSources":
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector protocol backend sources from protocol.json ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
-$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
 
 
 GYP_GENERATED_OUTPUTS := \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h
 
 # Make sure our deps and generated files are built first.
diff --git a/Source/core/inspector_protocol_sources.target.darwin-x86.mk b/Source/core/inspector_protocol_sources.target.darwin-x86.mk
index 067de7d..c003a0c 100644
--- a/Source/core/inspector_protocol_sources.target.darwin-x86.mk
+++ b/Source/core/inspector_protocol_sources.target.darwin-x86.mk
@@ -15,27 +15,27 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp
 
 ### Rules for action "generateInspectorProtocolBackendSources":
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector protocol backend sources from protocol.json ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
-$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
 
 
 GYP_GENERATED_OUTPUTS := \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h
 
 # Make sure our deps and generated files are built first.
diff --git a/Source/core/inspector_protocol_sources.target.linux-arm.mk b/Source/core/inspector_protocol_sources.target.linux-arm.mk
index 067de7d..c003a0c 100644
--- a/Source/core/inspector_protocol_sources.target.linux-arm.mk
+++ b/Source/core/inspector_protocol_sources.target.linux-arm.mk
@@ -15,27 +15,27 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp
 
 ### Rules for action "generateInspectorProtocolBackendSources":
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector protocol backend sources from protocol.json ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
-$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
 
 
 GYP_GENERATED_OUTPUTS := \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h
 
 # Make sure our deps and generated files are built first.
diff --git a/Source/core/inspector_protocol_sources.target.linux-mips.mk b/Source/core/inspector_protocol_sources.target.linux-mips.mk
index 067de7d..c003a0c 100644
--- a/Source/core/inspector_protocol_sources.target.linux-mips.mk
+++ b/Source/core/inspector_protocol_sources.target.linux-mips.mk
@@ -15,27 +15,27 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp
 
 ### Rules for action "generateInspectorProtocolBackendSources":
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector protocol backend sources from protocol.json ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
-$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
 
 
 GYP_GENERATED_OUTPUTS := \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h
 
 # Make sure our deps and generated files are built first.
diff --git a/Source/core/inspector_protocol_sources.target.linux-x86.mk b/Source/core/inspector_protocol_sources.target.linux-x86.mk
index 067de7d..c003a0c 100644
--- a/Source/core/inspector_protocol_sources.target.linux-x86.mk
+++ b/Source/core/inspector_protocol_sources.target.linux-x86.mk
@@ -15,27 +15,27 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_core_generate_inspector_protocol_version_gyp)/generate_inspector_protocol_version.stamp
 
 ### Rules for action "generateInspectorProtocolBackendSources":
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspector.py $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py $(LOCAL_PATH)/third_party/WebKit/Source/devtools/protocol.json $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating Inspector protocol backend sources from protocol.json ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit $(gyp_shared_intermediate_dir)/webcore; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_h_dir "$(gyp_shared_intermediate_dir)/webkit" --output_cpp_dir "$(gyp_shared_intermediate_dir)/webcore"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python inspector/CodeGeneratorInspector.py ../devtools/protocol.json --output_dir "$(gyp_shared_intermediate_dir)/webkit"
 
-$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
-$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
+$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp ;
 
 
 GYP_GENERATED_OUTPUTS := \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.h \
-	$(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.h
 
 # Make sure our deps and generated files are built first.
diff --git a/Source/core/loader/CachedMetadata.cpp b/Source/core/loader/CachedMetadata.cpp
index 7e58e09..1e944c7 100644
--- a/Source/core/loader/CachedMetadata.cpp
+++ b/Source/core/loader/CachedMetadata.cpp
@@ -32,7 +32,7 @@
 #include "core/loader/CachedMetadata.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
-#include <wtf/MemoryInstrumentationVector.h>
+#include "wtf/MemoryInstrumentationVector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/CachedMetadata.h b/Source/core/loader/CachedMetadata.h
index db9eb38..e216858 100644
--- a/Source/core/loader/CachedMetadata.h
+++ b/Source/core/loader/CachedMetadata.h
@@ -31,9 +31,9 @@
 #ifndef CachedMetadata_h
 #define CachedMetadata_h
 
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/CrossOriginAccessControl.cpp b/Source/core/loader/CrossOriginAccessControl.cpp
index e77bf5d..62f0d01 100644
--- a/Source/core/loader/CrossOriginAccessControl.cpp
+++ b/Source/core/loader/CrossOriginAccessControl.cpp
@@ -27,13 +27,13 @@
 #include "config.h"
 #include "core/loader/CrossOriginAccessControl.h"
 
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/Threading.h>
 #include "core/platform/network/HTTPParsers.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "weborigin/SecurityOrigin.h"
+#include "wtf/Threading.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/CrossOriginAccessControl.h b/Source/core/loader/CrossOriginAccessControl.h
index 7ab67b6..0962d13 100644
--- a/Source/core/loader/CrossOriginAccessControl.h
+++ b/Source/core/loader/CrossOriginAccessControl.h
@@ -29,8 +29,8 @@
 
 #include "core/platform/network/ResourceHandle.h"
 #include "core/platform/network/ResourceRequest.h"
-#include <wtf/Forward.h>
-#include <wtf/HashSet.h>
+#include "wtf/Forward.h"
+#include "wtf/HashSet.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/CrossOriginPreflightResultCache.cpp b/Source/core/loader/CrossOriginPreflightResultCache.cpp
index 9b5de73..91e0c94 100644
--- a/Source/core/loader/CrossOriginPreflightResultCache.cpp
+++ b/Source/core/loader/CrossOriginPreflightResultCache.cpp
@@ -29,9 +29,9 @@
 
 #include "core/loader/CrossOriginAccessControl.h"
 #include "core/platform/network/ResourceResponse.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/MainThread.h>
-#include <wtf/StdLibExtras.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/MainThread.h"
+#include "wtf/StdLibExtras.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/DocumentLoadTiming.cpp b/Source/core/loader/DocumentLoadTiming.cpp
index ff06dab..a9115f0 100644
--- a/Source/core/loader/DocumentLoadTiming.cpp
+++ b/Source/core/loader/DocumentLoadTiming.cpp
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "core/loader/DocumentLoadTiming.h"
 
-#include <wtf/CurrentTime.h>
-#include <wtf/RefPtr.h>
 #include "weborigin/SecurityOrigin.h"
+#include "wtf/CurrentTime.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/DocumentLoadTiming.h b/Source/core/loader/DocumentLoadTiming.h
index 74b7190..eedea55 100644
--- a/Source/core/loader/DocumentLoadTiming.h
+++ b/Source/core/loader/DocumentLoadTiming.h
@@ -26,7 +26,7 @@
 #ifndef DocumentLoadTiming_h
 #define DocumentLoadTiming_h
 
-#include <wtf/CurrentTime.h>
+#include "wtf/CurrentTime.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/DocumentLoader.cpp b/Source/core/loader/DocumentLoader.cpp
index b878158..9c60bc9 100644
--- a/Source/core/loader/DocumentLoader.cpp
+++ b/Source/core/loader/DocumentLoader.cpp
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "core/loader/DocumentLoader.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentParser.h"
@@ -48,7 +49,6 @@
 #include "core/loader/archive/ArchiveResourceCollection.h"
 #include "core/loader/archive/MHTMLArchive.h"
 #include "core/loader/cache/CachedResourceLoader.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/loader/cache/MemoryCache.h"
 #include "core/page/DOMWindow.h"
 #include "core/page/Frame.h"
@@ -399,7 +399,7 @@
         handleSubstituteDataLoadNow(0);
 }
 
-bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& request)
+bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& request, PolicyCheckLoadType policyCheckLoadType)
 {
     NavigationAction action = triggeringAction();
     if (action.isEmpty()) {
@@ -424,13 +424,22 @@
     if (m_frame->ownerElement() && !m_frame->ownerElement()->document()->contentSecurityPolicy()->allowChildFrameFromSource(request.url()))
         return false;
 
-    PolicyAction policy = frameLoader()->client()->decidePolicyForNavigationAction(action, request);
-    if (policy == PolicyDownload) {
-        ResourceRequest mutableRequest(request);
+    if (request.isNull())
+        return false;
+
+    NavigationPolicy policy = NavigationPolicyCurrentTab;
+    action.specifiesNavigationPolicy(&policy);
+    policy = frameLoader()->client()->decidePolicyForNavigation(request, action.type(), policy, policyCheckLoadType == PolicyCheckRedirect);
+    if (policy == NavigationPolicyCurrentTab)
+        return true;
+    if (policy == NavigationPolicyIgnore)
+        return false;
+
+    ResourceRequest mutableRequest(request);
+    if (policy == NavigationPolicyDownload)
         frameLoader()->setOriginalURLForDownloadRequest(mutableRequest);
-        frameLoader()->client()->startDownload(mutableRequest);
-    }
-    return policy == PolicyUse;
+    frameLoader()->client()->loadURLExternally(mutableRequest, policy);
+    return false;
 }
 
 void DocumentLoader::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -477,9 +486,9 @@
     if (newRequest.cachePolicy() == UseProtocolCachePolicy && isPostOrRedirectAfterPost(newRequest, redirectResponse))
         newRequest.setCachePolicy(ReloadIgnoringCacheData);
 
-    Frame* parent = m_frame->tree()->parent();
-    if (parent) {
-        if (!parent->loader()->mixedContentChecker()->canRunInsecureContent(parent->document()->securityOrigin(), newRequest.url())) {
+    Frame* top = m_frame->tree()->top();
+    if (top) {
+        if (!top->loader()->mixedContentChecker()->canDisplayInsecureContent(top->document()->securityOrigin(), newRequest.url())) {
             cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
             return;
         }
@@ -490,8 +499,9 @@
     if (redirectResponse.isNull())
         return;
 
+    appendRedirect(newRequest.url());
     frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
-    if (!shouldContinueForNavigationPolicy(newRequest))
+    if (!shouldContinueForNavigationPolicy(newRequest, PolicyCheckRedirect))
         stopLoadingForPolicyChange();
 }
 
@@ -704,6 +714,16 @@
     m_frame->document()->domWindow()->finishedLoading();
 }
 
+void DocumentLoader::clearRedirectChain()
+{
+    m_redirectChain.clear();
+}
+
+void DocumentLoader::appendRedirect(const KURL& url)
+{
+    m_redirectChain.append(url);
+}
+
 void DocumentLoader::setFrame(Frame* frame)
 {
     if (m_frame == frame)
@@ -815,12 +835,16 @@
 
     ASSERT(m_archiveResourceCollection);
     ArchiveResource* archiveResource = m_archiveResourceCollection->archiveResourceForURL(request.url());
-    ASSERT(archiveResource);
+    if (!archiveResource) {
+        cachedResource->error(CachedResource::LoadError);
+        return true;
+    }
 
     cachedResource->setLoading(true);
-    SharedBuffer* data = archiveResource->data();
     cachedResource->responseReceived(archiveResource->response());
-    cachedResource->appendData(data->data(), data->size());
+    SharedBuffer* data = archiveResource->data();
+    if (data)
+        cachedResource->appendData(data->data(), data->size());
     cachedResource->finish();
     return true;
 }
@@ -961,8 +985,8 @@
 
     ResourceRequest request(m_request);
     DEFINE_STATIC_LOCAL(ResourceLoaderOptions, mainResourceLoadOptions,
-        (SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck, CheckContentSecurityPolicy, UseDefaultOriginRestrictionsForType));
-    CachedResourceRequest cachedResourceRequest(request, cachedResourceRequestInitiators().document, mainResourceLoadOptions);
+        (SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck, CheckContentSecurityPolicy, UseDefaultOriginRestrictionsForType, DocumentContext));
+    CachedResourceRequest cachedResourceRequest(request, CachedResourceInitiatorTypeNames::document, mainResourceLoadOptions);
     m_mainResource = m_cachedResourceLoader->requestMainResource(cachedResourceRequest);
     if (!m_mainResource) {
         setRequest(ResourceRequest());
@@ -1032,7 +1056,7 @@
     // inherit an aliased security context.
     RefPtr<Document> document = DOMImplementation::createDocument(mimeType, frame, url, frame->inViewSourceMode());
     if (document->isPluginDocument() && document->isSandboxed(SandboxPlugins))
-        document = SinkDocument::create(frame, url);
+        document = SinkDocument::create(DocumentInit(url, frame));
     bool shouldReuseDefaultView = frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && frame->document()->isSecureTransitionTo(url);
 
     RefPtr<DOMWindow> originalDOMWindow;
diff --git a/Source/core/loader/DocumentLoader.h b/Source/core/loader/DocumentLoader.h
index 18f3151..7e15c50 100644
--- a/Source/core/loader/DocumentLoader.h
+++ b/Source/core/loader/DocumentLoader.h
@@ -126,7 +126,11 @@
         bool scheduleArchiveLoad(CachedResource*, const ResourceRequest&);
         void cancelPendingSubstituteLoad(ResourceLoader*);
 
-        bool shouldContinueForNavigationPolicy(const ResourceRequest&);
+        enum PolicyCheckLoadType {
+            PolicyCheckStandard,
+            PolicyCheckRedirect
+        };
+        bool shouldContinueForNavigationPolicy(const ResourceRequest&, PolicyCheckLoadType);
         const NavigationAction& triggeringAction() const { return m_triggeringAction; }
         void setTriggeringAction(const NavigationAction& action) { m_triggeringAction = action; }
 
@@ -158,10 +162,15 @@
         virtual void reportMemoryUsage(MemoryObjectInfo*) const;
         void checkLoadComplete();
 
+        bool isRedirect() const { return m_redirectChain.size() > 1; }
+        void clearRedirectChain();
+        void appendRedirect(const KURL&);
+
     protected:
         DocumentLoader(const ResourceRequest&, const SubstituteData&);
 
         bool m_deferMainResourceDataLoad;
+        Vector<KURL> m_redirectChain;
 
     private:
         static PassRefPtr<DocumentWriter> createWriterFor(Frame*, const Document* ownerDocument, const KURL&, const String& mimeType, const String& encoding, bool userChosen, bool dispatch);
diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp
index 9290db5..7230b91 100644
--- a/Source/core/loader/DocumentWriter.cpp
+++ b/Source/core/loader/DocumentWriter.cpp
@@ -58,8 +58,10 @@
     // document.open).
     , m_parser(m_document->implicitOpen())
 {
-    if (FrameView* view = m_document->frame()->view())
-        view->setContentsSize(IntSize());
+    if (m_document->frame()) {
+        if (FrameView* view = m_document->frame()->view())
+            view->setContentsSize(IntSize());
+    }
 }
 
 DocumentWriter::~DocumentWriter()
diff --git a/Source/core/loader/EmptyClients.cpp b/Source/core/loader/EmptyClients.cpp
index 447962f..706eb79 100644
--- a/Source/core/loader/EmptyClients.cpp
+++ b/Source/core/loader/EmptyClients.cpp
@@ -91,9 +91,9 @@
     return String();
 }
 
-PolicyAction EmptyFrameLoaderClient::decidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&)
+NavigationPolicy EmptyFrameLoaderClient::decidePolicyForNavigation(const ResourceRequest&, NavigationType, NavigationPolicy, bool)
 {
-    return PolicyUse;
+    return NavigationPolicyIgnore;
 }
 
 void EmptyFrameLoaderClient::dispatchWillSendSubmitEvent(PassRefPtr<FormState>)
diff --git a/Source/core/loader/EmptyClients.h b/Source/core/loader/EmptyClients.h
index e065823..b36f1fc 100644
--- a/Source/core/loader/EmptyClients.h
+++ b/Source/core/loader/EmptyClients.h
@@ -43,7 +43,6 @@
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/network/ResourceError.h"
 #include "core/platform/text/TextCheckerClient.h"
-#include "modules/device_orientation/DeviceMotionClient.h"
 #include "public/platform/WebScreenInfo.h"
 #include "wtf/Forward.h"
 
@@ -199,8 +198,6 @@
 
     virtual void dispatchDidHandleOnloadEvents() OVERRIDE { }
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() OVERRIDE { }
-    virtual void dispatchDidCancelClientRedirect() OVERRIDE { }
-    virtual void dispatchWillPerformClientRedirect(const KURL&, double, double) OVERRIDE { }
     virtual void dispatchDidChangeLocationWithinPage() OVERRIDE { }
     virtual void dispatchWillClose() OVERRIDE { }
     virtual void dispatchDidStartProvisionalLoad() OVERRIDE { }
@@ -213,7 +210,7 @@
     virtual void dispatchDidFinishLoad() OVERRIDE { }
     virtual void dispatchDidLayout(LayoutMilestones) OVERRIDE { }
 
-    virtual PolicyAction decidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&) OVERRIDE;
+    virtual NavigationPolicy decidePolicyForNavigation(const ResourceRequest&, NavigationType, NavigationPolicy, bool isRedirect) OVERRIDE;
 
     virtual void dispatchUnableToImplementPolicy(const ResourceError&) OVERRIDE { }
 
@@ -224,7 +221,7 @@
     virtual void postProgressEstimateChangedNotification() OVERRIDE { }
     virtual void postProgressFinishedNotification() OVERRIDE { }
 
-    virtual void startDownload(const ResourceRequest&, const String& suggestedName = String()) OVERRIDE { UNUSED_PARAM(suggestedName); }
+    virtual void loadURLExternally(const ResourceRequest&, NavigationPolicy, const String& = String()) OVERRIDE { }
 
     virtual void didReceiveDocumentData(const char*, int) OVERRIDE { }
 
@@ -277,9 +274,9 @@
 class EmptyTextCheckerClient : public TextCheckerClient {
 public:
     virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const OVERRIDE { return true; }
-    virtual void checkSpellingOfString(const UChar*, int, int*, int*) OVERRIDE { }
+    virtual void checkSpellingOfString(const String&, int*, int*) OVERRIDE { }
     virtual String getAutoCorrectSuggestionForMisspelledWord(const String&) OVERRIDE { return String(); }
-    virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) OVERRIDE { }
+    virtual void checkGrammarOfString(const String&, Vector<GrammarDetail>&, int*, int*) OVERRIDE { }
     virtual void requestCheckingOfString(PassRefPtr<TextCheckingRequest>) OVERRIDE;
 };
 
@@ -373,13 +370,6 @@
     virtual void stopUpdating() OVERRIDE { }
 };
 
-class EmptyDeviceMotionClient : public DeviceMotionClient {
-public:
-    virtual void setController(DeviceMotionController*) OVERRIDE { }
-    virtual DeviceMotionData* lastMotion() const OVERRIDE { return 0; }
-    virtual void deviceMotionControllerDestroyed() OVERRIDE { }
-};
-
 class EmptyDeviceOrientationClient : public DeviceOrientationClient {
 public:
     virtual void setController(DeviceOrientationController*) OVERRIDE { }
diff --git a/Source/core/loader/FormState.h b/Source/core/loader/FormState.h
index 964766b..a4d98a7 100644
--- a/Source/core/loader/FormState.h
+++ b/Source/core/loader/FormState.h
@@ -29,8 +29,8 @@
 #ifndef FormState_h
 #define FormState_h
 
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/FrameLoadRequest.h b/Source/core/loader/FrameLoadRequest.h
index 0d1c8cd..416c77e 100644
--- a/Source/core/loader/FrameLoadRequest.h
+++ b/Source/core/loader/FrameLoadRequest.h
@@ -26,6 +26,9 @@
 #ifndef FrameLoadRequest_h
 #define FrameLoadRequest_h
 
+#include "core/dom/Event.h"
+#include "core/html/HTMLFormElement.h"
+#include "core/loader/FrameLoaderTypes.h"
 #include "core/loader/SubstituteData.h"
 #include "weborigin/SecurityOrigin.h"
 #include "core/platform/network/ResourceRequest.h"
@@ -37,14 +40,18 @@
 public:
     explicit FrameLoadRequest(SecurityOrigin* requester)
         : m_requester(requester)
-        , m_lockHistory(false)
+        , m_lockBackForwardList(false)
+        , m_clientRedirect(false)
+        , m_shouldSendReferrer(MaybeSendReferrer)
     {
     }
 
     FrameLoadRequest(SecurityOrigin* requester, const ResourceRequest& resourceRequest)
         : m_requester(requester)
         , m_resourceRequest(resourceRequest)
-        , m_lockHistory(false)
+        , m_lockBackForwardList(false)
+        , m_clientRedirect(false)
+        , m_shouldSendReferrer(MaybeSendReferrer)
     {
     }
 
@@ -52,13 +59,21 @@
         : m_requester(requester)
         , m_resourceRequest(resourceRequest)
         , m_frameName(frameName)
-        , m_lockHistory(false)
+        , m_lockBackForwardList(false)
+        , m_clientRedirect(false)
+        , m_shouldSendReferrer(MaybeSendReferrer)
     {
     }
 
-    FrameLoadRequest(Frame*, const ResourceRequest&, const SubstituteData& = SubstituteData());
-
-    bool isEmpty() const { return m_resourceRequest.isEmpty(); }
+    FrameLoadRequest(SecurityOrigin* requester, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
+        : m_requester(requester)
+        , m_resourceRequest(resourceRequest)
+        , m_substituteData(substituteData)
+        , m_lockBackForwardList(false)
+        , m_clientRedirect(false)
+        , m_shouldSendReferrer(MaybeSendReferrer)
+    {
+    }
 
     const SecurityOrigin* requester() const { return m_requester.get(); }
 
@@ -68,19 +83,33 @@
     const String& frameName() const { return m_frameName; }
     void setFrameName(const String& frameName) { m_frameName = frameName; }
 
-    void setLockHistory(bool lockHistory) { m_lockHistory = lockHistory; }
-    bool lockHistory() const { return m_lockHistory; }
-
     const SubstituteData& substituteData() const { return m_substituteData; }
-    void setSubstituteData(const SubstituteData& data) { m_substituteData = data; }
-    bool hasSubstituteData() { return m_substituteData.isValid(); }
+
+    bool lockBackForwardList() const { return m_lockBackForwardList; }
+    void setLockBackForwardList(bool lockBackForwardList) { m_lockBackForwardList = lockBackForwardList; }
+
+    bool clientRedirect() const { return m_clientRedirect; }
+    void setClientRedirect(bool clientRedirect) { m_clientRedirect = clientRedirect; }
+
+    Event* triggeringEvent() const { return m_triggeringEvent.get(); }
+    void setTriggeringEvent(PassRefPtr<Event> triggeringEvent) { m_triggeringEvent = triggeringEvent; }
+
+    FormState* formState() const { return m_formState.get(); }
+    void setFormState(PassRefPtr<FormState> formState) { m_formState = formState; }
+
+    ShouldSendReferrer shouldSendReferrer() const { return m_shouldSendReferrer; }
+    void setShouldSendReferrer(ShouldSendReferrer shouldSendReferrer) { m_shouldSendReferrer = shouldSendReferrer; }
 
 private:
     RefPtr<SecurityOrigin> m_requester;
     ResourceRequest m_resourceRequest;
     String m_frameName;
-    bool m_lockHistory;
     SubstituteData m_substituteData;
+    bool m_lockBackForwardList;
+    bool m_clientRedirect;
+    RefPtr<Event> m_triggeringEvent;
+    RefPtr<FormState> m_formState;
+    ShouldSendReferrer m_shouldSendReferrer;
 };
 
 }
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index e10e317..8a9d882 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -89,6 +89,7 @@
 #include "weborigin/SecurityOrigin.h"
 #include "weborigin/SecurityPolicy.h"
 #include "wtf/MemoryInstrumentationHashSet.h"
+#include "wtf/TemporaryChange.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
 
@@ -175,6 +176,7 @@
     , m_didAccessInitialDocument(false)
     , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocumentTimerFired)
     , m_suppressOpenerInNewFrame(false)
+    , m_startingClientRedirect(false)
     , m_forcedSandboxFlags(SandboxNone)
 {
 }
@@ -217,40 +219,6 @@
     }
 }
 
-void FrameLoader::changeLocation(SecurityOrigin* securityOrigin, const KURL& url, const String& referrer, bool lockBackForwardList, bool refresh)
-{
-    urlSelected(FrameLoadRequest(securityOrigin, ResourceRequest(url, referrer, refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy), "_self"),
-        0, lockBackForwardList, MaybeSendReferrer);
-}
-
-void FrameLoader::urlSelected(const KURL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockBackForwardList, ShouldSendReferrer shouldSendReferrer)
-{
-    urlSelected(FrameLoadRequest(m_frame->document()->securityOrigin(), ResourceRequest(url), passedTarget),
-        triggeringEvent, lockBackForwardList, shouldSendReferrer);
-}
-
-void FrameLoader::urlSelected(const FrameLoadRequest& passedRequest, PassRefPtr<Event> triggeringEvent, bool lockBackForwardList, ShouldSendReferrer shouldSendReferrer)
-{
-    ASSERT(!m_suppressOpenerInNewFrame);
-
-    RefPtr<Frame> protect(m_frame);
-    FrameLoadRequest frameRequest(passedRequest);
-
-    if (m_frame->script()->executeScriptIfJavaScriptURL(frameRequest.resourceRequest().url()))
-        return;
-
-    if (frameRequest.frameName().isEmpty())
-        frameRequest.setFrameName(m_frame->document()->baseTarget());
-
-    if (shouldSendReferrer == NeverSendReferrer)
-        m_suppressOpenerInNewFrame = true;
-    addHTTPOriginIfNeeded(frameRequest.resourceRequest(), outgoingOrigin());
-
-    loadFrameRequest(frameRequest, lockBackForwardList, triggeringEvent, 0, shouldSendReferrer);
-
-    m_suppressOpenerInNewFrame = false;
-}
-
 void FrameLoader::submitForm(PassRefPtr<FormSubmission> submission)
 {
     ASSERT(submission->method() == FormSubmission::PostMethod || submission->method() == FormSubmission::GetMethod);
@@ -538,7 +506,12 @@
     else
         url = m_frame->document()->completeURL(url).string();
 
-    m_frame->navigationScheduler()->scheduleRedirect(delay, url);
+    if (!protocolIsJavaScript(url)) {
+        m_frame->navigationScheduler()->scheduleRedirect(delay, url);
+    } else {
+        String message = "Refused to refresh " + m_frame->document()->url().elidedString() + " to a javascript: URL";
+        m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+    }
 }
 
 void FrameLoader::setOutgoingReferrer(const KURL& url)
@@ -756,7 +729,7 @@
             return;
         }
     }
-    childFrame->loader()->loadURL(request, "_self", FrameLoadTypeInitialInChildFrame, 0, 0);
+    childFrame->loader()->loadURL(request, "_self", FrameLoadTypeInitialInChildFrame, 0, 0, childFrame->loader()->defaultSubstituteDataForURL(request.url()));
 }
 
 String FrameLoader::outgoingReferrer() const
@@ -886,8 +859,24 @@
         checkLoadComplete();
     }
 
+    // Generate start and stop notifications only when loader is completed so that we
+    // don't fire them for fragment redirection that happens in window.onload handler.
+    // See https://bugs.webkit.org/show_bug.cgi?id=31838
+    if (m_documentLoader->wasOnloadHandled())
+        m_client->postProgressStartedNotification();
+
+    m_documentLoader->clearRedirectChain();
+    if ((m_startingClientRedirect && !isNewNavigation) || !UserGestureIndicator::processingUserGesture()) {
+        m_client->dispatchDidCompleteClientRedirect(oldURL);
+        m_documentLoader->appendRedirect(oldURL);
+    }
+    m_documentLoader->appendRedirect(url);
+
     m_client->dispatchDidNavigateWithinPage();
 
+    if (m_documentLoader->wasOnloadHandled())
+        m_client->postProgressFinishedNotification();
+
     m_frame->document()->statePopped(stateObject ? stateObject : SerializedScriptValue::nullValue());
     
     if (hashChange) {
@@ -940,27 +929,33 @@
     }
 }
 
-void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, bool lockBackForwardList,
-    PassRefPtr<Event> event, PassRefPtr<FormState> formState, ShouldSendReferrer shouldSendReferrer)
-{    
+void FrameLoader::load(const FrameLoadRequest& passedRequest)
+{
+    ASSERT(!m_suppressOpenerInNewFrame);
+
     // Protect frame from getting blown away inside dispatchBeforeLoadEvent in loadWithDocumentLoader.
     RefPtr<Frame> protect(m_frame);
 
+    FrameLoadRequest request(passedRequest);
     KURL url = request.resourceRequest().url();
 
+    if (m_frame->script()->executeScriptIfJavaScriptURL(url))
+        return;
+
     ASSERT(m_frame->document());
-    if (!request.requester()->canDisplay(url)) {
+    // FIXME: There are a bunch of FrameLoaderRequest::requester() checks in this function, and it's messy.
+    if (request.requester() && !request.requester()->canDisplay(url)) {
         reportLocalLoadFailed(m_frame, url.elidedString());
         return;
     }
 
     ResourceRequest resourceRequest(request.resourceRequest());
     String argsReferrer = resourceRequest.httpReferrer();
-    if (argsReferrer.isEmpty())
+    if (argsReferrer.isEmpty() && request.requester())
         argsReferrer = outgoingReferrer();
 
-    String referrer = SecurityPolicy::generateReferrerHeader(m_frame->document()->referrerPolicy(), url, argsReferrer);
-    if (shouldSendReferrer == NeverSendReferrer)
+    String referrer = request.requester() ? SecurityPolicy::generateReferrerHeader(m_frame->document()->referrerPolicy(), url, argsReferrer) : argsReferrer;
+    if (request.shouldSendReferrer() == NeverSendReferrer)
         referrer = String();
 
     if (!referrer.isEmpty()) {
@@ -973,26 +968,22 @@
     FrameLoadType loadType;
     if (resourceRequest.cachePolicy() == ReloadIgnoringCacheData)
         loadType = FrameLoadTypeReload;
-    else if (lockBackForwardList)
+    else if (request.lockBackForwardList())
         loadType = FrameLoadTypeRedirectWithLockedBackForwardList;
+    else if (shouldTreatURLAsSameAsCurrent(request.substituteData().failingURL()) && m_loadType == FrameLoadTypeReload)
+        loadType = FrameLoadTypeReload;
     else
         loadType = FrameLoadTypeStandard;
 
-    loadURL(resourceRequest, request.frameName(), loadType, event, formState.get());
+    if (request.requester() && request.frameName().isEmpty())
+        request.setFrameName(m_frame->document()->baseTarget());
+    TemporaryChange<bool> changeOpener(m_suppressOpenerInNewFrame, request.shouldSendReferrer() == NeverSendReferrer);
+    TemporaryChange<bool> changeClientRedirect(m_startingClientRedirect, request.clientRedirect());
 
-    // FIXME: It's possible this targetFrame will not be the same frame that was targeted by the actual
-    // load if frame names have changed.
-    Frame* sourceFrame = formState ? formState->sourceDocument()->frame() : m_frame;
-    if (!sourceFrame)
-        sourceFrame = m_frame;
-    Frame* targetFrame = sourceFrame->loader()->findFrameForNavigation(request.frameName());
-    if (targetFrame && targetFrame != sourceFrame) {
-        if (Page* page = targetFrame->page())
-            page->chrome().focus();
-    }
+    loadURL(resourceRequest, request.frameName(), loadType, request.triggeringEvent(), request.formState(), request.substituteData());
 }
 
-void FrameLoader::loadURL(const ResourceRequest& request, const String& frameName, FrameLoadType newLoadType, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
+void FrameLoader::loadURL(const ResourceRequest& request, const String& frameName, FrameLoadType newLoadType, PassRefPtr<Event> event, PassRefPtr<FormState> formState, const SubstituteData& substituteData)
 {
     if (m_inStopAllLoaders)
         return;
@@ -1004,7 +995,7 @@
     // The search for a target frame is done earlier in the case of form submission.
     Frame* targetFrame = isFormSubmission ? 0 : findFrameForNavigation(frameName);
     if (targetFrame && targetFrame != m_frame) {
-        targetFrame->loader()->loadURL(request, "_self", newLoadType, event, formState);
+        targetFrame->loader()->loadURL(request, "_self", newLoadType, event, formState, substituteData);
         return;
     }
 
@@ -1019,7 +1010,7 @@
     }
 
     bool sameURL = shouldTreatURLAsSameAsCurrent(request.url());
-    loadWithNavigationAction(request, action, newLoadType, formState, defaultSubstituteDataForURL(request.url()));
+    loadWithNavigationAction(request, action, newLoadType, formState, substituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.url()));
     // Example of this case are sites that reload the same URL with a different cookie
     // driving the generated content, or a master frame with links that drive a target
     // frame, where the user has clicked on the same link repeatedly.
@@ -1037,37 +1028,6 @@
     return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcdoc.length()), "text/html", "UTF-8", KURL());
 }
 
-void FrameLoader::load(const FrameLoadRequest& passedRequest)
-{
-    FrameLoadRequest request(passedRequest);
-
-    if (m_inStopAllLoaders)
-        return;
-
-    if (!request.frameName().isEmpty()) {
-        Frame* frame = findFrameForNavigation(request.frameName());
-        if (frame && frame->loader() != this) {
-            frame->loader()->load(request);
-            return;
-        }
-    }
-
-    if (!request.hasSubstituteData())
-        request.setSubstituteData(defaultSubstituteDataForURL(request.resourceRequest().url()));
-
-    ResourceRequest& r = request.resourceRequest();
-    const KURL& unreachableURL = request.substituteData().failingURL();
-
-    FrameLoadType type;
-    if (shouldTreatURLAsSameAsCurrent(r.url()))
-        type = FrameLoadTypeSame;
-    else if (shouldTreatURLAsSameAsCurrent(unreachableURL) && m_loadType == FrameLoadTypeReload)
-        type = FrameLoadTypeReload;
-    else
-        type = FrameLoadTypeStandard;
-    loadWithNavigationAction(r, NavigationAction(r, type, false), type, 0, request.substituteData());
-}
-
 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState, const SubstituteData& substituteData, const String& overrideEncoding)
 {
     ASSERT(m_client->hasWebView());
@@ -1314,12 +1274,6 @@
     }
 
     transitionToCommitted();
-
-    // Call clientRedirectCancelledOrFinished() here so that the frame load delegate is notified that the redirect's
-    // status has changed, if there was a redirect.
-    if (pdl->isClientRedirect())
-        clientRedirectCancelledOrFinished();
-    
     didOpenURL();
 
     LOG(Loading, "WebCoreLoading %s: Finished committing provisional load to URL %s", m_frame->tree()->uniqueName().string().utf8().data(),
@@ -1372,16 +1326,6 @@
         m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
 }
 
-void FrameLoader::clientRedirectCancelledOrFinished()
-{
-    m_client->dispatchDidCancelClientRedirect();
-}
-
-void FrameLoader::clientRedirected(const KURL& url, double seconds, double fireDate)
-{
-    m_client->dispatchWillPerformClientRedirect(url, seconds, fireDate);
-}
-
 bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationURL)
 {
     // This function implements the rule: "Don't reload if navigating by fragment within
@@ -1879,11 +1823,6 @@
     if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
         if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCopy().url())
             m_submittedFormURL = KURL();
-            
-        // Call clientRedirectCancelledOrFinished here so that the frame load delegate is notified that the redirect's
-        // status has changed, if there was a redirect.
-        if (loader->isClientRedirect())
-            clientRedirectCancelledOrFinished();
     }
 
     checkCompleted();
@@ -1896,7 +1835,7 @@
     m_documentLoader->setTriggeringAction(action);
 
     const ResourceRequest& request = action.resourceRequest();
-    if (!m_documentLoader->shouldContinueForNavigationPolicy(request))
+    if (!m_documentLoader->shouldContinueForNavigationPolicy(request, DocumentLoader::PolicyCheckStandard))
         return;
 
     // If we have a provisional request for a different document, a fragment scroll should cancel it.
@@ -1918,7 +1857,6 @@
     return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET"))
         && loadType != FrameLoadTypeReload
         && loadType != FrameLoadTypeReloadFromOrigin
-        && loadType != FrameLoadTypeSame
         && !shouldReload(m_frame->document()->url(), url)
         // We don't want to just scroll if a link from within a
         // frameset is trying to reload the frameset into _top.
@@ -2021,7 +1959,7 @@
         // subsequent activity by the frame which the parent frame isn't
         // supposed to learn. For example, if the child frame navigated to
         // a new URL, the parent frame shouldn't learn the URL.
-        shouldContinue = m_policyDocumentLoader->shouldContinueForNavigationPolicy(m_policyDocumentLoader->request());
+        shouldContinue = m_policyDocumentLoader->shouldContinueForNavigationPolicy(m_policyDocumentLoader->request(), DocumentLoader::PolicyCheckStandard);
     }
 
     // Two reasons we can't continue:
@@ -2031,11 +1969,6 @@
     bool canContinue = shouldContinue && shouldClose();
 
     if (!canContinue) {
-        // If we were waiting for a client redirect, but the policy delegate decided to ignore it, then we
-        // need to report that the client redirect was cancelled.
-        if (m_policyDocumentLoader->isClientRedirect())
-            clientRedirectCancelledOrFinished();
-
         setPolicyDocumentLoader(0);
 
         // If the navigation request came from the back/forward menu, and we punt on it, we have the 
@@ -2074,7 +2007,12 @@
         m_client->dispatchWillSubmitForm(formState);
 
     m_progressTracker->progressStarted();
+    if (m_startingClientRedirect)
+        m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url());
+    m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->request().url());
     m_client->dispatchDidStartProvisionalLoad();
+    if (m_startingClientRedirect)
+        m_client->dispatchDidCompleteClientRedirect(m_frame->document()->url());
     ASSERT(m_provisionalDocumentLoader);
 
     if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) {
@@ -2097,7 +2035,7 @@
     action.specifiesNavigationPolicy(&navigationPolicy);
 
     if (navigationPolicy == NavigationPolicyDownload) {
-        m_client->startDownload(action.resourceRequest());
+        m_client->loadURLExternally(action.resourceRequest(), navigationPolicy);
         return;
     }
 
@@ -2436,86 +2374,4 @@
     info.addMember(m_requestedHistoryItem, "requestedHistoryItem");
 }
 
-Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest& request, const WindowFeatures& features, bool& created)
-{
-    ASSERT(!features.dialog || request.frameName().isEmpty());
-
-    if (!request.frameName().isEmpty() && request.frameName() != "_blank") {
-        if (Frame* frame = lookupFrame->loader()->findFrameForNavigation(request.frameName(), openerFrame->document())) {
-            if (request.frameName() != "_self") {
-                if (Page* page = frame->page())
-                    page->chrome().focus();
-            }
-            created = false;
-            return frame;
-        }
-    }
-
-    // Sandboxed frames cannot open new auxiliary browsing contexts.
-    if (isDocumentSandboxed(openerFrame, SandboxPopups)) {
-        // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-        openerFrame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString() + "' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.");
-        return 0;
-    }
-
-    // FIXME: Setting the referrer should be the caller's responsibility.
-    FrameLoadRequest requestWithReferrer = request;
-    String referrer = SecurityPolicy::generateReferrerHeader(openerFrame->document()->referrerPolicy(), request.resourceRequest().url(), openerFrame->loader()->outgoingReferrer());
-    if (!referrer.isEmpty())
-        requestWithReferrer.resourceRequest().setHTTPReferrer(referrer);
-    FrameLoader::addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), openerFrame->loader()->outgoingOrigin());
-
-    if (openerFrame->settings() && !openerFrame->settings()->supportsMultipleWindows()) {
-        created = false;
-        return openerFrame;
-    }
-
-    Page* oldPage = openerFrame->page();
-    if (!oldPage)
-        return 0;
-
-    NavigationAction action(requestWithReferrer.resourceRequest());
-    Page* page = oldPage->chrome().client()->createWindow(openerFrame, requestWithReferrer, features, action);
-    if (!page)
-        return 0;
-
-    Frame* frame = page->mainFrame();
-
-    frame->loader()->forceSandboxFlags(openerFrame->document()->sandboxFlags());
-
-    if (request.frameName() != "_blank")
-        frame->tree()->setName(request.frameName());
-
-    page->chrome().setToolbarsVisible(features.toolBarVisible || features.locationBarVisible);
-    page->chrome().setStatusbarVisible(features.statusBarVisible);
-    page->chrome().setScrollbarsVisible(features.scrollbarsVisible);
-    page->chrome().setMenubarVisible(features.menuBarVisible);
-    page->chrome().setResizable(features.resizable);
-
-    // 'x' and 'y' specify the location of the window, while 'width' and 'height'
-    // specify the size of the viewport. We can only resize the window, so adjust
-    // for the difference between the window size and the viewport size.
-
-    FloatRect windowRect = page->chrome().windowRect();
-    FloatSize viewportSize = page->chrome().pageRect().size();
-
-    if (features.xSet)
-        windowRect.setX(features.x);
-    if (features.ySet)
-        windowRect.setY(features.y);
-    if (features.widthSet)
-        windowRect.setWidth(features.width + (windowRect.width() - viewportSize.width()));
-    if (features.heightSet)
-        windowRect.setHeight(features.height + (windowRect.height() - viewportSize.height()));
-
-    // Ensure non-NaN values, minimum size as well as being within valid screen area.
-    FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
-
-    page->chrome().setWindowRect(newWindowRect);
-    page->chrome().show();
-
-    created = true;
-    return frame;
-}
-
 } // namespace WebCore
diff --git a/Source/core/loader/FrameLoader.h b/Source/core/loader/FrameLoader.h
index af5f5a8..bb553fb 100644
--- a/Source/core/loader/FrameLoader.h
+++ b/Source/core/loader/FrameLoader.h
@@ -94,15 +94,10 @@
 
     // FIXME: These are all functions which start loads. We have too many.
     void loadURLIntoChildFrame(const ResourceRequest&, Frame*);
-    void loadFrameRequest(const FrameLoadRequest&, bool lockBackForwardList,  // Called by submitForm, calls loadPostRequest and loadURL.
-        PassRefPtr<Event>, PassRefPtr<FormState>, ShouldSendReferrer);
-
     void load(const FrameLoadRequest&);
 
     unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
 
-    void changeLocation(SecurityOrigin*, const KURL&, const String& referrer, bool lockBackForwardList = true, bool refresh = false);
-    void urlSelected(const KURL&, const String& target, PassRefPtr<Event>, bool lockBackForwardList, ShouldSendReferrer);
     void submitForm(PassRefPtr<FormSubmission>);
 
     void reload(bool endToEndReload = false, const KURL& overrideURL = KURL(), const String& overrideEncoding = String());
@@ -235,8 +230,6 @@
 
     void completed();
     bool allAncestorsAreComplete() const; // including this
-    void clientRedirected(const KURL&, double delay, double fireDate);
-    void clientRedirectCancelledOrFinished();
 
     void setOriginalURLForDownloadRequest(ResourceRequest&);
 
@@ -295,14 +288,12 @@
 
     void dispatchDidCommitLoad();
 
-    void urlSelected(const FrameLoadRequest&, PassRefPtr<Event>, bool lockBackForwardList, ShouldSendReferrer);
-
     // Calls continueLoadAfterNavigationPolicy
     void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&,
         FrameLoadType, PassRefPtr<FormState>, const SubstituteData&, const String& overrideEncoding = String());
 
-    // Called by loadFrameRequest, calls loadWithNavigationAction or checkNewWindowPolicyAndContinue
-    void loadURL(const ResourceRequest&, const String& frameName, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
+    // Called by load, calls loadWithNavigationAction or checkNewWindowPolicyAndContinue
+    void loadURL(const ResourceRequest&, const String& frameName, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>, const SubstituteData&);
 
     bool shouldReload(const KURL& currentURL, const KURL& destinationURL);
 
@@ -373,21 +364,13 @@
     bool m_didAccessInitialDocument;
     Timer<FrameLoader> m_didAccessInitialDocumentTimer;
     bool m_suppressOpenerInNewFrame;
+    bool m_startingClientRedirect;
 
     SandboxFlags m_forcedSandboxFlags;
 
     RefPtr<HistoryItem> m_requestedHistoryItem;
 };
 
-// This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for
-// modal dialog creation.  The lookupFrame is for looking up the frame name in case
-// the frame name references a frame different from the openerFrame, e.g. when it is
-// "_self" or "_parent".
-//
-// FIXME: Consider making this function part of an appropriate class (not FrameLoader)
-// and moving it to a more appropriate location.
-Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest&, const WindowFeatures&, bool& created);
-
 } // namespace WebCore
 
 #endif // FrameLoader_h
diff --git a/Source/core/loader/FrameLoaderClient.h b/Source/core/loader/FrameLoaderClient.h
index 011dc65..f68ce39 100644
--- a/Source/core/loader/FrameLoaderClient.h
+++ b/Source/core/loader/FrameLoaderClient.h
@@ -32,10 +32,11 @@
 
 #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>
+#include "wtf/Forward.h"
+#include "wtf/Vector.h"
 
 typedef class _jobject* jobject;
 
@@ -68,7 +69,6 @@
     class IntSize;
     class KURL;
     class MessageEvent;
-    class NavigationAction;
     class Page;
     class PluginView;
     class ResourceError;
@@ -93,6 +93,7 @@
 
         virtual void detachedFromParent() = 0;
 
+        virtual void dispatchWillRequestAfterPreconnect(ResourceRequest&) { }
         virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse) = 0;
         virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&) = 0;
         virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) = 0;
@@ -101,8 +102,7 @@
 
         virtual void dispatchDidHandleOnloadEvents() = 0;
         virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
-        virtual void dispatchDidCancelClientRedirect() = 0;
-        virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) = 0;
+        virtual void dispatchDidCompleteClientRedirect(const KURL&) { }
         virtual void dispatchDidNavigateWithinPage() { }
         virtual void dispatchDidChangeLocationWithinPage() = 0;
         virtual void dispatchWillClose() = 0;
@@ -117,7 +117,7 @@
 
         virtual void dispatchDidLayout(LayoutMilestones) { }
 
-        virtual PolicyAction decidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&) = 0;
+        virtual NavigationPolicy decidePolicyForNavigation(const ResourceRequest&, NavigationType, NavigationPolicy, bool isRedirect) = 0;
 
         virtual void dispatchUnableToImplementPolicy(const ResourceError&) = 0;
 
@@ -131,7 +131,7 @@
         virtual void postProgressEstimateChangedNotification() = 0;
         virtual void postProgressFinishedNotification() = 0;
 
-        virtual void startDownload(const ResourceRequest&, const String& suggestedName = String()) = 0;
+        virtual void loadURLExternally(const ResourceRequest&, NavigationPolicy, const String& suggestedName = String()) = 0;
 
         virtual void didReceiveDocumentData(const char*, int) = 0;
 
diff --git a/Source/core/loader/FrameLoaderStateMachine.cpp b/Source/core/loader/FrameLoaderStateMachine.cpp
index a442bc4..425f912 100644
--- a/Source/core/loader/FrameLoaderStateMachine.cpp
+++ b/Source/core/loader/FrameLoaderStateMachine.cpp
@@ -29,7 +29,7 @@
 #include "config.h"
 #include "core/loader/FrameLoaderStateMachine.h"
 
-#include <wtf/Assertions.h>
+#include "wtf/Assertions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/FrameLoaderStateMachine.h b/Source/core/loader/FrameLoaderStateMachine.h
index 9503951..c9c6cc8 100644
--- a/Source/core/loader/FrameLoaderStateMachine.h
+++ b/Source/core/loader/FrameLoaderStateMachine.h
@@ -29,7 +29,7 @@
 #ifndef FrameLoaderStateMachine_h
 #define FrameLoaderStateMachine_h
 
-#include <wtf/Noncopyable.h>
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/FrameLoaderTypes.h b/Source/core/loader/FrameLoaderTypes.h
index bba82e2..75cf7ad 100644
--- a/Source/core/loader/FrameLoaderTypes.h
+++ b/Source/core/loader/FrameLoaderTypes.h
@@ -39,12 +39,6 @@
         FrameStateComplete
     };
 
-    enum PolicyAction {
-        PolicyUse,
-        PolicyDownload,
-        PolicyIgnore
-    };
-
     // NOTE: Keep in sync with WebKit/mac/WebView/WebFramePrivate.h and WebKit/win/Interfaces/IWebFramePrivate.idl
     enum FrameLoadType {
         FrameLoadTypeStandard,
diff --git a/Source/core/loader/ImageLoader.h b/Source/core/loader/ImageLoader.h
index fab6000..8c07187 100644
--- a/Source/core/loader/ImageLoader.h
+++ b/Source/core/loader/ImageLoader.h
@@ -26,7 +26,7 @@
 #include "core/loader/cache/CachedImage.h"
 #include "core/loader/cache/CachedImageClient.h"
 #include "core/loader/cache/CachedResourceHandle.h"
-#include <wtf/text/AtomicString.h>
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/LinkLoader.cpp b/Source/core/loader/LinkLoader.cpp
index 34fd95b..79315bc 100644
--- a/Source/core/loader/LinkLoader.cpp
+++ b/Source/core/loader/LinkLoader.cpp
@@ -32,12 +32,12 @@
 #include "config.h"
 #include "core/loader/LinkLoader.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/dom/Document.h"
 #include "core/html/LinkRelAttribute.h"
 #include "core/loader/Prerenderer.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/page/Settings.h"
 #include "core/platform/PrerenderHandle.h"
 #include "core/platform/network/DNS.h"
@@ -118,7 +118,7 @@
         if (!m_client->shouldLoadLink())
             return false;
         CachedResource::Type type = relAttribute.isLinkSubresource() ?  CachedResource::LinkSubresource : CachedResource::LinkPrefetch;
-        CachedResourceRequest linkRequest(ResourceRequest(document->completeURL(href)), cachedResourceRequestInitiators().link);
+        CachedResourceRequest linkRequest(ResourceRequest(document->completeURL(href)), CachedResourceInitiatorTypeNames::link);
         if (m_cachedLinkResource) {
             m_cachedLinkResource->removeClient(this);
             m_cachedLinkResource = 0;
diff --git a/Source/core/loader/LinkLoader.h b/Source/core/loader/LinkLoader.h
index d49f2ee..3bcf9de 100644
--- a/Source/core/loader/LinkLoader.h
+++ b/Source/core/loader/LinkLoader.h
@@ -37,8 +37,7 @@
 #include "core/loader/cache/CachedResourceHandle.h"
 #include "core/platform/PrerenderClient.h"
 #include "core/platform/Timer.h"
-
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/MixedContentChecker.h b/Source/core/loader/MixedContentChecker.h
index 89e3bef..f4d6647 100644
--- a/Source/core/loader/MixedContentChecker.h
+++ b/Source/core/loader/MixedContentChecker.h
@@ -31,7 +31,7 @@
 #ifndef MixedContentChecker_h
 #define MixedContentChecker_h
 
-#include <wtf/text/WTFString.h>
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/NavigationScheduler.cpp b/Source/core/loader/NavigationScheduler.cpp
index 56d2e0b..7551b35 100644
--- a/Source/core/loader/NavigationScheduler.cpp
+++ b/Source/core/loader/NavigationScheduler.cpp
@@ -71,7 +71,6 @@
 
     virtual bool shouldStartTimer(Frame*) { return true; }
     virtual void didStartTimer(Frame*, Timer<NavigationScheduler>*) { }
-    virtual void didStopTimer(Frame*) { }
 
     double delay() const { return m_delay; }
     bool lockBackForwardList() const { return m_lockBackForwardList; }
@@ -111,7 +110,10 @@
     virtual void fire(Frame* frame)
     {
         OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();
-        frame->loader()->changeLocation(m_securityOrigin.get(), KURL(ParsedURLString, m_url), m_referrer, lockBackForwardList(), false);
+        FrameLoadRequest request(m_securityOrigin.get(), ResourceRequest(KURL(ParsedURLString, m_url), m_referrer), "_self");
+        request.setLockBackForwardList(lockBackForwardList());
+        request.setClientRedirect(true);
+        frame->loader()->load(request);
     }
 
     virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer)
@@ -121,25 +123,10 @@
         m_haveToldClient = true;
 
         OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();
-        frame->loader()->clientRedirected(KURL(ParsedURLString, m_url), delay(), currentTime() + timer->nextFireInterval());
         if (frame->loader()->history()->currentItemShouldBeReplaced())
             setLockBackForwardList(true);
     }
 
-    virtual void didStopTimer(Frame* frame)
-    {
-        if (!m_haveToldClient)
-            return;
-
-        // Do not set a UserGestureIndicator because
-        // clientRedirectCancelledOrFinished() is also called from many places
-        // inside FrameLoader, where the gesture state is not set and is in
-        // fact unavailable. We need to be consistent with them, otherwise the
-        // gesture state will sometimes be set and sometimes not within
-        // dispatchDidCancelClientRedirect().
-        frame->loader()->clientRedirectCancelledOrFinished();
-    }
-
     SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
     String url() const { return m_url; }
     String referrer() const { return m_referrer; }
@@ -164,8 +151,12 @@
     virtual void fire(Frame* frame)
     {
         OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();
-        bool refresh = equalIgnoringFragmentIdentifier(frame->document()->url(), KURL(ParsedURLString, url()));
-        frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString, url()), referrer(), lockBackForwardList(), refresh);
+        FrameLoadRequest request(securityOrigin(), ResourceRequest(KURL(ParsedURLString, url()), referrer()), "_self");
+        request.setLockBackForwardList(lockBackForwardList());
+        if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.resourceRequest().url()))
+            request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData);
+        request.setClientRedirect(true);
+        frame->loader()->load(request);
     }
 };
 
@@ -185,7 +176,10 @@
     virtual void fire(Frame* frame)
     {
         OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();
-        frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString, url()), referrer(), lockBackForwardList(), true);
+        FrameLoadRequest request(securityOrigin(), ResourceRequest(KURL(ParsedURLString, url()), referrer(), ReloadIgnoringCacheData), "_self");
+        request.setLockBackForwardList(lockBackForwardList());
+        request.setClientRedirect(true);
+        frame->loader()->load(request);
     }
 };
 
@@ -202,9 +196,11 @@
         OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();
 
         if (!m_historySteps) {
+            FrameLoadRequest frameRequest(frame->document()->securityOrigin(), ResourceRequest(frame->document()->url()));
+            frameRequest.setLockBackForwardList(lockBackForwardList());
             // Special case for go(0) from a frame -> reload only the frame
             // To follow Firefox and IE's behavior, history reload can only navigate the self frame.
-            frame->loader()->urlSelected(frame->document()->url(), "_self", 0, lockBackForwardList(), MaybeSendReferrer);
+            frame->loader()->load(frameRequest);
             return;
         }
         // go(i!=0) from a frame navigates into the history of the frame only,
@@ -239,7 +235,10 @@
             return;
         FrameLoadRequest frameRequest(requestingDocument->document()->securityOrigin());
         m_submission->populateFrameLoadRequest(frameRequest);
-        frame->loader()->loadFrameRequest(frameRequest, lockBackForwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer);
+        frameRequest.setLockBackForwardList(lockBackForwardList());
+        frameRequest.setTriggeringEvent(m_submission->event());
+        frameRequest.setFormState(m_submission->state());
+        frame->loader()->load(frameRequest);
     }
     
     virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer)
@@ -249,25 +248,10 @@
         m_haveToldClient = true;
 
         OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();
-        frame->loader()->clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer->nextFireInterval());
         if (frame->loader()->history()->currentItemShouldBeReplaced())
             setLockBackForwardList(true);
     }
 
-    virtual void didStopTimer(Frame* frame)
-    {
-        if (!m_haveToldClient)
-            return;
-
-        // Do not set a UserGestureIndicator because
-        // clientRedirectCancelledOrFinished() is also called from many places
-        // inside FrameLoader, where the gesture state is not set and is in
-        // fact unavailable. We need to be consistent with them, otherwise the
-        // gesture state will sometimes be set and sometimes not within
-        // dispatchDidCancelClientRedirect().
-        frame->loader()->clientRedirectCancelledOrFinished();
-    }
-
 private:
     RefPtr<FormSubmission> m_submission;
     bool m_haveToldClient;
@@ -355,11 +339,18 @@
     FrameLoader* loader = m_frame->loader();
 
     // If the URL we're going to navigate to is the same as the current one, except for the
-    // fragment part, we don't need to schedule the location change.
-    KURL parsedURL(ParsedURLString, url);
-    if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame->document()->url(), parsedURL)) {
-        loader->changeLocation(securityOrigin, m_frame->document()->completeURL(url), referrer, lockBackForwardList);
-        return;
+    // fragment part, we don't need to schedule the location change. We'll skip this
+    // optimization for cross-origin navigations to minimize the navigator's ability to
+    // execute timing attacks.
+    if (securityOrigin->canAccess(m_frame->document()->securityOrigin())) {
+        KURL parsedURL(ParsedURLString, url);
+        if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame->document()->url(), parsedURL)) {
+            FrameLoadRequest request(securityOrigin, ResourceRequest(m_frame->document()->completeURL(url), referrer), "_self");
+            request.setLockBackForwardList(lockBackForwardList);
+            request.setClientRedirect(true);
+            loader->load(request);
+            return;
+        }
     }
 
     // Handle a location change of a page with no document as a special case.
@@ -482,10 +473,7 @@
     if (m_timer.isActive())
         InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
     m_timer.stop();
-
-    OwnPtr<ScheduledNavigation> redirect(m_redirect.release());
-    if (redirect)
-        redirect->didStopTimer(m_frame);
+    m_redirect.clear();
 }
 
 } // namespace WebCore
diff --git a/Source/core/loader/NavigationScheduler.h b/Source/core/loader/NavigationScheduler.h
index 46213c4..2f4032d 100644
--- a/Source/core/loader/NavigationScheduler.h
+++ b/Source/core/loader/NavigationScheduler.h
@@ -32,11 +32,11 @@
 #define NavigationScheduler_h
 
 #include "core/platform/Timer.h"
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
+#include "wtf/Forward.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/PingLoader.cpp b/Source/core/loader/PingLoader.cpp
index 4ec9a72..3d96a33 100644
--- a/Source/core/loader/PingLoader.cpp
+++ b/Source/core/loader/PingLoader.cpp
@@ -99,12 +99,12 @@
     UNUSED_PARAM(leakedPingLoader);
 }
 
-void PingLoader::sendViolationReport(Frame* frame, const KURL& reportURL, PassRefPtr<FormData> report)
+void PingLoader::sendViolationReport(Frame* frame, const KURL& reportURL, PassRefPtr<FormData> report, ViolationReportType type)
 {
     ResourceRequest request(reportURL);
     request.setTargetType(ResourceRequest::TargetIsSubresource);
     request.setHTTPMethod("POST");
-    request.setHTTPContentType("application/json");
+    request.setHTTPContentType(type == ContentSecurityPolicyViolationReport ? "application/csp-report" : "application/json");
     request.setHTTPBody(report);
     frame->loader()->addExtraFieldsToRequest(request);
 
diff --git a/Source/core/loader/PingLoader.h b/Source/core/loader/PingLoader.h
index d65842d..bf3d734 100644
--- a/Source/core/loader/PingLoader.h
+++ b/Source/core/loader/PingLoader.h
@@ -35,8 +35,8 @@
 #include "core/platform/Timer.h"
 #include "core/platform/network/ResourceHandleClient.h"
 #include "core/platform/network/ResourceHandleTypes.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
@@ -55,9 +55,14 @@
 class PingLoader : private ResourceHandleClient {
     WTF_MAKE_NONCOPYABLE(PingLoader); WTF_MAKE_FAST_ALLOCATED;
 public:
+    enum ViolationReportType {
+        ContentSecurityPolicyViolationReport,
+        XSSAuditorViolationReport
+    };
+
     static void loadImage(Frame*, const KURL& url);
     static void sendPing(Frame*, const KURL& pingURL, const KURL& destinationURL);
-    static void sendViolationReport(Frame*, const KURL& reportURL, PassRefPtr<FormData> report);
+    static void sendViolationReport(Frame*, const KURL& reportURL, PassRefPtr<FormData> report, ViolationReportType);
 
     virtual ~PingLoader();
 
diff --git a/Source/core/loader/Prerenderer.cpp b/Source/core/loader/Prerenderer.cpp
index b3a5c4e..e16405d 100644
--- a/Source/core/loader/Prerenderer.cpp
+++ b/Source/core/loader/Prerenderer.cpp
@@ -40,12 +40,11 @@
 #include "core/platform/PrerenderHandle.h"
 #include "weborigin/ReferrerPolicy.h"
 #include "weborigin/SecurityPolicy.h"
-
-#include <wtf/MemoryInstrumentationVector.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/ProgressTracker.h b/Source/core/loader/ProgressTracker.h
index 2c6a610..c871cc4 100644
--- a/Source/core/loader/ProgressTracker.h
+++ b/Source/core/loader/ProgressTracker.h
@@ -26,11 +26,11 @@
 #ifndef ProgressTracker_h
 #define ProgressTracker_h
 
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/ResourceLoaderOptions.h b/Source/core/loader/ResourceLoaderOptions.h
index a0836d3..53a3a95 100644
--- a/Source/core/loader/ResourceLoaderOptions.h
+++ b/Source/core/loader/ResourceLoaderOptions.h
@@ -72,6 +72,11 @@
     PotentiallyCrossOriginEnabled // Indicates "potentially CORS-enabled fetch" in HTML standard.
 };
 
+enum RequestInitiatorContext {
+    DocumentContext,
+    WorkerContext,
+};
+
 struct ResourceLoaderOptions {
     ResourceLoaderOptions()
         : sendLoadCallbacks(DoNotSendCallbacks)
@@ -83,6 +88,7 @@
         , securityCheck(DoSecurityCheck)
         , contentSecurityPolicyOption(CheckContentSecurityPolicy)
         , requestOriginPolicy(UseDefaultOriginRestrictionsForType)
+        , requestInitiatorContext(DocumentContext)
     {
     }
 
@@ -95,7 +101,8 @@
         ClientCrossOriginCredentialPolicy crossOriginCredentialPolicy,
         SecurityCheckPolicy securityCheck,
         ContentSecurityPolicyCheck contentSecurityPolicyOption,
-        RequestOriginPolicy requestOriginPolicy)
+        RequestOriginPolicy requestOriginPolicy,
+        RequestInitiatorContext requestInitiatorContext)
         : sendLoadCallbacks(sendLoadCallbacks)
         , sniffContent(sniffContent)
         , dataBufferingPolicy(dataBufferingPolicy)
@@ -105,6 +112,7 @@
         , securityCheck(securityCheck)
         , contentSecurityPolicyOption(contentSecurityPolicyOption)
         , requestOriginPolicy(requestOriginPolicy)
+        , requestInitiatorContext(requestInitiatorContext)
     {
     }
     SendCallbackPolicy sendLoadCallbacks;
@@ -117,6 +125,7 @@
     ContentSecurityPolicyCheck contentSecurityPolicyOption;
     CachedResourceInitiatorInfo initiatorInfo;
     RequestOriginPolicy requestOriginPolicy;
+    RequestInitiatorContext requestInitiatorContext;
 };
 
 } // namespace WebCore
diff --git a/Source/core/loader/SinkDocument.cpp b/Source/core/loader/SinkDocument.cpp
index a4464ab..307990c 100644
--- a/Source/core/loader/SinkDocument.cpp
+++ b/Source/core/loader/SinkDocument.cpp
@@ -47,8 +47,8 @@
     virtual size_t appendBytes(const char*, size_t) OVERRIDE { return 0; }
 };
 
-SinkDocument::SinkDocument(Frame* frame, const KURL& url)
-    : HTMLDocument(frame, url)
+SinkDocument::SinkDocument(const DocumentInit& initializer)
+    : HTMLDocument(initializer)
 {
     setCompatibilityMode(QuirksMode);
     lockCompatibilityMode();
diff --git a/Source/core/loader/SinkDocument.h b/Source/core/loader/SinkDocument.h
index 52792c8..e68bc45 100644
--- a/Source/core/loader/SinkDocument.h
+++ b/Source/core/loader/SinkDocument.h
@@ -32,13 +32,13 @@
 
 class SinkDocument FINAL : public HTMLDocument {
 public:
-    static PassRefPtr<SinkDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<SinkDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new SinkDocument(frame, url));
+        return adoptRef(new SinkDocument(initializer));
     }
 
 private:
-    SinkDocument(Frame*, const KURL&);
+    SinkDocument(const DocumentInit&);
     
     virtual PassRefPtr<DocumentParser> createParser();
 };
diff --git a/Source/core/loader/SubframeLoader.cpp b/Source/core/loader/SubframeLoader.cpp
index 1c7e25b..6543297 100644
--- a/Source/core/loader/SubframeLoader.cpp
+++ b/Source/core/loader/SubframeLoader.cpp
@@ -347,7 +347,7 @@
 
     renderer->setWidget(widget);
     m_containsPlugins = true;
-    pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
+    pluginElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
     return true;
 }
 
diff --git a/Source/core/loader/TextTrackLoader.cpp b/Source/core/loader/TextTrackLoader.cpp
index 6f4ee8b..d5342ea 100644
--- a/Source/core/loader/TextTrackLoader.cpp
+++ b/Source/core/loader/TextTrackLoader.cpp
@@ -27,12 +27,12 @@
 
 #include "core/loader/TextTrackLoader.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/dom/Document.h"
 #include "core/html/track/WebVTTParser.h"
 #include "core/loader/CrossOriginAccessControl.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/loader/cache/CachedTextTrack.h"
 #include "core/platform/Logging.h"
 #include "core/platform/SharedBuffer.h"
@@ -152,7 +152,7 @@
 
     ASSERT(m_scriptExecutionContext->isDocument());
     Document* document = toDocument(m_scriptExecutionContext);
-    CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url)), cachedResourceRequestInitiators().texttrack);
+    CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url)), CachedResourceInitiatorTypeNames::texttrack);
 
     if (!crossOriginMode.isNull()) {
         m_crossOriginMode = crossOriginMode;
diff --git a/Source/core/loader/TextTrackLoader.h b/Source/core/loader/TextTrackLoader.h
index dd17b2a..dc8eb98 100644
--- a/Source/core/loader/TextTrackLoader.h
+++ b/Source/core/loader/TextTrackLoader.h
@@ -31,7 +31,7 @@
 #include "core/loader/cache/CachedResourceHandle.h"
 #include "core/loader/cache/CachedTextTrack.h"
 #include "core/platform/Timer.h"
-#include <wtf/OwnPtr.h>
+#include "wtf/OwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/ThreadableLoaderClientWrapper.h b/Source/core/loader/ThreadableLoaderClientWrapper.h
index 7180d90..22a7e99 100644
--- a/Source/core/loader/ThreadableLoaderClientWrapper.h
+++ b/Source/core/loader/ThreadableLoaderClientWrapper.h
@@ -32,9 +32,9 @@
 #define ThreadableLoaderClientWrapper_h
 
 #include "core/loader/ThreadableLoaderClient.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/Threading.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/WorkerThreadableLoader.cpp b/Source/core/loader/WorkerThreadableLoader.cpp
index b0abbf8..0acff28 100644
--- a/Source/core/loader/WorkerThreadableLoader.cpp
+++ b/Source/core/loader/WorkerThreadableLoader.cpp
@@ -42,9 +42,9 @@
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerThread.h"
-#include <wtf/MainThread.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/MainThread.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/Vector.h"
 
 using namespace std;
 
@@ -109,6 +109,7 @@
 
     OwnPtr<ResourceRequest> request(ResourceRequest::adopt(requestData));
     request->setHTTPReferrer(outgoingReferrer);
+    options.requestInitiatorContext = WorkerContext;
     // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path
     // will return a 0 value.  Either this should return 0 or the other code path should do a callback with
     // a failure.
diff --git a/Source/core/loader/WorkerThreadableLoader.h b/Source/core/loader/WorkerThreadableLoader.h
index ac4b7d9..911bf6e 100644
--- a/Source/core/loader/WorkerThreadableLoader.h
+++ b/Source/core/loader/WorkerThreadableLoader.h
@@ -34,13 +34,12 @@
 #include "core/loader/ThreadableLoader.h"
 #include "core/loader/ThreadableLoaderClient.h"
 #include "core/loader/ThreadableLoaderClientWrapper.h"
-
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Threading.h>
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Threading.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/appcache/DOMApplicationCache.cpp b/Source/core/loader/appcache/DOMApplicationCache.cpp
index c8206d1..3b2467b 100644
--- a/Source/core/loader/appcache/DOMApplicationCache.cpp
+++ b/Source/core/loader/appcache/DOMApplicationCache.cpp
@@ -72,14 +72,14 @@
 {
     ApplicationCacheHost* cacheHost = applicationCacheHost();
     if (!cacheHost || !cacheHost->update())
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
 }
 
 void DOMApplicationCache::swapCache(ExceptionCode& ec)
 {
     ApplicationCacheHost* cacheHost = applicationCacheHost();
     if (!cacheHost || !cacheHost->swapCache())
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
 }
 
 void DOMApplicationCache::abort()
diff --git a/Source/core/loader/appcache/DOMApplicationCache.idl b/Source/core/loader/appcache/DOMApplicationCache.idl
index c58f5e3..057f7b5 100644
--- a/Source/core/loader/appcache/DOMApplicationCache.idl
+++ b/Source/core/loader/appcache/DOMApplicationCache.idl
@@ -25,9 +25,8 @@
 
 [
     NoInterfaceObject,
-    EventTarget,
     DoNotCheckConstants
-] interface DOMApplicationCache {
+] interface DOMApplicationCache : EventTarget {
     // update status
     const unsigned short UNCACHED = 0;
     const unsigned short IDLE = 1;
@@ -50,14 +49,5 @@
     attribute EventListener onupdateready;
     attribute EventListener oncached;
     attribute EventListener onobsolete;
-
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
 
diff --git a/Source/core/loader/archive/MHTMLArchive.h b/Source/core/loader/archive/MHTMLArchive.h
index d8ceeea..d102afd 100644
--- a/Source/core/loader/archive/MHTMLArchive.h
+++ b/Source/core/loader/archive/MHTMLArchive.h
@@ -32,10 +32,10 @@
 #define MHTMLArchive_h
 
 #include "core/loader/archive/ArchiveResource.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/archive/MHTMLParser.h b/Source/core/loader/archive/MHTMLParser.h
index c016fda..dda8bd3 100644
--- a/Source/core/loader/archive/MHTMLParser.h
+++ b/Source/core/loader/archive/MHTMLParser.h
@@ -32,9 +32,9 @@
 #define MHTMLParser_h
 
 #include "core/platform/SharedBufferChunkReader.h"
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/cache/CachedDocument.cpp b/Source/core/loader/cache/CachedDocument.cpp
index ea72449..d0ad108 100644
--- a/Source/core/loader/cache/CachedDocument.cpp
+++ b/Source/core/loader/cache/CachedDocument.cpp
@@ -71,7 +71,7 @@
 {
     switch (type()) {
     case SVGDocumentResource:
-        return SVGDocument::create(0, url);
+        return SVGDocument::create(DocumentInit(url));
     default:
         // FIXME: We'll add more types to support HTMLImports.
         ASSERT_NOT_REACHED();
diff --git a/Source/core/loader/cache/CachedFont.cpp b/Source/core/loader/cache/CachedFont.cpp
index 129de3e..d82b581 100644
--- a/Source/core/loader/cache/CachedFont.cpp
+++ b/Source/core/loader/cache/CachedFont.cpp
@@ -88,21 +88,21 @@
     return m_fontData;
 }
 
-FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
+FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
 {
 #if ENABLE(SVG_FONTS)
     if (m_externalSVGDocument)
         return FontPlatformData(size, bold, italic);
 #endif
     ASSERT(m_fontData);
-    return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);
+    return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant);
 }
 
 #if ENABLE(SVG_FONTS)
 bool CachedFont::ensureSVGFontData()
 {
     if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) {
-        m_externalSVGDocument = SVGDocument::create(0, KURL());
+        m_externalSVGDocument = SVGDocument::create();
 
         RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml");
         String svgSource = decoder->decode(m_data->data(), m_data->size());
@@ -135,10 +135,10 @@
 #endif
 
     if (fontName.isEmpty())
-        return static_cast<SVGFontElement*>(list->item(0));
+        return toSVGFontElement(list->item(0));
 
     for (unsigned i = 0; i < listLength; ++i) {
-        SVGFontElement* element = static_cast<SVGFontElement*>(list->item(i));
+        SVGFontElement* element = toSVGFontElement(list->item(i));
         if (element->getIdAttribute() == fontName)
             return element;
     }
diff --git a/Source/core/loader/cache/CachedFont.h b/Source/core/loader/cache/CachedFont.h
index 1750f9f..775ff03 100644
--- a/Source/core/loader/cache/CachedFont.h
+++ b/Source/core/loader/cache/CachedFont.h
@@ -29,7 +29,6 @@
 #include "core/loader/cache/CachedResource.h"
 #include "core/loader/cache/CachedResourceClient.h"
 #include "core/platform/graphics/FontOrientation.h"
-#include "core/platform/graphics/FontRenderingMode.h"
 #include "core/platform/graphics/FontWidthVariant.h"
 
 namespace WebCore {
@@ -54,7 +53,7 @@
     bool stillNeedsLoad() const { return !m_loadInitiated; }
 
     bool ensureCustomFontData();
-    FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 
 #if ENABLE(SVG_FONTS)
     bool ensureSVGFontData();
diff --git a/Source/core/loader/cache/CachedImage.cpp b/Source/core/loader/cache/CachedImage.cpp
index efdd5d6..0585571 100644
--- a/Source/core/loader/cache/CachedImage.cpp
+++ b/Source/core/loader/cache/CachedImage.cpp
@@ -34,11 +34,11 @@
 #include "core/platform/graphics/BitmapImage.h"
 #include "core/rendering/RenderObject.h"
 #include "core/svg/graphics/SVGImage.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/MemoryInstrumentationHashMap.h>
-#include <wtf/MemoryObjectInfo.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/Vector.h>
+#include "wtf/CurrentTime.h"
+#include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryObjectInfo.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/Vector.h"
 
 using std::max;
 
diff --git a/Source/core/loader/cache/CachedResource.cpp b/Source/core/loader/cache/CachedResource.cpp
index f2220a2..2ccf57b 100644
--- a/Source/core/loader/cache/CachedResource.cpp
+++ b/Source/core/loader/cache/CachedResource.cpp
@@ -108,7 +108,6 @@
 CachedResource::CachedResource(const ResourceRequest& request, Type type)
     : m_resourceRequest(request)
     , m_responseTimestamp(currentTime())
-    , m_decodedDataDeletionTimer(this, &CachedResource::decodedDataDeletionTimerFired)
     , m_cancelTimer(this, &CachedResource::cancelTimerFired)
     , m_lastDecodedAccessTime(0)
     , m_loadFinishTime(0)
@@ -368,9 +367,6 @@
 
 void CachedResource::didAddClient(CachedResourceClient* c)
 {
-    if (m_decodedDataDeletionTimer.isActive())
-        m_decodedDataDeletionTimer.stop();
-
     if (m_clientsAwaitingCallback.contains(c)) {
         m_clients.add(c);
         m_clientsAwaitingCallback.remove(c);
@@ -429,7 +425,6 @@
         }
         if (!m_switchingClientsToRevalidatedResource)
             allClientsRemoved();
-        destroyDecodedDataIfNeeded();
         if (response().cacheControlContainsNoStore()) {
             // RFC2616 14.9.2:
             // "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible"
@@ -458,25 +453,12 @@
     ASSERT_UNUSED(timer, timer == &m_cancelTimer);
     if (hasClients() || !m_loader)
         return;
+    CachedResourceHandle<CachedResource> protect(this);
     m_loader->cancelIfNotFinishing();
     if (m_status != Cached)
         memoryCache()->remove(this);
 }
 
-void CachedResource::destroyDecodedDataIfNeeded()
-{
-    if (!m_decodedSize)
-        return;
-
-    if (double interval = memoryCache()->deadDecodedDataDeletionInterval())
-        m_decodedDataDeletionTimer.startOneShot(interval);
-}
-
-void CachedResource::decodedDataDeletionTimerFired(Timer<CachedResource>*)
-{
-    destroyDecodedData();
-}
-
 bool CachedResource::deleteIfPossible()
 {
     if (canDelete() && !inCache()) {
@@ -678,13 +660,7 @@
     ASSERT(!canDelete());
 
     m_resourceToRevalidate->updateResponseAfterRevalidation(response);
-    memoryCache()->remove(this);
-    memoryCache()->add(m_resourceToRevalidate);
-    int delta = m_resourceToRevalidate->size();
-    if (m_resourceToRevalidate->decodedSize() && m_resourceToRevalidate->hasClients())
-        memoryCache()->insertInLiveDecodedResourcesList(m_resourceToRevalidate);
-    if (delta)
-        memoryCache()->adjustSize(m_resourceToRevalidate->hasClients(), delta);
+    memoryCache()->replace(m_resourceToRevalidate, this);
 
     switchClientsToRevalidatedResource();
     ASSERT(!m_deleted);
@@ -705,11 +681,8 @@
     ASSERT(inCache());
 
     // Need to make sure to remove before we increase the access count, since
-    // the queue will possibly change. However, if this is a resource that is being
-    // added back in due to a successful revalidation, it is not present in the LRU list
-    // at this point, so we don't need to remove it.
-    if (!m_proxyResource && m_accessCount)
-        memoryCache()->removeFromLRUList(this);
+    // the queue will possibly change.
+    memoryCache()->removeFromLRUList(this);
 
     // If this is the first time the resource has been accessed, adjust the size of the cache to account for its initial size.
     if (!m_accessCount)
@@ -882,7 +855,6 @@
     info.addMember(m_proxyResource, "proxyResource");
     info.addMember(m_handlesToRevalidate, "handlesToRevalidate");
     info.addMember(m_options, "options");
-    info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer");
     info.ignoreMember(m_clientsAwaitingCallback);
 
     if (m_purgeableData && !m_purgeableData->wasPurged())
diff --git a/Source/core/loader/cache/CachedResource.h b/Source/core/loader/cache/CachedResource.h
index e78d903..7c59bad 100644
--- a/Source/core/loader/cache/CachedResource.h
+++ b/Source/core/loader/cache/CachedResource.h
@@ -121,7 +121,6 @@
     virtual void didAddClient(CachedResourceClient*);
     virtual void didRemoveClient(CachedResourceClient*) { }
     virtual void allClientsRemoved();
-    void destroyDecodedDataIfNeeded();
 
     unsigned count() const { return m_clients.size(); }
 
@@ -282,12 +281,10 @@
 
     RefPtr<SharedBuffer> m_data;
     OwnPtr<PurgeableBuffer> m_purgeableData;
-    Timer<CachedResource> m_decodedDataDeletionTimer;
     Timer<CachedResource> m_cancelTimer;
 
 private:
     bool addClientToSet(CachedResourceClient*);
-    void decodedDataDeletionTimerFired(Timer<CachedResource>*);
     void cancelTimerFired(Timer<CachedResource>*);
 
     void revalidationSucceeded(const ResourceResponse&);
diff --git a/Source/core/loader/cache/CachedResourceClient.h b/Source/core/loader/cache/CachedResourceClient.h
index 5d1be65..e0e1b09 100644
--- a/Source/core/loader/cache/CachedResourceClient.h
+++ b/Source/core/loader/cache/CachedResourceClient.h
@@ -25,8 +25,8 @@
 #ifndef CachedResourceClient_h
 #define CachedResourceClient_h
 
-#include <wtf/FastAllocBase.h>
-#include <wtf/Forward.h>
+#include "wtf/FastAllocBase.h"
+#include "wtf/Forward.h"
 
 namespace WebCore {
 class CachedResource;
diff --git a/Source/core/loader/cache/CachedResourceClientWalker.h b/Source/core/loader/cache/CachedResourceClientWalker.h
index 9d5d9a1..e04ad6c 100644
--- a/Source/core/loader/cache/CachedResourceClientWalker.h
+++ b/Source/core/loader/cache/CachedResourceClientWalker.h
@@ -26,8 +26,8 @@
 #define CachedResourceClientWalker_h
 
 #include "core/loader/cache/CachedResourceClient.h"
-#include <wtf/HashCountedSet.h>
-#include <wtf/Vector.h>
+#include "wtf/HashCountedSet.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/cache/CachedResourceInitiatorTypeNames.in b/Source/core/loader/cache/CachedResourceInitiatorTypeNames.in
new file mode 100644
index 0000000..7356271
--- /dev/null
+++ b/Source/core/loader/cache/CachedResourceInitiatorTypeNames.in
@@ -0,0 +1,8 @@
+css
+document
+icon
+link
+processinginstruction
+texttrack
+xml
+xmlhttprequest
diff --git a/Source/core/loader/cache/CachedResourceLoader.cpp b/Source/core/loader/cache/CachedResourceLoader.cpp
index a534f01..3c00d4a 100644
--- a/Source/core/loader/cache/CachedResourceLoader.cpp
+++ b/Source/core/loader/cache/CachedResourceLoader.cpp
@@ -251,7 +251,7 @@
         memoryCache()->remove(existing);
     }
 
-    request.setOptions(ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck, CheckContentSecurityPolicy, UseDefaultOriginRestrictionsForType));
+    request.setOptions(ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, SkipSecurityCheck, CheckContentSecurityPolicy, UseDefaultOriginRestrictionsForType, DocumentContext));
     return static_cast<CachedCSSStyleSheet*>(requestResource(CachedResource::CSSStyleSheet, request).get());
 }
 
@@ -430,6 +430,7 @@
     String error;
     switch (resource->type()) {
     case CachedResource::Script:
+    case CachedResource::RawResource:
         if (resource->options().requestOriginPolicy == PotentiallyCrossOriginEnabled
             && !m_document->securityOrigin()->canRequest(resource->response().url())
             && !resource->passesAccessControlCheck(m_document->securityOrigin(), error)) {
@@ -704,6 +705,9 @@
 
 void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedResourceHandle<CachedResource>& resource, const CachedResourceRequest& request)
 {
+    if (request.options().requestInitiatorContext != DocumentContext)
+        return;
+
     CachedResourceInitiatorInfo info = request.options().initiatorInfo;
     info.startTime = monotonicallyIncreasingTime();
 
@@ -1139,7 +1143,7 @@
 
 const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
 {
-    DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaultOriginRestrictionsForType));
+    DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaultOriginRestrictionsForType, DocumentContext));
     return options;
 }
 
diff --git a/Source/core/loader/cache/CachedResourceRequestInitiators.cpp b/Source/core/loader/cache/CachedResourceRequestInitiators.cpp
deleted file mode 100644
index aa0fa53..0000000
--- a/Source/core/loader/cache/CachedResourceRequestInitiators.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:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, 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/loader/cache/CachedResourceRequestInitiators.h"
-
-namespace WebCore {
-
-CachedResourceRequestInitiators::CachedResourceRequestInitiators()
-    : css("css", AtomicString::ConstructFromLiteral)
-    , document("document", AtomicString::ConstructFromLiteral)
-    , icon("icon", AtomicString::ConstructFromLiteral)
-    , link("link", AtomicString::ConstructFromLiteral)
-    , processinginstruction("processinginstruction", AtomicString::ConstructFromLiteral)
-    , texttrack("texttrack", AtomicString::ConstructFromLiteral)
-    , xml("xml", AtomicString::ConstructFromLiteral)
-    , xmlhttprequest("xmlhttprequest", AtomicString::ConstructFromLiteral)
-{
-}
-
-} // namespace WebCore
diff --git a/Source/core/loader/cache/CachedResourceRequestInitiators.h b/Source/core/loader/cache/CachedResourceRequestInitiators.h
deleted file mode 100644
index 0856ea9..0000000
--- a/Source/core/loader/cache/CachedResourceRequestInitiators.h
+++ /dev/null
@@ -1,56 +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.
- */
-
-#ifndef CachedResourceRequestInitiators_h
-#define CachedResourceRequestInitiators_h
-
-#include "core/platform/ThreadGlobalData.h"
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-struct CachedResourceRequestInitiators {
-    const AtomicString css;
-    const AtomicString document;
-    const AtomicString icon;
-    const AtomicString link;
-    const AtomicString processinginstruction;
-    const AtomicString texttrack;
-    const AtomicString xml;
-    const AtomicString xmlhttprequest;
-    WTF_MAKE_NONCOPYABLE(CachedResourceRequestInitiators); WTF_MAKE_FAST_ALLOCATED;
-private:
-    CachedResourceRequestInitiators();
-    friend class ThreadGlobalData;
-};
-
-inline const CachedResourceRequestInitiators& cachedResourceRequestInitiators()
-{
-    return threadGlobalData().cachedResourceRequestInitiators();
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/loader/cache/CachedScript.cpp b/Source/core/loader/cache/CachedScript.cpp
index c580e4e..8c2531d 100644
--- a/Source/core/loader/cache/CachedScript.cpp
+++ b/Source/core/loader/cache/CachedScript.cpp
@@ -86,7 +86,7 @@
 
 bool CachedScript::mimeTypeAllowedByNosniff() const
 {
-    return !parseContentTypeOptionsHeader(m_response.httpHeaderField("X-Content-Type-Options")) == ContentTypeOptionsNosniff || MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType());
+    return parseContentTypeOptionsHeader(m_response.httpHeaderField("X-Content-Type-Options")) != ContentTypeOptionsNosniff || MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType());
 }
 
 void CachedScript::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
diff --git a/Source/core/loader/cache/CachedShader.cpp b/Source/core/loader/cache/CachedShader.cpp
index 7b5155e..537d0e7 100644
--- a/Source/core/loader/cache/CachedShader.cpp
+++ b/Source/core/loader/cache/CachedShader.cpp
@@ -28,12 +28,12 @@
  */
 
 #include "config.h"
+#include "core/loader/cache/CachedShader.h"
 
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/loader/TextResourceDecoder.h"
-#include "core/loader/cache/CachedShader.h"
 #include "core/platform/SharedBuffer.h"
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
@@ -68,4 +68,3 @@
 }
 
 } // namespace WebCore
-
diff --git a/Source/core/loader/cache/CachedStyleSheetClient.h b/Source/core/loader/cache/CachedStyleSheetClient.h
index 0b76637..b51b365 100644
--- a/Source/core/loader/cache/CachedStyleSheetClient.h
+++ b/Source/core/loader/cache/CachedStyleSheetClient.h
@@ -27,7 +27,7 @@
 #define CachedStyleSheetClient_h
 
 #include "core/loader/cache/CachedResourceClient.h"
-#include <wtf/Forward.h>
+#include "wtf/Forward.h"
 
 namespace WebCore {
 class CachedCSSStyleSheet;
diff --git a/Source/core/loader/cache/CachedXSLStyleSheet.cpp b/Source/core/loader/cache/CachedXSLStyleSheet.cpp
index d4e9249..a65e88c 100644
--- a/Source/core/loader/cache/CachedXSLStyleSheet.cpp
+++ b/Source/core/loader/cache/CachedXSLStyleSheet.cpp
@@ -32,7 +32,7 @@
 #include "core/loader/cache/CachedResourceClientWalker.h"
 #include "core/loader/cache/CachedStyleSheetClient.h"
 #include "core/platform/SharedBuffer.h"
-#include <wtf/Vector.h>
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/cache/MemoryCache.cpp b/Source/core/loader/cache/MemoryCache.cpp
index 8e5c4cf..6b75977 100644
--- a/Source/core/loader/cache/MemoryCache.cpp
+++ b/Source/core/loader/cache/MemoryCache.cpp
@@ -54,7 +54,6 @@
 static const int cDefaultCacheCapacity = 8192 * 1024;
 static const double cMinDelayBeforeLiveDecodedPrune = 1; // Seconds.
 static const float cTargetPrunePercentage = .95f; // Percentage of capacity toward which we prune, to avoid immediately pruning again.
-static const double cDefaultDecodedDataDeletionInterval = 0;
 
 MemoryCache* memoryCache()
 {
@@ -74,7 +73,6 @@
     , m_capacity(cDefaultCacheCapacity)
     , m_minDeadCapacity(0)
     , m_maxDeadCapacity(cDefaultCacheCapacity)
-    , m_deadDecodedDataDeletionInterval(cDefaultDecodedDataDeletionInterval)
     , m_liveSize(0)
     , m_deadSize(0)
 #ifdef MEMORY_CACHE_STATS
@@ -111,6 +109,20 @@
     LOG(ResourceLoading, "MemoryCache::add Added '%s', resource %p\n", resource->url().string().latin1().data(), resource);
 }
 
+void MemoryCache::replace(CachedResource* newResource, CachedResource* oldResource)
+{
+    evict(oldResource);
+    ASSERT(!m_resources.get(newResource->url()));
+    m_resources.set(newResource->url(), newResource);
+    newResource->setInCache(true);
+    insertInLRUList(newResource);
+    int delta = newResource->size();
+    if (newResource->decodedSize() && newResource->hasClients())
+        insertInLiveDecodedResourcesList(newResource);
+    if (delta)
+        adjustSize(newResource->hasClients(), delta);
+}
+
 CachedResource* MemoryCache::resourceForURL(const KURL& resourceURL)
 {
     ASSERT(WTF::isMainThread());
@@ -147,26 +159,6 @@
 
     unsigned targetSize = static_cast<unsigned>(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again.
 
-    pruneLiveResourcesToSize(targetSize);
-}
-
-void MemoryCache::pruneLiveResourcesToPercentage(float prunePercentage)
-{
-    if (prunePercentage < 0.0f  || prunePercentage > 0.95f)
-        return;
-
-    unsigned currentSize = m_liveSize + m_deadSize;
-    unsigned targetSize = static_cast<unsigned>(currentSize * prunePercentage);
-
-    pruneLiveResourcesToSize(targetSize);
-}
-
-void MemoryCache::pruneLiveResourcesToSize(unsigned targetSize)
-{
-    if (m_inPruneResources)
-        return;
-    TemporaryChange<bool> reentrancyProtector(m_inPruneResources, true);
-
     double currentTime = FrameView::currentPaintTimeStamp();
     if (!currentTime) // In case prune is called directly, outside of a Frame paint.
         currentTime = WTF::currentTime();
@@ -208,25 +200,6 @@
         return;
 
     unsigned targetSize = static_cast<unsigned>(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again.
-    pruneDeadResourcesToSize(targetSize);
-}
-
-void MemoryCache::pruneDeadResourcesToPercentage(float prunePercentage)
-{
-    if (prunePercentage < 0.0f  || prunePercentage > 0.95f)
-        return;
-
-    unsigned currentSize = m_liveSize + m_deadSize;
-    unsigned targetSize = static_cast<unsigned>(currentSize * prunePercentage);
-
-    pruneDeadResourcesToSize(targetSize);
-}
-
-void MemoryCache::pruneDeadResourcesToSize(unsigned targetSize)
-{
-    if (m_inPruneResources)
-        return;
-    TemporaryChange<bool> reentrancyProtector(m_inPruneResources, true);
 
     int size = m_allResources.size();
  
@@ -594,17 +567,14 @@
 {
     if (m_liveSize + m_deadSize <= m_capacity && m_maxDeadCapacity && m_deadSize <= m_maxDeadCapacity) // Fast path.
         return;
-        
+    if (m_inPruneResources)
+        return;
+    TemporaryChange<bool> reentrancyProtector(m_inPruneResources, true);
+
     pruneDeadResources(); // Prune dead first, in case it was "borrowing" capacity from live.
     pruneLiveResources();
 }
 
-void MemoryCache::pruneToPercentage(float targetPercentLive)
-{
-    pruneDeadResourcesToPercentage(targetPercentLive); // Prune dead first, in case it was "borrowing" capacity from live.
-    pruneLiveResourcesToPercentage(targetPercentLive);
-}
-
 
 #ifdef MEMORY_CACHE_STATS
 
diff --git a/Source/core/loader/cache/MemoryCache.h b/Source/core/loader/cache/MemoryCache.h
index 4b5faa1..1bf7c24 100644
--- a/Source/core/loader/cache/MemoryCache.h
+++ b/Source/core/loader/cache/MemoryCache.h
@@ -108,6 +108,7 @@
     CachedResource* resourceForURL(const KURL&);
     
     void add(CachedResource*);
+    void replace(CachedResource* newResource, CachedResource* oldResource);
     void remove(CachedResource* resource) { evict(resource); }
 
     static KURL removeFragmentIdentifierIfNeeded(const KURL& originalURL);
@@ -122,10 +123,6 @@
     void evictResources();
 
     void prune();
-    void pruneToPercentage(float targetPercentLive);
-
-    void setDeadDecodedDataDeletionInterval(double interval) { m_deadDecodedDataDeletionInterval = interval; }
-    double deadDecodedDataDeletionInterval() const { return m_deadDecodedDataDeletionInterval; }
 
     // Calls to put the cached resource into and out of LRU lists.
     void insertInLRUList(CachedResource*);
@@ -164,14 +161,10 @@
     unsigned liveCapacity() const;
     unsigned deadCapacity() const;
 
-    // pruneDead*() - Flush decoded and encoded data from resources not referenced by Web pages.
-    // pruneLive*() - Flush decoded data from resources still referenced by Web pages.
+    // pruneDeadResources() - Flush decoded and encoded data from resources not referenced by Web pages.
+    // pruneLiveResources() - Flush decoded data from resources still referenced by Web pages.
     void pruneDeadResources(); // Automatically decide how much to prune.
     void pruneLiveResources();
-    void pruneDeadResourcesToPercentage(float prunePercentage); // Prune to % current size
-    void pruneLiveResourcesToPercentage(float prunePercentage);
-    void pruneDeadResourcesToSize(unsigned targetSize);
-    void pruneLiveResourcesToSize(unsigned targetSize);
 
     void evict(CachedResource*);
 
@@ -182,7 +175,6 @@
     unsigned m_capacity;
     unsigned m_minDeadCapacity;
     unsigned m_maxDeadCapacity;
-    double m_deadDecodedDataDeletionInterval;
 
     unsigned m_liveSize; // The number of bytes currently consumed by "live" resources in the cache.
     unsigned m_deadSize; // The number of bytes currently consumed by "dead" resources in the cache.
diff --git a/Source/core/make_derived_sources.target.darwin-arm.mk b/Source/core/make_derived_sources.target.darwin-arm.mk
index c018bf8..8aab5c2 100644
--- a/Source/core/make_derived_sources.target.darwin-arm.mk
+++ b/Source/core/make_derived_sources.target.darwin-arm.mk
@@ -72,7 +72,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -95,7 +95,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/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)
 	@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)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -106,7 +106,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -131,7 +131,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -169,7 +169,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 
@@ -178,12 +178,23 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.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)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsChromium.css css/mediaControlsChromiumAndroid.css css/fullscreen.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
+### Rules for action "CachedResourceInitiatorTypeNames":
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.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/loader/cache/CachedResourceInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CachedResourceInitiatorTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl loader/cache/CachedResourceInitiatorTypeNames.in -- --resourceTypes
+
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp ;
+
 ### Rules for action "PickerCommon":
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
@@ -224,7 +235,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -235,7 +246,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -246,7 +257,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -257,7 +268,17 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_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)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+
+
+### Rules for action "MakeTokenMatcher":
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_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)/webkit; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp"
 
 
 
@@ -337,6 +358,8 @@
 	$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CalendarPicker.h \
@@ -350,6 +373,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y \
+	$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp \
@@ -406,8 +430,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -485,8 +510,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
diff --git a/Source/core/make_derived_sources.target.darwin-mips.mk b/Source/core/make_derived_sources.target.darwin-mips.mk
index 451a719..fbe2c8e 100644
--- a/Source/core/make_derived_sources.target.darwin-mips.mk
+++ b/Source/core/make_derived_sources.target.darwin-mips.mk
@@ -72,7 +72,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -95,7 +95,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/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)
 	@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)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -106,7 +106,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -131,7 +131,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -169,7 +169,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 
@@ -178,12 +178,23 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.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)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsChromium.css css/mediaControlsChromiumAndroid.css css/fullscreen.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
+### Rules for action "CachedResourceInitiatorTypeNames":
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.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/loader/cache/CachedResourceInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CachedResourceInitiatorTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl loader/cache/CachedResourceInitiatorTypeNames.in -- --resourceTypes
+
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp ;
+
 ### Rules for action "PickerCommon":
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
@@ -224,7 +235,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -235,7 +246,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -246,7 +257,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -257,7 +268,17 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_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)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+
+
+### Rules for action "MakeTokenMatcher":
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_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)/webkit; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp"
 
 
 
@@ -337,6 +358,8 @@
 	$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CalendarPicker.h \
@@ -350,6 +373,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y \
+	$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp \
@@ -407,6 +431,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -485,6 +511,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
diff --git a/Source/core/make_derived_sources.target.darwin-x86.mk b/Source/core/make_derived_sources.target.darwin-x86.mk
index 4bba7a8..553b58d 100644
--- a/Source/core/make_derived_sources.target.darwin-x86.mk
+++ b/Source/core/make_derived_sources.target.darwin-x86.mk
@@ -72,7 +72,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -95,7 +95,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/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)
 	@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)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -106,7 +106,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -131,7 +131,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -169,7 +169,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 
@@ -178,12 +178,23 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.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)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsChromium.css css/mediaControlsChromiumAndroid.css css/fullscreen.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
+### Rules for action "CachedResourceInitiatorTypeNames":
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.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/loader/cache/CachedResourceInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CachedResourceInitiatorTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl loader/cache/CachedResourceInitiatorTypeNames.in -- --resourceTypes
+
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp ;
+
 ### Rules for action "PickerCommon":
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
@@ -224,7 +235,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -235,7 +246,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -246,7 +257,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -257,7 +268,17 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_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)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+
+
+### Rules for action "MakeTokenMatcher":
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_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)/webkit; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp"
 
 
 
@@ -337,6 +358,8 @@
 	$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CalendarPicker.h \
@@ -350,6 +373,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y \
+	$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp \
@@ -408,8 +432,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -490,8 +515,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
diff --git a/Source/core/make_derived_sources.target.linux-arm.mk b/Source/core/make_derived_sources.target.linux-arm.mk
index c018bf8..8aab5c2 100644
--- a/Source/core/make_derived_sources.target.linux-arm.mk
+++ b/Source/core/make_derived_sources.target.linux-arm.mk
@@ -72,7 +72,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -95,7 +95,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/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)
 	@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)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -106,7 +106,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -131,7 +131,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -169,7 +169,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 
@@ -178,12 +178,23 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.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)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsChromium.css css/mediaControlsChromiumAndroid.css css/fullscreen.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
+### Rules for action "CachedResourceInitiatorTypeNames":
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.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/loader/cache/CachedResourceInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CachedResourceInitiatorTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl loader/cache/CachedResourceInitiatorTypeNames.in -- --resourceTypes
+
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp ;
+
 ### Rules for action "PickerCommon":
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
@@ -224,7 +235,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -235,7 +246,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -246,7 +257,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -257,7 +268,17 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_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)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+
+
+### Rules for action "MakeTokenMatcher":
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_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)/webkit; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp"
 
 
 
@@ -337,6 +358,8 @@
 	$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CalendarPicker.h \
@@ -350,6 +373,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y \
+	$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp \
@@ -406,8 +430,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -485,8 +510,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
diff --git a/Source/core/make_derived_sources.target.linux-mips.mk b/Source/core/make_derived_sources.target.linux-mips.mk
index 451a719..fbe2c8e 100644
--- a/Source/core/make_derived_sources.target.linux-mips.mk
+++ b/Source/core/make_derived_sources.target.linux-mips.mk
@@ -72,7 +72,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -95,7 +95,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/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)
 	@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)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -106,7 +106,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -131,7 +131,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -169,7 +169,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 
@@ -178,12 +178,23 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.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)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsChromium.css css/mediaControlsChromiumAndroid.css css/fullscreen.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
+### Rules for action "CachedResourceInitiatorTypeNames":
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.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/loader/cache/CachedResourceInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CachedResourceInitiatorTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl loader/cache/CachedResourceInitiatorTypeNames.in -- --resourceTypes
+
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp ;
+
 ### Rules for action "PickerCommon":
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
@@ -224,7 +235,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -235,7 +246,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -246,7 +257,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -257,7 +268,17 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_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)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+
+
+### Rules for action "MakeTokenMatcher":
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_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)/webkit; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp"
 
 
 
@@ -337,6 +358,8 @@
 	$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CalendarPicker.h \
@@ -350,6 +373,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y \
+	$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp \
@@ -407,6 +431,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -485,6 +511,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
diff --git a/Source/core/make_derived_sources.target.linux-x86.mk b/Source/core/make_derived_sources.target.linux-x86.mk
index 4bba7a8..553b58d 100644
--- a/Source/core/make_derived_sources.target.linux-x86.mk
+++ b/Source/core/make_derived_sources.target.linux-x86.mk
@@ -72,7 +72,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_css_property_names.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSPropertyNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSPropertyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/webkit/CSSPropertyNames.cpp ;
 
@@ -95,7 +95,7 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/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)
 	@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)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/webkit/CSSValueKeywords.cpp ;
 
@@ -106,7 +106,7 @@
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/HTMLNames.h" "$(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/HTMLNames.h: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp ;
@@ -131,7 +131,7 @@
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/svgattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGNames.h" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/webkit/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/svgtags.in svg/svgattrs.in -- --factory --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/SVGNames.h: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGNames.cpp ;
@@ -169,7 +169,7 @@
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathtags.in $(LOCAL_PATH)/third_party/WebKit/Source/core/mathml/mathattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl mathml/mathtags.in mathml/mathattrs.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/MathMLNames.h: $(gyp_shared_intermediate_dir)/webkit/MathMLNames.cpp ;
 
@@ -178,12 +178,23 @@
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/preprocessor.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/css/html.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/quirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/view-source.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumLinux.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeChromiumSkia.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWin.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/themeWinQuirks.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/svg.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mathml.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.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)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsChromium.css css/mediaControlsChromiumAndroid.css css/fullscreen.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp" css/html.css css/quirks.css css/view-source.css css/themeChromium.css css/themeChromiumAndroid.css css/themeChromiumLinux.css css/themeChromiumSkia.css css/themeWin.css css/themeWinQuirks.css css/svg.css css/mathml.css css/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h ;
 
+### Rules for action "CachedResourceInitiatorTypeNames":
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.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/loader/cache/CachedResourceInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CachedResourceInitiatorTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl loader/cache/CachedResourceInitiatorTypeNames.in -- --resourceTypes
+
+$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp ;
+
 ### Rules for action "PickerCommon":
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/webkit/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
@@ -224,7 +235,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XLinkNames.h: $(gyp_shared_intermediate_dir)/webkit/XLinkNames.cpp ;
 
@@ -235,7 +246,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNSNames.cpp ;
 
@@ -246,7 +257,7 @@
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/webkit/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\""
 
 $(gyp_shared_intermediate_dir)/webkit/XMLNames.h: $(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp ;
 
@@ -257,7 +268,17 @@
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSGrammar.y.includes $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_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)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --extraDefines "\"ENABLE_CANVAS_USES_MAILBOX=1\" \"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_XHR_TIMEOUT=0\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"ENABLE_PARTITION_ALLOC=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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_8BIT_TEXTRUN=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/webkit; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/webkit/" --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_NOTIFICATIONS=0\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_PRINTING=0\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"WTF_USE_NATIVE_FULLSCREEN_VIDEO=1\" \"ENABLE_OPENTYPE_VERTICAL=1\" \"WTF_USE_HARFBUZZ=1\"" --preprocessOnly --preprocessor "/usr/bin/gcc -E -P -x c++" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+
+
+### Rules for action "MakeTokenMatcher":
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make_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)/webkit; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp"
 
 
 
@@ -337,6 +358,8 @@
 	$(gyp_shared_intermediate_dir)/webkit/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/webkit/UserAgentStyleSheetsData.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.h \
 	$(gyp_shared_intermediate_dir)/webkit/PickerCommon.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CalendarPicker.h \
@@ -350,6 +373,7 @@
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.y \
+	$(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/webkit/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp \
@@ -408,8 +432,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -490,8 +515,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
diff --git a/Source/core/page/AutoscrollController.cpp b/Source/core/page/AutoscrollController.cpp
index c9c8020..1a9c96f 100644
--- a/Source/core/page/AutoscrollController.cpp
+++ b/Source/core/page/AutoscrollController.cpp
@@ -90,7 +90,7 @@
         return;
 
     scrollable->stopAutoscroll();
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     if (panScrollInProgress()) {
         if (FrameView* view = scrollable->frame()->view()) {
             view->removePanScrollIcon();
@@ -118,7 +118,7 @@
 
     RenderObject* renderer = m_autoscrollRenderer;
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     HitTestResult hitTest = renderer->frame()->eventHandler()->hitTestResultAtPoint(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
 
     if (Node* nodeAtPoint = hitTest.innerNode())
@@ -168,7 +168,7 @@
     }
 }
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
 void AutoscrollController::handleMouseReleaseForPanScrolling(Frame* frame, const PlatformMouseEvent& mouseEvent)
 {
     Page* page = frame->page();
@@ -234,7 +234,7 @@
         break;
     case NoAutoscroll:
         break;
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     case AutoscrollForPanCanStop:
     case AutoscrollForPan:
         if (!panScrollInProgress()) {
@@ -254,7 +254,7 @@
     m_autoscrollTimer.startRepeating(autoscrollInterval);
 }
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
 void AutoscrollController::updatePanScrollState(FrameView* view, const IntPoint& lastKnownMousePosition)
 {
     // At the original click location we draw a 4 arrowed icon. Over this icon there won't be any scroll
diff --git a/Source/core/page/AutoscrollController.h b/Source/core/page/AutoscrollController.h
index be62be5..dd501a7 100644
--- a/Source/core/page/AutoscrollController.h
+++ b/Source/core/page/AutoscrollController.h
@@ -44,7 +44,7 @@
     NoAutoscroll,
     AutoscrollForDragAndDrop,
     AutoscrollForSelection,
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     AutoscrollForPanCanStop,
     AutoscrollForPan,
 #endif
@@ -62,7 +62,7 @@
     void stopAutoscrollIfNeeded(RenderObject*);
     void updateAutoscrollRenderer();
     void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, double eventTime);
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     void handleMouseReleaseForPanScrolling(Frame*, const PlatformMouseEvent&);
     void startPanScrolling(RenderBox*, const IntPoint&);
 #endif
@@ -71,7 +71,7 @@
     AutoscrollController();
     void autoscrollTimerFired(Timer<AutoscrollController>*);
     void startAutoscrollTimer();
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     void updatePanScrollState(FrameView*, const IntPoint&);
 #endif
 
@@ -80,7 +80,7 @@
     AutoscrollType m_autoscrollType;
     IntPoint m_dragAndDropAutoscrollReferencePosition;
     double m_dragAndDropAutoscrollStartTime;
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     IntPoint m_panScrollStartPos;
 #endif
 };
diff --git a/Source/core/page/ChromeClient.h b/Source/core/page/ChromeClient.h
index 0d91580..56a24e0 100644
--- a/Source/core/page/ChromeClient.h
+++ b/Source/core/page/ChromeClient.h
@@ -244,13 +244,10 @@
     // For testing.
     virtual void setPagePopupDriver(PagePopupDriver*) = 0;
     virtual void resetPagePopupDriver() = 0;
-    // This function is called whenever a text field <input> is created. The
-    // implementation should return true if it wants to do something in
-    // addTextFieldDecorationsTo().
-    // The argument is always non-0.
-    virtual bool willAddTextFieldDecorationsTo(HTMLInputElement*) { return false; }
-    // The argument is always non-0.
-    virtual void addTextFieldDecorationsTo(HTMLInputElement*) { }
+
+    // FIXME: Should these be on a different client interface?
+    virtual bool isPasswordGenerationEnabled() const { return false; }
+    virtual void openPasswordGenerator(HTMLInputElement*) { }
 
     virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
     virtual String acceptLanguages() = 0;
diff --git a/Source/core/page/ContentSecurityPolicy.cpp b/Source/core/page/ContentSecurityPolicy.cpp
index aeed3de..0760cce 100644
--- a/Source/core/page/ContentSecurityPolicy.cpp
+++ b/Source/core/page/ContentSecurityPolicy.cpp
@@ -35,6 +35,7 @@
 #include "core/dom/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/Frame.h"
 #include "core/page/UseCounter.h"
@@ -194,10 +195,8 @@
         ++position;
 }
 
-static bool isSourceListNone(const String& value)
+static bool isSourceListNone(const UChar* begin, const UChar* end)
 {
-    const UChar* begin = value.bloatedCharacters();
-    const UChar* end = value.bloatedCharacters() + value.length();
     skipWhile<isASCIISpace>(begin, end);
 
     const UChar* position = begin;
@@ -303,15 +302,14 @@
 public:
     CSPSourceList(ContentSecurityPolicy*, const String& directiveName);
 
-    void parse(const String&);
+    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:
-    void parse(const UChar* begin, const UChar* end);
-
     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);
@@ -343,14 +341,6 @@
 {
 }
 
-void CSPSourceList::parse(const String& value)
-{
-    // We represent 'none' as an empty m_list.
-    if (isSourceListNone(value))
-        return;
-    parse(value.bloatedCharacters(), value.bloatedCharacters() + value.length());
-}
-
 bool CSPSourceList::matches(const KURL& url)
 {
     if (m_allowStar)
@@ -371,8 +361,11 @@
 //
 void CSPSourceList::parse(const UChar* begin, const UChar* end)
 {
-    const UChar* position = begin;
+    // We represent 'none' as an empty m_list.
+    if (isSourceListNone(begin, end))
+        return;
 
+    const UChar* position = begin;
     while (position < end) {
         skipWhile<isASCIISpace>(position, end);
         if (position == end)
@@ -533,7 +526,7 @@
 {
     DEFINE_STATIC_LOCAL(const String, noncePrefix, (ASCIILiteral("'nonce-")));
 
-    if (!equalIgnoringCase(noncePrefix.bloatedCharacters(), begin, noncePrefix.length()))
+    if (!equalIgnoringCase(noncePrefix.characters8(), begin, noncePrefix.length()))
         return true;
 
     const UChar* position = begin + noncePrefix.length();
@@ -716,7 +709,9 @@
     MediaListDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
         : CSPDirective(name, value, policy)
     {
-        parse(value);
+        Vector<UChar> characters;
+        value.appendTo(characters);
+        parse(characters.data(), characters.data() + characters.size());
     }
 
     bool allows(const String& type)
@@ -725,15 +720,13 @@
     }
 
 private:
-    void parse(const String& value)
+    void parse(const UChar* begin, const UChar* end)
     {
-        const UChar* begin = value.bloatedCharacters();
         const UChar* position = begin;
-        const UChar* end = begin + value.length();
 
         // 'plugin-types ____;' OR 'plugin-types;'
-        if (value.isEmpty()) {
-            policy()->reportInvalidPluginTypes(value);
+        if (position == end) {
+            policy()->reportInvalidPluginTypes(String());
             return;
         }
 
@@ -793,7 +786,10 @@
         : CSPDirective(name, value, policy)
         , m_sourceList(policy, name)
     {
-        m_sourceList.parse(value);
+        Vector<UChar> characters;
+        value.appendTo(characters);
+
+        m_sourceList.parse(characters.data(), characters.data() + characters.size());
     }
 
     bool allows(const KURL& url)
@@ -812,7 +808,9 @@
 class CSPDirectiveList {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<CSPDirectiveList> create(ContentSecurityPolicy*, const String&, ContentSecurityPolicy::HeaderType);
+    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; }
@@ -845,8 +843,6 @@
 private:
     CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType);
 
-    void parse(const String&);
-
     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);
@@ -913,10 +909,10 @@
     m_reportOnly = (type == ContentSecurityPolicy::Report || type == ContentSecurityPolicy::PrefixedReport);
 }
 
-PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* policy, const String& header, ContentSecurityPolicy::HeaderType type)
+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(header);
+    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";
@@ -924,7 +920,7 @@
     }
 
     if (directives->isReportOnly() && directives->reportURIs().isEmpty())
-        policy->reportMissingReportURI(header);
+        policy->reportMissingReportURI(String(begin, end - begin));
 
     return directives.release();
 }
@@ -1091,7 +1087,8 @@
 
 bool CSPDirectiveList::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const
 {
-    DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to evaluate script because it violates the following Content Security Policy directive: ")));
+    DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("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, String(), WTF::OrdinalNumber::beforeFirst(), state) :
         checkEval(operativeDirective(m_scriptSrc.get()));
@@ -1192,15 +1189,14 @@
 // policy            = directive-list
 // directive-list    = [ directive *( ";" [ directive ] ) ]
 //
-void CSPDirectiveList::parse(const String& policy)
+void CSPDirectiveList::parse(const UChar* begin, const UChar* end)
 {
-    m_header = policy;
-    if (policy.isEmpty())
+    m_header = String(begin, end - begin);
+
+    if (begin == end)
         return;
 
-    const UChar* position = policy.bloatedCharacters();
-    const UChar* end = position + policy.length();
-
+    const UChar* position = begin;
     while (position < end) {
         const UChar* directiveBegin = position;
         skipUntil(position, end, ';');
@@ -1277,8 +1273,12 @@
         m_policy->reportDuplicateDirective(name);
         return;
     }
-    const UChar* position = value.bloatedCharacters();
-    const UChar* end = position + value.length();
+
+    Vector<UChar> characters;
+    value.appendTo(characters);
+
+    const UChar* position = characters.data();
+    const UChar* end = position + characters.size();
 
     while (position < end) {
         skipWhile<isASCIISpace>(position, end);
@@ -1331,8 +1331,11 @@
         return;
     }
 
-    const UChar* position = value.bloatedCharacters();
-    const UChar* end = position + value.length();
+    Vector<UChar> characters;
+    value.appendTo(characters);
+
+    const UChar* position = characters.data();
+    const UChar* end = position + characters.size();
 
     skipWhile<isASCIISpace>(position, end);
     const UChar* begin = position;
@@ -1431,18 +1434,22 @@
             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* begin = header.bloatedCharacters();
     const UChar* position = begin;
-    const UChar* end = begin + header.length();
     while (position < end) {
         skipUntil(position, end, ',');
 
         // header1,header2 OR header1
         //        ^                  ^
-        OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, String(begin, position - begin), type);
+        OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, begin, position, type);
         if (!policy->isReportOnly() && !policy->allowEval(0, SuppressReport))
             m_scriptExecutionContext->disableEval(policy->evalDisabledErrorMessage());
 
@@ -1683,6 +1690,10 @@
     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)
@@ -1743,6 +1754,7 @@
         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());
@@ -1750,7 +1762,7 @@
     RefPtr<FormData> report = FormData::create(reportObject->toJSONString().utf8());
 
     for (size_t i = 0; i < reportURIs.size(); ++i)
-        PingLoader::sendViolationReport(frame, reportURIs[i], report);
+        PingLoader::sendViolationReport(frame, reportURIs[i], report, PingLoader::ContentSecurityPolicyViolationReport);
 }
 
 void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const
diff --git a/Source/core/page/CreateWindow.cpp b/Source/core/page/CreateWindow.cpp
new file mode 100644
index 0000000..6f9ff2c
--- /dev/null
+++ b/Source/core/page/CreateWindow.cpp
@@ -0,0 +1,172 @@
+/*
+ * 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/CreateWindow.h"
+
+#include "core/dom/Document.h"
+#include "core/loader/FrameLoadRequest.h"
+#include "core/loader/NavigationAction.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Frame.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/page/WindowFeatures.h"
+#include "core/platform/network/ResourceRequest.h"
+#include "weborigin/KURL.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
+
+namespace WebCore {
+
+static Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest& request, const WindowFeatures& features, bool& created)
+{
+    ASSERT(!features.dialog || request.frameName().isEmpty());
+
+    if (!request.frameName().isEmpty() && request.frameName() != "_blank") {
+        if (Frame* frame = lookupFrame->loader()->findFrameForNavigation(request.frameName(), openerFrame->document())) {
+            if (request.frameName() != "_self") {
+                if (Page* page = frame->page())
+                    page->chrome().focus();
+            }
+            created = false;
+            return frame;
+        }
+    }
+
+    // Sandboxed frames cannot open new auxiliary browsing contexts.
+    if (openerFrame->document()->isSandboxed(SandboxPopups)) {
+        // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
+        openerFrame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest().url().elidedString() + "' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.");
+        return 0;
+    }
+
+    // FIXME: Setting the referrer should be the caller's responsibility.
+    FrameLoadRequest requestWithReferrer = request;
+    String referrer = SecurityPolicy::generateReferrerHeader(openerFrame->document()->referrerPolicy(), request.resourceRequest().url(), openerFrame->loader()->outgoingReferrer());
+    if (!referrer.isEmpty())
+        requestWithReferrer.resourceRequest().setHTTPReferrer(referrer);
+    FrameLoader::addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), openerFrame->loader()->outgoingOrigin());
+
+    if (openerFrame->settings() && !openerFrame->settings()->supportsMultipleWindows()) {
+        created = false;
+        return openerFrame;
+    }
+
+    Page* oldPage = openerFrame->page();
+    if (!oldPage)
+        return 0;
+
+    NavigationAction action(requestWithReferrer.resourceRequest());
+    Page* page = oldPage->chrome().client()->createWindow(openerFrame, requestWithReferrer, features, action);
+    if (!page)
+        return 0;
+
+    Frame* frame = page->mainFrame();
+
+    frame->loader()->forceSandboxFlags(openerFrame->document()->sandboxFlags());
+
+    if (request.frameName() != "_blank")
+        frame->tree()->setName(request.frameName());
+
+    page->chrome().setToolbarsVisible(features.toolBarVisible || features.locationBarVisible);
+    page->chrome().setStatusbarVisible(features.statusBarVisible);
+    page->chrome().setScrollbarsVisible(features.scrollbarsVisible);
+    page->chrome().setMenubarVisible(features.menuBarVisible);
+    page->chrome().setResizable(features.resizable);
+
+    // 'x' and 'y' specify the location of the window, while 'width' and 'height'
+    // specify the size of the viewport. We can only resize the window, so adjust
+    // for the difference between the window size and the viewport size.
+
+    FloatRect windowRect = page->chrome().windowRect();
+    FloatSize viewportSize = page->chrome().pageRect().size();
+
+    if (features.xSet)
+        windowRect.setX(features.x);
+    if (features.ySet)
+        windowRect.setY(features.y);
+    if (features.widthSet)
+        windowRect.setWidth(features.width + (windowRect.width() - viewportSize.width()));
+    if (features.heightSet)
+        windowRect.setHeight(features.height + (windowRect.height() - viewportSize.height()));
+
+    // Ensure non-NaN values, minimum size as well as being within valid screen area.
+    FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
+
+    page->chrome().setWindowRect(newWindowRect);
+    page->chrome().show();
+
+    created = true;
+    return frame;
+}
+
+Frame* createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures& windowFeatures,
+    DOMWindow* activeWindow, Frame* firstFrame, Frame* openerFrame, DOMWindow::PrepareDialogFunction function, void* functionContext)
+{
+    Frame* activeFrame = activeWindow->frame();
+
+    KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString()) : firstFrame->document()->completeURL(urlString);
+    if (!completedURL.isEmpty() && !completedURL.isValid()) {
+        // Don't expose client code to invalid URLs.
+        activeWindow->printErrorMessage("Unable to open a window with invalid URL '" + completedURL.string() + "'.\n");
+        return 0;
+    }
+
+    // For whatever reason, Firefox uses the first frame to determine the outgoingReferrer. We replicate that behavior here.
+    String referrer = SecurityPolicy::generateReferrerHeader(firstFrame->document()->referrerPolicy(), completedURL, firstFrame->loader()->outgoingReferrer());
+
+    ResourceRequest request(completedURL, referrer);
+    FrameLoader::addHTTPOriginIfNeeded(request, firstFrame->loader()->outgoingOrigin());
+    FrameLoadRequest frameRequest(activeWindow->document()->securityOrigin(), request, frameName);
+
+    // We pass the opener frame for the lookupFrame in case the active frame is different from
+    // the opener frame, and the name references a frame relative to the opener frame.
+    bool created;
+    Frame* newFrame = createWindow(activeFrame, openerFrame, frameRequest, windowFeatures, created);
+    if (!newFrame)
+        return 0;
+
+    newFrame->loader()->setOpener(openerFrame);
+    newFrame->page()->setOpenedByDOM();
+
+    if (newFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
+        return newFrame;
+
+    if (function)
+        function(newFrame->document()->domWindow(), functionContext);
+
+    if (created) {
+        FrameLoadRequest request(activeWindow->document()->securityOrigin(), ResourceRequest(completedURL, referrer));
+        newFrame->loader()->load(request);
+    } else if (!urlString.isEmpty()) {
+        newFrame->navigationScheduler()->scheduleLocationChange(activeWindow->document()->securityOrigin(), completedURL.string(), referrer, false);
+    }
+    return newFrame;
+}
+
+} // namespace WebCore
diff --git a/Source/core/platform/graphics/FontRenderingMode.h b/Source/core/page/CreateWindow.h
similarity index 70%
rename from Source/core/platform/graphics/FontRenderingMode.h
rename to Source/core/page/CreateWindow.h
index c1ce497..4160344 100644
--- a/Source/core/platform/graphics/FontRenderingMode.h
+++ b/Source/core/page/CreateWindow.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * 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
@@ -20,18 +21,22 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef FontRenderingMode_h
-#define FontRenderingMode_h
+#ifndef CreateWindow_h
+#define CreateWindow_h
+
+#include "core/page/DOMWindow.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
+class Frame;
+class WindowFeatures;
 
-// This setting is used to provide ways of switching between multiple rendering modes that may have different
-// metrics.  It is used to switch between CG and GDI text on Windows.
-enum FontRenderingMode { NormalRenderingMode, AlternateRenderingMode };
+Frame* createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&,
+    DOMWindow* activeWindow, Frame* firstFrame, Frame* openerFrame, DOMWindow::PrepareDialogFunction = 0, void* functionContext = 0);
 
 } // namespace WebCore
 
-#endif // FontRenderingMode_h
+#endif // CreateWindow_h
diff --git a/Source/core/page/DOMSelection.cpp b/Source/core/page/DOMSelection.cpp
index 5e34937..71ec85c 100644
--- a/Source/core/page/DOMSelection.cpp
+++ b/Source/core/page/DOMSelection.cpp
@@ -197,7 +197,7 @@
         return;
 
     if (offset < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -216,7 +216,7 @@
     const VisibleSelection& selection = m_frame->selection()->selection();
 
     if (selection.isNone()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -231,7 +231,7 @@
     const VisibleSelection& selection = m_frame->selection()->selection();
 
     if (selection.isNone()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -251,7 +251,7 @@
         return;
 
     if (baseOffset < 0 || extentOffset < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -270,7 +270,7 @@
     if (!m_frame)
         return;
     if (offset < 0) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -337,12 +337,12 @@
         return;
 
     if (!node) {
-        ec = TYPE_MISMATCH_ERR;
+        ec = TypeMismatchError;
         return;
     }
 
     if (offset < 0 || offset > (node->offsetInCharacters() ? caretMaxOffset(node) : (int)node->childNodeCount())) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
@@ -359,7 +359,7 @@
         return 0;
 
     if (index < 0 || index >= rangeCount()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0;
     }
 
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
index fe2afe1..3d85031 100644
--- a/Source/core/page/DOMWindow.cpp
+++ b/Source/core/page/DOMWindow.cpp
@@ -53,10 +53,16 @@
 #include "core/dom/MessageEvent.h"
 #include "core/dom/PageTransitionEvent.h"
 #include "core/dom/RequestAnimationFrameCallback.h"
+#include "core/dom/ScriptExecutionContext.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/editing/Editor.h"
 #include "core/history/BackForwardController.h"
+#include "core/html/HTMLCanvasElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/html/ImageData.h"
+#include "core/html/canvas/CanvasRenderingContext2D.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/inspector/ScriptCallStack.h"
 #include "core/loader/DocumentLoader.h"
@@ -68,6 +74,7 @@
 #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/DOMTimer.h"
 #include "core/page/EventHandler.h"
@@ -75,6 +82,8 @@
 #include "core/page/FrameTree.h"
 #include "core/page/FrameView.h"
 #include "core/page/History.h"
+#include "core/page/ImageBitmap.h"
+#include "core/page/ImageBitmapCallback.h"
 #include "core/page/Location.h"
 #include "core/page/Navigator.h"
 #include "core/page/Page.h"
@@ -89,6 +98,7 @@
 #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"
@@ -640,13 +650,13 @@
         return 0;
 
     if (!document->securityOrigin()->canAccessLocalStorage(document->topOrigin())) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
     if (m_sessionStorage) {
         if (!m_sessionStorage->area()->canAccessStorage(m_frame)) {
-            ec = SECURITY_ERR;
+            ec = SecurityError;
             return 0;
         }
         return m_sessionStorage.get();
@@ -658,7 +668,7 @@
 
     OwnPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin());
     if (!storageArea->canAccessStorage(m_frame)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
@@ -676,13 +686,13 @@
         return 0;
 
     if (!document->securityOrigin()->canAccessLocalStorage(document->topOrigin())) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
     if (m_localStorage) {
         if (!m_localStorage->area()->canAccessStorage(m_frame)) {
-            ec = SECURITY_ERR;
+            ec = SecurityError;
             return 0;
         }
         return m_localStorage.get();
@@ -697,7 +707,7 @@
 
     OwnPtr<StorageArea> storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
     if (!storageArea->canAccessStorage(m_frame)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
@@ -713,7 +723,7 @@
     Document* sourceDocument = source->document();
 
     // Compute the target origin.  We need to do this synchronously in order
-    // to generate the SYNTAX_ERR exception correctly.
+    // to generate the SyntaxError exception correctly.
     RefPtr<SecurityOrigin> target;
     if (targetOrigin == "/") {
         if (!sourceDocument)
@@ -724,7 +734,7 @@
         // 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()) {
-            ec = SYNTAX_ERR;
+            ec = SyntaxError;
             return;
         }
     }
@@ -942,7 +952,7 @@
         return String();
 
     if (!stringToEncode.containsOnlyLatin1()) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return String();
     }
 
@@ -955,13 +965,13 @@
         return String();
 
     if (!encodedString.containsOnlyLatin1()) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return String();
     }
 
     Vector<char> out;
     if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter)) {
-        ec = INVALID_CHARACTER_ERR;
+        ec = InvalidCharacterError;
         return String();
     }
 
@@ -1015,6 +1025,10 @@
     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()));
@@ -1029,6 +1043,10 @@
     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()));
@@ -1395,6 +1413,192 @@
     DOMTimer::removeById(context, timeoutId);
 }
 
+static LayoutSize size(HTMLImageElement* image)
+{
+    if (CachedImage* cachedImage = image->cachedImage())
+        return cachedImage->imageSizeForRenderer(image->renderer(), 1.0f); // FIXME: Not sure about this.
+    return IntSize();
+}
+
+static IntSize size(HTMLVideoElement* video)
+{
+    if (MediaPlayer* player = video->player())
+        return player->naturalSize();
+    return IntSize();
+}
+
+void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
+{
+    LayoutSize s = size(image);
+    createImageBitmap(image, callback, 0, 0, s.width(), s.height(), ec);
+}
+
+void DOMWindow::createImageBitmap(HTMLImageElement* image, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+{
+    if (!image) {
+        ec = TypeError;
+        return;
+    }
+    if (!image->cachedImage()) {
+        ec = InvalidStateError;
+        return;
+    }
+    if (image->cachedImage()->image()->isSVGImage()) {
+        ec = InvalidStateError;
+        return;
+    }
+    if (!sw || !sh) {
+        ec = IndexSizeError;
+        return;
+    }
+    if (!image->cachedImage()->image()->hasSingleSecurityOrigin()) {
+        ec = SecurityError;
+        return;
+    }
+    if (!image->cachedImage()->passesAccessControlCheck(document()->securityOrigin()) && document()->securityOrigin()->taintsCanvas(image->src())) {
+        ec = SecurityError;
+        return;
+    }
+
+    ec = 0;
+
+    // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
+    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image, IntRect(sx, sy, sw, sh));
+    RefPtr<ImageBitmapCallback> callbackLocal = callback;
+    scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
+}
+
+void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
+{
+    IntSize s = size(video);
+    createImageBitmap(video, callback, 0, 0, s.width(), s.height(), ec);
+}
+
+void DOMWindow::createImageBitmap(HTMLVideoElement* video, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+{
+    if (!video) {
+        ec = TypeError;
+        return;
+    }
+    if (!video->player()) {
+        ec = InvalidStateError;
+        return;
+    }
+    if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) {
+        ec = InvalidStateError;
+        return;
+    }
+    if (video->player()->readyState() <= MediaPlayer::HaveMetadata) {
+        ec = InvalidStateError;
+        return;
+    }
+    if (!sw || !sh) {
+        ec = IndexSizeError;
+        return;
+    }
+    if (!video->hasSingleSecurityOrigin()) {
+        ec = SecurityError;
+        return;
+    }
+    if (!video->player()->didPassCORSAccessCheck() && document()->securityOrigin()->taintsCanvas(video->currentSrc())) {
+        ec = SecurityError;
+        return;
+    }
+
+    ec = 0;
+
+    // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
+    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(video, IntRect(sx, sy, sw, sh));
+    RefPtr<ImageBitmapCallback> callbackLocal = callback;
+    scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
+}
+
+void DOMWindow::createImageBitmap(CanvasRenderingContext2D* context, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
+{
+    createImageBitmap(context->canvas(), callback, ec);
+}
+
+void DOMWindow::createImageBitmap(CanvasRenderingContext2D* context, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+{
+    createImageBitmap(context->canvas(), callback, sx, sy, sw, sh, ec);
+}
+
+void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
+{
+    createImageBitmap(canvas, callback, 0, 0, canvas->width(), canvas->height(), ec);
+}
+
+void DOMWindow::createImageBitmap(HTMLCanvasElement* canvas, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+{
+    if (!canvas) {
+        ec = TypeError;
+        return;
+    }
+    if (!canvas->originClean()) {
+        ec = InvalidStateError;
+        return;
+    }
+    if (!sw || !sh) {
+        ec = IndexSizeError;
+        return;
+    }
+
+    ec = 0;
+
+    // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
+    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(canvas, IntRect(sx, sy, sw, sh));
+    RefPtr<ImageBitmapCallback> callbackLocal = callback;
+    scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
+}
+
+void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
+{
+    createImageBitmap(data, callback, 0, 0, data->width(), data->height(), ec);
+}
+
+void DOMWindow::createImageBitmap(ImageData* data, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+{
+    if (!data) {
+        ec = TypeError;
+        return;
+    }
+    if (!sw || !sh) {
+        ec = IndexSizeError;
+        return;
+    }
+
+    ec = 0;
+
+    // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
+    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(data, IntRect(sx, sy, sw, sh));
+    RefPtr<ImageBitmapCallback> callbackLocal = callback;
+    scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
+}
+
+void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCallback> callback, ExceptionCode& ec)
+{
+    createImageBitmap(bitmap, callback, 0, 0, bitmap->width(), bitmap->height(), ec);
+}
+
+void DOMWindow::createImageBitmap(ImageBitmap* bitmap, PassRefPtr<ImageBitmapCallback> callback, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+{
+    if (!bitmap) {
+        ec = TypeError;
+        return;
+    }
+    if (!sw || !sh) {
+        ec = IndexSizeError;
+        return;
+    }
+
+    ec = 0;
+
+    // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
+    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(bitmap, IntRect(sx, sy, sw, sh));
+    RefPtr<ImageBitmapCallback> callbackLocal = callback;
+    scriptExecutionContext()->postTask(ImageBitmapCallback::CallbackTask::create(imageBitmap.release(), callbackLocal));
+}
+
 int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
 {
     callback->m_useLegacyTimeBase = false;
@@ -1669,49 +1873,6 @@
     return true;
 }
 
-Frame* DOMWindow::createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures& windowFeatures,
-    DOMWindow* activeWindow, Frame* firstFrame, Frame* openerFrame, PrepareDialogFunction function, void* functionContext)
-{
-    Frame* activeFrame = activeWindow->frame();
-
-    KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString()) : firstFrame->document()->completeURL(urlString);
-    if (!completedURL.isEmpty() && !completedURL.isValid()) {
-        // Don't expose client code to invalid URLs.
-        activeWindow->printErrorMessage("Unable to open a window with invalid URL '" + completedURL.string() + "'.\n");
-        return 0;
-    }
-
-    // For whatever reason, Firefox uses the first frame to determine the outgoingReferrer. We replicate that behavior here.
-    String referrer = SecurityPolicy::generateReferrerHeader(firstFrame->document()->referrerPolicy(), completedURL, firstFrame->loader()->outgoingReferrer());
-
-    ResourceRequest request(completedURL, referrer);
-    FrameLoader::addHTTPOriginIfNeeded(request, firstFrame->loader()->outgoingOrigin());
-    FrameLoadRequest frameRequest(activeWindow->document()->securityOrigin(), request, frameName);
-
-    // We pass the opener frame for the lookupFrame in case the active frame is different from
-    // the opener frame, and the name references a frame relative to the opener frame.
-    bool created;
-    Frame* newFrame = WebCore::createWindow(activeFrame, openerFrame, frameRequest, windowFeatures, created);
-    if (!newFrame)
-        return 0;
-
-    newFrame->loader()->setOpener(openerFrame);
-    newFrame->page()->setOpenedByDOM();
-
-    if (newFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
-        return newFrame;
-
-    if (function)
-        function(newFrame->document()->domWindow(), functionContext);
-
-    if (created)
-        newFrame->loader()->changeLocation(activeWindow->document()->securityOrigin(), completedURL, referrer, false);
-    else if (!urlString.isEmpty())
-        newFrame->navigationScheduler()->scheduleLocationChange(activeWindow->document()->securityOrigin(), completedURL.string(), referrer, false);
-
-    return newFrame;
-}
-
 PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
     DOMWindow* activeWindow, DOMWindow* firstWindow)
 {
diff --git a/Source/core/page/DOMWindow.h b/Source/core/page/DOMWindow.h
index 7f74875..ae61ae0 100644
--- a/Source/core/page/DOMWindow.h
+++ b/Source/core/page/DOMWindow.h
@@ -21,7 +21,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef DOMWindow_h
@@ -31,12 +31,14 @@
 #include "core/dom/EventTarget.h"
 #include "core/page/FrameDestructionObserver.h"
 #include "core/platform/Supplementable.h"
+
 #include "wtf/Forward.h"
 
 namespace WebCore {
     class BarProp;
     class CSSRuleList;
     class CSSStyleDeclaration;
+    class CanvasRenderingContext2D;
     class Console;
     class DOMApplicationCache;
     class DOMPoint;
@@ -50,8 +52,14 @@
     class EventListener;
     class FloatRect;
     class Frame;
+    class HTMLCanvasElement;
+    class HTMLImageElement;
+    class HTMLVideoElement;
     class History;
     class IDBFactory;
+    class ImageBitmap;
+    class ImageBitmapCallback;
+    class ImageData;
     class Location;
     class MediaQueryList;
     class MessageEvent;
@@ -241,6 +249,20 @@
         void clearTimeout(int timeoutId);
         void clearInterval(int timeoutId);
 
+        // Images
+        void createImageBitmap(HTMLImageElement*, PassRefPtr<ImageBitmapCallback>, ExceptionCode&);
+        void createImageBitmap(HTMLImageElement*, PassRefPtr<ImageBitmapCallback>, int sx, int sy, int sw, int sh, ExceptionCode&);
+        void createImageBitmap(HTMLVideoElement*, PassRefPtr<ImageBitmapCallback>, ExceptionCode&);
+        void createImageBitmap(HTMLVideoElement*, PassRefPtr<ImageBitmapCallback>, int sx, int sy, int sw, int sh, ExceptionCode&);
+        void createImageBitmap(CanvasRenderingContext2D*, PassRefPtr<ImageBitmapCallback>, ExceptionCode&);
+        void createImageBitmap(CanvasRenderingContext2D*, PassRefPtr<ImageBitmapCallback>, int sx, int sy, int sw, int sh, ExceptionCode&);
+        void createImageBitmap(HTMLCanvasElement*, PassRefPtr<ImageBitmapCallback>, ExceptionCode&);
+        void createImageBitmap(HTMLCanvasElement*, PassRefPtr<ImageBitmapCallback>, int sx, int sy, int sw, int sh, ExceptionCode&);
+        void createImageBitmap(ImageData*, PassRefPtr<ImageBitmapCallback>, ExceptionCode&);
+        void createImageBitmap(ImageData*, PassRefPtr<ImageBitmapCallback>, int sx, int sy, int sw, int sh, ExceptionCode&);
+        void createImageBitmap(ImageBitmap*, PassRefPtr<ImageBitmapCallback>, ExceptionCode&);
+        void createImageBitmap(ImageBitmap*, PassRefPtr<ImageBitmapCallback>, int sx, int sy, int sw, int sh, ExceptionCode&);
+
         // WebKit animation extensions
         int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
         int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
@@ -292,6 +314,8 @@
         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);
@@ -373,6 +397,8 @@
         void willDetachDocumentFromFrame();
         DOMWindow* anonymousIndexedGetter(uint32_t);
 
+        bool isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString);
+
     private:
         explicit DOMWindow(Frame*);
 
@@ -386,11 +412,6 @@
         virtual EventTargetData* eventTargetData();
         virtual EventTargetData* ensureEventTargetData();
 
-        static Frame* createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&,
-            DOMWindow* activeWindow, Frame* firstFrame, Frame* openerFrame,
-            PrepareDialogFunction = 0, void* functionContext = 0);
-        bool isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString);
-
         void resetDOMWindowProperties();
         void willDestroyDocumentInFrame();
 
@@ -435,7 +456,7 @@
     inline String DOMWindow::defaultStatus() const
     {
         return m_defaultStatus;
-    } 
+    }
 
 } // namespace WebCore
 
diff --git a/Source/core/page/DragActions.h b/Source/core/page/DragActions.h
index de81147..c9793f3 100644
--- a/Source/core/page/DragActions.h
+++ b/Source/core/page/DragActions.h
@@ -46,7 +46,6 @@
         DragSourceActionImage        = 2,
         DragSourceActionLink         = 4,
         DragSourceActionSelection    = 8,
-        DragSourceActionAny          = UINT_MAX
     } DragSourceAction;
     
     //matches NSDragOperation
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 11065d2..fc2455c 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -45,6 +45,7 @@
 #include "core/editing/htmlediting.h"
 #include "core/editing/markup.h"
 #include "core/html/HTMLAnchorElement.h"
+#include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLPlugInElement.h"
 #include "core/loader/FrameLoadRequest.h"
@@ -90,6 +91,21 @@
 static const int LinkDragBorderInset = 2;
 static const float DragImageAlpha = 0.75f;
 
+static bool dragTypeIsValid(DragSourceAction action)
+{
+    switch (action) {
+    case DragSourceActionDHTML:
+    case DragSourceActionImage:
+    case DragSourceActionLink:
+    case DragSourceActionSelection:
+        return true;
+    case DragSourceActionNone:
+        return false;
+    }
+    // Make sure MSVC doesn't complain that not all control paths return a value.
+    return false;
+}
+
 static PlatformMouseEvent createMouseEvent(DragData* dragData)
 {
     bool shiftKey, ctrlKey, altKey, metaKey;
@@ -113,9 +129,7 @@
     , m_fileInputElementUnderMouse(0)
     , m_documentIsHandlingDrag(false)
     , m_dragDestinationAction(DragDestinationActionNone)
-    , m_dragSourceAction(DragSourceActionNone)
     , m_didInitiateDrag(false)
-    , m_sourceDragOperation(DragOperationNone)
 {
     ASSERT(m_client);
 }
@@ -246,7 +260,7 @@
     if (operationForLoad(dragData) == DragOperationNone)
         return false;
 
-    m_page->mainFrame()->loader()->load(FrameLoadRequest(m_page->mainFrame(), ResourceRequest(dragData->asURL(m_page->mainFrame()))));
+    m_page->mainFrame()->loader()->load(FrameLoadRequest(0, ResourceRequest(dragData->asURL(m_page->mainFrame()))));
     return true;
 }
 
@@ -403,13 +417,6 @@
     return false;
 }
 
-DragSourceAction DragController::delegateDragSourceAction()
-{
-    // FIXME: This can probably be simplified since we always set this to DragSourceActionAny
-    m_dragSourceAction = DragSourceActionAny;
-    return m_dragSourceAction;
-}
-
 DragOperation DragController::operationForLoad(DragData* dragData)
 {
     ASSERT(dragData);
@@ -630,24 +637,22 @@
             return 0;
         if (node->isElementNode()) {
             EUserDrag dragMode = renderer->style()->userDrag();
-            if ((m_dragSourceAction & DragSourceActionDHTML) && dragMode == DRAG_ELEMENT) {
-                state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionDHTML);
+            if (dragMode == DRAG_NONE)
+                continue;
+            if (renderer->isImage()
+                && src->settings()
+                && src->settings()->loadsImagesAutomatically()) {
+                state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionImage);
                 return node;
             }
-            if (dragMode == DRAG_AUTO) {
-                if ((m_dragSourceAction & DragSourceActionImage)
-                    && node->hasTagName(HTMLNames::imgTag)
-                    && src->settings()
-                    && src->settings()->loadsImagesAutomatically()) {
-                    state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionImage);
-                    return node;
-                }
-                if ((m_dragSourceAction & DragSourceActionLink)
-                    && node->hasTagName(HTMLNames::aTag)
-                    && static_cast<HTMLAnchorElement*>(node)->isLiveLink()) {
-                    state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionLink);
-                    return node;
-                }
+            if (isHTMLAnchorElement(node)
+                && toHTMLAnchorElement(node)->isLiveLink()) {
+                state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionLink);
+                return node;
+            }
+            if (dragMode == DRAG_ELEMENT) {
+                state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionDHTML);
+                return node;
             }
         }
     }
@@ -689,8 +694,8 @@
 
 bool DragController::populateDragClipboard(Frame* src, const DragState& state, const IntPoint& dragOrigin)
 {
+    ASSERT(dragTypeIsValid(state.m_dragType));
     ASSERT(src);
-
     if (!src->view() || !src->contentRenderer())
         return false;
 
@@ -707,7 +712,6 @@
     const KURL& imageURL = hitTestResult.absoluteImageURL();
 
     Clipboard* clipboard = state.m_dragClipboard.get();
-
     Node* node = state.m_dragSrc.get();
 
     if (state.m_dragType == DragSourceActionSelection) {
@@ -719,11 +723,14 @@
 
             clipboard->writeRange(selectionRange.get(), src);
         }
-    } else if ((m_dragSourceAction & DragSourceActionImage)
-        && !imageURL.isEmpty() && node && node->isElementNode()) {
+    } else if (state.m_dragType == DragSourceActionImage) {
+        if (imageURL.isEmpty() || !node || !node->isElementNode())
+            return false;
         Element* element = toElement(node);
         prepareClipboardForImageDrag(src, clipboard, element, linkURL, imageURL, hitTestResult.altDisplayString());
-    } else if ((m_dragSourceAction & DragSourceActionLink) && !linkURL.isEmpty()) {
+    } else if (state.m_dragType == DragSourceActionLink) {
+        if (linkURL.isEmpty())
+            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);
@@ -805,10 +812,10 @@
     return dragImage.release();
 }
 
-bool DragController::startDrag(Frame* src, const DragState& state, DragOperation srcOp, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin)
+bool DragController::startDrag(Frame* src, const DragState& state, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin)
 {
+    ASSERT(dragTypeIsValid(state.m_dragType));
     ASSERT(src);
-
     if (!src->view() || !src->contentRenderer())
         return false;
 
@@ -823,29 +830,18 @@
 
     IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.position());
 
-    m_sourceDragOperation = srcOp;
-
-    OwnPtr<DragImage> dragImage;
     IntPoint dragLocation;
     IntPoint dragOffset;
 
     Clipboard* clipboard = state.m_dragClipboard.get();
-    if (state.m_dragType == DragSourceActionDHTML)
-        dragImage = clipboard->createDragImage(dragOffset);
-    if (state.m_dragType == DragSourceActionSelection || !imageURL.isEmpty() || !linkURL.isEmpty())
-        // Selection, image, and link drags receive a default set of allowed drag operations that
-        // follows from:
-        // http://trac.webkit.org/browser/trunk/WebKit/mac/WebView/WebHTMLView.mm?rev=48526#L3430
-        m_sourceDragOperation = static_cast<DragOperation>(m_sourceDragOperation | DragOperationGeneric | DragOperationCopy);
-
     // 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);
     if (dragImage) {
         dragLocation = dragLocationForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragOffset, !linkURL.isEmpty());
     }
 
     Node* node = state.m_dragSrc.get();
-
     if (state.m_dragType == DragSourceActionSelection) {
         if (!dragImage) {
             dragImage = src->dragImageForSelection();
@@ -854,8 +850,9 @@
             dragLocation = dragLocationForSelectionDrag(src);
         }
         doSystemDrag(dragImage.get(), dragLocation, dragOrigin, clipboard, src, false);
-    } else if ((m_dragSourceAction & DragSourceActionImage)
-        && !imageURL.isEmpty() && node && node->isElementNode()) {
+    } else if (state.m_dragType == DragSourceActionImage) {
+        if (imageURL.isEmpty() || !node || !node->isElementNode())
+            return false;
         Element* element = toElement(node);
         Image* image = getImage(element);
         if (!image || image->isNull())
@@ -867,7 +864,9 @@
             dragImage = dragImageForImage(element, image, dragOrigin, hitTestResult.imageRect(), dragLocation);
         }
         doSystemDrag(dragImage.get(), dragLocation, dragOrigin, clipboard, src, false);
-    } else if ((m_dragSourceAction & DragSourceActionLink) && !linkURL.isEmpty()) {
+    } else if (state.m_dragType == DragSourceActionLink) {
+        if (linkURL.isEmpty())
+            return false;
         if (src->selection()->isCaret() && src->selection()->isContentEditable()) {
             // a user can initiate a drag on a link without having any text
             // selected.  In this case, we should expand the selection to
@@ -887,11 +886,9 @@
     } else if (state.m_dragType == DragSourceActionDHTML) {
         if (!dragImage)
             return false;
-        ASSERT(m_dragSourceAction & DragSourceActionDHTML);
         doSystemDrag(dragImage.get(), dragLocation, dragOrigin, clipboard, src, false);
     } else {
-        // draggableNode() determined an image or link node was draggable, but it turns out the
-        // image or link had no URL, so there is nothing to drag.
+        ASSERT_NOT_REACHED();
         return false;
     }
 
@@ -914,21 +911,6 @@
     cleanupAfterSystemDrag();
 }
 
-// Manual drag caret manipulation
-void DragController::placeDragCaret(const IntPoint& windowPoint)
-{
-    mouseMovedIntoDocument(m_page->mainFrame()->documentAtPoint(windowPoint));
-    if (!m_documentUnderMouse)
-        return;
-    Frame* frame = m_documentUnderMouse->frame();
-    FrameView* frameView = frame->view();
-    if (!frameView)
-        return;
-    IntPoint framePoint = frameView->windowToContents(windowPoint);
-
-    m_page->dragCaretController()->setCaretPosition(frame->visiblePositionForPoint(framePoint));
-}
-
 DragOperation DragController::dragOperation(DragData* dragData)
 {
     // FIXME: To match the MacOS behaviour we should return DragOperationNone
diff --git a/Source/core/page/DragController.h b/Source/core/page/DragController.h
index 553ccaa..e35a14a 100644
--- a/Source/core/page/DragController.h
+++ b/Source/core/page/DragController.h
@@ -58,31 +58,16 @@
 
         static PassOwnPtr<DragController> create(Page*, DragClient*);
 
-        DragClient* client() const { return m_client; }
-
         DragSession dragEntered(DragData*);
         void dragExited(DragData*);
         DragSession dragUpdated(DragData*);
         bool performDrag(DragData*);
         
-        // FIXME: It should be possible to remove a number of these accessors once all
-        // drag logic is in WebCore.
-        void setDidInitiateDrag(bool initiated) { m_didInitiateDrag = initiated; } 
-        bool didInitiateDrag() const { return m_didInitiateDrag; }
-        DragOperation sourceDragOperation() const { return m_sourceDragOperation; }
-        DragSourceAction dragSourceAction() const { return m_dragSourceAction; }
-
-        Document* documentUnderMouse() const { return m_documentUnderMouse.get(); }
-        DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; }
-        DragSourceAction delegateDragSourceAction();
-        
         Node* draggableNode(const Frame*, Node*, const IntPoint&, DragState&) const;
         void dragEnded();
         
-        void placeDragCaret(const IntPoint&);
-        
         bool populateDragClipboard(Frame* src, const DragState&, const IntPoint& dragOrigin);
-        bool startDrag(Frame* src, const DragState&, DragOperation srcOp, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin);
+        bool startDrag(Frame* src, const DragState&, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin);
         
         static const int DragIconRightInset;
         static const int DragIconBottomInset;        
@@ -104,10 +89,7 @@
 
         void mouseMovedIntoDocument(Document*);
 
-        IntRect selectionDraggingRect(Frame*);
-        bool doDrag(Frame* src, Clipboard*, DragImage*, const KURL& linkURL, const KURL& imageURL, Node*, IntPoint& dragLoc, IntPoint& dragImageOffset);
-        void doImageDrag(Element*, const IntPoint&, const IntRect&, Clipboard*, Frame*, IntPoint&);
-        void doSystemDrag(DragImage*, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool forLink);
+        void doSystemDrag(DragImage*, const IntPoint& dragLocation, const IntPoint& dragOrigin, Clipboard*, Frame*, bool forLink);
         void cleanupAfterSystemDrag();
 
         Page* m_page;
@@ -119,9 +101,7 @@
         bool m_documentIsHandlingDrag;
 
         DragDestinationAction m_dragDestinationAction;
-        DragSourceAction m_dragSourceAction;
         bool m_didInitiateDrag;
-        DragOperation m_sourceDragOperation; // Set in startDrag when a drag starts from a mouse down within WebKit
     };
 
 }
diff --git a/Source/core/page/DragState.h b/Source/core/page/DragState.h
index c032e1b..86a26b5 100644
--- a/Source/core/page/DragState.h
+++ b/Source/core/page/DragState.h
@@ -42,14 +42,8 @@
     WTF_MAKE_NONCOPYABLE(DragState);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    enum EventDispatchPolicy {
-        DoNotDispatchEvents,
-        DispatchEvents,
-    };
     DragState() { }
-    bool shouldDispatchEvents() const { return m_eventDispatchPolicy == DispatchEvents; }
     RefPtr<Node> m_dragSrc; // element that may be a drag source, for the current mouse gesture
-    EventDispatchPolicy m_eventDispatchPolicy;
     DragSourceAction m_dragType;
     RefPtr<Clipboard> m_dragClipboard; // used on only the source side of dragging
 };
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 1f176f1..86e54fc 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -367,7 +367,6 @@
 
 static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, const VisibleSelection& selection)
 {
-#if ENABLE(USERSELECT_ALL)
     Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode);
     if (!rootUserSelectAll)
         return selection;
@@ -377,10 +376,6 @@
     newSelection.setExtent(positionAfterNode(rootUserSelectAll).downstream(CanCrossEditingBoundary));
 
     return newSelection;
-#else
-    UNUSED_PARAM(targetNode);
-    return selection;
-#endif
 }
 
 bool EventHandler::updateSelectionForMouseDownDispatchingSelectStart(Node* targetNode, const VisibleSelection& selection, TextGranularity granularity)
@@ -584,11 +579,6 @@
         newSelection = expandSelectionToRespectUserSelectAll(innerNode, visiblePos);
 
     bool handled = updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, granularity);
-
-    if (event.event().button() == MiddleButton) {
-        // Ignore handled, since we want to paste to where the caret was placed anyway.
-        handled = handlePasteGlobalSelection(event.event()) || handled;
-    }
     return handled;
 }
 
@@ -761,7 +751,6 @@
         newSelection = VisibleSelection(targetPosition);
     }
 
-#if ENABLE(USERSELECT_ALL)
     Node* rootUserSelectAllForMousePressNode = Position::rootUserSelectAllForNode(m_mousePressNode.get());
     if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePressNode == Position::rootUserSelectAllForNode(target)) {
         newSelection.setBase(positionBeforeNode(rootUserSelectAllForMousePressNode).upstream(CanCrossEditingBoundary));
@@ -779,9 +768,6 @@
         else
             newSelection.setExtent(targetPosition);
     }
-#else
-    newSelection.setExtent(targetPosition);
-#endif
 
     if (m_frame->selection()->granularity() != CharacterGranularity)
         newSelection.expandUsingGranularity(m_frame->selection()->granularity());
@@ -850,7 +836,7 @@
 
     m_frame->selection()->selectFrameElementInParentIfFullySelected();
 
-    if (event.event().button() == MiddleButton) {
+    if (event.event().button() == MiddleButton && !event.isOverLink()) {
         // Ignore handled, since we want to paste to where the caret was placed anyway.
         handled = handlePasteGlobalSelection(event.event()) || handled;
     }
@@ -858,7 +844,7 @@
     return handled;
 }
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
 
 void EventHandler::startPanScrolling(RenderObject* renderer)
 {
@@ -871,7 +857,7 @@
     invalidateClick();
 }
 
-#endif // ENABLE(PAN_SCROLLING)
+#endif // OS(WINDOWS)
 
 bool EventHandler::panScrollInProgress() const
 {
@@ -879,22 +865,6 @@
     return page && page->panScrollInProgress();
 }
 
-DragSourceAction EventHandler::updateDragSourceActionsAllowed() const
-{
-    if (!m_frame)
-        return DragSourceActionNone;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return DragSourceActionNone;
-
-    FrameView* view = m_frame->view();
-    if (!view)
-        return DragSourceActionNone;
-
-    return page->dragController()->delegateDragSourceAction();
-}
-
 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
 {
     // We always send hitTestResultAtPoint to the main frame if we have one,
@@ -1117,7 +1087,7 @@
     Page* page = m_frame->page();
     if (!page)
         return NoCursorChange;
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     if (panScrollInProgress())
         return NoCursorChange;
 #endif
@@ -1333,7 +1303,7 @@
         return true;
     }
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     // We store whether pan scrolling is in progress before calling stopAutoscrollTimer()
     // because it will set m_autoscrollType to NoAutoscroll on return.
     bool isPanScrollInProgress = panScrollInProgress();
@@ -1455,12 +1425,6 @@
     return result;
 }
 
-bool EventHandler::passMouseMovedEventToScrollbars(const PlatformMouseEvent& event)
-{
-    HitTestResult hoveredNode;
-    return handleMouseMoveEvent(event, &hoveredNode, true);
-}
-
 static Cursor& syntheticTouchCursor()
 {
     DEFINE_STATIC_LOCAL(Cursor, c, (Image::loadPlatformResource("syntheticTouchCursor").get(), IntPoint(10, 10)));
@@ -1469,13 +1433,8 @@
 
 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars)
 {
-    // in Radar 3703768 we saw frequent crashes apparently due to the
-    // part being null here, which seems impossible, so check for nil
-    // but also assert so that we can try to figure this out in debug
-    // builds, if it happens.
     ASSERT(m_frame);
-    if (!m_frame)
-        return false;
+    ASSERT(m_frame->view());
 
     bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent);
     if (defaultPrevented) {
@@ -1483,8 +1442,6 @@
         return true;
     }
 
-    RefPtr<FrameView> protector(m_frame->view());
-    
     setLastKnownMousePosition(mouseEvent);
 
     if (m_hoverTimer.isActive())
@@ -1627,7 +1584,7 @@
     else
         gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture));
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     if (Page* page = m_frame->page())
         page->handleMouseReleaseForPanScrolling(m_frame, mouseEvent);
 #endif
@@ -1816,7 +1773,7 @@
                 accept = targetFrame->eventHandler()->updateDragAndDrop(event, clipboard);
         } else if (newTarget) {
             // 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 && dragState().shouldDispatchEvents()) {
+            if (dragState().m_dragSrc) {
                 // for now we don't care if event handler cancels default behavior, since there is none
                 dispatchDragSrcEvent(eventNames().dragEvent, event);
             }
@@ -1843,7 +1800,7 @@
                 accept = targetFrame->eventHandler()->updateDragAndDrop(event, clipboard);
         } else if (newTarget) {
             // 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 && dragState().shouldDispatchEvents()) {
+            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);
             }
@@ -1865,7 +1822,7 @@
         if (targetFrame)
             targetFrame->eventHandler()->cancelDragAndDrop(event, clipboard);
     } else if (m_dragTarget.get()) {
-        if (dragState().m_dragSrc && dragState().shouldDispatchEvents())
+        if (dragState().m_dragSrc)
             dispatchDragSrcEvent(eventNames().dragEvent, event);
         dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard);
     }
@@ -2079,11 +2036,11 @@
         // 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 (Page* page = m_frame->page()) {
-            if (node && node->isMouseFocusable()) {
-                if (!page->focusController()->setFocusedNode(node, m_frame, FocusDirectionMouse))
+            if (node && node->isElementNode() && node->isMouseFocusable()) {
+                if (!page->focusController()->setFocusedElement(toElement(node), m_frame, FocusDirectionMouse))
                     swallowEvent = true;
             } else if (!node || !node->focused()) {
-                if (!page->focusController()->setFocusedNode(0, m_frame))
+                if (!page->focusController()->setFocusedElement(0, m_frame))
                     swallowEvent = true;
             }
         }
@@ -2393,6 +2350,7 @@
         m_mouseDownMayStartDrag = true;
         dragState().m_dragSrc = 0;
         m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.position());
+        RefPtr<FrameView> protector(m_frame->view());
         handleDrag(mev, DontCheckDragHysteresis);
         if (m_didStartDrag) {
             m_longTapShouldInvokeContextMenu = true;
@@ -2976,7 +2934,7 @@
     if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL)
         capsLockStateMayHaveChanged();
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     if (panScrollInProgress()) {
         // If a key is pressed while the panScroll is in progress then we want to stop
         if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown)
@@ -3130,7 +3088,6 @@
     case DragSourceActionDHTML:
         break;
     case DragSourceActionNone:
-    case DragSourceActionAny:
         ASSERT_NOT_REACHED();
     }
     
@@ -3149,7 +3106,7 @@
     HitTestRequest request(HitTestRequest::Release | HitTestRequest::DisallowShadowContent);
     prepareMouseEvent(request, event);
 
-    if (dragState().m_dragSrc && dragState().shouldDispatchEvents()) {
+    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);
@@ -3174,13 +3131,20 @@
     return !dispatchDragEvent(eventType, dragState().m_dragSrc.get(), event, dragState().m_dragClipboard.get());
 }
     
-static bool ExactlyOneBitSet(DragSourceAction n)
+static bool exactlyOneBitSet(DragSourceAction n)
 {
     return n && !(n & (n - 1));
 }
 
 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.
+    ASSERT(m_frame);
+    ASSERT(m_frame->view());
+    if (!m_frame->page())
+        return false;
+
     if (event.event().button() != LeftButton || event.event().type() != PlatformEvent::MouseMoved) {
         // If we allowed the other side of the bridge to handle a drag
         // last time, then m_mousePressed might still be set. So we
@@ -3191,14 +3155,12 @@
     }
 
     if (m_mouseDownMayStartDrag && !dragState().m_dragSrc) {
-        dragState().m_eventDispatchPolicy = (updateDragSourceActionsAllowed() & DragSourceActionDHTML) ? DragState::DispatchEvents: DragState::DoNotDispatchEvents;
-
         // try to find an element that wants to be dragged
         HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
         HitTestResult result(m_mouseDownPos);
         m_frame->contentRenderer()->hitTest(request, result);
         Node* node = result.innerNode();
-        if (node && m_frame->page())
+        if (node)
             dragState().m_dragSrc = m_frame->page()->dragController()->draggableNode(m_frame, node, m_mouseDownPos, dragState());
         else
             dragState().m_dragSrc = 0;
@@ -3236,7 +3198,7 @@
     if (!m_mouseDownMayStartDrag)
         return !mouseDownMayStartSelect() && !m_mouseDownMayStartAutoscroll;
     
-    if (!ExactlyOneBitSet(dragState().m_dragType)) {
+    if (!exactlyOneBitSet(dragState().m_dragType)) {
         ASSERT((dragState().m_dragType & DragSourceActionSelection));
         ASSERT((dragState().m_dragType & ~DragSourceActionSelection) == DragSourceActionDHTML
                 || (dragState().m_dragType & ~DragSourceActionSelection) == DragSourceActionImage
@@ -3245,10 +3207,8 @@
     }
 
     // We are starting a text/image/url drag, so the cursor should be an arrow
-    if (FrameView* view = m_frame->view()) {
-        // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and drop (default to pointer).
-        view->setCursor(pointerCursor());
-    }
+    // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and drop (default to pointer).
+    m_frame->view()->setCursor(pointerCursor());
 
     if (checkDragHysteresis == ShouldCheckDragHysteresis && !dragHysteresisExceeded(event.event().position()))
         return true;
@@ -3256,81 +3216,68 @@
     // Once we're past the hysteresis point, we don't want to treat this gesture as a click
     invalidateClick();
     
-    DragOperation srcOp = DragOperationNone;      
-    
+    if (!tryStartDrag(event)) {
+        // Something failed to start the drag, clean up.
+        freeClipboard();
+        dragState().m_dragSrc = 0;
+    }
+
+    m_mouseDownMayStartDrag = false;
+    // Whether or not the drag actually started, no more default handling (like selection).
+    return true;
+}
+
+bool EventHandler::tryStartDrag(const MouseEventWithHitTestResults& event)
+{
     freeClipboard(); // would only happen if we missed a dragEnd.  Do it anyway, just
                      // to make sure it gets numbified
     dragState().m_dragClipboard = createDraggingClipboard();  
     
-    if (dragState().shouldDispatchEvents()) {
-        // Check to see if the is a DOM based drag, if it is get the DOM specified drag 
-        // image and offset
-        if (dragState().m_dragType == DragSourceActionDHTML) {
-            if (RenderObject* renderer = dragState().m_dragSrc->renderer()) {
-                // FIXME: This doesn't work correctly with transforms.
-                FloatPoint absPos = renderer->localToAbsolute();
-                IntSize delta = m_mouseDownPos - roundedIntPoint(absPos);
-                dragState().m_dragClipboard->setDragImageElement(dragState().m_dragSrc.get(), IntPoint(delta));
-            } else {
-                // The renderer has disappeared, this can happen if the onStartDrag handler has hidden
-                // the element in some way.  In this case we just kill the drag.
-                m_mouseDownMayStartDrag = false;
-                goto cleanupDrag;
-            }
-        } 
-        
-        Page* page = m_frame->page();
-        DragController* dragController = page ? page->dragController() : 0;
-        if (!dragController || !dragController->populateDragClipboard(m_frame, dragState(), m_mouseDownPos)) {
-            m_mouseDownMayStartDrag = false;
-            goto cleanupDrag;
-        }
-        m_mouseDownMayStartDrag = dispatchDragSrcEvent(eventNames().dragstartEvent, m_mouseDown)
-            && !m_frame->selection()->isInPasswordField();
-        
-        // Invalidate clipboard here against anymore pasteboard writing for security.  The drag
-        // image can still be changed as we drag, but not the pasteboard data.
-        dragState().m_dragClipboard->setAccessPolicy(ClipboardImageWritable);
-        
-        if (m_mouseDownMayStartDrag) {
-            // gather values from DHTML element, if it set any
-            srcOp = dragState().m_dragClipboard->sourceOperation();
-            
-            // 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();
+    // Check to see if this a DOM based drag, if it is get the DOM specified drag
+    // image and offset
+    if (dragState().m_dragType == DragSourceActionDHTML) {
+        if (RenderObject* renderer = dragState().m_dragSrc->renderer()) {
+            // FIXME: This doesn't work correctly with transforms.
+            FloatPoint absPos = renderer->localToAbsolute();
+            IntSize delta = m_mouseDownPos - roundedIntPoint(absPos);
+            dragState().m_dragClipboard->setDragImageElement(dragState().m_dragSrc.get(), IntPoint(delta));
+        } else {
+            // The renderer has disappeared, this can happen if the onStartDrag handler has hidden
+            // the element in some way. In this case we just kill the drag.
+            return false;
         }
     }
+
+    DragController* dragController = m_frame->page()->dragController();
+    ASSERT(dragController);
+    if (!dragController->populateDragClipboard(m_frame, dragState(), m_mouseDownPos))
+        return false;
+    m_mouseDownMayStartDrag = dispatchDragSrcEvent(eventNames().dragstartEvent, m_mouseDown)
+        && !m_frame->selection()->isInPasswordField();
+
+    // Invalidate clipboard here against anymore pasteboard writing for security. The drag
+    // image can still be changed as we drag, but not the pasteboard data.
+    dragState().m_dragClipboard->setAccessPolicy(ClipboardImageWritable);
     
     if (m_mouseDownMayStartDrag) {
-        Page* page = m_frame->page();
-        DragController* dragController = page ? page->dragController() : 0;
-        m_didStartDrag = dragController && dragController->startDrag(m_frame, dragState(), srcOp, event.event(), m_mouseDownPos);
-        // In WebKit2 we could reenter this code and start another drag.
-        // On OS X this causes problems with the ownership of the pasteboard
-        // and the promised types.
-        if (m_didStartDrag) {
-            m_mouseDownMayStartDrag = false;
-            return true;
-        }
-        if (dragState().shouldDispatchEvents()) {
-            // Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event
-            dispatchDragSrcEvent(eventNames().dragendEvent, event.event());
-            m_mouseDownMayStartDrag = false;
-        }
-    } 
+        // 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();
 
-cleanupDrag:
-    if (!m_mouseDownMayStartDrag) {
-        // something failed to start the drag, cleanup
-        freeClipboard();
-        dragState().m_dragSrc = 0;
+        // 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
+        // whether or not the drag started, but perhaps it can simply use the return value from
+        // handleDrag(), even though it doesn't mean exactly the same thing.
+        if (m_didStartDrag)
+            return true;
+        // Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event
+        dispatchDragSrcEvent(eventNames().dragendEvent, event.event());
     }
-    
-    // No more default handling (like selection), whether we're past the hysteresis bounds or not
-    return true;
+
+    return false;
 }
 
 bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, TextEventInputType inputType)
diff --git a/Source/core/page/EventHandler.h b/Source/core/page/EventHandler.h
index bfec93f..e1afe16 100644
--- a/Source/core/page/EventHandler.h
+++ b/Source/core/page/EventHandler.h
@@ -98,7 +98,7 @@
     Node* mousePressNode() const;
     void setMousePressNode(PassRefPtr<Node>);
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     void startPanScrolling(RenderObject*);
 #endif
 
@@ -139,12 +139,10 @@
     bool logicalScrollRecursively(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0);
 
     bool mouseMoved(const PlatformMouseEvent&);
-    bool passMouseMovedEventToScrollbars(const PlatformMouseEvent&);
 
     void lostMouseCapture();
 
     bool handleMousePressEvent(const PlatformMouseEvent&);
-    bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0, bool onlyUpdateScrollbars = false);
     bool handleMouseReleaseEvent(const PlatformMouseEvent&);
     bool handleWheelEvent(const PlatformWheelEvent&);
     void defaultWheelEventHandler(Node*, WheelEvent*);
@@ -209,6 +207,7 @@
     void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResults&);
     void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&);
 
+    bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0, bool onlyUpdateScrollbars = false);
     bool handleMousePressEvent(const MouseEventWithHitTestResults&);
     bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
     bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
@@ -250,6 +249,7 @@
     void freeClipboard();
 
     bool handleDrag(const MouseEventWithHitTestResults&, CheckDragHysteresis);
+    bool tryStartDrag(const MouseEventWithHitTestResults&);
     bool handleMouseUp(const MouseEventWithHitTestResults&);
     void clearDragState();
 
@@ -299,7 +299,7 @@
     bool panScrollInProgress() const;
     void setLastKnownMousePosition(const PlatformMouseEvent&);
 
-    Frame* m_frame;
+    Frame* const m_frame;
 
     bool m_mousePressed;
     bool m_capturesDragging;
diff --git a/Source/core/page/EventSource.cpp b/Source/core/page/EventSource.cpp
index 5435645..971d8e9 100644
--- a/Source/core/page/EventSource.cpp
+++ b/Source/core/page/EventSource.cpp
@@ -74,13 +74,13 @@
 PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, const String& url, const Dictionary& eventSourceInit, ExceptionCode& ec)
 {
     if (url.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
     KURL fullURL = context->completeURL(url);
     if (!fullURL.isValid()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -92,7 +92,7 @@
     }
     if (!shouldBypassMainWorldContentSecurityPolicy && !context->contentSecurityPolicy()->allowConnectToSource(fullURL)) {
         // FIXME: Should this be throwing an exception?
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
diff --git a/Source/core/page/EventSource.idl b/Source/core/page/EventSource.idl
index 490161e..d92caa9 100644
--- a/Source/core/page/EventSource.idl
+++ b/Source/core/page/EventSource.idl
@@ -34,9 +34,8 @@
     ActiveDOMObject,
     Constructor(DOMString url, optional Dictionary eventSourceInit),
     ConstructorCallWith=ScriptExecutionContext,
-    ConstructorRaisesException,
-    EventTarget
-] interface EventSource {
+    ConstructorRaisesException
+] interface EventSource : EventTarget {
 
     readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
     readonly attribute DOMString url;
@@ -53,14 +52,4 @@
     attribute EventListener onmessage;
     attribute EventListener onerror;
     void close();
-
-    // EventTarget interface
-    void addEventListener(DOMString type,
-                          EventListener listener,
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type,
-                             EventListener listener,
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
-
 };
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index acafdb1..7d62f6f 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -44,6 +44,7 @@
 #include "core/editing/htmlediting.h" // For firstPositionInOrBeforeNode
 #include "core/html/HTMLAreaElement.h"
 #include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLTextAreaElement.h"
 #include "core/page/Chrome.h"
 #include "core/page/EditorClient.h"
 #include "core/page/EventHandler.h"
@@ -295,7 +296,7 @@
     if (!node) {
         // We didn't find a node to focus, so we should try to pass focus to Chrome.
         if (!initialFocus && m_page->chrome().canTakeFocus(direction)) {
-            document->setFocusedNode(0);
+            document->setFocusedElement(0);
             setFocusedFrame(0);
             m_page->chrome().takeFocus(direction);
             return true;
@@ -326,20 +327,20 @@
         if (!owner->contentFrame())
             return false;
 
-        document->setFocusedNode(0);
+        document->setFocusedElement(0);
         setFocusedFrame(owner->contentFrame());
         return true;
     }
     
-    // FIXME: It would be nice to just be able to call setFocusedNode(node) here, but we can't do
-    // that because some elements (e.g. HTMLInputElement and HTMLTextAreaElement) do extra work in
-    // their focus() methods.
-
+    // FIXME: It would be nice to just be able to call setFocusedElement(node)
+    // here, but we can't do that because some elements (e.g. HTMLInputElement
+    // and HTMLTextAreaElement) do extra work in their focus() methods.
     Document* newDocument = node->document();
 
-    if (newDocument != document)
+    if (newDocument != document) {
         // Focus is going away from this document, so clear the focused node.
-        document->setFocusedNode(0);
+        document->setFocusedElement(0);
+    }
 
     if (newDocument)
         setFocusedFrame(newDocument->frame());
@@ -558,7 +559,7 @@
     Node* selectionStartNode = s->selection().start().deprecatedNode();
     if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendantOf(newFocusedNode) || selectionStartNode->deprecatedShadowAncestorNode() == newFocusedNode)
         return;
-        
+
     if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode()) {
         if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) {
             // Don't clear the selection for contentEditable elements, but do clear it for input and textarea. See bug 38696.
@@ -567,22 +568,22 @@
                 return;
 
             if (Node* shadowAncestorNode = root->deprecatedShadowAncestorNode()) {
-                if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag))
+                if (!shadowAncestorNode->hasTagName(inputTag) && !isHTMLTextAreaElement(shadowAncestorNode))
                     return;
             }
         }
     }
-    
+
     s->clear();
 }
 
-bool FocusController::setFocusedNode(Node* node, PassRefPtr<Frame> newFocusedFrame, FocusDirection direction)
+bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newFocusedFrame, FocusDirection direction)
 {
     RefPtr<Frame> oldFocusedFrame = focusedFrame();
     RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0;
     
     Node* oldFocusedNode = oldDocument ? oldDocument->focusedNode() : 0;
-    if (oldFocusedNode == node)
+    if (oldFocusedNode == element)
         return true;
 
     // FIXME: Might want to disable this check for caretBrowsing
@@ -591,21 +592,21 @@
 
     m_page->editorClient()->willSetInputMethodState();
 
-    clearSelectionIfNeeded(oldFocusedFrame.get(), newFocusedFrame.get(), node);
+    clearSelectionIfNeeded(oldFocusedFrame.get(), newFocusedFrame.get(), element);
 
-    if (!node) {
+    if (!element) {
         if (oldDocument)
-            oldDocument->setFocusedNode(0);
+            oldDocument->setFocusedElement(0);
         return true;
     }
 
-    RefPtr<Document> newDocument = node->document();
+    RefPtr<Document> newDocument = element->document();
 
-    if (newDocument && newDocument->focusedNode() == node)
+    if (newDocument && newDocument->focusedNode() == element)
         return true;
     
     if (oldDocument && oldDocument != newDocument)
-        oldDocument->setFocusedNode(0);
+        oldDocument->setFocusedElement(0);
 
     if (newFocusedFrame && !newFocusedFrame->page()) {
         setFocusedFrame(0);
@@ -614,9 +615,9 @@
     setFocusedFrame(newFocusedFrame);
 
     // Setting the focused node can result in losing our last reft to node when JS event handlers fire.
-    RefPtr<Node> protect = node;
+    RefPtr<Element> protect = element;
     if (newDocument) {
-        bool successfullyFocused = newDocument->setFocusedNode(node, direction);
+        bool successfullyFocused = newDocument->setFocusedElement(element, direction);
         if (!successfullyFocused)
             return false;
     }
@@ -850,8 +851,8 @@
         if (!hasOffscreenRect(focusedNode)) {
             container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, focusedNode);
             startingRect = nodeRectInAbsoluteCoordinates(focusedNode, true /* ignore border */);
-        } else if (focusedNode->hasTagName(areaTag)) {
-            HTMLAreaElement* area = static_cast<HTMLAreaElement*>(focusedNode);
+        } else if (isHTMLAreaElement(focusedNode)) {
+            HTMLAreaElement* area = toHTMLAreaElement(focusedNode);
             container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, area->imageElement());
             startingRect = virtualRectForAreaElementAndDirection(area, direction);
         }
diff --git a/Source/core/page/FocusController.h b/Source/core/page/FocusController.h
index 48d4d71..e8e14c6 100644
--- a/Source/core/page/FocusController.h
+++ b/Source/core/page/FocusController.h
@@ -70,7 +70,7 @@
     bool setInitialFocus(FocusDirection, KeyboardEvent*);
     bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false);
         
-    bool setFocusedNode(Node*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
+    bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
 
     void setActive(bool);
     bool isActive() const { return m_isActive; }
diff --git a/Source/core/page/Frame.cpp b/Source/core/page/Frame.cpp
index ddc44b6..328d8f1 100644
--- a/Source/core/page/Frame.cpp
+++ b/Source/core/page/Frame.cpp
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "core/page/Frame.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Event.h"
@@ -319,7 +320,8 @@
     if (view) {
         view->unscheduleRelayout();
         if (view->frame()) {
-            view->frame()->animation()->suspendAnimationsForDocument(document);
+            if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
+                view->frame()->animation()->suspendAnimationsForDocument(document);
             view->frame()->eventHandler()->stopAutoscrollTimer();
         }
     }
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index a8c3719..87eb49a 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -37,6 +37,7 @@
 #include "core/dom/OverflowEvent.h"
 #include "core/editing/FrameSelection.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"
@@ -615,7 +616,7 @@
     Node* body = document->body();
     if (body && body->renderer()) {
         if (body->hasTagName(bodyTag))
-            documentOrBodyRenderer = documentRenderer->style()->overflowX() == OVISIBLE && documentElement->hasTagName(htmlTag) ? body->renderer() : documentRenderer;
+            documentOrBodyRenderer = documentRenderer->style()->overflowX() == OVISIBLE && isHTMLHtmlElement(documentElement) ? body->renderer() : documentRenderer;
     }
 
     Pagination pagination;
@@ -669,7 +670,7 @@
             } 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 && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRenderer;
+                RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && isHTMLHtmlElement(document->documentElement()) ? body->renderer() : rootRenderer;
                 applyOverflowToViewport(o, hMode, vMode);
             }
         } else if (rootRenderer)
@@ -868,7 +869,7 @@
         return;
 
     TRACE_EVENT0("webkit", "FrameView::layout");
-    TraceEvent::SamplingState0Scope("Blink\0Blink-Layout");
+    TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout");
 
     // Protect the view from being deleted during layout (in recalcStyle)
     RefPtr<FrameView> protector(this);
@@ -961,11 +962,6 @@
                         body->renderer()->setChildNeedsLayout(true);
                 }
             }
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-            if (m_firstLayout && !m_frame->ownerElement())
-                printf("Elapsed time before first layout: %d\n", document->elapsedTime());
-#endif
         }
 
         autoSizeIfEnabled();
@@ -1532,7 +1528,7 @@
 
     // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
     if (anchorNode && anchorNode->isFocusable())
-        m_frame->document()->setFocusedNode(anchorNode);
+        m_frame->document()->setFocusedElement(anchorNode);
 
     return true;
 }
@@ -1891,17 +1887,11 @@
 
 void FrameView::layoutTimerFired(Timer<FrameView>*)
 {
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!m_frame->document()->ownerElement())
-        printf("Layout timer fired at %d\n", m_frame->document()->elapsedTime());
-#endif
     layout();
 }
 
 void FrameView::scheduleRelayout()
 {
-    // FIXME: We should assert the page is not in the page cache, but that is causing
-    // too many false assertions.  See <rdar://problem/7218118>.
     ASSERT(m_frame->view() == this);
 
     if (m_layoutRoot) {
@@ -1928,12 +1918,6 @@
         return;
 
     m_delayedLayout = delay != 0;
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!m_frame->document()->ownerElement())
-        printf("Scheduling layout for %d\n", delay);
-#endif
-
     m_layoutTimer.startOneShot(delay * 0.001);
 }
 
@@ -2024,20 +2008,16 @@
     if (!m_layoutTimer.isActive())
         return;
 
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-    if (!m_frame->document()->ownerElement())
-        printf("Layout timer unscheduled at %d\n", m_frame->document()->elapsedTime());
-#endif
-
     m_layoutTimer.stop();
     m_delayedLayout = false;
 }
 
 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
 {
-    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext()) {
+    for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->traverseNext()) {
         frame->view()->serviceScrollAnimations();
-        frame->animation()->serviceAnimations();
+        if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
+            frame->animation()->serviceAnimations();
         if (RuntimeEnabledFeatures::webAnimationsEnabled())
             frame->document()->timeline()->serviceAnimations(monotonicAnimationStartTime);
     }
diff --git a/Source/core/page/History.cpp b/Source/core/page/History.cpp
index 6f9cf92..d53e9ce 100644
--- a/Source/core/page/History.cpp
+++ b/Source/core/page/History.cpp
@@ -31,6 +31,7 @@
 #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"
@@ -57,13 +58,13 @@
     return m_frame->page()->backForward()->count();
 }
 
-PassRefPtr<SerializedScriptValue> History::state()
+SerializedScriptValue* History::state()
 {
     m_lastStateObjectRequested = stateInternal();
-    return m_lastStateObjectRequested;
+    return m_lastStateObjectRequested.get();
 }
 
-PassRefPtr<SerializedScriptValue> History::stateInternal() const
+SerializedScriptValue* History::stateInternal() const
 {
     if (!m_frame)
         return 0;
@@ -81,7 +82,7 @@
 
 bool History::isSameAsCurrentState(SerializedScriptValue* state) const
 {
-    return state == stateInternal().get();
+    return state == stateInternal();
 }
 
 void History::back()
@@ -144,7 +145,7 @@
     
     KURL fullURL = urlForState(urlString);
     if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest(fullURL)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
@@ -152,10 +153,12 @@
         m_frame->loader()->history()->pushState(data, title, fullURL.string());
     else if (stateObjectType == StateObjectReplace)
         m_frame->loader()->history()->replaceState(data, title, fullURL.string());
-            
+
     if (!urlString.isEmpty())
         m_frame->document()->updateURLForPushOrReplaceState(fullURL);
 
+    m_frame->loader()->documentLoader()->clearRedirectChain();
+    m_frame->loader()->documentLoader()->appendRedirect(fullURL);
     m_frame->loader()->client()->dispatchDidNavigateWithinPage();
 }
 
diff --git a/Source/core/page/History.h b/Source/core/page/History.h
index 689a23b..e571730 100644
--- a/Source/core/page/History.h
+++ b/Source/core/page/History.h
@@ -45,7 +45,7 @@
     static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); }
 
     unsigned length() const;
-    PassRefPtr<SerializedScriptValue> state();
+    SerializedScriptValue* state();
     void back();
     void forward();
     void go(int distance);
@@ -68,7 +68,7 @@
 
     KURL urlForState(const String& url);
 
-    PassRefPtr<SerializedScriptValue> stateInternal() const;
+    SerializedScriptValue* stateInternal() const;
 
     RefPtr<SerializedScriptValue> m_lastStateObjectRequested;
 };
diff --git a/Source/core/page/ImageBitmap.cpp b/Source/core/page/ImageBitmap.cpp
new file mode 100644
index 0000000..fabe684
--- /dev/null
+++ b/Source/core/page/ImageBitmap.cpp
@@ -0,0 +1,139 @@
+// 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/page/ImageBitmapCallback.h"
+#include "core/platform/graphics/GraphicsContext.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<BitmapImage> cropImage(Image* image, IntRect cropRect)
+{
+    SkBitmap cropped;
+    image->nativeImageForCurrentFrame()->bitmap().extractSubset(&cropped, cropRect);
+    return BitmapImage::create(NativeImageSkia::create(cropped));
+}
+
+ImageBitmap::ImageBitmap(HTMLImageElement* image, IntRect cropRect)
+    : m_bitmapOffset(max(0, -cropRect.x()), max(0, -cropRect.y()))
+    , m_size(cropRect.size())
+{
+    Image* bitmapImage = image->cachedImage()->image();
+    m_bitmap = cropImage(bitmapImage, cropRect).get();
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(HTMLVideoElement* video, IntRect cropRect)
+    : m_bitmapOffset(max(0, -cropRect.x()), max(0, -cropRect.y()))
+    , m_size(cropRect.size())
+{
+    IntRect videoRect = IntRect(IntPoint(), video->player()->naturalSize());
+    IntRect srcRect = intersection(cropRect, videoRect);
+    IntRect dstRect(IntPoint(), srcRect.size());
+
+    m_buffer = ImageBuffer::create(videoRect.size());
+    GraphicsContext* c = m_buffer->context();
+    c->clip(dstRect);
+    c->translate(-srcRect.x(), -srcRect.y());
+    video->paintCurrentFrameInContext(c, videoRect);
+    m_bitmap = static_cast<BitmapImage*>(m_buffer->copyImage(DontCopyBackingStore).get());
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, IntRect cropRect)
+    : m_bitmapOffset(max(0, -cropRect.x()), max(0, -cropRect.y()))
+    , m_size(cropRect.size())
+{
+    IntSize canvasSize = canvas->size();
+    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvasSize));
+    IntRect dstRect(IntPoint(), srcRect.size());
+
+    m_buffer = ImageBuffer::create(canvasSize);
+    m_buffer->context()->drawImageBuffer(canvas->buffer(), dstRect, srcRect);
+    m_bitmap = static_cast<BitmapImage*>(m_buffer->copyImage(DontCopyBackingStore).get());
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(ImageData* data, IntRect cropRect)
+    : m_bitmapOffset(max(0, -cropRect.x()), max(0, -cropRect.y()))
+    , m_size(cropRect.size())
+{
+    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size()));
+
+    m_buffer = ImageBuffer::create(data->size());
+    if (srcRect.width() > 0 && srcRect.height() > 0)
+        m_buffer->putByteArray(Unmultiplied, data->data(), data->size(), srcRect, IntPoint(min(0, -cropRect.x()), min(0, -cropRect.y())));
+
+    m_bitmap = static_cast<BitmapImage*>(m_buffer->copyImage(DontCopyBackingStore).get());
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(ImageBitmap* bitmap, IntRect cropRect)
+    : m_bitmapOffset(max(0, bitmap->bitmapOffset().x() - cropRect.x()), max(0, bitmap->bitmapOffset().y() - cropRect.y()))
+    , m_size(cropRect.size())
+{
+    Image* bitmapImage = bitmap->bitmapImage();
+    cropRect.moveBy(IntPoint(-bitmap->bitmapOffset().x(), -bitmap->bitmapOffset().y()));
+    m_bitmap = cropImage(bitmapImage, cropRect).get();
+
+    ScriptWrappable::init(this);
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, IntRect cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(image, normalizedCropRect)));
+    return imageBitmap.release();
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, IntRect cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(video, normalizedCropRect)));
+    return imageBitmap.release();
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, IntRect cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(canvas, normalizedCropRect)));
+    return imageBitmap.release();
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(ImageData* data, IntRect cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(data, normalizedCropRect)));
+    return imageBitmap.release();
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, IntRect cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(bitmap, normalizedCropRect)));
+    return imageBitmap.release();
+}
+
+}
diff --git a/Source/core/page/ImageBitmap.h b/Source/core/page/ImageBitmap.h
new file mode 100644
index 0000000..8b8c01c
--- /dev/null
+++ b/Source/core/page/ImageBitmap.h
@@ -0,0 +1,62 @@
+// 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/dom/ScriptExecutionContext.h"
+#include "core/platform/graphics/BitmapImage.h"
+#include "core/platform/graphics/ImageBuffer.h"
+#include "core/platform/graphics/IntRect.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class HTMLCanvasElement;
+class HTMLImageElement;
+class HTMLVideoElement;
+class ImageData;
+class ImageBitmapCallback;
+
+class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable {
+
+public:
+    static PassRefPtr<ImageBitmap> create(HTMLImageElement*, IntRect);
+    static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, IntRect);
+    static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, IntRect);
+    static PassRefPtr<ImageBitmap> create(ImageData*, IntRect);
+    static PassRefPtr<ImageBitmap> create(ImageBitmap*, IntRect);
+
+    BitmapImage* bitmapImage() const { return m_bitmap.get(); }
+
+    int bitmapWidth() const { return m_bitmap->width(); }
+    int bitmapHeight() const { return m_bitmap->height(); }
+    IntSize bitmapSize() const { return m_bitmap->size(); }
+    IntPoint bitmapOffset() const { return m_bitmapOffset; }
+
+    int width() const { return m_size.width(); }
+    int height() const { return m_size.height(); }
+    IntSize size() const { return m_size; }
+
+    ~ImageBitmap() { };
+
+private:
+    ImageBitmap(HTMLImageElement*, IntRect);
+    ImageBitmap(HTMLVideoElement*, IntRect);
+    ImageBitmap(HTMLCanvasElement*, IntRect);
+    ImageBitmap(ImageData*, IntRect);
+    ImageBitmap(ImageBitmap*, IntRect);
+
+    RefPtr<BitmapImage> m_bitmap;
+    OwnPtr<ImageBuffer> m_buffer;
+
+    IntPoint m_bitmapOffset; // offset applied to the image when it is drawn to the context
+    IntSize m_size; // user defined size of the ImageBitmap
+};
+
+} // namespace WebCore
+
+#endif // ImageBitmap_h
diff --git a/Source/core/page/ImageBitmap.idl b/Source/core/page/ImageBitmap.idl
new file mode 100644
index 0000000..40c4f3a
--- /dev/null
+++ b/Source/core/page/ImageBitmap.idl
@@ -0,0 +1,9 @@
+// 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.
+
+[
+    NoInterfaceObject
+] interface ImageBitmap {
+
+};
\ No newline at end of file
diff --git a/Source/core/page/ImageBitmapCallback.cpp b/Source/core/page/ImageBitmapCallback.cpp
new file mode 100644
index 0000000..56fd2a4
--- /dev/null
+++ b/Source/core/page/ImageBitmapCallback.cpp
@@ -0,0 +1,25 @@
+// 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/ImageBitmapCallback.h"
+
+namespace WebCore {
+
+ImageBitmapCallback::CallbackTask::CallbackTask(PassRefPtr<ImageBitmap> bitmap, PassRefPtr<ImageBitmapCallback> callback)
+    : m_bitmap(bitmap)
+    , m_callback(callback)
+{
+}
+
+void ImageBitmapCallback::CallbackTask::performTask(ScriptExecutionContext*)
+{
+    if (!m_callback || !m_bitmap) {
+        return;
+    }
+    m_callback->handleEvent(m_bitmap.get());
+}
+
+} // namespace Webcore
+
diff --git a/Source/core/page/ImageBitmapCallback.h b/Source/core/page/ImageBitmapCallback.h
new file mode 100644
index 0000000..5a6cc0f
--- /dev/null
+++ b/Source/core/page/ImageBitmapCallback.h
@@ -0,0 +1,41 @@
+// 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 ImageBitmapCallback_h
+#define ImageBitmapCallback_h
+
+#include "core/dom/ScriptExecutionContext.h"
+#include "core/page/ImageBitmap.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class ImageBitmap;
+
+class ImageBitmapCallback : public RefCounted<ImageBitmapCallback> {
+public:
+    virtual ~ImageBitmapCallback() { }
+    virtual bool handleEvent(ImageBitmap*) = 0;
+
+    class CallbackTask : public ScriptExecutionContext::Task {
+    public:
+        static PassOwnPtr<CallbackTask> create(PassRefPtr<ImageBitmap> bitmap, PassRefPtr<ImageBitmapCallback> callback)
+        {
+            return adoptPtr(new CallbackTask(bitmap, callback));
+        }
+
+        virtual void performTask(ScriptExecutionContext*);
+
+    private:
+        CallbackTask(PassRefPtr<ImageBitmap>, PassRefPtr<ImageBitmapCallback>);
+
+        RefPtr<ImageBitmap> m_bitmap;
+        RefPtr<ImageBitmapCallback> m_callback;
+    };
+};
+
+} // namespace Webcore
+
+#endif // ImageBitmapCallback_h
diff --git a/Source/core/page/ImageBitmapCallback.idl b/Source/core/page/ImageBitmapCallback.idl
new file mode 100644
index 0000000..fb2ae4f
--- /dev/null
+++ b/Source/core/page/ImageBitmapCallback.idl
@@ -0,0 +1,7 @@
+// 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.
+
+callback interface ImageBitmapCallback {
+    boolean handleEvent(ImageBitmap bitmap);
+};
diff --git a/Source/core/page/Location.cpp b/Source/core/page/Location.cpp
index b901efa..3a78903 100644
--- a/Source/core/page/Location.cpp
+++ b/Source/core/page/Location.cpp
@@ -157,7 +157,7 @@
         return;
     KURL url = m_frame->document()->url();
     if (!url.setProtocol(protocol)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
     setLocation(url.string(), activeWindow, firstWindow);
diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp
index 31a8fa1..8ca540c 100644
--- a/Source/core/page/Page.cpp
+++ b/Source/core/page/Page.cpp
@@ -228,7 +228,7 @@
     m_autoscrollController->updateDragAndDrop(dropTargetNode, eventPosition, eventTime);
 }
 
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
 void Page::handleMouseReleaseForPanScrolling(Frame* frame, const PlatformMouseEvent& point)
 {
     m_autoscrollController->handleMouseReleaseForPanScrolling(frame, point);
@@ -636,13 +636,13 @@
         return;
     m_visibilityState = visibilityState;
 
-    if (!isInitialState && m_mainFrame)
-        m_mainFrame->dispatchVisibilityStateChangeEvent();
-
     if (visibilityState == WebCore::PageVisibilityStateHidden)
         setTimerAlignmentInterval(DOMTimer::hiddenPageAlignmentInterval());
     else
         setTimerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval());
+
+    if (!isInitialState && m_mainFrame)
+        m_mainFrame->dispatchVisibilityStateChangeEvent();
 }
 
 PageVisibilityState Page::visibilityState() const
diff --git a/Source/core/page/Page.h b/Source/core/page/Page.h
index e857963..5c794d6 100644
--- a/Source/core/page/Page.h
+++ b/Source/core/page/Page.h
@@ -176,7 +176,7 @@
     void stopAutoscrollTimer();
     void updateAutoscrollRenderer();
     void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, double eventTime);
-#if ENABLE(PAN_SCROLLING)
+#if OS(WINDOWS)
     void handleMouseReleaseForPanScrolling(Frame*, const PlatformMouseEvent&);
     void startPanScrolling(RenderBox*, const IntPoint&);
 #endif
diff --git a/Source/core/page/PageSerializer.cpp b/Source/core/page/PageSerializer.cpp
index f5a46cc..407a1b5 100644
--- a/Source/core/page/PageSerializer.cpp
+++ b/Source/core/page/PageSerializer.cpp
@@ -224,7 +224,7 @@
             CachedImage* cachedImage = imageElement->cachedImage();
             addImageToResources(cachedImage, imageElement->renderer(), url);
         } else if (element->hasTagName(HTMLNames::linkTag)) {
-            HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(element);
+            HTMLLinkElement* linkElement = toHTMLLinkElement(element);
             if (CSSStyleSheet* sheet = linkElement->sheet()) {
                 KURL url = document->completeURL(linkElement->getAttribute(HTMLNames::hrefAttr));
                 serializeCSSStyleSheet(sheet, url);
diff --git a/Source/core/page/Performance.idl b/Source/core/page/Performance.idl
index 87a5b06..e676085 100644
--- a/Source/core/page/Performance.idl
+++ b/Source/core/page/Performance.idl
@@ -30,9 +30,7 @@
  */
 
 // See: http://dev.w3.org/2006/webapi/WebTiming/
-[
-    EventTarget
-] interface Performance {
+interface Performance {
     readonly attribute PerformanceNavigation navigation;
     readonly attribute PerformanceTiming timing;
     readonly attribute MemoryInfo memory;
diff --git a/Source/core/page/PerformanceUserTiming.cpp b/Source/core/page/PerformanceUserTiming.cpp
index 794eef3..c2e2587 100644
--- a/Source/core/page/PerformanceUserTiming.cpp
+++ b/Source/core/page/PerformanceUserTiming.cpp
@@ -100,7 +100,7 @@
 {
     ec = 0;
     if (restrictedKeyMap().contains(markName)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
@@ -123,13 +123,13 @@
     if (restrictedKeyMap().contains(markName)) {
         double value = static_cast<double>((m_performance->timing()->*(restrictedKeyMap().get(markName)))());
         if (!value) {
-            ec = INVALID_ACCESS_ERR;
+            ec = InvalidAccessError;
             return 0.0;
         }
         return value - m_performance->timing()->navigationStart();
     }
 
-    ec = SYNTAX_ERR;
+    ec = SyntaxError;
     return 0.0;
 }
 
diff --git a/Source/core/page/RuntimeCSSEnabled.cpp b/Source/core/page/RuntimeCSSEnabled.cpp
index 5d38e76..49b443e 100644
--- a/Source/core/page/RuntimeCSSEnabled.cpp
+++ b/Source/core/page/RuntimeCSSEnabled.cpp
@@ -69,6 +69,10 @@
         CSSPropertyTextDecorationStyle,
     };
     setCSSPropertiesEnabled(css3TextDecorationProperties, WTF_ARRAY_LENGTH(css3TextDecorationProperties), RuntimeEnabledFeatures::css3TextDecorationsEnabled());
+    CSSPropertyID css3TextProperties[] = {
+        CSSPropertyTextAlignLast,
+    };
+    setCSSPropertiesEnabled(css3TextProperties, WTF_ARRAY_LENGTH(css3TextProperties), RuntimeEnabledFeatures::css3TextEnabled());
     CSSPropertyID cssGridLayoutProperties[] = {
         CSSPropertyGridAutoColumns,
         CSSPropertyGridAutoRows,
diff --git a/Source/core/page/RuntimeEnabledFeatures.in b/Source/core/page/RuntimeEnabledFeatures.in
index 6ebf974..1f2edbb 100644
--- a/Source/core/page/RuntimeEnabledFeatures.in
+++ b/Source/core/page/RuntimeEnabledFeatures.in
@@ -18,7 +18,6 @@
 AnimatedWebP status=experimental
 ApplicationCache status=stable
 AuthorShadowDOMForAnyElement
-CanvasPath status=test
 Crypto status=test
 CSSCompositing status=experimental
 CSSExclusions status=experimental
@@ -26,6 +25,7 @@
 CSSRegions status=experimental
 CSSTouchAction status=test
 CSSVariables status=experimental
+CSS3Text status=experimental
 CSS3TextDecorations status=experimental
 CustomDOMElements status=experimental
 Database status=stable
@@ -52,7 +52,6 @@
 InputModeAttribute status=test
 InputTypeColor status=stable
 InputTypeWeek status=stable
-JavaScriptI18NAPI status=stable
 LangAttributeAwareFormControlUI
 LazyLayout
 LegacyEncryptedMedia status=stable
@@ -65,9 +64,10 @@
 ParseSVGAsHTML
 PeerConnection depends_on=MediaStream, status=stable
 ProgrammaticScrollNotifications status=test
-Promise status=test
+Promise status=experimental
 Quota status=stable
 RequestAutocomplete status=test
+RowSpanLogicalHeightSpreading status=test
 ScriptedSpeech status=stable
 SeamlessIFrames status=experimental
 SessionStorage status=stable
@@ -80,6 +80,8 @@
 Vibration status=test
 VideoTrack status=stable
 WebAnimations
+WebAnimationsCSS depends_on=WebAnimations
+WebAnimationsSVG depends_on=WebAnimations
 WebAudio condition=WEB_AUDIO, status=stable
 WebGLDraftExtensions status=experimental
 WebMIDI status=test
diff --git a/Source/core/page/Settings.cpp b/Source/core/page/Settings.cpp
index 67fa2f6..97f4fbe 100644
--- a/Source/core/page/Settings.cpp
+++ b/Source/core/page/Settings.cpp
@@ -133,7 +133,6 @@
     , m_areImagesEnabled(true)
     , m_arePluginsEnabled(false)
     , m_isScriptEnabled(false)
-    , m_fontRenderingMode(0)
     , m_isCSSCustomFilterEnabled(false)
     , m_cssStickyPositionEnabled(true)
     , m_dnsPrefetchingEnabled(false)
@@ -146,7 +145,7 @@
 PassOwnPtr<Settings> Settings::create(Page* page)
 {
     return adoptPtr(new Settings(page));
-} 
+}
 
 SETTINGS_SETTER_BODIES
 
@@ -338,19 +337,6 @@
     m_page->userStyleSheetLocationChanged();
 }
 
-void Settings::setFontRenderingMode(FontRenderingMode mode)
-{
-    if (fontRenderingMode() == mode)
-        return;
-    m_fontRenderingMode = mode;
-    m_page->setNeedsRecalcStyleInAllFrames();
-}
-
-FontRenderingMode Settings::fontRenderingMode() const
-{
-    return static_cast<FontRenderingMode>(m_fontRenderingMode);
-}
-
 void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
 {
     if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
diff --git a/Source/core/page/Settings.h b/Source/core/page/Settings.h
index e0fbbef..8628912 100644
--- a/Source/core/page/Settings.h
+++ b/Source/core/page/Settings.h
@@ -30,7 +30,6 @@
 #include "SettingsMacros.h"
 #include "core/editing/EditingBehaviorTypes.h"
 #include "core/platform/Timer.h"
-#include "core/platform/graphics/FontRenderingMode.h"
 #include "core/platform/graphics/IntSize.h"
 #include "weborigin/KURL.h"
 #include "wtf/HashMap.h"
@@ -134,9 +133,6 @@
     void setUserStyleSheetLocation(const KURL&);
     const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
 
-    void setFontRenderingMode(FontRenderingMode mode);
-    FontRenderingMode fontRenderingMode() const;
-
     void setCSSCustomFilterEnabled(bool enabled) { m_isCSSCustomFilterEnabled = enabled; }
     bool isCSSCustomFilterEnabled() const { return m_isCSSCustomFilterEnabled; }
 
@@ -187,7 +183,6 @@
     bool m_areImagesEnabled : 1;
     bool m_arePluginsEnabled : 1;
     bool m_isScriptEnabled : 1;
-    unsigned m_fontRenderingMode : 1;
     bool m_isCSSCustomFilterEnabled : 1;
     bool m_cssStickyPositionEnabled : 1;
     bool m_dnsPrefetchingEnabled : 1;
diff --git a/Source/core/page/Settings.in b/Source/core/page/Settings.in
index 5533c3c..d613eb0 100644
--- a/Source/core/page/Settings.in
+++ b/Source/core/page/Settings.in
@@ -42,7 +42,6 @@
 textAreasAreResizable initial=false, setNeedsStyleRecalcInAllFrames=1
 authorAndUserStylesEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
 acceleratedCompositingEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
-showDebugBorders initial=false, setNeedsStyleRecalcInAllFrames=1
 showRepaintCounter initial=false, setNeedsStyleRecalcInAllFrames=1
 
 shrinksStandaloneImagesToFit initial=true
@@ -69,6 +68,7 @@
 acceleratedCompositingForFixedPositionEnabled initial=false
 acceleratedCompositingForOverflowScrollEnabled initial=false
 acceleratedCompositingForTransitionEnabled initial=false
+acceleratedCompositingForFixedRootBackgroundEnabled initial=false
 
 # Works only in conjunction with forceCompositingMode.
 acceleratedCompositingForScrollableFramesEnabled initial=false
diff --git a/Source/core/page/SpatialNavigation.cpp b/Source/core/page/SpatialNavigation.cpp
index fb7ecd5..64ff00a 100644
--- a/Source/core/page/SpatialNavigation.cpp
+++ b/Source/core/page/SpatialNavigation.cpp
@@ -67,8 +67,8 @@
     ASSERT(node);
     ASSERT(node->isElementNode());
 
-    if (node->hasTagName(HTMLNames::areaTag)) {
-        HTMLAreaElement* area = static_cast<HTMLAreaElement*>(node);
+    if (isHTMLAreaElement(node)) {
+        HTMLAreaElement* area = toHTMLAreaElement(node);
         HTMLImageElement* image = area->imageElement();
         if (!image || !image->renderer())
             return;
@@ -604,7 +604,7 @@
     if (!firstCandidate.rect.intersects(secondCandidate.rect))
         return false;
 
-    if (firstCandidate.focusableNode->hasTagName(HTMLNames::areaTag) || secondCandidate.focusableNode->hasTagName(HTMLNames::areaTag))
+    if (isHTMLAreaElement(firstCandidate.focusableNode) || isHTMLAreaElement(secondCandidate.focusableNode))
         return false;
 
     if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCandidate.visibleNode->renderer()->isRenderInline())
diff --git a/Source/core/page/TouchAdjustment.cpp b/Source/core/page/TouchAdjustment.cpp
index 321f1f0..9eaa251 100644
--- a/Source/core/page/TouchAdjustment.cpp
+++ b/Source/core/page/TouchAdjustment.cpp
@@ -156,7 +156,7 @@
     if (textRenderer->frame()->editor()->behavior().shouldSelectOnContextualMenuClick()) {
         // Make subtargets out of every word.
         String textValue = textNode->data();
-        TextBreakIterator* wordIterator = wordBreakIterator(textValue.bloatedCharacters(), textValue.length());
+        TextBreakIterator* wordIterator = wordBreakIterator(textValue, 0, textValue.length());
         int lastOffset = textBreakFirst(wordIterator);
         if (lastOffset == -1)
             return;
diff --git a/Source/core/page/TouchDisambiguation.cpp b/Source/core/page/TouchDisambiguation.cpp
index b13fa18..a0ba0d9 100644
--- a/Source/core/page/TouchDisambiguation.cpp
+++ b/Source/core/page/TouchDisambiguation.cpp
@@ -38,6 +38,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #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"
@@ -125,7 +126,7 @@
         for (Node* node = it->get(); node; node = node->parentNode()) {
             if (blackList.contains(node))
                 continue;
-            if (node->isDocumentNode() || node->hasTagName(HTMLNames::htmlTag) || node->hasTagName(HTMLNames::bodyTag))
+            if (node->isDocumentNode() || isHTMLHtmlElement(node) || node->hasTagName(HTMLNames::bodyTag))
                 break;
             if (node->willRespondToMouseClickEvents()) {
                 TouchTargetData& targetData = touchTargets.add(node, TouchTargetData()).iterator->value;
diff --git a/Source/core/page/UseCounter.cpp b/Source/core/page/UseCounter.cpp
index 6001182..1f4aa00 100644
--- a/Source/core/page/UseCounter.cpp
+++ b/Source/core/page/UseCounter.cpp
@@ -465,8 +465,8 @@
     case CSSPropertyTextDecorationLine: return 401;
     case CSSPropertyTextDecorationStyle: return 402;
     case CSSPropertyTextDecorationColor: return 403;
+    case CSSPropertyTextAlignLast: return 404;
 #if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT
-    case CSSPropertyWebkitTextAlignLast: return 404;
     case CSSPropertyWebkitTextUnderlinePosition: return 405;
 #endif
     case CSSPropertyMaxZoom: return 406;
@@ -476,9 +476,7 @@
 #if defined(ENABLE_DASHBOARD_SUPPORT) && ENABLE_DASHBOARD_SUPPORT
     case CSSPropertyWebkitDashboardRegion: return 410;
 #endif
-#if defined(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) && ENABLE_ACCELERATED_OVERFLOW_SCROLLING
-    case CSSPropertyWebkitOverflowScrolling: return 411;
-#endif
+    // CSSPropertyWebkitOverflowScrolling was 411.
     case CSSPropertyWebkitAppRegion: return 412;
     case CSSPropertyWebkitFilter: return 413;
     case CSSPropertyWebkitBoxDecorationBreak: return 414;
@@ -642,6 +640,10 @@
     case PrefixedDocumentRegister:
         return "The document.webkitRegister method is deprecated. Use the document.register method instead.";
 
+    // HTML Media Capture
+    case CaptureAttributeAsEnum:
+        return "Using the 'capture' attribute as an enum is deprecated. Please use it as a boolean and specify the media types that should be accepted in the 'accept' attribute.";
+
     // 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 8aa08a7..205febc 100644
--- a/Source/core/page/UseCounter.h
+++ b/Source/core/page/UseCounter.h
@@ -81,7 +81,7 @@
         UnprefixedTransitionEndEvent,
         PrefixedAndUnprefixedTransitionEndEvent,
         AutoFocusAttribute,
-        UnusedSlot01, // Prior to 4/2013, we used this slot for AutoSaveAttribute.
+        SVGAnimationElement, // Prior to 4/2013, we used this slot for AutoSaveAttribute.
         DataListElement,
         FormAttribute,
         IncrementalAttribute,
@@ -143,6 +143,9 @@
         PrefixedDocumentRegister,
         HTMLShadowElementOlderShadowRoot,
         DocumentAll,
+        FormElement,
+        DemotedFormElement,
+        CaptureAttributeAsEnum,
         // Add new features immediately above this line. Don't change assigned numbers of each items.
         NumberOfFeatures, // This enum value must be last.
     };
diff --git a/Source/core/page/Window.idl b/Source/core/page/Window.idl
index d468230..e26d2db 100644
--- a/Source/core/page/Window.idl
+++ b/Source/core/page/Window.idl
@@ -26,11 +26,10 @@
 
 [
     CheckSecurity,
-    EventTarget,
     CustomToV8,
     DoNotGenerateWrap,
     ImplementedAs=DOMWindow
-] interface Window {
+] interface Window : EventTarget {
     // DOM Level 0
     [Replaceable] readonly attribute Screen screen;
     [Replaceable] readonly attribute History history;
@@ -161,6 +160,20 @@
 
     [Replaceable] readonly attribute Performance performance;
 
+    // Images
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(HTMLImageElement image, ImageBitmapCallback callback);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(HTMLImageElement image, ImageBitmapCallback callback, long sx, long sy, long sw, long sh);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(HTMLVideoElement video, ImageBitmapCallback callback);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(HTMLVideoElement video, ImageBitmapCallback callback, long sx, long sy, long sw, long sh);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(CanvasRenderingContext2D context, ImageBitmapCallback callback);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(CanvasRenderingContext2D context, ImageBitmapCallback callback, long sx, long sy, long sw, long sh);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(HTMLCanvasElement canvas, ImageBitmapCallback callback);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(HTMLCanvasElement canvas, ImageBitmapCallback callback, long sx, long sy, long sw, long sh);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(ImageData data, ImageBitmapCallback callback);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(ImageData data, ImageBitmapCallback callback, long sx, long sy, long sw, long sh);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(ImageBitmap bitmap, ImageBitmapCallback callback);
+    [EnabledAtRuntime=experimentalCanvasFeatures, RaisesException] void createImageBitmap(ImageBitmap bitmap, ImageBitmapCallback callback, long sx, long sy, long sw, long sh);
+
     [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(RequestAnimationFrameCallback callback);
     void cancelAnimationFrame(long id);
     [MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback);
@@ -207,6 +220,8 @@
     attribute EventListener onloadstart;
     attribute EventListener onmessage;
     attribute EventListener onmousedown;
+    attribute EventListener onmouseenter;
+    attribute EventListener onmouseleave;
     attribute EventListener onmousemove;
     attribute EventListener onmouseout;
     attribute EventListener onmouseover;
@@ -261,15 +276,6 @@
     [EnabledAtRuntime=deviceMotion] attribute EventListener ondevicemotion;
     [EnabledAtRuntime=deviceOrientation] attribute EventListener ondeviceorientation;
 
-    // EventTarget interface
-    [Custom] void addEventListener(DOMString type,
-                                  EventListener listener,
-                                  optional boolean useCapture);
-    [Custom] void removeEventListener(DOMString type,
-                                      EventListener listener,
-                                      optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
-
     // Additional constructors.
     attribute TransitionEventConstructor WebKitTransitionEvent;
     [CustomConstructor] attribute HTMLImageElementConstructorConstructor Image; // Usable with new operator
diff --git a/Source/core/page/animation/AnimationBase.cpp b/Source/core/page/animation/AnimationBase.cpp
index 881c4e7..c355cf2 100644
--- a/Source/core/page/animation/AnimationBase.cpp
+++ b/Source/core/page/animation/AnimationBase.cpp
@@ -62,7 +62,7 @@
 void AnimationBase::setNeedsStyleRecalc(Node* node)
 {
     if (node)
-        node->setNeedsStyleRecalc(SyntheticStyleChange);
+        node->setNeedsStyleRecalc(LocalStyleChange);
 }
 
 double AnimationBase::duration() const
@@ -576,7 +576,11 @@
     if (m_startTime <= 0)
         return 0;
 
-    return beginAnimationUpdateTime() - m_startTime;
+    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/AnimationController.cpp b/Source/core/page/animation/AnimationController.cpp
index a68827b..ac67686 100644
--- a/Source/core/page/animation/AnimationController.cpp
+++ b/Source/core/page/animation/AnimationController.cpp
@@ -35,6 +35,7 @@
 #include "core/dom/TransitionEvent.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"
@@ -44,7 +45,6 @@
 
 namespace WebCore {
 
-static const double cAnimationTimerDelay = 0.025;
 static const double cBeginAnimationUpdateTimeNotSet = -1;
 
 AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame)
@@ -83,69 +83,91 @@
     return animation->suspended();
 }
 
-double AnimationControllerPrivate::updateAnimations(SetChanged callSetChanged/* = DoNotCallSetChanged*/)
+void AnimationControllerPrivate::updateAnimations(double& timeToNextService, double& timeToNextEvent, SetNeedsStyleRecalc callSetNeedsStyleRecalc/* = DoNotCallSetNeedsStyleRecalc*/)
 {
-    double timeToNextService = -1;
-    bool calledSetChanged = false;
+    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 < timeToNextService || timeToNextService == -1))
-                timeToNextService = t;
-            if (!timeToNextService) {
-                if (callSetChanged == CallSetChanged) {
+            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(SyntheticStyleChange);
-                    calledSetChanged = true;
+                    node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
+                    updateStyleNeeded = true;
                 }
-                else
-                    break;
+            } else if (!minTimeToNextService && !minTimeToNextEvent) {
+                // Found the minimum values and do not need to mark for style recalc.
+                break;
             }
         }
     }
 
-    if (calledSetChanged)
+    if (updateStyleNeeded)
         m_frame->document()->updateStyleIfNeeded();
 
-    return timeToNextService;
+    timeToNextService = minTimeToNextService;
+    timeToNextEvent = minTimeToNextEvent;
 }
 
-void AnimationControllerPrivate::updateAnimationTimerForRenderer(RenderObject* renderer)
+void AnimationControllerPrivate::scheduleServiceForRenderer(RenderObject* renderer)
 {
-    double timeToNextService = 0;
+    double timeToNextService = -1;
+    double timeToNextEvent = -1;
 
     RefPtr<CompositeAnimation> compAnim = m_compositeAnimations.get(renderer);
-    if (!compAnim->suspended() && compAnim->hasAnimations())
+    if (!compAnim->suspended() && compAnim->hasAnimations()) {
         timeToNextService = compAnim->timeToNextService();
+        timeToNextEvent = compAnim->timeToNextEvent();
+    }
 
-    if (m_animationTimer.isActive() && (m_animationTimer.repeatInterval() || m_animationTimer.nextFireInterval() <= timeToNextService))
-        return;
-
-    m_animationTimer.startOneShot(timeToNextService);
+    if (timeToNextService >= 0)
+        scheduleService(timeToNextService, timeToNextEvent);
 }
 
-void AnimationControllerPrivate::updateAnimationTimer(SetChanged callSetChanged/* = DoNotCallSetChanged*/)
+void AnimationControllerPrivate::scheduleService()
 {
-    double timeToNextService = updateAnimations(callSetChanged);
+    double timeToNextService = -1;
+    double timeToNextEvent = -1;
+    updateAnimations(timeToNextService, timeToNextEvent, DoNotCallSetNeedsStyleRecalc);
+    scheduleService(timeToNextService, timeToNextEvent);
+}
 
-    // If we want service immediately, we start a repeating timer to reduce the overhead of starting
-    if (!timeToNextService) {
-        if (!m_animationTimer.isActive() || m_animationTimer.repeatInterval() == 0)
-            m_animationTimer.startRepeating(cAnimationTimerDelay);
+void AnimationControllerPrivate::scheduleService(double timeToNextService, double timeToNextEvent)
+{
+    if (!m_frame->page())
+        return;
+
+    bool visible = m_frame->page()->visibilityState() == WebCore::PageVisibilityStateVisible;
+
+    if (!visible)
+        timeToNextService = timeToNextEvent;
+
+    if (visible && !timeToNextService) {
+        m_frame->document()->view()->scheduleAnimation();
+        if (m_animationTimer.isActive())
+            m_animationTimer.stop();
         return;
     }
 
-    // If we don't need service, we want to make sure the timer is no longer running
     if (timeToNextService < 0) {
         if (m_animationTimer.isActive())
             m_animationTimer.stop();
         return;
     }
 
-    // Otherwise, we want to start a one-shot timer so we get here again
+    if (m_animationTimer.isActive() && m_animationTimer.nextFireInterval() <= timeToNextService)
+        return;
+
     m_animationTimer.startOneShot(timeToNextService);
 }
 
@@ -176,7 +198,7 @@
     // 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(SyntheticStyleChange);
+        (*it)->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
 
     m_nodeChangesToDispatch.clear();
 
@@ -211,12 +233,16 @@
     startUpdateStyleIfNeededDispatcher();
 }
 
-void AnimationControllerPrivate::animationFrameCallbackFired()
+void AnimationControllerPrivate::serviceAnimations()
 {
-    double timeToNextService = updateAnimations(CallSetChanged);
+    double timeToNextService = -1;
+    double timeToNextEvent = -1;
+    updateAnimations(timeToNextService, timeToNextEvent, CallSetNeedsStyleRecalc);
+    scheduleService(timeToNextService, timeToNextEvent);
 
-    if (timeToNextService >= 0)
-        m_frame->document()->view()->scheduleAnimation();
+    // 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>*)
@@ -224,14 +250,7 @@
     // Make sure animationUpdateTime is updated, so that it is current even if no
     // styleChange has happened (e.g. accelerated animations)
     setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
-
-    // When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate
-    // updateStyleIfNeeded.  It will then call back to us with new information.
-    updateAnimationTimer(CallSetChanged);
-
-    // Fire events right away, to avoid a flash of unanimated style after an animation completes, and before
-    // the 'end' event fires.
-    fireEventsAndUpdateStyle();
+    serviceAnimations();
 }
 
 bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
@@ -283,7 +302,7 @@
         }
     }
     
-    updateAnimationTimer();
+    scheduleService();
 }
 
 void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document)
@@ -299,7 +318,7 @@
         }
     }
     
-    updateAnimationTimer();
+    scheduleService();
 }
 
 void AnimationControllerPrivate::pauseAnimationsForTesting(double t)
@@ -307,7 +326,7 @@
     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(SyntheticStyleChange);
+        it->key->node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
     }
 }
 
@@ -456,7 +475,7 @@
 
     if (m_data->clear(renderer)) {
         if (Node* node = renderer->node())
-            node->setNeedsStyleRecalc(SyntheticStyleChange);
+            node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
     }
 }
 
@@ -486,9 +505,7 @@
     RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, oldStyle, newStyle);
 
     if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) {
-        m_data->updateAnimationTimerForRenderer(renderer);
-        if (FrameView* view = renderer->document()->view())
-            view->scheduleAnimation();
+        m_data->scheduleServiceForRenderer(renderer);
     }
 
     if (blendedStyle != newStyle) {
@@ -543,7 +560,7 @@
 
 void AnimationController::serviceAnimations()
 {
-    m_data->animationFrameCallbackFired();
+    m_data->serviceAnimations();
 }
 
 void AnimationController::suspendAnimationsForDocument(Document* document)
diff --git a/Source/core/page/animation/AnimationControllerPrivate.h b/Source/core/page/animation/AnimationControllerPrivate.h
index f4d7d95..948b166 100644
--- a/Source/core/page/animation/AnimationControllerPrivate.h
+++ b/Source/core/page/animation/AnimationControllerPrivate.h
@@ -50,9 +50,9 @@
 class RenderObject;
 class RenderStyle;
 
-enum SetChanged {
-    DoNotCallSetChanged = 0,
-    CallSetChanged = 1
+enum SetNeedsStyleRecalc {
+    DoNotCallSetNeedsStyleRecalc = 0,
+    CallSetNeedsStyleRecalc = 1
 };
 
 class AnimationControllerPrivate {
@@ -61,9 +61,8 @@
     AnimationControllerPrivate(Frame*);
     ~AnimationControllerPrivate();
 
-    // Returns the time until the next animation needs to be serviced, or -1 if there are none.
-    double updateAnimations(SetChanged callSetChanged = DoNotCallSetChanged);
-    void updateAnimationTimer(SetChanged callSetChanged = DoNotCallSetChanged);
+    void updateAnimations(double& timeToNextService, double& timeToNextEvent, SetNeedsStyleRecalc callSetNeedsStyleRecalc = DoNotCallSetNeedsStyleRecalc);
+    void scheduleService();
 
     PassRefPtr<CompositeAnimation> accessCompositeAnimation(RenderObject*);
     bool clear(RenderObject*);
@@ -77,7 +76,7 @@
 
     void suspendAnimations();
     void resumeAnimations();
-    void animationFrameCallbackFired();
+    void serviceAnimations();
 
     void suspendAnimationsForDocument(Document*);
     void resumeAnimationsForDocument(Document*);
@@ -103,11 +102,13 @@
 
     void animationWillBeRemoved(AnimationBase*);
 
-    void updateAnimationTimerForRenderer(RenderObject*);
+    void scheduleServiceForRenderer(RenderObject*);
     
 private:
     void animationTimerFired(Timer<AnimationControllerPrivate>*);
 
+    void scheduleService(double timeToNextService, double timeToNextEvent);
+
     void styleAvailable();
     void fireEventsAndUpdateStyle();
     void startTimeResponse(double t);
diff --git a/Source/core/page/animation/CSSPropertyAnimation.cpp b/Source/core/page/animation/CSSPropertyAnimation.cpp
index 06022ab..c1f4152 100644
--- a/Source/core/page/animation/CSSPropertyAnimation.cpp
+++ b/Source/core/page/animation/CSSPropertyAnimation.cpp
@@ -105,13 +105,13 @@
 {
     ASSERT(from && to);
     if (from->style() != to->style())
-        return adoptPtr(new ShadowData(*to));
+        return to->clone();
 
-    return adoptPtr(new ShadowData(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)));
+    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)
@@ -501,16 +501,16 @@
 
 static inline const ShadowData* shadowForBlending(const ShadowData* srcShadow, const ShadowData* otherShadow)
 {
-    DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, Color::transparent));
-    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, Color::transparent));
+    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;
+        return defaultInsetShadowData.get();
 
-    return &defaultShadowData;
+    return defaultShadowData.get();
 }
 
 class PropertyWrapperShadow : public AnimationPropertyWrapperBase {
@@ -1108,8 +1108,8 @@
     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<int>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing));
-    gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing));
+    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));
diff --git a/Source/core/page/animation/CompositeAnimation.cpp b/Source/core/page/animation/CompositeAnimation.cpp
index 86cff48..4616348 100644
--- a/Source/core/page/animation/CompositeAnimation.cpp
+++ b/Source/core/page/animation/CompositeAnimation.cpp
@@ -355,6 +355,45 @@
     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()) {
+        m_keyframeAnimations.checkConsistency();
+        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;
diff --git a/Source/core/page/animation/CompositeAnimation.h b/Source/core/page/animation/CompositeAnimation.h
index 2d3d142..2a6d0de 100644
--- a/Source/core/page/animation/CompositeAnimation.h
+++ b/Source/core/page/animation/CompositeAnimation.h
@@ -57,6 +57,7 @@
     PassRefPtr<RenderStyle> getAnimatedStyle() const;
 
     double timeToNextService() const;
+    double timeToNextEvent() const;
     
     AnimationControllerPrivate* animationController() const { return m_animationController; }
 
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp
index cd9e31f..20a515f 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -158,7 +158,6 @@
 
     // Avoid unnecessary commits
     clearPositionConstraintExceptForLayer(backing->ancestorClippingLayer(), mainLayer);
-    clearPositionConstraintExceptForLayer(backing->contentsContainmentLayer(), mainLayer);
     clearPositionConstraintExceptForLayer(backing->graphicsLayer(), mainLayer);
 
     if (WebLayer* scrollableLayer = scrollingWebLayerForGraphicsLayer(mainLayer))
@@ -240,7 +239,7 @@
     if (!platformSupportsCoordinatedScrollbar)
         return;
 
-    bool isMainFrame = (scrollableArea == static_cast<ScrollableArea*>(m_page->mainFrame()->view()));
+    bool isMainFrame = isForMainFrame(scrollableArea);
     if (!isMainFrame && platformSupportsMainFrameOnly)
         return;
 
@@ -268,11 +267,13 @@
         removeWebScrollbarLayer(scrollableArea, orientation);
 }
 
-void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea)
+bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea)
 {
     GraphicsLayer* scrollLayer = scrollLayerForScrollableArea(scrollableArea);
-    if (scrollLayer)
-        scrollLayer->setScrollableArea(scrollableArea);
+    if (scrollLayer) {
+        bool isMainFrame = isForMainFrame(scrollableArea);
+        scrollLayer->setScrollableArea(scrollableArea, isMainFrame);
+    }
 
     WebLayer* webLayer = scrollingWebLayerForScrollableArea(scrollableArea);
     if (webLayer) {
@@ -280,10 +281,18 @@
         webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition()));
         webLayer->setMaxScrollPosition(IntSize(scrollableArea->scrollSize(HorizontalScrollbar), scrollableArea->scrollSize(VerticalScrollbar)));
     }
-    if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar))
-        setupScrollbarLayer(horizontalScrollbarLayerForScrollableArea(scrollableArea), scrollbarLayer, webLayer);
-    if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar))
-        setupScrollbarLayer(verticalScrollbarLayerForScrollableArea(scrollableArea), scrollbarLayer, webLayer);
+    if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) {
+        GraphicsLayer* horizontalScrollbarLayer = horizontalScrollbarLayerForScrollableArea(scrollableArea);
+        if (horizontalScrollbarLayer)
+            setupScrollbarLayer(horizontalScrollbarLayer, scrollbarLayer, webLayer);
+    }
+    if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar)) {
+        GraphicsLayer* verticalScrollbarLayer = verticalScrollbarLayerForScrollableArea(scrollableArea);
+        if (verticalScrollbarLayer)
+            setupScrollbarLayer(verticalScrollbarLayer, scrollbarLayer, webLayer);
+    }
+
+    return !!webLayer;
 }
 
 void ScrollingCoordinator::setTouchEventTargetRects(const Vector<IntRect>& absoluteHitTestRects)
@@ -533,6 +542,11 @@
     return scrollableArea->layerForVerticalScrollbar();
 }
 
+bool ScrollingCoordinator::isForMainFrame(ScrollableArea* scrollableArea) const
+{
+    return scrollableArea == m_page->mainFrame()->view();
+}
+
 GraphicsLayer* ScrollingCoordinator::scrollLayerForFrameView(FrameView* frameView)
 {
     Frame* frame = frameView->frame();
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.h b/Source/core/page/scrolling/ScrollingCoordinator.h
index 925583b..de91423 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.h
+++ b/Source/core/page/scrolling/ScrollingCoordinator.h
@@ -90,7 +90,8 @@
     bool shouldUpdateScrollLayerPositionOnMainThread() const { return mainThreadScrollingReasons() != 0; }
 
     void willDestroyScrollableArea(ScrollableArea*);
-    void scrollableAreaScrollLayerDidChange(ScrollableArea*);
+    // Returns true if the coordinator handled this change.
+    bool scrollableAreaScrollLayerDidChange(ScrollableArea*);
     void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation);
     void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool);
     void updateLayerPositionConstraint(RenderLayer*);
@@ -108,6 +109,7 @@
     static GraphicsLayer* scrollLayerForScrollableArea(ScrollableArea*);
     static GraphicsLayer* horizontalScrollbarLayerForScrollableArea(ScrollableArea*);
     static GraphicsLayer* verticalScrollbarLayerForScrollableArea(ScrollableArea*);
+    bool isForMainFrame(ScrollableArea*) const;
 
     unsigned computeCurrentWheelEventHandlerCount();
     GraphicsLayer* scrollLayerForFrameView(FrameView*);
diff --git a/Source/core/platform/AsyncFileSystemCallbacks.h b/Source/core/platform/AsyncFileSystemCallbacks.h
index efe6b7e..8b52313 100644
--- a/Source/core/platform/AsyncFileSystemCallbacks.h
+++ b/Source/core/platform/AsyncFileSystemCallbacks.h
@@ -68,6 +68,10 @@
     // Called when there was an error.
     virtual void didFail(int code) = 0;
 
+    // Returns true if the caller expects that the calling thread blocks
+    // until completion.
+    virtual bool shouldBlockUntilCompletion() const { return false; }
+
     virtual ~AsyncFileSystemCallbacks() { }
 };
 
diff --git a/Source/core/platform/DEPS b/Source/core/platform/DEPS
index 8773d70..f1e4fe8 100644
--- a/Source/core/platform/DEPS
+++ b/Source/core/platform/DEPS
@@ -2,8 +2,23 @@
 # Please run Tools/Scripts/check-blink-deps after modifying this file.
 
 include_rules = [
+    "-core",
+    "+core/platform",
     "+dl",
     "+skia",
     "+third_party",
     "+webp",
+    # platform/ shouldn't depends on core/ but unfortunately does (crbug.com/258901).
+    # Please don't add anything to this list of exceptions.
+    "!core/accessibility",
+    "!core/css",
+    "!core/dom",
+    "!core/editing",
+    "!core/fileapi",
+    "!core/html",
+    "!core/inspector",
+    "!core/loader/cache",
+    "!core/page",
+    "!core/plugins",
+    "!core/rendering",
 ]
diff --git a/Source/core/platform/EventTracer.cpp b/Source/core/platform/EventTracer.cpp
index f9be0da..d10037c 100644
--- a/Source/core/platform/EventTracer.cpp
+++ b/Source/core/platform/EventTracer.cpp
@@ -39,22 +39,20 @@
 // The dummy variable is needed to avoid a crash when someone updates the state variables
 // before EventTracer::initialize() is called.
 long dummyTraceSamplingState = 0;
-long* traceSamplingState0 = &dummyTraceSamplingState;
-long* traceSamplingState1 = &dummyTraceSamplingState;
-long* traceSamplingState2 = &dummyTraceSamplingState;
+long* traceSamplingState[3] = {&dummyTraceSamplingState, &dummyTraceSamplingState, &dummyTraceSamplingState };
 
 void EventTracer::initialize()
 {
-    traceSamplingState0 = WebKit::Platform::current()->getTraceSamplingState(0);
-    // FIXME: traceSamplingState0 can be 0 in split-dll build. http://crbug.com/237249
-    if (!traceSamplingState0)
-        traceSamplingState0 = &dummyTraceSamplingState;
-    traceSamplingState1 = WebKit::Platform::current()->getTraceSamplingState(1);
-    if (!traceSamplingState1)
-        traceSamplingState1 = &dummyTraceSamplingState;
-    traceSamplingState2 = WebKit::Platform::current()->getTraceSamplingState(2);
-    if (!traceSamplingState2)
-        traceSamplingState2 = &dummyTraceSamplingState;
+    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)
diff --git a/Source/core/platform/EventTracer.h b/Source/core/platform/EventTracer.h
index 73df310..e284802 100644
--- a/Source/core/platform/EventTracer.h
+++ b/Source/core/platform/EventTracer.h
@@ -34,9 +34,7 @@
 namespace WebCore {
 
 // FIXME: Make these global variables thread-safe. Make a value update atomic.
-extern long* traceSamplingState0;
-extern long* traceSamplingState1;
-extern long* traceSamplingState2;
+extern long* traceSamplingState[3];
 
 class EventTracer {
 public:
diff --git a/Source/core/platform/FileChooser.h b/Source/core/platform/FileChooser.h
index 47b3072..bffd04e 100644
--- a/Source/core/platform/FileChooser.h
+++ b/Source/core/platform/FileChooser.h
@@ -56,7 +56,7 @@
     Vector<String> acceptFileExtensions;
     Vector<String> selectedFiles;
 #if ENABLE(MEDIA_CAPTURE)
-    String capture;
+    bool useMediaCapture;
 #endif
 
     // Returns a combined vector of acceptMIMETypes and acceptFileExtensions.
diff --git a/Source/core/platform/HashTools.h b/Source/core/platform/HashTools.h
index 3badbde..c376470 100644
--- a/Source/core/platform/HashTools.h
+++ b/Source/core/platform/HashTools.h
@@ -28,12 +28,12 @@
 };
 
 struct Property {
-    const char* name;
+    int nameOffset;
     int id;
 };
 
 struct Value {
-    const char* name;
+    int nameOffset;
     int id;
 };
 
diff --git a/Source/core/platform/Length.cpp b/Source/core/platform/Length.cpp
index 89a1ee2..d93d6af 100644
--- a/Source/core/platform/Length.cpp
+++ b/Source/core/platform/Length.cpp
@@ -73,36 +73,6 @@
     return Length(0, Fixed);
 }
 
-template<typename CharType>
-static Length parseFrameSetDimension(const CharType* data, unsigned length)
-{
-    if (!length)
-        return Length(1, Relative);
-
-    unsigned intLength;
-    unsigned doubleLength;
-    unsigned i = splitLength(data, length, intLength, doubleLength);
-
-    bool ok;
-    CharType next = (i < length) ? data[i] : ' ';
-    if (next == '%') {
-        // IE quirk: accept decimal fractions for percentages.
-        double r = charactersToDouble(data, doubleLength, &ok);
-        if (ok)
-            return Length(r, Percent);
-        return Length(1, Relative);
-    }
-    int r = charactersToIntStrict(data, intLength, &ok);
-    if (next == '*') {
-        if (ok)
-            return Length(r, Relative);
-        return Length(1, Relative);
-    }
-    if (ok)
-        return Length(r, Fixed);
-    return Length(0, Relative);
-}
-
 // FIXME: Per HTML5, this should follow the "rules for parsing a list of integers".
 Vector<Length> parseHTMLAreaElementCoords(const String& string)
 {
@@ -140,43 +110,6 @@
     return r;
 }
 
-template<typename CharType>
-static Vector<Length> parseFrameSetListOfDimensionsInternal(StringImpl* str)
-{
-    unsigned len = str->count(',') + 1;
-    Vector<Length> r(len);
-
-    int i = 0;
-    unsigned pos = 0;
-    size_t pos2;
-
-    while ((pos2 = str->find(',', pos)) != notFound) {
-        r[i++] = parseFrameSetDimension(str->getCharacters<CharType>() + pos, pos2 - pos);
-        pos = pos2 + 1;
-    }
-
-    ASSERT(i == len - 1);
-
-    // IE Quirk: If the last comma is the last char skip it and reduce len by one.
-    if (str->length() - pos > 0)
-        r[i] = parseFrameSetDimension(str->getCharacters<CharType>() + pos, str->length() - pos);
-    else
-        r.shrink(r.size() - 1);
-
-    return r;
-}
-
-// FIXME: Per HTML5, this should "use the rules for parsing a list of dimensions".
-Vector<Length> parseFrameSetListOfDimensions(const String& string)
-{
-    RefPtr<StringImpl> str = string.impl()->simplifyWhiteSpace();
-    if (!str->length())
-        return Vector<Length>();
-    if (str->is8Bit())
-        return parseFrameSetListOfDimensionsInternal<LChar>(str.get());
-    return parseFrameSetListOfDimensionsInternal<UChar>(str.get());
-}
-
 class CalculationValueHandleMap {
     WTF_MAKE_FAST_ALLOCATED;
 public:
diff --git a/Source/core/platform/Length.h b/Source/core/platform/Length.h
index 516c952..6f1eb0b 100644
--- a/Source/core/platform/Length.h
+++ b/Source/core/platform/Length.h
@@ -310,7 +310,6 @@
 };
 
 Vector<Length> parseHTMLAreaElementCoords(const String&);
-Vector<Length> parseFrameSetListOfDimensions(const String&);
 
 } // namespace WebCore
 
diff --git a/Source/core/platform/Partitions.cpp b/Source/core/platform/Partitions.cpp
index 3630819..635025a 100644
--- a/Source/core/platform/Partitions.cpp
+++ b/Source/core/platform/Partitions.cpp
@@ -32,7 +32,6 @@
 #include "config.h"
 #include "core/platform/Partitions.h"
 
-#if ENABLE(PARTITION_ALLOC)
 namespace WebCore {
 
 PartitionRoot Partitions::m_objectModelRoot;
@@ -49,6 +48,5 @@
     // the valgrind and heapcheck bots, which run without partitions.
     (void) partitionAllocShutdown(&m_objectModelRoot);
 }
-#endif
 
 } // namespace WebCore
diff --git a/Source/core/platform/SharedBuffer.cpp b/Source/core/platform/SharedBuffer.cpp
index 78f28cd..0d9c948 100644
--- a/Source/core/platform/SharedBuffer.cpp
+++ b/Source/core/platform/SharedBuffer.cpp
@@ -309,15 +309,22 @@
     RefPtr<SharedBuffer> clone(adoptRef(new SharedBuffer));
     if (m_purgeableBuffer) {
         clone->append(data(), size());
-        return clone;
+        return clone.release();
     }
 
     clone->m_size = m_size;
     clone->m_buffer.reserveCapacity(m_size);
     clone->m_buffer.append(m_buffer.data(), m_buffer.size());
-    for (unsigned i = 0; i < m_segments.size(); ++i)
-        clone->m_buffer.append(m_segments[i], segmentSize);
-    return clone;
+    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()
diff --git a/Source/core/platform/SharedBufferTest.cpp b/Source/core/platform/SharedBufferTest.cpp
index bfea541..ed4963e 100644
--- a/Source/core/platform/SharedBufferTest.cpp
+++ b/Source/core/platform/SharedBufferTest.cpp
@@ -47,15 +47,15 @@
     char testData1[] = "World";
     char testData2[] = "Goodbye";
 
-    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(testData0, sizeof(testData0) - 1);
-    sharedBuffer->append(testData1, sizeof(testData1) - 1);
-    sharedBuffer->append(testData2, sizeof(testData2) - 1);
+    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(sizeof(expectedConcatenation) - 1, arrayBuffer->byteLength());
-    EXPECT_EQ(0, memcmp(expectedConcatenation, arrayBuffer->data(), sizeof(expectedConcatenation) - 1));
+    ASSERT_EQ(strlen(expectedConcatenation), arrayBuffer->byteLength());
+    EXPECT_EQ(0, memcmp(expectedConcatenation, arrayBuffer->data(), strlen(expectedConcatenation)));
 }
 
 TEST(SharedBufferTest, getAsArrayBufferLargeSegments)
@@ -92,4 +92,40 @@
     }
 }
 
+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/ThreadGlobalData.cpp b/Source/core/platform/ThreadGlobalData.cpp
index 32936cc..815deb7 100644
--- a/Source/core/platform/ThreadGlobalData.cpp
+++ b/Source/core/platform/ThreadGlobalData.cpp
@@ -29,7 +29,6 @@
 
 #include "core/dom/EventNames.h"
 #include "core/inspector/InspectorCounters.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/platform/ThreadTimers.h"
 #include "wtf/MainThread.h"
 #include "wtf/ThreadSpecific.h"
@@ -44,8 +43,7 @@
 ThreadSpecific<ThreadGlobalData>* ThreadGlobalData::staticData;
 
 ThreadGlobalData::ThreadGlobalData()
-    : m_cachedResourceRequestInitiators(adoptPtr(new CachedResourceRequestInitiators))
-    , m_eventNames(adoptPtr(new EventNames))
+    : m_eventNames(adoptPtr(new EventNames))
     , m_threadTimers(adoptPtr(new ThreadTimers))
 #ifndef NDEBUG
     , m_isMainThread(isMainThread())
diff --git a/Source/core/platform/ThreadGlobalData.h b/Source/core/platform/ThreadGlobalData.h
index b9004b5..55d21d8 100644
--- a/Source/core/platform/ThreadGlobalData.h
+++ b/Source/core/platform/ThreadGlobalData.h
@@ -44,7 +44,6 @@
     class ThreadLocalInspectorCounters;
     class ThreadTimers;
 
-    struct CachedResourceRequestInitiators;
     struct TECConverterWrapper;
 
     class ThreadGlobalData {
@@ -54,14 +53,12 @@
         ~ThreadGlobalData();
         void destroy(); // called on workers to clean up the ThreadGlobalData before the thread exits.
 
-        const CachedResourceRequestInitiators& cachedResourceRequestInitiators() { return *m_cachedResourceRequestInitiators; }
         EventNames& eventNames() { return *m_eventNames; }
         ThreadTimers& threadTimers() { return *m_threadTimers; }
 
         ThreadLocalInspectorCounters& inspectorCounters() { return *m_inspectorCounters; }
 
     private:
-        OwnPtr<CachedResourceRequestInitiators> m_cachedResourceRequestInitiators;
         OwnPtr<EventNames> m_eventNames;
         OwnPtr<ThreadTimers> m_threadTimers;
 
diff --git a/Source/core/platform/ThreadTimers.cpp b/Source/core/platform/ThreadTimers.cpp
index 19ec847..abf5bea 100644
--- a/Source/core/platform/ThreadTimers.cpp
+++ b/Source/core/platform/ThreadTimers.cpp
@@ -102,12 +102,12 @@
 
 void ThreadTimers::sharedTimerFired()
 {
-    TRACE_EVENT_SAMPLING_STATE0("Blink\0Blink-Internal");
+    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "Internal");
 
     // Redirect to non-static method.
     threadGlobalData().threadTimers().sharedTimerFiredInternal();
 
-    TRACE_EVENT_SAMPLING_STATE0("Blink\0Blink-Sleeping");
+    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "Sleeping");
 }
 
 void ThreadTimers::sharedTimerFiredInternal()
diff --git a/Source/core/platform/animation/AnimationUtilities.h b/Source/core/platform/animation/AnimationUtilities.h
index cb1924d..07cd54d 100644
--- a/Source/core/platform/animation/AnimationUtilities.h
+++ b/Source/core/platform/animation/AnimationUtilities.h
@@ -34,12 +34,12 @@
 
 inline int blend(int from, int to, double progress)
 {  
-    return static_cast<int>(lround(static_cast<double>(from) + static_cast<double>(to - from) * progress));
+    return lround(from + (to - from) * progress);
 }
 
 inline unsigned blend(unsigned from, unsigned to, double progress)
 {
-    return static_cast<unsigned>(lround(to > from ? static_cast<double>(from) + static_cast<double>(to - from) * progress : static_cast<double>(from) - static_cast<double>(from - to) * progress));
+    return lround(to > from ? from + (to - from) * progress : from - (from - to) * progress);
 }
 
 inline double blend(double from, double to, double progress)
@@ -59,8 +59,7 @@
 
 inline IntPoint blend(const IntPoint& from, const IntPoint& to, double progress)
 {
-    return IntPoint(blend(from.x(), to.x(), progress),
-                    blend(from.y(), to.y(), progress));
+    return IntPoint(blend(from.x(), to.x(), progress), blend(from.y(), to.y(), progress));
 }
 
 // Calculates the accuracy for evaluating a timing function for an animation with the specified duration.
diff --git a/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp b/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp
index 561ed58..74e5e05 100644
--- a/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp
+++ b/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp
@@ -135,13 +135,16 @@
         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;
-            m_realData[k] = complexFFT[index];
-            m_imagData[k] = complexFFT[index + 1];
+            real[k] = c[index];
+            imag[k] = c[index + 1];
         }
-        m_realData[0] = complexFFT[0];
-        m_imagData[0] = complexFFT[m_FFTSize];
+        real[0] = c[0];
+        imag[0] = c[m_FFTSize];
     }
 }
 
@@ -150,22 +153,25 @@
     ASSERT(m_inverseContext);
 
     if (m_inverseContext) {
-        AudioFloatArray fftData(m_FFTSize + 2);
+        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] = m_realData[k];
-            fftData[index + 1] = m_imagData[k];
+            fftData[index] = real[k];
+            fftData[index + 1] = imag[k];
         }
-        fftData[0] = m_realData[0];
+        fftData[0] = real[0];
         fftData[1] = 0;
-        fftData[m_FFTSize] = m_imagData[0];
+        fftData[m_FFTSize] = imag[0];
         fftData[m_FFTSize + 1] = 0;
     
-        omxSP_FFTInv_CCSToR_F32_Sfs(fftData.data(), data, m_inverseContext);
+        omxSP_FFTInv_CCSToR_F32_Sfs(fftData, data, m_inverseContext);
     }
 }
 
diff --git a/Source/core/platform/chromium/ChromiumDataObject.cpp b/Source/core/platform/chromium/ChromiumDataObject.cpp
index 2facc6a..d29b06e 100644
--- a/Source/core/platform/chromium/ChromiumDataObject.cpp
+++ b/Source/core/platform/chromium/ChromiumDataObject.cpp
@@ -93,7 +93,7 @@
 void ChromiumDataObject::add(const String& data, const String& type, ExceptionCode& ec)
 {
     if (!internalAddStringItem(ChromiumDataObjectItem::createFromString(type, data)))
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
 }
 
 void ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context)
diff --git a/Source/core/platform/chromium/ClipboardChromium.cpp b/Source/core/platform/chromium/ClipboardChromium.cpp
index 2e2dbab..bd63bdb 100644
--- a/Source/core/platform/chromium/ClipboardChromium.cpp
+++ b/Source/core/platform/chromium/ClipboardChromium.cpp
@@ -106,7 +106,7 @@
 void DataTransferItemListPolicyWrapper::deleteItem(unsigned long index, ExceptionCode& ec)
 {
     if (!m_clipboard->canWriteData()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
     m_dataObject->deleteItem(index);
diff --git a/Source/core/platform/chromium/TraceEvent.h b/Source/core/platform/chromium/TraceEvent.h
index 1e70c41..0af2ab7 100644
--- a/Source/core/platform/chromium/TraceEvent.h
+++ b/Source/core/platform/chromium/TraceEvent.h
@@ -427,15 +427,45 @@
         category, name, id, TRACE_EVENT_FLAG_COPY, \
         arg1_name, arg1_val, arg2_name, arg2_val)
 
-// Updates a global state with 'name'. The sampling thread will read
-// the value periodically. STATE0 is for the main thread.
-// STATE1 and STATE2 will be preserved for other threads.
-#define TRACE_EVENT_SAMPLING_STATE0(name) \
-    INTERNAL_TRACE_EVENT_SAMPLING_STATE(name, 0)
-#define TRACE_EVENT_SAMPLING_STATE1(name) \
-    INTERNAL_TRACE_EVENT_SAMPLING_STATE(name, 1)
-#define TRACE_EVENT_SAMPLING_STATE2(name) \
-    INTERNAL_TRACE_EVENT_SAMPLING_STATE(name, 2)
+// 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)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Implementation specific tracing API definitions.
@@ -535,15 +565,6 @@
         } \
     } while (0)
 
-// Implementation detail: internal macro to update a global state for
-// the sampling profiler.
-// FIXME: The current implementation uses only one global variable,
-// and thus cannot trace states of multiple threads.
-#define INTERNAL_TRACE_EVENT_SAMPLING_STATE(name, threadBucket) \
-    do { \
-        *WebCore::traceSamplingState##threadBucket = reinterpret_cast<long>(name); \
-    } 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
@@ -793,32 +814,36 @@
     Data m_data;
 };
 
-class SamplingState0Scope {
+// 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:
-    SamplingState0Scope(const char* name)
+    SamplingStateScope(const char* categoryAndName)
     {
-        m_previousState0 = *WebCore::traceSamplingState0;
-        *WebCore::traceSamplingState0 = reinterpret_cast<long>(const_cast<char*>(name));
+        m_previousState = SamplingStateScope<BucketNumber>::current();
+        SamplingStateScope<BucketNumber>::set(categoryAndName);
     }
 
-    ~SamplingState0Scope()
+    ~SamplingStateScope()
     {
-        *WebCore::traceSamplingState0 = m_previousState0;
+        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::traceSamplingState0);
+        return reinterpret_cast<const char*>(*WebCore::traceSamplingState[BucketNumber]);
     }
-
-    static inline void forceCurrent(const char* name)
+    static inline void set(const char* categoryAndName)
     {
-        *WebCore::traceSamplingState0 = reinterpret_cast<long>(const_cast<char*>(name));
+        *WebCore::traceSamplingState[BucketNumber] = reinterpret_cast<long>(const_cast<char*>(categoryAndName));
     }
 
 private:
-    long m_previousState0;
+    const char* m_previousState;
 };
 
 } // namespace TraceEvent
diff --git a/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp b/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
index 0ca2d40..685bd3d 100644
--- a/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
+++ b/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
@@ -39,31 +39,31 @@
 
 class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithmPrivate> {
 public:
-    WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId algorithmId, const char* algorithmName, PassOwnPtr<WebCryptoAlgorithmParams> params)
-        : algorithmId(algorithmId)
-        , algorithmName(algorithmName)
+    WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId id, const char* name, PassOwnPtr<WebCryptoAlgorithmParams> params)
+        : id(id)
+        , name(name)
         , params(params)
     {
     }
 
-    WebCryptoAlgorithmId algorithmId;
-    const char* const algorithmName;
+    WebCryptoAlgorithmId id;
+    const char* const name;
     OwnPtr<WebCryptoAlgorithmParams> params;
 };
 
-WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId algorithmId, const char* algorithmName, PassOwnPtr<WebCryptoAlgorithmParams> params)
-    : m_private(adoptRef(new WebCryptoAlgorithmPrivate(algorithmId, algorithmName, params)))
+WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId id, const char* name, PassOwnPtr<WebCryptoAlgorithmParams> params)
+    : m_private(adoptRef(new WebCryptoAlgorithmPrivate(id, name, params)))
 {
 }
 
-WebCryptoAlgorithmId WebCryptoAlgorithm::algorithmId() const
+WebCryptoAlgorithmId WebCryptoAlgorithm::id() const
 {
-    return m_private->algorithmId;
+    return m_private->id;
 }
 
-const char* WebCryptoAlgorithm::algorithmName() const
+const char* WebCryptoAlgorithm::name() const
 {
-    return m_private->algorithmName;
+    return m_private->name;
 }
 
 WebCryptoAlgorithmParamsType WebCryptoAlgorithm::paramsType() const
diff --git a/Source/core/platform/chromium/support/WebCryptoKey.cpp b/Source/core/platform/chromium/support/WebCryptoKey.cpp
new file mode 100644
index 0000000..64e3b9c
--- /dev/null
+++ b/Source/core/platform/chromium/support/WebCryptoKey.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 "public/platform/WebCryptoKey.h"
+
+#include "public/platform/WebCryptoAlgorithm.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/ThreadSafeRefCounted.h"
+
+namespace WebKit {
+
+class WebCryptoKeyPrivate : public ThreadSafeRefCounted<WebCryptoKeyPrivate> {
+public:
+    WebCryptoKeyPrivate(PassOwnPtr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMask usages)
+        : handle(handle)
+        , type(type)
+        , extractable(extractable)
+        , algorithm(algorithm)
+        , usages(usages)
+    {
+    }
+
+    const OwnPtr<WebCryptoKeyHandle> handle;
+    const WebCryptoKeyType type;
+    const bool extractable;
+    const WebCryptoAlgorithm algorithm;
+    const WebCryptoKeyUsageMask usages;
+};
+
+WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType type, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMask usages)
+{
+    WebCryptoKey key;
+    key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, extractable, algorithm, usages));
+    return key;
+}
+
+WebCryptoKeyHandle* WebCryptoKey::handle() const
+{
+    return m_private->handle.get();
+}
+
+WebCryptoKeyType WebCryptoKey::type() const
+{
+    return m_private->type;
+}
+
+bool WebCryptoKey::extractable() const
+{
+    return m_private->extractable;
+}
+
+const WebCryptoAlgorithm& WebCryptoKey::algorithm() const
+{
+    return m_private->algorithm;
+}
+
+WebCryptoKeyUsageMask WebCryptoKey::usages() const
+{
+    return m_private->usages;
+}
+
+void WebCryptoKey::assign(const WebCryptoKey& other)
+{
+    m_private = other.m_private;
+}
+
+void WebCryptoKey::reset()
+{
+    m_private.reset();
+}
+
+} // namespace WebKit
diff --git a/Source/core/platform/graphics/Font.cpp b/Source/core/platform/graphics/Font.cpp
index 4d610de..f948c7e 100644
--- a/Source/core/platform/graphics/Font.cpp
+++ b/Source/core/platform/graphics/Font.cpp
@@ -76,7 +76,7 @@
 {
 }
 
-Font::Font(const FontDescription& fd, short letterSpacing, short wordSpacing) 
+Font::Font(const FontDescription& fd, float letterSpacing, float wordSpacing)
     : m_fontDescription(fd)
     , m_letterSpacing(letterSpacing)
     , m_wordSpacing(wordSpacing)
@@ -201,7 +201,7 @@
     }
 
     bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures);
-    bool hasWordSpacingOrLetterSpacing = wordSpacing() | letterSpacing();
+    bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing();
     float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow);
     if (cacheEntry && !std::isnan(*cacheEntry))
         return *cacheEntry;
diff --git a/Source/core/platform/graphics/Font.h b/Source/core/platform/graphics/Font.h
index 1261b64..ed3df81 100644
--- a/Source/core/platform/graphics/Font.h
+++ b/Source/core/platform/graphics/Font.h
@@ -79,7 +79,7 @@
 class Font {
 public:
     Font();
-    Font(const FontDescription&, short letterSpacing, short wordSpacing);
+    Font(const FontDescription&, float letterSpacing, float wordSpacing);
     // This constructor is only used if the platform wants to start with a native font.
     Font(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoothing);
     ~Font();
@@ -113,14 +113,12 @@
 
     bool isSmallCaps() const { return m_fontDescription.smallCaps(); }
 
-    short wordSpacing() const { return m_wordSpacing; }
-    short letterSpacing() const { return m_letterSpacing; }
-    void setWordSpacing(short s) { m_wordSpacing = s; }
-    void setLetterSpacing(short s) { m_letterSpacing = s; }
+    float wordSpacing() const { return m_wordSpacing; }
+    float letterSpacing() const { return m_letterSpacing; }
+    void setWordSpacing(float s) { m_wordSpacing = s; }
+    void setLetterSpacing(float s) { m_letterSpacing = s; }
     bool isFixedPitch() const;
     bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
-    
-    FontRenderingMode renderingMode() const { return m_fontDescription.renderingMode(); }
 
     TypesettingFeatures typesettingFeatures() const { return m_typesettingFeatures; }
 
@@ -289,8 +287,8 @@
 
     FontDescription m_fontDescription;
     mutable RefPtr<FontFallbackList> m_fontFallbackList;
-    short m_letterSpacing;
-    short m_wordSpacing;
+    float m_letterSpacing;
+    float m_wordSpacing;
     bool m_isPlatformFont;
     bool m_needsTranscoding;
     mutable TypesettingFeatures m_typesettingFeatures; // Caches values computed from m_fontDescription.
diff --git a/Source/core/platform/graphics/FontCache.cpp b/Source/core/platform/graphics/FontCache.cpp
index b5e2d12..c5a13b7 100644
--- a/Source/core/platform/graphics/FontCache.cpp
+++ b/Source/core/platform/graphics/FontCache.cpp
@@ -61,14 +61,12 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, unsigned weight = 0, bool italic = false,
-                             bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode, FontOrientation orientation = Horizontal,
-                             FontWidthVariant widthVariant = RegularWidth)
+        bool isPrinterFont = false, FontOrientation orientation = Horizontal, FontWidthVariant widthVariant = RegularWidth)
         : m_size(size)
         , m_weight(weight)
         , m_family(family)
         , m_italic(italic)
         , m_printerFont(isPrinterFont)
-        , m_renderingMode(renderingMode)
         , m_orientation(orientation)
         , m_widthVariant(widthVariant)
     {
@@ -79,9 +77,9 @@
 
     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_renderingMode == other.m_renderingMode && 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;
     }
 
     unsigned m_size;
@@ -89,7 +87,6 @@
     AtomicString m_family;
     bool m_italic;
     bool m_printerFont;
-    FontRenderingMode m_renderingMode;
     FontOrientation m_orientation;
     FontWidthVariant m_widthVariant;
 
@@ -104,7 +101,7 @@
         fontKey.m_size,
         fontKey.m_weight,
         fontKey.m_widthVariant,
-        static_cast<unsigned>(fontKey.m_orientation) << 3 | static_cast<unsigned>(fontKey.m_italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 | static_cast<unsigned>(fontKey.m_renderingMode)
+        static_cast<unsigned>(fontKey.m_orientation) << 2 | static_cast<unsigned>(fontKey.m_italic) << 1 | static_cast<unsigned>(fontKey.m_printerFont)
     };
     return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
 }
@@ -198,8 +195,7 @@
     }
 
     FontPlatformDataCacheKey key(familyName, fontDescription.computedPixelSize(), fontDescription.weight(), fontDescription.italic(),
-                                 fontDescription.usePrinterFont(), fontDescription.renderingMode(), fontDescription.orientation(),
-                                 fontDescription.widthVariant());
+        fontDescription.usePrinterFont(), fontDescription.orientation(), fontDescription.widthVariant());
     FontPlatformData* result = 0;
     bool foundResult;
     FontPlatformDataCache::iterator it = gFontPlatformDataCache->find(key);
@@ -558,4 +554,27 @@
     purgeInactiveFontData();
 }
 
+const FontPlatformData* FontCache::getFallbackFontData(const FontDescription& description)
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, sansStr, ("Sans", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(const AtomicString, serifStr, ("Serif", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(const AtomicString, monospaceStr, ("Monospace", AtomicString::ConstructFromLiteral));
+
+    FontPlatformData* fontPlatformData = 0;
+    switch (description.genericFamily()) {
+    case FontDescription::SerifFamily:
+        fontPlatformData = getCachedFontPlatformData(description, serifStr);
+        break;
+    case FontDescription::MonospaceFamily:
+        fontPlatformData = getCachedFontPlatformData(description, monospaceStr);
+        break;
+    case FontDescription::SansSerifFamily:
+    default:
+        fontPlatformData = getCachedFontPlatformData(description, sansStr);
+        break;
+    }
+
+    return fontPlatformData;
+}
+
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/FontCache.h b/Source/core/platform/graphics/FontCache.h
index 115875f..2058738 100644
--- a/Source/core/platform/graphics/FontCache.h
+++ b/Source/core/platform/graphics/FontCache.h
@@ -126,6 +126,7 @@
     FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family);
 
     PassRefPtr<SimpleFontData> getCachedFontData(const FontPlatformData*, ShouldRetain = Retain);
+    const FontPlatformData* getFallbackFontData(const FontDescription&);
 
     // Don't purge if this count is > 0;
     int m_purgePreventCount;
diff --git a/Source/core/platform/graphics/FontDescription.h b/Source/core/platform/graphics/FontDescription.h
index 304d182..66ab2b9 100644
--- a/Source/core/platform/graphics/FontDescription.h
+++ b/Source/core/platform/graphics/FontDescription.h
@@ -29,7 +29,6 @@
 #include "core/platform/graphics/FontFamily.h"
 #include "core/platform/graphics/FontFeatureSettings.h"
 #include "core/platform/graphics/FontOrientation.h"
-#include "core/platform/graphics/FontRenderingMode.h"
 #include "core/platform/graphics/FontSmoothingMode.h"
 #include "core/platform/graphics/FontTraitsMask.h"
 #include "core/platform/graphics/FontWidthVariant.h"
@@ -88,7 +87,6 @@
         , m_weight(FontWeightNormal)
         , m_genericFamily(NoFamily)
         , m_usePrinterFont(false)
-        , m_renderingMode(NormalRenderingMode)
         , m_kerning(AutoKerning)
         , m_commonLigaturesState(NormalLigaturesState)
         , m_discretionaryLigaturesState(NormalLigaturesState)
@@ -119,7 +117,6 @@
     bool usePrinterFont() const { return m_usePrinterFont; }
     // only use fixed default size when there is only one font family, and that family is "monospace"
     bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == monospaceFamily; }
-    FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
     Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
     LigaturesState commonLigaturesState() const { return static_cast<LigaturesState>(m_commonLigaturesState); }
     LigaturesState discretionaryLigaturesState() const { return static_cast<LigaturesState>(m_discretionaryLigaturesState); }
@@ -152,7 +149,6 @@
 #else
     void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
 #endif
-    void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
     void setKerning(Kerning kerning) { m_kerning = kerning; }
     void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; }
     void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesState) { m_discretionaryLigaturesState = discretionaryLigaturesState; }
@@ -188,7 +184,6 @@
     unsigned m_genericFamily : 3; // GenericFamilyType
     unsigned m_usePrinterFont : 1;
 
-    unsigned m_renderingMode : 1;  // Used to switch between CG and GDI text on Windows.
     unsigned m_kerning : 2; // Kerning
 
     unsigned m_commonLigaturesState : 2;
@@ -216,7 +211,6 @@
         && m_weight == other.m_weight
         && m_genericFamily == other.m_genericFamily
         && m_usePrinterFont == other.m_usePrinterFont
-        && m_renderingMode == other.m_renderingMode
         && m_kerning == other.m_kerning
         && m_commonLigaturesState == other.m_commonLigaturesState
         && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState
diff --git a/Source/core/platform/graphics/FontTest.cpp b/Source/core/platform/graphics/FontTest.cpp
new file mode 100644
index 0000000..8b9c784
--- /dev/null
+++ b/Source/core/platform/graphics/FontTest.cpp
@@ -0,0 +1,643 @@
+/*
+ * 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.
+ */
+
+// Tests for the Font class.
+
+#include "config.h"
+
+#include "core/platform/graphics/Font.h"
+
+#include <gtest/gtest.h>
+
+namespace WebCore {
+
+TEST(FontTest, TestCharacterRangeCodePath1)
+{
+    static UChar c1[] = { 0x0 };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x2E4 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c3[] = { 0x2E5 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x2E8 };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x2E9 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c6[] = { 0x2EA };
+    codePath = Font::characterRangeCodePath(c6, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath2)
+{
+    static UChar c1[] = { 0x2FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x300 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x330 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x36F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x370 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath3)
+{
+    static UChar c1[] = { 0x0590 };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x0591 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x05A0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x05BD };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x05BE };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c6[] = { 0x05BF };
+    codePath = Font::characterRangeCodePath(c6, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c7[] = { 0x05C0 };
+    codePath = Font::characterRangeCodePath(c7, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c8[] = { 0x05CF };
+    codePath = Font::characterRangeCodePath(c8, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c9[] = { 0x05D0 };
+    codePath = Font::characterRangeCodePath(c9, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath4)
+{
+    static UChar c1[] = { 0x05FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x0600 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x0700 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x109F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x10A0 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath5)
+{
+    static UChar c1[] = { 0x10FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x1100 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x11A0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x11FF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x1200 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath6)
+{
+    static UChar c1[] = { 0x135C };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x135D };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x135E };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x135F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x1360 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath7)
+{
+    static UChar c1[] = { 0x16FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x1700 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x1800 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x18AF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x18B0 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath8)
+{
+    static UChar c1[] = { 0x18FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x1900 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x1940 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x194F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x1950 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath9)
+{
+    static UChar c1[] = { 0x197F };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x1980 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x19D0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x19DF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x19E0 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath10)
+{
+    static UChar c1[] = { 0x19FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x1A00 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x1C00 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x1CFF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x1D00 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath11)
+{
+    static UChar c1[] = { 0x1DBF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x1DC0 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x1DD0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x1DFF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x1E00 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath);
+
+    static UChar c6[] = { 0x2000 };
+    codePath = Font::characterRangeCodePath(c6, 1);
+    EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath);
+
+    static UChar c7[] = { 0x2001 };
+    codePath = Font::characterRangeCodePath(c7, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath12)
+{
+    static UChar c1[] = { 0x20CF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x20D0 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x20F0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x20FF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x2100 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath13)
+{
+    static UChar c1[] = { 0x2CED };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x2CEF };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x2CF0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x2CF1 };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x2CF2 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath14)
+{
+    static UChar c1[] = { 0x3029 };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0x302A };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0x302C };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0x302F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0x3030 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath15)
+{
+    static UChar c1[] = { 0xA67B };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xA67C };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0xA67D };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0xA67E };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath16)
+{
+    static UChar c1[] = { 0xA6E9 };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xA6F0 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0xA6F1 };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0xA6F2 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath17)
+{
+    static UChar c1[] = { 0xA7FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xA800 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0xAA00 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0xABFF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0xAC00 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath18)
+{
+    static UChar c1[] = { 0xD7AF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xD7B0 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0xD7F0 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0xD7FF };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0xD800 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath19)
+{
+    static UChar c1[] = { 0xFDFF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xFE00 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0xFE05 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0xFE0F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0xFE10 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePath20)
+{
+    static UChar c1[] = { 0xFD1F };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xFE20 };
+    codePath = Font::characterRangeCodePath(c2, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c3[] = { 0xFE28 };
+    codePath = Font::characterRangeCodePath(c3, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c4[] = { 0xFE2F };
+    codePath = Font::characterRangeCodePath(c4, 1);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c5[] = { 0xFE30 };
+    codePath = Font::characterRangeCodePath(c5, 1);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePathSurrogate1)
+{
+    /* To be surrogate ... */
+    /* 1st character must be 0xD800 .. 0xDBFF */
+    /* 2nd character must be 0xdc00 .. 0xdfff */
+
+    /* The following 5 should all be Simple because they are not surrogate. */
+    static UChar c1[] = { 0xD800, 0xDBFE };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c2[] = { 0xD800, 0xE000 };
+    codePath = Font::characterRangeCodePath(c2, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c3[] = { 0xDBFF, 0xDBFE };
+    codePath = Font::characterRangeCodePath(c3, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c4[] = { 0xDBFF, 0xE000 };
+    codePath = Font::characterRangeCodePath(c4, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c5[] = { 0xDC00, 0xDBFF };
+    codePath = Font::characterRangeCodePath(c5, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    /* To be Complex, the Supplementary Character must be in either */
+    /* U+1F1E6 through U+1F1FF or U+E0100 through U+E01EF. */
+    /* That is, a lead of 0xD83C with trail 0xDDE6 .. 0xDDFF or */
+    /* a lead of 0xDB40 with trail 0xDD00 .. 0xDDEF. */
+    static UChar c6[] = { 0xD83C, 0xDDE5 };
+    codePath = Font::characterRangeCodePath(c6, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c7[] = { 0xD83C, 0xDDE6 };
+    codePath = Font::characterRangeCodePath(c7, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c8[] = { 0xD83C, 0xDDF0 };
+    codePath = Font::characterRangeCodePath(c8, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c9[] = { 0xD83C, 0xDDFF };
+    codePath = Font::characterRangeCodePath(c9, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c10[] = { 0xD83C, 0xDE00 };
+    codePath = Font::characterRangeCodePath(c10, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c11[] = { 0xDB40, 0xDCFF };
+    codePath = Font::characterRangeCodePath(c11, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    static UChar c12[] = { 0xDB40, 0xDD00 };
+    codePath = Font::characterRangeCodePath(c12, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c13[] = { 0xDB40, 0xDDED };
+    codePath = Font::characterRangeCodePath(c13, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c14[] = { 0xDB40, 0xDDEF };
+    codePath = Font::characterRangeCodePath(c14, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    static UChar c15[] = { 0xDB40, 0xDDF0 };
+    codePath = Font::characterRangeCodePath(c15, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+}
+
+TEST(FontTest, TestCharacterRangeCodePathString)
+{
+    // Simple-Simple is still simple
+    static UChar c1[] = { 0x2FF, 0x2FF };
+    Font::CodePath codePath = Font::characterRangeCodePath(c1, 2);
+    EXPECT_EQ(Font::Simple, codePath);
+
+    // Complex-Simple is Complex
+    static UChar c2[] = { 0x300, 0x2FF };
+    codePath = Font::characterRangeCodePath(c2, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    // Simple-Complex is Complex
+    static UChar c3[] = { 0x2FF, 0x330 };
+    codePath = Font::characterRangeCodePath(c3, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    // Complex-Complex is Complex
+    static UChar c4[] = { 0x36F, 0x330 };
+    codePath = Font::characterRangeCodePath(c4, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    // SimpleWithGlyphOverflow-Simple is SimpleWithGlyphOverflow
+    static UChar c5[] = { 0x1E00, 0x2FF };
+    codePath = Font::characterRangeCodePath(c5, 2);
+    EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath);
+
+    // Simple-SimpleWithGlyphOverflow is SimpleWithGlyphOverflow
+    static UChar c6[] = { 0x2FF, 0x2000 };
+    codePath = Font::characterRangeCodePath(c6, 2);
+    EXPECT_EQ(Font::SimpleWithGlyphOverflow, codePath);
+
+    // SimpleWithGlyphOverflow-Complex is Complex
+    static UChar c7[] = { 0x1E00, 0x330 };
+    codePath = Font::characterRangeCodePath(c7, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    // Complex-SimpleWithGlyphOverflow is Complex
+    static UChar c8[] = { 0x330, 0x2000 };
+    codePath = Font::characterRangeCodePath(c8, 2);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    // Surrogate-Complex is Complex
+    static UChar c9[] = { 0xD83C, 0xDDE5, 0x330 };
+    codePath = Font::characterRangeCodePath(c9, 3);
+    EXPECT_EQ(Font::Complex, codePath);
+
+    // Complex-Surrogate is Complex
+    static UChar c10[] = { 0x330, 0xD83C, 0xDDE5 };
+    codePath = Font::characterRangeCodePath(c10, 3);
+    EXPECT_EQ(Font::Complex, codePath);
+}
+
+
+} // namespace WebCore
+
diff --git a/Source/core/platform/graphics/GeneratorGeneratedImage.cpp b/Source/core/platform/graphics/GeneratorGeneratedImage.cpp
index 7b0e934..96ab49d 100644
--- a/Source/core/platform/graphics/GeneratorGeneratedImage.cpp
+++ b/Source/core/platform/graphics/GeneratorGeneratedImage.cpp
@@ -30,6 +30,8 @@
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 
+#define SKIA_MAX_PATTERN_SIZE 32767
+
 namespace WebCore {
 
 void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode)
@@ -45,14 +47,75 @@
     destContext->fillRect(FloatRect(FloatPoint(), m_size));
 }
 
+void GeneratorGeneratedImage::drawPatternWithoutCache(GraphicsContext* destContext, const FloatRect& srcRect, const FloatSize& scale,
+    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
+{
+    int firstColumn = static_cast<int>(floorf((((destRect.x() - phase.x()) / scale.width()) - srcRect.x()) / srcRect.width()));
+    int firstRow = static_cast<int>(floorf((((destRect.y() - phase.y()) / scale.height())  - srcRect.y()) / srcRect.height()));
+    for (int i = firstColumn; ; ++i) {
+        float dstX = (srcRect.x() + i * srcRect.width()) * scale.width() + phase.x();
+        // assert that first column encroaches left edge of dstRect.
+        ASSERT(i > firstColumn || dstX <= destRect.x());
+        ASSERT(i == firstColumn || dstX > destRect.x());
+
+        if (dstX >= destRect.maxX())
+            break;
+        float dstMaxX = dstX + srcRect.width() * scale.width();
+        if (dstX < destRect.x())
+            dstX = destRect.x();
+        if (dstMaxX > destRect.maxX())
+            dstMaxX = destRect.maxX();
+        if (dstX >= dstMaxX)
+            continue;
+
+        FloatRect visibleSrcRect;
+        FloatRect tileDstRect;
+        tileDstRect.setX(dstX);
+        tileDstRect.setWidth(dstMaxX - dstX);
+        visibleSrcRect.setX((tileDstRect.x() - phase.x()) / scale.width() - i * srcRect.width());
+        visibleSrcRect.setWidth(tileDstRect.width() / scale.width());
+
+        for (int j = firstRow; ; j++) {
+            float dstY = (srcRect.y() + j * srcRect.height()) * scale.height() + phase.y();
+            // assert that first row encroaches top edge of dstRect.
+            ASSERT(j > firstRow || dstY <= destRect.y());
+            ASSERT(j == firstRow || dstY > destRect.y());
+
+            if (dstY >= destRect.maxY())
+                break;
+            float dstMaxY = dstY + srcRect.height() * scale.height();
+            if (dstY < destRect.y())
+                dstY = destRect.y();
+            if (dstMaxY > destRect.maxY())
+                dstMaxY = destRect.maxY();
+            if (dstY >= dstMaxY)
+                continue;
+
+            tileDstRect.setY(dstY);
+            tileDstRect.setHeight(dstMaxY - dstY);
+            visibleSrcRect.setY((tileDstRect.y() - phase.y()) / scale.height() - j * srcRect.height());
+            visibleSrcRect.setHeight(tileDstRect.height() / scale.height());
+            draw(destContext, tileDstRect, visibleSrcRect, compositeOp, blendMode);
+        }
+    }
+}
+
 void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const FloatSize& scale,
-    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode)
+    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
 {
     // Allow the generator to provide visually-equivalent tiling parameters for better performance.
     IntSize adjustedSize = m_size;
     FloatRect adjustedSrcRect = srcRect;
+
     m_gradient->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
 
+    if (adjustedSize.width() > SKIA_MAX_PATTERN_SIZE || adjustedSize.height() > SKIA_MAX_PATTERN_SIZE) {
+        // Workaround to fix crbug.com/241486
+        // SkBitmapProcShader is unable to handle cached tiles >= 32k pixels high or wide.
+        drawPatternWithoutCache(destContext, srcRect, scale, phase, compositeOp, destRect, blendMode);
+        return;
+    }
+
     // Factor in the destination context's scale to generate at the best resolution.
     // FIXME: No need to get the full CTM here, we just need the scale.
     AffineTransform destContextCTM = destContext->getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
diff --git a/Source/core/platform/graphics/GeneratorGeneratedImage.h b/Source/core/platform/graphics/GeneratorGeneratedImage.h
index db16fd8..3f78858 100644
--- a/Source/core/platform/graphics/GeneratorGeneratedImage.h
+++ b/Source/core/platform/graphics/GeneratorGeneratedImage.h
@@ -59,6 +59,9 @@
         const FloatSize&, const FloatPoint&, CompositeOperator,
         const FloatRect&, BlendMode) OVERRIDE;
 
+    void drawPatternWithoutCache(GraphicsContext*, const FloatRect&, const FloatSize&,
+        const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode);
+
     void invalidateCacheTimerFired(DeferrableOneShotTimer<GeneratorGeneratedImage>*);
 
     GeneratorGeneratedImage(PassRefPtr<Gradient> generator, const IntSize& size)
diff --git a/Source/core/platform/graphics/GlyphMetricsMap.h b/Source/core/platform/graphics/GlyphMetricsMap.h
index caa1765..15cc399 100644
--- a/Source/core/platform/graphics/GlyphMetricsMap.h
+++ b/Source/core/platform/graphics/GlyphMetricsMap.h
@@ -30,11 +30,11 @@
 #define GlyphMetricsMap_h
 
 #include "core/platform/graphics/Glyph.h"
-#include <wtf/FixedArray.h>
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/unicode/Unicode.h>
+#include "wtf/Assertions.h"
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/unicode/Unicode.h"
 
 namespace WebCore {
 
@@ -55,9 +55,9 @@
     }
 
 private:
-    struct GlyphMetricsPage {
+    class GlyphMetricsPage {
+    public:
         static const size_t size = 256; // Usually covers Latin-1 in a single page.
-        FixedArray<T, size> m_metrics;
 
         T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; }
         void setMetricsForGlyph(Glyph glyph, const T& metrics)
@@ -66,8 +66,12 @@
         }
         void setMetricsForIndex(unsigned index, const T& metrics)
         {
+            ASSERT_WITH_SECURITY_IMPLICATION(index < size);
             m_metrics[index] = metrics;
         }
+
+    private:
+        T m_metrics[size];
     };
     
     GlyphMetricsPage* locatePage(unsigned pageNumber)
diff --git a/Source/core/platform/graphics/Gradient.cpp b/Source/core/platform/graphics/Gradient.cpp
index bb110b7..5a69dfd 100644
--- a/Source/core/platform/graphics/Gradient.cpp
+++ b/Source/core/platform/graphics/Gradient.cpp
@@ -53,7 +53,6 @@
     , m_spreadMethod(SpreadMethodPad)
     , m_cachedHash(0)
     , m_drawInPMColorSpace(false)
-    , m_gradient(0)
 {
 }
 
@@ -68,19 +67,11 @@
     , m_spreadMethod(SpreadMethodPad)
     , m_cachedHash(0)
     , m_drawInPMColorSpace(false)
-    , m_gradient(0)
 {
 }
 
 Gradient::~Gradient()
 {
-    destroyShader();
-}
-
-void Gradient::destroyShader()
-{
-    SkSafeUnref(m_gradient);
-    m_gradient = 0;
 }
 
 void Gradient::adjustParametersForTiledDrawing(IntSize& size, FloatRect& srcRect)
@@ -115,7 +106,7 @@
     m_stops.append(ColorStop(value, r, g, b, a));
 
     m_stopsSorted = false;
-    destroyShader();
+    m_gradient.clear();
 
     invalidateHash();
 }
@@ -125,7 +116,7 @@
     m_stops.append(stop);
 
     m_stopsSorted = false;
-    destroyShader();
+    m_gradient.clear();
 
     invalidateHash();
 }
@@ -163,7 +154,7 @@
 void Gradient::setSpreadMethod(GradientSpreadMethod spreadMethod)
 {
     // FIXME: Should it become necessary, allow calls to this method after m_gradient has been set.
-    ASSERT(m_gradient == 0);
+    ASSERT(!m_gradient);
 
     if (m_spreadMethod == spreadMethod)
         return;
@@ -179,9 +170,7 @@
         return;
 
     m_drawInPMColorSpace = drawInPMColorSpace;
-
-    if (m_gradient)
-        destroyShader();
+    m_gradient.clear();
 
     invalidateHash();
 }
@@ -307,7 +296,7 @@
 SkShader* Gradient::shader()
 {
     if (m_gradient)
-        return m_gradient;
+        return m_gradient.get();
 
     sortStopsIfNecessary();
     ASSERT(m_stopsSorted);
@@ -340,14 +329,14 @@
     if (m_radial) {
         // Since the two-point radial gradient is slower than the plain radial,
         // only use it if we have to.
-        if (m_p0 == m_p1 && m_r0 <= 0.0f)
-            m_gradient = SkGradientShader::CreateRadial(m_p1, m_r1, colors, pos, static_cast<int>(countUsed), tile, 0, shouldDrawInPMColorSpace);
-        else {
+        if (m_p0 == m_p1 && m_r0 <= 0.0f) {
+            m_gradient = adoptRef(SkGradientShader::CreateRadial(m_p1, m_r1, colors, pos, static_cast<int>(countUsed), tile, 0, shouldDrawInPMColorSpace));
+        } else {
             // The radii we give to Skia must be positive. If we're given a
             // negative radius, ask for zero instead.
             SkScalar radius0 = m_r0 >= 0.0f ? WebCoreFloatToSkScalar(m_r0) : 0;
             SkScalar radius1 = m_r1 >= 0.0f ? WebCoreFloatToSkScalar(m_r1) : 0;
-            m_gradient = SkGradientShader::CreateTwoPointConical(m_p0, radius0, m_p1, radius1, colors, pos, static_cast<int>(countUsed), tile, 0, shouldDrawInPMColorSpace);
+            m_gradient = adoptRef(SkGradientShader::CreateTwoPointConical(m_p0, radius0, m_p1, radius1, colors, pos, static_cast<int>(countUsed), tile, 0, shouldDrawInPMColorSpace));
         }
 
         if (aspectRatio() != 1) {
@@ -360,15 +349,16 @@
         }
     } else {
         SkPoint pts[2] = { m_p0, m_p1 };
-        m_gradient = SkGradientShader::CreateLinear(pts, colors, pos, static_cast<int>(countUsed), tile, 0, shouldDrawInPMColorSpace);
+        m_gradient = adoptRef(SkGradientShader::CreateLinear(pts, colors, pos, static_cast<int>(countUsed), tile, 0, shouldDrawInPMColorSpace));
     }
 
-    if (!m_gradient)
+    if (!m_gradient) {
         // use last color, since our "geometry" was degenerate (e.g. radius==0)
-        m_gradient = new SkColorShader(colors[countUsed - 1]);
-    else
+        m_gradient = adoptRef(new SkColorShader(colors[countUsed - 1]));
+    } else {
         m_gradient->setLocalMatrix(m_gradientSpaceTransformation);
-    return m_gradient;
+    }
+    return m_gradient.get();
 }
 
 } //namespace
diff --git a/Source/core/platform/graphics/Gradient.h b/Source/core/platform/graphics/Gradient.h
index 291c5e4..04e4598 100644
--- a/Source/core/platform/graphics/Gradient.h
+++ b/Source/core/platform/graphics/Gradient.h
@@ -159,7 +159,7 @@
 
     mutable unsigned m_cachedHash;
 
-    SkShader* m_gradient;
+    RefPtr<SkShader> m_gradient;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index 63ca4a9..c9da39c 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -293,7 +293,7 @@
     if (paintingDisabled())
         return;
 
-    setDrawLooper(drawLooper.skDrawLooper());
+    m_state->m_looper = drawLooper.skDrawLooper();
 }
 
 void GraphicsContext::clearDrawLooper()
@@ -301,7 +301,7 @@
     if (paintingDisabled())
         return;
 
-    setDrawLooper(0);
+    m_state->m_looper.clear();
 }
 
 bool GraphicsContext::hasShadow() const
@@ -1724,7 +1724,7 @@
 
     paint->setAntiAlias(m_state->m_shouldAntialias);
     paint->setXfermodeMode(m_state->m_xferMode);
-    paint->setLooper(m_state->m_looper);
+    paint->setLooper(m_state->m_looper.get());
 }
 
 void GraphicsContext::drawOuterPath(const SkPath& path, SkPaint& paint, int width)
diff --git a/Source/core/platform/graphics/GraphicsContext.h b/Source/core/platform/graphics/GraphicsContext.h
index 11d16d2..0dc1fc5 100644
--- a/Source/core/platform/graphics/GraphicsContext.h
+++ b/Source/core/platform/graphics/GraphicsContext.h
@@ -38,9 +38,10 @@
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/platform/graphics/ImageOrientation.h"
 #include "core/platform/graphics/skia/OpaqueRegionSkia.h"
-
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
+#include "wtf/FastAllocBase.h"
+#include "wtf/Forward.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassOwnPtr.h"
 
 class SkBitmap;
 class SkDevice;
@@ -127,7 +128,7 @@
     void setFillGradient(PassRefPtr<Gradient>);
     Gradient* fillGradient() const { return m_state->m_fillGradient.get(); }
 
-    SkDrawLooper* drawLooper() const { return m_state->m_looper; }
+    SkDrawLooper* drawLooper() const { return m_state->m_looper.get(); }
     SkColor effectiveStrokeColor() const { return m_state->applyAlpha(m_state->m_strokeData.color().rgb()); }
 
     int getNormalizedAlpha() const;
@@ -388,8 +389,6 @@
         return value;
     }
 
-    void setDrawLooper(SkDrawLooper* looper) { SkRefCnt_SafeAssign(m_state->m_looper, looper); }
-
     // Sets up the common flags on a paint for antialiasing, effects, etc.
     // This is implicitly called by setupPaintFill and setupPaintStroke, but
     // you may wish to call it directly sometimes if you don't want that other
diff --git a/Source/core/platform/graphics/GraphicsContext3D.cpp b/Source/core/platform/graphics/GraphicsContext3D.cpp
index 2ff862e..a5deef4 100644
--- a/Source/core/platform/graphics/GraphicsContext3D.cpp
+++ b/Source/core/platform/graphics/GraphicsContext3D.cpp
@@ -87,6 +87,7 @@
     , m_initializedAvailableExtensions(false)
     , m_layerComposited(false)
     , m_preserveDrawingBuffer(preserveDrawingBuffer)
+    , m_packAlignment(4)
     , m_resourceSafety(ResourceSafetyUnknown)
     , m_grContext(0)
 {
@@ -98,6 +99,7 @@
     , m_initializedAvailableExtensions(false)
     , m_layerComposited(false)
     , m_preserveDrawingBuffer(preserveDrawingBuffer)
+    , m_packAlignment(4)
     , m_resourceSafety(ResourceSafetyUnknown)
     , m_grContext(m_provider->grContext())
 {
@@ -500,7 +502,14 @@
 DELEGATE_TO_WEBCONTEXT_1R(isTexture, Platform3DObject, GC3Dboolean)
 DELEGATE_TO_WEBCONTEXT_1(lineWidth, GC3Dfloat)
 DELEGATE_TO_WEBCONTEXT_1(linkProgram, Platform3DObject)
-DELEGATE_TO_WEBCONTEXT_2(pixelStorei, GC3Denum, GC3Dint)
+
+void GraphicsContext3D::pixelStorei(GC3Denum pname, GC3Dint param)
+{
+    if (pname == PACK_ALIGNMENT)
+        m_packAlignment = param;
+    m_impl->pixelStorei(pname, param);
+}
+
 DELEGATE_TO_WEBCONTEXT_2(polygonOffset, GC3Dfloat, GC3Dfloat)
 
 DELEGATE_TO_WEBCONTEXT_7(readPixels, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, void*)
@@ -604,19 +613,45 @@
 
     RefPtr<ImageData> imageData = ImageData::create(IntSize(width, height));
     unsigned char* pixels = imageData->data()->data();
-    size_t bufferSize = 4 * width * height;
 
-    m_impl->readBackFramebuffer(pixels, bufferSize, framebufferId, width, height);
-
-#if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT
-    // If the implementation swapped the red and blue channels, un-swap them.
-    for (size_t i = 0; i < bufferSize; i += 4)
-        std::swap(pixels[i], pixels[i + 2]);
-#endif
+    m_impl->bindFramebuffer(FRAMEBUFFER, framebufferId);
+    readBackFramebuffer(pixels, width, height, ReadbackRGBA, AlphaDoNothing);
+    flipVertically(pixels, width, height);
 
     return imageData.release();
 }
 
+void GraphicsContext3D::readBackFramebuffer(unsigned char* pixels, int width, int height, ReadbackOrder readbackOrder, AlphaOp op)
+{
+    if (m_packAlignment > 4)
+        m_impl->pixelStorei(PACK_ALIGNMENT, 1);
+    m_impl->readPixels(0, 0, width, height, RGBA, UNSIGNED_BYTE, pixels);
+    if (m_packAlignment > 4)
+        m_impl->pixelStorei(PACK_ALIGNMENT, m_packAlignment);
+
+    size_t bufferSize = 4 * width * height;
+
+    if (readbackOrder == ReadbackSkia) {
+#if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT
+        // Swizzle red and blue channels to match SkBitmap's byte ordering.
+        // TODO(kbr): expose GL_BGRA as extension.
+        for (size_t i = 0; i < bufferSize; i += 4) {
+            std::swap(pixels[i], pixels[i + 2]);
+        }
+#endif
+    }
+
+    if (op == AlphaDoPremultiply) {
+        for (size_t i = 0; i < bufferSize; i += 4) {
+            pixels[i + 0] = std::min(255, pixels[i + 0] * pixels[i + 3] / 255);
+            pixels[i + 1] = std::min(255, pixels[i + 1] * pixels[i + 3] / 255);
+            pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255);
+        }
+    } else if (op != AlphaDoNothing) {
+        ASSERT_NOT_REACHED();
+    }
+}
+
 DELEGATE_TO_WEBCONTEXT_R(createBuffer, Platform3DObject)
 DELEGATE_TO_WEBCONTEXT_R(createFramebuffer, Platform3DObject)
 DELEGATE_TO_WEBCONTEXT_R(createProgram, Platform3DObject)
@@ -890,7 +925,6 @@
 void GraphicsContext3D::paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer* imageBuffer)
 {
     unsigned char* pixels = 0;
-    size_t bufferSize = 4 * width * height;
 
     const SkBitmap* canvasBitmap = imageBuffer->context()->bitmap();
     const SkBitmap* readbackBitmap = 0;
@@ -916,15 +950,9 @@
     SkAutoLockPixels bitmapLock(*readbackBitmap);
     pixels = static_cast<unsigned char*>(readbackBitmap->getPixels());
 
-    m_impl->readBackFramebuffer(pixels, 4 * width * height, framebuffer, width, height);
-
-    if (premultiplyAlpha) {
-        for (size_t i = 0; i < bufferSize; i += 4) {
-            pixels[i + 0] = std::min(255, pixels[i + 0] * pixels[i + 3] / 255);
-            pixels[i + 1] = std::min(255, pixels[i + 1] * pixels[i + 3] / 255);
-            pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255);
-        }
-    }
+    m_impl->bindFramebuffer(FRAMEBUFFER, framebuffer);
+    readBackFramebuffer(pixels, width, height, ReadbackSkia, premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing);
+    flipVertically(pixels, width, height);
 
     readbackBitmap->notifyPixelsChanged();
     if (m_resizingBitmap.readyToDraw()) {
@@ -1009,4 +1037,19 @@
     return m_enabledExtensions.contains(mappedName);
 }
 
+void GraphicsContext3D::flipVertically(uint8_t* framebuffer, int width, int height)
+{
+    m_scanline.resize(width * 4);
+    uint8* scanline = &m_scanline[0];
+    unsigned rowBytes = width * 4;
+    unsigned count = height / 2;
+    for (unsigned i = 0; i < count; i++) {
+        uint8* rowA = framebuffer + i * rowBytes;
+        uint8* rowB = framebuffer + (height - i - 1) * rowBytes;
+        memcpy(scanline, rowB, rowBytes);
+        memcpy(rowB, rowA, rowBytes);
+        memcpy(rowA, scanline, rowBytes);
+    }
+}
+
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/GraphicsContext3D.h b/Source/core/platform/graphics/GraphicsContext3D.h
index d0f7deb..755aa28 100644
--- a/Source/core/platform/graphics/GraphicsContext3D.h
+++ b/Source/core/platform/graphics/GraphicsContext3D.h
@@ -789,6 +789,16 @@
 
     // End GraphicsContext3DImagePacking.cpp functions
 
+    // This is the order of bytes to use when doing a readback.
+    enum ReadbackOrder {
+        ReadbackRGBA,
+        ReadbackSkia
+    };
+
+    // Helper function which does a readback from the currently-bound
+    // framebuffer into a buffer of a certain size with 4-byte pixels.
+    void readBackFramebuffer(unsigned char* pixels, int width, int height, ReadbackOrder, AlphaOp);
+
 private:
     friend class Extensions3D;
 
@@ -804,6 +814,8 @@
     static bool packPixels(const uint8_t* sourceData, DataFormat sourceDataFormat, unsigned width, unsigned height, unsigned sourceUnpackAlignment, unsigned destinationFormat, unsigned destinationType, AlphaOp, void* destinationData, bool flipY);
 
     void paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer*);
+    // Helper function to flip a bitmap vertically.
+    void flipVertically(uint8_t* data, int width, int height);
 
     // Extensions3D support.
     bool supportsExtension(const String& name);
@@ -816,16 +828,17 @@
 
     OwnPtr<WebKit::WebGraphicsContext3DProvider> m_provider;
     WebKit::WebGraphicsContext3D* m_impl;
-    OwnPtr<WebKit::WebGraphicsContext3D> m_ownedWebContext;
-    OwnPtr<Extensions3D> m_extensions;
     OwnPtr<GraphicsContext3DContextLostCallbackAdapter> m_contextLostCallbackAdapter;
     OwnPtr<GraphicsContext3DErrorMessageCallbackAdapter> m_errorMessageCallbackAdapter;
+    OwnPtr<WebKit::WebGraphicsContext3D> m_ownedWebContext;
+    OwnPtr<Extensions3D> m_extensions;
     OwnPtr<GrMemoryAllocationChangedCallbackAdapter> m_grContextMemoryAllocationCallbackAdapter;
     bool m_initializedAvailableExtensions;
     HashSet<String> m_enabledExtensions;
     HashSet<String> m_requestableExtensions;
     bool m_layerComposited;
     bool m_preserveDrawingBuffer;
+    int m_packAlignment;
 
     enum ResourceSafety {
         ResourceSafetyUnknown,
@@ -843,6 +856,9 @@
 
     GrContext* m_grContext;
     SkAutoTUnref<GrContext> m_ownedGrContext;
+
+    // Used to flip a bitmap vertically.
+    Vector<uint8_t> m_scanline;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/GraphicsContextState.h b/Source/core/platform/graphics/GraphicsContextState.h
index 37b5e70..5c39e0f 100644
--- a/Source/core/platform/graphics/GraphicsContextState.h
+++ b/Source/core/platform/graphics/GraphicsContextState.h
@@ -34,31 +34,23 @@
 #include "core/platform/graphics/Path.h"
 #include "core/platform/graphics/Pattern.h"
 #include "core/platform/graphics/StrokeData.h"
-
 #include "third_party/skia/include/core/SkColorPriv.h"
 #include "third_party/skia/include/core/SkDrawLooper.h"
 #include "third_party/skia/include/effects/SkDashPathEffect.h"
-
 #include "wtf/PassOwnPtr.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
 // Encapsulates the state information we store for each pushed graphics state.
 // Only GraphicsContext can use this class.
 class GraphicsContextState {
-public:
-    ~GraphicsContextState()
-    {
-        SkSafeUnref(m_looper);
-    }
-
 private:
     friend class GraphicsContext;
 
     GraphicsContextState()
         : m_fillColor(Color::black)
         , m_fillRule(RULE_NONZERO)
-        , m_looper(0)
         , m_textDrawingMode(TextModeFill)
         , m_alpha(1)
         , m_xferMode(SkXfermode::kSrcOver_Mode)
@@ -87,18 +79,11 @@
         , m_xferMode(other.m_xferMode)
         , m_compositeOperator(other.m_compositeOperator)
         , m_blendMode(other.m_blendMode)
-        , m_imageBufferClip(other.m_imageBufferClip)
         , m_clip(other.m_clip)
         , m_interpolationQuality(other.m_interpolationQuality)
         , m_shouldAntialias(other.m_shouldAntialias)
         , m_shouldSmoothFonts(other.m_shouldSmoothFonts)
     {
-        // Up the ref count of these. SkSafeRef does nothing if its argument is 0.
-        SkSafeRef(m_looper);
-
-        // The clip image only needs to be applied once. Reset the image so that we
-        // don't attempt to clip multiple times.
-        m_imageBufferClip.reset();
     }
 
     // Helper function for applying the state's alpha value to the given input
@@ -131,7 +116,7 @@
     RefPtr<Pattern> m_fillPattern;
 
     // Shadow. (This will need tweaking if we use draw loopers for other things.)
-    SkDrawLooper* m_looper;
+    RefPtr<SkDrawLooper> m_looper;
 
     // Text. (See TextModeFill & friends.)
     TextDrawingModeFlags m_textDrawingMode;
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index f7ecd98..b5d0472 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -118,7 +118,6 @@
     , m_masksToBounds(false)
     , m_drawsContent(false)
     , m_contentsVisible(true)
-    , m_showDebugBorder(false)
     , m_showRepaintCounter(false)
     , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
     , m_contentsOrientation(CompositingCoordinatesTopDown)
@@ -141,7 +140,6 @@
     m_opaqueRectTrackingContentLayerDelegate = adoptPtr(new OpaqueRectTrackingContentLayerDelegate(this));
     m_layer = adoptPtr(Platform::current()->compositorSupport()->createContentLayer(m_opaqueRectTrackingContentLayerDelegate.get()));
     m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
-    m_layer->layer()->setScrollClient(this);
     m_layer->setAutomaticallyComputeRasterScale(true);
 }
 
@@ -383,35 +381,6 @@
     return id.toString();
 }
 
-void GraphicsLayer::getDebugBorderInfo(Color& color, float& width) const
-{
-    if (drawsContent()) {
-        color = Color(0, 128, 32, 128); // normal layer: green
-        width = 2;
-        return;
-    }
-    
-    if (masksToBounds()) {
-        color = Color(128, 255, 255, 48); // masking layer: pale blue
-        width = 20;
-        return;
-    }
-        
-    color = Color(255, 255, 0, 192); // container: yellow
-    width = 2;
-}
-
-void GraphicsLayer::updateDebugIndicators()
-{
-    if (!isShowingDebugBorder())
-        return;
-
-    Color borderColor;
-    float width = 0;
-    getDebugBorderInfo(borderColor, width);
-    setDebugBorder(borderColor, width);
-}
-
 void GraphicsLayer::setZPosition(float position)
 {
     m_zPosition = position;
@@ -953,12 +922,6 @@
     updateNames();
 }
 
-int GraphicsLayer::debugID() const
-{
-    // FIXME: change this to assert m_layer always exists, and remove enum.
-    return m_layer ? m_layer->layer()->id() : DebugIDNoCompositedLayer;
-}
-
 void GraphicsLayer::setCompositingReasons(WebKit::WebCompositingReasons reasons)
 {
     m_layer->layer()->setCompositingReasons(reasons);
@@ -1336,6 +1299,21 @@
     updateChildList();
 }
 
+void GraphicsLayer::setScrollableArea(ScrollableArea* scrollableArea, bool isMainFrame)
+{
+    if (m_scrollableArea == scrollableArea)
+        return;
+
+    m_scrollableArea = scrollableArea;
+
+    // Main frame scrolling may involve pinch zoom and gets routed through
+    // WebViewImpl explicitly rather than via GraphicsLayer::didScroll.
+    if (isMainFrame)
+        m_layer->layer()->setScrollClient(0);
+    else
+        m_layer->layer()->setScrollClient(this);
+}
+
 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip)
 {
     paintGraphicsLayerContents(context, clip);
diff --git a/Source/core/platform/graphics/GraphicsLayer.h b/Source/core/platform/graphics/GraphicsLayer.h
index 72206c3..ab10b80 100644
--- a/Source/core/platform/graphics/GraphicsLayer.h
+++ b/Source/core/platform/graphics/GraphicsLayer.h
@@ -49,11 +49,6 @@
 #include "public/platform/WebLayerScrollClient.h"
 #include "public/platform/WebSolidColorLayer.h"
 
-enum DebugIDSpecialValues {
-    DebugIDNoPlatformLayer = -1,
-    DebugIDNoCompositedLayer = -2
-};
-
 namespace WebKit {
 class GraphicsLayerFactoryChromium;
 class WebLayer;
@@ -223,9 +218,6 @@
     const String& name() const { return m_name; }
     void setName(const String&);
 
-    // Layer ID from platform-specific layer. Only used to identify layers in the compositor for debugging purposes.
-    int debugID() const;
-
     void setCompositingReasons(WebKit::WebCompositingReasons);
 
     GraphicsLayer* parent() const { return m_parent; };
@@ -382,9 +374,6 @@
 
     void dumpLayer(TextStream&, int indent = 0, LayerTreeFlags = LayerTreeNormal) const;
 
-    void setShowDebugBorder(bool show) { m_showDebugBorder = show; }
-    bool isShowingDebugBorder() const { return m_showDebugBorder; }
-
     void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; }
     bool isShowingRepaintCounter() const { return m_showRepaintCounter; }
 
@@ -392,9 +381,6 @@
     int repaintCount() const { return m_repaintCount; }
     int incrementRepaintCount() { return ++m_repaintCount; }
 
-    void setDebugBackgroundColor(const Color&) { }
-    void setDebugBorder(const Color&, float /*borderWidth*/) { }
-
     // z-position is the z-equivalent of position(). It's only used for debugging purposes.
     float zPosition() const { return m_zPosition; }
     void setZPosition(float);
@@ -425,7 +411,7 @@
     // Exposed for tests
     LinkHighlightClient* linkHighlight() { return m_linkHighlight; }
 
-    void setScrollableArea(ScrollableArea* scrollableArea) { m_scrollableArea = scrollableArea; }
+    void setScrollableArea(ScrollableArea*, bool isMainFrame);
     ScrollableArea* scrollableArea() const { return m_scrollableArea; }
 
     WebKit::WebContentLayer* contentLayer() const { return m_layer.get(); }
@@ -433,8 +419,6 @@
     // Exposed for tests. FIXME - name is too similar to contentLayer(), very error prone.
     WebKit::WebLayer* contentsLayer() const { return m_contentsLayer; }
 
-    void updateDebugIndicators();
-
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
     static void registerContentsLayer(WebKit::WebLayer*);
@@ -483,8 +467,6 @@
     void dumpProperties(TextStream&, int indent, LayerTreeFlags) const;
     void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) const { }
 
-    void getDebugBorderInfo(Color&, float& width) const;
-
     // Helper functions used by settors to keep layer's the state consistent.
     void updateNames();
     void updateChildList();
@@ -523,7 +505,6 @@
     bool m_masksToBounds : 1;
     bool m_drawsContent : 1;
     bool m_contentsVisible : 1;
-    bool m_showDebugBorder : 1;
     bool m_showRepaintCounter : 1;
     
     GraphicsLayerPaintingPhase m_paintingPhase;
diff --git a/Source/core/platform/graphics/GraphicsLayerClient.h b/Source/core/platform/graphics/GraphicsLayerClient.h
index 662ec20..ec566ea 100644
--- a/Source/core/platform/graphics/GraphicsLayerClient.h
+++ b/Source/core/platform/graphics/GraphicsLayerClient.h
@@ -57,7 +57,8 @@
     LayerTreeNormal = 0,
     LayerTreeIncludesDebugInfo = 1 << 0, // Dump extra debugging info like layer addresses.
     LayerTreeIncludesRepaintRects = 1 << 1,
-    LayerTreeIncludesPaintingPhases = 1 << 2
+    LayerTreeIncludesPaintingPhases = 1 << 2,
+    LayerTreeIncludesRootLayer = 1 << 3
 };
 typedef unsigned LayerTreeFlags;
 
diff --git a/Source/core/platform/graphics/Image.cpp b/Source/core/platform/graphics/Image.cpp
index 878ba53..f1d3de4 100644
--- a/Source/core/platform/graphics/Image.cpp
+++ b/Source/core/platform/graphics/Image.cpp
@@ -34,6 +34,8 @@
 #include "core/platform/SharedBuffer.h"
 #include "core/platform/graphics/BitmapImage.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 "wtf/MainThread.h"
 #include "wtf/MemoryObjectInfo.h"
@@ -148,19 +150,39 @@
 
 // FIXME: Merge with the other drawTiled eventually, since we need a combination of both for some things.
 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect,
-    const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, CompositeOperator op)
+    const FloatSize& providedTileScaleFactor, TileRule hRule, TileRule vRule, CompositeOperator op)
 {
     if (mayFillWithSolidColor()) {
         fillWithSolidColor(ctxt, dstRect, solidColor(), op);
         return;
     }
 
-    // FIXME: We do not support 'round' or 'space' yet. For now just map them to 'repeat'.
-    if (hRule == RoundTile || hRule == SpaceTile)
+    // FIXME: We do not support 'space' yet. For now just map it to 'repeat'.
+    if (hRule == SpaceTile)
         hRule = RepeatTile;
-    if (vRule == RoundTile || vRule == SpaceTile)
+    if (vRule == SpaceTile)
         vRule = RepeatTile;
 
+    // FIXME: if this code is used for background-repeat: round (in addition to
+    // border-image-repeat), then add logic to deal with the background-size: auto
+    // special case. The aspect ratio should be maintained in this case.
+    FloatSize tileScaleFactor = providedTileScaleFactor;
+    bool useLowInterpolationQuality = false;
+    if (hRule == RoundTile) {
+        float hRepetitions = std::max(1.0f, roundf(dstRect.width() / (tileScaleFactor.width() * srcRect.width())));
+        tileScaleFactor.setWidth(dstRect.width() / (srcRect.width() * hRepetitions));
+    }
+    if (vRule == RoundTile) {
+        float vRepetitions = std::max(1.0f, roundf(dstRect.height() / (tileScaleFactor.height() * srcRect.height())));
+        tileScaleFactor.setHeight(dstRect.height() / (srcRect.height() * vRepetitions));
+    }
+    if (hRule == RoundTile || vRule == RoundTile) {
+        // High interpolation quality rounds the scaled tile to an integer size (see Image::drawPattern).
+        // To avoid causing a visual problem, linear interpolation must be used instead.
+        // FIXME: Allow using high-quality interpolation in this case, too.
+        useLowInterpolationQuality = true;
+    }
+
     // We want to construct the phase such that the pattern is centered (when stretch is not
     // set for a particular rule).
     float hPhase = tileScaleFactor.width() * srcRect.x();
@@ -173,7 +195,14 @@
         vPhase -= (dstRect.height() - scaledTileHeight) / 2;
     FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
 
-    drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect);
+    if (useLowInterpolationQuality) {
+        InterpolationQuality previousInterpolationQuality = ctxt->imageInterpolationQuality();
+        ctxt->setImageInterpolationQuality(InterpolationLow);
+        drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect);
+        ctxt->setImageInterpolationQuality(previousInterpolationQuality);
+    } else {
+        drawPattern(ctxt, srcRect, tileScaleFactor, patternPhase, op, dstRect);
+    }
 
     startAnimation();
 }
diff --git a/Source/core/platform/graphics/ImageBuffer.cpp b/Source/core/platform/graphics/ImageBuffer.cpp
index 0ceb1dc..d130b56 100644
--- a/Source/core/platform/graphics/ImageBuffer.cpp
+++ b/Source/core/platform/graphics/ImageBuffer.cpp
@@ -73,7 +73,6 @@
         return 0;
     gr->resetContext();
     Canvas2DLayerBridge::OpacityMode bridgeOpacityMode = opacityMode == Opaque ? Canvas2DLayerBridge::Opaque : Canvas2DLayerBridge::NonOpaque;
-    Canvas2DLayerBridge::ThreadMode threadMode = WebKit::Platform::current()->isThreadedCompositingEnabled() ? Canvas2DLayerBridge::Threaded : Canvas2DLayerBridge::SingleThread;
     SkImage::Info info;
     info.fWidth = size.width();
     info.fHeight = size.height();
@@ -83,7 +82,7 @@
     if (!surface.get())
         return 0;
     SkDeferredCanvas* canvas = new SkDeferredCanvas(surface.get());
-    *outLayerBridge = Canvas2DLayerBridge::create(context3D.release(), canvas, bridgeOpacityMode, threadMode);
+    *outLayerBridge = Canvas2DLayerBridge::create(context3D.release(), canvas, bridgeOpacityMode);
     // If canvas buffer allocation failed, debug build will have asserted
     // For release builds, we must verify whether the device has a render target
     return canvas;
@@ -140,9 +139,13 @@
     , m_logicalSize(size)
     , m_resolutionScale(resolutionScale)
 {
-    if (renderingMode == Accelerated)
+    if (renderingMode == Accelerated) {
         m_canvas = adoptPtr(createAcceleratedCanvas(size, &m_layerBridge, opacityMode));
-    else if (renderingMode == UnacceleratedNonPlatformBuffer)
+        if (!m_canvas)
+            renderingMode = UnacceleratedNonPlatformBuffer;
+    }
+
+    if (renderingMode == UnacceleratedNonPlatformBuffer)
         m_canvas = adoptPtr(createNonPlatformCanvas(size));
 
     if (!m_canvas)
diff --git a/Source/core/platform/graphics/MediaPlayer.h b/Source/core/platform/graphics/MediaPlayer.h
index 0796e04..1e528b0 100644
--- a/Source/core/platform/graphics/MediaPlayer.h
+++ b/Source/core/platform/graphics/MediaPlayer.h
@@ -42,7 +42,7 @@
 class IntSize;
 class KURL;
 class MediaPlayer;
-class MediaSourceBase;
+class HTMLMediaSource;
 class TimeRanges;
 
 class MediaPlayerClient {
@@ -87,7 +87,7 @@
     
     virtual CORSMode mediaPlayerCORSMode() const = 0;
 
-    virtual void scheduleLayerUpdate() = 0;
+    virtual void mediaPlayerScheduleLayerUpdate() = 0;
 
     virtual void mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>) = 0;
     virtual void mediaPlayerDidRemoveTrack(PassRefPtr<InbandTextTrackPrivate>) = 0;
@@ -107,7 +107,7 @@
     virtual ~MediaPlayer() { }
 
     virtual void load(const String& url) = 0;
-    virtual void load(const String& url, PassRefPtr<MediaSourceBase>) = 0;
+    virtual void load(const String& url, PassRefPtr<HTMLMediaSource>) = 0;
 
     virtual void prepareToPlay() = 0;
     virtual WebKit::WebLayer* platformLayer() const = 0;
diff --git a/Source/core/platform/graphics/MediaSourcePrivate.h b/Source/core/platform/graphics/MediaSourcePrivate.h
index 78eeb14..48bf31d 100644
--- a/Source/core/platform/graphics/MediaSourcePrivate.h
+++ b/Source/core/platform/graphics/MediaSourcePrivate.h
@@ -48,7 +48,8 @@
     virtual double duration() = 0;
     virtual void setDuration(double) = 0;
     enum EndOfStreamStatus { EosNoError, EosNetworkError, EosDecodeError };
-    virtual void endOfStream(EndOfStreamStatus) = 0;
+    virtual void markEndOfStream(EndOfStreamStatus) = 0;
+    virtual void unmarkEndOfStream() = 0;
 };
 
 }
diff --git a/Source/core/platform/graphics/Path.cpp b/Source/core/platform/graphics/Path.cpp
index f701265..110338d 100644
--- a/Source/core/platform/graphics/Path.cpp
+++ b/Source/core/platform/graphics/Path.cpp
@@ -37,6 +37,7 @@
 #include "core/platform/graphics/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"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -233,6 +234,20 @@
     return FloatPoint(quietNaN, quietNaN);
 }
 
+WindRule Path::windRule() const
+{
+    return m_path.getFillType() == SkPath::kEvenOdd_FillType
+        ? RULE_EVENODD
+        : RULE_NONZERO;
+}
+
+void Path::setWindRule(const WindRule rule)
+{
+    m_path.setFillType(rule == RULE_EVENODD
+        ? SkPath::kEvenOdd_FillType
+        : SkPath::kWinding_FillType);
+}
+
 void Path::moveTo(const FloatPoint& point)
 {
     m_path.moveTo(point);
@@ -362,11 +377,6 @@
 
 void Path::addPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, RoundedRectStrategy strategy)
 {
-    if (strategy == PreferBezierRoundedRect) {
-        addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
-        return;
-    }
-
     addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
 }
 
@@ -407,4 +417,9 @@
     m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(size.height()));
 }
 
+bool Path::unionPath(const Path& other)
+{
+    return Op(m_path, other.m_path, kUnion_PathOp, &m_path);
+}
+
 }
diff --git a/Source/core/platform/graphics/Path.h b/Source/core/platform/graphics/Path.h
index 6288b0c..de26284 100644
--- a/Source/core/platform/graphics/Path.h
+++ b/Source/core/platform/graphics/Path.h
@@ -91,6 +91,9 @@
     bool hasCurrentPoint() const;
     FloatPoint currentPoint() const;
 
+    WindRule windRule() const;
+    void setWindRule(const WindRule);
+
     void moveTo(const FloatPoint&);
     void addLineTo(const FloatPoint&);
     void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& endPoint);
@@ -121,6 +124,9 @@
     void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect);
     void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
 
+    // Updates the path to the union (inclusive-or) of itself with the given argument.
+    bool unionPath(const Path& other);
+
 private:
     SkPath m_path;
 };
diff --git a/Source/core/platform/graphics/Pattern.cpp b/Source/core/platform/graphics/Pattern.cpp
index 1256718..7e12c81 100644
--- a/Source/core/platform/graphics/Pattern.cpp
+++ b/Source/core/platform/graphics/Pattern.cpp
@@ -40,7 +40,6 @@
     : m_tileImage(image)
     , m_repeatX(repeatX)
     , m_repeatY(repeatY)
-    , m_pattern(0)
     , m_externalMemoryAllocated(0)
 {
     ASSERT(m_tileImage);
@@ -48,25 +47,21 @@
 
 Pattern::~Pattern()
 {
-    SkSafeUnref(m_pattern);
-    m_pattern = 0;
-    if (m_externalMemoryAllocated) {
+    if (m_externalMemoryAllocated)
         v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externalMemoryAllocated);
-        m_externalMemoryAllocated = 0;
-    }
 }
 
 SkShader* Pattern::shader()
 {
     if (m_pattern)
-        return m_pattern;
+        return m_pattern.get();
 
     RefPtr<NativeImageSkia> image = m_tileImage->nativeImageForCurrentFrame();
     // If we don't have a bitmap, return a transparent shader.
     if (!image)
-        m_pattern = new SkColorShader(SkColorSetARGB(0, 0, 0, 0));
+        m_pattern = adoptRef(new SkColorShader(SK_ColorTRANSPARENT));
     else if (m_repeatX && m_repeatY)
-        m_pattern = SkShader::CreateBitmapShader(image->bitmap(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);
+        m_pattern = adoptRef(SkShader::CreateBitmapShader(image->bitmap(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
     else {
         // Skia does not have a "draw the tile only once" option. Clamp_TileMode
         // repeats the last line of the image after drawing one tile. To avoid
@@ -88,14 +83,14 @@
         SkCanvas canvas(bm2);
         canvas.drawBitmap(image->bitmap(), 0, 0);
         bm2.setImmutable();
-        m_pattern = SkShader::CreateBitmapShader(bm2, tileModeX, tileModeY);
+        m_pattern = adoptRef(SkShader::CreateBitmapShader(bm2, tileModeX, tileModeY));
 
         // Clamp to int, since that's what the adjust function takes.
         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);
-    return m_pattern;
+    return m_pattern.get();
 }
 
 void Pattern::setPatternSpaceTransform(const AffineTransform& patternSpaceTransformation)
diff --git a/Source/core/platform/graphics/Pattern.h b/Source/core/platform/graphics/Pattern.h
index ef36152..12cec68 100644
--- a/Source/core/platform/graphics/Pattern.h
+++ b/Source/core/platform/graphics/Pattern.h
@@ -47,7 +47,7 @@
     {
         return adoptRef(new Pattern(tileImage, repeatX, repeatY));
     }
-    virtual ~Pattern();
+    ~Pattern();
 
     Image* tileImage() const { return m_tileImage.get(); }
 
@@ -66,7 +66,7 @@
     bool m_repeatX;
     bool m_repeatY;
     AffineTransform m_patternSpaceTransformation;
-    SkShader* m_pattern;
+    RefPtr<SkShader> m_pattern;
     int m_externalMemoryAllocated;
 };
 
diff --git a/Source/core/platform/graphics/StringTruncator.cpp b/Source/core/platform/graphics/StringTruncator.cpp
index ef80369..e34bcab 100644
--- a/Source/core/platform/graphics/StringTruncator.cpp
+++ b/Source/core/platform/graphics/StringTruncator.cpp
@@ -42,18 +42,18 @@
 
 typedef unsigned TruncationFunction(const String&, unsigned length, unsigned keepCount, UChar* buffer);
 
-static inline int textBreakAtOrPreceding(TextBreakIterator* it, int offset)
+static inline int textBreakAtOrPreceding(const NonSharedCharacterBreakIterator& it, int offset)
 {
-    if (isTextBreak(it, offset))
+    if (it.isBreak(offset))
         return offset;
 
-    int result = textBreakPreceding(it, offset);
+    int result = it.preceding(offset);
     return result == TextBreakDone ? 0 : result;
 }
 
-static inline int boundedTextBreakFollowing(TextBreakIterator* it, int offset, int length)
+static inline int boundedTextBreakFollowing(const NonSharedCharacterBreakIterator& it, int offset, int length)
 {
-    int result = textBreakFollowing(it, offset);
+    int result = it.following(offset);
     return result == TextBreakDone ? length : result;
 }
 
@@ -63,16 +63,16 @@
     ASSERT(keepCount < STRING_BUFFER_SIZE);
     
     unsigned omitStart = (keepCount + 1) / 2;
-    NonSharedCharacterBreakIterator it(string.bloatedCharacters(), length);
+    NonSharedCharacterBreakIterator it(string);
     unsigned omitEnd = boundedTextBreakFollowing(it, omitStart + (length - keepCount) - 1, length);
     omitStart = textBreakAtOrPreceding(it, omitStart);
     
     unsigned truncatedLength = omitStart + 1 + (length - omitEnd);
     ASSERT(truncatedLength <= length);
 
-    memcpy(buffer, string.bloatedCharacters(), sizeof(UChar) * omitStart);
+    string.copyTo(buffer, 0, omitStart);
     buffer[omitStart] = horizontalEllipsis;
-    memcpy(&buffer[omitStart + 1], &string.bloatedCharacters()[omitEnd], sizeof(UChar) * (length - omitEnd));
+    string.copyTo(&buffer[omitStart + 1], omitEnd, length - omitEnd);
     
     return truncatedLength;
 }
@@ -82,16 +82,24 @@
     ASSERT(keepCount < length);
     ASSERT(keepCount < STRING_BUFFER_SIZE);
     
-    NonSharedCharacterBreakIterator it(string.bloatedCharacters(), length);
+    NonSharedCharacterBreakIterator it(string);
     unsigned keepLength = textBreakAtOrPreceding(it, keepCount);
     unsigned truncatedLength = keepLength + 1;
-    
-    memcpy(buffer, string.bloatedCharacters(), sizeof(UChar) * keepLength);
+
+    string.copyTo(buffer, 0, keepLength);
     buffer[keepLength] = horizontalEllipsis;
     
     return truncatedLength;
 }
 
+static float stringWidth(const Font& renderer, const String& string, bool disableRoundingHacks)
+{
+    TextRun run(string);
+    if (disableRoundingHacks)
+        run.disableRoundingHacks();
+    return renderer.width(run);
+}
+
 static float stringWidth(const Font& renderer, const UChar* characters, unsigned length, bool disableRoundingHacks)
 {
     TextRun run(characters, length);
@@ -119,7 +127,7 @@
         truncatedLength = centerTruncateToBuffer(string, length, keepCount, stringBuffer);
     } else {
         keepCount = length;
-        memcpy(stringBuffer, string.bloatedCharacters(), sizeof(UChar) * length);
+        string.copyTo(stringBuffer, 0, length);
         truncatedLength = length;
     }
 
@@ -137,7 +145,7 @@
         keepCountForLargestKnownToFit = 1;
         keepCountForSmallestKnownToNotFit = 2;
     }
-    
+
     while (keepCountForLargestKnownToFit + 1 < keepCountForSmallestKnownToNotFit) {
         ASSERT(widthForLargestKnownToFit <= maxWidth);
         ASSERT(widthForSmallestKnownToNotFit > maxWidth);
@@ -193,7 +201,7 @@
 
 float StringTruncator::width(const String& string, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks)
 {
-    return stringWidth(font, string.bloatedCharacters(), string.length(), !enableRoundingHacks);
+    return stringWidth(font, string, !enableRoundingHacks);
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/TextRun.cpp b/Source/core/platform/graphics/TextRun.cpp
index 224abba..03b032b 100644
--- a/Source/core/platform/graphics/TextRun.cpp
+++ b/Source/core/platform/graphics/TextRun.cpp
@@ -48,6 +48,21 @@
     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
index ab28956..7205423 100644
--- a/Source/core/platform/graphics/TextRun.h
+++ b/Source/core/platform/graphics/TextRun.h
@@ -59,7 +59,6 @@
 
     typedef unsigned RoundingHacks;
 
-#if ENABLE(8BIT_TEXTRUN)
     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)
@@ -79,7 +78,6 @@
     {
         m_data.characters8 = c;
     }
-#endif
 
     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)
@@ -101,9 +99,9 @@
         m_data.characters16 = c;
     }
     
-    TextRun(const String& s, 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(s.length())
-        , m_len(s.length())
+    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)
@@ -117,18 +115,16 @@
         , m_disableSpacing(false)
         , m_tabSize(0)
     {
-#if ENABLE(8BIT_TEXTRUN)
-        if (m_charactersLength && s.is8Bit()) {
-            m_data.characters8 = s.characters8();
+        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 = s.bloatedCharacters();
+            m_data.characters16 = string.characters16();
             m_is8Bit = false;
         }
-#else
-        m_data.characters16 = s.bloatedCharacters();
-        m_is8Bit = false;
-#endif
     }
 
     TextRun subRun(unsigned startOffset, unsigned length) const
@@ -137,14 +133,10 @@
 
         TextRun result = *this;
 
-#if ENABLE(8BIT_TEXTRUN)
         if (is8Bit()) {
             result.setText(data8(startOffset), length);
             return result;
         }
-#else
-        ASSERT(!is8Bit());
-#endif
         result.setText(data16(startOffset), length);
         return result;
     }
@@ -160,10 +152,9 @@
     int length() const { return m_len; }
     int charactersLength() const { return m_charactersLength; }
 
-#if ENABLE(8BIT_TEXTRUN)
     void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;}
-#endif
     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; }
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
index 8dc281f..a720654 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
@@ -40,38 +40,28 @@
 
 using WebKit::WebExternalTextureLayer;
 using WebKit::WebGraphicsContext3D;
-using WebKit::WebTextureUpdater;
 
 namespace WebCore {
 
-Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas, OpacityMode opacityMode, ThreadMode threadMode)
+Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas, OpacityMode opacityMode)
     : m_canvas(canvas)
     , m_context(context)
     , m_bytesAllocated(0)
     , m_didRecordDrawCommand(false)
     , m_framesPending(0)
+    , m_rateLimitingEnabled(false)
     , m_next(0)
     , m_prev(0)
-#if ENABLE(CANVAS_USES_MAILBOX)
     , m_lastImageId(0)
-#endif
 {
     ASSERT(m_canvas);
     // Used by browser tests to detect the use of a Canvas2DLayerBridge.
     TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation");
     m_canvas->setNotificationClient(this);
-#if ENABLE(CANVAS_USES_MAILBOX)
-    m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createExternalTextureLayerForMailbox(this));
-#else
     m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createExternalTextureLayer(this));
-    m_layer->setRateLimitContext(threadMode == SingleThread);
-    GrRenderTarget* renderTarget = reinterpret_cast<GrRenderTarget*>(m_canvas->getDevice()->accessRenderTarget());
-    if (renderTarget) {
-        m_layer->setTextureId(renderTarget->asTexture()->getTextureHandle());
-    }
-#endif
     m_layer->setOpaque(opacityMode == Opaque);
     GraphicsLayer::registerContentsLayer(m_layer->layer());
+    m_layer->setRateLimitContext(m_rateLimitingEnabled);
 }
 
 Canvas2DLayerBridge::~Canvas2DLayerBridge()
@@ -81,9 +71,7 @@
     m_canvas->setNotificationClient(0);
     m_layer->clearTexture();
     m_layer.clear();
-#if ENABLE(CANVAS_USES_MAILBOX)
     m_mailboxes.clear();
-#endif
 }
 
 void Canvas2DLayerBridge::limitPendingFrames()
@@ -91,16 +79,19 @@
     if (m_didRecordDrawCommand) {
         m_framesPending++;
         m_didRecordDrawCommand = false;
-        if (m_framesPending > 1)
+        if (m_framesPending > 1) {
+            // Turn on the rate limiter if this layer tends to accumulate a
+            // non-discardable multi-frame backlog of draw commands.
+            setRateLimitingEnabled(true);
+        }
+        if (m_rateLimitingEnabled) {
             flush();
+        }
     }
 }
 
 void Canvas2DLayerBridge::prepareForDraw()
 {
-#if !ENABLE(CANVAS_USES_MAILBOX)
-    m_layer->willModifyTexture();
-#endif
     m_context->makeContextCurrent();
 }
 
@@ -124,9 +115,20 @@
 
 void Canvas2DLayerBridge::skippedPendingDrawCommands()
 {
+    // Stop triggering the rate limiter if SkDeferredCanvas is detecting
+    // and optimizing overdraw.
+    setRateLimitingEnabled(false);
     flushedDrawCommands();
 }
 
+void Canvas2DLayerBridge::setRateLimitingEnabled(bool enabled)
+{
+    if (m_rateLimitingEnabled != enabled) {
+        m_rateLimitingEnabled = enabled;
+        m_layer->setRateLimitContext(m_rateLimitingEnabled);
+    }
+}
+
 size_t Canvas2DLayerBridge::freeMemoryIfPossible(size_t bytesToFree)
 {
     size_t bytesFreed = m_canvas->freeMemoryIfPossible(bytesToFree);
@@ -138,31 +140,10 @@
 
 void Canvas2DLayerBridge::flush()
 {
-    if (m_canvas->hasPendingCommands())
+    if (m_canvas->hasPendingCommands()) {
+        TRACE_EVENT0("cc", "Canvas2DLayerBridge::flush");
         m_canvas->flush();
-}
-
-unsigned Canvas2DLayerBridge::prepareTexture(WebTextureUpdater& updater)
-{
-#if ENABLE(CANVAS_USES_MAILBOX)
-    ASSERT_NOT_REACHED();
-    return 0;
-#else
-    m_context->makeContextCurrent();
-
-    TRACE_EVENT0("cc", "Canvas2DLayerBridge::SkCanvas::flush");
-    m_canvas->flush();
-    m_context->flush();
-
-    // Notify skia that the state of the backing store texture object will be touched by the compositor
-    GrRenderTarget* renderTarget = reinterpret_cast<GrRenderTarget*>(m_canvas->getDevice()->accessRenderTarget());
-    if (renderTarget) {
-        GrTexture* texture = renderTarget->asTexture();
-        texture->invalidateCachedState();
-        return texture->getTextureHandle();
     }
-    return 0;
-#endif  // !ENABLE(CANVAS_USES_MAILBOX)
 }
 
 WebGraphicsContext3D* Canvas2DLayerBridge::context()
@@ -170,13 +151,14 @@
     return m_context->webContext();
 }
 
-bool Canvas2DLayerBridge::prepareMailbox(WebKit::WebExternalTextureMailbox* outMailbox)
+bool Canvas2DLayerBridge::prepareMailbox(WebKit::WebExternalTextureMailbox* outMailbox, WebKit::WebExternalBitmap* bitmap)
 {
-#if ENABLE(CANVAS_USES_MAILBOX)
+    ASSERT(!bitmap);
     // Release to skia textures that were previouosly released by the
     // compositor. We do this before acquiring the next snapshot in
     // order to cap maximum gpu memory consumption.
     m_context->makeContextCurrent();
+    flush();
     Vector<MailboxInfo>::iterator mailboxInfo;
     for (mailboxInfo = m_mailboxes.begin(); mailboxInfo < m_mailboxes.end(); mailboxInfo++) {
         if (mailboxInfo->m_status == MailboxReleased) {
@@ -219,19 +201,12 @@
     m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
     // Because we are changing the texture binding without going through skia,
     // we must dirty the context.
-    // TODO(piman): expose finer granularity reset. We only really want to
-    // 'dirty' the current texture binding.
-    m_context->grContext()->resetContext();
+    m_context->grContext()->resetContext(kTextureBinding_GrGLBackendState);
 
     *outMailbox = mailboxInfo->m_mailbox;
     return true;
-#else
-    ASSERT_NOT_REACHED();
-    return false;
-#endif
 }
 
-#if ENABLE(CANVAS_USES_MAILBOX)
 Canvas2DLayerBridge::MailboxInfo* Canvas2DLayerBridge::createMailboxInfo() {
     MailboxInfo* mailboxInfo;
     for (mailboxInfo = m_mailboxes.begin(); mailboxInfo < m_mailboxes.end(); mailboxInfo++) {
@@ -254,11 +229,9 @@
     ASSERT(mailboxInfo < m_mailboxes.end());
     return mailboxInfo;
 }
-#endif
 
 void Canvas2DLayerBridge::mailboxReleased(const WebKit::WebExternalTextureMailbox& mailbox)
 {
-#if ENABLE(CANVAS_USES_MAILBOX)
     Vector<MailboxInfo>::iterator mailboxInfo;
     for (mailboxInfo = m_mailboxes.begin(); mailboxInfo < m_mailboxes.end(); mailboxInfo++) {
          if (!memcmp(mailboxInfo->m_mailbox.name, mailbox.name, sizeof(mailbox.name))) {
@@ -268,7 +241,6 @@
              return;
          }
      }
-#endif
      ASSERT_NOT_REACHED();
 }
 
@@ -295,7 +267,6 @@
     return 0;
 }
 
-#if ENABLE(CANVAS_USES_MAILBOX)
 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) {
     // This copy constructor should only be used for Vector reallocation
     // Assuming 'other' is to be destroyed, we swap m_image ownership
@@ -304,6 +275,5 @@
     m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image));
     m_status = other.m_status;
 }
-#endif
 
 }
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
index 68388ea..9b12a14 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
@@ -51,22 +51,16 @@
         NonOpaque
     };
 
-    enum ThreadMode {
-        SingleThread,
-        Threaded
-    };
-
-    static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas, OpacityMode opacityMode, ThreadMode threading)
+    static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas, OpacityMode opacityMode)
     {
-        return adoptPtr(new Canvas2DLayerBridge(context, canvas, opacityMode, threading));
+        return adoptPtr(new Canvas2DLayerBridge(context, canvas, opacityMode));
     }
 
     virtual ~Canvas2DLayerBridge();
 
     // WebKit::WebExternalTextureLayerClient implementation.
-    virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE;
     virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
-    virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE;
+    virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*, WebKit::WebExternalBitmap*) OVERRIDE;
     virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERRIDE;
 
     // SkDeferredCanvas::NotificationClient implementation
@@ -88,7 +82,8 @@
     unsigned backBufferTexture();
 
 protected:
-    Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, OpacityMode, ThreadMode);
+    Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, OpacityMode);
+    void setRateLimitingEnabled(bool);
 
     SkDeferredCanvas* m_canvas;
     OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
@@ -96,12 +91,12 @@
     size_t m_bytesAllocated;
     bool m_didRecordDrawCommand;
     int m_framesPending;
+    bool m_rateLimitingEnabled;
 
     friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>;
     Canvas2DLayerBridge* m_next;
     Canvas2DLayerBridge* m_prev;
 
-#if ENABLE(CANVAS_USES_MAILBOX)
     enum MailboxStatus {
         MailboxInUse,
         MailboxReleased,
@@ -120,7 +115,6 @@
 
     uint32_t m_lastImageId;
     Vector<MailboxInfo> m_mailboxes;
-#endif
 };
 
 }
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp
new file mode 100644
index 0000000..81e2d6d
--- /dev/null
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "core/platform/graphics/chromium/Canvas2DLayerBridge.h"
+
+#include "SkDeferredCanvas.h"
+#include "core/platform/graphics/ImageBuffer.h"
+#include "core/tests/FakeWebGraphicsContext3D.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebThread.h"
+#include "third_party/skia/include/core/SkDevice.h"
+#include "wtf/RefPtr.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+using namespace WebKit;
+using testing::InSequence;
+using testing::Return;
+using testing::Test;
+
+namespace {
+
+class MockCanvasContext : public FakeWebGraphicsContext3D {
+public:
+    MOCK_METHOD0(flush, void(void));
+    MOCK_METHOD0(createTexture, unsigned(void));
+    MOCK_METHOD1(deleteTexture, void(unsigned));
+
+    virtual GrGLInterface* onCreateGrGLInterface() OVERRIDE { return 0; }
+};
+
+} // namespace
+
+class Canvas2DLayerBridgeTest : public Test {
+protected:
+    void fullLifecycleTest()
+    {
+        RefPtr<GraphicsContext3D> mainContext = GraphicsContext3D::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext));
+
+        MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(mainContext->webContext());
+
+        SkDevice device(SkBitmap::kARGB_8888_Config, 300, 150);
+        SkDeferredCanvas canvas(&device);
+
+        ::testing::Mock::VerifyAndClearExpectations(&mainMock);
+
+        OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainContext.release(), &canvas, Canvas2DLayerBridge::NonOpaque);
+
+        ::testing::Mock::VerifyAndClearExpectations(&mainMock);
+
+        EXPECT_CALL(mainMock, flush());
+        unsigned textureId = bridge->backBufferTexture();
+        EXPECT_EQ(textureId, 0u);
+
+        ::testing::Mock::VerifyAndClearExpectations(&mainMock);
+
+        bridge.clear();
+
+        ::testing::Mock::VerifyAndClearExpectations(&mainMock);
+    }
+};
+
+namespace {
+
+TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleSingleThreaded)
+{
+    fullLifecycleTest();
+}
+
+} // namespace
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp
new file mode 100644
index 0000000..83dfa09
--- /dev/null
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp
@@ -0,0 +1,257 @@
+/*
+ * 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/graphics/chromium/Canvas2DLayerManager.h"
+
+#include "SkDevice.h"
+#include "core/platform/graphics/GraphicsContext3D.h"
+#include "core/tests/FakeWebGraphicsContext3D.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebThread.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+using testing::InSequence;
+using testing::Return;
+using testing::Test;
+
+
+class FakeCanvas2DLayerBridge : public Canvas2DLayerBridge {
+public:
+    FakeCanvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas)
+        : Canvas2DLayerBridge(context, canvas, NonOpaque)
+        , m_freeableBytes(0)
+        , m_freeMemoryIfPossibleCount(0)
+        , m_flushCount(0)
+    {
+    }
+
+    virtual size_t storageAllocatedForRecording() OVERRIDE
+    {
+        // Because the fake layer has no canvas to query, just
+        // return status quo. Allocation changes that would normally be
+        // initiated by the canvas can be faked by invoking
+        // storageAllocatedForRecordingChanged directly from the test code.
+        return m_bytesAllocated;
+    }
+
+    void fakeFreeableBytes(size_t size)
+    {
+        m_freeableBytes = size;
+    }
+
+    virtual size_t freeMemoryIfPossible(size_t size) OVERRIDE
+    {
+        m_freeMemoryIfPossibleCount++;
+        size_t bytesFreed = size < m_freeableBytes ? size : m_freeableBytes;
+        m_freeableBytes -= bytesFreed;
+        if (bytesFreed)
+            Canvas2DLayerManager::get().layerAllocatedStorageChanged(this, -((intptr_t)bytesFreed));
+        m_bytesAllocated -= bytesFreed;
+        return bytesFreed;
+    }
+
+    virtual void flush() OVERRIDE
+    {
+        flushedDrawCommands();
+        m_flushCount++;
+    }
+
+public:
+    size_t m_freeableBytes;
+    int m_freeMemoryIfPossibleCount;
+    int m_flushCount;
+};
+
+static PassOwnPtr<SkDeferredCanvas> createCanvas(GraphicsContext3D* context)
+{
+    SkAutoTUnref<SkDevice> device(new SkDevice(SkBitmap::kARGB_8888_Config, 1, 1));
+    return adoptPtr(new SkDeferredCanvas(device.get()));
+}
+
+class Canvas2DLayerManagerTest : public Test {
+protected:
+    void storageAllocationTrackingTest()
+    {
+        Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
+        manager.init(10, 10);
+        {
+            RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsContextFromWebContext(adoptPtr(new WebKit::FakeWebGraphicsContext3D));
+            OwnPtr<SkDeferredCanvas> canvas1 = createCanvas(context.get());
+            FakeCanvas2DLayerBridge layer1(context, canvas1.get());
+            EXPECT_EQ((size_t)0, manager.m_bytesAllocated);
+            layer1.storageAllocatedForRecordingChanged(1);
+            EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
+            // Test allocation increase
+            layer1.storageAllocatedForRecordingChanged(2);
+            EXPECT_EQ((size_t)2, manager.m_bytesAllocated);
+            // Test allocation decrease
+            layer1.storageAllocatedForRecordingChanged(1);
+            EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
+            {
+                OwnPtr<SkDeferredCanvas> canvas2 = createCanvas(context.get());
+                FakeCanvas2DLayerBridge layer2(context, canvas2.get());
+                EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
+                // verify multi-layer allocation tracking
+                layer2.storageAllocatedForRecordingChanged(2);
+                EXPECT_EQ((size_t)3, manager.m_bytesAllocated);
+            }
+            // Verify tracking after destruction
+            EXPECT_EQ((size_t)1, manager.m_bytesAllocated);
+        }
+    }
+
+    void evictionTest()
+    {
+        RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsContextFromWebContext(adoptPtr(new WebKit::FakeWebGraphicsContext3D));
+        Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
+        manager.init(10, 5);
+        OwnPtr<SkDeferredCanvas> canvas = createCanvas(context.get());
+        FakeCanvas2DLayerBridge layer(context, canvas.get());
+        layer.fakeFreeableBytes(10);
+        layer.storageAllocatedForRecordingChanged(8); // under the max
+        EXPECT_EQ(0, layer.m_freeMemoryIfPossibleCount);
+        layer.storageAllocatedForRecordingChanged(12); // over the max
+        EXPECT_EQ(1, layer.m_freeMemoryIfPossibleCount);
+        EXPECT_EQ((size_t)3, layer.m_freeableBytes);
+        EXPECT_EQ(0, layer.m_flushCount); // eviction succeeded without triggering a flush
+        EXPECT_EQ((size_t)5, layer.bytesAllocated());
+    }
+
+    void flushEvictionTest()
+    {
+        RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsContextFromWebContext(adoptPtr(new WebKit::FakeWebGraphicsContext3D));
+        Canvas2DLayerManager& manager = Canvas2DLayerManager::get();
+        manager.init(10, 5);
+        OwnPtr<SkDeferredCanvas> canvas = createCanvas(context.get());
+        FakeCanvas2DLayerBridge layer(context, canvas.get());
+        layer.fakeFreeableBytes(1); // Not enough freeable bytes, will cause aggressive eviction by flushing
+        layer.storageAllocatedForRecordingChanged(8); // under the max
+        EXPECT_EQ(0, layer.m_freeMemoryIfPossibleCount);
+        layer.storageAllocatedForRecordingChanged(12); // over the max
+        EXPECT_EQ(2, layer.m_freeMemoryIfPossibleCount); // Two tries, one before flush, one after flush
+        EXPECT_EQ((size_t)0, layer.m_freeableBytes);
+        EXPECT_EQ(1, layer.m_flushCount); // flush was attempted
+        EXPECT_EQ((size_t)11, layer.bytesAllocated()); // flush drops the layer from manager's tracking list
+        EXPECT_FALSE(manager.isInList(&layer));
+    }
+
+    void doDeferredFrameTestTask(FakeCanvas2DLayerBridge* layer, bool skipCommands)
+    {
+        EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
+        layer->contextAcquired();
+        layer->storageAllocatedForRecordingChanged(1);
+        EXPECT_TRUE(Canvas2DLayerManager::get().m_taskObserverActive);
+        if (skipCommands) {
+            layer->contextAcquired();
+            layer->storageAllocatedForRecordingChanged(0);
+            layer->skippedPendingDrawCommands();
+        }
+        WebKit::Platform::current()->currentThread()->exitRunLoop();
+    }
+
+    class DeferredFrameTestTask : public WebKit::WebThread::Task {
+    public:
+        DeferredFrameTestTask(Canvas2DLayerManagerTest* test, FakeCanvas2DLayerBridge* layer, bool skipCommands)
+        {
+            m_test = test;
+            m_layer = layer;
+            m_skipCommands = skipCommands;
+        }
+
+        virtual void run() OVERRIDE
+        {
+            m_test->doDeferredFrameTestTask(m_layer, m_skipCommands);
+        }
+    private:
+        Canvas2DLayerManagerTest* m_test;
+        FakeCanvas2DLayerBridge* m_layer;
+        bool m_skipCommands;
+    };
+
+    void deferredFrameTest()
+    {
+        RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsContextFromWebContext(adoptPtr(new WebKit::FakeWebGraphicsContext3D));
+        Canvas2DLayerManager::get().init(10, 10);
+        OwnPtr<SkDeferredCanvas> canvas = createCanvas(context.get());
+        FakeCanvas2DLayerBridge fakeLayer(context, canvas.get());
+        WebKit::Platform::current()->currentThread()->postTask(new DeferredFrameTestTask(this, &fakeLayer, true));
+        WebKit::Platform::current()->currentThread()->enterRunLoop();
+        // Verify that didProcessTask was called upon completion
+        EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
+        // Verify that no flush was performed because frame is fresh
+        EXPECT_EQ(0, fakeLayer.m_flushCount);
+
+        // Verify that no flushes are triggered as long as frame are fresh
+        WebKit::Platform::current()->currentThread()->postTask(new DeferredFrameTestTask(this, &fakeLayer, true));
+        WebKit::Platform::current()->currentThread()->enterRunLoop();
+        EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
+        EXPECT_EQ(0, fakeLayer.m_flushCount);
+
+        WebKit::Platform::current()->currentThread()->postTask(new DeferredFrameTestTask(this, &fakeLayer, true));
+        WebKit::Platform::current()->currentThread()->enterRunLoop();
+        EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
+        EXPECT_EQ(0, fakeLayer.m_flushCount);
+
+        // Verify that a flush is triggered when queue is accumulating a multi-frame backlog.
+        WebKit::Platform::current()->currentThread()->postTask(new DeferredFrameTestTask(this, &fakeLayer, false));
+        WebKit::Platform::current()->currentThread()->enterRunLoop();
+        EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
+        EXPECT_EQ(1, fakeLayer.m_flushCount);
+
+        WebKit::Platform::current()->currentThread()->postTask(new DeferredFrameTestTask(this, &fakeLayer, false));
+        WebKit::Platform::current()->currentThread()->enterRunLoop();
+        EXPECT_FALSE(Canvas2DLayerManager::get().m_taskObserverActive);
+        EXPECT_EQ(2, fakeLayer.m_flushCount);
+    }
+};
+
+namespace {
+
+TEST_F(Canvas2DLayerManagerTest, testStorageAllocationTracking)
+{
+    storageAllocationTrackingTest();
+}
+
+TEST_F(Canvas2DLayerManagerTest, testEviction)
+{
+    evictionTest();
+}
+
+TEST_F(Canvas2DLayerManagerTest, testFlushEviction)
+{
+    flushEvictionTest();
+}
+
+TEST_F(Canvas2DLayerManagerTest, testDeferredFrame)
+{
+    deferredFrameTest();
+}
+
+} // namespace
+
diff --git a/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp b/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp
index fa64ff9..b1b659d 100644
--- a/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp
+++ b/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp
@@ -122,24 +122,7 @@
 
 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescription& description, ShouldRetain shouldRetain)
 {
-    DEFINE_STATIC_LOCAL(const AtomicString, serif, ("Serif", AtomicString::ConstructFromLiteral));
-    DEFINE_STATIC_LOCAL(const AtomicString, monospace, ("Monospace", AtomicString::ConstructFromLiteral));
-    DEFINE_STATIC_LOCAL(const AtomicString, sans, ("Sans", AtomicString::ConstructFromLiteral));
-
-    FontPlatformData* fontPlatformData = 0;
-    switch (description.genericFamily()) {
-    case FontDescription::SerifFamily:
-        fontPlatformData = getCachedFontPlatformData(description, serif);
-        break;
-    case FontDescription::MonospaceFamily:
-        fontPlatformData = getCachedFontPlatformData(description, monospace);
-        break;
-    case FontDescription::SansSerifFamily:
-    default:
-        fontPlatformData = getCachedFontPlatformData(description, sans);
-        break;
-    }
-
+    const FontPlatformData* fontPlatformData = getFallbackFontData(description);
     ASSERT(fontPlatformData);
     return getCachedFontData(fontPlatformData, shouldRetain);
 }
diff --git a/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp
index 04726dc..e449c1c 100644
--- a/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp
@@ -235,7 +235,7 @@
 
 static HFONT createFontIndirectAndGetWinName(const String& family, LOGFONT* winfont, String* winName)
 {
-    unsigned len = family.copyTo(winfont->lfFaceName, LF_FACESIZE - 1);
+    unsigned len = family.copyTo(winfont->lfFaceName, 0, LF_FACESIZE - 1);
     winfont->lfFaceName[len] = '\0';
 
     HFONT hfont = CreateFontIndirect(winfont);
@@ -589,7 +589,7 @@
     LOGFONT logFont;
     logFont.lfCharSet = DEFAULT_CHARSET;
     unsigned familyLength = min(familyName.length(), static_cast<unsigned>(LF_FACESIZE - 1));
-    memcpy(logFont.lfFaceName, familyName.characters(), familyLength * sizeof(UChar));
+    familyName.string().copyTo(logFont.lfFaceName, 0, familyLength);
     logFont.lfFaceName[familyLength] = 0;
     logFont.lfPitchAndFamily = 0;
 
diff --git a/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp b/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp
index 0562b65..e827e56 100644
--- a/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp
+++ b/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp
@@ -55,9 +55,11 @@
 {
 #ifndef NDEBUG
     setCacheLimitInBytes(0);
-    ASSERT(!m_cacheMap.size());
+    ASSERT(!m_imageCacheMap.size());
+    ASSERT(!m_decoderCacheMap.size());
     ASSERT(!m_orderedCacheList.size());
-    ASSERT(!m_cachedSizeMap.size());
+    ASSERT(!m_imageCacheKeyMap.size());
+    ASSERT(!m_decoderCacheKeyMap.size());
 #endif
 }
 
@@ -76,53 +78,27 @@
     setInstance(0);
 }
 
-bool ImageDecodingStore::lockCache(const ImageFrameGenerator* generator, const SkISize& scaledSize, CacheCondition condition, const ScaledImageFragment** cachedImage, ImageDecoder** decoder)
+bool ImageDecodingStore::lockCache(const ImageFrameGenerator* generator, const SkISize& scaledSize, size_t index, const ScaledImageFragment** cachedImage)
 {
     ASSERT(cachedImage);
 
-    CacheEntry* cacheEntry = 0;
     Vector<OwnPtr<CacheEntry> > cacheEntriesToDelete;
     {
         MutexLocker lock(m_mutex);
-        CacheMap::iterator iter = m_cacheMap.find(std::make_pair(generator, scaledSize));
-        if (iter == m_cacheMap.end())
+        // Public access is restricted to complete images only.
+        ImageCacheMap::iterator iter = m_imageCacheMap.find(ImageCacheEntry::makeCacheKey(generator, scaledSize, index, ScaledImageFragment::CompleteImage));
+        if (iter == m_imageCacheMap.end())
             return false;
-        cacheEntry = iter->value.get();
-        ScaledImageFragment* image = cacheEntry->cachedImage();
-        if (condition == CacheMustBeComplete && !image->isComplete())
-            return false;
-
-        // Incomplete cache entry cannot be used more than once.
-        ASSERT(image->isComplete() || !cacheEntry->useCount());
-
-        image->bitmap().lockPixels();
-        if (image->bitmap().getPixels()) {
-            // Increment use count such that it doesn't get evicted.
-            cacheEntry->incrementUseCount();
-
-            // Complete cache entry doesn't have a decoder.
-            ASSERT(!image->isComplete() || !cacheEntry->cachedDecoder());
-
-            if (decoder)
-                *decoder = cacheEntry->cachedDecoder();
-            *cachedImage = image;
-        } else {
-            image->bitmap().unlockPixels();
-            removeFromCacheInternal(cacheEntry, &cacheEntriesToDelete);
-            removeFromCacheListInternal(cacheEntriesToDelete);
-            return false;
-        }
+        return lockCacheEntryInternal(iter->value.get(), cachedImage, &cacheEntriesToDelete);
     }
-
-    return true;
 }
 
 void ImageDecodingStore::unlockCache(const ImageFrameGenerator* generator, const ScaledImageFragment* cachedImage)
 {
     MutexLocker lock(m_mutex);
     cachedImage->bitmap().unlockPixels();
-    CacheMap::iterator iter = m_cacheMap.find(std::make_pair(generator, cachedImage->scaledSize()));
-    ASSERT(iter != m_cacheMap.end());
+    ImageCacheMap::iterator iter = m_imageCacheMap.find(ImageCacheEntry::makeCacheKey(generator, cachedImage->scaledSize(), cachedImage->index(), cachedImage->generation()));
+    ASSERT(iter != m_imageCacheMap.end());
 
     CacheEntry* cacheEntry = iter->value.get();
     cacheEntry->decrementUseCount();
@@ -132,64 +108,111 @@
     m_orderedCacheList.append(cacheEntry);
 }
 
-const ScaledImageFragment* ImageDecodingStore::insertAndLockCache(const ImageFrameGenerator* generator, PassOwnPtr<ScaledImageFragment> image, PassOwnPtr<ImageDecoder> decoder)
+const ScaledImageFragment* ImageDecodingStore::insertAndLockCache(const ImageFrameGenerator* generator, PassOwnPtr<ScaledImageFragment> image)
 {
     // Prune old cache entries to give space for the new one.
     prune();
 
-    ScaledImageFragment* cachedImage = image.get();
-    OwnPtr<CacheEntry> newCacheEntry;
+    ScaledImageFragment* newImage = image.get();
+    OwnPtr<ImageCacheEntry> newCacheEntry = ImageCacheEntry::createAndUse(generator, image);
+    Vector<OwnPtr<CacheEntry> > cacheEntriesToDelete;
+    {
+        MutexLocker lock(m_mutex);
 
-    // ImageDecoder is not used any more if cache is complete.
-    if (image->isComplete())
-        newCacheEntry = CacheEntry::createAndUse(generator, image);
-    else
-        newCacheEntry = CacheEntry::createAndUse(generator, image, decoder);
+        ImageCacheMap::iterator iter = m_imageCacheMap.find(newCacheEntry->cacheKey());
 
-    MutexLocker lock(m_mutex);
-    // Lock the underlying SkBitmap to prevent it from being purged.
-    cachedImage->bitmap().lockPixels();
-    ASSERT(!m_cacheMap.contains(newCacheEntry->cacheKey()));
-    insertCacheInternal(newCacheEntry.release());
-    return cachedImage;
+        // It is rare but possible that the key of a new cache entry is found.
+        // This happens if the generation ID of the image object wraps around.
+        // In this case we will try to return the existing cached object and
+        // discard the new cache object.
+        if (iter != m_imageCacheMap.end()) {
+            const ScaledImageFragment* oldImage;
+            if (lockCacheEntryInternal(iter->value.get(), &oldImage, &cacheEntriesToDelete)) {
+                newCacheEntry->decrementUseCount();
+                return oldImage;
+            }
+        }
+
+        // The new image is not locked yet so do it here.
+        newImage->bitmap().lockPixels();
+        insertCacheInternal(newCacheEntry.release(), &m_imageCacheMap, &m_imageCacheKeyMap);
+    }
+    return newImage;
 }
 
-bool ImageDecodingStore::isCached(const ImageFrameGenerator* generator, const SkISize& scaledSize)
+bool ImageDecodingStore::lockDecoder(const ImageFrameGenerator* generator, const SkISize& scaledSize, ImageDecoder** decoder)
 {
+    ASSERT(decoder);
+
     MutexLocker lock(m_mutex);
-    CacheMap::iterator iter = m_cacheMap.find(std::make_pair(generator, scaledSize));
-    if (iter == m_cacheMap.end())
+    DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::makeCacheKey(generator, scaledSize));
+    if (iter == m_decoderCacheMap.end())
         return false;
+
+    DecoderCacheEntry* cacheEntry = iter->value.get();
+
+    // There can only be one user of a decoder at a time.
+    ASSERT(!cacheEntry->useCount());
+    cacheEntry->incrementUseCount();
+    *decoder = cacheEntry->cachedDecoder();
     return true;
 }
 
-
-const ScaledImageFragment* ImageDecodingStore::overwriteAndLockCache(const ImageFrameGenerator* generator, const ScaledImageFragment* cachedImage, PassOwnPtr<ScaledImageFragment> newImage)
+void ImageDecodingStore::unlockDecoder(const ImageFrameGenerator* generator, const ImageDecoder* decoder)
 {
-    OwnPtr<ImageDecoder> trash;
-    const ScaledImageFragment* newCachedImage = 0;
+    MutexLocker lock(m_mutex);
+    DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::makeCacheKey(generator, decoder));
+    ASSERT(iter != m_decoderCacheMap.end());
+
+    CacheEntry* cacheEntry = iter->value.get();
+    cacheEntry->decrementUseCount();
+
+    // Put the entry to the end of list.
+    m_orderedCacheList.remove(cacheEntry);
+    m_orderedCacheList.append(cacheEntry);
+}
+
+void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder, bool isDiscardable)
+{
+    // Prune old cache entries to give space for the new one.
+    prune();
+
+    OwnPtr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generator, decoder, isDiscardable);
+
+    MutexLocker lock(m_mutex);
+    ASSERT(!m_decoderCacheMap.contains(newCacheEntry->cacheKey()));
+    insertCacheInternal(newCacheEntry.release(), &m_decoderCacheMap, &m_decoderCacheKeyMap);
+}
+
+void ImageDecodingStore::removeDecoder(const ImageFrameGenerator* generator, const ImageDecoder* decoder)
+{
+    Vector<OwnPtr<CacheEntry> > cacheEntriesToDelete;
     {
         MutexLocker lock(m_mutex);
-        cachedImage->bitmap().unlockPixels();
-        CacheMap::iterator iter = m_cacheMap.find(std::make_pair(generator, cachedImage->scaledSize()));
-        ASSERT(iter != m_cacheMap.end());
+        DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::makeCacheKey(generator, decoder));
+        ASSERT(iter != m_decoderCacheMap.end());
 
         CacheEntry* cacheEntry = iter->value.get();
-        ASSERT(cacheEntry->useCount() == 1);
-        ASSERT(!cacheEntry->cachedImage()->isComplete());
+        ASSERT(cacheEntry->useCount());
+        cacheEntry->decrementUseCount();
 
-        bool isNewImageDiscardable = DiscardablePixelRef::isDiscardable(newImage->bitmap().pixelRef());
-        if (cacheEntry->isDiscardable() && !isNewImageDiscardable)
-            incrementMemoryUsage(cacheEntry->memoryUsageInBytes());
-        else if (!cacheEntry->isDiscardable() && isNewImageDiscardable)
-            decrementMemoryUsage(cacheEntry->memoryUsageInBytes());
-        trash = cacheEntry->overwriteCachedImage(newImage);
-        newCachedImage = cacheEntry->cachedImage();
-        // Lock the underlying SkBitmap to prevent it from being purged.
-        newCachedImage->bitmap().lockPixels();
+        // Delete only one decoder cache entry. Ownership of the cache entry
+        // is transfered to cacheEntriesToDelete such that object can be deleted
+        // outside of the lock.
+        removeFromCacheInternal(cacheEntry, &cacheEntriesToDelete);
+
+        // Remove from LRU list.
+        removeFromCacheListInternal(cacheEntriesToDelete);
     }
+}
 
-    return newCachedImage;
+bool ImageDecodingStore::isCached(const ImageFrameGenerator* generator, const SkISize& scaledSize, size_t index)
+{
+    MutexLocker lock(m_mutex);
+    ImageCacheMap::iterator iter = m_imageCacheMap.find(ImageCacheEntry::makeCacheKey(generator, scaledSize, index, ScaledImageFragment::CompleteImage));
+    if (iter == m_imageCacheMap.end())
+        return false;
+    return true;
 }
 
 void ImageDecodingStore::removeCacheIndexedByGenerator(const ImageFrameGenerator* generator)
@@ -197,26 +220,13 @@
     Vector<OwnPtr<CacheEntry> > cacheEntriesToDelete;
     {
         MutexLocker lock(m_mutex);
-        CachedSizeMap::iterator iter = m_cachedSizeMap.find(generator);
-        if (iter == m_cachedSizeMap.end())
-            return;
 
-        // Get all cached sizes indexed by generator.
-        Vector<SkISize> cachedSizeList;
-        copyToVector(iter->value, cachedSizeList);
+        // Remove image cache objects and decoder cache objects associated
+        // with a ImageFrameGenerator.
+        removeCacheIndexedByGeneratorInternal(&m_imageCacheMap, &m_imageCacheKeyMap, generator, &cacheEntriesToDelete);
+        removeCacheIndexedByGeneratorInternal(&m_decoderCacheMap, &m_decoderCacheKeyMap, generator, &cacheEntriesToDelete);
 
-        // For each cached size find the corresponding CacheEntry and remove it from
-        // m_cacheMap.
-        for (size_t i = 0; i < cachedSizeList.size(); ++i) {
-            CacheIdentifier key = std::make_pair(generator, cachedSizeList[i]);
-            ASSERT(m_cacheMap.contains(key));
-
-            const CacheEntry* cacheEntry = m_cacheMap.get(key);
-            ASSERT(!cacheEntry->useCount());
-            removeFromCacheInternal(cacheEntry, &cacheEntriesToDelete);
-        }
-
-        // Remove from cache list as well.
+        // Remove from LRU list as well.
         removeFromCacheListInternal(cacheEntriesToDelete);
     }
 }
@@ -256,7 +266,19 @@
 unsigned ImageDecodingStore::cacheEntries()
 {
     MutexLocker lock(m_mutex);
-    return m_cacheMap.size();
+    return m_imageCacheMap.size() + m_decoderCacheMap.size();
+}
+
+unsigned ImageDecodingStore::imageCacheEntries()
+{
+    MutexLocker lock(m_mutex);
+    return m_imageCacheMap.size();
+}
+
+unsigned ImageDecodingStore::decoderCacheEntries()
+{
+    MutexLocker lock(m_mutex);
+    return m_decoderCacheMap.size();
 }
 
 void ImageDecodingStore::prune()
@@ -284,44 +306,98 @@
     }
 }
 
-void ImageDecodingStore::insertCacheInternal(PassOwnPtr<CacheEntry> cacheEntry)
+bool ImageDecodingStore::lockCacheEntryInternal(ImageCacheEntry* cacheEntry, const ScaledImageFragment** cachedImage, Vector<OwnPtr<CacheEntry> >* deletionList)
 {
+    ScaledImageFragment* image = cacheEntry->cachedImage();
+
+    image->bitmap().lockPixels();
+
+    // Memory for this image entry might be discarded already.
+    // In this case remove the entry.
+    if (!image->bitmap().getPixels()) {
+        image->bitmap().unlockPixels();
+        removeFromCacheInternal(cacheEntry, &m_imageCacheMap, &m_imageCacheKeyMap, deletionList);
+        removeFromCacheListInternal(*deletionList);
+        return false;
+    }
+    cacheEntry->incrementUseCount();
+    *cachedImage = image;
+    return true;
+}
+
+template<class T, class U, class V>
+void ImageDecodingStore::insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap)
+{
+    // Usage of discardable memory is not counted because we want to use more
+    // than the cache limit allows. Cache limit only applies to non-discardable
+    // objects.
     if (!cacheEntry->isDiscardable())
         incrementMemoryUsage(cacheEntry->memoryUsageInBytes());
-    TRACE_COUNTER1("webkit", "ImageDecodingStoreMemoryUsageBytes", m_memoryUsageInBytes);
 
     // m_orderedCacheList is used to support LRU operations to reorder cache
     // entries quickly.
     m_orderedCacheList.append(cacheEntry.get());
 
-    CacheIdentifier key = cacheEntry->cacheKey();
-    // m_cacheMap is used for indexing and quick lookup of a cached image. It owns
-    // all cache entries.
-    m_cacheMap.add(key, cacheEntry);
-    TRACE_COUNTER1("webkit", "ImageDecodingStoreNumOfEntries", m_cacheMap.size());
+    typename U::KeyType key = cacheEntry->cacheKey();
+    typename V::AddResult result = identifierMap->add(cacheEntry->generator(), typename V::MappedType());
+    result.iterator->value.add(key);
+    cacheMap->add(key, cacheEntry);
 
-    // m_cachedSizeMap keeps all scaled sizes associated with an ImageFrameGenerator.
-    CachedSizeMap::AddResult result = m_cachedSizeMap.add(key.first, SizeSet());
-    result.iterator->value.add(key.second);
+    TRACE_COUNTER1("webkit", "ImageDecodingStoreMemoryUsageBytes", m_memoryUsageInBytes);
+    TRACE_COUNTER1("webkit", "ImageDecodingStoreNumOfImages", m_imageCacheMap.size());
+    TRACE_COUNTER1("webkit", "ImageDecodingStoreNumOfDecoders", m_decoderCacheMap.size());
+}
+
+template<class T, class U, class V>
+void ImageDecodingStore::removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry> >* deletionList)
+{
+    if (!cacheEntry->isDiscardable())
+        decrementMemoryUsage(cacheEntry->memoryUsageInBytes());
+
+    // Remove entry from identifier map.
+    typename V::iterator iter = identifierMap->find(cacheEntry->generator());
+    ASSERT(iter != identifierMap->end());
+    iter->value.remove(cacheEntry->cacheKey());
+    if (!iter->value.size())
+        identifierMap->remove(iter);
+
+    // Remove entry from cache map.
+    deletionList->append(cacheMap->take(cacheEntry->cacheKey()));
+
+    TRACE_COUNTER1("webkit", "ImageDecodingStoreMemoryUsageBytes", m_memoryUsageInBytes);
+    TRACE_COUNTER1("webkit", "ImageDecodingStoreNumOfImages", m_imageCacheMap.size());
+    TRACE_COUNTER1("webkit", "ImageDecodingStoreNumOfDecoders", m_decoderCacheMap.size());
 }
 
 void ImageDecodingStore::removeFromCacheInternal(const CacheEntry* cacheEntry, Vector<OwnPtr<CacheEntry> >* deletionList)
 {
-    if (!cacheEntry->isDiscardable())
-        decrementMemoryUsage(cacheEntry->memoryUsageInBytes());
-    TRACE_COUNTER1("webkit", "ImageDecodingStoreMemoryUsageBytes", m_memoryUsageInBytes);
+    if (cacheEntry->type() == CacheEntry::TypeImage) {
+        removeFromCacheInternal(static_cast<const ImageCacheEntry*>(cacheEntry), &m_imageCacheMap, &m_imageCacheKeyMap, deletionList);
+    } else if (cacheEntry->type() == CacheEntry::TypeDecoder) {
+        removeFromCacheInternal(static_cast<const DecoderCacheEntry*>(cacheEntry), &m_decoderCacheMap, &m_decoderCacheKeyMap, deletionList);
+    } else {
+        ASSERT(false);
+    }
+}
 
-    // Remove from m_cacheMap.
-    CacheIdentifier key = cacheEntry->cacheKey();
-    deletionList->append(m_cacheMap.take(key));
-    TRACE_COUNTER1("webkit", "ImageDecodingStoreNumOfEntries", m_cacheMap.size());
+template<class U, class V>
+void ImageDecodingStore::removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator* generator, Vector<OwnPtr<CacheEntry> >* deletionList)
+{
+    typename V::iterator iter = identifierMap->find(generator);
+    if (iter == identifierMap->end())
+        return;
 
-    // Remove from m_cachedSizeMap.
-    CachedSizeMap::iterator iter = m_cachedSizeMap.find(key.first);
-    ASSERT(iter != m_cachedSizeMap.end());
-    iter->value.remove(key.second);
-    if (!iter->value.size())
-        m_cachedSizeMap.remove(iter);
+    // Get all cache identifiers associated with generator.
+    Vector<typename U::KeyType> cacheIdentifierList;
+    copyToVector(iter->value, cacheIdentifierList);
+
+    // For each cache identifier find the corresponding CacheEntry and remove it.
+    for (size_t i = 0; i < cacheIdentifierList.size(); ++i) {
+        ASSERT(cacheMap->contains(cacheIdentifierList[i]));
+        const typename U::MappedType::PtrType cacheEntry = cacheMap->get(cacheIdentifierList[i]);
+        ASSERT(!cacheEntry->useCount());
+        removeFromCacheInternal(cacheEntry, cacheMap, identifierMap, deletionList);
+    }
 }
 
 void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry> >& deletionList)
diff --git a/Source/core/platform/graphics/chromium/ImageDecodingStore.h b/Source/core/platform/graphics/chromium/ImageDecodingStore.h
index ba3b6d8..28c87c5 100644
--- a/Source/core/platform/graphics/chromium/ImageDecodingStore.h
+++ b/Source/core/platform/graphics/chromium/ImageDecodingStore.h
@@ -45,13 +45,45 @@
 class ImageFrameGenerator;
 class SharedBuffer;
 
+// FUNCTION
+//
+// ImageDecodingStore is a class used to manage image cache objects. There are two
+// types of cache objects stored:
+//
+// 1. Image objects
+//    Each image object belongs to one frame decoded and/or resampled from an image
+//    file. The image object can be complete or partial. Complete means the image
+//    is fully decoded and will not mutate in future decoding passes. It can have
+//    multiple concurrent users. A partial image object has only one user.
+//
+// 2. Decoder objects
+//    A decoder object contains an image decoder. This allows decoding to resume
+//    from previous states. There can be one user per one decoder object at any
+//    time.
+//
+// EXTERNAL OBJECTS
+//
+// ScaledImageFragment
+//   A cached image object. Contains the bitmap and information about the bitmap
+//   image.
+//
+// ImageDecoder
+//   A decoder object. It is used to decode raw data into bitmap images.
+//
+// ImageFrameGenerator
+//   This is a direct user of this cache. Responsible for generating bitmap images
+//   using an ImageDecoder. It contains encoded image data and is used to represent
+//   one image file. It is used to index image and decoder objects in the cache.
+//
+// LazyDecodingPixelRef
+//   A read only user of this cache.
+//
+// THREAD SAFETY
+//
+// All public methods can be used on any thread.
+
 class ImageDecodingStore {
 public:
-    enum CacheCondition {
-        CacheMustBeComplete,
-        CacheCanBeIncomplete
-    };
-
     static PassOwnPtr<ImageDecodingStore> create() { return adoptPtr(new ImageDecodingStore); }
     ~ImageDecodingStore();
 
@@ -59,17 +91,24 @@
     static void initializeOnce();
     static void shutdown();
 
-    // If cacheMustBeComplete is true then only return a complete cache.
-    bool lockCache(const ImageFrameGenerator*, const SkISize& scaledSize, CacheCondition, const ScaledImageFragment**, ImageDecoder** = 0);
+    // Access a complete cached image object. A complete cached image object is
+    // indexed by the origin (ImageFrameGenerator), scaled size and frame index
+    // within the image file.
+    // Return true if the cache object is found.
+    // Return false if the cache object cannot be found or it is incomplete.
+    bool lockCache(const ImageFrameGenerator*, const SkISize& scaledSize, size_t index, const ScaledImageFragment**);
     void unlockCache(const ImageFrameGenerator*, const ScaledImageFragment*);
-    const ScaledImageFragment* insertAndLockCache(const ImageFrameGenerator*, PassOwnPtr<ScaledImageFragment>, PassOwnPtr<ImageDecoder> = nullptr);
+    const ScaledImageFragment* insertAndLockCache(const ImageFrameGenerator*, PassOwnPtr<ScaledImageFragment>);
+
+    // Access a cached decoder object. A decoder is indexed by origin (ImageFrameGenerator)
+    // and scaled size. Return true if the cached object is found.
+    bool lockDecoder(const ImageFrameGenerator*, const SkISize& scaledSize, ImageDecoder**);
+    void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*);
+    void insertDecoder(const ImageFrameGenerator*, PassOwnPtr<ImageDecoder>, bool isDiscardable);
+    void removeDecoder(const ImageFrameGenerator*, const ImageDecoder*);
 
     // Locks the cache for safety, but does not attempt to lock the object we're checking for.
-    bool isCached(const ImageFrameGenerator*, const SkISize& scaledSize);
-
-    // Overwrite an existing cached image. It is unlocked and then replaced with the new image.
-    // The existing cached image must be already locked and incomplete.
-    const ScaledImageFragment* overwriteAndLockCache(const ImageFrameGenerator*, const ScaledImageFragment*, PassOwnPtr<ScaledImageFragment>);
+    bool isCached(const ImageFrameGenerator*, const SkISize& scaledSize, size_t index);
 
     // Remove all cache entries indexed by ImageFrameGenerator.
     void removeCacheIndexedByGenerator(const ImageFrameGenerator*);
@@ -78,46 +117,48 @@
     void setCacheLimitInBytes(size_t);
     size_t memoryUsageInBytes();
     unsigned cacheEntries();
+    unsigned imageCacheEntries();
+    unsigned decoderCacheEntries();
 
 private:
-    typedef std::pair<const ImageFrameGenerator*, SkISize> CacheIdentifier;
+    // Image cache entry is identified by:
+    // 1. Pointer to ImageFrameGenerator.
+    // 2. Size of the image.
+    // 3. Frame index.
+    // 4. Frame generation. Increments on each progressive decode.
+    //
+    // The use of generation ID is to allow multiple versions of an image frame
+    // be stored in the cache. Each generation comes from a progressive decode.
+    //
+    // Decoder entries are identified by (1) and (2) only.
+    typedef std::pair<const ImageFrameGenerator*, SkISize> DecoderCacheKey;
+    typedef std::pair<size_t, size_t> IndexAndGeneration;
+    typedef std::pair<DecoderCacheKey, IndexAndGeneration> ImageCacheKey;
 
+    // Base class for all cache entries.
     class CacheEntry : public DoublyLinkedListNode<CacheEntry> {
         friend class WTF::DoublyLinkedListNode<CacheEntry>;
     public:
-        static PassOwnPtr<CacheEntry> createAndUse(const ImageFrameGenerator* generator, PassOwnPtr<ScaledImageFragment> image, PassOwnPtr<ImageDecoder> decoder = nullptr)
-        {
-            return adoptPtr(new CacheEntry(generator, image, decoder, 1));
-        }
+        enum CacheType {
+            TypeImage,
+            TypeDecoder,
+        };
 
-        CacheEntry(const ImageFrameGenerator* generator, PassOwnPtr<ScaledImageFragment> image, PassOwnPtr<ImageDecoder> decoder, int count)
-            : m_prev(0)
+        CacheEntry(const ImageFrameGenerator* generator, int useCount, bool isDiscardable)
+            : m_generator(generator)
+            , m_useCount(useCount)
+            , m_isDiscardable(isDiscardable)
+            , m_prev(0)
             , m_next(0)
-            , m_generator(generator)
-            , m_cachedImage(image)
-            , m_cachedDecoder(decoder)
-            , m_useCount(count)
-            , m_isDiscardable(DiscardablePixelRef::isDiscardable(m_cachedImage->bitmap().pixelRef()))
         {
         }
 
-        ~CacheEntry()
+        virtual ~CacheEntry()
         {
             ASSERT(!m_useCount);
         }
 
-        CacheIdentifier cacheKey() const { return std::make_pair(m_generator, m_cachedImage->scaledSize()); }
-        const ScaledImageFragment* cachedImage() const { return m_cachedImage.get(); }
-        ScaledImageFragment* cachedImage() { return m_cachedImage.get(); }
-        ImageDecoder* cachedDecoder() const { return m_cachedDecoder.get(); }
-        PassOwnPtr<ImageDecoder> overwriteCachedImage(PassOwnPtr<ScaledImageFragment> image)
-        {
-            m_isDiscardable = DiscardablePixelRef::isDiscardable(image->bitmap().pixelRef());
-            m_cachedImage = image;
-            if (m_cachedImage->isComplete())
-                return m_cachedDecoder.release();
-            return nullptr;
-        }
+        const ImageFrameGenerator* generator() const { return m_generator; }
         int useCount() const { return m_useCount; }
         void incrementUseCount() { ++m_useCount; }
         void decrementUseCount() { --m_useCount; ASSERT(m_useCount >= 0); }
@@ -125,26 +166,110 @@
 
         // FIXME: getSafeSize() returns size in bytes truncated to a 32-bits integer.
         //        Find a way to get the size in 64-bits.
-        size_t memoryUsageInBytes() const { return cachedImage()->bitmap().getSafeSize(); }
+        virtual size_t memoryUsageInBytes() const = 0;
+        virtual CacheType type() const = 0;
+
+    protected:
+        const ImageFrameGenerator* m_generator;
+        int m_useCount;
+        bool m_isDiscardable;
 
     private:
         CacheEntry* m_prev;
         CacheEntry* m_next;
-        const ImageFrameGenerator* m_generator;
+    };
+
+    class ImageCacheEntry : public CacheEntry {
+    public:
+        static PassOwnPtr<ImageCacheEntry> createAndUse(const ImageFrameGenerator* generator, PassOwnPtr<ScaledImageFragment> image)
+        {
+            return adoptPtr(new ImageCacheEntry(generator, 1, image));
+        }
+
+        ImageCacheEntry(const ImageFrameGenerator* generator, int count, PassOwnPtr<ScaledImageFragment> image)
+            : CacheEntry(generator, count, DiscardablePixelRef::isDiscardable(image->bitmap().pixelRef()))
+            , m_cachedImage(image)
+        {
+        }
+
+        // FIXME: getSafeSize() returns size in bytes truncated to a 32-bits integer.
+        //        Find a way to get the size in 64-bits.
+        virtual size_t memoryUsageInBytes() const { return cachedImage()->bitmap().getSafeSize(); }
+        virtual CacheType type() const { return TypeImage; }
+
+        static ImageCacheKey makeCacheKey(const ImageFrameGenerator* generator, const SkISize& size, size_t index, size_t generation)
+        {
+            return std::make_pair(std::make_pair(generator, size), std::make_pair(index, generation));
+        }
+        ImageCacheKey cacheKey() const { return makeCacheKey(m_generator, m_cachedImage->scaledSize(), m_cachedImage->index(), m_cachedImage->generation()); }
+        const ScaledImageFragment* cachedImage() const { return m_cachedImage.get(); }
+        ScaledImageFragment* cachedImage() { return m_cachedImage.get(); }
+
+    private:
         OwnPtr<ScaledImageFragment> m_cachedImage;
+    };
+
+    class DecoderCacheEntry : public CacheEntry {
+    public:
+        static PassOwnPtr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder, bool isDiscardable)
+        {
+            return adoptPtr(new DecoderCacheEntry(generator, 0, decoder, isDiscardable));
+        }
+
+        DecoderCacheEntry(const ImageFrameGenerator* generator, int count, PassOwnPtr<ImageDecoder> decoder, bool isDiscardable)
+            : CacheEntry(generator, count, isDiscardable)
+            , m_cachedDecoder(decoder)
+            , m_size(SkISize::Make(m_cachedDecoder->size().width(), m_cachedDecoder->size().height()))
+        {
+        }
+
+        virtual size_t memoryUsageInBytes() const { return m_size.width() * m_size.height() * 4; }
+        virtual CacheType type() const { return TypeDecoder; }
+
+        static DecoderCacheKey makeCacheKey(const ImageFrameGenerator* generator, const SkISize& size)
+        {
+            return std::make_pair(generator, size);
+        }
+        static DecoderCacheKey makeCacheKey(const ImageFrameGenerator* generator, const ImageDecoder* decoder)
+        {
+            return std::make_pair(generator, SkISize::Make(decoder->size().width(), decoder->size().height()));
+        }
+        DecoderCacheKey cacheKey() const { return makeCacheKey(m_generator, m_size); }
+        ImageDecoder* cachedDecoder() const { return m_cachedDecoder.get(); }
+
+    private:
         OwnPtr<ImageDecoder> m_cachedDecoder;
-        int m_useCount;
-        bool m_isDiscardable;
+        SkISize m_size;
     };
 
     ImageDecodingStore();
 
     void prune();
 
-    // These methods are called while m_mutex is locked.
-    void insertCacheInternal(PassOwnPtr<CacheEntry>);
+    // These helper methods are called while m_mutex is locked.
+
+    // Find and lock a cache entry, and return true on success.
+    // Memory of the cache entry can be discarded, in which case it is saved in
+    // deletionList.
+    bool lockCacheEntryInternal(ImageCacheEntry*, const ScaledImageFragment**, Vector<OwnPtr<CacheEntry> >* deletionList);
+
+    template<class T, class U, class V> void insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap);
+
+    // Helper method to remove a cache entry. Ownership is transferred to
+    // deletionList. Use of Vector<> is handy when removing multiple entries.
+    template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry> >* deletionList);
+
+    // Helper method to remove a cache entry. Uses the templated version base on
+    // the type of cache entry.
     void removeFromCacheInternal(const CacheEntry*, Vector<OwnPtr<CacheEntry> >* deletionList);
+
+    // Helper method to remove all cache entries associated with a ImageFraneGenerator.
+    // Ownership of cache entries is transferred to deletionList.
+    template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<OwnPtr<CacheEntry> >* deletionList);
+
+    // Helper method to remove cache entry pointers from the LRU list.
     void removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry> >& deletionList);
+
     void incrementMemoryUsage(size_t size) { m_memoryUsageInBytes += size; }
     void decrementMemoryUsage(size_t size)
     {
@@ -152,24 +277,40 @@
         m_memoryUsageInBytes -= size;
     }
 
+    // A doubly linked list that maintains usage history of cache entries.
+    // This is used for eviction of old entries.
     // Head of this list is the least recently used cache entry.
     // Tail of this list is the most recently used cache entry.
     DoublyLinkedList<CacheEntry> m_orderedCacheList;
 
-    typedef HashMap<CacheIdentifier, OwnPtr<CacheEntry> > CacheMap;
-    CacheMap m_cacheMap;
+    // A lookup table for all image cache objects. Owns all image cache objects.
+    typedef HashMap<ImageCacheKey, OwnPtr<ImageCacheEntry> > ImageCacheMap;
+    ImageCacheMap m_imageCacheMap;
 
-    typedef HashSet<SkISize> SizeSet;
-    typedef HashMap<const ImageFrameGenerator*, SizeSet> CachedSizeMap;
-    CachedSizeMap m_cachedSizeMap;
+    // A lookup table for all decoder cache objects. Owns all decoder cache objects.
+    typedef HashMap<DecoderCacheKey, OwnPtr<DecoderCacheEntry> > DecoderCacheMap;
+    DecoderCacheMap m_decoderCacheMap;
+
+    // A lookup table to map ImageFrameGenerator to all associated image
+    // cache keys.
+    typedef HashSet<ImageCacheKey> ImageCacheKeySet;
+    typedef HashMap<const ImageFrameGenerator*, ImageCacheKeySet> ImageCacheKeyMap;
+    ImageCacheKeyMap m_imageCacheKeyMap;
+
+    // A lookup table to map ImageFrameGenerator to all associated
+    // decoder cache keys.
+    typedef HashSet<DecoderCacheKey> DecoderCacheKeySet;
+    typedef HashMap<const ImageFrameGenerator*, DecoderCacheKeySet> DecoderCacheKeyMap;
+    DecoderCacheKeyMap m_decoderCacheKeyMap;
 
     size_t m_cacheLimitInBytes;
     size_t m_memoryUsageInBytes;
 
     // Protect concurrent access to these members:
     //   m_orderedCacheList
-    //   m_cacheMap and all CacheEntrys stored in it
-    //   m_cachedSizeMap
+    //   m_imageCacheMap, m_decoderCacheMap and all CacheEntrys stored in it
+    //   m_imageCacheKeyMap
+    //   m_decoderCacheKeyMap
     //   m_cacheLimitInBytes
     //   m_memoryUsageInBytes
     // This mutex also protects calls to underlying skBitmap's
diff --git a/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp b/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp
index b97ac77..997f3fa 100644
--- a/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp
+++ b/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp
@@ -69,7 +69,7 @@
     }
 
 protected:
-    PassOwnPtr<ScaledImageFragment> createCompleteImage(const SkISize& size, bool discardable = false)
+    PassOwnPtr<ScaledImageFragment> createCompleteImage(const SkISize& size, bool discardable = false, size_t index = 0)
     {
         SkBitmap bitmap;
         bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
@@ -77,10 +77,10 @@
             bitmap.allocPixels();
         else
             bitmap.setPixelRef(new MockDiscardablePixelRef())->unref();
-        return ScaledImageFragment::create(size, bitmap, true);
+        return ScaledImageFragment::createComplete(size, index, bitmap);
     }
 
-    PassOwnPtr<ScaledImageFragment> createIncompleteImage(const SkISize& size, bool discardable = false)
+    PassOwnPtr<ScaledImageFragment> createIncompleteImage(const SkISize& size, bool discardable = false, size_t generation = 0)
     {
         SkBitmap bitmap;
         bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
@@ -88,7 +88,7 @@
             bitmap.allocPixels();
         else
             bitmap.setPixelRef(new MockDiscardablePixelRef())->unref();
-        return ScaledImageFragment::create(size, bitmap, false);
+        return ScaledImageFragment::createPartial(size, 0, generation, bitmap);
     }
 
     void insertCache(const SkISize& size)
@@ -98,10 +98,10 @@
         unlockCache(image);
     }
 
-    const ScaledImageFragment* lockCache(const SkISize& size)
+    const ScaledImageFragment* lockCache(const SkISize& size, size_t index = 0)
     {
         const ScaledImageFragment* cachedImage = 0;
-        if (ImageDecodingStore::instance()->lockCache(m_generator.get(), size, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage))
+        if (ImageDecodingStore::instance()->lockCache(m_generator.get(), size, index, &cachedImage))
             return cachedImage;
         return 0;
     }
@@ -235,63 +235,187 @@
     insertCache(SkISize::Make(1, 1));
     insertCache(SkISize::Make(2, 2));
     insertCache(SkISize::Make(3, 3));
-    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+    OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this);
+    decoder->setSize(1, 1);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder.release(), false);
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->cacheEntries());
 
     m_generator.clear();
     EXPECT_FALSE(ImageDecodingStore::instance()->cacheEntries());
 }
 
-TEST_F(ImageDecodingStoreTest, insertIncompleteCache)
+TEST_F(ImageDecodingStoreTest, insertDecoder)
 {
     const SkISize size = SkISize::Make(1, 1);
-    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(
-        m_generator.get(), createIncompleteImage(size), MockImageDecoder::create(this));
+    OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this);
+    decoder->setSize(1, 1);
+    const ImageDecoder* refDecoder = decoder.get();
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder.release(), false);
     EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    unlockCache(cachedImage);
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->memoryUsageInBytes());
 
-    ImageDecoder* decoder = 0;
-    EXPECT_TRUE(ImageDecodingStore::instance()->lockCache(m_generator.get(), size, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage, &decoder));
-    EXPECT_TRUE(decoder);
-    ASSERT_TRUE(cachedImage);
-    EXPECT_FALSE(cachedImage->isComplete());
-    unlockCache(cachedImage);
-    EXPECT_EQ(0, m_decodersDestroyed);
+    ImageDecoder* testDecoder;
+    EXPECT_TRUE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), size, &testDecoder));
+    EXPECT_TRUE(testDecoder);
+    EXPECT_EQ(refDecoder, testDecoder);
+    ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), testDecoder);
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
 }
 
-TEST_F(ImageDecodingStoreTest, insertCompleteCacheWithDecoder)
+TEST_F(ImageDecodingStoreTest, evictDecoder)
 {
-    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(
-        m_generator.get(), createCompleteImage(SkISize::Make(1, 1)), MockImageDecoder::create(this));
-    unlockCache(cachedImage);
+    OwnPtr<ImageDecoder> decoder1 = MockImageDecoder::create(this);
+    OwnPtr<ImageDecoder> decoder2 = MockImageDecoder::create(this);
+    OwnPtr<ImageDecoder> decoder3 = MockImageDecoder::create(this);
+    decoder1->setSize(1, 1);
+    decoder2->setSize(2, 2);
+    decoder3->setSize(3, 3);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder1.release(), false);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder2.release(), false);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder3.release(), false);
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(56u, ImageDecodingStore::instance()->memoryUsageInBytes());
+
+    evictOneCache();
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(52u, ImageDecodingStore::instance()->memoryUsageInBytes());
+
+    evictOneCache();
     EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    EXPECT_EQ(1, m_decodersDestroyed);
+    EXPECT_EQ(36u, ImageDecodingStore::instance()->memoryUsageInBytes());
+
+    evictOneCache();
+    EXPECT_FALSE(ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_FALSE(ImageDecodingStore::instance()->memoryUsageInBytes());
 }
 
-TEST_F(ImageDecodingStoreTest, incompleteCacheBecomesComplete)
+TEST_F(ImageDecodingStoreTest, decoderInUseNotEvicted)
+{
+    OwnPtr<ImageDecoder> decoder1 = MockImageDecoder::create(this);
+    OwnPtr<ImageDecoder> decoder2 = MockImageDecoder::create(this);
+    OwnPtr<ImageDecoder> decoder3 = MockImageDecoder::create(this);
+    decoder1->setSize(1, 1);
+    decoder2->setSize(2, 2);
+    decoder3->setSize(3, 3);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder1.release(), false);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder2.release(), false);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder3.release(), false);
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+
+    ImageDecoder* testDecoder;
+    EXPECT_TRUE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), SkISize::Make(2, 2), &testDecoder));
+
+    evictOneCache();
+    evictOneCache();
+    evictOneCache();
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(16u, ImageDecodingStore::instance()->memoryUsageInBytes());
+
+    ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), testDecoder);
+    evictOneCache();
+    EXPECT_FALSE(ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_FALSE(ImageDecodingStore::instance()->memoryUsageInBytes());
+}
+
+TEST_F(ImageDecodingStoreTest, removeDecoder)
 {
     const SkISize size = SkISize::Make(1, 1);
-    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(
-        m_generator.get(), createIncompleteImage(size), MockImageDecoder::create(this));
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), cachedImage);
+    OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this);
+    decoder->setSize(1, 1);
+    const ImageDecoder* refDecoder = decoder.get();
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder.release(), false);
     EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->memoryUsageInBytes());
 
-    ImageDecoder* decoder = 0;
-    EXPECT_TRUE(ImageDecodingStore::instance()->lockCache(m_generator.get(), size, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage, &decoder));
-    EXPECT_TRUE(decoder);
-    ASSERT_TRUE(cachedImage);
-    EXPECT_FALSE(cachedImage->isComplete());
+    ImageDecoder* testDecoder;
+    EXPECT_TRUE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), size, &testDecoder));
+    EXPECT_TRUE(testDecoder);
+    EXPECT_EQ(refDecoder, testDecoder);
+    ImageDecodingStore::instance()->removeDecoder(m_generator.get(), testDecoder);
+    EXPECT_FALSE(ImageDecodingStore::instance()->cacheEntries());
 
-    cachedImage = ImageDecodingStore::instance()->overwriteAndLockCache(
-        m_generator.get(), cachedImage, createCompleteImage(size));
-    EXPECT_TRUE(cachedImage->isComplete());
-    EXPECT_EQ(1, m_decodersDestroyed);
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), cachedImage);
+    EXPECT_FALSE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), size, &testDecoder));
+}
+
+TEST_F(ImageDecodingStoreTest, multipleIndex)
+{
+    const SkISize size = SkISize::Make(1, 1);
+    const ScaledImageFragment* refImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createCompleteImage(size, false, 0));
+    unlockCache(refImage);
+    const ScaledImageFragment* testImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createCompleteImage(size, false, 1));
+    unlockCache(testImage);
+    EXPECT_NE(refImage, testImage);
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+
+    EXPECT_TRUE(ImageDecodingStore::instance()->lockCache(m_generator.get(), size, 1, &refImage));
+    EXPECT_EQ(refImage, testImage);
+    unlockCache(refImage);
+}
+
+TEST_F(ImageDecodingStoreTest, finalAndPartialImage)
+{
+    const SkISize size = SkISize::Make(1, 1);
+    const ScaledImageFragment* refImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createCompleteImage(size, false, 0));
+    unlockCache(refImage);
+    const ScaledImageFragment* testImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, false, 1));
+    unlockCache(testImage);
+    EXPECT_NE(refImage, testImage);
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+
+    EXPECT_TRUE(ImageDecodingStore::instance()->lockCache(m_generator.get(), size, 0, &refImage));
+    EXPECT_NE(refImage, testImage);
+    unlockCache(refImage);
+}
+
+TEST_F(ImageDecodingStoreTest, insertNoGenerationCollision)
+{
+    const SkISize size = SkISize::Make(1, 1);
+    const ScaledImageFragment* refImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, false, 1));
+    unlockCache(refImage);
+    const ScaledImageFragment* testImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, false, 2));
+    unlockCache(testImage);
+    EXPECT_NE(refImage, testImage);
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+}
+
+TEST_F(ImageDecodingStoreTest, insertGenerationCollision)
+{
+    const SkISize size = SkISize::Make(1, 1);
+    const ScaledImageFragment* refImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, false, 1));
+    unlockCache(refImage);
+    const ScaledImageFragment* testImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, false, 1));
+    unlockCache(testImage);
+    EXPECT_EQ(refImage, testImage);
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+}
+
+TEST_F(ImageDecodingStoreTest, insertGenerationCollisionAfterMemoryDiscarded)
+{
+    const SkISize size = SkISize::Make(1, 1);
+    const ScaledImageFragment* refImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, true, 1));
+    unlockCache(refImage);
+    MockDiscardablePixelRef* pixelRef = static_cast<MockDiscardablePixelRef*>(refImage->bitmap().pixelRef());
+    pixelRef->discard();
+    const ScaledImageFragment* testImage = ImageDecodingStore::instance()->insertAndLockCache(
+        m_generator.get(), createIncompleteImage(size, false, 1));
+    unlockCache(testImage);
+    EXPECT_NE(refImage, testImage);
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
 }
 
 TEST_F(ImageDecodingStoreTest, lockCacheFailedAfterMemoryDiscarded)
 {
     const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(
-        m_generator.get(), createCompleteImage(SkISize::Make(1, 1), true), MockImageDecoder::create(this));
+        m_generator.get(), createCompleteImage(SkISize::Make(1, 1), true));
     unlockCache(cachedImage);
     MockDiscardablePixelRef* pixelRef = static_cast<MockDiscardablePixelRef*>(cachedImage->bitmap().pixelRef());
     pixelRef->discard();
@@ -299,56 +423,17 @@
     EXPECT_EQ(0u, ImageDecodingStore::instance()->cacheEntries());
 }
 
-TEST_F(ImageDecodingStoreTest, overwriteNonDiscardableCacheWithDiscardable)
-{
-
-    const SkISize size = SkISize::Make(1, 1);
-    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(
-        m_generator.get(), createIncompleteImage(size), MockImageDecoder::create(this));
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), cachedImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    EXPECT_LT(0u, ImageDecodingStore::instance()->memoryUsageInBytes());
-
-    ImageDecoder* decoder = 0;
-    EXPECT_TRUE(ImageDecodingStore::instance()->lockCache(m_generator.get(), size, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage, &decoder));
-    EXPECT_FALSE(cachedImage->isComplete());
-
-    cachedImage = ImageDecodingStore::instance()->overwriteAndLockCache(
-        m_generator.get(), cachedImage, createCompleteImage(size, true));
-    EXPECT_TRUE(cachedImage->isComplete());
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    EXPECT_EQ(0u, ImageDecodingStore::instance()->memoryUsageInBytes());
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), cachedImage);
-}
-
-TEST_F(ImageDecodingStoreTest, overwriteDiscardableCacheWithNonDiscardable)
-{
-
-    const SkISize size = SkISize::Make(1, 1);
-    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(
-        m_generator.get(), createIncompleteImage(size, true), MockImageDecoder::create(this));
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), cachedImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    EXPECT_EQ(0u, ImageDecodingStore::instance()->memoryUsageInBytes());
-
-    ImageDecoder* decoder = 0;
-    EXPECT_TRUE(ImageDecodingStore::instance()->lockCache(m_generator.get(), size, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage, &decoder));
-    EXPECT_FALSE(cachedImage->isComplete());
-
-    cachedImage = ImageDecodingStore::instance()->overwriteAndLockCache(
-        m_generator.get(), cachedImage, createCompleteImage(size));
-    EXPECT_TRUE(cachedImage->isComplete());
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    EXPECT_LT(0u, ImageDecodingStore::instance()->memoryUsageInBytes());
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), cachedImage);
-}
-
 TEST_F(ImageDecodingStoreTest, clear)
 {
     insertCache(SkISize::Make(1, 1));
     insertCache(SkISize::Make(2, 2));
     EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
 
+    OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this);
+    decoder->setSize(1, 1);
+    ImageDecodingStore::instance()->insertDecoder(m_generator.get(), decoder.release(), false);
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+
     ImageDecodingStore::instance()->clear();
     EXPECT_EQ(0u, ImageDecodingStore::instance()->cacheEntries());
 }
diff --git a/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp b/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp
index 6304966..e5027cb 100644
--- a/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp
+++ b/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp
@@ -29,6 +29,7 @@
 
 #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"
@@ -50,7 +51,7 @@
     : m_fullSize(fullSize)
     , m_decodeFailedAndEmpty(false)
     , m_hasAlpha(true)
-    , m_decodeCount(0)
+    , m_decodeCount(ScaledImageFragment::FirstPartialImage)
 {
     setData(data.get(), allDataReceived);
 }
@@ -91,7 +92,7 @@
     if (cachedImage)
         return cachedImage;
 
-    TRACE_EVENT2("webkit", "ImageFrameGenerator::decodeAndScale", "generator", this, "decodeCount", ++m_decodeCount);
+    TRACE_EVENT2("webkit", "ImageFrameGenerator::decodeAndScale", "generator", this, "decodeCount", static_cast<int>(m_decodeCount));
 
     cachedImage = tryToScale(0, scaledSize);
     if (cachedImage)
@@ -110,7 +111,7 @@
 const ScaledImageFragment* ImageFrameGenerator::tryToLockCompleteCache(const SkISize& scaledSize)
 {
     const ScaledImageFragment* cachedImage = 0;
-    if (ImageDecodingStore::instance()->lockCache(this, scaledSize, ImageDecodingStore::CacheMustBeComplete, &cachedImage))
+    if (ImageDecodingStore::instance()->lockCache(this, scaledSize, 0, &cachedImage))
         return cachedImage;
     return 0;
 }
@@ -124,26 +125,21 @@
     if (scaledSize == m_fullSize)
         return 0;
 
-    if (!fullSizeImage && !ImageDecodingStore::instance()->lockCache(this, m_fullSize, ImageDecodingStore::CacheMustBeComplete, &fullSizeImage))
+    if (!fullSizeImage && !ImageDecodingStore::instance()->lockCache(this, m_fullSize, 0, &fullSizeImage))
         return 0;
 
-    DiscardablePixelRefAllocator allocator;
     // This call allocates the DiscardablePixelRef and lock/unlocks it
     // afterwards. So the memory allocated to the scaledBitmap can be
     // discarded after this call. Need to lock the scaledBitmap and
     // check the pixels before using it next time.
-    SkBitmap scaledBitmap = skia::ImageOperations::Resize(fullSizeImage->bitmap(), resizeMethod(), scaledSize.width(), scaledSize.height(), &allocator);
+    SkBitmap scaledBitmap = skia::ImageOperations::Resize(fullSizeImage->bitmap(), resizeMethod(), scaledSize.width(), scaledSize.height(), &m_allocator);
 
-    OwnPtr<ScaledImageFragment> scaledImage = ScaledImageFragment::create(scaledSize, scaledBitmap, fullSizeImage->isComplete());
-
+    OwnPtr<ScaledImageFragment> scaledImage;
+    if (fullSizeImage->isComplete())
+        scaledImage = ScaledImageFragment::createComplete(scaledSize, fullSizeImage->index(), scaledBitmap);
+    else
+        scaledImage = ScaledImageFragment::createPartial(scaledSize, fullSizeImage->index(), nextGenerationId(), scaledBitmap);
     ImageDecodingStore::instance()->unlockCache(this, fullSizeImage);
-
-    const ScaledImageFragment* cachedImage = 0;
-
-    // If a cache lookup is successful then the cache entry must be incomplete
-    // therefore it is safe to overwrite.
-    if (ImageDecodingStore::instance()->lockCache(this, scaledSize, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage))
-        return ImageDecodingStore::instance()->overwriteAndLockCache(this, cachedImage, scaledImage.release());
     return ImageDecodingStore::instance()->insertAndLockCache(this, scaledImage.release());
 }
 
@@ -151,17 +147,22 @@
 {
     TRACE_EVENT0("webkit", "ImageFrameGenerator::tryToResumeDecodeAndScale");
 
-    const ScaledImageFragment* cachedImage = 0;
     ImageDecoder* cachedDecoder = 0;
-    if (!ImageDecodingStore::instance()->lockCache(this, m_fullSize, ImageDecodingStore::CacheCanBeIncomplete, &cachedImage, &cachedDecoder))
+
+    if (!ImageDecodingStore::instance()->lockDecoder(this, m_fullSize, &cachedDecoder))
         return 0;
     ASSERT(cachedDecoder);
 
-    if (m_data.hasNewData()) {
-        // Only do decoding if there is new data.
-        OwnPtr<ScaledImageFragment> fullSizeImage = decode(&cachedDecoder);
-        cachedImage = ImageDecodingStore::instance()->overwriteAndLockCache(this, cachedImage, fullSizeImage.release());
-    }
+    // Always generate a new image and insert it into cache.
+    OwnPtr<ScaledImageFragment> fullSizeImage = decode(&cachedDecoder);
+    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(this, fullSizeImage.release());
+
+    // If the image generated is complete then there is no need to keep
+    // the decoder.
+    if (cachedImage->isComplete())
+        ImageDecodingStore::instance()->removeDecoder(this, cachedDecoder);
+    else
+        ImageDecodingStore::instance()->unlockDecoder(this, cachedDecoder);
 
     if (m_fullSize == scaledSize)
         return cachedImage;
@@ -187,12 +188,16 @@
         return 0;
     }
 
-    const ScaledImageFragment* cachedFullSizeImage = ImageDecodingStore::instance()->insertAndLockCache(
-        this, fullSizeImage.release(), decoderContainer.release());
+    const ScaledImageFragment* cachedImage = ImageDecodingStore::instance()->insertAndLockCache(this, fullSizeImage.release());
+
+    // If image is complete then decoder is not needed in the future.
+    // Otherwise save the decoder for later use.
+    if (!cachedImage->isComplete())
+        ImageDecodingStore::instance()->insertDecoder(this, decoderContainer.release(), DiscardablePixelRef::isDiscardable(cachedImage->bitmap().pixelRef()));
 
     if (m_fullSize == scaledSize)
-        return cachedFullSizeImage;
-    return tryToScale(cachedFullSizeImage, scaledSize);
+        return cachedImage;
+    return tryToScale(cachedImage, scaledSize);
 }
 
 PassOwnPtr<ScaledImageFragment> ImageFrameGenerator::decode(ImageDecoder** decoder)
@@ -230,7 +235,7 @@
     if (!frame || frame->status() == ImageFrame::FrameEmpty)
         return nullptr;
 
-    bool isComplete = frame->status() == ImageFrame::FrameComplete;
+    const bool isComplete = frame->status() == ImageFrame::FrameComplete;
     SkBitmap fullSizeBitmap = frame->getSkBitmap();
     {
         MutexLocker lock(m_alphaMutex);
@@ -238,7 +243,14 @@
     }
     ASSERT(fullSizeBitmap.width() == m_fullSize.width() && fullSizeBitmap.height() == m_fullSize.height());
 
-    return ScaledImageFragment::create(m_fullSize, fullSizeBitmap, isComplete);
+    if (isComplete)
+        return ScaledImageFragment::createComplete(m_fullSize, 0, fullSizeBitmap);
+
+    // If the image is partial we need to return a copy. This is to avoid future
+    // decode operations writing to the same bitmap.
+    SkBitmap copyBitmap;
+    fullSizeBitmap.copyTo(&copyBitmap, fullSizeBitmap.config(), &m_allocator);
+    return ScaledImageFragment::createPartial(m_fullSize, 0, nextGenerationId(), copyBitmap);
 }
 
 bool ImageFrameGenerator::hasAlpha()
diff --git a/Source/core/platform/graphics/chromium/ImageFrameGenerator.h b/Source/core/platform/graphics/chromium/ImageFrameGenerator.h
index ae9bdb9..4c8be42 100644
--- a/Source/core/platform/graphics/chromium/ImageFrameGenerator.h
+++ b/Source/core/platform/graphics/chromium/ImageFrameGenerator.h
@@ -84,11 +84,16 @@
     // Use the given decoder to decode. If a decoder is not given then try to create one.
     PassOwnPtr<ScaledImageFragment> decode(ImageDecoder**);
 
+    // Return the next generation ID of a new image object. This is used
+    // to identify images of the same frame from different stages of
+    // progressive decode.
+    size_t nextGenerationId() { return m_decodeCount++; }
+
     SkISize m_fullSize;
     ThreadSafeDataTransport m_data;
     bool m_decodeFailedAndEmpty;
     bool m_hasAlpha;
-    int m_decodeCount;
+    size_t m_decodeCount;
     DiscardablePixelRefAllocator m_allocator;
 
     OwnPtr<ImageDecoderFactory> m_imageDecoderFactory;
diff --git a/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp b/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp
index 6cdcc04..7335763 100644
--- a/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp
+++ b/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp
@@ -101,7 +101,7 @@
         SkBitmap bitmap;
         bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
         bitmap.allocPixels();
-        return ScaledImageFragment::create(size, bitmap, true);
+        return ScaledImageFragment::createComplete(size, 0, bitmap);
     }
 
     void addNewData()
@@ -201,32 +201,18 @@
     EXPECT_FALSE(tempImage->isComplete());
     EXPECT_EQ(1, m_frameBufferRequestCount);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     addNewData();
     tempImage = m_generator->decodeAndScale(fullSize());
     EXPECT_FALSE(tempImage->isComplete());
     EXPECT_EQ(2, m_frameBufferRequestCount);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-    EXPECT_EQ(0, m_decodersDestroyed);
-}
-
-TEST_F(ImageFrameGeneratorTest, cacheMissWithIncompleteDecodeNoNewData)
-{
-    setFrameStatus(ImageFrame::FramePartial);
-
-    const ScaledImageFragment* tempImage= m_generator->decodeAndScale(fullSize());
-    EXPECT_FALSE(tempImage->isComplete());
-    EXPECT_EQ(1, m_frameBufferRequestCount);
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
-
-    tempImage = m_generator->decodeAndScale(fullSize());
-    EXPECT_FALSE(tempImage->isComplete());
-    EXPECT_EQ(1, m_frameBufferRequestCount);
-    ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
     EXPECT_EQ(0, m_decodersDestroyed);
 }
 
@@ -238,14 +224,18 @@
     EXPECT_FALSE(tempImage->isComplete());
     EXPECT_EQ(1, m_frameBufferRequestCount);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     addNewData();
     tempImage = m_generator->decodeAndScale(scaledSize());
     EXPECT_FALSE(tempImage->isComplete());
     EXPECT_EQ(2, m_frameBufferRequestCount);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(5u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
     EXPECT_EQ(0, m_decodersDestroyed);
 }
 
@@ -258,7 +248,9 @@
     EXPECT_EQ(1, m_frameBufferRequestCount);
     EXPECT_EQ(0, m_decodersDestroyed);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     setFrameStatus(ImageFrame::FrameComplete);
     addNewData();
@@ -268,7 +260,9 @@
     EXPECT_EQ(2, m_frameBufferRequestCount);
     EXPECT_EQ(1, m_decodersDestroyed);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(0u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     tempImage = m_generator->decodeAndScale(fullSize());
     EXPECT_TRUE(tempImage->isComplete());
@@ -285,7 +279,9 @@
     EXPECT_EQ(1, m_frameBufferRequestCount);
     EXPECT_EQ(0, m_decodersDestroyed);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     setFrameStatus(ImageFrame::FrameComplete);
     addNewData();
@@ -295,7 +291,9 @@
     EXPECT_EQ(2, m_frameBufferRequestCount);
     EXPECT_EQ(1, m_decodersDestroyed);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(0u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     tempImage = m_generator->decodeAndScale(scaledSize());
     EXPECT_TRUE(tempImage->isComplete());
@@ -324,7 +322,9 @@
     EXPECT_EQ(1, m_frameBufferRequestCount);
     EXPECT_EQ(0, m_decodersDestroyed);
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     // Frame can now be decoded completely.
     setFrameStatus(ImageFrame::FrameComplete);
@@ -334,7 +334,9 @@
 
     EXPECT_EQ(2, m_frameBufferRequestCount);
     EXPECT_EQ(1, m_decodersDestroyed);
-    EXPECT_EQ(1u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(2u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(0u, ImageDecodingStore::instance()->decoderCacheEntries());
 
     tempImage = m_generator->decodeAndScale(fullSize());
     EXPECT_TRUE(tempImage->isComplete());
@@ -342,4 +344,48 @@
     ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
 }
 
+TEST_F(ImageFrameGeneratorTest, concurrentIncompleteDecodeAndScale)
+{
+    setFrameStatus(ImageFrame::FramePartial);
+
+    const ScaledImageFragment* fullImage = m_generator->decodeAndScale(fullSize());
+    const ScaledImageFragment* scaledImage = m_generator->decodeAndScale(scaledSize());
+    EXPECT_FALSE(fullImage->isComplete());
+    EXPECT_FALSE(scaledImage->isComplete());
+    EXPECT_EQ(2, m_frameBufferRequestCount);
+    ImageDecodingStore::instance()->unlockCache(m_generator.get(), fullImage);
+    ImageDecodingStore::instance()->unlockCache(m_generator.get(), scaledImage);
+    EXPECT_EQ(4u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(3u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(1u, ImageDecodingStore::instance()->decoderCacheEntries());
+    EXPECT_EQ(0, m_decodersDestroyed);
+
+    addNewData();
+    setFrameStatus(ImageFrame::FrameComplete);
+    scaledImage = m_generator->decodeAndScale(scaledSize());
+    EXPECT_TRUE(scaledImage->isComplete());
+    EXPECT_EQ(3, m_frameBufferRequestCount);
+    ImageDecodingStore::instance()->unlockCache(m_generator.get(), scaledImage);
+    EXPECT_EQ(5u, ImageDecodingStore::instance()->cacheEntries());
+    EXPECT_EQ(5u, ImageDecodingStore::instance()->imageCacheEntries());
+    EXPECT_EQ(0u, ImageDecodingStore::instance()->decoderCacheEntries());
+    EXPECT_EQ(1, m_decodersDestroyed);
+}
+
+TEST_F(ImageFrameGeneratorTest, incompleteBitmapCopied)
+{
+    setFrameStatus(ImageFrame::FramePartial);
+
+    const ScaledImageFragment* tempImage= m_generator->decodeAndScale(fullSize());
+    EXPECT_FALSE(tempImage->isComplete());
+    EXPECT_EQ(1, m_frameBufferRequestCount);
+
+    ImageDecoder* tempDecoder = 0;
+    EXPECT_TRUE(ImageDecodingStore::instance()->lockDecoder(m_generator.get(), fullSize(), &tempDecoder));
+    ASSERT_TRUE(tempDecoder);
+    EXPECT_NE(tempDecoder->frameBufferAtIndex(0)->getSkBitmap().getPixels(), tempImage->bitmap().getPixels());
+    ImageDecodingStore::instance()->unlockCache(m_generator.get(), tempImage);
+    ImageDecodingStore::instance()->unlockDecoder(m_generator.get(), tempDecoder);
+}
+
 } // namespace
diff --git a/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp b/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp
index 076c2f7..d4f704b 100644
--- a/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp
+++ b/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp
@@ -79,7 +79,7 @@
     m_mutex.lock();
     ASSERT(!m_lockedCachedImage);
 
-    if (!ImageDecodingStore::instance()->lockCache(m_frameGenerator.get(), m_scaledSize, ImageDecodingStore::CacheMustBeComplete, &m_lockedCachedImage))
+    if (!ImageDecodingStore::instance()->lockCache(m_frameGenerator.get(), m_scaledSize, 0, &m_lockedCachedImage))
         m_lockedCachedImage = 0;
 
     // Use ImageFrameGenerator to generate the image. It will lock the cache
@@ -113,7 +113,7 @@
 
 bool LazyDecodingPixelRef::MaybeDecoded()
 {
-    return ImageDecodingStore::instance()->isCached(m_frameGenerator.get(), m_scaledSize);
+    return ImageDecodingStore::instance()->isCached(m_frameGenerator.get(), m_scaledSize, 0);
 }
 
 bool LazyDecodingPixelRef::PrepareToDecode(const LazyPixelRef::PrepareParams& params)
@@ -121,7 +121,7 @@
     // TODO: check if only a particular rect is available in image cache.
     UNUSED_PARAM(params);
     const ScaledImageFragment* cachedImage = 0;
-    bool cached = ImageDecodingStore::instance()->lockCache(m_frameGenerator.get(), m_scaledSize, ImageDecodingStore::CacheMustBeComplete, &cachedImage);
+    bool cached = ImageDecodingStore::instance()->lockCache(m_frameGenerator.get(), m_scaledSize, 0, &cachedImage);
     if (cached)
         ImageDecodingStore::instance()->unlockCache(m_frameGenerator.get(), cachedImage);
     return cached;
diff --git a/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp b/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp
index bf62235..7ac1349 100644
--- a/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp
+++ b/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp
@@ -26,6 +26,7 @@
 
 #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"
@@ -54,6 +55,9 @@
     context.setCertainlyOpaque(m_opaque);
     context.setShouldSmoothFonts(canPaintLCDText);
 
+    if (*EventTracer::getTraceCategoryEnabledFlag("blink.graphics_context_annotations"))
+        context.setAnnotationMode(AnnotateAll);
+
     // Record transform prior to painting, as all opaque tracking will be
     // relative to this current value.
     AffineTransform canvasToContentTransform = context.getCTM().inverse();
diff --git a/Source/core/platform/graphics/chromium/ScaledImageFragment.cpp b/Source/core/platform/graphics/chromium/ScaledImageFragment.cpp
index ebd5ef4..fb9c2c4 100644
--- a/Source/core/platform/graphics/chromium/ScaledImageFragment.cpp
+++ b/Source/core/platform/graphics/chromium/ScaledImageFragment.cpp
@@ -33,10 +33,11 @@
 {
 }
 
-ScaledImageFragment::ScaledImageFragment(const SkISize& scaledSize, const SkBitmap& bitmap, const bool isComplete)
+ScaledImageFragment::ScaledImageFragment(const SkISize& scaledSize, size_t index, size_t generation, const SkBitmap& bitmap)
     : m_scaledSize(scaledSize)
+    , m_index(index)
+    , m_generation(generation)
     , m_bitmap(bitmap)
-    , m_isComplete(isComplete)
 {
 }
 
diff --git a/Source/core/platform/graphics/chromium/ScaledImageFragment.h b/Source/core/platform/graphics/chromium/ScaledImageFragment.h
index 00a22b5..4bbc417 100644
--- a/Source/core/platform/graphics/chromium/ScaledImageFragment.h
+++ b/Source/core/platform/graphics/chromium/ScaledImageFragment.h
@@ -37,24 +37,36 @@
 // ScaledImageFragment is a scaled version of an image.
 class ScaledImageFragment {
 public:
-    static PassOwnPtr<ScaledImageFragment> create(const SkISize& scaledSize, const SkBitmap& bitmap, bool isComplete)
+    enum ImageGeneration {
+        CompleteImage = 0,
+        FirstPartialImage = 1,
+    };
+
+    static PassOwnPtr<ScaledImageFragment> createComplete(const SkISize& scaledSize, size_t index, const SkBitmap& bitmap)
     {
-        return adoptPtr(new ScaledImageFragment(scaledSize, bitmap, isComplete));
+        return adoptPtr(new ScaledImageFragment(scaledSize, index, CompleteImage, bitmap));
     }
 
-    ScaledImageFragment(const SkISize&, const SkBitmap&, bool isComplete);
+    static PassOwnPtr<ScaledImageFragment> createPartial(const SkISize& scaledSize, size_t index, size_t generation, const SkBitmap& bitmap)
+    {
+        return adoptPtr(new ScaledImageFragment(scaledSize, index, generation, bitmap));
+    }
+
+    ScaledImageFragment(const SkISize&, size_t index, size_t generation, const SkBitmap&);
     ~ScaledImageFragment();
 
     const SkISize& scaledSize() const { return m_scaledSize; }
+    size_t index() const { return m_index; }
+    size_t generation() const { return m_generation; }
+    bool isComplete() const { return m_generation == CompleteImage; }
     const SkBitmap& bitmap() const { return m_bitmap; }
     SkBitmap& bitmap() { return m_bitmap; }
-    bool isComplete() const { return m_isComplete; }
-    void setIsComplete() { m_isComplete = true; }
 
 private:
     SkISize m_scaledSize;
+    size_t m_index;
+    size_t m_generation;
     SkBitmap m_bitmap;
-    bool m_isComplete;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelper.cpp b/Source/core/platform/graphics/chromium/UniscribeHelper.cpp
index b35f675..79b01b8 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelper.cpp
+++ b/Source/core/platform/graphics/chromium/UniscribeHelper.cpp
@@ -657,6 +657,13 @@
                                           &shaping.m_logs[0], &charProps[0],
                                           &shaping.m_glyphs[0], &glyphProps[0],
                                           &generatedGlyphs);
+            if (SUCCEEDED(hr)) {
+                // If we use ScriptShapeOpenType(), visual attributes
+                // information for each characters are stored in
+                // |glyphProps[i].sva|.
+                for (int i = 0; i < generatedGlyphs; ++i)
+                    memcpy(&shaping.m_visualAttributes[i], &glyphProps[i].sva, sizeof(SCRIPT_VISATTR));
+            }
         } else {
             hr = ScriptShape(m_cachedDC, scriptCache, input, itemLength,
                              numGlyphs, &run.a,
@@ -754,12 +761,6 @@
   cleanup:
     shaping.m_glyphs.resize(generatedGlyphs);
     shaping.m_visualAttributes.resize(generatedGlyphs);
-    // If we use ScriptShapeOpenType(), visual attributes information for each
-    // characters are stored in |glyphProps[i].sva|.
-    if (gScriptShapeOpenTypeFunc) {
-        for (int i = 0; i < generatedGlyphs; ++i)
-            memcpy(&shaping.m_visualAttributes[i], &glyphProps[i].sva, sizeof(SCRIPT_VISATTR));
-    }
     shaping.m_advance.resize(generatedGlyphs);
     shaping.m_offsets.resize(generatedGlyphs);
 
@@ -1026,13 +1027,19 @@
 {
     for (int i = 0; i < shaping.charLength(); i++) {
         UChar c = m_input[run.iCharPos + i];
-        // Skip zero-width space characters because they're not considered to be missing in a font.
+        // Skip zero-width space characters because they're not considered to
+        // be missing in a font.
         if (Font::treatAsZeroWidthSpaceInComplexScript(c))
             continue;
         int glyphIndex = shaping.m_logs[i];
         WORD glyph = shaping.m_glyphs[glyphIndex];
+        // Note on the thrid condition: Windows Vista sometimes returns glyphs
+        // equal to wgBlank (instead of wgDefault), with fZeroWidth set. Treat
+        // such cases as having missing glyphs if the corresponding character
+        // is not a zero width whitespace.
         if (glyph == properties->wgDefault
-            || (glyph == properties->wgInvalid && glyph != properties->wgBlank))
+            || (glyph == properties->wgInvalid && glyph != properties->wgBlank)
+            || (glyph == properties->wgBlank && shaping.m_visualAttributes[glyphIndex].fZeroWidth))
             return true;
     }
     return false;
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelper.h b/Source/core/platform/graphics/chromium/UniscribeHelper.h
index 03f0d95..8db169a 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelper.h
+++ b/Source/core/platform/graphics/chromium/UniscribeHelper.h
@@ -223,6 +223,11 @@
     // This is the default implementation and it does not do anything.
     virtual void tryToPreloadFont(HFONT) {}
 
+    // Let our subclasses provide the input lazily in case they can't compute
+    // it in their constructors. Once we have input, however, we don't let
+    // our subclasses change it.
+    void setInput(const UChar* input) { ASSERT(!m_input); m_input = input; }
+
 private:
     friend class UniscribeTest_TooBig_Test;
 
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp b/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp
index 49811fb..40ed69c 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp
+++ b/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp
@@ -40,7 +40,7 @@
 
 UniscribeHelperTextRun::UniscribeHelperTextRun(const TextRun& run,
                                                const Font& font)
-    : UniscribeHelper(run.characters16(), run.length(), run.rtl(),
+    : UniscribeHelper(0, run.length(), run.rtl(),
                       font.primaryFont()->platformData().hfont(),
                       font.primaryFont()->platformData().scriptCache(),
                       font.primaryFont()->platformData().scriptFontProperties(),
@@ -48,6 +48,13 @@
     , m_font(&font)
     , m_fontIndex(0)
 {
+    if (run.is8Bit()) {
+        m_stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
+        setInput(m_stringFor8BitRun.characters16());
+    } else {
+        setInput(run.characters16());
+    }
+
     setDirectionalOverride(run.directionalOverride());
     setLetterSpacing(font.letterSpacing());
     setSpaceWidth(font.spaceWidth());
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.h b/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.h
index af65457..1cc2d25 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.h
+++ b/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.h
@@ -32,6 +32,7 @@
 #define UniscribeHelperTextRun_h
 
 #include "core/platform/graphics/chromium/UniscribeHelper.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -77,6 +78,10 @@
     // This pointer can be NULL for no font fallback handling.
     const Font* m_font;
 
+    // When we have an 8 bit TestRun, we store the buffer of upconverted characters
+    // in this string.
+    String m_stringFor8BitRun;
+
     // It's rare that many fonts are listed in stylesheets.
     // Four would be large enough in most cases.
     const static size_t kNumberOfFonts = 4;
diff --git a/Source/core/platform/graphics/filters/FEBlend.cpp b/Source/core/platform/graphics/filters/FEBlend.cpp
index 6f275ca..4df9e5c 100644
--- a/Source/core/platform/graphics/filters/FEBlend.cpp
+++ b/Source/core/platform/graphics/filters/FEBlend.cpp
@@ -35,7 +35,7 @@
 #include <wtf/Uint8ClampedArray.h>
 
 #include "SkBitmapSource.h"
-#include "SkBlendImageFilter.h"
+#include "SkXfermodeImageFilter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
 
@@ -187,21 +187,21 @@
 #endif
 }
 
-static SkBlendImageFilter::Mode toSkiaMode(BlendModeType mode)
+static SkXfermode::Mode toSkiaMode(BlendModeType mode)
 {
     switch (mode) {
     case FEBLEND_MODE_NORMAL:
-        return SkBlendImageFilter::kNormal_Mode;
+        return SkXfermode::kSrcOver_Mode;
     case FEBLEND_MODE_MULTIPLY:
-        return SkBlendImageFilter::kMultiply_Mode;
+        return SkXfermode::kMultiply_Mode;
     case FEBLEND_MODE_SCREEN:
-        return SkBlendImageFilter::kScreen_Mode;
+        return SkXfermode::kScreen_Mode;
     case FEBLEND_MODE_DARKEN:
-        return SkBlendImageFilter::kDarken_Mode;
+        return SkXfermode::kDarken_Mode;
     case FEBLEND_MODE_LIGHTEN:
-        return SkBlendImageFilter::kLighten_Mode;
+        return SkXfermode::kLighten_Mode;
     default:
-        return SkBlendImageFilter::kNormal_Mode;
+        return SkXfermode::kSrcOver_Mode;
     }
 }
 
@@ -234,8 +234,8 @@
     SkBitmap backgroundBitmap = backgroundNativeImage->bitmap();
 
     SkAutoTUnref<SkImageFilter> backgroundSource(new SkBitmapSource(backgroundBitmap));
-    SkBlendImageFilter::Mode mode = toSkiaMode(m_mode);
-    SkAutoTUnref<SkImageFilter> blend(new SkBlendImageFilter(mode, backgroundSource));
+    SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(toSkiaMode(m_mode)));
+    SkAutoTUnref<SkImageFilter> blend(new SkXfermodeImageFilter(mode, backgroundSource));
     SkPaint paint;
     paint.setImageFilter(blend);
     resultImage->context()->drawBitmap(foregroundBitmap, 0, 0, &paint);
@@ -246,8 +246,8 @@
 {
     SkAutoTUnref<SkImageFilter> foreground(builder->build(inputEffect(0), operatingColorSpace()));
     SkAutoTUnref<SkImageFilter> background(builder->build(inputEffect(1), operatingColorSpace()));
-    SkBlendImageFilter::Mode mode = toSkiaMode(m_mode);
-    return new SkBlendImageFilter(mode, background, foreground);
+    SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(toSkiaMode(m_mode)));
+    return new SkXfermodeImageFilter(mode, background, foreground);
 }
 
 static TextStream& operator<<(TextStream& ts, const BlendModeType& type)
diff --git a/Source/core/platform/graphics/filters/FilterOperation.h b/Source/core/platform/graphics/filters/FilterOperation.h
index e200717..d296063 100644
--- a/Source/core/platform/graphics/filters/FilterOperation.h
+++ b/Source/core/platform/graphics/filters/FilterOperation.h
@@ -32,6 +32,7 @@
 #include "core/platform/graphics/LayoutSize.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/FilterEffect.h"
+#include "core/platform/graphics/filters/ReferenceFilter.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefCounted.h"
@@ -162,8 +163,8 @@
     CachedSVGDocumentReference* cachedSVGDocumentReference() const { return m_cachedSVGDocumentReference.get(); }
     void setCachedSVGDocumentReference(PassOwnPtr<CachedSVGDocumentReference> cachedSVGDocumentReference) { m_cachedSVGDocumentReference = cachedSVGDocumentReference; }
 
-    FilterEffect* filterEffect() const { return m_filterEffect.get(); }
-    void setFilterEffect(PassRefPtr<FilterEffect> filterEffect, PassRefPtr<Filter> filter) { m_filterEffect = filterEffect; m_filter = filter; }
+    ReferenceFilter* filter() const { return m_filter.get(); }
+    void setFilter(PassRefPtr<ReferenceFilter> filter) { m_filter = filter; }
 
 private:
 
@@ -185,8 +186,7 @@
     String m_url;
     String m_fragment;
     OwnPtr<CachedSVGDocumentReference> m_cachedSVGDocumentReference;
-    RefPtr<FilterEffect> m_filterEffect;
-    RefPtr<Filter> m_filter;
+    RefPtr<ReferenceFilter> m_filter;
 };
 
 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color matrix effect.
diff --git a/Source/core/platform/graphics/filters/FilterOperations.cpp b/Source/core/platform/graphics/filters/FilterOperations.cpp
index 8701482..6fd4491 100644
--- a/Source/core/platform/graphics/filters/FilterOperations.cpp
+++ b/Source/core/platform/graphics/filters/FilterOperations.cpp
@@ -142,9 +142,9 @@
         }
         case FilterOperation::REFERENCE: {
             ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
-            if (referenceOperation->filterEffect()) {
+            if (referenceOperation->filter() && referenceOperation->filter()->lastEffect()) {
                 FloatRect outsetRect(0, 0, 1, 1);
-                outsetRect = referenceOperation->filterEffect()->mapRectRecursive(outsetRect);
+                outsetRect = referenceOperation->filter()->lastEffect()->mapRectRecursive(outsetRect);
                 FilterOutsets outsets(
                     std::max(0.0f, -outsetRect.y()),
                     std::max(0.0f, outsetRect.x() + outsetRect.width() - 1),
diff --git a/Source/core/platform/graphics/filters/ReferenceFilter.cpp b/Source/core/platform/graphics/filters/ReferenceFilter.cpp
new file mode 100644
index 0000000..2b84dd5
--- /dev/null
+++ b/Source/core/platform/graphics/filters/ReferenceFilter.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2013 Adobe Systems Incorporated. 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 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.
+ */
+
+#include "config.h"
+
+#include "core/platform/graphics/filters/ReferenceFilter.h"
+
+#include "core/platform/graphics/filters/FilterEffect.h"
+#include "core/platform/graphics/filters/SourceGraphic.h"
+
+namespace WebCore {
+
+ReferenceFilter::ReferenceFilter()
+    : Filter(AffineTransform())
+    , m_sourceGraphic(SourceGraphic::create(this))
+{
+    // FIXME: This should come from the filter DOM node's filterRes attribute.
+    setFilterResolution(FloatSize(1, 1));
+}
+
+void ReferenceFilter::setLastEffect(PassRefPtr<FilterEffect> effect)
+{
+    m_lastEffect = effect;
+}
+
+ReferenceFilter::~ReferenceFilter()
+{
+}
+
+} // namespace WebCore
diff --git a/Source/core/platform/graphics/filters/ReferenceFilter.h b/Source/core/platform/graphics/filters/ReferenceFilter.h
new file mode 100644
index 0000000..7bc87dc
--- /dev/null
+++ b/Source/core/platform/graphics/filters/ReferenceFilter.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2013 Adobe Systems Incorporated. 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 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 ReferenceFilter_h
+#define ReferenceFilter_h
+
+#include "core/platform/graphics/FloatRect.h"
+#include "core/platform/graphics/filters/Filter.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class SourceGraphic;
+class FilterEffect;
+
+class ReferenceFilter: public Filter {
+public:
+    static PassRefPtr<ReferenceFilter> create()
+    {
+        return adoptRef(new ReferenceFilter());
+    }
+
+    virtual FloatRect sourceImageRect() const { return FloatRect(); };
+
+    void setLastEffect(PassRefPtr<FilterEffect>);
+    FilterEffect* lastEffect() const { return m_lastEffect.get(); }
+
+    SourceGraphic* sourceGraphic() const { return m_sourceGraphic.get(); }
+
+private:
+    ReferenceFilter();
+    ~ReferenceFilter();
+
+    RefPtr<SourceGraphic> m_sourceGraphic;
+    RefPtr<FilterEffect> m_lastEffect;
+};
+
+}
+
+#endif // ReferenceFilter_h
diff --git a/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp b/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp
index 30350d4..2b30900 100644
--- a/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp
+++ b/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp
@@ -34,6 +34,7 @@
 #include "core/platform/graphics/filters/DropShadowImageFilter.h"
 #include "core/platform/graphics/filters/FilterEffect.h"
 #include "core/platform/graphics/filters/FilterOperations.h"
+#include "core/platform/graphics/filters/SourceGraphic.h"
 
 namespace {
 
@@ -218,11 +219,25 @@
         const FilterOperation& op = *operations.at(i);
         switch (op.getOperationType()) {
         case FilterOperation::REFERENCE: {
-            FilterEffect* filterEffect = static_cast<const ReferenceFilterOperation*>(&op)->filterEffect();
-            // FIXME: hook up parent filter to image source
-            if (filterEffect)
+            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.)
+                FilterColorSpacePair deviceKey(referenceFilter->sourceGraphic(), ColorSpaceDeviceRGB);
+                FilterColorSpacePair linearKey(referenceFilter->sourceGraphic(), ColorSpaceLinearRGB);
+                m_map.set(deviceKey, transformColorSpace(filter, currentColorSpace, ColorSpaceDeviceRGB));
+                m_map.set(linearKey, transformColorSpace(filter, currentColorSpace, ColorSpaceLinearRGB));
+
                 currentColorSpace = filterEffect->operatingColorSpace();
-            filter.reset(SkiaImageFilterBuilder::build(filterEffect, currentColorSpace));
+                filter.reset(SkiaImageFilterBuilder::build(filterEffect, currentColorSpace));
+                // We might have no reference to the SourceGraphic's Skia filter now, so make
+                // sure we don't keep it in the map anymore.
+                m_map.remove(deviceKey);
+                m_map.remove(linearKey);
+            }
             break;
         }
         case FilterOperation::GRAYSCALE: {
diff --git a/Source/core/platform/graphics/gpu/DrawingBuffer.cpp b/Source/core/platform/graphics/gpu/DrawingBuffer.cpp
index 5940b06..a862bf4 100644
--- a/Source/core/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/core/platform/graphics/gpu/DrawingBuffer.cpp
@@ -39,6 +39,7 @@
 #include "core/platform/graphics/GraphicsLayer.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCompositorSupport.h"
+#include "public/platform/WebExternalBitmap.h"
 #include "public/platform/WebExternalTextureLayer.h"
 #include "public/platform/WebGraphicsContext3D.h"
 
@@ -114,7 +115,6 @@
     , m_fbo(0)
     , m_colorBuffer(0)
     , m_frontColorBuffer(0)
-    , m_separateFrontTexture(false)
     , m_depthStencilBuffer(0)
     , m_depthBuffer(0)
     , m_stencilBuffer(0)
@@ -129,21 +129,6 @@
 {
     // Used by browser tests to detect the use of a DrawingBuffer.
     TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation");
-    // Before enabling mailboxes for canvas, make sure the scenarios
-    // from http://crbug.com/234428 do not reproduce!
-#if !ENABLE(CANVAS_USES_MAILBOX)
-    // We need a separate front and back textures if ...
-    m_separateFrontTexture = m_preserveDrawingBuffer == Preserve // ... we have to preserve contents after compositing, which is done with a copy or ...
-                             || WebKit::Platform::current()->isThreadedCompositingEnabled(); // ... if we're in threaded mode and need to double buffer.
-
-#if OS(DARWIN)
-    // http://crbug.com/234428 : always use a separate front texture
-    // on Mac OS. Doing this on all GPUs, not just NVIDIA GPUs,
-    // ensures consistent behavior and is much less code.
-    m_separateFrontTexture = true;
-#endif // OS(DARWIN)
-
-#endif // !ENABLE(CANVAS_USES_MAILBOX)
     initialize(size);
 }
 
@@ -152,23 +137,6 @@
     releaseResources();
 }
 
-unsigned DrawingBuffer::prepareTexture(WebKit::WebTextureUpdater& updater)
-{
-    if (!m_context || !m_colorBuffer)
-        return 0;
-
-    prepareBackBuffer();
-
-    m_context->flush();
-    m_context->markLayerComposited();
-
-    unsigned textureId = frontColorBuffer();
-    if (requiresCopyFromBackToFrontBuffer())
-        updater.appendCopy(colorBuffer(), textureId, size());
-
-    return textureId;
-}
-
 WebKit::WebGraphicsContext3D* DrawingBuffer::context()
 {
     if (!m_context)
@@ -176,7 +144,7 @@
     return m_context->webContext();
 }
 
-bool DrawingBuffer::prepareMailbox(WebKit::WebExternalTextureMailbox* outMailbox)
+bool DrawingBuffer::prepareMailbox(WebKit::WebExternalTextureMailbox* outMailbox, WebKit::WebExternalBitmap* bitmap)
 {
     if (!m_context || !m_contentsChanged || !m_lastColorBuffer)
         return false;
@@ -187,6 +155,16 @@
     if (multisample())
         commit();
 
+    if (bitmap) {
+        bitmap->setSize(size());
+
+        unsigned char* pixels = bitmap->pixels();
+        bool needPremultiply = m_attributes.alpha && !m_attributes.premultipliedAlpha;
+        GraphicsContext3D::AlphaOp op = needPremultiply ? GraphicsContext3D::AlphaDoPremultiply : GraphicsContext3D::AlphaDoNothing;
+        if (pixels)
+            m_context->readBackFramebuffer(pixels, size().width(), size().height(), GraphicsContext3D::ReadbackSkia, op);
+    }
+
     // We must restore the texture binding since creating new textures,
     // consuming and producing mailboxes changes it.
     ScopedTextureUnit0BindingRestorer restorer(m_context.get(), m_activeTextureUnit, m_texture2DBinding);
@@ -301,55 +279,17 @@
 
     m_fbo = m_context->createFramebuffer();
 
-    if (m_separateFrontTexture)
-        m_frontColorBuffer = createColorTexture();
-
     m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     m_colorBuffer = createColorTexture();
     m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
     createSecondaryBuffers();
     reset(size);
-#if ENABLE(CANVAS_USES_MAILBOX)
     m_lastColorBuffer = createNewMailbox(m_colorBuffer);
-#endif // ENABLE(CANVAS_USES_MAILBOX)
-}
-
-void DrawingBuffer::prepareBackBuffer()
-{
-    if (!m_context || !m_contentsChanged)
-        return;
-
-    m_context->makeContextCurrent();
-
-    if (multisample())
-        commit();
-
-    if (m_preserveDrawingBuffer == Discard && m_separateFrontTexture) {
-        swap(m_frontColorBuffer, m_colorBuffer);
-        // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a
-        // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding.
-        // If this stops being true at some point, we should track the current framebuffer binding in the DrawingBuffer and restore
-        // it after attaching the new back buffer here.
-        m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
-        m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
-    }
-
-    if (multisample() && !m_framebufferBinding)
-        bind();
-    else
-        restoreFramebufferBinding();
-
-    m_contentsChanged = false;
-}
-
-bool DrawingBuffer::requiresCopyFromBackToFrontBuffer() const
-{
-    return m_separateFrontTexture && m_preserveDrawingBuffer == Preserve;
 }
 
 unsigned DrawingBuffer::frontColorBuffer() const
 {
-    return m_separateFrontTexture ? m_frontColorBuffer : m_colorBuffer;
+    return m_colorBuffer;
 }
 
 Platform3DObject DrawingBuffer::framebuffer() const
@@ -362,12 +302,8 @@
     if (!m_context)
         return 0;
 
-    if (!m_layer){
-#if ENABLE(CANVAS_USES_MAILBOX)
-        m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createExternalTextureLayerForMailbox(this));
-#else
+    if (!m_layer) {
         m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createExternalTextureLayer(this));
-#endif // ENABLE(CANVAS_USES_MAILBOX)
 
         m_layer->setOpaque(!m_attributes.alpha);
         m_layer->setPremultipliedAlpha(m_attributes.premultipliedAlpha);
@@ -383,16 +319,12 @@
         return;
 
     Extensions3D* extensions = m_context->getExtensions();
-#if ENABLE(CANVAS_USES_MAILBOX)
     // Since the m_frontColorBuffer was produced and sent to the compositor, it cannot be bound to an fbo.
     // We have to make a copy of it here and bind that copy instead.
+    // FIXME: That's not true any more, provided we don't change texture
+    // parameters.
     unsigned sourceTexture = createColorTexture(m_size);
     extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, m_frontColorBuffer, sourceTexture, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE);
-#else
-    // FIXME: Re-examine general correctness of this code beacause m_colorBuffer may contain a stale copy of the data
-    // that was sent to the compositor at some point in the past.
-    unsigned sourceTexture = frontColorBuffer();
-#endif // ENABLE(CANVAS_USES_MAILBOX)
 
     // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding).
     // FIXME: The WebGLRenderingContext tracks the current framebuffer binding, it would be slightly more efficient to use this value
@@ -406,9 +338,7 @@
 
     extensions->paintFramebufferToCanvas(framebuffer, size().width(), size().height(), !m_attributes.premultipliedAlpha, imageBuffer);
     m_context->deleteFramebuffer(framebuffer);
-#if ENABLE(CANVAS_USES_MAILBOX)
     m_context->deleteTexture(sourceTexture);
-#endif // ENABLE(CANVAS_USES_MAILBOX)
 
     m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, previousFramebuffer);
 }
@@ -429,16 +359,8 @@
 
         clearPlatformLayer();
 
-#if !ENABLE(CANVAS_USES_MAILBOX)
-        if (m_colorBuffer)
-            m_context->deleteTexture(m_colorBuffer);
-
-        if (m_frontColorBuffer)
-            m_context->deleteTexture(m_frontColorBuffer);
-#else
         for (size_t i = 0; i < m_textureMailboxes.size(); i++)
             m_context->deleteTexture(m_textureMailboxes[i]->textureId);
-#endif // !ENABLE(CANVAS_USES_MAILBOX)
 
         if (m_multisampleColorBuffer)
             m_context->deleteRenderbuffer(m_multisampleColorBuffer);
@@ -473,11 +395,9 @@
     m_fbo = 0;
     m_contextEvictionManager.clear();
 
-#if ENABLE(CANVAS_USES_MAILBOX)
     m_lastColorBuffer.clear();
     m_recycledMailboxes.clear();
     m_textureMailboxes.clear();
-#endif  // ENABLE(CANVAS_USES_MAILBOX)
 
     if (m_layer) {
         GraphicsLayer::unregisterContentsLayer(m_layer->layer());
@@ -527,12 +447,6 @@
 
     m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
 
-    // resize the front color buffer
-    if (m_separateFrontTexture) {
-        m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_frontColorBuffer);
-        m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, m_internalColorFormat, size.width(), size.height(), 0, m_colorFormat, GraphicsContext3D::UNSIGNED_BYTE);
-    }
-
     m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
 
     if (!multisample())
diff --git a/Source/core/platform/graphics/gpu/DrawingBuffer.h b/Source/core/platform/graphics/gpu/DrawingBuffer.h
index d505af0..0cbb8a9 100644
--- a/Source/core/platform/graphics/gpu/DrawingBuffer.h
+++ b/Source/core/platform/graphics/gpu/DrawingBuffer.h
@@ -42,6 +42,7 @@
 #include <wtf/PassOwnPtr.h>
 
 namespace WebKit {
+class WebExternalBitmap;
 class WebExternalTextureLayer;
 class WebGraphicsContext3D;
 class WebLayer;
@@ -123,9 +124,8 @@
     void paintCompositedResultsToCanvas(ImageBuffer*);
 
     // WebExternalTextureLayerClient implementation.
-    virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE;
     virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
-    virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*) OVERRIDE;
+    virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*, WebKit::WebExternalBitmap*) OVERRIDE;
     virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&) OVERRIDE;
 
 private:
@@ -134,8 +134,6 @@
 
     void initialize(const IntSize&);
 
-    void prepareBackBuffer();
-    bool requiresCopyFromBackToFrontBuffer() const;
     Platform3DObject frontColorBuffer() const;
     Platform3DObject colorBuffer() const { return m_colorBuffer; }
 
diff --git a/Source/core/platform/graphics/gpu/DrawingBufferTest.cpp b/Source/core/platform/graphics/gpu/DrawingBufferTest.cpp
new file mode 100644
index 0000000..7b39310
--- /dev/null
+++ b/Source/core/platform/graphics/gpu/DrawingBufferTest.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:
+ *
+ *     * 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/gpu/DrawingBuffer.h"
+
+#include "core/platform/graphics/GraphicsContext3D.h"
+#include "core/tests/FakeWebGraphicsContext3D.h"
+#include "public/platform/Platform.h"
+#include "wtf/RefPtr.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+using namespace WebKit;
+using testing::Test;
+using testing::_;
+
+namespace {
+
+class FakeContextEvictionManager : public ContextEvictionManager {
+public:
+    void forciblyLoseOldestContext(const String& reason) { }
+    IntSize oldestContextSize() { return IntSize(); }
+};
+
+} // namespace
+
+class DrawingBufferTest : public Test {
+protected:
+    virtual void SetUp()
+    {
+        RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new FakeContextEvictionManager());
+        RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D));
+        const IntSize size(100, 100);
+        m_drawingBuffer = DrawingBuffer::create(context.get(), size, DrawingBuffer::Discard, contextEvictionManager.release());
+    }
+
+    RefPtr<DrawingBuffer> m_drawingBuffer;
+};
+
+namespace {
+
+TEST_F(DrawingBufferTest, verifyNoNewBuffersAfterContextLostWithMailboxes)
+{
+    // Tell the buffer its contents changed and context was lost.
+    m_drawingBuffer->markContentsChanged();
+    m_drawingBuffer->releaseResources();
+
+    WebKit::WebExternalTextureMailbox mailbox;
+    EXPECT_FALSE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
+}
+
+} // namespace
diff --git a/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp b/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
index 6b40ad8..6738b7f 100644
--- a/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
+++ b/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
@@ -354,7 +354,7 @@
     unsigned numFeatures = settings->size();
     for (unsigned i = 0; i < numFeatures; ++i) {
         hb_feature_t feature;
-        const UChar* tag = settings->at(i).tag().characters();
+        String tag = settings->at(i).tag();
         feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]);
         feature.value = settings->at(i).value();
         feature.start = 0;
@@ -480,7 +480,8 @@
             String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters());
             upperText.makeUpper();
             currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData;
-            hb_buffer_add_utf16(harfBuzzBuffer.get(), upperText.bloatedCharacters(), currentRun->numCharacters(), 0, currentRun->numCharacters());
+            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());
         } else
             hb_buffer_add_utf16(harfBuzzBuffer.get(), m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharacters());
 
diff --git a/Source/core/platform/graphics/mac/FontCacheMac.mm b/Source/core/platform/graphics/mac/FontCacheMac.mm
index 8191d9b..0716d41 100644
--- a/Source/core/platform/graphics/mac/FontCacheMac.mm
+++ b/Source/core/platform/graphics/mac/FontCacheMac.mm
@@ -39,11 +39,6 @@
 #import <wtf/StdLibExtras.h>
 
 // Forward declare Mac SPIs.
-// Request for public API: rdar://13787490
-extern "C" {
-void CGFontSetShouldUseMulticache(bool enable);
-}
-
 // Request for public API: rdar://13803570
 @interface NSFont (WebKitSPI)
 + (NSFont*)findFontLike:(NSFont*)font forString:(NSString*)string withRange:(NSRange)range inLanguage:(id)useNil;
@@ -71,8 +66,6 @@
 
 void FontCache::platformInit()
 {
-    // Note: This may break on future OS releases, per https://bugs.webkit.org/show_bug.cgi?id=102405#c8.
-    CGFontSetShouldUseMulticache(true);
     CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
 }
 
diff --git a/Source/core/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/core/platform/graphics/mac/FontCustomPlatformData.cpp
index 99ad0d0..d2b1bc9 100644
--- a/Source/core/platform/graphics/mac/FontCustomPlatformData.cpp
+++ b/Source/core/platform/graphics/mac/FontCustomPlatformData.cpp
@@ -37,7 +37,7 @@
     CGFontRelease(m_cgFont);
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
 {
     return FontPlatformData(m_cgFont, size, bold, italic, orientation, widthVariant);
 }
diff --git a/Source/core/platform/graphics/mac/FontCustomPlatformData.h b/Source/core/platform/graphics/mac/FontCustomPlatformData.h
index 90a34d0..5716c43 100644
--- a/Source/core/platform/graphics/mac/FontCustomPlatformData.h
+++ b/Source/core/platform/graphics/mac/FontCustomPlatformData.h
@@ -23,7 +23,6 @@
 
 #include <CoreFoundation/CFBase.h>
 #include "core/platform/graphics/FontOrientation.h"
-#include "core/platform/graphics/FontRenderingMode.h"
 #include "core/platform/graphics/FontWidthVariant.h"
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
@@ -50,7 +49,7 @@
 
     ~FontCustomPlatformData();
 
-    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 
     static bool supportsFormat(const String&);
 
diff --git a/Source/core/platform/graphics/skia/FontCacheSkia.cpp b/Source/core/platform/graphics/skia/FontCacheSkia.cpp
index 0477827..34e154f 100644
--- a/Source/core/platform/graphics/skia/FontCacheSkia.cpp
+++ b/Source/core/platform/graphics/skia/FontCacheSkia.cpp
@@ -90,24 +90,7 @@
 
 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescription& description, ShouldRetain shouldRetain)
 {
-    DEFINE_STATIC_LOCAL(const AtomicString, sansStr, ("Sans", AtomicString::ConstructFromLiteral));
-    DEFINE_STATIC_LOCAL(const AtomicString, serifStr, ("Serif", AtomicString::ConstructFromLiteral));
-    DEFINE_STATIC_LOCAL(const AtomicString, monospaceStr, ("Monospace", AtomicString::ConstructFromLiteral));
-
-    FontPlatformData* fontPlatformData = 0;
-    switch (description.genericFamily()) {
-    case FontDescription::SerifFamily:
-        fontPlatformData = getCachedFontPlatformData(description, serifStr);
-        break;
-    case FontDescription::MonospaceFamily:
-        fontPlatformData = getCachedFontPlatformData(description, monospaceStr);
-        break;
-    case FontDescription::SansSerifFamily:
-    default:
-        fontPlatformData = getCachedFontPlatformData(description, sansStr);
-        break;
-    }
-
+    const FontPlatformData* fontPlatformData = getFallbackFontData(description);
     if (!fontPlatformData) {
         // we should at least have Arial; this is the SkFontHost_fontconfig last resort fallback
         DEFINE_STATIC_LOCAL(const AtomicString, arialStr, ("Arial", AtomicString::ConstructFromLiteral));
diff --git a/Source/core/platform/graphics/skia/FontCustomPlatformData.cpp b/Source/core/platform/graphics/skia/FontCustomPlatformData.cpp
index 826baf8..325a80a 100644
--- a/Source/core/platform/graphics/skia/FontCustomPlatformData.cpp
+++ b/Source/core/platform/graphics/skia/FontCustomPlatformData.cpp
@@ -64,8 +64,7 @@
 #endif
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation,
-                                                          FontWidthVariant, FontRenderingMode mode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
 {
 #if OS(WINDOWS)
     ASSERT(m_fontReference);
@@ -78,7 +77,7 @@
         ASSERT_NOT_REACHED();
         return FontPlatformData();
     }
-    unsigned len = m_name.copyTo(logFont.lfFaceName, LF_FACESIZE - 1);
+    unsigned len = m_name.copyTo(logFont.lfFaceName, 0, LF_FACESIZE - 1);
     logFont.lfFaceName[len] = '\0';
 
     // FIXME: almost identical to FillLogFont in FontCacheWin.cpp.
diff --git a/Source/core/platform/graphics/skia/FontCustomPlatformData.h b/Source/core/platform/graphics/skia/FontCustomPlatformData.h
index 5d2959a..7c2d298 100644
--- a/Source/core/platform/graphics/skia/FontCustomPlatformData.h
+++ b/Source/core/platform/graphics/skia/FontCustomPlatformData.h
@@ -33,7 +33,6 @@
 #define FontCustomPlatformData_h
 
 #include "core/platform/graphics/FontOrientation.h"
-#include "core/platform/graphics/FontRenderingMode.h"
 #include "core/platform/graphics/FontWidthVariant.h"
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
@@ -66,8 +65,7 @@
 
     ~FontCustomPlatformData();
 
-    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal,
-                                      FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 
     static bool supportsFormat(const String&);
 
diff --git a/Source/core/platform/graphics/skia/ImageSkia.cpp b/Source/core/platform/graphics/skia/ImageSkia.cpp
index 5b13d69..8f25fa2 100644
--- a/Source/core/platform/graphics/skia/ImageSkia.cpp
+++ b/Source/core/platform/graphics/skia/ImageSkia.cpp
@@ -65,6 +65,11 @@
     RESAMPLE_AWESOME,
 };
 
+static bool nearlyIntegral(float value)
+{
+    return fabs(value - floorf(value)) < std::numeric_limits<float>::epsilon();
+}
+
 static ResamplingMode computeResamplingMode(const SkMatrix& matrix, const NativeImageSkia& bitmap, float srcWidth, float srcHeight, float destWidth, float destHeight)
 {
     // The percent change below which we will not resample. This usually means
@@ -96,8 +101,17 @@
         || srcHeight <= kSmallImageSizeThreshold
         || destWidth <= kSmallImageSizeThreshold
         || destHeight <= kSmallImageSizeThreshold) {
-        // Never resample small images. These are often used for borders and
-        // rules (think 1x1 images used to make lines).
+        // Small image detected.
+
+        // Resample in the case where the new size would be non-integral.
+        // This can cause noticeable breaks in repeating patterns, except
+        // when the source image is only one pixel wide in that dimension.
+        if ((!nearlyIntegral(destWidth) && srcWidth > 1 + std::numeric_limits<float>::epsilon())
+            || (!nearlyIntegral(destHeight) && srcHeight > 1 + std::numeric_limits<float>::epsilon()))
+            return RESAMPLE_LINEAR;
+
+        // Otherwise, don't resample small images. These are often used for
+        // borders and rules (think 1x1 images used to make lines).
         return RESAMPLE_NONE;
     }
 
diff --git a/Source/core/platform/image-decoders/ImageDecoder.h b/Source/core/platform/image-decoders/ImageDecoder.h
index 90195d4..b609d50 100644
--- a/Source/core/platform/image-decoders/ImageDecoder.h
+++ b/Source/core/platform/image-decoders/ImageDecoder.h
@@ -115,7 +115,10 @@
         unsigned duration() const { return m_duration; }
         FrameDisposalMethod disposalMethod() const { return m_disposalMethod; }
         bool premultiplyAlpha() const { return m_premultiplyAlpha; }
+        SkBitmap::Allocator* allocator() const { return m_allocator; }
+        const SkBitmap& getSkBitmap() const { return m_bitmap->bitmap(); }
         void reportMemoryUsage(MemoryObjectInfo*) const;
+
         size_t requiredPreviousFrameIndex() const
         {
             ASSERT(m_requiredPreviousFrameIndexValid);
@@ -124,13 +127,15 @@
 #if !ASSERT_DISABLED
         bool requiredPreviousFrameIndexValid() const { return m_requiredPreviousFrameIndexValid; }
 #endif
-
         void setHasAlpha(bool alpha);
         void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; }
         void setStatus(FrameStatus status);
         void setDuration(unsigned duration) { m_duration = duration; }
         void setDisposalMethod(FrameDisposalMethod method) { m_disposalMethod = method; }
         void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premultiplyAlpha; }
+        void setMemoryAllocator(SkBitmap::Allocator* allocator) { m_allocator = allocator; }
+        void setSkBitmap(const SkBitmap& bitmap) { m_bitmap = NativeImageSkia::create(bitmap); }
+
         void setRequiredPreviousFrameIndex(size_t previousFrameIndex)
         {
             m_requiredPreviousFrameIndex = previousFrameIndex;
@@ -139,42 +144,17 @@
 #endif
         }
 
-        inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
-        {
-            setRGBA(getAddr(x, y), r, g, b, a);
-        }
-
         inline PixelData* getAddr(int x, int y)
         {
             return m_bitmap->bitmap().getAddr32(x, y);
         }
 
-        void setSkBitmap(const SkBitmap& bitmap)
+        inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
         {
-            m_bitmap = NativeImageSkia::create(bitmap);
+            setRGBA(getAddr(x, y), r, g, b, a);
         }
 
-        const SkBitmap& getSkBitmap() const
-        {
-            return m_bitmap->bitmap();
-        }
-
-        void setMemoryAllocator(SkBitmap::Allocator* allocator)
-        {
-            m_allocator = allocator;
-        }
-
-        SkBitmap::Allocator* allocator() const { return m_allocator; }
-
-        // Use fix point multiplier instead of integer division or floating point math.
-        // This multipler produces exactly the same result for all values in range 0 - 255.
-        static const unsigned fixPointShift = 24;
-        static const unsigned fixPointMult = static_cast<unsigned>(1.0 / 255.0 * (1 << fixPointShift)) + 1;
-        // Multiplies unsigned value by fixpoint value and converts back to unsigned.
-        static unsigned fixPointUnsignedMultiply(unsigned fixed, unsigned v)
-        {
-            return  (fixed * v) >> fixPointShift;
-        }
+        static const unsigned div255 = static_cast<unsigned>(1.0 / 255 * (1 << 24)) + 1;
 
         inline void setRGBA(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
         {
@@ -184,16 +164,22 @@
                     return;
                 }
 
-                unsigned alphaMult = a * fixPointMult;
-                r = fixPointUnsignedMultiply(r, alphaMult);
-                g = fixPointUnsignedMultiply(g, alphaMult);
-                b = fixPointUnsignedMultiply(b, alphaMult);
+                unsigned alpha = a * div255;
+                r = (r * alpha) >> 24;
+                g = (g * alpha) >> 24;
+                b = (b * alpha) >> 24;
             }
+
             // Call the "NoCheck" version since we may deliberately pass non-premultiplied
             // values, and we don't want an assert.
             *dest = SkPackARGB32NoCheck(a, r, g, b);
         }
 
+        inline void setRGBARaw(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+        {
+            *dest = SkPackARGB32NoCheck(a, r, g, b);
+        }
+
     private:
         int width() const
         {
@@ -397,8 +383,11 @@
         virtual void setMemoryAllocator(SkBitmap::Allocator* allocator)
         {
             // FIXME: this doesn't work for images with multiple frames.
-            if (m_frameBufferCache.isEmpty())
+            if (m_frameBufferCache.isEmpty()) {
                 m_frameBufferCache.resize(1);
+                m_frameBufferCache[0].setRequiredPreviousFrameIndex(
+                    findRequiredPreviousFrame(0));
+            }
             m_frameBufferCache[0].setMemoryAllocator(allocator);
         }
 
diff --git a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index 7974b79..9d87086 100644
--- a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -377,13 +377,6 @@
 
             m_decoder->setOrientation(readImageOrientation(info()));
 
-#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) && defined(TURBO_JPEG_RGB_SWIZZLE)
-            // There's no point swizzle decoding if image down sampling will
-            // be applied. Revert to using JSC_RGB in that case.
-            if (m_decoder->willDownSample() && turboSwizzled(m_info.out_color_space))
-                m_info.out_color_space = JCS_RGB;
-#endif
-
 #if USE(QCMSLIB)
             // Allow color management of the decoded RGBA pixels if possible.
             if (!m_decoder->ignoresGammaAndColorProfile()) {
@@ -643,7 +636,7 @@
 
     switch (colorSpace) {
     case JCS_RGB:
-        buffer.setRGBA(pixel, jsample[0], jsample[1], jsample[2], 0xFF);
+        buffer.setRGBARaw(pixel, jsample[0], jsample[1], jsample[2], 255);
         break;
     case JCS_CMYK:
         // Source is 'Inverted CMYK', output is RGB.
@@ -656,7 +649,7 @@
         // From CMY (0..1) to RGB (0..1):
         // R = 1 - C => 1 - (1 - iC*iK) => iC*iK  [G and B similar]
         unsigned k = jsample[3];
-        buffer.setRGBA(pixel, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 0xFF);
+        buffer.setRGBARaw(pixel, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 255);
         break;
     }
 }
diff --git a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp
index 5e559e4..da5252b 100644
--- a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -56,6 +56,7 @@
     , m_frameBackgroundHasAlpha(false)
 #if USE(QCMSLIB)
     , m_haveReadProfile(false)
+    , m_hasProfile(false)
     , m_transform(0)
 #endif
     , m_demux(0)
@@ -94,9 +95,9 @@
 
 bool WEBPImageDecoder::isSizeAvailable()
 {
-    if (!ImageDecoder::isSizeAvailable()) {
+    if (!ImageDecoder::isSizeAvailable())
         updateDemuxer();
-    }
+
     return ImageDecoder::isSizeAvailable();
 }
 
@@ -104,6 +105,7 @@
 {
     if (!updateDemuxer())
         return 0;
+
     return m_frameBufferCache.size();
 }
 
@@ -168,6 +170,10 @@
 
     if (m_demuxState != WEBP_DEMUX_DONE)
         m_haveAlreadyParsedThisData = false;
+#if USE(QCMSLIB)
+    else if (m_hasProfile && !m_haveReadProfile)
+        m_haveAlreadyParsedThisData = false;
+#endif
 }
 
 int WEBPImageDecoder::repetitionCount() const
@@ -214,12 +220,16 @@
     bool hasAnimation = (m_formatFlags & ANIMATION_FLAG);
     if (!ImageDecoder::isSizeAvailable()) {
         m_formatFlags = WebPDemuxGetI(m_demux, WEBP_FF_FORMAT_FLAGS);
+#if USE(QCMSLIB)
+        m_hasProfile = (m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile();
+#endif
         hasAnimation = (m_formatFlags & ANIMATION_FLAG);
         if (hasAnimation && !RuntimeEnabledFeatures::animatedWebPEnabled())
             return setFailed();
         if (!setSize(WebPDemuxGetI(m_demux, WEBP_FF_CANVAS_WIDTH), WebPDemuxGetI(m_demux, WEBP_FF_CANVAS_HEIGHT)))
             return setFailed();
     }
+
     ASSERT(ImageDecoder::isSizeAvailable());
     const size_t newFrameCount = WebPDemuxGetI(m_demux, WEBP_FF_FRAME_COUNT);
     if (hasAnimation && !m_haveReadAnimationParameters && newFrameCount) {
@@ -232,6 +242,7 @@
             m_repetitionCount = cAnimationLoopInfinite;
         m_haveReadAnimationParameters = true;
     }
+
     const size_t oldFrameCount = m_frameBufferCache.size();
     if (newFrameCount > oldFrameCount) {
         m_frameBufferCache.resize(newFrameCount);
@@ -251,6 +262,7 @@
             m_frameBufferCache[i].setRequiredPreviousFrameIndex(findRequiredPreviousFrame(i));
         }
     }
+
     return true;
 }
 
@@ -393,7 +405,7 @@
     const int top = frameRect.y();
 
 #if USE(QCMSLIB)
-    if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile()) {
+    if (m_hasProfile) {
         if (!m_haveReadProfile) {
             readColorProfile();
             m_haveReadProfile = true;
@@ -505,7 +517,7 @@
         if (!m_premultiplyAlpha)
             mode = outputMode(false);
 #if USE(QCMSLIB)
-        if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile())
+        if (m_hasProfile)
             mode = MODE_RGBA; // Decode to RGBA for input to libqcms.
 #endif
         WebPInitDecBuffer(&m_decoderBuffer);
diff --git a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
index 8d6f4b8..9118f97 100644
--- a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
+++ b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
@@ -65,6 +65,7 @@
     void readColorProfile();
 
     bool m_haveReadProfile;
+    bool m_hasProfile;
     qcms_transform* m_transform;
 #endif
 
diff --git a/Source/core/platform/midi/MIDIAccessor.cpp b/Source/core/platform/midi/MIDIAccessor.cpp
index a5f602b..8c0ad70 100644
--- a/Source/core/platform/midi/MIDIAccessor.cpp
+++ b/Source/core/platform/midi/MIDIAccessor.cpp
@@ -56,9 +56,10 @@
     ASSERT(m_accessor);
 }
 
-void MIDIAccessor::requestAccess(bool access)
+void MIDIAccessor::startSession()
 {
-    m_accessor->requestAccess(access);
+    // FIXME: Use new API once embedder side implement the new API.
+    m_accessor->requestAccess(false);
 }
 
 void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
@@ -76,14 +77,19 @@
     m_client->didAddOutputPort(id, manufacturer, name, version);
 }
 
+void MIDIAccessor::didStartSession()
+{
+    m_client->didStartSession();
+}
+
 void MIDIAccessor::didAllowAccess()
 {
-    m_client->didAllowAccess();
+    m_client->didStartSession();
 }
 
 void MIDIAccessor::didBlockAccess()
 {
-    m_client->didBlockAccess();
+    m_client->didStartSession();
 }
 
 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
diff --git a/Source/core/platform/midi/MIDIAccessor.h b/Source/core/platform/midi/MIDIAccessor.h
index 3eaa90c..39dd88d 100644
--- a/Source/core/platform/midi/MIDIAccessor.h
+++ b/Source/core/platform/midi/MIDIAccessor.h
@@ -46,18 +46,19 @@
 
     virtual ~MIDIAccessor() { }
 
-    void requestAccess(bool access);
+    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() OVERRIDE;
     virtual void didAllowAccess() OVERRIDE;
     virtual void didBlockAccess() OVERRIDE;
     virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) OVERRIDE;
 
 private:
-    MIDIAccessor(MIDIAccessorClient*);
+    explicit MIDIAccessor(MIDIAccessorClient*);
 
     MIDIAccessorClient* m_client;
     OwnPtr<WebKit::WebMIDIAccessor> m_accessor;
diff --git a/Source/core/platform/midi/MIDIAccessorClient.h b/Source/core/platform/midi/MIDIAccessorClient.h
index 467d96d..9170256 100644
--- a/Source/core/platform/midi/MIDIAccessorClient.h
+++ b/Source/core/platform/midi/MIDIAccessorClient.h
@@ -40,8 +40,7 @@
     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 didAllowAccess() = 0;
-    virtual void didBlockAccess() = 0;
+    virtual void didStartSession() = 0;
     virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) = 0;
 };
 
diff --git a/Source/core/platform/mock/DeviceMotionClientMock.cpp b/Source/core/platform/mock/DeviceMotionClientMock.cpp
deleted file mode 100644
index 0ffdff8..0000000
--- a/Source/core/platform/mock/DeviceMotionClientMock.cpp
+++ /dev/null
@@ -1,72 +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.
- *
- * 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/DeviceMotionClientMock.h"
-
-#include "modules/device_orientation/DeviceMotionController.h"
-
-namespace WebCore {
-
-DeviceMotionClientMock::DeviceMotionClientMock()
-    : m_controller(0)
-    , m_timer(this, &DeviceMotionClientMock::timerFired)
-    , m_isUpdating(false)
-{
-}
-
-void DeviceMotionClientMock::setController(DeviceMotionController* controller)
-{
-    ASSERT(!m_controller);
-    m_controller = controller;
-    ASSERT(m_controller);
-}
-
-void DeviceMotionClientMock::startUpdating()
-{
-    m_isUpdating = true;
-}
-
-void DeviceMotionClientMock::stopUpdating()
-{
-    m_isUpdating = false;
-    m_timer.stop();
-}
-
-void DeviceMotionClientMock::setMotion(PassRefPtr<DeviceMotionData> motion)
-{
-    m_motion = motion;
-    if (m_isUpdating && !m_timer.isActive())
-        m_timer.startOneShot(0);
-}
-
-void DeviceMotionClientMock::timerFired(Timer<DeviceMotionClientMock>* timer)
-{
-    ASSERT_UNUSED(timer, timer == &m_timer);
-    m_timer.stop();
-    m_controller->didChangeDeviceMotion(m_motion.get());
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/mock/DeviceMotionClientMock.h b/Source/core/platform/mock/DeviceMotionClientMock.h
deleted file mode 100644
index 7641f50..0000000
--- a/Source/core/platform/mock/DeviceMotionClientMock.h
+++ /dev/null
@@ -1,68 +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.
- *
- * 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 DeviceMotionClientMock_h
-#define DeviceMotionClientMock_h
-
-#include "modules/device_orientation/DeviceMotionClient.h"
-#include "modules/device_orientation/DeviceMotionData.h"
-#include "core/platform/Timer.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class DeviceMotionController;
-
-// A mock implementation of DeviceMotionClient used to test the feature in
-// DumpRenderTree. Embedders should should configure the Page object to use this
-// client when running DumpRenderTree.
-class DeviceMotionClientMock : public DeviceMotionClient {
-public:
-    DeviceMotionClientMock();
-
-    // DeviceMotionClient
-    virtual void setController(DeviceMotionController*) OVERRIDE;
-    virtual void startUpdating() OVERRIDE;
-    virtual void stopUpdating() OVERRIDE;
-    virtual DeviceMotionData* lastMotion() const OVERRIDE { return m_motion.get(); }
-    // mock is owned by the testing framework, which should handle deletion
-    virtual void deviceMotionControllerDestroyed() OVERRIDE { }
-
-    void setMotion(PassRefPtr<DeviceMotionData>);
-
-private:
-    void timerFired(Timer<DeviceMotionClientMock>*);
-
-    RefPtr<DeviceMotionData> m_motion;
-    DeviceMotionController* m_controller;
-    Timer<DeviceMotionClientMock> m_timer;
-    bool m_isUpdating;
-};
-
-} // namespace WebCore
-
-#endif // DeviceMotionClientMock_h
diff --git a/Source/core/platform/sql/SQLiteStatement.cpp b/Source/core/platform/sql/SQLiteStatement.cpp
index 8e1a488..d4ef7ab 100644
--- a/Source/core/platform/sql/SQLiteStatement.cpp
+++ b/Source/core/platform/sql/SQLiteStatement.cpp
@@ -175,16 +175,9 @@
 
 int SQLiteStatement::bindBlob(int index, const String& text)
 {
-    // String::bloatedCharacters() returns 0 for the empty string, which SQLite
-    // treats as a null, so we supply a non-null pointer for that case.
-    UChar anyCharacter = 0;
-    const UChar* characters;
-    if (text.isEmpty() && !text.isNull())
-        characters = &anyCharacter;
-    else
-        characters = text.bloatedCharacters();
-
-    return bindBlob(index, characters, text.length() * sizeof(UChar));
+    // 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)
@@ -193,16 +186,9 @@
     ASSERT(index > 0);
     ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
 
-    // String::bloatedCharacters() returns 0 for the empty string, which SQLite
-    // treats as a null, so we supply a non-null pointer for that case.
-    UChar anyCharacter = 0;
-    const UChar* characters;
-    if (text.isEmpty() && !text.isNull())
-        characters = &anyCharacter;
-    else
-        characters = text.bloatedCharacters();
-
-    return sqlite3_bind_text16(m_statement, index, characters, sizeof(UChar) * text.length(), SQLITE_TRANSIENT);
+    // 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)
diff --git a/Source/core/platform/text/DecodeEscapeSequences.h b/Source/core/platform/text/DecodeEscapeSequences.h
index 40709a0..d809896 100644
--- a/Source/core/platform/text/DecodeEscapeSequences.h
+++ b/Source/core/platform/text/DecodeEscapeSequences.h
@@ -51,7 +51,9 @@
         }
         return runEnd;
     }
-    static String decodeRun(const UChar* run, size_t runLength, const WTF::TextEncoding&)
+
+    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>.
@@ -96,14 +98,16 @@
         }
         return runEnd;
     }
-    static String decodeRun(const UChar* run, size_t runLength, const WTF::TextEncoding& encoding)
+
+    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 UChar* runEnd = run + runLength;
+        const CharType* runEnd = run + runLength;
         while (run < runEnd) {
             if (run[0] == '%') {
                 *p++ = (toASCIIHexValue(run[1]) << 4) | toASCIIHexValue(run[2]);
@@ -134,7 +138,10 @@
             continue;
         }
 
-        String decoded = EscapeSequence::decodeRun(string.bloatedCharacters() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding);
+        String decoded = string.is8Bit() ?
+            EscapeSequence::decodeRun(string.characters8() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding) :
+            EscapeSequence::decodeRun(string.characters16() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding);
+
         if (decoded.isEmpty())
             continue;
 
diff --git a/Source/core/platform/text/LocaleICU.cpp b/Source/core/platform/text/LocaleICU.cpp
index ca241db..34245ac 100644
--- a/Source/core/platform/text/LocaleICU.cpp
+++ b/Source/core/platform/text/LocaleICU.cpp
@@ -323,11 +323,13 @@
     if (!patternGenerator)
         return format;
     status = U_ZERO_ERROR;
-    int32_t length = udatpg_getBestPattern(patternGenerator, skeleton.bloatedCharacters(), skeleton.length(), 0, 0, &status);
+    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) {
         Vector<UChar> buffer(length);
         status = U_ZERO_ERROR;
-        udatpg_getBestPattern(patternGenerator, skeleton.bloatedCharacters(), skeleton.length(), buffer.data(), length, &status);
+        udatpg_getBestPattern(patternGenerator, skeletonCharacters.data(), skeletonCharacters.size(), buffer.data(), length, &status);
         if (U_SUCCESS(status))
             format = String::adopt(buffer);
     }
diff --git a/Source/core/platform/text/TextBreakIterator.cpp b/Source/core/platform/text/TextBreakIterator.cpp
index 7291729..c39466f 100644
--- a/Source/core/platform/text/TextBreakIterator.cpp
+++ b/Source/core/platform/text/TextBreakIterator.cpp
@@ -24,47 +24,47 @@
 
 namespace WebCore {
 
-unsigned numGraphemeClusters(const String& s)
+unsigned numGraphemeClusters(const String& string)
 {
-    unsigned stringLength = s.length();
+    unsigned stringLength = string.length();
     
     if (!stringLength)
         return 0;
 
     // The only Latin-1 Extended Grapheme Cluster is CR LF
-    if (s.is8Bit() && !s.contains('\r'))
+    if (string.is8Bit() && !string.contains('\r'))
         return stringLength;
 
-    NonSharedCharacterBreakIterator it(s.bloatedCharacters(), stringLength);
+    NonSharedCharacterBreakIterator it(string);
     if (!it)
         return stringLength;
 
     unsigned num = 0;
-    while (textBreakNext(it) != TextBreakDone)
+    while (it.next() != TextBreakDone)
         ++num;
     return num;
 }
 
-unsigned numCharactersInGraphemeClusters(const String& s, unsigned numGraphemeClusters)
+unsigned numCharactersInGraphemeClusters(const String& string, unsigned numGraphemeClusters)
 {
-    unsigned stringLength = s.length();
+    unsigned stringLength = string.length();
 
     if (!stringLength)
         return 0;
 
     // The only Latin-1 Extended Grapheme Cluster is CR LF
-    if (s.is8Bit() && !s.contains('\r'))
+    if (string.is8Bit() && !string.contains('\r'))
         return std::min(stringLength, numGraphemeClusters);
 
-    NonSharedCharacterBreakIterator it(s.bloatedCharacters(), stringLength);
+    NonSharedCharacterBreakIterator it(string);
     if (!it)
         return std::min(stringLength, numGraphemeClusters);
 
     for (unsigned i = 0; i < numGraphemeClusters; ++i) {
-        if (textBreakNext(it) == TextBreakDone)
+        if (it.next() == TextBreakDone)
             return stringLength;
     }
-    return textBreakCurrent(it);
+    return it.current();
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/text/TextBreakIterator.h b/Source/core/platform/text/TextBreakIterator.h
index 7475f79..738637d 100644
--- a/Source/core/platform/text/TextBreakIterator.h
+++ b/Source/core/platform/text/TextBreakIterator.h
@@ -37,6 +37,7 @@
 // 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);
@@ -179,12 +180,52 @@
 class NonSharedCharacterBreakIterator {
     WTF_MAKE_NONCOPYABLE(NonSharedCharacterBreakIterator);
 public:
-    NonSharedCharacterBreakIterator(const UChar*, int length);
+    explicit NonSharedCharacterBreakIterator(const String&);
+    NonSharedCharacterBreakIterator(const UChar*, unsigned length);
     ~NonSharedCharacterBreakIterator();
 
-    operator TextBreakIterator*() const { return m_iterator; }
+    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;
 };
 
diff --git a/Source/core/platform/text/TextBreakIteratorICU.cpp b/Source/core/platform/text/TextBreakIteratorICU.cpp
index 7d1733b..36bd871 100644
--- a/Source/core/platform/text/TextBreakIteratorICU.cpp
+++ b/Source/core/platform/text/TextBreakIteratorICU.cpp
@@ -23,7 +23,6 @@
 #include "core/platform/text/TextBreakIterator.h"
 
 #include "core/platform/text/LineBreakIteratorPoolICU.h"
-#include <wtf/Atomics.h>
 #include <wtf/text/WTFString.h>
 
 using namespace WTF;
@@ -31,26 +30,14 @@
 
 namespace WebCore {
 
-static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator,
-    UBreakIteratorType type, const UChar* string, int length)
+static TextBreakIterator* ensureIterator(bool& createdIterator, TextBreakIterator*& iterator, UBreakIteratorType type)
 {
-    if (!string)
-        return 0;
-
     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);
     }
-    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;
 }
 
@@ -247,7 +234,7 @@
     UBool isAccessible;
     if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
         return isAccessible;
-    nativeIndex = textPinIndex(nativeIndex, nativeLength);
+    nativeIndex = textPinIndex(nativeIndex, nativeLength - 1);
     TextContext currentContext = textLatin1GetCurrentContext(text);
     TextContext newContext = textGetContext(text, nativeIndex, forward);
     ASSERT(newContext != NoContext);
@@ -370,7 +357,7 @@
     UBool isAccessible;
     if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
         return isAccessible;
-    nativeIndex = textPinIndex(nativeIndex, nativeLength);
+    nativeIndex = textPinIndex(nativeIndex, nativeLength - 1);
     TextContext currentContext = textUTF16GetCurrentContext(text);
     TextContext newContext = textGetContext(text, nativeIndex, forward);
     ASSERT(newContext != NoContext);
@@ -420,15 +407,83 @@
     return text;
 }
 
-TextBreakIterator* wordBreakIterator(const UChar* string, int length)
+static UText emptyText = UTEXT_INITIALIZER;
+
+static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator, UBreakIteratorType type, const UChar* string, int length)
 {
-    static bool createdWordBreakIterator = false;
-    static TextBreakIterator* staticWordBreakIterator;
-    return setUpIterator(createdWordBreakIterator,
-        staticWordBreakIterator, UBRK_WORD, string, 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 UText emptyText = UTEXT_INITIALIZER;
+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)
 {
@@ -444,13 +499,14 @@
     UErrorCode openStatus = U_ZERO_ERROR;
     UText* text = textOpenLatin1(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
     if (U_FAILURE(openStatus)) {
-        LOG_ERROR("textOpenUTF16 failed with status %d", 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;
     }
@@ -478,6 +534,7 @@
     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;
     }
@@ -498,19 +555,47 @@
 
 static inline bool compareAndSwapNonSharedCharacterBreakIterator(TextBreakIterator* expected, TextBreakIterator* newValue)
 {
-#if ENABLE(COMPARE_AND_SWAP)
-    return weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), expected, newValue);
-#else
     DEFINE_STATIC_LOCAL(Mutex, nonSharedCharacterBreakIteratorMutex, ());
     MutexLocker locker(nonSharedCharacterBreakIteratorMutex);
     if (nonSharedCharacterBreakIterator != expected)
         return false;
     nonSharedCharacterBreakIterator = newValue;
     return true;
-#endif
 }
 
-NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length)
+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);
@@ -519,10 +604,58 @@
 
 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;
@@ -586,8 +719,9 @@
     if (!createdIterator) {
         UParseError parseStatus;
         UErrorCode openStatus = U_ZERO_ERROR;
-        String rules(breakRules);
-        iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.bloatedCharacters(), rules.length(), 0, 0, &parseStatus, &openStatus));
+        Vector<UChar> rules;
+        String(ASCIILiteral(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);
     }
diff --git a/Source/core/platform/text/TextCheckerClient.h b/Source/core/platform/text/TextCheckerClient.h
index e855bf3..046bb8a 100644
--- a/Source/core/platform/text/TextCheckerClient.h
+++ b/Source/core/platform/text/TextCheckerClient.h
@@ -29,11 +29,10 @@
 #define TextCheckerClient_h
 
 #include "core/platform/text/TextChecking.h"
-
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -42,9 +41,9 @@
     virtual ~TextCheckerClient() {}
 
     virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const = 0;
-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
+    virtual void checkSpellingOfString(const String&, int* misspellingLocation, int* misspellingLength) = 0;
     virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) = 0;
-    virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
+    virtual void checkGrammarOfString(const String&, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
     virtual void requestCheckingOfString(PassRefPtr<TextCheckingRequest>) = 0;
 };
 
diff --git a/Source/core/plugins/PluginView.h b/Source/core/plugins/PluginView.h
index 2a4a1ee..fabcb04 100644
--- a/Source/core/plugins/PluginView.h
+++ b/Source/core/plugins/PluginView.h
@@ -28,9 +28,10 @@
 
 #include "core/platform/ScrollTypes.h"
 #include "core/platform/Widget.h"
-#include <bindings/npruntime.h>
 #include <wtf/text/WTFString.h>
 
+struct NPObject;
+
 namespace WebKit { class WebLayer; }
 
 namespace WebCore {
@@ -45,8 +46,6 @@
 
     virtual WebKit::WebLayer* platformLayer() const { return 0; }
     virtual NPObject* scriptableObject() { return 0; }
-    virtual NPP pluginNPP() = 0;
-
     virtual bool getFormValue(String&) { return false; }
     virtual bool wantsWheelEvents() { return false; }
     virtual bool supportsKeyboardFocus() const { return false; }
diff --git a/Source/core/rendering/FilterEffectRenderer.cpp b/Source/core/rendering/FilterEffectRenderer.cpp
index dc57d05..30797e4 100644
--- a/Source/core/rendering/FilterEffectRenderer.cpp
+++ b/Source/core/rendering/FilterEffectRenderer.cpp
@@ -28,24 +28,24 @@
 
 #include "core/rendering/FilterEffectRenderer.h"
 
-#include "SVGNames.h"
-#include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/dom/Document.h"
 #include "core/loader/cache/CachedDocument.h"
 #include "core/loader/cache/CachedSVGDocumentReference.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"
 #include "core/platform/graphics/filters/FEDropShadow.h"
 #include "core/platform/graphics/filters/FEGaussianBlur.h"
-#include "core/platform/graphics/filters/SourceAlpha.h"
 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h"
 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
 #include "core/platform/graphics/filters/custom/FECustomFilter.h"
 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h"
 #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 "wtf/MathExtras.h"
@@ -90,46 +90,6 @@
         operation->meshRows(), operation->meshColumns(),  operation->meshType());
 }
 
-// Returns whether or not the SVGStyledElement object contains a valid color-interpolation-filters attribute
-static bool getSVGStyledElementColorSpace(SVGStyledElement* svgStyledElement, ColorSpace& cs)
-{
-    if (!svgStyledElement)
-        return false;
-
-    const RenderObject* renderer = svgStyledElement->renderer();
-    const RenderStyle* style = renderer ? renderer->style() : 0;
-    const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
-    EColorInterpolation eColorInterpolation = CI_AUTO;
-    if (svgStyle) {
-        // If a layout has been performed, then we can use the fast path to get this attribute
-        eColorInterpolation = svgStyle->colorInterpolationFilters();
-    } else {
-        // Otherwise, use the slow path by using string comparison (used by external svg files)
-        RefPtr<CSSValue> cssValue = svgStyledElement->getPresentationAttribute(
-            SVGNames::color_interpolation_filtersAttr.toString());
-        if (cssValue.get() && cssValue->isPrimitiveValue()) {
-            const CSSPrimitiveValue& primitiveValue = *((CSSPrimitiveValue*)cssValue.get());
-            eColorInterpolation = (EColorInterpolation)primitiveValue;
-        } else {
-            return false;
-        }
-    }
-
-    switch (eColorInterpolation) {
-    case CI_AUTO:
-    case CI_SRGB:
-        cs = ColorSpaceDeviceRGB;
-        break;
-    case CI_LINEARRGB:
-        cs = ColorSpaceLinearRGB;
-        break;
-    default:
-        return false;
-    }
-
-    return true;
-}
-
 FilterEffectRenderer::FilterEffectRenderer()
     : Filter(AffineTransform())
     , m_graphicsBufferAttached(false)
@@ -149,94 +109,16 @@
     return sourceImage() ? sourceImage()->context() : 0;
 }
 
-PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderObject* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
-{
-    if (!renderer)
-        return 0;
-
-    Document* document = renderer->document();
-    ASSERT(document);
-
-    CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation->cachedSVGDocumentReference();
-    CachedDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : 0;
-
-    // If we have an SVG document, this is an external reference. Otherwise
-    // we look up the referenced node in the current document.
-    if (cachedSVGDocument)
-        document = cachedSVGDocument->document();
-
-    if (!document)
-        return 0;
-
-    Element* filter = document->getElementById(filterOperation->fragment());
-    if (!filter) {
-        // Although we did not find the referenced filter, it might exist later
-        // in the document
-        document->accessSVGExtensions()->addPendingResource(filterOperation->fragment(), toElement(renderer->node()));
-        return 0;
-    }
-
-    if (!filter->isSVGElement() || !filter->hasTagName(SVGNames::filterTag))
-        return 0;
-
-    SVGFilterElement* filterElement = toSVGFilterElement(toSVGElement(filter));
-
-    RefPtr<FilterEffect> effect;
-
-    // FIXME: Figure out what to do with SourceAlpha. Right now, we're
-    // using the alpha of the original input layer, which is obviously
-    // wrong. We should probably be extracting the alpha from the 
-    // previousEffect, but this requires some more processing.  
-    // This may need a spec clarification.
-    RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
-
-    ColorSpace filterColorSpace = ColorSpaceDeviceRGB;
-    const bool useFilterColorSpace = getSVGStyledElementColorSpace(filterElement, filterColorSpace);
-
-    for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
-        if (!node->isSVGElement())
-            continue;
-
-        SVGElement* element = toSVGElement(node);
-        if (!element->isFilterEffect())
-            continue;
-
-        SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
-
-        effect = effectElement->build(builder.get(), this);
-        if (!effect)
-            continue;
-
-        effectElement->setStandardAttributes(effect.get());
-        effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits(), sourceImageRect()));
-
-        ColorSpace colorSpace = filterColorSpace;
-        if (useFilterColorSpace || getSVGStyledElementColorSpace(effectElement, colorSpace))
-            effect->setOperatingColorSpace(colorSpace);
-        builder->add(effectElement->result(), effect);
-        m_effects.append(effect);
-    }
-    return effect;
-}
-
 bool FilterEffectRenderer::build(RenderObject* renderer, const FilterOperations& operations)
 {
     m_hasCustomShaderFilter = false;
     m_hasFilterThatMovesPixels = operations.hasFilterThatMovesPixels();
-    
-    // Keep the old effects on the stack until we've created the new effects.
-    // New FECustomFilters can reuse cached resources from old FECustomFilters.
-    FilterEffectList oldEffects;
-    m_effects.swap(oldEffects);
 
-    // Inverse zoom the pre-zoomed CSS shorthand filters, so that they are in the zoom as the unzoomed reference filters
+    // Inverse zoom the pre-zoomed CSS shorthand filters, so that they are in the same zoom as the unzoomed reference filters.
     const RenderStyle* style = renderer->style();
-    float zoom = style ? style->effectiveZoom() : 1.0f;
-    float invZoom = 1.0f / zoom;
-    // Apply zoom to filter region here so that applyHorizontalScale/applyVerticalScale will
-    // work while create hardware filters through FE<some filter effect>::createImageFilter()
-    setFilterRegion(FloatRect(0, 0, 1, 1));
-    setAbsoluteFilterRegion(FloatRect(0, 0, zoom, zoom));
+    // FIXME: The effects now contain high dpi information, but the software path doesn't (yet) scale its backing.
+    //        When the proper dpi dependant backing size is allocated, we should remove deviceScaleFactor(...) here.
+    float invZoom = 1.0f / ((style ? style->effectiveZoom() : 1.0f) * deviceScaleFactor(renderer->frame()));
 
     RefPtr<FilterEffect> previousEffect = m_sourceGraphic;
     for (size_t i = 0; i < operations.operations().size(); ++i) {
@@ -245,8 +127,7 @@
         switch (filterOperation->getOperationType()) {
         case FilterOperation::REFERENCE: {
             ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
-            effect = buildReferenceFilter(renderer, previousEffect, referenceOperation);
-            referenceOperation->setFilterEffect(effect, this);
+            effect = ReferenceFilterBuilder::build(this, renderer, previousEffect.get(), referenceOperation);
             break;
         }
         case FilterOperation::GRAYSCALE: {
@@ -405,14 +286,17 @@
                 effect->setClipsToBounds(false);
                 effect->setOperatingColorSpace(ColorSpaceDeviceRGB);
                 effect->inputEffects().append(previousEffect);
-                m_effects.append(effect);
             }
             previousEffect = effect.release();
         }
     }
 
+    // We need to keep the old effects alive until this point, so that filters like FECustomFilter
+    // can share cached resources across frames.
+    m_lastEffect = previousEffect;
+
     // If we didn't make any effects, tell our caller we are not valid
-    if (!m_effects.size())
+    if (!m_lastEffect.get())
         return false;
 
     return true;
@@ -445,9 +329,8 @@
 
 void FilterEffectRenderer::clearIntermediateResults()
 {
-    m_sourceGraphic->clearResult();
-    for (size_t i = 0; i < m_effects.size(); ++i)
-        m_effects[i]->clearResult();
+    if (m_lastEffect.get())
+        m_lastEffect->clearResultsRecursive();
 }
 
 void FilterEffectRenderer::apply()
diff --git a/Source/core/rendering/FilterEffectRenderer.h b/Source/core/rendering/FilterEffectRenderer.h
index eb80830..9fd408d 100644
--- a/Source/core/rendering/FilterEffectRenderer.h
+++ b/Source/core/rendering/FilterEffectRenderer.h
@@ -43,7 +43,6 @@
 
 namespace WebCore {
 
-typedef Vector<RefPtr<FilterEffect> > FilterEffectList;
 class CachedShader;
 class CustomFilterProgram;
 class Document;
@@ -96,7 +95,6 @@
     ImageBuffer* output() const { return lastEffect()->asImageBuffer(); }
 
     bool build(RenderObject* renderer, const FilterOperations&);
-    PassRefPtr<FilterEffect> buildReferenceFilter(RenderObject* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation*);
     bool updateBackingStoreRect(const FloatRect& filterRect);
     void allocateBackingStoreIfNeeded();
     void clearIntermediateResults();
@@ -110,9 +108,7 @@
     bool hasCustomShaderFilter() const { return m_hasCustomShaderFilter; }
     PassRefPtr<FilterEffect> lastEffect() const
     {
-        if (m_effects.size() > 0)
-            return m_effects.last();
-        return 0;
+        return m_lastEffect;
     }
 private:
 
@@ -121,8 +117,8 @@
     
     FloatRect m_sourceDrawingRegion;
     
-    FilterEffectList m_effects;
     RefPtr<SourceGraphic> m_sourceGraphic;
+    RefPtr<FilterEffect> m_lastEffect;
     
     IntRectExtent m_outsets;
 
diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp
index ec11a7b..fd72506 100644
--- a/Source/core/rendering/HitTestResult.cpp
+++ b/Source/core/rendering/HitTestResult.cpp
@@ -30,9 +30,12 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLAnchorElement.h"
+#include "core/html/HTMLAreaElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLMediaElement.h"
+#include "core/html/HTMLTextAreaElement.h"
+#include "core/html/HTMLVideoElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/loader/cache/CachedImage.h"
 #include "core/page/Frame.h"
@@ -313,7 +316,7 @@
     if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()->isMedia()))
         return 0;
 
-    if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag))
+    if (isHTMLVideoElement(m_innerNonSharedNode.get()) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag))
         return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
     return 0;
 }
@@ -324,7 +327,7 @@
         return KURL();
 
     AtomicString urlString;
-    if (m_innerURLElement->hasTagName(aTag) || m_innerURLElement->hasTagName(areaTag) || m_innerURLElement->hasTagName(linkTag))
+    if (isHTMLAnchorElement(m_innerURLElement.get()) || isHTMLAreaElement(m_innerURLElement.get()) || m_innerURLElement->hasTagName(linkTag))
         urlString = m_innerURLElement->getAttribute(hrefAttr);
     else if (m_innerURLElement->hasTagName(SVGNames::aTag))
         urlString = m_innerURLElement->getAttribute(XLinkNames::hrefAttr);
@@ -339,8 +342,8 @@
     if (!(m_innerURLElement && m_innerURLElement->document()))
         return false;
 
-    if (m_innerURLElement->hasTagName(aTag))
-        return static_cast<HTMLAnchorElement*>(m_innerURLElement.get())->isLiveLink();
+    if (isHTMLAnchorElement(m_innerURLElement.get()))
+        return toHTMLAnchorElement(m_innerURLElement.get())->isLiveLink();
 
     if (m_innerURLElement->hasTagName(SVGNames::aTag))
         return m_innerURLElement->isLink();
@@ -383,7 +386,7 @@
     if (!m_innerNonSharedNode)
         return false;
 
-    if (m_innerNonSharedNode->hasTagName(textareaTag))
+    if (isHTMLTextAreaElement(m_innerNonSharedNode.get()))
         return true;
 
     if (m_innerNonSharedNode->hasTagName(inputTag))
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index 381320e..c016016 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -374,7 +374,7 @@
 
 bool InlineTextBox::isLineBreak() const
 {
-    return renderer()->isBR() || (renderer()->style()->preserveNewline() && len() == 1 && (*textRenderer()->text())[start()] == '\n');
+    return renderer()->isBR() || (renderer()->style()->preserveNewline() && len() == 1 && (*textRenderer()->text().impl())[start()] == '\n');
 }
 
 bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
diff --git a/Source/core/rendering/LayoutState.cpp b/Source/core/rendering/LayoutState.cpp
index 7573e4e..e89cd1b 100644
--- a/Source/core/rendering/LayoutState.cpp
+++ b/Source/core/rendering/LayoutState.cpp
@@ -62,8 +62,8 @@
 
     m_layoutOffset = m_paintOffset;
 
-    if (renderer->hasPaintOffset() && renderer->hasLayer())
-        m_paintOffset += renderer->layer()->paintOffset();
+    if (renderer->isInFlowPositioned() && renderer->hasLayer())
+        m_paintOffset += renderer->layer()->offsetForInFlowPosition();
 
     m_clipped = !fixed && prev->m_clipped;
     if (m_clipped)
diff --git a/Source/core/rendering/OrderIterator.cpp b/Source/core/rendering/OrderIterator.cpp
index b11cd58..d55779c 100644
--- a/Source/core/rendering/OrderIterator.cpp
+++ b/Source/core/rendering/OrderIterator.cpp
@@ -31,46 +31,17 @@
 #include "config.h"
 #include "core/rendering/OrderIterator.h"
 
-#include "core/rendering/RenderFlexibleBox.h"
+#include "core/rendering/RenderBox.h"
 
 namespace WebCore {
 
-OrderIterator::OrderIterator(const RenderFlexibleBox* flexibleBox)
-    : m_flexibleBox(flexibleBox)
+OrderIterator::OrderIterator(const RenderBox* containerBox)
+    : m_containerBox(containerBox)
     , m_currentChild(0)
     , m_orderValuesIterator(0)
 {
 }
 
-void OrderIterator::setOrderValues(Vector<int>& orderValues)
-{
-    reset();
-    m_orderValues.clear();
-
-    if (orderValues.isEmpty())
-        return;
-
-    std::sort(orderValues.begin(), orderValues.end());
-
-
-    // This is inefficient if there are many repeated values, but
-    // saves a lot of allocations when the values are unique. By far,
-    // the common case is that there's exactly one item in the list
-    // (the default order value of 0).
-    m_orderValues.reserveInitialCapacity(orderValues.size());
-
-    int previous = orderValues[0];
-    m_orderValues.append(previous);
-    for (size_t i = 1; i < orderValues.size(); ++i) {
-        int current = orderValues[i];
-        if (current == previous)
-            continue;
-        m_orderValues.append(current);
-        previous = current;
-    }
-    m_orderValues.shrinkToFit();
-}
-
 RenderBox* OrderIterator::first()
 {
     reset();
@@ -91,7 +62,7 @@
                 m_orderValuesIterator = m_orderValues.begin();
             }
 
-            m_currentChild = m_flexibleBox->firstChildBox();
+            m_currentChild = m_containerBox->firstChildBox();
         } else {
             m_currentChild = m_currentChild->nextSiblingBox();
         }
@@ -106,4 +77,46 @@
     m_orderValuesIterator = 0;
 }
 
+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::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;
+}
+
 } // namespace WebCore
diff --git a/Source/core/rendering/OrderIterator.h b/Source/core/rendering/OrderIterator.h
index 9c36d7f..8639bdc 100644
--- a/Source/core/rendering/OrderIterator.h
+++ b/Source/core/rendering/OrderIterator.h
@@ -37,25 +37,51 @@
 namespace WebCore {
 
 class RenderBox;
-class RenderFlexibleBox;
 
 class OrderIterator {
     WTF_MAKE_NONCOPYABLE(OrderIterator);
 public:
-    OrderIterator(const RenderFlexibleBox*);
-    void setOrderValues(Vector<int>&);
+    friend class OrderIteratorPopulator;
+
+    OrderIterator(const RenderBox*);
+
     RenderBox* currentChild() const { return m_currentChild; }
     RenderBox* first();
     RenderBox* next();
     void reset();
 
 private:
-    const RenderFlexibleBox* m_flexibleBox;
+    const RenderBox* m_containerBox;
     RenderBox* m_currentChild;
-    Vector<int> m_orderValues;
+    // 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;
+    OrderValues m_orderValues;
     Vector<int>::const_iterator m_orderValuesIterator;
 };
 
+class OrderIteratorPopulator {
+public:
+    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);
+    }
+
+    ~OrderIteratorPopulator();
+
+    void collectChild(const RenderBox*);
+
+private:
+    void removeDuplicatedOrderValues();
+
+    OrderIterator& m_iterator;
+    bool m_anyChildHasDefaultOrderValue;
+};
+
 } // namespace WebCore
 
 #endif //  OrderIterator_h
diff --git a/Source/core/rendering/Pagination.cpp b/Source/core/rendering/Pagination.cpp
new file mode 100644
index 0000000..26822b0
--- /dev/null
+++ b/Source/core/rendering/Pagination.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/rendering/Pagination.h"
+
+#include "core/rendering/style/RenderStyle.h"
+
+namespace WebCore {
+
+void Pagination::setStylesForPaginationMode(Mode paginationMode, RenderStyle* style)
+{
+    if (paginationMode == Unpaginated)
+        return;
+
+    switch (paginationMode) {
+    case LeftToRightPaginated:
+        style->setColumnAxis(HorizontalColumnAxis);
+        if (style->isHorizontalWritingMode())
+            style->setColumnProgression(style->isLeftToRightDirection() ? NormalColumnProgression : ReverseColumnProgression);
+        else
+            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? ReverseColumnProgression : NormalColumnProgression);
+        break;
+    case RightToLeftPaginated:
+        style->setColumnAxis(HorizontalColumnAxis);
+        if (style->isHorizontalWritingMode())
+            style->setColumnProgression(style->isLeftToRightDirection() ? ReverseColumnProgression : NormalColumnProgression);
+        else
+            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? NormalColumnProgression : ReverseColumnProgression);
+        break;
+    case TopToBottomPaginated:
+        style->setColumnAxis(VerticalColumnAxis);
+        if (style->isHorizontalWritingMode())
+            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? ReverseColumnProgression : NormalColumnProgression);
+        else
+            style->setColumnProgression(style->isLeftToRightDirection() ? NormalColumnProgression : ReverseColumnProgression);
+        break;
+    case BottomToTopPaginated:
+        style->setColumnAxis(VerticalColumnAxis);
+        if (style->isHorizontalWritingMode())
+            style->setColumnProgression(style->isFlippedBlocksWritingMode() ? NormalColumnProgression : ReverseColumnProgression);
+        else
+            style->setColumnProgression(style->isLeftToRightDirection() ? ReverseColumnProgression : NormalColumnProgression);
+        break;
+    case Unpaginated:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+}
+
+} // namespace WebCore
diff --git a/Source/core/rendering/Pagination.h b/Source/core/rendering/Pagination.h
index 1afad69..ce695f7 100644
--- a/Source/core/rendering/Pagination.h
+++ b/Source/core/rendering/Pagination.h
@@ -28,6 +28,8 @@
 
 namespace WebCore {
 
+class RenderStyle;
+
 struct Pagination {
     enum Mode { Unpaginated, LeftToRightPaginated, RightToLeftPaginated, TopToBottomPaginated, BottomToTopPaginated };
 
@@ -53,6 +55,8 @@
     bool behavesLikeColumns;
     unsigned pageLength;
     unsigned gap;
+
+    static void setStylesForPaginationMode(Mode, RenderStyle*);
 };
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 099adda..5d04032 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -78,7 +78,7 @@
 using namespace HTMLNames;
 
 struct SameSizeAsRenderBlock : public RenderBox {
-    void* pointers[2];
+    void* pointers[1];
     RenderObjectChildList children;
     RenderLineBoxList lineBoxes;
     uint32_t bitfields;
@@ -105,9 +105,11 @@
 
 static TrackedDescendantsMap* gPositionedDescendantsMap = 0;
 static TrackedDescendantsMap* gPercentHeightDescendantsMap = 0;
+static TrackedFloatMap* gFloatingObjectMap = 0;
 
 static TrackedContainerMap* gPositionedContainerMap = 0;
 static TrackedContainerMap* gPercentHeightContainerMap = 0;
+static TrackedContainerMap* gFloatingObjectContainerMap = 0;
     
 typedef WTF::HashMap<RenderBlock*, OwnPtr<ListHashSet<RenderInline*> > > ContinuationOutlineTableMap;
 
@@ -226,11 +228,40 @@
     }
 }
 
+void RenderBlock::removeBlockFromFloatMaps(DeleteFloatMapValues deleteValues)
+{
+    FloatingObjects* floats = floatingObjects();
+
+    // Container map entries are only cleared when the RenderBlock or the float are being destroyed.
+    // This means that it might contain obsolete entries, but the performance cost of modifying the
+    // container map during layout is very high, and it is much easier to deal with the extra entries
+    // when iterating container maps.
+    if (beingDestroyed()) {
+        FloatingObjectSetIterator end = floats->set().end();
+        for (FloatingObjectSetIterator floatIterator = floats->set().begin(); floatIterator != end; ++floatIterator) {
+            TrackedContainerMap::iterator it = gFloatingObjectContainerMap->find((*floatIterator)->m_renderer);
+            ASSERT(it != gFloatingObjectContainerMap->end());
+            if (it == gFloatingObjectContainerMap->end())
+                continue;
+            HashSet<RenderBlock*>* containerSet = it->value.get();
+            ASSERT(containerSet->contains(this));
+            containerSet->remove(this);
+            if (containerSet->isEmpty())
+                gFloatingObjectContainerMap->remove(it);
+        }
+    }
+    if (deleteValues == DeleteAllValues)
+        deleteAllValues(floats->set());
+    floats->clear();
+}
+
 RenderBlock::~RenderBlock()
 {
-    if (m_floatingObjects)
-        deleteAllValues(m_floatingObjects->set());
-    
+    if (floatingObjects()) {
+        removeBlockFromFloatMaps();
+        gFloatingObjectMap->remove(this);
+    }
+
     if (hasColumns())
         gColumnInfoMap->take(this);
 
@@ -375,7 +406,7 @@
     bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !avoidsFloats();
     if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canPropagateFloatIntoSibling && hasOverhangingFloats()) {
         RenderBlock* parentBlock = this;
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
         FloatingObjectSetIterator end = floatingObjectSet.end();
 
         for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
@@ -855,7 +886,7 @@
             // We are placing a column-span element inside a block.
             RenderBlock* newBox = createAnonymousColumnSpanBlock();
         
-            if (columnsBlockAncestor != this) {
+            if (columnsBlockAncestor != this && !isRenderFlowThread()) {
                 // We are nested inside a multi-column element and are being split by the span. We have to break up
                 // our block into continuations.
                 RenderBoxModelObject* oldContinuation = continuation();
@@ -982,7 +1013,7 @@
 {
     if (containsFloats()) {
         // Clear references to originating lines, since the lines are being deleted
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
         FloatingObjectSetIterator end = floatingObjectSet.end();
         for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
             ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->renderer() == this);
@@ -1178,11 +1209,11 @@
     // already marked for layout, this will get fixed before anything gets
     // displayed.
     // See bug https://code.google.com/p/chromium/issues/detail?id=230907
-    if (m_floatingObjects) {
-        if (!toBlock->m_floatingObjects)
+    if (floatingObjects()) {
+        if (!toBlock->floatingObjects())
             toBlock->createFloatingObjects();
 
-        const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set();
+        const FloatingObjectSet& fromFloatingObjectSet = floatingObjects()->set();
         FloatingObjectSetIterator end = fromFloatingObjectSet.end();
 
         for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it != end; ++it) {
@@ -1192,7 +1223,7 @@
             if (toBlock->containsFloat(floatingObject->renderer()))
                 continue;
 
-            toBlock->m_floatingObjects->add(floatingObject->clone());
+            toBlock->insertIntoFloatingObjectMaps(floatingObject->clone());
         }
     }
 
@@ -1786,10 +1817,11 @@
 
 void RenderBlock::addOverflowFromFloats()
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return;
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* r = *it;
@@ -2882,7 +2914,7 @@
     // FIXME: Avoid disabling LayoutState. At the very least, don't disable it for floats originating
     // in this block. Better yet would be to push extra state for the containers of other floats.
     LayoutStateDisabler layoutStateDisabler(view());
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* r = *it;
@@ -3234,10 +3266,11 @@
 
 void RenderBlock::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paintOffset, bool preservePhase)
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return;
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* r = *it;
@@ -3462,8 +3495,8 @@
         if (isBody() || isRoot()) // The <body> must make sure to examine its containingBlock's positioned objects.
             for (RenderBlock* cb = containingBlock(); cb && !cb->isRenderView(); cb = cb->containingBlock())
                 clipOutPositionedObjects(paintInfo, LayoutPoint(cb->x(), cb->y()), cb->positionedObjects()); // FIXME: Not right for flipped writing modes.
-        if (m_floatingObjects) {
-            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        if (FloatingObjects* floats = floatingObjects()) {
+            const FloatingObjectSet& floatingObjectSet = floats->set();
             FloatingObjectSetIterator end = floatingObjectSet.end();
             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
                 FloatingObject* r = *it;
@@ -3575,10 +3608,10 @@
         if (curr->isFloatingOrOutOfFlowPositioned())
             continue; // We must be a normal flow object in order to even be considered.
 
-        if (curr->hasPaintOffset() && curr->hasLayer()) {
+        if (curr->isInFlowPositioned() && curr->hasLayer()) {
             // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element.
             // Just disregard it completely.
-            LayoutSize relOffset = curr->layer()->paintOffset();
+            LayoutSize relOffset = curr->layer()->offsetForInFlowPosition();
             if (relOffset.width() || relOffset.height())
                 continue;
         }
@@ -3868,23 +3901,82 @@
 
 void RenderBlock::removeFloatingObjects()
 {
-    if (!m_floatingObjects)
+    if (floatingObjects())
+        removeBlockFromFloatMaps();
+}
+
+void RenderBlock::insertIntoFloatingObjectMaps(FloatingObject* floatingObject)
+{
+    FloatingObjects* floats = floatingObjects();
+    HashSet<RenderBlock*>* containerSet = gFloatingObjectContainerMap->get(floatingObject->renderer());
+
+    floats->add(floatingObject);
+
+    if (!containerSet) {
+        containerSet = new HashSet<RenderBlock*>;
+        gFloatingObjectContainerMap->set(floatingObject->renderer(), adoptPtr(containerSet));
+    }
+    containerSet->add(this);
+}
+
+void RenderBlock::floatWillBeRemoved(RenderBox* floatingObject)
+{
+    if (!gFloatingObjectContainerMap)
+        return;
+    OwnPtr<HashSet<RenderBlock*> > containerSet = gFloatingObjectContainerMap->take(floatingObject);
+    if (!containerSet)
         return;
 
-    deleteAllValues(m_floatingObjects->set());
-    m_floatingObjects->clear();
+    HashSet<RenderBlock*>::iterator end = containerSet->end();
+    for (HashSet<RenderBlock*>::iterator it = containerSet->begin(); it != end; ++it) {
+        RenderBlock* container = *it;
+
+        TrackedFloatMap::iterator floatIterator = gFloatingObjectMap->find(container);
+        if (floatIterator == gFloatingObjectMap->end())
+            continue;
+        FloatingObjects* floatingObjects = floatIterator->value.get();
+        const FloatingObjectSet& floatingObjectSet = floatingObjects->set();
+        FloatingObjectSetIterator floatIt = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(floatingObject);
+        if (floatIt != floatingObjectSet.end())
+            floatingObjects->remove(*floatIt);
+        if (floatingObjects->set().isEmpty())
+            gFloatingObjectMap->remove(floatIterator);
+    }
 }
 
+void RenderBlock::removeFromFloatingObjectMaps(FloatingObject* floatingObject)
+{
+    TrackedContainerMap::iterator it = gFloatingObjectContainerMap->find(floatingObject->m_renderer);
+    if (it == gFloatingObjectContainerMap->end())
+        return;
+
+    HashSet<RenderBlock*>* containerSet = it->value.get();
+    HashSet<RenderBlock*>::iterator end = containerSet->end();
+
+    TrackedFloatMap::iterator floatIterator = gFloatingObjectMap->find(this);
+    ASSERT(floatIterator != gFloatingObjectMap->end());
+    if (floatIterator != gFloatingObjectMap->end()) {
+        FloatingObjects* floatingObjects = floatIterator->value.get();
+        ASSERT(floatingObjects->set().contains(floatingObject));
+        floatingObjects->remove(floatingObject);
+    }
+
+    containerSet->remove(this);
+    if (containerSet->isEmpty())
+        gFloatingObjectContainerMap->remove(floatingObject->m_renderer);
+}
+
+
 RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o)
 {
     ASSERT(o->isFloating());
 
     // Create the list of special objects if we don't aleady have one
-    if (!m_floatingObjects)
+    if (!floatingObjects())
         createFloatingObjects();
     else {
         // Don't insert the object again if it's already in the list
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
         FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(o);
         if (it != floatingObjectSet.end())
             return *it;
@@ -3908,28 +4000,25 @@
         o->computeAndSetBlockDirectionMargins(this);
     }
 
-    ShapeOutsideInfo* shapeOutside = o->shapeOutsideInfo();
-    if (shapeOutside) {
-        shapeOutside->setShapeSize(o->logicalWidth(), o->logicalHeight());
-        // The CSS Shapes specification says that the margins are ignored
-        // when a float has a shape outside.
-        setLogicalWidthForFloat(newObj, shapeOutside->shapeLogicalWidth());
-    } else
-        setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o));
+    setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o));
+
+    if (ShapeOutsideInfo* shapeOutside = o->shapeOutsideInfo())
+        shapeOutside->setShapeSize(logicalWidthForChild(o), logicalHeightForChild(o));
 
     newObj->setShouldPaint(!o->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will.
     newObj->setIsDescendant(true);
     newObj->m_renderer = o;
 
-    m_floatingObjects->add(newObj);
+    insertIntoFloatingObjectMaps(newObj);
     
     return newObj;
 }
 
 void RenderBlock::removeFloatingObject(RenderBox* o)
 {
-    if (m_floatingObjects) {
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    FloatingObjects* floats = floatingObjects();
+    if (floats) {
+        const FloatingObjectSet& floatingObjectSet = floats->set();
         FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(o);
         if (it != floatingObjectSet.end()) {
             FloatingObject* r = *it;
@@ -3957,7 +4046,7 @@
                 }
                 markLinesDirtyInBlockRange(0, logicalBottom);
             }
-            m_floatingObjects->remove(r);
+            removeFromFloatingObjectMaps(r);
             ASSERT(!r->m_originatingLine);
             delete r;
         }
@@ -3969,10 +4058,10 @@
     if (!containsFloats())
         return;
     
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
     FloatingObject* curr = floatingObjectSet.last();
     while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(curr) >= logicalOffset)) {
-        m_floatingObjects->remove(curr);
+        removeFromFloatingObjectMaps(curr);
         ASSERT(!curr->m_originatingLine);
         delete curr;
         if (floatingObjectSet.isEmpty())
@@ -4008,10 +4097,10 @@
     if (childBox->style()->floating() == LeftFloat) {
         LayoutUnit heightRemainingLeft = 1;
         LayoutUnit heightRemainingRight = 1;
-        floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft);
-        while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) {
+        floatLogicalLeft = logicalLeftOffsetForLineIgnoringShapeOutside(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft);
+        while (logicalRightOffsetForLineIgnoringShapeOutside(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) {
             logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
-            floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft);
+            floatLogicalLeft = logicalLeftOffsetForLineIgnoringShapeOutside(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft);
             if (insideFlowThread) {
                 // Have to re-evaluate all of our offsets, since they may have changed.
                 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset.
@@ -4023,10 +4112,10 @@
     } else {
         LayoutUnit heightRemainingLeft = 1;
         LayoutUnit heightRemainingRight = 1;
-        floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight);
-        while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) {
+        floatLogicalLeft = logicalRightOffsetForLineIgnoringShapeOutside(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight);
+        while (floatLogicalLeft - logicalLeftOffsetForLineIgnoringShapeOutside(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) {
             logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
-            floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight);
+            floatLogicalLeft = logicalRightOffsetForLineIgnoringShapeOutside(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight);
             if (insideFlowThread) {
                 // Have to re-evaluate all of our offsets, since they may have changed.
                 logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset.
@@ -4044,10 +4133,11 @@
 
 bool RenderBlock::positionNewFloats()
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return false;
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     if (floatingObjectSet.isEmpty())
         return false;
 
@@ -4140,12 +4230,10 @@
         }
 
         setLogicalTopForFloat(floatingObject, floatLogicalLocation.y());
-        if (childBox->shapeOutsideInfo())
-            setLogicalHeightForFloat(floatingObject, childBox->shapeOutsideInfo()->shapeLogicalHeight());
-        else
-            setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
 
-        m_floatingObjects->addPlacedObject(floatingObject);
+        setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
+
+        floats->addPlacedObject(floatingObject);
 
         // If the child moved, we have to repaint it.
         if (childBox->checkForRepaintDuringLayout())
@@ -4311,24 +4399,33 @@
     return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? boxRect.maxX() : boxRect.maxY()));
 }
 
-LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit logicalHeight) const
+LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode offsetMode) const
 {
     LayoutUnit left = fixedOffset;
-    if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) {
+    FloatingObjects* floats = floatingObjects();
+    if (floats && floats->hasLeftObjects()) {
         if (heightRemaining)
             *heightRemaining = 1;
 
         FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemaining);
-        m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
+        floats->placedFloatsTree().allOverlapsWithAdapter(adapter);
 
-        if (const FloatingObject* lastFloat = adapter.lastFloat()) {
+        const FloatingObject* lastFloat = adapter.lastFloat();
+        if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
             if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) {
-                shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight);
-                left += shapeOutside->rightSegmentShapeBoundingBoxDelta();
+                shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat), logicalHeight);
+                left += shapeOutside->rightSegmentMarginBoxDelta();
             }
         }
     }
 
+    return left;
+}
+
+LayoutUnit RenderBlock::adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const
+{
+    LayoutUnit left = offsetFromFloats;
+
     if (applyTextIndent && style()->isLeftToRightDirection())
         left += textIndentOffset();
 
@@ -4363,27 +4460,35 @@
     return left;
 }
 
-LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining, LayoutUnit logicalHeight) const
+LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode offsetMode) const
 {
     LayoutUnit right = fixedOffset;
-    if (m_floatingObjects && m_floatingObjects->hasRightObjects()) {
+    FloatingObjects* floats = floatingObjects();
+    if (floats && floats->hasRightObjects()) {
         if (heightRemaining)
             *heightRemaining = 1;
 
         LayoutUnit rightFloatOffset = fixedOffset;
         FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, heightRemaining);
-        m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
+        floats->placedFloatsTree().allOverlapsWithAdapter(adapter);
 
-        if (const FloatingObject* lastFloat = adapter.lastFloat()) {
+        const FloatingObject* lastFloat = adapter.lastFloat();
+        if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
             if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) {
-                shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight);
-                rightFloatOffset += shapeOutside->leftSegmentShapeBoundingBoxDelta();
+                shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat), logicalHeight);
+                rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta();
             }
         }
 
         right = min(right, rightFloatOffset);
     }
+    return right;
+}
     
+LayoutUnit RenderBlock::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const
+{
+    LayoutUnit right = offsetFromFloats;
+
     if (applyTextIndent && !style()->isLeftToRightDirection())
         right -= textIndentOffset();
     
@@ -4420,11 +4525,12 @@
 
 LayoutUnit RenderBlock::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight) const
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return logicalHeight;
 
     LayoutUnit bottom = LayoutUnit::max();
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* r = *it;
@@ -4438,10 +4544,11 @@
 
 LayoutUnit RenderBlock::lowestFloatLogicalBottom(FloatingObject::Type floatType) const
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return 0;
     LayoutUnit lowestFloatBottom = 0;
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* r = *it;
@@ -4471,12 +4578,13 @@
 
 void RenderBlock::clearFloats()
 {
-    if (m_floatingObjects)
-        m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
+    FloatingObjects* floats = floatingObjects();
+    if (floats)
+        floats->setHorizontalWritingMode(isHorizontalWritingMode());
 
     HashSet<RenderBox*> oldIntrudingFloatSet;
-    if (!childrenInline() && m_floatingObjects) {
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    if (!childrenInline() && floats) {
+        const FloatingObjectSet& floatingObjectSet = floats->set();
         FloatingObjectSetIterator end = floatingObjectSet.end();
         for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
             FloatingObject* floatingObject = *it;
@@ -4487,10 +4595,8 @@
 
     // Inline blocks are covered by the isReplaced() check in the avoidFloats method.
     if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrOutOfFlowPositioned() || isTableCell()) {
-        if (m_floatingObjects) {
-            deleteAllValues(m_floatingObjects->set());
-            m_floatingObjects->clear();
-        }
+        if (floats)
+            removeBlockFromFloatMaps();
         if (!oldIntrudingFloatSet.isEmpty())
             markAllDescendantsWithFloatsForLayout();
         return;
@@ -4499,17 +4605,18 @@
     typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap;
     RendererToFloatInfoMap floatMap;
 
-    if (m_floatingObjects) {
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    if (floats) {
+        const FloatingObjectSet& floatingObjectSet = floats->set();
         if (childrenInline()) {
             FloatingObjectSetIterator end = floatingObjectSet.end();
             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
                 FloatingObject* f = *it;
                 floatMap.add(f->m_renderer, f);
             }
-        } else
-            deleteAllValues(floatingObjectSet);
-        m_floatingObjects->clear();
+            removeBlockFromFloatMaps(DoNotDeleteValues);
+        } else {
+            removeBlockFromFloatMaps();
+        }
     }
 
     // We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add 
@@ -4545,14 +4652,14 @@
 
     // Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.    
     RenderBlock* block = toRenderBlock(prev);
-    if (block->m_floatingObjects && block->lowestFloatLogicalBottom() > logicalTopOffset)
+    if (block->floatingObjects() && block->lowestFloatLogicalBottom() > logicalTopOffset)
         addIntrudingFloats(block, logicalLeftOffset, logicalTopOffset);
 
     if (childrenInline()) {
         LayoutUnit changeLogicalTop = LayoutUnit::max();
         LayoutUnit changeLogicalBottom = LayoutUnit::min();
-        if (m_floatingObjects) {
-            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        if (floats) {
+            const FloatingObjectSet& floatingObjectSet = floats->set();
             FloatingObjectSetIterator end = floatingObjectSet.end();
             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
                 FloatingObject* f = *it;
@@ -4603,10 +4710,10 @@
     } else if (!oldIntrudingFloatSet.isEmpty()) {
         // If there are previously intruding floats that no longer intrude, then children with floats
         // should also get layout because they might need their floating object lists cleared.
-        if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size())
+        if (floats->set().size() < oldIntrudingFloatSet.size())
             markAllDescendantsWithFloatsForLayout();
         else {
-            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+            const FloatingObjectSet& floatingObjectSet = floats->set();
             FloatingObjectSetIterator end = floatingObjectSet.end();
             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it)
                 oldIntrudingFloatSet.remove((*it)->m_renderer);
@@ -4628,8 +4735,9 @@
 
     // Floats that will remain the child's responsibility to paint should factor into its
     // overflow.
-    FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end();
-    for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) {
+    FloatingObjects* childFloats = child->floatingObjects();
+    FloatingObjectSetIterator childEnd = childFloats->set().end();
+    for (FloatingObjectSetIterator childIt = childFloats->set().begin(); childIt != childEnd; ++childIt) {
         FloatingObject* r = *childIt;
         LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(r), LayoutUnit::max() - childLogicalTop);
         LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat;
@@ -4654,9 +4762,9 @@
                 floatingObj->setIsDescendant(true);
 
                 // We create the floating object list lazily.
-                if (!m_floatingObjects)
+                if (!floatingObjects())
                     createFloatingObjects();
-                m_floatingObjects->add(floatingObj);
+                insertIntoFloatingObjectMaps(floatingObj);
             }
         } else {
             if (makeChildPaintOtherFloats && !r->shouldPaint() && !r->m_renderer->hasSelfPaintingLayer()
@@ -4680,10 +4788,11 @@
 
 bool RenderBlock::hasOverhangingFloat(RenderBox* renderer)
 {
-    if (!m_floatingObjects || hasColumns() || !parent())
+    FloatingObjects* floats = floatingObjects();
+    if (!floats || hasColumns() || !parent())
         return false;
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(renderer);
     if (it == floatingObjectSet.end())
         return false;
@@ -4696,17 +4805,19 @@
     ASSERT(!avoidsFloats());
 
     // If the parent or previous sibling doesn't have any floats to add, don't bother.
-    if (!prev->m_floatingObjects)
+    FloatingObjects* prevFloats = prev->floatingObjects();
+    if (!prevFloats)
         return;
 
     logicalLeftOffset += marginLogicalLeft();
 
-    const FloatingObjectSet& prevSet = prev->m_floatingObjects->set();
+    const FloatingObjectSet& prevSet = prevFloats->set();
     FloatingObjectSetIterator prevEnd = prevSet.end();
     for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd; ++prevIt) {
         FloatingObject* r = *prevIt;
         if (logicalBottomForFloat(r) > logicalTopOffset) {
-            if (!m_floatingObjects || !m_floatingObjects->set().contains(r)) {
+            FloatingObjects* floats = floatingObjects();
+            if (!floats || !floats->set().contains(r)) {
                 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOffset, logicalTopOffset) : LayoutSize(logicalTopOffset, logicalLeftOffset);
                 FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size()));
 
@@ -4726,9 +4837,9 @@
                 floatingObj->m_renderer = r->m_renderer;
                 
                 // We create the floating object list lazily.
-                if (!m_floatingObjects)
+                if (!floats)
                     createFloatingObjects();
-                m_floatingObjects->add(floatingObj);
+                insertIntoFloatingObjectMaps(floatingObj);
             }
         }
     }
@@ -4740,9 +4851,21 @@
     return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth();
 }
 
+RenderBlock::FloatingObjects* RenderBlock::floatingObjects() const
+{
+    return gFloatingObjectMap ? gFloatingObjectMap->get(this) : 0;
+}
+
+bool RenderBlock::containsFloats() const
+{
+    FloatingObjects* floats = floatingObjects();
+    return floats && !floats->set().isEmpty();
+}
+
 bool RenderBlock::containsFloat(RenderBox* renderer) const
 {
-    return m_floatingObjects && m_floatingObjects->set().contains<RenderBox*, FloatingObjectHashTranslator>(renderer);
+    FloatingObjects* floats = floatingObjects();
+    return floats && floats->set().contains<RenderBox*, FloatingObjectHashTranslator>(renderer);
 }
 
 void RenderBlock::markShapeInsideDescendantsForLayout()
@@ -4786,10 +4909,11 @@
 
 void RenderBlock::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove)
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return;
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
 
     for (RenderObject* next = nextSibling(); next; next = next->nextSibling()) {
@@ -4964,7 +5088,8 @@
 
 bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset)
 {
-    if (!m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!floats)
         return false;
 
     LayoutPoint adjustedLocation = accumulatedOffset;
@@ -4972,7 +5097,7 @@
         adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scrollPosition());
     }
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator begin = floatingObjectSet.begin();
     for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) {
         --it;
@@ -5140,8 +5265,8 @@
 static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBlock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates)
 {
     LayoutPoint childLocation = child->location();
-    if (child->hasPaintOffset())
-        childLocation += child->paintOffset();
+    if (child->isInFlowPositioned())
+        childLocation += child->offsetForInFlowPosition();
 
     // FIXME: This is wrong if the child's writing-mode is different from the parent's.
     LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation));
@@ -6853,8 +6978,8 @@
             }
         }
         
-        if (m_floatingObjects) {
-            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        if (FloatingObjects* floats = floatingObjects()) {
+            const FloatingObjectSet& floatingObjectSet = floats->set();
             FloatingObjectSetIterator end = floatingObjectSet.end();
             for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
                 FloatingObject* r = *it;
@@ -7880,7 +8005,12 @@
 
 void RenderBlock::createFloatingObjects()
 {
-    m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMode()));
+    if (!gFloatingObjectMap) {
+        gFloatingObjectMap = new TrackedFloatMap;
+        gFloatingObjectContainerMap = new TrackedContainerMap;
+    }
+
+    gFloatingObjectMap->set(this, adoptPtr(new FloatingObjects(this, isHorizontalWritingMode())));
 }
 
 inline void RenderBlock::FloatingObjects::clear()
@@ -8009,12 +8139,10 @@
     return run;
 }
 
-#if ENABLE(8BIT_TEXTRUN)
 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
 {
     return constructTextRunInternal(context, font, characters, length, style, expansion);
 }
-#endif
 
 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
 {
@@ -8023,38 +8151,27 @@
 
 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expansion)
 {
-#if ENABLE(8BIT_TEXTRUN)
     if (text->is8Bit())
         return constructTextRunInternal(context, font, text->characters8(), text->textLength(), style, expansion);
     return constructTextRunInternal(context, font, text->characters16(), text->textLength(), style, expansion);
-#else
-    return constructTextRunInternal(context, font, text->characters(), text->textLength(), style, expansion);
-#endif
 }
 
 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
 {
     ASSERT(offset + length <= text->textLength());
-#if ENABLE(8BIT_TEXTRUN)
     if (text->is8Bit())
         return constructTextRunInternal(context, font, text->characters8() + offset, length, style, expansion);
     return constructTextRunInternal(context, font, text->characters16() + offset, length, style, expansion);
-#else
-    return constructTextRunInternal(context, font, text->characters() + offset, length, style, expansion);
-#endif
 }
 
 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
 {
     unsigned length = string.length();
-
-#if ENABLE(8BIT_TEXTRUN)
-    if (length && string.is8Bit())
+    if (!length)
+        return constructTextRunInternal(context, font, static_cast<const LChar*>(0), length, style, expansion, flags);
+    if (string.is8Bit())
         return constructTextRunInternal(context, font, string.characters8(), length, style, expansion, flags);
-    return constructTextRunInternal(context, font, string.bloatedCharacters(), length, style, expansion, flags);
-#else
-    return constructTextRunInternal(context, font, string.bloatedCharacters(), length, style, expansion, flags);
-#endif
+    return constructTextRunInternal(context, font, string.characters16(), length, style, expansion, flags);
 }
 
 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const RenderObject* parent, EDisplay display)
@@ -8138,7 +8255,6 @@
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering);
     RenderBox::reportMemoryUsage(memoryObjectInfo);
-    info.addMember(m_floatingObjects, "floatingObjects");
     info.addMember(m_rareData, "rareData");
     info.addMember(m_children, "children");
     info.addMember(m_lineBoxes, "lineBoxes");
@@ -8151,6 +8267,8 @@
     memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMemoryTypes::RenderingStructures);
     memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryTypes::RenderingStructures);
     memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemoryTypes::RenderingStructures);
+    memoryInstrumentation->addRootObject(gFloatingObjectContainerMap, WebCoreMemoryTypes::RenderingStructures);
+    memoryInstrumentation->addRootObject(gFloatingObjectMap, WebCoreMemoryTypes::RenderingStructures);
     memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMemoryTypes::RenderingStructures);
 }
 
diff --git a/Source/core/rendering/RenderBlock.h b/Source/core/rendering/RenderBlock.h
index 3a92dae..d58c274 100644
--- a/Source/core/rendering/RenderBlock.h
+++ b/Source/core/rendering/RenderBlock.h
@@ -67,6 +67,8 @@
 enum CaretType { CursorCaret, DragCaret };
 enum ContainingBlockState { NewContainingBlock, SameContainingBlock };
 
+enum DeleteFloatMapValues { DeleteAllValues, DoNotDeleteValues };
+
 enum TextRunFlag {
     DefaultTextRunFlags = 0,
     RespectDirection = 1 << 0,
@@ -118,6 +120,7 @@
     void removePositionedObjects(RenderBlock*, ContainingBlockState = SameContainingBlock);
 
     void removeFloatingObjects();
+    static void floatWillBeRemoved(RenderBox*);
 
     TrackedRendererListHashSet* positionedObjects() const;
     bool hasPositionedObjects() const
@@ -156,7 +159,8 @@
     void markPositionedObjectsForLayout();
     virtual void markForPaginationRelayoutIfNeeded() OVERRIDE FINAL;
 
-    bool containsFloats() const { return m_floatingObjects && !m_floatingObjects->set().isEmpty(); }
+    bool containsFloats() const;
+
     bool containsFloat(RenderBox*) const;
 
     // Versions that can compute line offsets with the region and page offset passed in. Used for speed to avoid having to
@@ -293,10 +297,8 @@
     static TextRun constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, RenderStyle* style,
         TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
 
-#if ENABLE(8BIT_TEXTRUN)
     static TextRun constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle* style,
         TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
-#endif
 
     static TextRun constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style,
         TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
@@ -506,8 +508,22 @@
     virtual void paintChildren(PaintInfo&, const LayoutPoint&);
     void paintChild(RenderBox*, PaintInfo&, const LayoutPoint&);
 
-    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit logicalHeight = 0) const;
-    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit logicalHeight = 0) const;
+    LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining = 0, LayoutUnit logicalHeight = 0) const
+    {
+        return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(logicalTop, fixedOffset, heightRemaining, logicalHeight, ShapeOutsideFloatShapeOffset), applyTextIndent);
+    }
+    LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining = 0, LayoutUnit logicalHeight = 0) const
+    {
+        return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logicalTop, fixedOffset, heightRemaining, logicalHeight, ShapeOutsideFloatShapeOffset), applyTextIndent);
+    }
+    LayoutUnit logicalRightOffsetForLineIgnoringShapeOutside(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining = 0, LayoutUnit logicalHeight = 0) const
+    {
+        return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(logicalTop, fixedOffset, heightRemaining, logicalHeight, ShapeOutsideFloatMarginBoxOffset), applyTextIndent);
+    }
+    LayoutUnit logicalLeftOffsetForLineIgnoringShapeOutside(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining = 0, LayoutUnit logicalHeight = 0) const
+    {
+        return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logicalTop, fixedOffset, heightRemaining, logicalHeight, ShapeOutsideFloatMarginBoxOffset), applyTextIndent);
+    }
 
     virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
     virtual void adjustInlineDirectionLineBounds(int /* expansionOpportunityCount */, float& /* logicalLeft */, float& /* logicalWidth */) const { }
@@ -572,6 +588,13 @@
     virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight);
 
 private:
+    enum ShapeOutsideFloatOffsetMode { ShapeOutsideFloatShapeOffset, ShapeOutsideFloatMarginBoxOffset };
+
+    LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode) const;
+    LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode) const;
+    LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
+    LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
+
     void computeShapeSize();
     void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool);
     void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeValue* oldShape);
@@ -777,10 +800,6 @@
 
     LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const
     {
-        ShapeOutsideInfo *shapeOutside = child->renderer()->shapeOutsideInfo();
-        if (shapeOutside)
-            return child->x();
-
         if (isHorizontalWritingMode())
             return child->x() + child->renderer()->marginLeft();
         else
@@ -789,10 +808,6 @@
         
     LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) const
     {
-        ShapeOutsideInfo *shapeOutside = child->renderer()->shapeOutsideInfo();
-        if (shapeOutside)
-            return child->y();
-
         if (isHorizontalWritingMode())
             return child->y() + marginBeforeForChild(child->renderer());
         else
@@ -1169,9 +1184,9 @@
         // When computing the offset caused by the floats on a given line, if
         // the outermost float on that line has a shape-outside, the inline
         // content that butts up against that float must be positioned using
-        // the contours of the shape, not the shape's bounding box. We save the
-        // last float encountered so that the offset can be computed correctly
-        // by the code using this adapter.
+        // the contours of the shape, not the margin box of the float.
+        // We save the last float encountered so that the offset can be
+        // computed correctly by the code using this adapter.
         const FloatingObject* lastFloat() const { return m_last; }
 
     private:
@@ -1280,9 +1295,14 @@
 
 protected:
 
-    OwnPtr<FloatingObjects> m_floatingObjects;
     OwnPtr<RenderBlockRareData> m_rareData;
 
+    FloatingObjects* floatingObjects() const;
+
+    void removeBlockFromFloatMaps(DeleteFloatMapValues deleteValues = DeleteAllValues);
+    void insertIntoFloatingObjectMaps(FloatingObject*);
+    void removeFromFloatingObjectMaps(FloatingObject*);
+
     RenderObjectChildList m_children;
     RenderLineBoxList m_lineBoxes;   // All of the root line boxes created for this block flow.  For example, <div>Hello<br>world.</div> will have two total lines for the <div>.
 
@@ -1315,6 +1335,8 @@
     return static_cast<const RenderBlock*>(object);
 }
 
+typedef WTF::HashMap<const RenderBlock*, OwnPtr<RenderBlock::FloatingObjects> > TrackedFloatMap;
+
 // This will catch anyone doing an unnecessary cast.
 void toRenderBlock(const RenderBlock*);
 
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index a645d5c..b3bf851 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -161,22 +161,48 @@
     if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->logicalBottomForFloat(newFloat))
         return;
 
+    // When floats with shape outside are stacked, the floats are positioned based on the margin box of the float,
+    // not the shape's contour. Since we computed the width based on the shape contour when we added the float,
+    // when we add a subsequent float on the same line, we need to undo the shape delta in order to position
+    // based on the margin box. In order to do this, we need to walk back through the floating object list to find
+    // the first previous float that is on the same side as our newFloat.
+    ShapeOutsideInfo* previousShapeOutsideInfo = 0;
+    const RenderBlock::FloatingObjectSet& floatingObjectSet = m_block->floatingObjects()->set();
+    RenderBlock::FloatingObjectSetIterator it = floatingObjectSet.end();
+    RenderBlock::FloatingObjectSetIterator begin = floatingObjectSet.begin();
+    while (it != begin) {
+        --it;
+        RenderBlock::FloatingObject* previousFloat = *it;
+        if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) {
+            previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideInfo();
+            if (previousShapeOutsideInfo) {
+                LayoutUnit lineTopInShapeCoordinates = m_block->logicalHeight() - m_block->logicalTopForFloat(previousFloat);
+                previousShapeOutsideInfo->computeSegmentsForLine(lineTopInShapeCoordinates, logicalHeightForLine(m_block, m_isFirstLine));
+            }
+            break;
+        }
+    }
+
     ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo();
     if (shapeOutsideInfo)
-        shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(newFloat) + shapeOutsideInfo->shapeLogicalTop(), logicalHeightForLine(m_block, m_isFirstLine));
+        shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(newFloat), logicalHeightForLine(m_block, m_isFirstLine));
 
     if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) {
         float newLeft = m_block->logicalRightForFloat(newFloat);
+        if (previousShapeOutsideInfo)
+            newLeft -= previousShapeOutsideInfo->rightSegmentMarginBoxDelta();
         if (shapeOutsideInfo)
-            newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta();
+            newLeft += shapeOutsideInfo->rightSegmentMarginBoxDelta();
 
         if (shouldIndentText() && m_block->style()->isLeftToRightDirection())
             newLeft += floorToInt(m_block->textIndentOffset());
         m_left = max<float>(m_left, newLeft);
     } else {
         float newRight = m_block->logicalLeftForFloat(newFloat);
+        if (previousShapeOutsideInfo)
+            newRight -= previousShapeOutsideInfo->leftSegmentMarginBoxDelta();
         if (shapeOutsideInfo)
-            newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta();
+            newRight += shapeOutsideInfo->leftSegmentMarginBoxDelta();
 
         if (shouldIndentText() && !m_block->style()->isLeftToRightDirection())
             newRight -= floorToInt(m_block->textIndentOffset());
@@ -1487,7 +1513,7 @@
     }
 
     if (containsFloats())
-        layoutState.setLastFloat(m_floatingObjects->set().last());
+        layoutState.setLastFloat(floatingObjects()->set().last());
 
     // We also find the first clean line and extract these lines.  We will add them back
     // if we determine that we're able to synchronize after handling all our dirty lines.
@@ -1613,7 +1639,7 @@
 
         const InlineIterator oldEnd = end;
         bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
-        FloatingObject* lastFloatFromPreviousLine = (containsFloats()) ? m_floatingObjects->set().last() : 0;
+        FloatingObject* lastFloatFromPreviousLine = (containsFloats()) ? floatingObjects()->set().last() : 0;
         // FIXME: Bug 95361: It is possible for a line to grow beyond lineHeight, in which
         // case these segments may be incorrect.
         if (layoutState.flowThread())
@@ -1715,8 +1741,9 @@
             newLine(lineBreaker.clear());
         }
 
-        if (m_floatingObjects && lastRootBox()) {
-            const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        FloatingObjects* floats = floatingObjects();
+        if (floats && lastRootBox()) {
+            const FloatingObjectSet& floatingObjectSet = floats->set();
             FloatingObjectSetIterator it = floatingObjectSet.begin();
             FloatingObjectSetIterator end = floatingObjectSet.end();
             if (layoutState.lastFloat()) {
@@ -1836,7 +1863,7 @@
         }
     }
     
-    if (m_floatingObjects && (layoutState.checkForFloatsFromLastLine() || positionNewFloats()) && lastRootBox()) {
+    if (floatingObjects() && (layoutState.checkForFloatsFromLastLine() || positionNewFloats()) && lastRootBox()) {
         // In case we have a float on the last line, it might not be positioned up to now.
         // This has to be done before adding in the bottom border/padding, or the float will
         // include the padding incorrectly. -dwh
@@ -1859,7 +1886,7 @@
                 trailingFloatsLineBox->setContainingRegion(regionAtBlockOffset(trailingFloatsLineBox->lineTopWithLeading()));
         }
 
-        const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+        const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
         FloatingObjectSetIterator it = floatingObjectSet.begin();
         FloatingObjectSetIterator end = floatingObjectSet.end();
         if (layoutState.lastFloat()) {
@@ -2206,7 +2233,8 @@
         }
     }
     
-    if (!lineDelta || !m_floatingObjects)
+    FloatingObjects* floats = floatingObjects();
+    if (!lineDelta || !floats)
         return true;
     
     // See if any floats end in the range along which we want to shift the lines vertically.
@@ -2218,7 +2246,7 @@
 
     LayoutUnit logicalBottom = lastLine->lineBottomWithLeading() + absoluteValue(lineDelta);
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     FloatingObjectSetIterator end = floatingObjectSet.end();
     for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
         FloatingObject* f = *it;
@@ -2450,7 +2478,7 @@
     if (prefixLength < minimumPrefixLength)
         return;
 
-    prefixLength = lastHyphenLocation(text->characters() + lastSpace, pos - lastSpace, min(prefixLength, pos - lastSpace - minimumSuffixLength) + 1, localeIdentifier);
+    prefixLength = lastHyphenLocation(text->bloatedCharacters() + lastSpace, pos - lastSpace, min(prefixLength, pos - lastSpace - minimumSuffixLength) + 1, localeIdentifier);
     if (!prefixLength || prefixLength < minimumPrefixLength)
         return;
 
@@ -2505,7 +2533,10 @@
 inline void TrailingObjects::clear()
 {
     m_whitespace = 0;
-    m_boxes.clear();
+    // Using resize(0) rather than clear() here saves 2% on
+    // PerformanceTests/Layout/line-layout.html because we avoid freeing and
+    // re-allocating the underlying buffer repeatedly.
+    m_boxes.resize(0);
 }
 
 inline void TrailingObjects::appendBoxIfNeeded(RenderBox* box)
@@ -2905,7 +2936,7 @@
 
                 if ((breakAll || breakWords) && !midWordBreak) {
                     wrapW += charWidth;
-                    bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && current.m_pos + 1 < t->textLength() && U16_IS_TRAIL(t->characters()[current.m_pos + 1]);
+                    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();
                 }
@@ -3324,7 +3355,8 @@
     if (!newFloat->m_paginationStrut || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty())
         return true;
 
-    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+    FloatingObjects* floats = floatingObjects();
+    const FloatingObjectSet& floatingObjectSet = floats->set();
     ASSERT(floatingObjectSet.last() == newFloat);
 
     LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat);
@@ -3351,9 +3383,9 @@
             // Save the old logical top before calling removePlacedObject which will set
             // isPlaced to false. Otherwise it will trigger an assert in logicalTopForFloat.
             LayoutUnit oldLogicalTop = logicalTopForFloat(f);
-            m_floatingObjects->removePlacedObject(f);
+            floats->removePlacedObject(f);
             setLogicalTopForFloat(f, oldLogicalTop + paginationStrut);
-            m_floatingObjects->addPlacedObject(f);
+            floats->addPlacedObject(f);
         }
     }
 
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 276141d..9950917 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -34,6 +34,8 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
 #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/page/Page.h"
@@ -49,6 +51,7 @@
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderLayerCompositor.h"
+#include "core/rendering/RenderListMarker.h"
 #include "core/rendering/RenderRegion.h"
 #include "core/rendering/RenderTableCell.h"
 #include "core/rendering/RenderTheme.h"
@@ -99,6 +102,7 @@
     : RenderBoxModelObject(node)
     , m_minPreferredLogicalWidth(-1)
     , m_maxPreferredLogicalWidth(-1)
+    , m_intrinsicContentLogicalHeight(-1)
     , m_inlineBoxWrapper(0)
 {
     setIsBox();
@@ -193,6 +197,7 @@
             parentBlock->markSiblingsWithFloatsForLayout(this);
             parentBlock->markAllDescendantsWithFloatsForLayout(this, false);
         }
+        RenderBlock::floatWillBeRemoved(this);
     }
 
     if (isOutOfFlowPositioned())
@@ -208,7 +213,7 @@
         // The background of the root element or the body element could propagate up to
         // the canvas.  Just dirty the entire canvas when our style changes substantially.
         if (diff >= StyleDifferenceRepaint && node() &&
-            (node()->hasTagName(htmlTag) || node()->hasTagName(bodyTag))) {
+            (isHTMLHtmlElement(node()) || node()->hasTagName(bodyTag))) {
             view()->repaint();
             
             if (oldStyle->hasEntirelyFixedBackground() != newStyle->hasEntirelyFixedBackground())
@@ -282,10 +287,6 @@
     bool isBodyRenderer = isBody();
     bool isRootRenderer = isRoot();
 
-    // Set the text color if we're the body.
-    if (isBodyRenderer)
-        document()->setTextColor(newStyle->visitedDependentColor(CSSPropertyColor));
-
     if (isRootRenderer || isBodyRenderer) {
         // Propagate the new writing mode and direction up to the RenderView.
         RenderView* viewRenderer = view();
@@ -350,12 +351,12 @@
             // (1) The root element is <html>.
             // (2) We are the primary <body> (can be checked by looking at document.body).
             // (3) The root element has visible overflow.
-            if (document()->documentElement()->hasTagName(htmlTag) &&
-                document()->body() == node() &&
-                document()->documentElement()->renderer()->style()->overflowX() == OVISIBLE)
+            if (isHTMLHtmlElement(document()->documentElement())
+                && document()->body() == node()
+                && document()->documentElement()->renderer()->style()->overflowX() == OVISIBLE)
                 boxHasOverflowClip = false;
         }
-        
+
         // Check for overflow clip.
         // It's sufficient to just check one direction, since it's illegal to have visible on only one overflow value.
         if (boxHasOverflowClip) {
@@ -564,13 +565,15 @@
     LayoutRect box = borderBoundingBox();
     adjustRectForOutlineAndShadow(box);
 
-    FloatQuad containerRelativeQuad;
-    if (geometryMap)
-        containerRelativeQuad = geometryMap->mapToContainer(box, repaintContainer);
-    else
-        containerRelativeQuad = localToContainerQuad(FloatRect(box), repaintContainer);
+    if (repaintContainer != this) {
+        FloatQuad containerRelativeQuad;
+        if (geometryMap)
+            containerRelativeQuad = geometryMap->mapToContainer(box, repaintContainer);
+        else
+            containerRelativeQuad = localToContainerQuad(FloatRect(box), repaintContainer);
 
-    box = containerRelativeQuad.enclosingBoundingBox();
+        box = containerRelativeQuad.enclosingBoundingBox();
+    }
 
     // FIXME: layoutDelta needs to be applied in parts before/after transforms and
     // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
@@ -1275,7 +1278,9 @@
     // Table and root background painting is special.
     if (isTable() || isRoot())
         return false;
-
+    // FIXME: box-shadow is painted while background painting.
+    if (style()->boxShadow())
+        return false;
     LayoutRect backgroundRect = backgroundPaintedExtent();
     return foregroundIsKnownToBeOpaqueInRect(backgroundRect, backgroundObscurationTestMaxDepth);
 }
@@ -1698,8 +1703,8 @@
         if (v->layoutStateEnabled() && !repaintContainer) {
             LayoutState* layoutState = v->layoutState();
             LayoutSize offset = layoutState->m_paintOffset + locationOffset();
-            if (style()->hasPaintOffset() && layer())
-                offset += layer()->paintOffset();
+            if (style()->hasInFlowPosition() && layer())
+                offset += layer()->offsetForInFlowPosition();
             transformState.move(offset);
             return;
         }
@@ -1771,8 +1776,8 @@
     ASSERT(o == container() || o->isRenderRegion());
 
     LayoutSize offset;    
-    if (hasPaintOffset())
-        offset += paintOffset();
+    if (isInFlowPositioned())
+        offset += offsetForInFlowPosition();
 
     if (!isInline() || isReplaced()) {
         if (!style()->hasOutOfFlowPosition() && o->hasColumns()) {
@@ -1908,8 +1913,8 @@
                 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
 
             // We can't trust the bits on RenderObject, because this might be called while re-resolving style.
-            if (styleToUse->hasPaintOffset() && layer())
-                rect.move(layer()->paintOffset());
+            if (styleToUse->hasInFlowPosition() && layer())
+                rect.move(layer()->offsetForInFlowPosition());
 
             rect.moveBy(location());
             rect.move(layoutState->m_paintOffset);
@@ -1951,14 +1956,14 @@
     } else if (position == FixedPosition)
         fixed = true;
 
-    if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline())
+    if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline()) {
         topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this);
-    else if (styleToUse->hasPaintOffset() && layer()) {
+    } else if (styleToUse->hasInFlowPosition() && layer()) {
         // Apply the relative position offset when invalidating a rectangle.  The layer
         // is translated, but the render box isn't, so we need to do this to get the
         // right dirty rect.  Since this is called from RenderObject::setStyle, the relative position
         // flag on the RenderObject has been cleared, so use the one on the style().
-        topLeft += layer()->paintOffset();
+        topLeft += layer()->offsetForInFlowPosition();
     }
     
     if (position != AbsolutePosition && position != FixedPosition && o->hasColumns() && o->isBlockFlow()) {
@@ -2018,6 +2023,36 @@
     setMarginEnd(computedValues.m_margins.m_end);
 }
 
+static float getMaxWidthListMarker(const RenderBox* renderer)
+{
+#ifndef NDEBUG
+    ASSERT(renderer);
+    Node* parentNode = renderer->generatingNode();
+    ASSERT(parentNode);
+    ASSERT(parentNode->hasTagName(olTag) || parentNode->hasTagName(ulTag));
+    ASSERT(renderer->style()->textAutosizingMultiplier() != 1);
+#endif
+    float maxWidth = 0;
+    for (RenderObject* child = renderer->firstChild(); child; child = child->nextSibling()) {
+        if (!child->isListItem())
+            continue;
+
+        RenderBox* listItem = toRenderBox(child);
+        for (RenderObject* itemChild = listItem->firstChild(); itemChild; itemChild = itemChild->nextSibling()) {
+            if (!itemChild->isListMarker())
+                continue;
+            RenderBox* itemMarker = toRenderBox(itemChild);
+            if (itemMarker->requiresLayoutToDetermineWidth()) {
+                // Make sure to compute the autosized width.
+                itemMarker->layout();
+            }
+            maxWidth = max<float>(maxWidth, toRenderListMarker(itemMarker)->logicalWidth().toFloat());
+            break;
+        }
+    }
+    return maxWidth;
+}
+
 void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& computedValues, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const
 {
     computedValues.m_extent = logicalWidth();
@@ -2103,6 +2138,19 @@
         else
             computedValues.m_margins.m_end = newMargin;
     }
+
+    if (styleToUse->textAutosizingMultiplier() != 1 && styleToUse->marginStart().type() == Fixed) {
+        Node* parentNode = generatingNode();
+        if (parentNode && (parentNode->hasTagName(olTag) || parentNode->hasTagName(ulTag))) {
+            // Make sure the markers in a list are properly positioned (i.e. not chopped off) when autosized.
+            const float adjustedMargin = (1 - 1.0 / styleToUse->textAutosizingMultiplier()) * getMaxWidthListMarker(this);
+            bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection();
+            if (hasInvertedDirection)
+                computedValues.m_margins.m_end += adjustedMargin;
+            else
+                computedValues.m_margins.m_start += adjustedMargin;
+        }
+    }
 }
 
 LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth) const
@@ -2237,7 +2285,8 @@
     // stretching column flexbox.
     // FIXME: Think about block-flow here.
     // https://bugs.webkit.org/show_bug.cgi?id=46473
-    if (logicalWidth.type() == Auto && !isStretchingColumnFlexItem(this) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag)))
+    if (logicalWidth.type() == Auto && !isStretchingColumnFlexItem(this) && node() && (node()->hasTagName(inputTag)
+        || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || isHTMLTextAreaElement(node()) || node()->hasTagName(legendTag)))
         return true;
 
     if (isHorizontalWritingMode() != containingBlock()->isHorizontalWritingMode())
@@ -2398,6 +2447,8 @@
 
 void RenderBox::updateLogicalHeight()
 {
+    m_intrinsicContentLogicalHeight = contentLogicalHeight();
+
     LogicalExtentComputedValues computedValues;
     computeLogicalHeight(logicalHeight(), logicalTop(), computedValues);
 
@@ -2540,8 +2591,13 @@
 {
     // FIXME(cbiesinger): The css-sizing spec is considering changing what min-content/max-content should resolve to.
     // If that happens, this code will have to change.
-    if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent())
+    if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent()) {
+        if (isReplaced())
+            return intrinsicSize().height();
+        if (m_intrinsicContentLogicalHeight != -1)
+            return m_intrinsicContentLogicalHeight;
         return intrinsicContentHeight;
+    }
     if (logicalHeightLength.isFillAvailable())
         return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
     ASSERT_NOT_REACHED();
@@ -4378,7 +4434,7 @@
         rect.unite(layoutOverflowRect());
 
     bool hasTransform = hasLayer() && layer()->transform();
-    if (hasPaintOffset() || hasTransform) {
+    if (isInFlowPositioned() || hasTransform) {
         // If we are relatively positioned or if we have a transform, then we have to convert
         // this rectangle into physical coordinates, apply relative positioning and transforms
         // to it, and then convert it back.
@@ -4387,8 +4443,8 @@
         if (hasTransform)
             rect = layer()->currentTransform().mapRect(rect);
 
-        if (hasPaintOffset())
-            rect.move(paintOffset());
+        if (isInFlowPositioned())
+            rect.move(offsetForInFlowPosition());
         
         // Now we need to flip back.
         flipForWritingMode(rect);
diff --git a/Source/core/rendering/RenderBox.h b/Source/core/rendering/RenderBox.h
index 6046045..2691dc9 100644
--- a/Source/core/rendering/RenderBox.h
+++ b/Source/core/rendering/RenderBox.h
@@ -674,6 +674,11 @@
     // The preferred logical width of the element if it never breaks any lines at all.
     LayoutUnit m_maxPreferredLogicalWidth;
 
+    // Our intrinsic height, used for min-height: min-content etc. Maintained by
+    // updateLogicalHeight. This is logicalHeight() before it is clamped to
+    // min/max.
+    LayoutUnit m_intrinsicContentLogicalHeight;
+
     // For inline replaced elements, the inline box that owns us.
     InlineBox* m_inlineBoxWrapper;
 
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index 491343b..809d44c 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -402,17 +402,6 @@
     return LayoutSize();
 }
 
-LayoutSize RenderBoxModelObject::paintOffset() const
-{
-    LayoutSize offset = offsetForInFlowPosition();
-
-    if (isBox() && isFloating())
-        if (ShapeOutsideInfo* shapeOutside = toRenderBox(this)->shapeOutsideInfo())
-            offset -= shapeOutside->shapeLogicalOffset();
-
-    return offset;
-}
-
 LayoutUnit RenderBoxModelObject::offsetLeft() const
 {
     // Note that RenderInline and RenderBox override this to pass a different
diff --git a/Source/core/rendering/RenderBoxModelObject.h b/Source/core/rendering/RenderBoxModelObject.h
index 747dc9c..1cdeee1 100644
--- a/Source/core/rendering/RenderBoxModelObject.h
+++ b/Source/core/rendering/RenderBoxModelObject.h
@@ -70,7 +70,6 @@
     LayoutSize stickyPositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? stickyPositionOffset() : stickyPositionOffset().transposedSize(); }
 
     LayoutSize offsetForInFlowPosition() const;
-    LayoutSize paintOffset() const;
 
     // IE extensions. Used to calculate offsetWidth/Height.  Overridden by inlines (RenderFlow)
     // to return the remaining width on a given line (and the height of a single line).
diff --git a/Source/core/rendering/RenderCombineText.cpp b/Source/core/rendering/RenderCombineText.cpp
index 97bb34d..d974897 100644
--- a/Source/core/rendering/RenderCombineText.cpp
+++ b/Source/core/rendering/RenderCombineText.cpp
@@ -57,7 +57,7 @@
 
 float RenderCombineText::width(unsigned from, unsigned length, const Font& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
-    if (!characters())
+    if (!bloatedCharacters())
         return 0;
 
     if (m_isCombined)
diff --git a/Source/core/rendering/RenderEmbeddedObject.cpp b/Source/core/rendering/RenderEmbeddedObject.cpp
index 700d8ab..d70f061 100644
--- a/Source/core/rendering/RenderEmbeddedObject.cpp
+++ b/Source/core/rendering/RenderEmbeddedObject.cpp
@@ -188,7 +188,6 @@
     ASSERT(settings);
     if (!settings)
         return false;
-    fontDescription.setRenderingMode(settings->fontRenderingMode());
     fontDescription.setComputedSize(fontDescription.specifiedSize());
     font = Font(fontDescription, 0, 0);
     font.update(0);
@@ -269,7 +268,7 @@
         int marginWidth = -1;
         int marginHeight = -1;
         if (node()->hasTagName(iframeTag)) {
-            HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
+            HTMLIFrameElement* frame = toHTMLIFrameElement(node());
             marginWidth = frame->marginWidth();
             marginHeight = frame->marginHeight();
         }
diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
index 032a76d..d1c9cfc 100644
--- a/Source/core/rendering/RenderFlexibleBox.cpp
+++ b/Source/core/rendering/RenderFlexibleBox.cpp
@@ -293,13 +293,12 @@
 
     RenderBlock::startDelayUpdateScrollInfo();
 
-    Vector<LineContext> lineContexts;
-    Vector<int> orderValues;
-    computeMainAxisPreferredSizes(orderValues);
-    m_orderIterator.setOrderValues(orderValues);
+    prepareOrderIteratorAndMargins();
 
     ChildFrameRects oldChildRects;
     appendChildFrameRects(oldChildRects);
+
+    Vector<LineContext> lineContexts;
     layoutFlexItems(relayoutChildren, lineContexts);
 
     updateLogicalHeight();
@@ -871,17 +870,13 @@
     return minimumValueForLength(margin, availableSize, view);
 }
 
-void RenderFlexibleBox::computeMainAxisPreferredSizes(Vector<int>& orderValues)
+void RenderFlexibleBox::prepareOrderIteratorAndMargins()
 {
     RenderView* renderView = view();
-    bool anyChildHasDefaultOrderValue = false;
+    OrderIteratorPopulator populator(m_orderIterator);
 
     for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
-        // Avoid growing the vector for the common-case default value of 0.
-        if (int order = child->style()->order())
-            orderValues.append(child->style()->order());
-        else
-            anyChildHasDefaultOrderValue = true;
+        populator.collectChild(child);
 
         if (child->isOutOfFlowPositioned())
             continue;
@@ -896,13 +891,6 @@
             child->setMarginBottom(computeChildMarginValue(child->style()->marginBottom(), renderView));
         }
     }
-
-    if (anyChildHasDefaultOrderValue) {
-        // Avoid growing the vector to the default capacity of 16 if we're only going to put one item in it.
-        if (orderValues.isEmpty())
-            orderValues.reserveInitialCapacity(1);
-        orderValues.append(0);
-    }
 }
 
 LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize)
diff --git a/Source/core/rendering/RenderFlexibleBox.h b/Source/core/rendering/RenderFlexibleBox.h
index 415d449..3d5fc26 100644
--- a/Source/core/rendering/RenderFlexibleBox.h
+++ b/Source/core/rendering/RenderFlexibleBox.h
@@ -135,7 +135,7 @@
     LayoutUnit marginBoxAscentForChild(RenderBox*);
 
     LayoutUnit computeChildMarginValue(Length margin, RenderView*);
-    void computeMainAxisPreferredSizes(Vector<int>&);
+    void prepareOrderIteratorAndMargins();
     LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize);
     // The hypothetical main size of an item is the flex base size clamped according to its min and max main size properties
     bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool& hasInfiniteLineLength);
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index cfbd888..b1e8312 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -150,6 +150,7 @@
 
 RenderGrid::RenderGrid(Element* element)
     : RenderBlock(element)
+    , m_orderIterator(this)
 {
     // All of our children must be block level.
     setChildrenInline(false);
@@ -444,25 +445,6 @@
     return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColumnCount() : explicitGridRowCount();
 }
 
-size_t RenderGrid::maximumIndexInDirection(TrackSizingDirection direction) const
-{
-    size_t maximumIndex = std::max<size_t>(1, (direction == ForColumns) ? explicitGridColumnCount() : explicitGridRowCount());
-
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
-        // This function bypasses the cache (cachedGridCoordinate()) as it is used to build it.
-        OwnPtr<GridSpan> positions = resolveGridPositionsFromStyle(child, direction);
-
-        // |positions| is NULL if we need to run the auto-placement algorithm. Our estimation ignores
-        // this case as the auto-placement algorithm will grow the grid as needed.
-        if (!positions)
-            continue;
-
-        maximumIndex = std::max(maximumIndex, positions->finalPositionIndex + 1);
-    }
-
-    return maximumIndex;
-}
-
 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<GridTrack>& columnTracks)
 {
     // FIXME: We shouldn't force a layout every time this function is called but
@@ -643,15 +625,12 @@
     ASSERT(!gridWasPopulated());
     ASSERT(m_gridItemCoordinate.isEmpty());
 
-    m_grid.grow(maximumIndexInDirection(ForRows));
-    size_t maximumColumnIndex = maximumIndexInDirection(ForColumns);
-    for (size_t i = 0; i < m_grid.size(); ++i)
-        m_grid[i].grow(maximumColumnIndex);
+    populateExplicitGridAndOrderIterator();
 
     Vector<RenderBox*> autoMajorAxisAutoGridItems;
     Vector<RenderBox*> specifiedMajorAxisAutoGridItems;
     GridAutoFlow autoFlow = style()->gridAutoFlow();
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+    for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
         // FIXME: We never re-resolve positions if the grid is grown during auto-placement which may lead auto / <integer>
         // positions to not match the author's intent. The specification is unclear on what should be done in this case.
         OwnPtr<GridSpan> rowPositions = resolveGridPositionsFromStyle(child, ForRows);
@@ -681,6 +660,33 @@
     placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems);
 }
 
+void RenderGrid::populateExplicitGridAndOrderIterator()
+{
+    OrderIteratorPopulator populator(m_orderIterator);
+
+    size_t maximumRowIndex = std::max<size_t>(1, explicitGridRowCount());
+    size_t maximumColumnIndex = std::max<size_t>(1, explicitGridColumnCount());
+
+    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+        populator.collectChild(child);
+
+        // This function bypasses the cache (cachedGridCoordinate()) as it is used to build it.
+        OwnPtr<GridSpan> rowPositions = resolveGridPositionsFromStyle(child, ForRows);
+        OwnPtr<GridSpan> columnPositions = resolveGridPositionsFromStyle(child, ForColumns);
+
+        // |positions| is 0 if we need to run the auto-placement algorithm. Our estimation ignores
+        // this case as the auto-placement algorithm will grow the grid as needed.
+        if (rowPositions)
+            maximumRowIndex = std::max(maximumRowIndex, rowPositions->finalPositionIndex + 1);
+        if (columnPositions)
+            maximumColumnIndex = std::max(maximumColumnIndex, columnPositions->finalPositionIndex + 1);
+    }
+
+    m_grid.grow(maximumRowIndex);
+    for (size_t i = 0; i < m_grid.size(); ++i)
+        m_grid[i].grow(maximumColumnIndex);
+}
+
 void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(Vector<RenderBox*> autoGridItems)
 {
     for (size_t i = 0; i < autoGridItems.size(); ++i) {
@@ -862,11 +868,16 @@
     return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition));
 }
 
+inline static size_t adjustGridPositionForAfterEndSide(size_t resolvedPosition)
+{
+    return resolvedPosition ? resolvedPosition - 1 : 0;
+}
+
 static size_t adjustGridPositionForSide(size_t resolvedPosition, GridPositionSide side)
 {
     // An item finishing on the N-th line belongs to the N-1-th cell.
     if (side == ColumnEndSide || side == RowEndSide)
-        return resolvedPosition ? resolvedPosition - 1 : 0;
+        return adjustGridPositionForAfterEndSide(resolvedPosition);
 
     return resolvedPosition;
 }
@@ -936,6 +947,11 @@
     ASSERT(position.isSpan());
     ASSERT(position.spanPosition() > 0);
 
+    if (!position.namedGridLine().isNull()) {
+        // span 2 'c' -> we need to find the appropriate grid line before / after our opposite position.
+        return resolveNamedGridLinePositionAgainstOppositePosition(resolvedOppositePosition, position, side);
+    }
+
     // 'span 1' is contained inside a single grid track regardless of the direction.
     // That's why the CSS span value is one more than the offset we apply.
     size_t positionOffset = position.spanPosition() - 1;
@@ -947,6 +963,55 @@
     return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition + positionOffset);
 }
 
+PassOwnPtr<GridSpan> RenderGrid::resolveNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side) const
+{
+    ASSERT(position.isSpan());
+    ASSERT(!position.namedGridLine().isNull());
+    // Negative positions are not allowed per the specification and should have been handled during parsing.
+    ASSERT(position.spanPosition() > 0);
+
+    const NamedGridLinesMap& gridLinesNames = (side == ColumnStartSide || side == ColumnEndSide) ? style()->namedGridColumnLines() : style()->namedGridRowLines();
+    NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGridLine());
+
+    // If there is no named grid line of that name, we resolve the position to 'auto' (which is equivalent to 'span 1' in this case).
+    // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html.
+    if (it == gridLinesNames.end())
+        return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition);
+
+    if (side == RowStartSide || side == ColumnStartSide)
+        return resolveBeforeStartNamedGridLinePositionAgainstOppositePosition(resolvedOppositePosition, position, it->value);
+
+    return resolveAfterEndNamedGridLinePositionAgainstOppositePosition(resolvedOppositePosition, position, it->value);
+}
+
+PassOwnPtr<GridSpan> RenderGrid::resolveBeforeStartNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines) const
+{
+    // The grid line inequality needs to be strict (which doesn't match the after / end case) because |resolvedOppositePosition|
+    // is already converted to an index in our grid representation (ie one was removed from the grid line to account for the side).
+    // FIXME: This could be a binary search as |gridLines| is ordered.
+    int firstLineBeforeOppositePositionIndex = gridLines.size() - 1;
+    for (; firstLineBeforeOppositePositionIndex >= 0 && gridLines[firstLineBeforeOppositePositionIndex] > resolvedOppositePosition; --firstLineBeforeOppositePositionIndex) { }
+
+    size_t gridLineIndex = std::max<int>(0, firstLineBeforeOppositePositionIndex - position.spanPosition() + 1);
+    size_t resolvedGridLinePosition = gridLines[gridLineIndex];
+    if (resolvedGridLinePosition > resolvedOppositePosition)
+        resolvedGridLinePosition = resolvedOppositePosition;
+    return GridSpan::create(resolvedGridLinePosition, resolvedOppositePosition);
+}
+
+PassOwnPtr<GridSpan> RenderGrid::resolveAfterEndNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines) const
+{
+    // FIXME: This could be a binary search as |gridLines| is ordered.
+    size_t firstLineAfterOppositePositionIndex = 0;
+    for (; firstLineAfterOppositePositionIndex < gridLines.size() && gridLines[firstLineAfterOppositePositionIndex] <= resolvedOppositePosition; ++firstLineAfterOppositePositionIndex) { }
+
+    size_t gridLineIndex = std::min(gridLines.size() - 1, firstLineAfterOppositePositionIndex + position.spanPosition() - 1);
+    size_t resolvedGridLinePosition = adjustGridPositionForAfterEndSide(gridLines[gridLineIndex]);
+    if (resolvedGridLinePosition < resolvedOppositePosition)
+        resolvedGridLinePosition = resolvedOppositePosition;
+    return GridSpan::create(resolvedOppositePosition, resolvedGridLinePosition);
+}
+
 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox* child, TrackSizingDirection direction, const Vector<GridTrack>& tracks) const
 {
     const GridCoordinate& coordinate = cachedGridCoordinate(child);
@@ -973,6 +1038,12 @@
     return offset;
 }
 
+void RenderGrid::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+    for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next())
+        paintChild(child, paintInfo, paintOffset);
+}
+
 const char* RenderGrid::renderName() const
 {
     if (isFloating())
diff --git a/Source/core/rendering/RenderGrid.h b/Source/core/rendering/RenderGrid.h
index 074f859..eddf270 100644
--- a/Source/core/rendering/RenderGrid.h
+++ b/Source/core/rendering/RenderGrid.h
@@ -26,6 +26,7 @@
 #ifndef RenderGrid_h
 #define RenderGrid_h
 
+#include "core/rendering/OrderIterator.h"
 #include "core/rendering/RenderBlock.h"
 
 namespace WebCore {
@@ -72,6 +73,7 @@
     void insertItemIntoGrid(RenderBox*, size_t rowTrack, size_t columnTrack);
     void insertItemIntoGrid(RenderBox*, const GridCoordinate&);
     void placeItemsOnGrid();
+    void populateExplicitGridAndOrderIterator();
     void placeSpecifiedMajorAxisItemsOnGrid(Vector<RenderBox*>);
     void placeAutoMajorAxisItemsOnGrid(Vector<RenderBox*>);
     void placeAutoMajorAxisItemOnGrid(RenderBox*);
@@ -94,7 +96,6 @@
     size_t explicitGridColumnCount() const;
     size_t explicitGridRowCount() const;
     size_t explicitGridSizeForSide(GridPositionSide) const;
-    size_t maximumIndexInDirection(TrackSizingDirection) const;
 
     LayoutUnit logicalContentHeightForChild(RenderBox*, Vector<GridTrack>&);
     LayoutUnit minContentForChild(RenderBox*, TrackSizingDirection, Vector<GridTrack>& columnTracks);
@@ -107,9 +108,14 @@
     size_t resolveNamedGridLinePositionFromStyle(const GridPosition&, GridPositionSide) const;
     size_t resolveGridPositionFromStyle(const GridPosition&, GridPositionSide) const;
     PassOwnPtr<GridSpan> resolveGridPositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition&, GridPositionSide) const;
+    PassOwnPtr<GridSpan> resolveNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition&, GridPositionSide) const;
+    PassOwnPtr<GridSpan> resolveBeforeStartNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition&, const Vector<size_t>&) const;
+    PassOwnPtr<GridSpan> resolveAfterEndNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition&, const Vector<size_t>&) const;
 
     LayoutUnit gridAreaBreadthForChild(const RenderBox* child, TrackSizingDirection, const Vector<GridTrack>&) const;
 
+    virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL;
+
 #ifndef NDEBUG
     bool tracksAreWiderThanMinTrackBreadth(TrackSizingDirection, const Vector<GridTrack>&);
     bool gridWasPopulated() const { return !m_grid.isEmpty() && !m_grid[0].isEmpty(); }
@@ -128,6 +134,7 @@
 
     Vector<Vector<Vector<RenderBox*, 1> > > m_grid;
     HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate;
+    OrderIterator m_orderIterator;
 };
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderHTMLCanvas.cpp b/Source/core/rendering/RenderHTMLCanvas.cpp
index 8a183bf..5101e8f 100644
--- a/Source/core/rendering/RenderHTMLCanvas.cpp
+++ b/Source/core/rendering/RenderHTMLCanvas.cpp
@@ -49,7 +49,7 @@
     if (RenderReplaced::requiresLayer())
         return true;
     
-    HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(node());
+    HTMLCanvasElement* canvas = toHTMLCanvasElement(node());
     return canvas && canvas->renderingContext() && canvas->renderingContext()->isAccelerated();
 }
 
@@ -66,12 +66,12 @@
     }
 
     bool useLowQualityScale = style()->imageRendering() == ImageRenderingOptimizeContrast;
-    static_cast<HTMLCanvasElement*>(node())->paint(paintInfo.context, rect, useLowQualityScale);
+    toHTMLCanvasElement(node())->paint(paintInfo.context, rect, useLowQualityScale);
 }
 
 void RenderHTMLCanvas::canvasSizeChanged()
 {
-    IntSize canvasSize = static_cast<HTMLCanvasElement*>(node())->size();
+    IntSize canvasSize = toHTMLCanvasElement(node())->size();
     LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasSize.height() * style()->effectiveZoom());
 
     if (zoomedSize == intrinsicSize())
diff --git a/Source/core/rendering/RenderIFrame.cpp b/Source/core/rendering/RenderIFrame.cpp
index 14405a0..655f4aa 100644
--- a/Source/core/rendering/RenderIFrame.cpp
+++ b/Source/core/rendering/RenderIFrame.cpp
@@ -78,7 +78,7 @@
 
 bool RenderIFrame::isSeamless() const
 {
-    return node() && node()->hasTagName(iframeTag) && static_cast<HTMLIFrameElement*>(node())->shouldDisplaySeamlessly();
+    return node() && node()->hasTagName(iframeTag) && toHTMLIFrameElement(node())->shouldDisplaySeamlessly();
 }
 
 bool RenderIFrame::requiresLayer() const
diff --git a/Source/core/rendering/RenderImage.cpp b/Source/core/rendering/RenderImage.cpp
index 6eb89bb..25f505f 100644
--- a/Source/core/rendering/RenderImage.cpp
+++ b/Source/core/rendering/RenderImage.cpp
@@ -175,7 +175,7 @@
             ASSERT(node());
             if (node()) {
                 m_needsToSetSizeForAltText = true;
-                node()->setNeedsStyleRecalc(SyntheticStyleChange);
+                node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
             }
             return;
         }
@@ -397,10 +397,10 @@
         return;
 
     Node* focusedNode = document->focusedNode();
-    if (!focusedNode || !focusedNode->hasTagName(areaTag))
+    if (!focusedNode || !isHTMLAreaElement(focusedNode))
         return;
 
-    HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedNode);
+    HTMLAreaElement* areaElement = toHTMLAreaElement(focusedNode);
     if (areaElement->imageElement() != node())
         return;
 
diff --git a/Source/core/rendering/RenderInline.cpp b/Source/core/rendering/RenderInline.cpp
index 3752c45..2530163 100644
--- a/Source/core/rendering/RenderInline.cpp
+++ b/Source/core/rendering/RenderInline.cpp
@@ -1024,7 +1024,7 @@
             break;
         }
         if (inlineFlow->style()->hasInFlowPosition() && inlineFlow->hasLayer())
-            repaintRect.move(toRenderInline(inlineFlow)->layer()->paintOffset());
+            repaintRect.move(toRenderInline(inlineFlow)->layer()->offsetForInFlowPosition());
     }
 
     LayoutUnit outlineSize = style()->outlineSize();
@@ -1071,7 +1071,7 @@
         if (v->layoutStateEnabled() && !repaintContainer) {
             LayoutState* layoutState = v->layoutState();
             if (style()->hasInFlowPosition() && layer())
-                rect.move(layer()->paintOffset());
+                rect.move(layer()->offsetForInFlowPosition());
             rect.move(layoutState->m_paintOffset);
             if (layoutState->m_clipped)
                 rect.intersect(layoutState->m_clipRect);
@@ -1104,7 +1104,7 @@
         // is translated, but the render box isn't, so we need to do this to get the
         // right dirty rect. Since this is called from RenderObject::setStyle, the relative or sticky position
         // flag on the RenderObject has been cleared, so use the one on the style().
-        topLeft += layer()->paintOffset();
+        topLeft += layer()->offsetForInFlowPosition();
     }
     
     // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout,
@@ -1159,7 +1159,7 @@
             LayoutState* layoutState = v->layoutState();
             LayoutSize offset = layoutState->m_paintOffset;
             if (style()->hasInFlowPosition() && layer())
-                offset += layer()->paintOffset();
+                offset += layer()->offsetForInFlowPosition();
             transformState.move(offset);
             return;
         }
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 568ec43..07820f1 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -76,6 +76,8 @@
 #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"
 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h"
 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
@@ -100,6 +102,7 @@
 #include "core/rendering/RenderScrollbarPart.h"
 #include "core/rendering/RenderTreeAsText.h"
 #include "core/rendering/RenderView.h"
+#include "core/rendering/svg/ReferenceFilterBuilder.h"
 #include "core/rendering/svg/RenderSVGResourceClipper.h"
 #include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/StdLibExtras.h>
@@ -1213,13 +1216,13 @@
     }
     
     bool positionOrOffsetChanged = false;
-    if (renderer()->hasPaintOffset()) {
-        LayoutSize newOffset = toRenderBoxModelObject(renderer())->paintOffset();
-        positionOrOffsetChanged = newOffset != m_paintOffset;
-        m_paintOffset = newOffset;
-        localPoint.move(m_paintOffset);
+    if (renderer()->isInFlowPositioned()) {
+        LayoutSize newOffset = toRenderBoxModelObject(renderer())->offsetForInFlowPosition();
+        positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition;
+        m_offsetForInFlowPosition = newOffset;
+        localPoint.move(m_offsetForInFlowPosition);
     } else {
-        m_paintOffset = LayoutSize();
+        m_offsetForInFlowPosition = LayoutSize();
     }
 
     // FIXME: We'd really like to just get rid of the concept of a layer rectangle and rely on the renderers.
@@ -3493,15 +3496,21 @@
     return false;
 }
 
+static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::PaintLayerFlags paintFlags)
+{
+    return layer->renderer()->isRoot() && (paintFlags & RenderLayer::PaintLayerPaintingRootBackgroundOnly);
+}
+
 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
 {
     if (isComposited()) {
         // The updatingControlTints() painting pass goes through compositing layers,
         // 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))
+        if (context->updatingControlTints() || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)) {
             paintFlags |= PaintLayerTemporaryClipRects;
-        else if (!backing()->paintsIntoCompositedAncestor()
-            && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection)) {
+        } else if (!backing()->paintsIntoCompositedAncestor()
+            && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection)
+            && !paintForFixedRootBackground(this, paintFlags)) {
             // If this RenderLayer should paint into its backing, that will be done via RenderLayerBacking::paintIntoLayer().
             return;
         }
@@ -4878,7 +4887,7 @@
         clipRects.setPosClipRect(clipRects.fixedClipRect());
         clipRects.setOverflowClipRect(clipRects.fixedClipRect());
         clipRects.setFixed(true);
-    } else if (renderer()->style()->hasPaintOffset())
+    } else if (renderer()->style()->hasInFlowPosition())
         clipRects.setPosClipRect(clipRects.overflowClipRect());
     else if (renderer()->style()->position() == AbsolutePosition)
         clipRects.setOverflowClipRect(clipRects.posClipRect());
@@ -5778,8 +5787,7 @@
         || renderer()->hasClipPath()
         || renderer()->hasFilter()
         || renderer()->hasBlendMode()
-        || isTransparent()
-        || renderer()->isFloatingWithShapeOutside();
+        || isTransparent();
 
     return couldBeNormalFlow && !preventsElementFromBeingNormalFlow;
 }
@@ -6046,13 +6054,6 @@
     if (shouldUpdateFilters)
         backing()->updateFilters(renderer()->style());
     updateOrRemoveFilterEffectRenderer();
-    // FIXME: Accelerated SVG reference filters still rely on FilterEffectRenderer to build the filter graph.
-    // Thus, we have to call updateFilters again, after we have a FilterEffectRenderer.
-    // FilterEffectRenderer is intended to render software filters and shouldn't be needed for accelerated filters.
-    // We should extract the SVG graph building functionality out of FilterEffectRenderer, and it should happen in RenderLayer::computeFilterOperations.
-    // https://bugs.webkit.org/show_bug.cgi?id=114051
-    if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter())
-        backing()->updateFilters(renderer()->style());
 }
 
 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
@@ -6245,6 +6246,22 @@
 FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style)
 {
     const FilterOperations& filters = style->filter();
+    if (filters.hasReferenceFilter()) {
+        for (size_t i = 0; i < filters.size(); ++i) {
+            FilterOperation* filterOperation = filters.operations().at(i).get();
+            if (filterOperation->getOperationType() != FilterOperation::REFERENCE)
+                continue;
+            ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
+            // FIXME: Cache the ReferenceFilter if it didn't change.
+            RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create();
+            float zoom = style->effectiveZoom() * WebCore::deviceScaleFactor(renderer()->frame());
+            referenceFilter->setFilterResolution(FloatSize(zoom, zoom));
+            referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referenceFilter.get(), renderer(), referenceFilter->sourceGraphic(),
+                referenceOperation));
+            referenceOperation->setFilter(referenceFilter.release());
+        }
+    }
+
     if (!filters.hasCustomFilter())
         return filters;
 
@@ -6310,14 +6327,7 @@
         if (RenderLayerFilterInfo* filterInfo = this->filterInfo())
             filterInfo->setRenderer(0);
 
-        // FIXME: Accelerated SVG reference filters shouldn't rely on FilterEffectRenderer to build the filter graph.
-        // https://bugs.webkit.org/show_bug.cgi?id=114051
-
-        // Early-return only if we *don't* have reference filters.
-        // For reference filters, we still want the FilterEffect graph built
-        // for us, even if we're composited.
-        if (!renderer()->style()->filter().hasReferenceFilter())
-            return;
+        return;
     }
     
     RenderLayerFilterInfo* filterInfo = ensureFilterInfo();
@@ -6339,7 +6349,7 @@
 
 void RenderLayer::filterNeedsRepaint()
 {
-    renderer()->node()->setNeedsStyleRecalc(SyntheticStyleChange);
+    toElement(renderer()->node())->scheduleLayerUpdate();
     if (renderer()->view())
         renderer()->repaint();
 }
diff --git a/Source/core/rendering/RenderLayer.h b/Source/core/rendering/RenderLayer.h
index fea79f4..bf6a7ab 100644
--- a/Source/core/rendering/RenderLayer.h
+++ b/Source/core/rendering/RenderLayer.h
@@ -481,7 +481,7 @@
 
     void updateBlendMode();
 
-    const LayoutSize& paintOffset() const { return m_paintOffset; }
+    const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; }
 
     void clearClipRectsIncludingDescendants(ClipRectsType typeToClear = AllClipRectTypes);
     void clearClipRects(ClipRectsType typeToClear = AllClipRectTypes);
@@ -1198,8 +1198,8 @@
     LayoutRect m_repaintRect; // Cached repaint rects. Used by layout.
     LayoutRect m_outlineBox;
 
-    // Paint time offset only, it is used for properly paint relative / sticky positioned elements and shape boxes on floats.
-    LayoutSize m_paintOffset;
+    // Our current relative position offset.
+    LayoutSize m_offsetForInFlowPosition;
 
     // Our (x,y) coordinates are in our parent layer's coordinate space.
     LayoutPoint m_topLeft;
diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp
index a5a84c2..35579d2 100644
--- a/Source/core/rendering/RenderLayerBacking.cpp
+++ b/Source/core/rendering/RenderLayerBacking.cpp
@@ -75,7 +75,7 @@
 static inline bool isAcceleratedCanvas(RenderObject* renderer)
 {
     if (renderer->isCanvas()) {
-        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node());
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
         if (CanvasRenderingContext* context = canvas->renderingContext())
             return context->isAccelerated();
     }
@@ -142,50 +142,6 @@
     return graphicsLayer.release();
 }
 
-void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaintCounter)
-{
-    m_graphicsLayer->setShowDebugBorder(showBorder);
-    m_graphicsLayer->setShowRepaintCounter(showRepaintCounter);
-    
-    if (m_ancestorClippingLayer)
-        m_ancestorClippingLayer->setShowDebugBorder(showBorder);
-
-    if (m_foregroundLayer) {
-        m_foregroundLayer->setShowDebugBorder(showBorder);
-        m_foregroundLayer->setShowRepaintCounter(showRepaintCounter);
-    }
-    
-    if (m_contentsContainmentLayer)
-        m_contentsContainmentLayer->setShowDebugBorder(showBorder);
-    
-    if (m_backgroundLayer) {
-        m_backgroundLayer->setShowDebugBorder(showBorder);
-        m_backgroundLayer->setShowRepaintCounter(showRepaintCounter);
-    }
-
-    if (m_maskLayer) {
-        m_maskLayer->setShowDebugBorder(showBorder);
-        m_maskLayer->setShowRepaintCounter(showRepaintCounter);
-    }
-
-    if (m_layerForHorizontalScrollbar)
-        m_layerForHorizontalScrollbar->setShowDebugBorder(showBorder);
-
-    if (m_layerForVerticalScrollbar)
-        m_layerForVerticalScrollbar->setShowDebugBorder(showBorder);
-
-    if (m_layerForScrollCorner)
-        m_layerForScrollCorner->setShowDebugBorder(showBorder);
-
-    if (m_scrollingLayer)
-        m_scrollingLayer->setShowDebugBorder(showBorder);
-
-    if (m_scrollingContentsLayer) {
-        m_scrollingContentsLayer->setShowDebugBorder(showBorder);
-        m_scrollingContentsLayer->setShowRepaintCounter(showRepaintCounter);
-    }
-}
-
 void RenderLayerBacking::createPrimaryGraphicsLayer()
 {
     String layerName;
@@ -214,7 +170,6 @@
         m_graphicsLayer->removeFromParent();
 
     m_ancestorClippingLayer = nullptr;
-    m_contentsContainmentLayer = nullptr;
     m_graphicsLayer = nullptr;
     m_foregroundLayer = nullptr;
     m_backgroundLayer = nullptr;
@@ -240,11 +195,7 @@
         makeMatrixRenderable(t, compositor()->canRender3DTransforms());
     }
     
-    if (m_contentsContainmentLayer) {
-        m_contentsContainmentLayer->setTransform(t);
-        m_graphicsLayer->setTransform(TransformationMatrix());
-    } else
-        m_graphicsLayer->setTransform(t);
+    m_graphicsLayer->setTransform(t);
 }
 
 void RenderLayerBacking::updateFilters(const RenderStyle* style)
@@ -274,7 +225,12 @@
 {
     // For non-root layers, background is always painted by the primary graphics layer.
     ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
-    m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+    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)
@@ -440,8 +396,7 @@
         m_graphicsLayer->setReplicatedByLayer(0);
 
     updateBackgroundColor(isSimpleContainerCompositingLayer());
-    updateRootLayerConfiguration();
-    
+
     if (isDirectlyCompositedImage())
         updateImageContents();
 
@@ -452,7 +407,7 @@
         HTMLMediaElement* mediaElement = toMediaElement(renderer->node());
         m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
     } else if (isAcceleratedCanvas(renderer)) {
-        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node());
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
         if (CanvasRenderingContext* context = canvas->renderingContext())
             m_graphicsLayer->setContentsToCanvas(context->platformLayer());
         layerConfigChanged = true;
@@ -561,14 +516,6 @@
 
     FloatSize contentsSize = relativeCompositingBounds.size();
     
-    if (m_contentsContainmentLayer) {
-        m_contentsContainmentLayer->setPreserves3D(preserves3D);
-        m_contentsContainmentLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
-        // Use the same size as m_graphicsLayer so transforms behave correctly.
-        m_contentsContainmentLayer->setSize(contentsSize);
-        graphicsLayerParentLocation = relativeCompositingBounds.location();
-    }
-
     m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
     m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
     
@@ -612,10 +559,7 @@
         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());
-        if (m_contentsContainmentLayer)
-            m_contentsContainmentLayer->setAnchorPoint(anchor);
-        else
-            m_graphicsLayer->setAnchorPoint(anchor);
+        m_graphicsLayer->setAnchorPoint(anchor);
 
         RenderStyle* style = renderer()->style();
         GraphicsLayer* clipLayer = clippingLayer();
@@ -636,8 +580,6 @@
         }
     } else {
         m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0));
-        if (m_contentsContainmentLayer)
-            m_contentsContainmentLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0));
     }
 
     if (m_foregroundLayer) {
@@ -664,7 +606,6 @@
         FloatSize backgroundSize = contentsSize;
         if (backgroundLayerPaintsFixedRootBackground()) {
             FrameView* frameView = toRenderView(renderer())->frameView();
-            backgroundPosition = IntPoint(frameView->scrollOffsetForFixedPosition());
             backgroundSize = frameView->visibleContentRect().size();
         }
         m_backgroundLayer->setPosition(backgroundPosition);
@@ -697,7 +638,6 @@
         IntSize adjustedScrollOffset = m_owningLayer->adjustedScrollOffset();
         m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCompositingBounds.location()));
         m_scrollingLayer->setSize(clientBox.size());
-        m_scrollingContentsLayer->setPosition(FloatPoint(-adjustedScrollOffset.width(), -adjustedScrollOffset.height()));
 
         IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
         m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()));
@@ -709,8 +649,14 @@
             m_scrollingContentsLayer->setNeedsDisplay();
 
         IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjustedScrollOffset);
-        if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
-            compositor()->scrollingLayerDidChange(m_owningLayer);
+        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.
@@ -762,19 +708,9 @@
     if (m_ancestorClippingLayer)
         m_ancestorClippingLayer->removeAllChildren();
     
-    if (m_contentsContainmentLayer) {
-        m_contentsContainmentLayer->removeAllChildren();
-        if (m_ancestorClippingLayer)
-            m_ancestorClippingLayer->addChild(m_contentsContainmentLayer.get());
-    }
-    
-    if (m_backgroundLayer)
-        m_contentsContainmentLayer->addChild(m_backgroundLayer.get());
-
     m_graphicsLayer->removeFromParent();
-    if (m_contentsContainmentLayer)
-        m_contentsContainmentLayer->addChild(m_graphicsLayer.get());
-    else if (m_ancestorClippingLayer)
+
+    if (m_ancestorClippingLayer)
         m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
 
     if (m_childContainmentLayer) {
@@ -816,11 +752,6 @@
     m_graphicsLayer->setContentsRect(contentsRect);
 }
 
-void RenderLayerBacking::updateDrawsContent()
-{
-    updateDrawsContent(isSimpleContainerCompositingLayer());
-}
-
 void RenderLayerBacking::updateDrawsContent(bool isSimpleContainer)
 {
     if (m_scrollingLayer) {
@@ -836,7 +767,7 @@
         return;
     }
 
-    bool hasPaintedContent = !isSimpleContainer && containsPaintedContent();
+    bool hasPaintedContent = containsPaintedContent(isSimpleContainer);
 
     // FIXME: we could refine this to only allocate backing for one of these layers if possible.
     m_graphicsLayer->setDrawsContent(hasPaintedContent);
@@ -865,7 +796,9 @@
     }
     
     if (needsDescendantClip) {
-        if (!m_childContainmentLayer) {
+        // 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("Child clipping Layer", CompositingReasonLayerForClip);
             m_childContainmentLayer->setMasksToBounds(true);
             layersChanged = true;
@@ -1018,30 +951,26 @@
             m_backgroundLayer->setDrawsContent(true);
             m_backgroundLayer->setAnchorPoint(FloatPoint3D());
             m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
-            layerChanged = true;
-        }
-        
-        if (!m_contentsContainmentLayer) {
-            String layerName;
-#ifndef NDEBUG
-            layerName = m_owningLayer->debugName() + " (contents containment)";
+#if !OS(ANDROID)
+            m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
+            m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(false);
 #endif
-            m_contentsContainmentLayer = createGraphicsLayer(layerName, CompositingReasonLayerForBackground);
             layerChanged = true;
         }
     } else {
         if (m_backgroundLayer) {
             m_backgroundLayer->removeFromParent();
             m_backgroundLayer = nullptr;
-            layerChanged = true;
-        }
-        if (m_contentsContainmentLayer) {
-            m_contentsContainmentLayer->removeFromParent();
-            m_contentsContainmentLayer = nullptr;
+#if !OS(ANDROID)
+            m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
+#endif
             layerChanged = true;
         }
     }
-    
+
+    if (layerChanged && !m_owningLayer->renderer()->documentBeingDestroyed())
+        compositor()->rootFixedBackgroundsChanged();
+
     return layerChanged;
 }
 
@@ -1181,10 +1110,6 @@
     }
 }
 
-void RenderLayerBacking::updateRootLayerConfiguration()
-{
-}
-
 static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer)
 {
     if (!GraphicsLayer::supportsBackgroundColorContent())
@@ -1333,9 +1258,9 @@
     return hasVisibleNonCompositingDescendant(m_owningLayer);
 }
 
-bool RenderLayerBacking::containsPaintedContent() const
+bool RenderLayerBacking::containsPaintedContent(bool isSimpleContainer) const
 {
-    if (isSimpleContainerCompositingLayer() || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflection())
+    if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflection())
         return false;
 
     if (isDirectlyCompositedImage())
@@ -1512,9 +1437,6 @@
     if (m_ancestorClippingLayer)
         return m_ancestorClippingLayer.get();
 
-    if (m_contentsContainmentLayer)
-        return m_contentsContainmentLayer.get();
-    
     return m_graphicsLayer.get();
 }
 
@@ -1619,13 +1541,15 @@
 
     if (graphicsLayer == m_backgroundLayer)
         paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | RenderLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
-    else if (m_backgroundLayer)
+    else if (compositor()->fixedRootBackgroundLayer())
         paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
     
     // FIXME: GraphicsLayers need a way to split for RenderRegions.
     RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, paintBehavior, LayoutSize());
     m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags);
 
+    ASSERT(graphicsLayer != m_backgroundLayer || paintFlags & RenderLayer::PaintLayerPaintingRootBackgroundOnly);
+
     if (m_owningLayer->containsDirtyOverlayScrollbars())
         m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
 
@@ -1696,8 +1620,7 @@
 
 bool RenderLayerBacking::getCurrentTransform(const GraphicsLayer* graphicsLayer, TransformationMatrix& transform) const
 {
-    GraphicsLayer* transformedLayer = m_contentsContainmentLayer.get() ? m_contentsContainmentLayer.get() : m_graphicsLayer.get();
-    if (graphicsLayer != transformedLayer)
+    if (graphicsLayer != m_graphicsLayer.get())
         return false;
 
     if (m_owningLayer->hasTransform()) {
@@ -1927,7 +1850,7 @@
 {
     double backingMemory;
     
-    // m_ancestorClippingLayer, m_contentsContainmentLayer and m_childContainmentLayer are just used for masking or containment, so have no backing.
+    // 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();
@@ -1956,7 +1879,6 @@
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering);
     info.addWeakPointer(m_owningLayer);
     info.addMember(m_ancestorClippingLayer, "ancestorClippingLayer");
-    info.addMember(m_contentsContainmentLayer, "contentsContainmentLayer");
     info.addMember(m_graphicsLayer, "graphicsLayer");
     info.addMember(m_foregroundLayer, "foregroundLayer");
     info.addMember(m_backgroundLayer, "backgroundLayer");
diff --git a/Source/core/rendering/RenderLayerBacking.h b/Source/core/rendering/RenderLayerBacking.h
index e4efc64..3b135ed 100644
--- a/Source/core/rendering/RenderLayerBacking.h
+++ b/Source/core/rendering/RenderLayerBacking.h
@@ -70,8 +70,6 @@
     bool updateGraphicsLayerConfiguration();
     // Update graphics layer position and bounds.
     void updateGraphicsLayerGeometry(); // make private
-    // Update contents and clipping structure.
-    void updateDrawsContent();
     // Update whether layer needs blending.
     void updateContentsOpaque();
 
@@ -85,8 +83,6 @@
     bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != 0; }
     GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
 
-    GraphicsLayer* contentsContainmentLayer() const { return m_contentsContainmentLayer.get(); }
-
     bool hasContentsLayer() const { return m_foregroundLayer != 0; }
     GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
 
@@ -135,8 +131,6 @@
     void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
     bool hasUnpositionedOverflowControlsLayers() const;
 
-    void updateDebugIndicators(bool showBorder, bool showRepaintCounter);
-
     // GraphicsLayerClient interface
     virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime) OVERRIDE;
 
@@ -192,8 +186,6 @@
     void updateDrawsContent(bool isSimpleContainer);
     void registerScrollingLayers();
     
-    void updateRootLayerConfiguration();
-
     void setBackgroundLayerPaintsFixedRootBackground(bool);
 
     GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
@@ -218,7 +210,7 @@
     // 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() const;
+    bool containsPaintedContent(bool isSimpleContainer) const;
     // Returns true if the RenderLayer just contains an image that we can composite directly.
     bool isDirectlyCompositedImage() const;
     void updateImageContents();
@@ -241,7 +233,6 @@
     RenderLayer* m_owningLayer;
 
     OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context.
-    OwnPtr<GraphicsLayer> m_contentsContainmentLayer; // Only used if we have a background layer; takes the transform.
     OwnPtr<GraphicsLayer> m_graphicsLayer;
     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.
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 55f2c44..6a6ca61 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -49,6 +49,7 @@
 #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/HitTestResult.h"
 #include "core/rendering/RenderApplet.h"
@@ -212,7 +213,6 @@
     , m_hasAcceleratedCompositing(true)
     , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(ChromeClient::AllTriggers))
     , m_compositedLayerCount(0)
-    , m_showDebugBorders(false)
     , m_showRepaintCounter(false)
     , m_reevaluateCompositingAfterLayout(false)
     , m_compositing(false)
@@ -253,7 +253,6 @@
 void RenderLayerCompositor::cacheAcceleratedCompositingFlags()
 {
     bool hasAcceleratedCompositing = false;
-    bool showDebugBorders = false;
     bool showRepaintCounter = false;
     bool forceCompositingMode = false;
 
@@ -270,7 +269,6 @@
             }
         }
 
-        showDebugBorders = settings->showDebugBorders();
         showRepaintCounter = settings->showRepaintCounter();
         forceCompositingMode = settings->forceCompositingMode() && hasAcceleratedCompositing;
 
@@ -278,25 +276,12 @@
             forceCompositingMode = requiresCompositingForScrollableFrame();
     }
 
-    if (hasAcceleratedCompositing != m_hasAcceleratedCompositing || showDebugBorders != m_showDebugBorders || showRepaintCounter != m_showRepaintCounter || forceCompositingMode != m_forceCompositingMode)
+    if (hasAcceleratedCompositing != m_hasAcceleratedCompositing || showRepaintCounter != m_showRepaintCounter || forceCompositingMode != m_forceCompositingMode)
         setCompositingLayersNeedRebuild();
 
-    bool debugBordersChanged = m_showDebugBorders != showDebugBorders;
     m_hasAcceleratedCompositing = hasAcceleratedCompositing;
-    m_showDebugBorders = showDebugBorders;
     m_showRepaintCounter = showRepaintCounter;
     m_forceCompositingMode = forceCompositingMode;
-    
-    if (debugBordersChanged) {
-        if (m_layerForHorizontalScrollbar)
-            m_layerForHorizontalScrollbar->setShowDebugBorder(m_showDebugBorders);
-
-        if (m_layerForVerticalScrollbar)
-            m_layerForVerticalScrollbar->setShowDebugBorder(m_showDebugBorders);
-
-        if (m_layerForScrollCorner)
-            m_layerForScrollCorner->setShowDebugBorder(m_showDebugBorders);
-    }
 }
 
 bool RenderLayerCompositor::canRender3DTransforms() const
@@ -320,7 +305,7 @@
     if (!frameView)
         return;
 
-    IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView->contentsSize()) : frameView->visibleContentRect();
+    IntRect visibleRect = m_containerLayer ? IntRect(IntPoint(), frameView->contentsSize()) : frameView->visibleContentRect();
     if (rootLayer->visibleRectChangeRequiresFlush(visibleRect)) {
         if (Page* page = this->page())
             page->chrome().client()->scheduleCompositingLayerFlush();
@@ -609,9 +594,6 @@
         }
     }
     
-    if (layer->backing())
-        layer->backing()->updateDebugIndicators(m_showDebugBorders, m_showRepaintCounter);
-
     return layerChanged;
 }
 
@@ -1043,9 +1025,7 @@
                 reflection->backing()->updateCompositedBounds();
         }
 
-        if (layerBacking->updateGraphicsLayerConfiguration())
-            layerBacking->updateDebugIndicators(m_showDebugBorders, m_showRepaintCounter);
-        
+        layerBacking->updateGraphicsLayerConfiguration();
         layerBacking->updateGraphicsLayerGeometry();
 
         if (!layer->parent())
@@ -1152,9 +1132,9 @@
 
 void RenderLayerCompositor::frameViewDidChangeSize()
 {
-    if (m_clipLayer) {
+    if (m_containerLayer) {
         FrameView* frameView = m_renderView->frameView();
-        m_clipLayer->setSize(frameView->unscaledVisibleContentSize());
+        m_containerLayer->setSize(frameView->unscaledVisibleContentSize());
 
         frameViewDidScroll();
         updateOverflowControlsLayers();
@@ -1174,19 +1154,21 @@
     if (!m_scrollLayer)
         return;
 
-    // If there's a scrolling coordinator that manages scrolling for this frame view,
-    // it will also manage updating the scroll layer position.
+    bool scrollingCoordinatorHandlesOffset = false;
     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) {
         if (Settings* settings = m_renderView->document()->settings()) {
             if (isMainFrame() || settings->compositedScrollingForFramesEnabled())
-                scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameView);
+                scrollingCoordinatorHandlesOffset = scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameView);
         }
     }
 
-    m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
-
-    if (GraphicsLayer* fixedBackgroundLayer = fixedRootBackgroundLayer())
-        fixedBackgroundLayer->setPosition(IntPoint(frameView->scrollOffsetForFixedPosition()));
+    // Scroll position = scroll minimum + scroll offset. Adjust the layer's
+    // position to handle whatever the scroll coordinator isn't handling.
+    // The minimum scroll position is non-zero for RTL pages with overflow.
+    if (scrollingCoordinatorHandlesOffset)
+        m_scrollLayer->setPosition(-frameView->minimumScrollPosition());
+    else
+        m_scrollLayer->setPosition(-scrollPosition);
 }
 
 void RenderLayerCompositor::frameViewDidLayout()
@@ -1195,13 +1177,31 @@
 
 void RenderLayerCompositor::rootFixedBackgroundsChanged()
 {
-    // FIXME: Implement when root fixed background layer is implemented.
+    if (!supportsFixedRootBackgroundCompositing())
+        return;
+
+    // To avoid having to make the fixed root background layer fixed positioned to
+    // stay put, we position it in the layer tree as follows:
+    //
+    // + Overflow controls host
+    //   + Frame clip
+    //     + (Fixed root background) <-- Here.
+    //     + Frame scroll
+    //       + Root content layer
+    //   + Scrollbars
+    //
+    // That is, it needs to be the first child of the frame clip, the sibling of
+    // the frame scroll layer. The compositor does not own the background layer, it
+    // just positions it (like the foreground layer).
+    if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
+        m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get());
 }
 
-void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
+bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
 {
     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-        scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
+        return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
+    return false;
 }
 
 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
@@ -1212,8 +1212,13 @@
         return String();
 
     // We skip dumping the scroll and clip layers to keep layerTreeAsText output
-    // similar between platforms.
-    String layerTreeText = m_rootContentLayer->layerTreeAsText(flags);
+    // similar between platforms (unless we explicitly request dumping from the
+    // root.
+    GraphicsLayer* rootLayer = m_rootContentLayer.get();
+    if (flags & LayerTreeIncludesRootLayer)
+        rootLayer = rootGraphicsLayer();
+
+    String layerTreeText = rootLayer->layerTreeAsText(flags);
 
     // The true root layer is not included in the dump, so if we want to report
     // its repaint rects, they must be included here.
@@ -1486,9 +1491,9 @@
         m_rootContentLayer->setSize(documentRect.size());
         m_rootContentLayer->setPosition(documentRect.location());
     }
-    if (m_clipLayer) {
+    if (m_containerLayer) {
         FrameView* frameView = m_renderView->frameView();
-        m_clipLayer->setSize(frameView->unscaledVisibleContentSize());
+        m_containerLayer->setSize(frameView->unscaledVisibleContentSize());
     }
 
 #if ENABLE(RUBBER_BANDING)
@@ -1784,7 +1789,7 @@
         return false;
 
     if (renderer->isCanvas()) {
-        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node());
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
 #if USE(COMPOSITING_FOR_SMALL_CANVASES)
         bool isCanvasLargeEnoughToForceCompositing = true;
 #else
@@ -2090,7 +2095,11 @@
 
 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
 {
-    return false;  // FIXME: Return true if this is supported when implemented.
+    if (Settings* settings = m_renderView->document()->settings()) {
+        if (settings->acceleratedCompositingForFixedRootBackgroundEnabled())
+            return true;
+    }
+    return false;
 }
 
 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer* layer) const
@@ -2256,25 +2265,6 @@
 
 #endif
 
-bool RenderLayerCompositor::viewHasTransparentBackground(Color* backgroundColor) const
-{
-    FrameView* frameView = m_renderView->frameView();
-    if (frameView->isTransparent()) {
-        if (backgroundColor)
-            *backgroundColor = Color(); // Return an invalid color.
-        return true;
-    }
-
-    Color documentBackgroundColor = frameView->documentBackgroundColor();
-    if (!documentBackgroundColor.isValid())
-        documentBackgroundColor = Color::white;
-
-    if (backgroundColor)
-        *backgroundColor = documentBackgroundColor;
-        
-    return documentBackgroundColor.hasAlpha();
-}
-
 void RenderLayerCompositor::updateOverflowControlsLayers()
 {
 #if ENABLE(RUBBER_BANDING)
@@ -2289,7 +2279,7 @@
 
             // We want the overhang areas layer to be positioned below the frame contents,
             // so insert it below the clip layer.
-            m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.get(), m_clipLayer.get());
+            m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.get(), m_containerLayer.get());
         }
     } else if (m_layerForOverhangAreas) {
         m_layerForOverhangAreas->removeFromParent();
@@ -2317,7 +2307,6 @@
     if (requiresHorizontalScrollbarLayer()) {
         if (!m_layerForHorizontalScrollbar) {
             m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), this);
-            m_layerForHorizontalScrollbar->setShowDebugBorder(m_showDebugBorders);
 #ifndef NDEBUG
             m_layerForHorizontalScrollbar->setName("horizontal scrollbar");
 #endif
@@ -2337,7 +2326,6 @@
     if (requiresVerticalScrollbarLayer()) {
         if (!m_layerForVerticalScrollbar) {
             m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), this);
-            m_layerForVerticalScrollbar->setShowDebugBorder(m_showDebugBorders);
 #ifndef NDEBUG
             m_layerForVerticalScrollbar->setName("vertical scrollbar");
 #endif
@@ -2357,7 +2345,6 @@
     if (requiresScrollCornerLayer()) {
         if (!m_layerForScrollCorner) {
             m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory(), this);
-            m_layerForScrollCorner->setShowDebugBorder(m_showDebugBorders);
 #ifndef NDEBUG
             m_layerForScrollCorner->setName("scroll corner");
 #endif
@@ -2392,7 +2379,7 @@
 
     if (!m_overflowControlsHostLayer) {
         ASSERT(!m_scrollLayer);
-        ASSERT(!m_clipLayer);
+        ASSERT(!m_containerLayer);
 
         // Create a layer to host the clipping layer and the overflow controls layers.
         m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
@@ -2401,11 +2388,12 @@
 #endif
 
         // Create a clipping layer if this is an iframe
-        m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+        m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
 #ifndef NDEBUG
-        m_clipLayer->setName("frame clipping");
+        m_containerLayer->setName("frame clipping");
 #endif
-        m_clipLayer->setMasksToBounds(true);
+        if (!isMainFrame())
+            m_containerLayer->setMasksToBounds(true);
 
         m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
 #ifndef NDEBUG
@@ -2415,8 +2403,8 @@
             scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_scrollLayer.get(), true);
 
         // Hook them up
-        m_overflowControlsHostLayer->addChild(m_clipLayer.get());
-        m_clipLayer->addChild(m_scrollLayer.get());
+        m_overflowControlsHostLayer->addChild(m_containerLayer.get());
+        m_containerLayer->addChild(m_scrollLayer.get());
         m_scrollLayer->addChild(m_rootContentLayer.get());
 
         frameViewDidChangeSize();
@@ -2469,7 +2457,7 @@
 
     if (m_overflowControlsHostLayer) {
         m_overflowControlsHostLayer = nullptr;
-        m_clipLayer = nullptr;
+        m_containerLayer = nullptr;
         m_scrollLayer = nullptr;
     }
     ASSERT(!m_scrollLayer);
@@ -2741,7 +2729,7 @@
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering);
     info.addWeakPointer(m_renderView);
     info.addMember(m_rootContentLayer, "rootContentLayer");
-    info.addMember(m_clipLayer, "clipLayer");
+    info.addMember(m_containerLayer, "containerLayer");
     info.addMember(m_scrollLayer, "scrollLayer");
     info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers");
     info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer");
diff --git a/Source/core/rendering/RenderLayerCompositor.h b/Source/core/rendering/RenderLayerCompositor.h
index 00087e0..790680e 100644
--- a/Source/core/rendering/RenderLayerCompositor.h
+++ b/Source/core/rendering/RenderLayerCompositor.h
@@ -175,7 +175,7 @@
     void frameViewDidLayout();
     void rootFixedBackgroundsChanged();
 
-    void scrollingLayerDidChange(RenderLayer*);
+    bool scrollingLayerDidChange(RenderLayer*);
 
     String layerTreeAsText(LayerTreeFlags);
 
@@ -203,8 +203,6 @@
     void reportMemoryUsage(MemoryObjectInfo*) const;
     void setShouldReevaluateCompositingAfterLayout() { m_reevaluateCompositingAfterLayout = true; }
 
-    bool viewHasTransparentBackground(Color* backgroundColor = 0) const;
-
     // Returns all reasons (direct, indirectly due to subtree, and indirectly due to overlap) that a layer should be composited.
     CompositingReasons reasonsForCompositing(const RenderLayer*) const;
     
@@ -316,7 +314,6 @@
     ChromeClient::CompositingTriggerFlags m_compositingTriggers;
 
     int m_compositedLayerCount;
-    bool m_showDebugBorders;
     bool m_showRepaintCounter;
 
     // When true, we have to wait until layout has happened before we can decide whether to enter compositing mode,
@@ -333,8 +330,8 @@
     
     RootLayerAttachment m_rootLayerAttachment;
 
-    // Enclosing clipping layer for iframe content
-    OwnPtr<GraphicsLayer> m_clipLayer;
+    // Enclosing container layer, which clips for iframe content
+    OwnPtr<GraphicsLayer> m_containerLayer;
     OwnPtr<GraphicsLayer> m_scrollLayer;
 
     HashSet<RenderLayer*> m_viewportConstrainedLayers;
diff --git a/Source/core/rendering/RenderLayerFilterInfo.cpp b/Source/core/rendering/RenderLayerFilterInfo.cpp
index d31cd7f..df709e1 100644
--- a/Source/core/rendering/RenderLayerFilterInfo.cpp
+++ b/Source/core/rendering/RenderLayerFilterInfo.cpp
@@ -37,6 +37,7 @@
 #include "core/platform/graphics/filters/custom/CustomFilterProgram.h"
 #include "core/rendering/FilterEffectRenderer.h"
 #include "core/rendering/RenderLayer.h"
+#include "core/rendering/svg/RenderSVGResourceContainer.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
 #include "core/svg/graphics/filters/SVGFilter.h"
@@ -106,7 +107,7 @@
 void RenderLayerFilterInfo::notifyFinished(CachedResource*)
 {
     RenderObject* renderer = m_layer->renderer();
-    renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
+    toElement(renderer->node())->scheduleLayerUpdate();
     renderer->repaint();
 }
 
@@ -154,7 +155,7 @@
 void RenderLayerFilterInfo::notifyCustomFilterProgramLoaded(CustomFilterProgram*)
 {
     RenderObject* renderer = m_layer->renderer();
-    renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
+    toElement(renderer->node())->scheduleLayerUpdate();
     renderer->repaint();
 }
 
diff --git a/Source/core/rendering/RenderListBox.cpp b/Source/core/rendering/RenderListBox.cpp
index 6ebf5ef..3841675 100644
--- a/Source/core/rendering/RenderListBox.cpp
+++ b/Source/core/rendering/RenderListBox.cpp
@@ -121,10 +121,10 @@
             HTMLElement* element = listItems[i];
             String text;
             Font itemFont = style()->font();
-            if (element->hasTagName(optionTag))
+            if (element->hasTagName(optionTag)) {
                 text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
-            else if (element->hasTagName(optgroupTag)) {
-                text = static_cast<const HTMLOptGroupElement*>(element)->groupLabelText();
+            } else if (isHTMLOptGroupElement(element)) {
+                text = toHTMLOptGroupElement(element)->groupLabelText();
                 FontDescription d = itemFont.fontDescription();
                 d.setWeight(d.bolderWeight());
                 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
@@ -403,8 +403,8 @@
     bool isOptionElement = element->hasTagName(optionTag);
     if (isOptionElement)
         itemText = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
-    else if (element->hasTagName(optgroupTag))
-        itemText = static_cast<const HTMLOptGroupElement*>(element)->groupLabelText();
+    else if (isHTMLOptGroupElement(element))
+        itemText = toHTMLOptGroupElement(element)->groupLabelText();
     applyTextTransform(style(), itemText, ' ');
 
     Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor);
@@ -423,7 +423,7 @@
     LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex);
     r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r));
 
-    if (element->hasTagName(optgroupTag)) {
+    if (isHTMLOptGroupElement(element)) {
         FontDescription d = itemFont.fontDescription();
         d.setWeight(d.bolderWeight());
         itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
diff --git a/Source/core/rendering/RenderListItem.cpp b/Source/core/rendering/RenderListItem.cpp
index fd91115..f6e8b40 100644
--- a/Source/core/rendering/RenderListItem.cpp
+++ b/Source/core/rendering/RenderListItem.cpp
@@ -268,32 +268,34 @@
 {
     // Sanity check the location of our marker.
     if (m_marker) {
-        RenderObject* markerPar = m_marker->parent();
+        RenderObject* markerParent = m_marker->parent();
         RenderObject* lineBoxParent = getParentOfFirstLineBox(this, m_marker);
         if (!lineBoxParent) {
             // If the marker is currently contained inside an anonymous box,
             // then we are the only item in that anonymous box (since no line box
             // parent was found).  It's ok to just leave the marker where it is
             // in this case.
-            if (markerPar && markerPar->isAnonymousBlock())
-                lineBoxParent = markerPar;
+            if (markerParent && markerParent->isAnonymousBlock())
+                lineBoxParent = markerParent;
             else
                 lineBoxParent = this;
         }
 
-        if (markerPar != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) {
+        if (markerParent != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) {
             // Removing and adding the marker can trigger repainting in
             // containers other than ourselves, so we need to disable LayoutState.
             LayoutStateDisabler layoutStateDisabler(view());
             updateFirstLetter();
             m_marker->remove();
+            if (markerParent)
+                markerParent->dirtyLinesFromChangedChild(m_marker);
             if (!lineBoxParent)
                 lineBoxParent = this;
             lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent));
             m_marker->updateMarginsAndContent();
-            // If markerPar is an anonymous block that has lost all its children, destroy it.
-            if (markerPar && markerPar->isAnonymousBlock() && !markerPar->firstChild() && !toRenderBlock(markerPar)->continuation())
-                markerPar->destroy();
+            // If markerParent is an anonymous block that has lost all its children, destroy it.
+            if (markerParent && markerParent->isAnonymousBlock() && !markerParent->firstChild() && !toRenderBlock(markerParent)->continuation())
+                markerParent->destroy();
         }
     }
 }
diff --git a/Source/core/rendering/RenderListMarker.cpp b/Source/core/rendering/RenderListMarker.cpp
index 092f8f4..4964c58 100644
--- a/Source/core/rendering/RenderListMarker.cpp
+++ b/Source/core/rendering/RenderListMarker.cpp
@@ -1295,7 +1295,8 @@
             reversedText.reserveCapacity(length);
             for (int i = length - 1; i >= 0; --i)
                 reversedText.append(m_text[i]);
-            textRun.setText(reversedText.characters(), length);
+            ASSERT(reversedText.length() == reversedText.capacity());
+            textRun.setText(reversedText.toString());
         }
 
         const UChar suffix = listMarkerSuffix(type, m_listItem->value());
diff --git a/Source/core/rendering/RenderMenuList.cpp b/Source/core/rendering/RenderMenuList.cpp
index 6b3d43f..2071418 100644
--- a/Source/core/rendering/RenderMenuList.cpp
+++ b/Source/core/rendering/RenderMenuList.cpp
@@ -260,7 +260,7 @@
 
 String RenderMenuList::text() const
 {
-    return m_buttonText ? m_buttonText->text() : 0;
+    return m_buttonText ? m_buttonText->text() : String();
 }
 
 LayoutRect RenderMenuList::controlClipRect(const LayoutPoint& additionalOffset) const
@@ -399,8 +399,8 @@
 
     String itemString;
     Element* element = listItems[listIndex];
-    if (element->hasTagName(optgroupTag))
-        itemString = static_cast<const HTMLOptGroupElement*>(element)->groupLabelText();
+    if (isHTMLOptGroupElement(element))
+        itemString = toHTMLOptGroupElement(element)->groupLabelText();
     else if (element->hasTagName(optionTag))
         itemString = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
 
@@ -446,7 +446,7 @@
 
     bool groupEnabled = true;
     if (Element* parentElement = element->parentElement()) {
-        if (parentElement->hasTagName(optgroupTag))
+        if (isHTMLOptGroupElement(parentElement))
             groupEnabled = !parentElement->isDisabledFormControl();
     }
     if (!groupEnabled)
@@ -590,7 +590,7 @@
 bool RenderMenuList::itemIsLabel(unsigned listIndex) const
 {
     const Vector<HTMLElement*>& listItems = selectElement()->listItems();
-    return listIndex < listItems.size() && listItems[listIndex]->hasTagName(optgroupTag);
+    return listIndex < listItems.size() && isHTMLOptGroupElement(listItems[listIndex]);
 }
 
 bool RenderMenuList::itemIsSelected(unsigned listIndex) const
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index a08b09e..d84ea8a 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -33,7 +33,10 @@
 #include "core/editing/EditingBoundary.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/htmlediting.h"
+#include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLElement.h"
+#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"
@@ -1721,7 +1724,7 @@
 
 void RenderObject::setAnimatableStyle(PassRefPtr<RenderStyle> style)
 {
-    if (!isText() && style)
+    if (!isText() && style && !RuntimeEnabledFeatures::webAnimationsCSSEnabled())
         setStyle(animation()->updateAnimations(this, style.get()));
     else
         setStyle(style);
@@ -2285,7 +2288,7 @@
 RenderObject* RenderObject::rendererForRootBackground()
 {
     ASSERT(isRoot());
-    if (!hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) {
+    if (!hasBackground() && node() && isHTMLHtmlElement(node())) {
         // Locate the <body> element using the DOM. This is easier than trying
         // to crawl around a render tree with potential :before/:after content and
         // anonymous blocks created by inline <body> tags etc. We can locate the <body>
@@ -2860,8 +2863,7 @@
         curr = curr->parent();
         if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuation())
             curr = toRenderBlock(curr)->continuation();
-    } while (curr && decorations && (!quirksMode || !curr->node() ||
-                                     (!curr->node()->hasTagName(aTag) && !curr->node()->hasTagName(fontTag))));
+    } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnchorElement(curr->node()) && !curr->node()->hasTagName(fontTag))));
 
     // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
     if (decorations && curr) {
@@ -3048,7 +3050,7 @@
         if (node->hasTagName(HTMLNames::bodyTag))
             break;
 
-        if (!isPositioned() && (node->hasTagName(tableTag) || node->hasTagName(tdTag) || node->hasTagName(thTag)))
+        if (!isPositioned() && (isHTMLTableElement(node) || node->hasTagName(tdTag) || node->hasTagName(thTag)))
             break;
 
         // Webkit specific extension where offsetParent stops at zoom level changes.
diff --git a/Source/core/rendering/RenderObject.h b/Source/core/rendering/RenderObject.h
index 3e12f3b..4500ca3 100644
--- a/Source/core/rendering/RenderObject.h
+++ b/Source/core/rendering/RenderObject.h
@@ -517,14 +517,6 @@
 
     bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositioned(); } // absolute or fixed positioning
     bool isInFlowPositioned() const { return m_bitfields.isRelPositioned() || m_bitfields.isStickyPositioned(); } // relative or sticky positioning
-    bool hasPaintOffset() const
-    {
-        bool positioned = isInFlowPositioned();
-        // Shape outside on a float can reposition the float in much the
-        // same way as relative positioning, so treat it as such.
-        positioned = positioned || isFloatingWithShapeOutside();
-        return positioned;
-    }
     bool isRelPositioned() const { return m_bitfields.isRelPositioned(); } // relative positioning
     bool isStickyPositioned() const { return m_bitfields.isStickyPositioned(); }
     bool isPositioned() const { return m_bitfields.isPositioned(); }
diff --git a/Source/core/rendering/RenderTable.cpp b/Source/core/rendering/RenderTable.cpp
index 4df5fed..01c1695 100644
--- a/Source/core/rendering/RenderTable.cpp
+++ b/Source/core/rendering/RenderTable.cpp
@@ -28,6 +28,7 @@
 
 #include "HTMLNames.h"
 #include "core/dom/Document.h"
+#include "core/html/HTMLTableElement.h"
 #include "core/page/FrameView.h"
 #include "core/rendering/AutoTableLayout.h"
 #include "core/rendering/FixedTableLayout.h"
@@ -324,7 +325,7 @@
 
     // HTML tables' width styles already include borders and paddings, but CSS tables' width styles do not.
     LayoutUnit borders = 0;
-    bool isCSSTable = !node() || !node()->hasTagName(tableTag);
+    bool isCSSTable = !node() || !isHTMLTableElement(node());
     if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive() && style()->boxSizing() == CONTENT_BOX)
         borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : paddingStart() + paddingEnd());
 
@@ -341,7 +342,7 @@
         // HTML tables size as though CSS height includes border/padding, CSS tables do not.
         LayoutUnit borders = LayoutUnit();
         // FIXME: We cannot apply box-sizing: content-box on <table> which other browsers allow.
-        if ((node() && node()->hasTagName(tableTag)) || style()->boxSizing() == BORDER_BOX) {
+        if ((node() && isHTMLTableElement(node())) || style()->boxSizing() == BORDER_BOX) {
             borders = borderAndPadding;
         }
         computedLogicalHeight = styleLogicalHeight.value() - borders;
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index 3bcff2d..41ad275 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -24,13 +24,16 @@
  */
 
 #include "config.h"
+#include "core/rendering/RenderTableSection.h"
+
+// FIXME: Remove 'RuntimeEnabledFeatures.h' when http://crbug.com/78724 is closed.
+#include "RuntimeEnabledFeatures.h"
 #include <limits>
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderTableCell.h"
 #include "core/rendering/RenderTableCol.h"
 #include "core/rendering/RenderTableRow.h"
-#include "core/rendering/RenderTableSection.h"
 #include "core/rendering/RenderView.h"
 #include <wtf/HashSet.h>
 #include <wtf/MemoryInstrumentationHashMap.h>
@@ -360,18 +363,26 @@
                 if (current.inColSpan && cell->rowSpan() == 1)
                     continue;
 
-                if (cell->rowSpan() > 1) {
-                    // For row spanning cells, we only handle them for the first row they span. This ensures we take their baseline into account.
-                    if (cell->rowIndex() == r) {
-                        rowSpanCells.append(cell);
+                if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled()) {
+                    if (cell->rowSpan() > 1) {
+                        // For row spanning cells, we only handle them for the first row they span. This ensures we take their baseline into account.
+                        if (cell->rowIndex() == r) {
+                            rowSpanCells.append(cell);
 
-                        // Find out the baseline. The baseline is set on the first row in a rowSpan.
-                        updateBaselineForCell(cell, r, baselineDescent);
+                            // Find out the baseline. The baseline is set on the first row in a rowSpan.
+                            updateBaselineForCell(cell, r, baselineDescent);
+                        }
+                        continue;
                     }
-                    continue;
-                }
 
-                ASSERT(cell->rowSpan() == 1);
+                    ASSERT(cell->rowSpan() == 1);
+                } else {
+                    // FIXME: We add all the logical row of a rowspan to the last rows
+                    // until crbug.com/78724 is fixed and the runtime flag removed.
+                    // This avoids propagating temporary regressions while we fix the bug.
+                    if ((cell->rowIndex() + cell->rowSpan() - 1) != r)
+                        continue;
+                }
 
                 if (cell->hasOverrideHeight()) {
                     if (!statePusher.didPush()) {
@@ -385,10 +396,20 @@
                     cell->layoutIfNeeded();
                 }
 
-                m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logicalHeightForRowSizing());
+                if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled()) {
+                    m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logicalHeightForRowSizing());
 
-                // Find out the baseline.
-                updateBaselineForCell(cell, r, baselineDescent);
+                    // Find out the baseline.
+                    updateBaselineForCell(cell, r, baselineDescent);
+                } else {
+                    // For row spanning cells, |r| is the last row in the span.
+                    unsigned cellStartRow = cell->rowIndex();
+
+                    m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cell->logicalHeightForRowSizing());
+
+                    // Find out the baseline.
+                    updateBaselineForCell(cell, cellStartRow, baselineDescent);
+                }
             }
         }
 
@@ -397,8 +418,10 @@
         m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]);
     }
 
-    if (!rowSpanCells.isEmpty())
+    if (!rowSpanCells.isEmpty()) {
+        ASSERT(RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled());
         distributeRowSpanHeightToRows(rowSpanCells);
+    }
 
     ASSERT(!needsLayout());
 
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index acf1042..14e80bf 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -85,7 +85,7 @@
     virtual void fired()
     {
         ASSERT(gSecureTextTimers->contains(m_renderText));
-        m_renderText->setText(m_renderText->text(), true /* forcing setting text as it may be masked later */);
+        m_renderText->setText(m_renderText->text().impl(), true /* forcing setting text as it may be masked later */);
     }
 
     RenderText* m_renderText;
@@ -786,7 +786,7 @@
 
     int len = textLength();
 
-    if (!len || (stripFrontSpaces && text()->containsOnlyWhitespace())) {
+    if (!len || (stripFrontSpaces && text().impl()->containsOnlyWhitespace())) {
         firstLineMinWidth = 0;
         lastLineMinWidth = 0;
         firstLineMaxWidth = 0;
@@ -913,7 +913,7 @@
         fragmentWithHyphen.append(word + suffixStart, fragmentLength);
         fragmentWithHyphen.append(style->hyphenString());
 
-        TextRun run = RenderBlock::constructTextRun(renderer, font, fragmentWithHyphen.characters(), fragmentWithHyphen.length(), style);
+        TextRun run = RenderBlock::constructTextRun(renderer, font, fragmentWithHyphen.bloatedCharacters(), fragmentWithHyphen.length(), style);
         run.setCharactersLength(fragmentWithHyphen.length());
         run.setCharacterScanForCodePath(!renderer->canUseSimpleFontCodePath());
         float fragmentWidth = font.width(run);
@@ -1068,7 +1068,7 @@
 
             if (w > maxWordWidth) {
                 int suffixStart;
-                float maxFragmentWidth = maxWordFragmentWidth(this, styleToUse, f, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart);
+                float maxFragmentWidth = maxWordFragmentWidth(this, styleToUse, f, bloatedCharacters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart);
 
                 if (suffixStart) {
                     float suffixWidth;
@@ -1351,10 +1351,7 @@
         return true;
     if (!o->isText())
         return false;
-    StringImpl* text = toRenderText(o)->text();
-    if (!text)
-        return true;
-    return !text->length();
+    return toRenderText(o)->text().isEmpty();
 }
 
 UChar RenderText::previousCharacter() const
@@ -1366,7 +1363,7 @@
             break;
     UChar prev = ' ';
     if (previousText && previousText->isText())
-        if (StringImpl* previousString = toRenderText(previousText)->text())
+        if (StringImpl* previousString = toRenderText(previousText)->text().impl())
             prev = (*previousString)[previousString->length() - 1];
     return prev;
 }
@@ -1897,7 +1894,7 @@
 {
     if (isAllASCII() || m_text.is8Bit())
         return true;
-    return Font::characterRangeCodePath(characters(), length()) == Font::Simple;
+    return Font::characterRangeCodePath(bloatedCharacters(), length()) == Font::Simple;
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/rendering/RenderText.h b/Source/core/rendering/RenderText.h
index 0566d9c..78bba3a 100644
--- a/Source/core/rendering/RenderText.h
+++ b/Source/core/rendering/RenderText.h
@@ -52,7 +52,7 @@
     void attachTextBox(InlineTextBox*);
     void removeTextBox(InlineTextBox*);
 
-    StringImpl* text() const { return m_text.impl(); }
+    const String& text() const { return m_text; }
     String textWithoutTranscoding() const;
 
     InlineTextBox* createInlineTextBox();
@@ -72,7 +72,7 @@
     bool is8Bit() const { return m_text.is8Bit(); }
     const LChar* characters8() const { return m_text.impl()->characters8(); }
     const UChar* characters16() const { return m_text.impl()->characters16(); }
-    const UChar* characters() const { return m_text.bloatedCharacters(); }
+    const UChar* bloatedCharacters() const { return m_text.bloatedCharacters(); }
     UChar characterAt(unsigned) const;
     UChar uncheckedCharacterAt(unsigned) const;
     UChar operator[](unsigned i) const { return uncheckedCharacterAt(i); }
diff --git a/Source/core/rendering/RenderTextControlMultiLine.cpp b/Source/core/rendering/RenderTextControlMultiLine.cpp
index 6da489f..8a8887d 100644
--- a/Source/core/rendering/RenderTextControlMultiLine.cpp
+++ b/Source/core/rendering/RenderTextControlMultiLine.cpp
@@ -36,7 +36,7 @@
 RenderTextControlMultiLine::~RenderTextControlMultiLine()
 {
     if (node() && node()->inDocument())
-        static_cast<HTMLTextAreaElement*>(node())->rendererWillBeDestroyed();
+        toHTMLTextAreaElement(node())->rendererWillBeDestroyed();
 }
 
 bool RenderTextControlMultiLine::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
@@ -63,13 +63,13 @@
 
 LayoutUnit RenderTextControlMultiLine::preferredContentLogicalWidth(float charWidth) const
 {
-    int factor = static_cast<HTMLTextAreaElement*>(node())->cols();
+    int factor = toHTMLTextAreaElement(node())->cols();
     return static_cast<LayoutUnit>(ceilf(charWidth * factor)) + scrollbarThickness();
 }
 
 LayoutUnit RenderTextControlMultiLine::computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const
 {
-    return lineHeight * static_cast<HTMLTextAreaElement*>(node())->rows() + nonContentHeight;
+    return lineHeight * toHTMLTextAreaElement(node())->rows() + nonContentHeight;
 }
 
 int RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
diff --git a/Source/core/rendering/RenderTheme.cpp b/Source/core/rendering/RenderTheme.cpp
index a8999b9..5c8b9bc 100644
--- a/Source/core/rendering/RenderTheme.cpp
+++ b/Source/core/rendering/RenderTheme.cpp
@@ -92,7 +92,7 @@
 {
 }
 
-void RenderTheme::adjustStyle(RenderStyle* style, Element* e, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
+void RenderTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyle& uaStyle)
 {
     // Force inline and table display styles to be inline-block (except for table- which is block)
     ControlPart part = style->appearance();
@@ -104,7 +104,7 @@
     else if (style->display() == COMPACT || style->display() == RUN_IN || style->display() == LIST_ITEM || style->display() == TABLE)
         style->setDisplay(BLOCK);
 
-    if (UAHasAppearance && isControlStyled(style, border, background, backgroundColor)) {
+    if (uaStyle.hasAppearance && isControlStyled(style, uaStyle)) {
         if (part == MenulistPart) {
             style->setAppearance(MenulistButtonPart);
             part = MenulistButtonPart;
@@ -495,6 +495,7 @@
     if (RuntimeEnabledFeatures::dialogElementEnabled()) {
         runtimeCSS.appendLiteral("dialog:not([open]) { display: none; }");
         runtimeCSS.appendLiteral("dialog { position: absolute; left: 0; right: 0; margin: auto; border: solid; padding: 1em; background: white; color: black;}");
+        runtimeCSS.appendLiteral("dialog::backdrop { background: rgba(0,0,0,0.1); }");
     }
 
     return runtimeCSS.toString();
@@ -645,22 +646,22 @@
     return appearance != CheckboxPart && appearance != RadioPart;
 }
 
-static bool isBackgroundOrBorderStyled(const RenderStyle& style, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
+static bool isBackgroundOrBorderStyled(const RenderStyle& style, const CachedUAStyle& uaStyle)
 {
     // Code below excludes the background-repeat from comparison by resetting it
-    FillLayer backgroundCopy = background;
+    FillLayer backgroundCopy = uaStyle.backgroundLayers;
     FillLayer backgroundLayersCopy = *style.backgroundLayers();
     backgroundCopy.setRepeatX(NoRepeatFill);
     backgroundCopy.setRepeatY(NoRepeatFill);
     backgroundLayersCopy.setRepeatX(NoRepeatFill);
     backgroundLayersCopy.setRepeatY(NoRepeatFill);
     // Test the style to see if the UA border and background match.
-    return style.border() != border
+    return style.border() != uaStyle.border
         || backgroundLayersCopy != backgroundCopy
-        || style.visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor;
+        || style.visitedDependentColor(CSSPropertyBackgroundColor) != uaStyle.backgroundColor;
 }
 
-bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background, const Color& backgroundColor) const
+bool RenderTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle& uaStyle) const
 {
     switch (style->appearance()) {
     case PushButtonPart:
@@ -672,14 +673,14 @@
     case ContinuousCapacityLevelIndicatorPart:
     case DiscreteCapacityLevelIndicatorPart:
     case RatingLevelIndicatorPart:
-        return isBackgroundOrBorderStyled(*style, border, background, backgroundColor);
+        return isBackgroundOrBorderStyled(*style, uaStyle);
 
     case ListboxPart:
     case MenulistPart:
     case SearchFieldPart:
     case TextAreaPart:
     case TextFieldPart:
-        return isBackgroundOrBorderStyled(*style, border, background, backgroundColor) || style->boxShadow();
+        return isBackgroundOrBorderStyled(*style, uaStyle) || style->boxShadow();
 
     case SliderHorizontalPart:
     case SliderVerticalPart:
diff --git a/Source/core/rendering/RenderTheme.h b/Source/core/rendering/RenderTheme.h
index f342c5a..efbbe68 100644
--- a/Source/core/rendering/RenderTheme.h
+++ b/Source/core/rendering/RenderTheme.h
@@ -23,15 +23,16 @@
 #ifndef RenderTheme_h
 #define RenderTheme_h
 
+#include "core/platform/ScrollTypes.h"
 #if USE(NEW_THEME)
 #include "core/platform/Theme.h"
 #else
 #include "core/platform/ThemeTypes.h"
 #endif
-#include "core/platform/ScrollTypes.h"
 #include "core/rendering/RenderObject.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "core/rendering/style/CachedUAStyle.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
 
 namespace WebCore {
 
@@ -44,6 +45,7 @@
 class RenderMeter;
 class RenderProgress;
 
+
 class RenderTheme : public RefCounted<RenderTheme> {
 protected:
     RenderTheme();
@@ -69,8 +71,7 @@
     // metrics and defaults given the contents of the style.  This includes sophisticated operations like
     // selection of control size based off the font, the disabling of appearance when certain other properties like
     // "border" are set, or if the appearance is not supported by the theme.
-    void adjustStyle(RenderStyle*, Element*,  bool UAHasAppearance,
-                     const BorderData&, const FillLayer&, const Color& backgroundColor);
+    void adjustStyle(RenderStyle*, Element*,  const CachedUAStyle&);
 
     // This method is called to paint the widget as a background of the RenderObject.  A widget's foreground, e.g., the
     // text of a button, is always rendered by the engine itself.  The boolean return value indicates
@@ -102,7 +103,7 @@
     virtual bool controlSupportsTints(const RenderObject*) const { return false; }
 
     // Whether or not the control has been styled enough by the author to disable the native appearance.
-    virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const;
+    virtual bool isControlStyled(const RenderStyle*, const CachedUAStyle&) const;
 
     // A general method asking if any control tinting is supported at all.
     virtual bool supportsControlTints() const { return false; }
diff --git a/Source/core/rendering/RenderThemeChromiumAndroid.cpp b/Source/core/rendering/RenderThemeChromiumAndroid.cpp
index 778d769..e316abf 100644
--- a/Source/core/rendering/RenderThemeChromiumAndroid.cpp
+++ b/Source/core/rendering/RenderThemeChromiumAndroid.cpp
@@ -69,7 +69,7 @@
 
 String RenderThemeChromiumAndroid::extraMediaControlsStyleSheet()
 {
-    return String(mediaControlsChromiumAndroidUserAgentStyleSheet, sizeof(mediaControlsChromiumAndroidUserAgentStyleSheet));
+    return String(mediaControlsAndroidUserAgentStyleSheet, sizeof(mediaControlsAndroidUserAgentStyleSheet));
 }
 
 String RenderThemeChromiumAndroid::extraDefaultStyleSheet()
diff --git a/Source/core/rendering/RenderThemeChromiumMac.h b/Source/core/rendering/RenderThemeChromiumMac.h
index 6fbfe5d..1475367 100644
--- a/Source/core/rendering/RenderThemeChromiumMac.h
+++ b/Source/core/rendering/RenderThemeChromiumMac.h
@@ -37,62 +37,62 @@
     static PassRefPtr<RenderTheme> create();
 
     // A method asking if the control changes its tint when the window has focus or not.
-    virtual bool controlSupportsTints(const RenderObject*) const;
+    virtual bool controlSupportsTints(const RenderObject*) const OVERRIDE;
 
     // A general method asking if any control tinting is supported at all.
-    virtual bool supportsControlTints() const { return true; }
+    virtual bool supportsControlTints() const OVERRIDE { return true; }
 
     virtual void adjustRepaintRect(const RenderObject*, IntRect&) OVERRIDE;
 
-    virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const;
+    virtual bool isControlStyled(const RenderStyle*, const CachedUAStyle&) const OVERRIDE;
 
-    virtual Color platformActiveSelectionBackgroundColor() const;
-    virtual Color platformInactiveSelectionBackgroundColor() const;
-    virtual Color platformActiveListBoxSelectionBackgroundColor() const;
-    virtual Color platformActiveListBoxSelectionForegroundColor() const;
-    virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
-    virtual Color platformInactiveListBoxSelectionForegroundColor() const;
-    virtual Color platformFocusRingColor() const;
+    virtual Color platformActiveSelectionBackgroundColor() const OVERRIDE;
+    virtual Color platformInactiveSelectionBackgroundColor() const OVERRIDE;
+    virtual Color platformActiveListBoxSelectionBackgroundColor() const OVERRIDE;
+    virtual Color platformActiveListBoxSelectionForegroundColor() const OVERRIDE;
+    virtual Color platformInactiveListBoxSelectionBackgroundColor() const OVERRIDE;
+    virtual Color platformInactiveListBoxSelectionForegroundColor() const OVERRIDE;
+    virtual Color platformFocusRingColor() const OVERRIDE;
 
-    virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return SmallScrollbar; }
+    virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) OVERRIDE { return SmallScrollbar; }
 
-    virtual void platformColorsDidChange();
+    virtual void platformColorsDidChange() OVERRIDE;
 
     // System fonts.
-    virtual void systemFont(CSSValueID, FontDescription&) const;
+    virtual void systemFont(CSSValueID, FontDescription&) const OVERRIDE;
 
-    virtual int minimumMenuListSize(RenderStyle*) const;
+    virtual int minimumMenuListSize(RenderStyle*) const OVERRIDE;
 
-    virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
+    virtual void adjustSliderThumbSize(RenderStyle*, Element*) const OVERRIDE;
 
     virtual IntSize sliderTickSize() const OVERRIDE;
     virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE;
 
-    virtual int popupInternalPaddingLeft(RenderStyle*) const;
-    virtual int popupInternalPaddingRight(RenderStyle*) const;
-    virtual int popupInternalPaddingTop(RenderStyle*) const;
-    virtual int popupInternalPaddingBottom(RenderStyle*) const;
+    virtual int popupInternalPaddingLeft(RenderStyle*) const OVERRIDE;
+    virtual int popupInternalPaddingRight(RenderStyle*) const OVERRIDE;
+    virtual int popupInternalPaddingTop(RenderStyle*) const OVERRIDE;
+    virtual int popupInternalPaddingBottom(RenderStyle*) const OVERRIDE;
 
     virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
 
     virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; }
 
     virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const OVERRIDE;
-    virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&);
-    virtual bool supportsMeter(ControlPart) const;
+    virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&) OVERRIDE;
+    virtual bool supportsMeter(ControlPart) const OVERRIDE;
 
     // Returns the repeat interval of the animation for the progress bar.
-    virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
+    virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const OVERRIDE;
     // Returns the duration of the animation for the progress bar.
-    virtual double animationDurationForProgressBar(RenderProgress*) const;
+    virtual double animationDurationForProgressBar(RenderProgress*) const OVERRIDE;
 
-    virtual Color systemColor(CSSValueID) const;
+    virtual Color systemColor(CSSValueID) const OVERRIDE;
 
 protected:
     RenderThemeChromiumMac();
     virtual ~RenderThemeChromiumMac();
 
-    virtual bool supportsSelectionForegroundColors() const { return false; }
+    virtual bool supportsSelectionForegroundColors() const OVERRIDE { return false; }
 
     virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
     virtual void adjustTextFieldStyle(RenderStyle*, Element*) const;
@@ -180,7 +180,6 @@
     virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
     virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
     virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
-    virtual String extraMediaControlsStyleSheet();
     virtual String extraFullScreenStyleSheet();
   
     virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
diff --git a/Source/core/rendering/RenderThemeChromiumMac.mm b/Source/core/rendering/RenderThemeChromiumMac.mm
index 38f3e24..82a723f 100644
--- a/Source/core/rendering/RenderThemeChromiumMac.mm
+++ b/Source/core/rendering/RenderThemeChromiumMac.mm
@@ -504,11 +504,10 @@
     return color;
 }
 
-bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const BorderData& border,
-                                     const FillLayer& background, const Color& backgroundColor) const
+bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const CachedUAStyle& uaStyle) const
 {
     if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart)
-        return style->border() != border || style->boxShadow();
+        return style->border() != uaStyle.border || style->boxShadow();
 
     // FIXME: This is horrible, but there is not much else that can be done.  Menu lists cannot draw properly when
     // scaled.  They can't really draw properly when transformed either.  We can't detect the transform case at style
@@ -520,7 +519,7 @@
     if (style->appearance() == SearchFieldPart && style->effectiveZoom() != 1)
         return true;
 
-    return RenderTheme::isControlStyled(style, border, background, backgroundColor);
+    return RenderTheme::isControlStyled(style, uaStyle);
 }
 
 const int sliderThumbShadowBlur = 1;
@@ -1963,11 +1962,6 @@
     return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
 }
 
-String RenderThemeChromiumMac::extraMediaControlsStyleSheet()
-{
-    return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet));
-}
-
 String RenderThemeChromiumMac::extraFullScreenStyleSheet()
 {
     // FIXME: Chromium may wish to style its default media controls differently in fullscreen.
diff --git a/Source/core/rendering/RenderThemeChromiumSkia.cpp b/Source/core/rendering/RenderThemeChromiumSkia.cpp
index ff22164..9163e78 100644
--- a/Source/core/rendering/RenderThemeChromiumSkia.cpp
+++ b/Source/core/rendering/RenderThemeChromiumSkia.cpp
@@ -80,11 +80,6 @@
     return String(themeWinQuirksUserAgentStyleSheet, sizeof(themeWinQuirksUserAgentStyleSheet));
 }
 
-String RenderThemeChromiumSkia::extraMediaControlsStyleSheet()
-{
-    return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet));
-}
-
 bool RenderThemeChromiumSkia::supportsHover(const RenderStyle* style) const
 {
     return true;
diff --git a/Source/core/rendering/RenderThemeChromiumSkia.h b/Source/core/rendering/RenderThemeChromiumSkia.h
index 95bd2dd..f3550c7 100644
--- a/Source/core/rendering/RenderThemeChromiumSkia.h
+++ b/Source/core/rendering/RenderThemeChromiumSkia.h
@@ -41,7 +41,6 @@
 
     virtual String extraDefaultStyleSheet();
     virtual String extraQuirksStyleSheet();
-    virtual String extraMediaControlsStyleSheet();
 
     virtual Color platformTapHighlightColor() const OVERRIDE
     {
diff --git a/Source/core/rendering/RenderVideo.cpp b/Source/core/rendering/RenderVideo.cpp
index 61ce56c..6c604cf 100644
--- a/Source/core/rendering/RenderVideo.cpp
+++ b/Source/core/rendering/RenderVideo.cpp
@@ -216,11 +216,11 @@
     RenderMedia::layout();
     updatePlayer();
 }
-    
+
 HTMLVideoElement* RenderVideo::videoElement() const
 {
-    ASSERT(node()->hasTagName(videoTag));
-    return static_cast<HTMLVideoElement*>(node()); 
+    ASSERT(isHTMLVideoElement(node()));
+    return toHTMLVideoElement(node());
 }
 
 void RenderVideo::updateFromElement()
diff --git a/Source/core/rendering/TextAutosizer.cpp b/Source/core/rendering/TextAutosizer.cpp
index 04e4956..d14ba17 100644
--- a/Source/core/rendering/TextAutosizer.cpp
+++ b/Source/core/rendering/TextAutosizer.cpp
@@ -461,7 +461,7 @@
 
     while (renderer) {
         if (!isAutosizingContainer(renderer)) {
-            if (renderer->isText() && toRenderText(renderer)->text()->stripWhiteSpace()->length() > 3)
+            if (renderer->isText() && toRenderText(renderer)->text().impl()->stripWhiteSpace()->length() > 3)
                 return false;
             if (!renderer->isInline())
                 return false;
diff --git a/Source/core/rendering/shapes/Shape.cpp b/Source/core/rendering/shapes/Shape.cpp
index 11fec13..60d003b 100644
--- a/Source/core/rendering/shapes/Shape.cpp
+++ b/Source/core/rendering/shapes/Shape.cpp
@@ -89,6 +89,17 @@
     return size.transposedSize();
 }
 
+static inline void ensureRadiiDoNotOverlap(FloatRect &bounds, FloatSize &radii)
+{
+    float widthRatio = bounds.width() / (2 * radii.width());
+    float heightRatio = bounds.height() / (2 * radii.height());
+    float reductionRatio = std::min<float>(widthRatio, heightRatio);
+    if (reductionRatio < 1) {
+        radii.setWidth(reductionRatio * radii.width());
+        radii.setHeight(reductionRatio * radii.height());
+    }
+}
+
 PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, Length margin, Length padding)
 {
     ASSERT(basicShape);
@@ -107,11 +118,10 @@
             floatValueForLength(rectangle->y(), boxHeight),
             floatValueForLength(rectangle->width(), boxWidth),
             floatValueForLength(rectangle->height(), boxHeight));
-        Length radiusXLength = rectangle->cornerRadiusX();
-        Length radiusYLength = rectangle->cornerRadiusY();
         FloatSize cornerRadii(
-            radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth),
-            radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight));
+            floatValueForLength(rectangle->cornerRadiusX(), boxWidth),
+            floatValueForLength(rectangle->cornerRadiusY(), boxHeight));
+        ensureRadiiDoNotOverlap(bounds, cornerRadii);
         FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.height(), writingMode);
 
         shape = createRectangleShape(logicalBounds, physicalSizeToLogical(cornerRadii, writingMode));
@@ -158,6 +168,25 @@
         break;
     }
 
+    case BasicShape::BasicShapeInsetRectangleType: {
+        const BasicShapeInsetRectangle* rectangle = static_cast<const BasicShapeInsetRectangle*>(basicShape);
+        float left = floatValueForLength(rectangle->left(), boxWidth);
+        float top = floatValueForLength(rectangle->top(), boxHeight);
+        FloatRect bounds(
+            left,
+            top,
+            boxWidth - left - floatValueForLength(rectangle->right(), boxWidth),
+            boxHeight - top - floatValueForLength(rectangle->bottom(), boxHeight));
+        FloatSize cornerRadii(
+            floatValueForLength(rectangle->cornerRadiusX(), boxWidth),
+            floatValueForLength(rectangle->cornerRadiusY(), boxHeight));
+        ensureRadiiDoNotOverlap(bounds, cornerRadii);
+        FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.height(), writingMode);
+
+        shape = createRectangleShape(logicalBounds, physicalSizeToLogical(cornerRadii, writingMode));
+        break;
+    }
+
     default:
         ASSERT_NOT_REACHED();
     }
diff --git a/Source/core/rendering/shapes/ShapeInfo.h b/Source/core/rendering/shapes/ShapeInfo.h
index 3812d10..2f2053f 100644
--- a/Source/core/rendering/shapes/ShapeInfo.h
+++ b/Source/core/rendering/shapes/ShapeInfo.h
@@ -113,12 +113,13 @@
     LayoutUnit m_lineHeight;
     SegmentList m_segments;
 
+    const RenderType* m_renderer;
+
 private:
     mutable OwnPtr<Shape> m_shape;
 
     LayoutUnit m_shapeLogicalWidth;
     LayoutUnit m_shapeLogicalHeight;
-    const RenderType* m_renderer;
 };
 }
 #endif
diff --git a/Source/core/rendering/shapes/ShapeOutsideInfo.cpp b/Source/core/rendering/shapes/ShapeOutsideInfo.cpp
index d209a5e..a3a004e 100644
--- a/Source/core/rendering/shapes/ShapeOutsideInfo.cpp
+++ b/Source/core/rendering/shapes/ShapeOutsideInfo.cpp
@@ -36,22 +36,18 @@
 bool ShapeOutsideInfo::isEnabledFor(const RenderBox* box)
 {
     ShapeValue* value = box->style()->shapeOutside();
-    if (!box->isFloatingWithShapeOutside() || value->type() != ShapeValue::Shape)
-        return false;
-
-    BasicShape* shape = value->shape();
-    return shape && shape->type() != BasicShape::BasicShapeInsetRectangleType;
+    return box->isFloatingWithShapeOutside() && value->type() == ShapeValue::Shape && value->shape();
 }
 
 bool ShapeOutsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight)
 {
     if (shapeSizeDirty() || m_lineTop != lineTop || m_lineHeight != lineHeight) {
         if (ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExcludedIntervals>::computeSegmentsForLine(lineTop, lineHeight)) {
-            m_leftSegmentShapeBoundingBoxDelta = m_segments[0].logicalLeft - shapeLogicalLeft();
-            m_rightSegmentShapeBoundingBoxDelta = m_segments[m_segments.size()-1].logicalRight - shapeLogicalRight();
+            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_leftSegmentShapeBoundingBoxDelta = 0;
-            m_rightSegmentShapeBoundingBoxDelta = 0;
+            m_leftSegmentMarginBoxDelta = m_renderer->logicalWidth() + m_renderer->marginStart();
+            m_rightSegmentMarginBoxDelta = -m_renderer->logicalWidth() - m_renderer->marginEnd();
         }
         m_lineTop = lineTop;
     }
diff --git a/Source/core/rendering/shapes/ShapeOutsideInfo.h b/Source/core/rendering/shapes/ShapeOutsideInfo.h
index 5e8de8b..9bc3dcc 100644
--- a/Source/core/rendering/shapes/ShapeOutsideInfo.h
+++ b/Source/core/rendering/shapes/ShapeOutsideInfo.h
@@ -39,10 +39,8 @@
 
 class ShapeOutsideInfo : public ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExcludedIntervals>, public MappedInfo<RenderBox, ShapeOutsideInfo> {
 public:
-    LayoutSize shapeLogicalOffset() const { return LayoutSize(shapeLogicalLeft(), shapeLogicalTop()); }
-
-    LayoutUnit leftSegmentShapeBoundingBoxDelta() const { return m_leftSegmentShapeBoundingBoxDelta; }
-    LayoutUnit rightSegmentShapeBoundingBoxDelta() const { return m_rightSegmentShapeBoundingBoxDelta; }
+    LayoutUnit leftSegmentMarginBoxDelta() const { return m_leftSegmentMarginBoxDelta; }
+    LayoutUnit rightSegmentMarginBoxDelta() const { return m_rightSegmentMarginBoxDelta; }
 
     virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE;
 
@@ -55,8 +53,8 @@
 private:
     ShapeOutsideInfo(const RenderBox* renderer) : ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExcludedIntervals>(renderer) { }
 
-    LayoutUnit m_leftSegmentShapeBoundingBoxDelta;
-    LayoutUnit m_rightSegmentShapeBoundingBoxDelta;
+    LayoutUnit m_leftSegmentMarginBoxDelta;
+    LayoutUnit m_rightSegmentMarginBoxDelta;
     LayoutUnit m_lineTop;
 };
 
diff --git a/Source/core/rendering/style/BasicShapes.cpp b/Source/core/rendering/style/BasicShapes.cpp
index 31173e8..1f3ce3e 100644
--- a/Source/core/rendering/style/BasicShapes.cpp
+++ b/Source/core/rendering/style/BasicShapes.cpp
@@ -61,8 +61,8 @@
             floatValueForLength(m_height, boundingBox.height())
         ),
         FloatSize(
-            m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width()),
-            m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height())
+            floatValueForLength(m_cornerRadiusX, boundingBox.width()),
+            floatValueForLength(m_cornerRadiusY, boundingBox.height())
         )
     );
 }
@@ -77,10 +77,8 @@
     result->setY(m_y.blend(o->y(), progress));
     result->setWidth(m_width.blend(o->width(), progress));
     result->setHeight(m_height.blend(o->height(), progress));
-    if (!m_cornerRadiusX.isUndefined() && !o->cornerRadiusX().isUndefined())
-        result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
-    if (!m_cornerRadiusY.isUndefined() && !o->cornerRadiusY().isUndefined())
-        result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
+    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
+    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
     return result.release();
 }
 
@@ -193,8 +191,8 @@
             std::max<float>(boundingBox.height() - top - floatValueForLength(m_bottom, boundingBox.height()), 0)
         ),
         FloatSize(
-            m_cornerRadiusX.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusX, boundingBox.width()),
-            m_cornerRadiusY.isUndefined() ? 0 : floatValueForLength(m_cornerRadiusY, boundingBox.height())
+            floatValueForLength(m_cornerRadiusX, boundingBox.width()),
+            floatValueForLength(m_cornerRadiusY, boundingBox.height())
         )
     );
 }
@@ -209,10 +207,8 @@
     result->setRight(m_right.blend(o->right(), progress));
     result->setBottom(m_bottom.blend(o->bottom(), progress));
     result->setLeft(m_left.blend(o->left(), progress));
-    if (!m_cornerRadiusX.isUndefined() && !o->cornerRadiusX().isUndefined())
-        result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
-    if (!m_cornerRadiusY.isUndefined() && !o->cornerRadiusY().isUndefined())
-        result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
+    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
+    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
     return result.release();
 }
 }
diff --git a/Source/core/rendering/style/BasicShapes.h b/Source/core/rendering/style/BasicShapes.h
index 00db38d..0f69c52 100644
--- a/Source/core/rendering/style/BasicShapes.h
+++ b/Source/core/rendering/style/BasicShapes.h
@@ -79,18 +79,23 @@
     void setY(Length y) { m_y = y; }
     void setWidth(Length width) { m_width = width; }
     void setHeight(Length height) { m_height = height; }
-    void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; }
-    void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; }
+    void setCornerRadiusX(Length radiusX)
+    {
+        ASSERT(!radiusX.isUndefined());
+        m_cornerRadiusX = radiusX;
+    }
+    void setCornerRadiusY(Length radiusY)
+    {
+        ASSERT(!radiusY.isUndefined());
+        m_cornerRadiusY = radiusY;
+    }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
 
     virtual Type type() const { return BasicShapeRectangleType; }
 private:
-    BasicShapeRectangle()
-        : m_cornerRadiusX(Undefined)
-        , m_cornerRadiusY(Undefined)
-    { }
+    BasicShapeRectangle() { }
 
     Length m_y;
     Length m_x;
@@ -192,18 +197,23 @@
     void setRight(Length right) { m_right = right; }
     void setBottom(Length bottom) { m_bottom = bottom; }
     void setLeft(Length left) { m_left = left; }
-    void setCornerRadiusX(Length radiusX) { m_cornerRadiusX = radiusX; }
-    void setCornerRadiusY(Length radiusY) { m_cornerRadiusY = radiusY; }
+    void setCornerRadiusX(Length radiusX)
+    {
+        ASSERT(!radiusX.isUndefined());
+        m_cornerRadiusX = radiusX;
+    }
+    void setCornerRadiusY(Length radiusY)
+    {
+        ASSERT(!radiusY.isUndefined());
+        m_cornerRadiusY = radiusY;
+    }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
 
     virtual Type type() const { return BasicShapeInsetRectangleType; }
 private:
-    BasicShapeInsetRectangle()
-        : m_cornerRadiusX(Undefined)
-        , m_cornerRadiusY(Undefined)
-    { }
+    BasicShapeInsetRectangle() { }
 
     Length m_right;
     Length m_top;
diff --git a/Source/core/rendering/style/CachedUAStyle.h b/Source/core/rendering/style/CachedUAStyle.h
new file mode 100644
index 0000000..f56d66f
--- /dev/null
+++ b/Source/core/rendering/style/CachedUAStyle.h
@@ -0,0 +1,63 @@
+ /*
+ * Copyright (C) 2013 Google, Inc.
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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 CachedUAStyle_h
+#define CachedUAStyle_h
+
+#include "core/rendering/style/RenderStyle.h"
+
+namespace WebCore {
+
+// RenderTheme::adjustStyle wants the background and borders
+// as specified by the UA sheets, excluding any author rules.
+// We use this class to cache those values during
+// applyMatchedProperties for later use during adjustRenderStyle.
+class CachedUAStyle {
+public:
+    CachedUAStyle()
+        : hasAppearance(false)
+        , backgroundLayers(BackgroundFillLayer)
+    { }
+
+    explicit CachedUAStyle(const RenderStyle* style)
+        : hasAppearance(style->hasAppearance())
+        , backgroundLayers(BackgroundFillLayer)
+    {
+        // RenderTheme::adjustStyle is the only consumer of this data.
+        // It only cares about the styles if appearance is set,
+        // so we cheat and don't bother to copy them when !hasAppearance.
+        if (!hasAppearance)
+            return;
+        border = style->border();
+        backgroundLayers = *style->backgroundLayers();
+        backgroundColor = style->backgroundColor();
+    }
+
+    bool hasAppearance;
+    BorderData border;
+    FillLayer backgroundLayers;
+    Color backgroundColor;
+};
+
+
+} // namespace WebCore
+
+#endif // CachedUAStyle_h
diff --git a/Source/core/rendering/style/GridPosition.h b/Source/core/rendering/style/GridPosition.h
index 7b409f7..b72cce0 100644
--- a/Source/core/rendering/style/GridPosition.h
+++ b/Source/core/rendering/style/GridPosition.h
@@ -92,7 +92,7 @@
 
     bool operator==(const GridPosition& other) const
     {
-        return m_type == other.m_type && m_integerPosition == other.m_integerPosition;
+        return m_type == other.m_type && m_integerPosition == other.m_integerPosition && m_namedGridLine == other.m_namedGridLine;
     }
 
     bool shouldBeResolvedAgainstOppositePosition() const
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index f8a4e32..1ffb016 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -188,6 +188,7 @@
     noninherited_flags._page_break_after = other->noninherited_flags._page_break_after;
     noninherited_flags._page_break_inside = other->noninherited_flags._page_break_inside;
     noninherited_flags.explicitInheritance = other->noninherited_flags.explicitInheritance;
+    noninherited_flags.currentColor = other->noninherited_flags.currentColor;
     if (m_svgStyle != other->m_svgStyle)
         m_svgStyle.access()->copyNonInheritedFrom(other->m_svgStyle.get());
     ASSERT(zoom() == initialZoom());
@@ -434,7 +435,6 @@
         if (rareInheritedData->highlight != other->rareInheritedData->highlight
             || rareInheritedData->indent != other->rareInheritedData->indent
 #if ENABLE(CSS3_TEXT)
-            || rareInheritedData->m_textAlignLast != other->rareInheritedData->m_textAlignLast
             || rareInheritedData->m_textIndentLine != other->rareInheritedData->m_textIndentLine
 #endif
             || rareInheritedData->m_effectiveZoom != other->rareInheritedData->m_effectiveZoom
@@ -451,6 +451,7 @@
             || rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark
             || rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition
             || rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark
+            || rareInheritedData->m_textAlignLast != other->rareInheritedData->m_textAlignLast
             || rareInheritedData->m_textOrientation != other->rareInheritedData->m_textOrientation
             || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
             || rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
@@ -1153,8 +1154,8 @@
 float RenderStyle::computedFontSize() const { return fontDescription().computedSize(); }
 int RenderStyle::fontSize() const { return inherited->font.pixelSize(); }
 
-int RenderStyle::wordSpacing() const { return inherited->font.wordSpacing(); }
-int RenderStyle::letterSpacing() const { return inherited->font.letterSpacing(); }
+float RenderStyle::wordSpacing() const { return inherited->font.wordSpacing(); }
+float RenderStyle::letterSpacing() const { return inherited->font.letterSpacing(); }
 
 bool RenderStyle::setFontDescription(const FontDescription& v)
 {
@@ -1198,8 +1199,8 @@
     return lh.value();
 }
 
-void RenderStyle::setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
-void RenderStyle::setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
+void RenderStyle::setWordSpacing(float v) { inherited.access()->font.setWordSpacing(v); }
+void RenderStyle::setLetterSpacing(float v) { inherited.access()->font.setLetterSpacing(v); }
 
 void RenderStyle::setFontSize(float size)
 {
diff --git a/Source/core/rendering/style/RenderStyle.h b/Source/core/rendering/style/RenderStyle.h
index c31dfcf..87f1823 100644
--- a/Source/core/rendering/style/RenderStyle.h
+++ b/Source/core/rendering/style/RenderStyle.h
@@ -69,11 +69,11 @@
 #include "core/rendering/style/StyleTransformData.h"
 #include "core/rendering/style/StyleVisualData.h"
 #include "core/svg/SVGPaint.h"
-#include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/Vector.h"
 
 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
 
@@ -117,8 +117,10 @@
     friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
     friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors.  Rebaselining would allow this to be yanked.
     friend class StyleBuilderFunctions; // Sets color styles
+    friend class StyleBuilder; // FIXME: Revove this! StyleBuilder::oldApplyProperty reads color().
     friend class StyleResolver; // Sets members directly.
-    friend class StyleResolverState; // Sets members directly.
+    friend class StyleResolverState; // Needs to read color() to compute currentColor.
+    friend class CachedUAStyle; // Saves Border/Background information for later comparison.
 protected:
 
     // non-inherited attributes
@@ -215,6 +217,7 @@
                 && _pseudoBits == other._pseudoBits
                 && _unicodeBidi == other._unicodeBidi
                 && explicitInheritance == other.explicitInheritance
+                && currentColor == other.currentColor
                 && unique == other.unique
                 && emptyState == other.emptyState
                 && firstChildState == other.firstChildState
@@ -241,8 +244,9 @@
         unsigned _page_break_inside : 2; // EPageBreak
 
         unsigned _styleType : 6; // PseudoId
-        unsigned _pseudoBits : 7;
+        unsigned _pseudoBits : 8;
         unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property
+        unsigned currentColor : 1; // At least one color has the value 'currentColor'
         unsigned unique : 1; // Style can not be shared.
         unsigned emptyState : 1;
         unsigned firstChildState : 1;
@@ -262,7 +266,7 @@
         unsigned _affectedByDrag : 1;
         unsigned _isLink : 1;
         // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom()
-        // 59 bits
+        // 61 bits
     } noninherited_flags;
 
 // !END SYNC!
@@ -304,6 +308,7 @@
         noninherited_flags._styleType = NOPSEUDO;
         noninherited_flags._pseudoBits = 0;
         noninherited_flags.explicitInheritance = false;
+        noninherited_flags.currentColor = false;
         noninherited_flags.unique = false;
         noninherited_flags.emptyState = false;
         noninherited_flags.firstChildState = false;
@@ -433,12 +438,6 @@
     EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
     bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
     bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; }
-    bool hasPaintOffset() const
-    {
-        bool paintOffset = hasInFlowPosition();
-        paintOffset = paintOffset || (isFloating() && shapeOutside());
-        return paintOffset;
-    }
     bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
     EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
 
@@ -541,16 +540,16 @@
     TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
 #endif
     ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
+    TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
     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); }
 #if ENABLE(CSS3_TEXT)
-    TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
     TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
 #endif // CSS3_TEXT
     TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
-    int wordSpacing() const;
-    int letterSpacing() const;
+    float wordSpacing() const;
+    float letterSpacing() const;
 
     float zoom() const { return visual->m_zoom; }
     float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
@@ -862,7 +861,6 @@
     CSSAnimationDataList* accessTransitions();
 
     bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
-    bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
 
     // return the first found Animation (including 'all' transitions)
     const CSSAnimationData* transitionForProperty(CSSPropertyID) const;
@@ -1049,12 +1047,12 @@
     void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
 #endif
     void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
+    void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, 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; }
     void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); }
 #if ENABLE(CSS3_TEXT)
-    void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
     void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
 #endif // CSS3_TEXT
     void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
@@ -1068,8 +1066,8 @@
 
     void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
 
-    void setWordSpacing(int);
-    void setLetterSpacing(int);
+    void setWordSpacing(float);
+    void setLetterSpacing(float);
 
     void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
     void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
@@ -1291,8 +1289,6 @@
         rareNonInheritedData.access()->m_transitions.clear();
     }
 
-    void inheritAnimations(const CSSAnimationDataList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new CSSAnimationDataList(*parent)) : nullptr; }
-    void inheritTransitions(const CSSAnimationDataList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new CSSAnimationDataList(*parent)) : nullptr; }
     void adjustAnimations();
     void adjustTransitions();
 
@@ -1450,6 +1446,9 @@
     void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; }
     bool hasExplicitlyInheritedProperties() const { return noninherited_flags.explicitInheritance; }
 
+    void setHasCurrentColor() { noninherited_flags.currentColor = true; }
+    bool hasCurrentColor() const { return noninherited_flags.currentColor; }
+
     void reportMemoryUsage(MemoryObjectInfo*) const;
     
     // Initial values for all the properties
@@ -1488,7 +1487,7 @@
     static unsigned initialBorderWidth() { return 3; }
     static unsigned short initialColumnRuleWidth() { return 3; }
     static unsigned short initialOutlineWidth() { return 3; }
-    static int initialLetterWordSpacing() { return 0; }
+    static float initialLetterWordSpacing() { return 0.0f; }
     static Length initialSize() { return Length(); }
     static Length initialMinSize() { return Length(Fixed); }
     static Length initialMaxSize() { return Length(Undefined); }
@@ -1504,9 +1503,9 @@
     static short initialOrphans() { return 2; }
     static Length initialLineHeight() { return Length(-100.0, Percent); }
     static ETextAlign initialTextAlign() { return TASTART; }
+    static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
     static TextDecoration initialTextDecoration() { return TextDecorationNone; }
 #if ENABLE(CSS3_TEXT)
-    static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
     static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
 #endif // CSS3_TEXT
     static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
@@ -1625,7 +1624,10 @@
     static WrapFlow initialWrapFlow() { return WrapFlowAuto; }
     static WrapThrough initialWrapThrough() { return WrapThroughWrap; }
 
+    static QuotesData* initialQuotes() { return 0; }
+
     // Keep these at the end.
+    // FIXME: Why? Seems these should all be one big sorted list.
     static LineClampValue initialLineClamp() { return LineClampValue(); }
     static ETextSecurity initialTextSecurity() { return TSNONE; }
     static Color initialTapHighlightColor();
diff --git a/Source/core/rendering/style/RenderStyleConstants.h b/Source/core/rendering/style/RenderStyleConstants.h
index 7dd5c70..52f8182 100644
--- a/Source/core/rendering/style/RenderStyleConstants.h
+++ b/Source/core/rendering/style/RenderStyleConstants.h
@@ -70,7 +70,8 @@
 // Static pseudo styles. Dynamic ones are produced on the fly.
 enum PseudoId {
     // The order must be NOP ID, public IDs, and then internal IDs.
-    NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
+    // If you add or remove a public ID, you must update _pseudoBits in RenderStyle.
+    NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, BACKDROP, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
     // Internal IDs follow:
     SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
     INPUT_LIST_BUTTON,
@@ -352,11 +353,11 @@
     TextDecorationStyleWavy
 };
 
-#if ENABLE(CSS3_TEXT)
 enum TextAlignLast {
     TextAlignLastAuto, TextAlignLastStart, TextAlignLastEnd, TextAlignLastLeft, TextAlignLastRight, TextAlignLastCenter, TextAlignLastJustify
 };
 
+#if ENABLE(CSS3_TEXT)
 enum TextUnderlinePosition {
     // FIXME: Implement support for 'under left' and 'under right' values.
     TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4
diff --git a/Source/core/rendering/style/SVGRenderStyleDefs.cpp b/Source/core/rendering/style/SVGRenderStyleDefs.cpp
index 5a76766..d9a7208 100644
--- a/Source/core/rendering/style/SVGRenderStyleDefs.cpp
+++ b/Source/core/rendering/style/SVGRenderStyleDefs.cpp
@@ -179,7 +179,7 @@
 
 StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other)
     : RefCounted<StyleShadowSVGData>()
-    , shadow(other.shadow ? adoptPtr(new ShadowData(*other.shadow)) : nullptr)
+    , shadow(cloneShadow(other.shadow.get()))
 {
 }
 
diff --git a/Source/core/rendering/style/ShadowData.h b/Source/core/rendering/style/ShadowData.h
index facb296..9c98c08 100644
--- a/Source/core/rendering/style/ShadowData.h
+++ b/Source/core/rendering/style/ShadowData.h
@@ -36,33 +36,22 @@
 enum ShadowStyle { Normal, Inset };
 
 // This class holds information about shadows for the text-shadow and box-shadow properties.
-
 class ShadowData {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    ShadowData()
-        : m_blur(0)
-        , m_spread(0)
-        , m_style(Normal)
+    static PassOwnPtr<ShadowData> create() { return adoptPtr(new ShadowData); }
+    static PassOwnPtr<ShadowData> create(const IntPoint& location, int blur, int spread, ShadowStyle style, const Color& color)
     {
+        return adoptPtr(new ShadowData(location, blur, spread, style, color));
+    }
+    // This clones the whole ShadowData linked list.
+    PassOwnPtr<ShadowData> clone() const
+    {
+        return adoptPtr(new ShadowData(*this));
     }
 
-    ShadowData(const IntPoint& location, int blur, int spread, ShadowStyle style, const Color& color)
-        : m_location(location)
-        , m_blur(blur)
-        , m_spread(spread)
-        , m_color(color)
-        , m_style(style)
-    {
-    }
-
-    ShadowData(const ShadowData& o);
-
-    bool operator==(const ShadowData& o) const;
-    bool operator!=(const ShadowData& o) const
-    {
-        return !(*this == o);
-    }
+    bool operator==(const ShadowData&) const;
+    bool operator!=(const ShadowData& o) const { return !(*this == o); }
     
     int x() const { return m_location.x(); }
     int y() const { return m_location.y(); }
@@ -79,6 +68,24 @@
     void adjustRectForShadow(FloatRect&, int additionalOutlineSize = 0) const;
 
 private:
+    ShadowData()
+        : m_blur(0)
+        , m_spread(0)
+        , m_style(Normal)
+    {
+    }
+
+    ShadowData(const IntPoint& location, int blur, int spread, ShadowStyle style, const Color& color)
+        : m_location(location)
+        , m_blur(blur)
+        , m_spread(spread)
+        , m_color(color)
+        , m_style(style)
+    {
+    }
+
+    ShadowData(const ShadowData&);
+
     IntPoint m_location;
     int m_blur;
     int m_spread;
@@ -87,6 +94,17 @@
     OwnPtr<ShadowData> m_next;
 };
 
+// Helper method to handle nullptr, otherwise all callers need an ugly ternary.
+inline PassOwnPtr<ShadowData> cloneShadow(const ShadowData* shadow)
+{
+    return shadow ? shadow->clone() : nullptr;
+}
+
+inline PassOwnPtr<ShadowData> cloneShadow(const OwnPtr<ShadowData>& shadow)
+{
+    return cloneShadow(shadow.get());
+}
+
 } // namespace WebCore
 
 #endif // ShadowData_h
diff --git a/Source/core/rendering/style/StyleRareInheritedData.cpp b/Source/core/rendering/style/StyleRareInheritedData.cpp
index 8b9eb66..90043c3 100644
--- a/Source/core/rendering/style/StyleRareInheritedData.cpp
+++ b/Source/core/rendering/style/StyleRareInheritedData.cpp
@@ -76,6 +76,7 @@
     , textEmphasisFill(TextEmphasisFillFilled)
     , textEmphasisMark(TextEmphasisMarkNone)
     , textEmphasisPosition(TextEmphasisPositionOver)
+    , m_textAlignLast(RenderStyle::initialTextAlignLast())
     , m_textOrientation(TextOrientationVerticalRight)
 #if ENABLE(CSS3_TEXT)
     , m_textIndentLine(RenderStyle::initialTextIndentLine())
@@ -85,7 +86,6 @@
     , m_lineSnap(RenderStyle::initialLineSnap())
     , m_lineAlign(RenderStyle::initialLineAlign())
 #if ENABLE(CSS3_TEXT)
-    , m_textAlignLast(RenderStyle::initialTextAlignLast())
     , m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition())
 #endif // CSS3_TEXT
     , m_rubyPosition(RenderStyle::initialRubyPosition())
@@ -109,7 +109,7 @@
     , visitedLinkTextStrokeColor(o.visitedLinkTextStrokeColor)
     , visitedLinkTextFillColor(o.visitedLinkTextFillColor)
     , visitedLinkTextEmphasisColor(o.visitedLinkTextEmphasisColor)
-    , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : nullptr)
+    , textShadow(cloneShadow(o.textShadow))
     , highlight(o.highlight)
     , cursorData(o.cursorData)
     , indent(o.indent)
@@ -130,6 +130,7 @@
     , textEmphasisFill(o.textEmphasisFill)
     , textEmphasisMark(o.textEmphasisMark)
     , textEmphasisPosition(o.textEmphasisPosition)
+    , m_textAlignLast(o.m_textAlignLast)
     , m_textOrientation(o.m_textOrientation)
 #if ENABLE(CSS3_TEXT)
     , m_textIndentLine(o.m_textIndentLine)
@@ -139,7 +140,6 @@
     , m_lineSnap(o.m_lineSnap)
     , m_lineAlign(o.m_lineAlign)
 #if ENABLE(CSS3_TEXT)
-    , m_textAlignLast(o.m_textAlignLast)
     , m_textUnderlinePosition(o.m_textUnderlinePosition)
 #endif // CSS3_TEXT
     , m_rubyPosition(o.m_rubyPosition)
@@ -203,6 +203,7 @@
         && textEmphasisFill == o.textEmphasisFill
         && textEmphasisMark == o.textEmphasisMark
         && textEmphasisPosition == o.textEmphasisPosition
+        && m_textAlignLast == o.m_textAlignLast
         && m_textOrientation == o.m_textOrientation
 #if ENABLE(CSS3_TEXT)
         && m_textIndentLine == o.m_textIndentLine
@@ -216,7 +217,6 @@
         && m_lineGrid == o.m_lineGrid
         && m_imageRendering == o.m_imageRendering
 #if ENABLE(CSS3_TEXT)
-        && m_textAlignLast == o.m_textAlignLast
         && m_textUnderlinePosition == o.m_textUnderlinePosition
 #endif // CSS3_TEXT
         && m_rubyPosition == o.m_rubyPosition
diff --git a/Source/core/rendering/style/StyleRareInheritedData.h b/Source/core/rendering/style/StyleRareInheritedData.h
index a55aa18..9c9a946 100644
--- a/Source/core/rendering/style/StyleRareInheritedData.h
+++ b/Source/core/rendering/style/StyleRareInheritedData.h
@@ -95,6 +95,7 @@
     unsigned textEmphasisFill : 1; // TextEmphasisFill
     unsigned textEmphasisMark : 3; // TextEmphasisMark
     unsigned textEmphasisPosition : 1; // TextEmphasisPosition
+    unsigned m_textAlignLast : 3; // TextAlignLast
     unsigned m_textOrientation : 2; // TextOrientation
 #if ENABLE(CSS3_TEXT)
     unsigned m_textIndentLine : 1; // TextIndentEachLine
@@ -105,7 +106,6 @@
     unsigned m_lineSnap : 2; // LineSnap
     unsigned m_lineAlign : 1; // LineAlign
 #if ENABLE(CSS3_TEXT)
-    unsigned m_textAlignLast : 3; // TextAlignLast
     unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition
 #endif // CSS3_TEXT
     unsigned m_rubyPosition : 1; // RubyPosition
diff --git a/Source/core/rendering/style/StyleRareNonInheritedData.cpp b/Source/core/rendering/style/StyleRareNonInheritedData.cpp
index f5a16f9..e4d640a 100644
--- a/Source/core/rendering/style/StyleRareNonInheritedData.cpp
+++ b/Source/core/rendering/style/StyleRareNonInheritedData.cpp
@@ -103,7 +103,7 @@
     , m_gridItem(o.m_gridItem)
     , m_content(o.m_content ? o.m_content->clone() : nullptr)
     , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
-    , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
+    , m_boxShadow(cloneShadow(o.m_boxShadow))
     , m_boxReflect(o.m_boxReflect)
     , m_animations(o.m_animations ? adoptPtr(new CSSAnimationDataList(*o.m_animations)) : nullptr)
     , m_transitions(o.m_transitions ? adoptPtr(new CSSAnimationDataList(*o.m_transitions)) : nullptr)
diff --git a/Source/core/rendering/svg/ReferenceFilterBuilder.cpp b/Source/core/rendering/svg/ReferenceFilterBuilder.cpp
new file mode 100644
index 0000000..b78922a
--- /dev/null
+++ b/Source/core/rendering/svg/ReferenceFilterBuilder.cpp
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2013 Adobe Systems Inc. All rights reserved.
+ * Copyright (C) 2013 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.
+ *
+ * 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/svg/ReferenceFilterBuilder.h"
+
+#include "SVGNames.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/dom/Element.h"
+#include "core/loader/cache/CachedDocument.h"
+#include "core/loader/cache/CachedSVGDocumentReference.h"
+#include "core/platform/graphics/filters/FilterEffect.h"
+#include "core/platform/graphics/filters/SourceAlpha.h"
+#include "core/rendering/svg/RenderSVGResourceFilter.h"
+#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
+#include "core/svg/graphics/filters/SVGFilterBuilder.h"
+
+namespace WebCore {
+
+// Returns whether or not the SVGStyledElement object contains a valid color-interpolation-filters attribute
+static bool getSVGStyledElementColorSpace(SVGStyledElement* svgStyledElement, ColorSpace& cs)
+{
+    if (!svgStyledElement)
+        return false;
+
+    const RenderObject* renderer = svgStyledElement->renderer();
+    const RenderStyle* style = renderer ? renderer->style() : 0;
+    const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
+    EColorInterpolation eColorInterpolation = CI_AUTO;
+    if (svgStyle) {
+        // If a layout has been performed, then we can use the fast path to get this attribute
+        eColorInterpolation = svgStyle->colorInterpolationFilters();
+    } else {
+        // Otherwise, use the slow path by using string comparison (used by external svg files)
+        RefPtr<CSSValue> cssValue = svgStyledElement->getPresentationAttribute(
+            SVGNames::color_interpolation_filtersAttr.toString());
+        if (cssValue.get() && cssValue->isPrimitiveValue()) {
+            const CSSPrimitiveValue& primitiveValue = *((CSSPrimitiveValue*)cssValue.get());
+            eColorInterpolation = (EColorInterpolation)primitiveValue;
+        } else {
+            return false;
+        }
+    }
+
+    switch (eColorInterpolation) {
+    case CI_AUTO:
+    case CI_SRGB:
+        cs = ColorSpaceDeviceRGB;
+        break;
+    case CI_LINEARRGB:
+        cs = ColorSpaceLinearRGB;
+        break;
+    default:
+        return false;
+    }
+
+    return true;
+}
+
+PassRefPtr<FilterEffect> ReferenceFilterBuilder::build(Filter* parentFilter, RenderObject* renderer, FilterEffect* previousEffect, const ReferenceFilterOperation* filterOperation)
+{
+    if (!renderer)
+        return 0;
+
+    Document* document = renderer->document();
+    ASSERT(document);
+
+    CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation->cachedSVGDocumentReference();
+    CachedDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : 0;
+
+    // If we have an SVG document, this is an external reference. Otherwise
+    // we look up the referenced node in the current document.
+    if (cachedSVGDocument)
+        document = cachedSVGDocument->document();
+
+    if (!document)
+        return 0;
+
+    Element* filter = document->getElementById(filterOperation->fragment());
+
+    if (!filter) {
+        // Although we did not find the referenced filter, it might exist later
+        // in the document
+        document->accessSVGExtensions()->addPendingResource(filterOperation->fragment(), toElement(renderer->node()));
+        return 0;
+    }
+
+    if (!filter->isSVGElement() || !filter->hasTagName(SVGNames::filterTag))
+        return 0;
+
+    SVGFilterElement* filterElement = toSVGFilterElement(toSVGElement(filter));
+
+    // FIXME: Figure out what to do with SourceAlpha. Right now, we're
+    // using the alpha of the original input layer, which is obviously
+    // wrong. We should probably be extracting the alpha from the
+    // previousEffect, but this requires some more processing.
+    // This may need a spec clarification.
+    RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(parentFilter));
+
+    ColorSpace filterColorSpace = ColorSpaceDeviceRGB;
+    bool useFilterColorSpace = getSVGStyledElementColorSpace(filterElement, filterColorSpace);
+
+    for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
+        if (!node->isSVGElement())
+            continue;
+
+        SVGElement* element = toSVGElement(node);
+        if (!element->isFilterEffect())
+            continue;
+
+        SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
+
+        RefPtr<FilterEffect> effect = effectElement->build(builder.get(), parentFilter);
+        if (!effect)
+            continue;
+
+        effectElement->setStandardAttributes(effect.get());
+        effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnitsCurrentValue(), parentFilter->sourceImageRect()));
+        ColorSpace colorSpace = filterColorSpace;
+        if (useFilterColorSpace || getSVGStyledElementColorSpace(effectElement, colorSpace))
+            effect->setOperatingColorSpace(colorSpace);
+        builder->add(effectElement->resultCurrentValue(), effect);
+    }
+    return builder->lastEffect();
+}
+
+} // namespace WebCore
diff --git a/Source/core/rendering/svg/ReferenceFilterBuilder.h b/Source/core/rendering/svg/ReferenceFilterBuilder.h
new file mode 100644
index 0000000..9cc113a
--- /dev/null
+++ b/Source/core/rendering/svg/ReferenceFilterBuilder.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 Adobe Systems Incorporated. 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 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 ReferenceFilterBuilder_h
+#define ReferenceFilterBuilder_h
+
+#include "core/platform/graphics/filters/FilterEffect.h"
+#include "wtf/PassRefPtr.h"
+
+namespace WebCore {
+
+class Filter;
+class FilterEffect;
+class ReferenceFilterOperation;
+class RenderObject;
+
+class ReferenceFilterBuilder {
+public:
+    static PassRefPtr<FilterEffect> build(Filter*, RenderObject* renderer, FilterEffect* previousEffect, const ReferenceFilterOperation*);
+};
+
+}
+
+#endif // ReferenceFilterBuilder_h
diff --git a/Source/core/rendering/svg/RenderSVGEllipse.cpp b/Source/core/rendering/svg/RenderSVGEllipse.cpp
index be5ea3f..3c559f6 100644
--- a/Source/core/rendering/svg/RenderSVGEllipse.cpp
+++ b/Source/core/rendering/svg/RenderSVGEllipse.cpp
@@ -81,9 +81,9 @@
         SVGCircleElement* circle = static_cast<SVGCircleElement*>(node());
 
         SVGLengthContext lengthContext(circle);
-        float radius = circle->r().value(lengthContext);
+        float radius = circle->rCurrentValue().value(lengthContext);
         m_radii = FloatSize(radius, radius);
-        m_center = FloatPoint(circle->cx().value(lengthContext), circle->cy().value(lengthContext));
+        m_center = FloatPoint(circle->cxCurrentValue().value(lengthContext), circle->cyCurrentValue().value(lengthContext));
         return;
     }
 
@@ -91,8 +91,8 @@
     SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(node());
 
     SVGLengthContext lengthContext(ellipse);
-    m_radii = FloatSize(ellipse->rx().value(lengthContext), ellipse->ry().value(lengthContext));
-    m_center = FloatPoint(ellipse->cx().value(lengthContext), ellipse->cy().value(lengthContext));
+    m_radii = FloatSize(ellipse->rxCurrentValue().value(lengthContext), ellipse->ryCurrentValue().value(lengthContext));
+    m_center = FloatPoint(ellipse->cxCurrentValue().value(lengthContext), ellipse->cyCurrentValue().value(lengthContext));
 }
 
 void RenderSVGEllipse::fillShape(GraphicsContext* context) const
diff --git a/Source/core/rendering/svg/RenderSVGForeignObject.cpp b/Source/core/rendering/svg/RenderSVGForeignObject.cpp
index e6a16c8..632e805 100644
--- a/Source/core/rendering/svg/RenderSVGForeignObject.cpp
+++ b/Source/core/rendering/svg/RenderSVGForeignObject.cpp
@@ -137,8 +137,8 @@
 
     // Cache viewport boundaries
     SVGLengthContext lengthContext(foreign);
-    FloatPoint viewportLocation(foreign->x().value(lengthContext), foreign->y().value(lengthContext));
-    m_viewport = FloatRect(viewportLocation, FloatSize(foreign->width().value(lengthContext), foreign->height().value(lengthContext)));
+    FloatPoint viewportLocation(foreign->xCurrentValue().value(lengthContext), foreign->yCurrentValue().value(lengthContext));
+    m_viewport = FloatRect(viewportLocation, FloatSize(foreign->widthCurrentValue().value(lengthContext), foreign->heightCurrentValue().value(lengthContext)));
     if (!updateCachedBoundariesInParents)
         updateCachedBoundariesInParents = oldViewport != m_viewport;
 
diff --git a/Source/core/rendering/svg/RenderSVGImage.cpp b/Source/core/rendering/svg/RenderSVGImage.cpp
index 5edf820..2d37048 100644
--- a/Source/core/rendering/svg/RenderSVGImage.cpp
+++ b/Source/core/rendering/svg/RenderSVGImage.cpp
@@ -57,17 +57,17 @@
 
 bool RenderSVGImage::updateImageViewport()
 {
-    SVGImageElement* image = static_cast<SVGImageElement*>(node());
+    SVGImageElement* image = toSVGImageElement(node());
     FloatRect oldBoundaries = m_objectBoundingBox;
     bool updatedViewport = false;
 
     SVGLengthContext lengthContext(image);
-    m_objectBoundingBox = FloatRect(image->x().value(lengthContext), image->y().value(lengthContext), image->width().value(lengthContext), image->height().value(lengthContext));
+    m_objectBoundingBox = FloatRect(image->xCurrentValue().value(lengthContext), image->yCurrentValue().value(lengthContext), image->widthCurrentValue().value(lengthContext), image->heightCurrentValue().value(lengthContext));
 
     // Images with preserveAspectRatio=none should force non-uniform scaling. This can be achieved
     // by setting the image's container size to its intrinsic size.
     // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRatio’ attribute.
-    if (image->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) {
+    if (image->preserveAspectRatioCurrentValue().align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) {
         if (CachedImage* cachedImage = m_imageResource->cachedImage()) {
             LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(0, style()->effectiveZoom());
             if (intrinsicSize != m_imageResource->imageSize(style()->effectiveZoom())) {
@@ -97,7 +97,7 @@
 
     bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundariesUpdate;
     if (m_needsTransformUpdate) {
-        m_localTransform = static_cast<SVGImageElement*>(node())->animatedLocalTransform();
+        m_localTransform = toSVGImageElement(node())->animatedLocalTransform();
         m_needsTransformUpdate = false;
     }
 
@@ -162,8 +162,8 @@
     FloatRect destRect = m_objectBoundingBox;
     FloatRect srcRect(0, 0, image->width(), image->height());
 
-    SVGImageElement* imageElement = static_cast<SVGImageElement*>(node());
-    imageElement->preserveAspectRatio().transformRect(destRect, srcRect);
+    SVGImageElement* imageElement = toSVGImageElement(node());
+    imageElement->preserveAspectRatioCurrentValue().transformRect(destRect, srcRect);
 
     bool useLowQualityScaling = false;
     if (style()->svgStyle()->bufferedRendering() != BR_STATIC)
diff --git a/Source/core/rendering/svg/RenderSVGInlineText.cpp b/Source/core/rendering/svg/RenderSVGInlineText.cpp
index 865e569..626bdc7 100644
--- a/Source/core/rendering/svg/RenderSVGInlineText.cpp
+++ b/Source/core/rendering/svg/RenderSVGInlineText.cpp
@@ -225,18 +225,21 @@
     StyleResolver* styleResolver = document->styleResolver();
     ASSERT(styleResolver);
 
-    // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified
+    // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified.
     scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFactor(renderer);
-    if (scalingFactor == 1 || !scalingFactor || style->fontDescription().textRenderingMode() == GeometricPrecision) {
+    if (scalingFactor == 1 || !scalingFactor) {
         scalingFactor = 1;
         scaledFont = style->font();
         return;
     }
 
+    if (style->fontDescription().textRenderingMode() == GeometricPrecision)
+        scalingFactor = 1;
+
     FontDescription fontDescription(style->fontDescription());
 
     // FIXME: We need to better handle the case when we compute very small fonts below (below 1pt).
-    fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.computedSize(), DoNotUseSmartMinimumForFontSize));
+    fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), DoNotUseSmartMinimumForFontSize));
 
     scaledFont = Font(fontDescription, 0, 0);
     scaledFont.update(styleResolver->fontSelector());
diff --git a/Source/core/rendering/svg/RenderSVGModelObject.cpp b/Source/core/rendering/svg/RenderSVGModelObject.cpp
index c69ccdf..2939781 100644
--- a/Source/core/rendering/svg/RenderSVGModelObject.cpp
+++ b/Source/core/rendering/svg/RenderSVGModelObject.cpp
@@ -170,7 +170,7 @@
     quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates())));
 }
     
-bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const FloatRect& rect)
+bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const SVGRect& rect)
 {
     if (!renderer || renderer->style()->pointerEvents() == PE_NONE)
         return false;
@@ -183,7 +183,7 @@
     return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->repaintRectInLocalCoordinates()));
 }
 
-bool RenderSVGModelObject::checkEnclosure(RenderObject* renderer, const FloatRect& rect)
+bool RenderSVGModelObject::checkEnclosure(RenderObject* renderer, const SVGRect& rect)
 {
     if (!renderer || renderer->style()->pointerEvents() == PE_NONE)
         return false;
diff --git a/Source/core/rendering/svg/RenderSVGModelObject.h b/Source/core/rendering/svg/RenderSVGModelObject.h
index 7653a4c..5c7515d 100644
--- a/Source/core/rendering/svg/RenderSVGModelObject.h
+++ b/Source/core/rendering/svg/RenderSVGModelObject.h
@@ -33,6 +33,7 @@
 
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/svg/SVGRenderSupport.h"
+#include "core/svg/SVGRect.h"
 
 namespace WebCore {
 
@@ -59,8 +60,8 @@
     virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle) OVERRIDE FINAL;
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
-    static bool checkIntersection(RenderObject*, const FloatRect&);
-    static bool checkEnclosure(RenderObject*, const FloatRect&);
+    static bool checkIntersection(RenderObject*, const SVGRect&);
+    static bool checkEnclosure(RenderObject*, const SVGRect&);
 
     virtual FloatRect repaintRectInLocalCoordinatesExcludingSVGShadow() const { return repaintRectInLocalCoordinates(); }
     bool hasSVGShadow() const { return m_hasSVGShadow; }
diff --git a/Source/core/rendering/svg/RenderSVGRect.cpp b/Source/core/rendering/svg/RenderSVGRect.cpp
index 2df1cf6..6ad7ff9 100644
--- a/Source/core/rendering/svg/RenderSVGRect.cpp
+++ b/Source/core/rendering/svg/RenderSVGRect.cpp
@@ -55,18 +55,18 @@
 
     SVGLengthContext lengthContext(rect);
     // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling stroke.
-    if (rect->rx().value(lengthContext) > 0 || rect->ry().value(lengthContext) > 0 || hasNonScalingStroke()) {
+    if (rect->rxCurrentValue().value(lengthContext) > 0 || rect->ryCurrentValue().value(lengthContext) > 0 || hasNonScalingStroke()) {
         RenderSVGShape::updateShapeFromElement();
         m_usePathFallback = true;
         return;
     }
 
     m_usePathFallback = false;
-    FloatSize boundingBoxSize(rect->width().value(lengthContext), rect->height().value(lengthContext));
+    FloatSize boundingBoxSize(rect->widthCurrentValue().value(lengthContext), rect->heightCurrentValue().value(lengthContext));
     if (boundingBoxSize.isEmpty())
         return;
 
-    m_fillBoundingBox = FloatRect(FloatPoint(rect->x().value(lengthContext), rect->y().value(lengthContext)), boundingBoxSize);
+    m_fillBoundingBox = FloatRect(FloatPoint(rect->xCurrentValue().value(lengthContext), rect->yCurrentValue().value(lengthContext)), boundingBoxSize);
 
     // To decide if the stroke contains a point we create two rects which represent the inner and
     // the outer stroke borders. A stroke contains the point, if the point is between them.
diff --git a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
index d9da9fb..c1978d6 100644
--- a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
@@ -88,11 +88,6 @@
     WindRule clipRule = RULE_NONZERO;
     Path clipPath = Path();
 
-    // If clip-path only contains one visible shape or path, we can use path-based clipping. Invisible
-    // shapes don't affect the clipping and can be ignored. If clip-path contains more than one
-    // visible shape, the additive clipping may not work, caused by the clipRule. EvenOdd
-    // as well as NonZero can cause self-clipping of the elements.
-    // See also http://www.w3.org/TR/SVG/painting.html#FillRuleProperty
     for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
         RenderObject* renderer = childNode->renderer();
         if (!renderer)
@@ -110,15 +105,24 @@
         // Current shape in clip-path gets clipped too. Fallback to masking.
         if (!svgStyle->clipperResource().isEmpty())
             return false;
-        // Fallback to masking, if there is more than one clipping path.
+
         if (clipPath.isEmpty()) {
+            // First clip shape.
             styled->toClipPath(clipPath);
             clipRule = svgStyle->clipRule();
-        } else
+            clipPath.setWindRule(clipRule);
+            continue;
+        }
+
+        // Attempt to generate a combined clip path, fall back to masking if not possible.
+        Path subPath;
+        styled->toClipPath(subPath);
+        subPath.setWindRule(svgStyle->clipRule());
+        if (!clipPath.unionPath(subPath))
             return false;
     }
     // Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary.
-    if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+    if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         AffineTransform transform;
         transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
         transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
@@ -200,7 +204,7 @@
 
     AffineTransform maskContentTransformation;
     SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node());
-    if (clipPath->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+    if (clipPath->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         maskContentTransformation.translate(objectBoundingBox.x(), objectBoundingBox.y());
         maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
         maskContext->concatCTM(maskContentTransformation);
@@ -278,7 +282,7 @@
         return false;
 
     SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node());
-    if (clipPathElement->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+    if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         AffineTransform transform;
         transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
         transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
@@ -311,7 +315,7 @@
     if (m_clipBoundaries.isEmpty())
         calculateClipContentRepaintRect();
 
-    if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+    if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         FloatRect objectBoundingBox = object->objectBoundingBox();
         AffineTransform transform;
         transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
diff --git a/Source/core/rendering/svg/RenderSVGResourceClipper.h b/Source/core/rendering/svg/RenderSVGResourceClipper.h
index 71c7780..b464f2b 100644
--- a/Source/core/rendering/svg/RenderSVGResourceClipper.h
+++ b/Source/core/rendering/svg/RenderSVGResourceClipper.h
@@ -52,7 +52,7 @@
     
     bool hitTestClipContent(const FloatRect&, const FloatPoint&);
 
-    SVGUnitTypes::SVGUnitType clipPathUnits() const { return static_cast<SVGClipPathElement*>(node())->clipPathUnits(); }
+    SVGUnitTypes::SVGUnitType clipPathUnits() const { return static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue(); }
 
     static RenderSVGResourceType s_resourceType;
 private:
diff --git a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
index 3c28875..9342e7b 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
@@ -29,6 +29,7 @@
 #include "core/page/Settings.h"
 #include "core/platform/graphics/filters/SourceAlpha.h"
 #include "core/platform/graphics/filters/SourceGraphic.h"
+#include "core/rendering/svg/RenderSVGResourceFilterPrimitive.h"
 #include "core/rendering/svg/SVGRenderingContext.h"
 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
 
@@ -78,7 +79,7 @@
 
 PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter* filter)
 {
-    SVGFilterElement* filterElement = static_cast<SVGFilterElement*>(node());
+    SVGFilterElement* filterElement = toSVGFilterElement(node());
     FloatRect targetBoundingBox = filter->targetBoundingBox();
 
     // Add effects to the builder
@@ -99,10 +100,10 @@
         }
         builder->appendEffectToEffectReferences(effect, effectElement->renderer());
         effectElement->setStandardAttributes(effect.get());
-        effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits(), targetBoundingBox));
+        effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnitsCurrentValue(), targetBoundingBox));
         effect->setOperatingColorSpace(
             effectElement->renderer()->style()->svgStyle()->colorInterpolationFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB);
-        builder->add(effectElement->result(), effect);
+        builder->add(effectElement->resultCurrentValue(), effect);
     }
     return builder.release();
 }
@@ -138,8 +139,8 @@
     OwnPtr<FilterData> filterData(adoptPtr(new FilterData));
     FloatRect targetBoundingBox = object->objectBoundingBox();
 
-    SVGFilterElement* filterElement = static_cast<SVGFilterElement*>(node());
-    filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement>(filterElement, filterElement->filterUnits(), targetBoundingBox);
+    SVGFilterElement* filterElement = toSVGFilterElement(node());
+    filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement>(filterElement, filterElement->filterUnitsCurrentValue(), targetBoundingBox);
     if (filterData->boundaries.isEmpty())
         return false;
 
@@ -159,7 +160,7 @@
     FloatRect absoluteDrawingRegion = filterData->shearFreeAbsoluteTransform.mapRect(filterData->drawingRegion);
 
     // Create the SVGFilter object.
-    bool primitiveBoundingBoxMode = filterElement->primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+    bool primitiveBoundingBoxMode = filterElement->primitiveUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
     filterData->filter = SVGFilter::create(filterData->shearFreeAbsoluteTransform, absoluteDrawingRegion, targetBoundingBox, filterData->boundaries, primitiveBoundingBoxMode);
 
     // Create all relevant filter primitives.
@@ -171,8 +172,8 @@
     // Also see http://www.w3.org/TR/SVG/filters.html#FilterEffectsRegion
     FloatSize scale(1, 1);
     if (filterElement->hasAttribute(SVGNames::filterResAttr)) {
-        scale.setWidth(filterElement->filterResX() / absoluteFilterBoundaries.width());
-        scale.setHeight(filterElement->filterResY() / absoluteFilterBoundaries.height());
+        scale.setWidth(filterElement->filterResXCurrentValue() / absoluteFilterBoundaries.width());
+        scale.setHeight(filterElement->filterResYCurrentValue() / absoluteFilterBoundaries.height());
     }
 
     if (scale.isEmpty())
@@ -310,8 +311,8 @@
 
 FloatRect RenderSVGResourceFilter::resourceBoundingBox(RenderObject* object)
 {
-    if (SVGFilterElement* element = static_cast<SVGFilterElement*>(node()))
-        return SVGLengthContext::resolveRectangle<SVGFilterElement>(element, element->filterUnits(), object->objectBoundingBox());
+    if (SVGFilterElement* element = toSVGFilterElement(node()))
+        return SVGLengthContext::resolveRectangle<SVGFilterElement>(element, element->filterUnitsCurrentValue(), object->objectBoundingBox());
 
     return FloatRect();
 }
diff --git a/Source/core/rendering/svg/RenderSVGResourceFilter.h b/Source/core/rendering/svg/RenderSVGResourceFilter.h
index 95137f0..9022067 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilter.h
+++ b/Source/core/rendering/svg/RenderSVGResourceFilter.h
@@ -73,8 +73,8 @@
 
     PassRefPtr<SVGFilterBuilder> buildPrimitives(SVGFilter*);
 
-    SVGUnitTypes::SVGUnitType filterUnits() const { return static_cast<SVGFilterElement*>(node())->filterUnits(); }
-    SVGUnitTypes::SVGUnitType primitiveUnits() const { return static_cast<SVGFilterElement*>(node())->primitiveUnits(); }
+    SVGUnitTypes::SVGUnitType filterUnits() const { return toSVGFilterElement(node())->filterUnitsCurrentValue(); }
+    SVGUnitTypes::SVGUnitType primitiveUnits() const { return toSVGFilterElement(node())->primitiveUnitsCurrentValue(); }
 
     void primitiveAttributeChanged(RenderObject*, const QualifiedName&);
 
diff --git a/Source/core/rendering/svg/RenderSVGResourceMarker.cpp b/Source/core/rendering/svg/RenderSVGResourceMarker.cpp
index b5a08be..2f5bdb1 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMarker.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceMarker.cpp
@@ -98,7 +98,7 @@
     ASSERT(marker);
 
     SVGLengthContext lengthContext(marker);
-    return FloatPoint(marker->refX().value(lengthContext), marker->refY().value(lengthContext));
+    return FloatPoint(marker->refXCurrentValue().value(lengthContext), marker->refYCurrentValue().value(lengthContext));
 }
 
 float RenderSVGResourceMarker::angle() const
@@ -107,8 +107,8 @@
     ASSERT(marker);
 
     float angle = -1;
-    if (marker->orientType() == SVGMarkerOrientAngle)
-        angle = marker->orientAngle().value();
+    if (marker->orientTypeCurrentValue() == SVGMarkerOrientAngle)
+        angle = marker->orientAngleCurrentValue().value();
 
     return angle;
 }
@@ -119,7 +119,7 @@
     ASSERT(marker);
 
     float markerAngle = angle();
-    bool useStrokeWidth = marker->markerUnits() == SVGMarkerUnitsStrokeWidth;
+    bool useStrokeWidth = marker->markerUnitsCurrentValue() == SVGMarkerUnitsStrokeWidth;
 
     AffineTransform transform;
     transform.translate(origin.x(), origin.y());
@@ -133,7 +133,7 @@
     // An empty viewBox disables rendering.
     SVGMarkerElement* marker = toSVGMarkerElement(toSVGElement(node()));
     ASSERT(marker);
-    if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBoxIsValid() && marker->viewBox().isEmpty())
+    if (marker->hasAttribute(SVGNames::viewBoxAttr) && marker->viewBoxIsValid() && marker->viewBoxCurrentValue().isEmpty())
         return;
 
     PaintInfo info(paintInfo);
@@ -172,8 +172,8 @@
     ASSERT(marker);
     
     SVGLengthContext lengthContext(marker);
-    float w = marker->markerWidth().value(lengthContext);
-    float h = marker->markerHeight().value(lengthContext);
+    float w = marker->markerWidthCurrentValue().value(lengthContext);
+    float h = marker->markerHeightCurrentValue().value(lengthContext);
     m_viewport = FloatRect(0, 0, w, h);
 }
 
diff --git a/Source/core/rendering/svg/RenderSVGResourceMarker.h b/Source/core/rendering/svg/RenderSVGResourceMarker.h
index d6d7fe9..b0cdcc1 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMarker.h
+++ b/Source/core/rendering/svg/RenderSVGResourceMarker.h
@@ -59,7 +59,7 @@
 
     FloatPoint referencePoint() const;
     float angle() const;
-    SVGMarkerUnitsType markerUnits() const { return static_cast<SVGMarkerElement*>(node())->markerUnits(); }
+    SVGMarkerUnitsType markerUnits() const { return static_cast<SVGMarkerElement*>(node())->markerUnitsCurrentValue(); }
 
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
     static RenderSVGResourceType s_resourceType;
diff --git a/Source/core/rendering/svg/RenderSVGResourceMasker.cpp b/Source/core/rendering/svg/RenderSVGResourceMasker.cpp
index de18fe9..6d5f46d 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMasker.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceMasker.cpp
@@ -121,7 +121,7 @@
 
     // Eventually adjust the mask image context according to the target objectBoundingBox.
     AffineTransform maskContentTransformation;
-    if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+    if (maskElement->maskContentUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         FloatRect objectBoundingBox = object->objectBoundingBox();
         maskContentTransformation.translate(objectBoundingBox.x(), objectBoundingBox.y());
         maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
@@ -171,7 +171,7 @@
     ASSERT(maskElement);
 
     FloatRect objectBoundingBox = object->objectBoundingBox();
-    FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(maskElement, maskElement->maskUnits(), objectBoundingBox);
+    FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(maskElement, maskElement->maskUnitsCurrentValue(), objectBoundingBox);
 
     // Resource was not layouted yet. Give back clipping rect of the mask.
     if (selfNeedsLayout())
@@ -181,7 +181,7 @@
         calculateMaskContentRepaintRect();
 
     FloatRect maskRect = m_maskContentBoundaries;
-    if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+    if (maskElement->maskContentUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
         AffineTransform transform;
         transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
         transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
diff --git a/Source/core/rendering/svg/RenderSVGResourceMasker.h b/Source/core/rendering/svg/RenderSVGResourceMasker.h
index 6b764c0..d159e1f 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMasker.h
+++ b/Source/core/rendering/svg/RenderSVGResourceMasker.h
@@ -49,8 +49,8 @@
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual FloatRect resourceBoundingBox(RenderObject*);
 
-    SVGUnitTypes::SVGUnitType maskUnits() const { return static_cast<SVGMaskElement*>(node())->maskUnits(); }
-    SVGUnitTypes::SVGUnitType maskContentUnits() const { return static_cast<SVGMaskElement*>(node())->maskContentUnits(); }
+    SVGUnitTypes::SVGUnitType maskUnits() const { return static_cast<SVGMaskElement*>(node())->maskUnitsCurrentValue(); }
+    SVGUnitTypes::SVGUnitType maskContentUnits() const { return static_cast<SVGMaskElement*>(node())->maskContentUnitsCurrentValue(); }
 
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
     static RenderSVGResourceType s_resourceType;
diff --git a/Source/core/rendering/svg/RenderSVGRoot.cpp b/Source/core/rendering/svg/RenderSVGRoot.cpp
index 15b4704..1021b51 100644
--- a/Source/core/rendering/svg/RenderSVGRoot.cpp
+++ b/Source/core/rendering/svg/RenderSVGRoot.cpp
@@ -93,7 +93,7 @@
     //   aspect ratio is calculated from the width and height values of the ‘viewBox’ specified for the current SVG document
     //   fragment. If the ‘viewBox’ is not correctly specified, or set to 'none', the intrinsic aspect ratio cannot be
     //   calculated and is considered unspecified.
-    intrinsicSize = svg->viewBox().size();
+    intrinsicSize = svg->viewBoxCurrentValue().size();
     if (!intrinsicSize.isEmpty()) {
         // The viewBox can only yield an intrinsic ratio, not an intrinsic size.
         intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height());
@@ -358,10 +358,10 @@
     SVGSVGElement* svg = toSVGSVGElement(node());
     ASSERT(svg);
     float scale = style()->effectiveZoom();
-    FloatPoint translate = svg->currentTranslate();
+    SVGPoint translate = svg->currentTranslate();
     LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
     m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
-    if (borderAndPadding.isEmpty() && scale == 1 && translate == FloatPoint::zero())
+    if (borderAndPadding.isEmpty() && scale == 1 && translate == SVGPoint::zero())
         return;
     m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
 }
diff --git a/Source/core/rendering/svg/RenderSVGTextPath.cpp b/Source/core/rendering/svg/RenderSVGTextPath.cpp
index 65bab6f..96a9ad2 100644
--- a/Source/core/rendering/svg/RenderSVGTextPath.cpp
+++ b/Source/core/rendering/svg/RenderSVGTextPath.cpp
@@ -36,7 +36,7 @@
 Path RenderSVGTextPath::layoutPath() const
 {
     SVGTextPathElement* textPathElement = static_cast<SVGTextPathElement*>(node());
-    Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href(), textPathElement->document());
+    Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->hrefCurrentValue(), textPathElement->document());
     if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag))
         return Path();
     
@@ -56,17 +56,17 @@
 
 float RenderSVGTextPath::startOffset() const
 {
-    return static_cast<SVGTextPathElement*>(node())->startOffset().valueAsPercentage();
+    return static_cast<SVGTextPathElement*>(node())->startOffsetCurrentValue().valueAsPercentage();
 }
 
 bool RenderSVGTextPath::exactAlignment() const
 {
-    return static_cast<SVGTextPathElement*>(node())->spacing() == SVGTextPathSpacingExact;
+    return static_cast<SVGTextPathElement*>(node())->spacingCurrentValue() == SVGTextPathSpacingExact;
 }
 
 bool RenderSVGTextPath::stretchMethod() const
 {
-    return static_cast<SVGTextPathElement*>(node())->method() == SVGTextPathMethodStretch;
+    return static_cast<SVGTextPathElement*>(node())->methodCurrentValue() == SVGTextPathMethodStretch;
 }
 
 }
diff --git a/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp b/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
index 2a29b00..e03be53 100644
--- a/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
+++ b/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
@@ -55,7 +55,7 @@
 
     if (useElement) {
         SVGLengthContext lengthContext(useElement);
-        FloatSize translation(useElement->x().value(lengthContext), useElement->y().value(lengthContext));
+        FloatSize translation(useElement->xCurrentValue().value(lengthContext), useElement->yCurrentValue().value(lengthContext));
         if (translation != m_lastTranslation)
             m_needsTransformUpdate = true;
         m_lastTranslation = translation;
diff --git a/Source/core/rendering/svg/RenderSVGViewportContainer.cpp b/Source/core/rendering/svg/RenderSVGViewportContainer.cpp
index 00e428e..8cb7ee8 100644
--- a/Source/core/rendering/svg/RenderSVGViewportContainer.cpp
+++ b/Source/core/rendering/svg/RenderSVGViewportContainer.cpp
@@ -63,7 +63,7 @@
     FloatRect oldViewport = m_viewport;
 
     SVGLengthContext lengthContext(element);
-    m_viewport = FloatRect(svg->x().value(lengthContext), svg->y().value(lengthContext), svg->width().value(lengthContext), svg->height().value(lengthContext));
+    m_viewport = FloatRect(svg->xCurrentValue().value(lengthContext), svg->yCurrentValue().value(lengthContext), svg->widthCurrentValue().value(lengthContext), svg->heightCurrentValue().value(lengthContext));
 
     SVGElement* correspondingElement = svg->correspondingElement();
     if (correspondingElement && svg->isInShadowTree()) {
@@ -97,14 +97,14 @@
 
         SVGLengthContext lengthContext(element);
         if (useElement->hasAttribute(SVGNames::widthAttr))
-            m_viewport.setWidth(useElement->width().value(lengthContext));
+            m_viewport.setWidth(useElement->widthCurrentValue().value(lengthContext));
         else if (isSymbolElement && svg->hasAttribute(SVGNames::widthAttr)) {
             SVGLength containerWidth(LengthModeWidth, "100%");
             m_viewport.setWidth(containerWidth.value(lengthContext));
         }
 
         if (useElement->hasAttribute(SVGNames::heightAttr))
-            m_viewport.setHeight(useElement->height().value(lengthContext));
+            m_viewport.setHeight(useElement->heightCurrentValue().value(lengthContext));
         else if (isSymbolElement && svg->hasAttribute(SVGNames::heightAttr)) {
             SVGLength containerHeight(LengthModeHeight, "100%");
             m_viewport.setHeight(containerHeight.value(lengthContext));
diff --git a/Source/core/rendering/svg/SVGInlineTextBox.cpp b/Source/core/rendering/svg/SVGInlineTextBox.cpp
index 3206298..becc6bd 100644
--- a/Source/core/rendering/svg/SVGInlineTextBox.cpp
+++ b/Source/core/rendering/svg/SVGInlineTextBox.cpp
@@ -432,14 +432,21 @@
     RenderText* text = textRenderer();
     ASSERT(text);
 
-    TextRun run(text->characters() + fragment.characterOffset
-                , fragment.length
-                , 0 /* xPos, only relevant with allowTabs=true */
-                , 0 /* padding, only relevant for justified text, not relevant for SVG */
+    TextRun run(static_cast<const LChar*>(0) // characters, will be set below if non-zero.
+                , 0 // length, will be set below if non-zero.
+                , 0 // xPos, only relevant with allowTabs=true
+                , 0 // padding, only relevant for justified text, not relevant for SVG
                 , TextRun::AllowTrailingExpansion
                 , direction()
                 , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */);
 
+    if (fragment.length) {
+        if (text->is8Bit())
+            run.setText(text->characters8() + fragment.characterOffset, fragment.length);
+        else
+            run.setText(text->characters16() + fragment.characterOffset, fragment.length);
+    }
+
     if (textRunNeedsRenderingContext(style->font()))
         run.setRenderingContext(SVGTextRunRenderingContext::create(text));
 
diff --git a/Source/core/rendering/svg/SVGPathData.cpp b/Source/core/rendering/svg/SVGPathData.cpp
index 0879b8b..bd88270 100644
--- a/Source/core/rendering/svg/SVGPathData.cpp
+++ b/Source/core/rendering/svg/SVGPathData.cpp
@@ -40,9 +40,9 @@
     SVGCircleElement* circle = static_cast<SVGCircleElement*>(element);
 
     SVGLengthContext lengthContext(element);
-    float r = circle->r().value(lengthContext);
+    float r = circle->rCurrentValue().value(lengthContext);
     if (r > 0)
-        path.addEllipse(FloatRect(circle->cx().value(lengthContext) - r, circle->cy().value(lengthContext) - r, r * 2, r * 2));
+        path.addEllipse(FloatRect(circle->cxCurrentValue().value(lengthContext) - r, circle->cyCurrentValue().value(lengthContext) - r, r * 2, r * 2));
 }
 
 static void updatePathFromEllipseElement(SVGElement* element, Path& path)
@@ -51,13 +51,13 @@
     SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(element);
 
     SVGLengthContext lengthContext(element);
-    float rx = ellipse->rx().value(lengthContext);
+    float rx = ellipse->rxCurrentValue().value(lengthContext);
     if (rx <= 0)
         return;
-    float ry = ellipse->ry().value(lengthContext);
+    float ry = ellipse->ryCurrentValue().value(lengthContext);
     if (ry <= 0)
         return;
-    path.addEllipse(FloatRect(ellipse->cx().value(lengthContext) - rx, ellipse->cy().value(lengthContext) - ry, rx * 2, ry * 2));
+    path.addEllipse(FloatRect(ellipse->cxCurrentValue().value(lengthContext) - rx, ellipse->cyCurrentValue().value(lengthContext) - ry, rx * 2, ry * 2));
 }
 
 static void updatePathFromLineElement(SVGElement* element, Path& path)
@@ -66,8 +66,8 @@
     SVGLineElement* line = static_cast<SVGLineElement*>(element);
 
     SVGLengthContext lengthContext(element);
-    path.moveTo(FloatPoint(line->x1().value(lengthContext), line->y1().value(lengthContext)));
-    path.addLineTo(FloatPoint(line->x2().value(lengthContext), line->y2().value(lengthContext)));
+    path.moveTo(FloatPoint(line->x1CurrentValue().value(lengthContext), line->y1CurrentValue().value(lengthContext)));
+    path.addLineTo(FloatPoint(line->x2CurrentValue().value(lengthContext), line->y2CurrentValue().value(lengthContext)));
 }
 
 static void updatePathFromPathElement(SVGElement* element, Path& path)
@@ -116,19 +116,19 @@
     SVGRectElement* rect = static_cast<SVGRectElement*>(element);
 
     SVGLengthContext lengthContext(element);
-    float width = rect->width().value(lengthContext);
+    float width = rect->widthCurrentValue().value(lengthContext);
     if (width <= 0)
         return;
-    float height = rect->height().value(lengthContext);
+    float height = rect->heightCurrentValue().value(lengthContext);
     if (height <= 0)
         return;
-    float x = rect->x().value(lengthContext);
-    float y = rect->y().value(lengthContext);
-    bool hasRx = rect->rx().value(lengthContext) > 0;
-    bool hasRy = rect->ry().value(lengthContext) > 0;
+    float x = rect->xCurrentValue().value(lengthContext);
+    float y = rect->yCurrentValue().value(lengthContext);
+    bool hasRx = rect->rxCurrentValue().value(lengthContext) > 0;
+    bool hasRy = rect->ryCurrentValue().value(lengthContext) > 0;
     if (hasRx || hasRy) {
-        float rx = rect->rx().value(lengthContext);
-        float ry = rect->ry().value(lengthContext);
+        float rx = rect->rxCurrentValue().value(lengthContext);
+        float ry = rect->ryCurrentValue().value(lengthContext);
         if (!hasRx)
             rx = ry;
         else if (!hasRy)
diff --git a/Source/core/rendering/svg/SVGRenderTreeAsText.cpp b/Source/core/rendering/svg/SVGRenderTreeAsText.cpp
index 952b085..980fa19 100644
--- a/Source/core/rendering/svg/SVGRenderTreeAsText.cpp
+++ b/Source/core/rendering/svg/SVGRenderTreeAsText.cpp
@@ -332,27 +332,27 @@
 
     if (svgElement->hasTagName(SVGNames::rectTag)) {
         SVGRectElement* element = static_cast<SVGRectElement*>(svgElement);
-        writeNameValuePair(ts, "x", element->x().value(lengthContext));
-        writeNameValuePair(ts, "y", element->y().value(lengthContext));
-        writeNameValuePair(ts, "width", element->width().value(lengthContext));
-        writeNameValuePair(ts, "height", element->height().value(lengthContext));
+        writeNameValuePair(ts, "x", element->xCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "y", element->yCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "width", element->widthCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "height", element->heightCurrentValue().value(lengthContext));
     } else if (svgElement->hasTagName(SVGNames::lineTag)) {
         SVGLineElement* element = static_cast<SVGLineElement*>(svgElement);
-        writeNameValuePair(ts, "x1", element->x1().value(lengthContext));
-        writeNameValuePair(ts, "y1", element->y1().value(lengthContext));
-        writeNameValuePair(ts, "x2", element->x2().value(lengthContext));
-        writeNameValuePair(ts, "y2", element->y2().value(lengthContext));
+        writeNameValuePair(ts, "x1", element->x1CurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "y1", element->y1CurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "x2", element->x2CurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "y2", element->y2CurrentValue().value(lengthContext));
     } else if (svgElement->hasTagName(SVGNames::ellipseTag)) {
         SVGEllipseElement* element = static_cast<SVGEllipseElement*>(svgElement);
-        writeNameValuePair(ts, "cx", element->cx().value(lengthContext));
-        writeNameValuePair(ts, "cy", element->cy().value(lengthContext));
-        writeNameValuePair(ts, "rx", element->rx().value(lengthContext));
-        writeNameValuePair(ts, "ry", element->ry().value(lengthContext));
+        writeNameValuePair(ts, "cx", element->cxCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "cy", element->cyCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "rx", element->rxCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "ry", element->ryCurrentValue().value(lengthContext));
     } else if (svgElement->hasTagName(SVGNames::circleTag)) {
         SVGCircleElement* element = static_cast<SVGCircleElement*>(svgElement);
-        writeNameValuePair(ts, "cx", element->cx().value(lengthContext));
-        writeNameValuePair(ts, "cy", element->cy().value(lengthContext));
-        writeNameValuePair(ts, "r", element->r().value(lengthContext));
+        writeNameValuePair(ts, "cx", element->cxCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "cy", element->cyCurrentValue().value(lengthContext));
+        writeNameValuePair(ts, "r", element->rCurrentValue().value(lengthContext));
     } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTagName(SVGNames::polylineTag)) {
         SVGPolyElement* element = static_cast<SVGPolyElement*>(svgElement);
         writeNameAndQuotedValue(ts, "points", element->pointList().valueAsString());
@@ -632,7 +632,7 @@
     if (!style)
         return;
 
-    ts << " [offset=" << stopElement->offset() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n";
+    ts << " [offset=" << stopElement->offsetCurrentValue() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n";
 }
 
 void writeResources(TextStream& ts, const RenderObject& object, int indent)
diff --git a/Source/core/rendering/svg/SVGResources.cpp b/Source/core/rendering/svg/SVGResources.cpp
index 32769d3..e6c2564 100644
--- a/Source/core/rendering/svg/SVGResources.cpp
+++ b/Source/core/rendering/svg/SVGResources.cpp
@@ -143,11 +143,11 @@
 {
     String target;
     if (element->hasTagName(SVGNames::patternTag))
-        target = static_cast<SVGPatternElement*>(element)->href();
+        target = static_cast<SVGPatternElement*>(element)->hrefCurrentValue();
     else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag))
-        target = static_cast<SVGGradientElement*>(element)->href();
+        target = static_cast<SVGGradientElement*>(element)->hrefCurrentValue();
     else if (element->hasTagName(SVGNames::filterTag))
-        target = static_cast<SVGFilterElement*>(element)->href();
+        target = toSVGFilterElement(element)->hrefCurrentValue();
     else
         ASSERT_NOT_REACHED();
 
diff --git a/Source/core/rendering/svg/SVGResourcesCache.cpp b/Source/core/rendering/svg/SVGResourcesCache.cpp
index bffef97..eca0bef 100644
--- a/Source/core/rendering/svg/SVGResourcesCache.cpp
+++ b/Source/core/rendering/svg/SVGResourcesCache.cpp
@@ -141,8 +141,11 @@
 
     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(SyntheticStyleChange);
+        renderer->node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
 }
 
 void SVGResourcesCache::clientWasAddedToTree(RenderObject* renderer, const RenderStyle* newStyle)
diff --git a/Source/core/rendering/svg/SVGTextChunkBuilder.cpp b/Source/core/rendering/svg/SVGTextChunkBuilder.cpp
index 78f522c..d26d868 100644
--- a/Source/core/rendering/svg/SVGTextChunkBuilder.cpp
+++ b/Source/core/rendering/svg/SVGTextChunkBuilder.cpp
@@ -129,7 +129,7 @@
         SVGLengthContext lengthContext(textContentElement);
         desiredTextLength = textContentElement->specifiedTextLength().value(lengthContext);
 
-        switch (textContentElement->lengthAdjust()) {
+        switch (textContentElement->lengthAdjustCurrentValue()) {
         case SVGLengthAdjustUnknown:
             break;
         case SVGLengthAdjustSpacing:
diff --git a/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp b/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
index 1fdea13..e9ea97f 100644
--- a/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp
@@ -89,7 +89,7 @@
         return;
     }
 
-    const UChar* characters = text->characters();
+    const UChar* characters = text->bloatedCharacters();
     unsigned textLength = text->textLength();    
     for (unsigned textPosition = 0; textPosition < textLength; ++textPosition) {
         const UChar* currentCharacter = characters + textPosition;
@@ -179,11 +179,11 @@
 
 void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& position)
 {
-    const SVGLengthList& xList = position.element->x();
-    const SVGLengthList& yList = position.element->y();
-    const SVGLengthList& dxList = position.element->dx();
-    const SVGLengthList& dyList = position.element->dy();
-    const SVGNumberList& rotateList = position.element->rotate();
+    const SVGLengthList& xList = position.element->xCurrentValue();
+    const SVGLengthList& yList = position.element->yCurrentValue();
+    const SVGLengthList& dxList = position.element->dxCurrentValue();
+    const SVGLengthList& dyList = position.element->dyCurrentValue();
+    const SVGNumberList& rotateList = position.element->rotateCurrentValue();
 
     unsigned xListSize = xList.size();
     unsigned yListSize = yList.size();
diff --git a/Source/core/rendering/svg/SVGTextLayoutEngine.cpp b/Source/core/rendering/svg/SVGTextLayoutEngine.cpp
index 3f75978..cbdaf1b 100644
--- a/Source/core/rendering/svg/SVGTextLayoutEngine.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutEngine.cpp
@@ -148,7 +148,7 @@
     while (currentParent) {
         if (SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(currentParent)) {
             SVGLengthContext lengthContext(textContentElement);
-            if (textContentElement->lengthAdjust() == SVGLengthAdjustSpacing && textContentElement->specifiedTextLength().value(lengthContext) > 0)
+            if (textContentElement->lengthAdjustCurrentValue() == SVGLengthAdjustSpacing && textContentElement->specifiedTextLength().value(lengthContext) > 0)
                 return true;
         }
 
@@ -206,7 +206,7 @@
 
     if (SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(textPath)) {
         SVGLengthContext lengthContext(textContentElement);
-        lengthAdjust = textContentElement->lengthAdjust();
+        lengthAdjust = textContentElement->lengthAdjustCurrentValue();
         desiredTextLength = textContentElement->specifiedTextLength().value(lengthContext);
     }
 
@@ -441,7 +441,7 @@
     Vector<SVGTextMetrics>& visualMetricsValues = text->layoutAttributes()->textMetricsValues();
     ASSERT(!visualMetricsValues.isEmpty());
 
-    const UChar* characters = text->characters();
+    const UChar* characters = text->bloatedCharacters();
     const Font& font = style->font();
 
     SVGTextLayoutEngineSpacing spacingLayout(font);
diff --git a/Source/core/rendering/svg/SVGTextMetrics.cpp b/Source/core/rendering/svg/SVGTextMetrics.cpp
index 26796d7..e91d5f9 100644
--- a/Source/core/rendering/svg/SVGTextMetrics.cpp
+++ b/Source/core/rendering/svg/SVGTextMetrics.cpp
@@ -61,19 +61,26 @@
     m_length = static_cast<unsigned>(length);
 }
 
-TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, const UChar* characters, unsigned position, unsigned length)
+TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned position, unsigned length)
 {
     RenderStyle* style = text->style();
     ASSERT(style);
 
-    TextRun run(characters + position
-                , length
-                , 0 /* xPos, only relevant with allowTabs=true */
-                , 0 /* padding, only relevant for justified text, not relevant for SVG */
+    TextRun run(static_cast<const LChar*>(0) // characters, will be set below if non-zero.
+                , 0 // length, will be set below if non-zero.
+                , 0 // xPos, only relevant with allowTabs=true
+                , 0 // padding, only relevant for justified text, not relevant for SVG
                 , TextRun::AllowTrailingExpansion
                 , style->direction()
                 , isOverride(style->unicodeBidi()) /* directionalOverride */);
 
+    if (length) {
+        if (text->is8Bit())
+            run.setText(text->characters8() + position, length);
+        else
+            run.setText(text->characters16() + position, length);
+    }
+
     if (textRunNeedsRenderingContext(style->font()))
         run.setRenderingContext(SVGTextRunRenderingContext::create(text));
 
@@ -91,7 +98,7 @@
 SVGTextMetrics SVGTextMetrics::measureCharacterRange(RenderSVGInlineText* text, unsigned position, unsigned length)
 {
     ASSERT(text);
-    return SVGTextMetrics(text, constructTextRun(text, text->characters(), position, length));
+    return SVGTextMetrics(text, constructTextRun(text, position, length));
 }
 
 SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width, const String& glyphName)
@@ -106,7 +113,7 @@
     m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor;
     if (needsContext) {
         m_glyph.isValid = true;
-        m_glyph.unicodeString = String(text->characters() + position, length);
+        m_glyph.unicodeString = String(text->bloatedCharacters() + position, length);
         m_glyph.name = glyphName;
     }
 
diff --git a/Source/core/rendering/svg/SVGTextMetrics.h b/Source/core/rendering/svg/SVGTextMetrics.h
index 5b0693e..227bb1b 100644
--- a/Source/core/rendering/svg/SVGTextMetrics.h
+++ b/Source/core/rendering/svg/SVGTextMetrics.h
@@ -39,7 +39,7 @@
     SVGTextMetrics(RenderSVGInlineText*, unsigned position, unsigned length, float width, const String& glyphName);
 
     static SVGTextMetrics measureCharacterRange(RenderSVGInlineText*, unsigned position, unsigned length);
-    static TextRun constructTextRun(RenderSVGInlineText*, const UChar* characters, unsigned position, unsigned length);
+    static TextRun constructTextRun(RenderSVGInlineText*, unsigned position, unsigned length);
 
     bool isEmpty() const { return !m_width && !m_height && !m_glyph.isValid && m_length == 1; }
 
diff --git a/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp b/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp
index 5246362..46a2797 100644
--- a/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp
+++ b/Source/core/rendering/svg/SVGTextMetricsBuilder.cpp
@@ -100,7 +100,7 @@
     m_totalWidth = 0;
 
     const Font& scaledFont = text->scaledFont();
-    m_run = SVGTextMetrics::constructTextRun(text, text->characters(), 0, text->textLength());
+    m_run = SVGTextMetrics::constructTextRun(text, 0, text->textLength());
     m_isComplexText = scaledFont.codePath(m_run) == Font::Complex;
 
     if (m_isComplexText)
@@ -112,6 +112,7 @@
 struct MeasureTextData {
     MeasureTextData(SVGCharacterDataMap* characterDataMap)
         : allCharactersMap(characterDataMap)
+        , hasLastCharacter(false)
         , lastCharacter(0)
         , processRenderer(false)
         , valueListPosition(0)
@@ -120,7 +121,8 @@
     }
 
     SVGCharacterDataMap* allCharactersMap;
-    const UChar* lastCharacter;
+    bool hasLastCharacter;
+    UChar lastCharacter;
     bool processRenderer;
     unsigned valueListPosition;
     unsigned skippedCharacters;
@@ -144,8 +146,8 @@
     int surrogatePairCharacters = 0;
 
     while (advance()) {
-        const UChar* currentCharacter = m_run.data16(m_textPosition);
-        if (*currentCharacter == ' ' && !preserveWhiteSpace && (!data->lastCharacter || *data->lastCharacter == ' ')) {
+        UChar currentCharacter = m_run[m_textPosition];
+        if (currentCharacter == ' ' && !preserveWhiteSpace && (!data->hasLastCharacter || data->lastCharacter == ' ')) {
             if (data->processRenderer)
                 textMetricsValues->append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics));
             if (data->allCharactersMap)
@@ -165,6 +167,7 @@
         if (data->allCharactersMap && currentCharacterStartsSurrogatePair())
             surrogatePairCharacters++;
 
+        data->hasLastCharacter = true;
         data->lastCharacter = currentCharacter;
     }
 
diff --git a/Source/core/rendering/svg/SVGTextQuery.cpp b/Source/core/rendering/svg/SVGTextQuery.cpp
index c871f3b..27c7170 100644
--- a/Source/core/rendering/svg/SVGTextQuery.cpp
+++ b/Source/core/rendering/svg/SVGTextQuery.cpp
@@ -500,10 +500,10 @@
     return true;
 }
 
-FloatRect SVGTextQuery::extentOfCharacter(unsigned position) const
+SVGRect SVGTextQuery::extentOfCharacter(unsigned position) const
 {
     if (m_textBoxes.isEmpty())
-        return FloatRect();
+        return SVGRect();
 
     ExtentOfCharacterData data(position);
     executeQuery(&data, &SVGTextQuery::extentOfCharacterCallback);
@@ -541,7 +541,7 @@
     return false;
 }
 
-int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const
+int SVGTextQuery::characterNumberAtPosition(const SVGPoint& position) const
 {
     if (m_textBoxes.isEmpty())
         return -1;
diff --git a/Source/core/rendering/svg/SVGTextQuery.h b/Source/core/rendering/svg/SVGTextQuery.h
index 007b5c9..1a99cd3 100644
--- a/Source/core/rendering/svg/SVGTextQuery.h
+++ b/Source/core/rendering/svg/SVGTextQuery.h
@@ -20,8 +20,9 @@
 #ifndef SVGTextQuery_h
 #define SVGTextQuery_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/svg/SVGTextFragment.h"
+#include "core/svg/SVGPoint.h"
+#include "core/svg/SVGRect.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -40,8 +41,8 @@
     FloatPoint startPositionOfCharacter(unsigned position) const;
     FloatPoint endPositionOfCharacter(unsigned position) const;
     float rotationOfCharacter(unsigned position) const;
-    FloatRect extentOfCharacter(unsigned position) const;
-    int characterNumberAtPosition(const FloatPoint&) const;
+    SVGRect extentOfCharacter(unsigned position) const;
+    int characterNumberAtPosition(const SVGPoint&) const;
 
     // Public helper struct. Private classes in SVGTextQuery inherit from it.
     struct Data;
diff --git a/Source/core/scripts/action_makenames.py b/Source/core/scripts/action_makenames.py
index 4cf45cd..c4bfe74 100644
--- a/Source/core/scripts/action_makenames.py
+++ b/Source/core/scripts/action_makenames.py
@@ -137,7 +137,7 @@
             assert False
 
     assert makeNamesInput != None
-    assert tagInput != None or attrInput != None or eventsInput != None or ('--fonts' in options)
+    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.
diff --git a/Source/core/scripts/supplemental_idl_files.py b/Source/core/scripts/list_idl_files_with_partial_interface.py
similarity index 98%
rename from Source/core/scripts/supplemental_idl_files.py
rename to Source/core/scripts/list_idl_files_with_partial_interface.py
index eaf0270..edebc51 100644
--- a/Source/core/scripts/supplemental_idl_files.py
+++ b/Source/core/scripts/list_idl_files_with_partial_interface.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-#
 # Copyright (C) 2013 Google Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -35,6 +33,7 @@
 
 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:
diff --git a/Source/core/scripts/make_css_property_names.py b/Source/core/scripts/make_css_property_names.py
index 58f85f2..f775462 100755
--- a/Source/core/scripts/make_css_property_names.py
+++ b/Source/core/scripts/make_css_property_names.py
@@ -78,10 +78,14 @@
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
-const char* const propertyNameStrings[numCSSProperties] = {
+static const char propertyNameStringsPool[] = {
 %(property_name_strings)s
 };
 
+static const unsigned short propertyNameStringsOffsets[] = {
+%(property_name_offsets)s
+};
+
 %%}
 %%struct-type
 struct Property;
@@ -93,6 +97,7 @@
 %%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
 %%%%
@@ -110,7 +115,7 @@
     int index = id - firstCSSProperty;
     if (index >= numCSSProperties)
         return 0;
-    return propertyNameStrings[index];
+    return propertyNameStringsPool + propertyNameStringsOffsets[index];
 }
 
 const AtomicString& getPropertyNameAtomicString(CSSPropertyID id)
@@ -124,7 +129,7 @@
     static AtomicString* propertyStrings = new AtomicString[numCSSProperties]; // Intentionally never destroyed.
     AtomicString& propertyString = propertyStrings[index];
     if (propertyString.isNull()) {
-        const char* propertyName = propertyNameStrings[index];
+        const char* propertyName = propertyNameStringsPool + propertyNameStringsOffsets[index];
         propertyString = AtomicString(propertyName, strlen(propertyName), AtomicString::ConstructFromLiteral);
     }
     return propertyString;
@@ -210,14 +215,21 @@
         }
 
     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",' % property, self._properties)),
+            '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)),
         }
         # 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_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]
 
diff --git a/Source/core/scripts/make_css_value_keywords.py b/Source/core/scripts/make_css_value_keywords.py
index a51823c..0b5a3d6 100755
--- a/Source/core/scripts/make_css_value_keywords.py
+++ b/Source/core/scripts/make_css_value_keywords.py
@@ -46,10 +46,13 @@
 #include <string.h>
 
 namespace WebCore {
-const char* const valueList[] = {
-"",
+static const char valueListStringPool[] = {
+"\\0"
 %(value_keyword_strings)s
-0
+};
+
+static const unsigned short valueListStringOffsets[] = {
+%(value_keyword_offsets)s
 };
 
 %%}
@@ -62,7 +65,9 @@
 %%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
@@ -76,7 +81,7 @@
 {
     if (id >= numCSSValueKeywords || id <= 0)
         return 0;
-    return valueList[id];
+    return valueListStringPool + valueListStringOffsets[id];
 }
 
 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode)
@@ -146,14 +151,21 @@
         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",' % property, self._value_keywords)),
+            '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'))),
+            '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']
diff --git a/Source/core/scripts/make_event_factory.py b/Source/core/scripts/make_event_factory.py
index d34e4be..947ce1c 100644
--- a/Source/core/scripts/make_event_factory.py
+++ b/Source/core/scripts/make_event_factory.py
@@ -60,6 +60,7 @@
         'ImplementedAs': None,
         'Conditional': None,
         'EnabledAtRuntime': None,
+        'AllowJSCreationOnlyIfFeatureEnabled': None,
     }
     default_parameters = {
         'namespace': '',
@@ -74,7 +75,7 @@
 
     def _factory_implementation(self, event):
         runtime_condition = ''
-        if event['EnabledAtRuntime']:
+        if event['EnabledAtRuntime'] and event['AllowJSCreationOnlyIfFeatureEnabled']:
             runtime_condition = ' && RuntimeEnabledFeatures::' + event['EnabledAtRuntime'] + '()'
         name = os.path.basename(event['name'])
         class_name = self._class_name_for_entry(event)
diff --git a/Source/core/scripts/make_names.pl b/Source/core/scripts/make_names.pl
index a323a1d..bceb391 100755
--- a/Source/core/scripts/make_names.pl
+++ b/Source/core/scripts/make_names.pl
@@ -44,6 +44,7 @@
 
 my $printFactory = 0; 
 my $fontNamesIn = "";
+my $resourceTypesIn = "";
 my $tagsFile = "";
 my $attrsFile = "";
 my $outputDir = ".";
@@ -78,59 +79,22 @@
     'outputDir=s' => \$outputDir,
     'extraDefines=s' => \$extraDefines,
     'preprocessor=s' => \$preprocessor,
-    'fonts=s' => \$fontNamesIn
+    'fonts=s' => \$fontNamesIn,
+    'resourceTypes=s' => \$resourceTypesIn
 );
 
 mkpath($outputDir);
 
 if (length($fontNamesIn)) {
-    my $names = new IO::File;
     my $familyNamesFileBase = "FontFamily";
+    my $familyNamesPrefix = "CSS";
+    createGenericNamesFile($fontNamesIn, $familyNamesFileBase, $familyNamesPrefix);
+}
 
-    open($names, $fontNamesIn) or die "Failed to open file: $fontNamesIn";
-
-    $initDefaults = 0;
-    my $Parser = InFilesParser->new();
-    my $dummy;
-    $Parser->parse($names, \&parametersHandler, \&dummy);
-
-    my $F;
-    my $header = File::Spec->catfile($outputDir, "${familyNamesFileBase}Names.h");
-    open F, ">$header" or die "Unable to open $header for writing.";
-
-    printLicenseHeader($F);
-    printHeaderHead($F, "CSS", $familyNamesFileBase, "#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, "${familyNamesFileBase}Names.cpp");
-    open F, ">$source" or die "Unable to open $source for writing.";
-
-    printLicenseHeader($F);
-    printCppHead($F, "CSS", $familyNamesFileBase, "WTF");
-
-    print F StaticString::GenerateStrings(\%parameters);
-
-    while ( my ($name, $identifier) = each %parameters ) {
-        print F "DEFINE_GLOBAL(AtomicString, $name)\n";
-    }
-
-    printInit($F, 0);
-
-    print F "\n";
-    print F StaticString::GenerateStringAsserts(\%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;
+if (length($resourceTypesIn)) {
+    my $baseName = "CachedResourceInitiatorType";
+    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));
@@ -281,6 +245,11 @@
     # 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;
 }
@@ -837,7 +806,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "Settings.h"
 
-#include "CustomElementRegistry.h"
+#include "CustomElementRegistrationContext.h"
 
 namespace WebCore {
 
@@ -891,9 +860,9 @@
     if (!document)
         return 0;
 
-    if (RuntimeEnabledFeatures::customDOMElementsEnabled() && CustomElementRegistry::isCustomTagName(qName.localName())) {
-        RefPtr<Element> element = document->ensureCustomElementRegistry()->createCustomTagElement(qName);
-        ASSERT(element->is$parameters{namespace}Element());
+    if (CustomElementRegistrationContext::isCustomTagName(qName.localName())) {
+        RefPtr<Element> element = document->registrationContext()->createCustomTagElement(document, qName);
+        ASSERT_WITH_SECURITY_IMPLICATION(element->is$parameters{namespace}Element());
         return static_pointer_cast<$parameters{namespace}Element>(element.release());
     }
 
@@ -1101,7 +1070,7 @@
 
 #include "V8$parameters{namespace}Element.h"
 
-#include "bindings/v8/CustomElementHelpers.h"
+#include "bindings/v8/CustomElementWrapper.h"
 
 #include <v8.h>
 
@@ -1148,7 +1117,7 @@
 
     Create$parameters{namespace}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl());
     if (element->isCustomElement())
-        return CustomElementHelpers::wrap(element, creationContext, isolate, CustomElementHelpers::CreateWrapperFunction(createWrapperFunction));
+        return CustomElementWrapper<$parameters{namespace}Element, V8$parameters{namespace}Element>::wrap(element, creationContext, isolate, createWrapperFunction);
     if (createWrapperFunction)
     {
 END
@@ -1260,3 +1229,57 @@
 
     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");
+
+    print F StaticString::GenerateStrings(\%parameters);
+
+    while ( my ($name, $identifier) = each %parameters ) {
+        print F "DEFINE_GLOBAL(AtomicString, $name)\n";
+    }
+
+    printInit($F, 0);
+
+    print F "\n";
+    print F StaticString::GenerateStringAsserts(\%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_token_matcher.py b/Source/core/scripts/make_token_matcher.py
new file mode 100755
index 0000000..3631ed9
--- /dev/null
+++ b/Source/core/scripts/make_token_matcher.py
@@ -0,0 +1,231 @@
+#!/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) as input_file:
+        with io.open(output_name, 'w') 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
new file mode 100755
index 0000000..c0c8286
--- /dev/null
+++ b/Source/core/scripts/make_token_matcher_unittest.py
@@ -0,0 +1,243 @@
+#!/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/templates/StyleBuilder.cpp.tmpl b/Source/core/scripts/templates/StyleBuilder.cpp.tmpl
index 09d2be1..f5a4637 100644
--- a/Source/core/scripts/templates/StyleBuilder.cpp.tmpl
+++ b/Source/core/scripts/templates/StyleBuilder.cpp.tmpl
@@ -12,7 +12,7 @@
 //   test other variations for performance once we have more properties here.
 
 {%- macro set_value(property) -%}
-    styleResolver->style()->{{property.setter}}
+    state.style()->{{property.setter}}
 {%- endmacro %}
 
 namespace WebCore {
@@ -22,41 +22,49 @@
         return;
 
     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-{% if property.use_none %}
-    if (primitiveValue->getValueID() == CSSValueNone)
-        {{ set_value(property) }}(Length(Undefined));
-{% endif %}
+    Length length;
+    switch(primitiveValue->getValueID()) {
 
-{%- if property.use_intrinsic %}
-    if (primitiveValue->getValueID() == CSSValueIntrinsic)
-        {{ set_value(property) }}(Length(Intrinsic));
-    else if (primitiveValue->getValueID() == CSSValueMinIntrinsic)
-        {{ set_value(property) }}(Length(MinIntrinsic));
-    else if (primitiveValue->getValueID() == CSSValueWebkitMinContent)
-        {{ set_value(property) }}(Length(MinContent));
-    else if (primitiveValue->getValueID() == CSSValueWebkitMaxContent)
-        {{ set_value(property) }}(Length(MaxContent));
-    else if (primitiveValue->getValueID() == CSSValueWebkitFillAvailable)
-        {{ set_value(property) }}(Length(FillAvailable));
-    else if (primitiveValue->getValueID() == CSSValueWebkitFitContent)
-        {{ set_value(property) }}(Length(FitContent));
-{% endif %}
-
-{%- if property.use_auto %}
-    if (primitiveValue->getValueID() == CSSValueAuto)
-        {{ set_value(property) }}(Length());
+{%- if property.use_none %}
+    case CSSValueNone:
+        length = Length(Undefined);
+        break;
 {%- endif %}
 
-    if (primitiveValue->isLength()) {
-        Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+{%- if property.use_intrinsic %}
+    case CSSValueIntrinsic:
+        length = Length(Intrinsic);
+        break;
+    case CSSValueMinIntrinsic:
+        length = Length(MinIntrinsic);
+        break;
+    case CSSValueWebkitMinContent:
+        length = Length(MinContent);
+        break;
+    case CSSValueWebkitMaxContent:
+        length = Length(MaxContent);
+        break;
+    case CSSValueWebkitFillAvailable:
+        length = Length(FillAvailable);
+        break;
+    case CSSValueWebkitFitContent:
+        length = Length(FitContent);
+        break;
+{%- endif %}
+
+{%- if property.use_auto %}
+    case CSSValueAuto:
+        break; // default ctor is auto
+{%- endif %}
+
+    case CSSValueInvalid:
+        length = primitiveValue->convertToLength<FixedIntegerConversion | CalculatedConversion | PercentConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
         length.setQuirk(primitiveValue->isQuirkValue());
-        {{ set_value(property) }}(length);
-    } else if (primitiveValue->isPercentage())
-        {{ set_value(property) }}(Length(primitiveValue->getDoubleValue(), Percent));
-    else if (primitiveValue->isCalculatedPercentageWithLength())
-        {{ set_value(property) }}(Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
-    else if (primitiveValue->isViewportPercentageLength())
-        {{ set_value(property) }}(primitiveValue->viewportPercentageLength());
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+    {{ set_value(property) }}(length);
 {%- endmacro %}
 
 {%- for property_id, property in properties.items() if not property.use_handlers_for %}
@@ -64,21 +72,21 @@
 {%- set apply_type = property.apply_type %}
 
 {%- if not property.custom_initial %}
-void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleResolver)
+void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleResolver, StyleResolverState& state)
 {
     {{ set_value(property) }}(RenderStyle::{{property.initial}}());
 }
 {% endif %}
 
 {%- if not property.custom_inherit %}
-void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolver* styleResolver)
+void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolver* styleResolver, StyleResolverState& state)
 {
-    {{ set_value(property) }}(styleResolver->parentStyle()->{{property.getter}}());
+    {{ set_value(property) }}(state.parentStyle()->{{property.getter}}());
 }
 {% endif %}
 
 {%- if not property.custom_value %}
-void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolver* styleResolver, CSSValue* value)
+void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
 {
 {%- if apply_type == "length" %}
     {{ apply_value_length(property) }}
@@ -91,7 +99,7 @@
 {%- endcall %}
 {%- endfor %}
 
-bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver* styleResolver, CSSValue* value, bool isInitial, bool isInherit) {
+bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolver* styleResolver, 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 %}
@@ -99,11 +107,11 @@
 {%- call wrap_with_condition(used_property.condition) %}
     case {{ property_id }}:
         if (isInitial)
-            StyleBuilderFunctions::applyInitial{{ used_property_id }}(styleResolver);
+            StyleBuilderFunctions::applyInitial{{ used_property_id }}(styleResolver, state);
         else if (isInherit)
-            StyleBuilderFunctions::applyInherit{{ used_property_id }}(styleResolver);
+            StyleBuilderFunctions::applyInherit{{ used_property_id }}(styleResolver, state);
         else
-            StyleBuilderFunctions::applyValue{{ used_property_id }}(styleResolver, value);
+            StyleBuilderFunctions::applyValue{{ used_property_id }}(styleResolver, state, value);
         return true;
 {%- endcall %}
 {% endfor %}
diff --git a/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl
index f78bc93..bc15ce4 100644
--- a/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -1,42 +1,44 @@
-{% from "macros.tmpl" import lower_first, wrap_with_condition -%}
+{% 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, condition)
+    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/StyleResolver.h"
 
-{%- macro apply_initial(property_id) -%}
-void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleResolver)
+{%- macro declare_initial_function(property_id) -%}
+void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolver* styleResolver, StyleResolverState& state)
 {%- endmacro %}
 
-{%- macro apply_inherit(property_id) -%}
-void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolver* styleResolver)
+{%- macro declare_inherit_function(property_id) -%}
+void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolver* styleResolver, StyleResolverState& state)
 {%- endmacro %}
 
-{%- macro apply_value(property_id) -%}
-void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolver* styleResolver, CSSValue* value)
+{%- macro declare_value_function(property_id) -%}
+void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolver* styleResolver, StyleResolverState& state, CSSValue* value)
 {%- endmacro %}
 
 {%- macro set_value(property) -%}
-    styleResolver->style()->{{property.setter}}
+    state.style()->{{property.setter}}
 {%- endmacro %}
 
 namespace WebCore {
 
 {%- macro apply_animation(property_id, attribute, animation) %}
-{{ apply_initial(property_id) }}
+{{ declare_initial_function(property_id) }}
 {
-    CSSAnimationDataList* list = styleResolver->style()->access{{animation}}();
+    CSSAnimationDataList* list = state.style()->access{{animation}}();
     if (list->isEmpty())
         list->append(CSSAnimationData::create());
     list->animation(0)->set{{attribute}}(CSSAnimationData::initialAnimation{{attribute}}());
@@ -47,10 +49,10 @@
         list->animation(i)->clear{{attribute}}();
 }
 
-{{ apply_inherit(property_id) }}
+{{ declare_inherit_function(property_id) }}
 {
-    CSSAnimationDataList* list = styleResolver->style()->access{{animation}}();
-    const CSSAnimationDataList* parentList = styleResolver->parentStyle()->{{animation|lower}}();
+    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) {
         if (list->size() <= i)
@@ -64,22 +66,22 @@
         list->animation(i)->clear{{attribute}}();
 }
 
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
-    CSSAnimationDataList* list = styleResolver->style()->access{{animation}}();
+    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()) {
             if (childIndex <= list->size())
                 list->append(CSSAnimationData::create());
-            styleResolver->styleMap()->mapAnimation{{attribute}}(list->animation(childIndex), i.value());
+            state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex), i.value());
             ++childIndex;
         }
     } else {
         if (list->isEmpty())
             list->append(CSSAnimationData::create());
-        styleResolver->styleMap()->mapAnimation{{attribute}}(list->animation(childIndex), value);
+        state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex), value);
         childIndex = 1;
     }
     for ( ; childIndex < list->size(); ++childIndex) {
@@ -106,30 +108,30 @@
 {%- 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 %}
-{{ apply_initial(property_id) }}
+{{ declare_initial_function(property_id) }}
 {
-    styleResolver->style()->{{auto_setter}}();
+    state.style()->{{auto_setter}}();
 }
 
-{{ apply_inherit(property_id) }}
+{{ declare_inherit_function(property_id) }}
 {
-    if (styleResolver->parentStyle()->{{auto_getter}}())
-        styleResolver->style()->{{auto_setter}}();
+    if (state.parentStyle()->{{auto_getter}}())
+        state.style()->{{auto_setter}}();
     else
-        {{ set_value(property) }}(styleResolver->parentStyle()->{{property.getter}}());
+        {{ set_value(property) }}(state.parentStyle()->{{property.getter}}());
 }
 
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
     if (!value->isPrimitiveValue())
         return;
 
     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     if (primitiveValue->getValueID() == {{auto_identity}})
-        styleResolver->style()->{{auto_setter}}();
+        state.style()->{{auto_setter}}();
     else
     {%- if compute_length %}
-        {{ set_value(property) }}(primitiveValue->computeLength<{{property.type_name}}>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
+        {{ set_value(property) }}(primitiveValue->computeLength<{{property.type_name}}>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom()));
     {%- else %}
         {{ set_value(property) }}(*primitiveValue);
     {%- endif %}
@@ -144,14 +146,14 @@
 {{ apply_auto("CSSPropertyZIndex") }}
 
 {%- macro apply_value_border_image(property_id) %}
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
     {%- set property = properties[property_id] %}
     NinePieceImage image;
     {%- if property_id == "CSSPropertyWebkitMaskBoxImage" %}
     image.setMaskDefaults();
     {%- endif %}
-    styleResolver->styleMap()->mapNinePieceImage({{property_id}}, value, image);
+    state.styleMap().mapNinePieceImage({{property_id}}, value, image);
     {{ set_value(property) }}(image);
 }
 {%- endmacro %}
@@ -159,32 +161,138 @@
 {{ 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_value_border_radius(property_id) %}
+{{ declare_value_function(property_id) }}
+{
+    {%- set property = properties[property_id] %}
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    Pair* pair = primitiveValue->getPairValue();
+    if (!pair || !pair->first() || !pair->second())
+        return;
+
+    Length radiusWidth = pair->first()->convertToLength<FixedIntegerConversion | CalculatedConversion | PercentConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
+    Length radiusHeight = pair->second()->convertToLength<FixedIntegerConversion | CalculatedConversion | PercentConversion | ViewportPercentageConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
+    int width = radiusWidth.value();
+    int height = radiusHeight.value();
+    if (width < 0 || height < 0)
+        return;
+    if (!width)
+        radiusHeight = radiusWidth; // Null out the other value.
+    else if (!height)
+        radiusWidth = radiusHeight; // Null out the other value.
+
+    LengthSize size(radiusWidth, radiusHeight);
+    {{ set_value(property) }}(size);
+}
+{%- endmacro %}
+
+{{ apply_value_border_radius("CSSPropertyBorderBottomLeftRadius") }}
+{{ apply_value_border_radius("CSSPropertyBorderBottomRightRadius") }}
+{{ apply_value_border_radius("CSSPropertyBorderTopLeftRadius") }}
+{{ apply_value_border_radius("CSSPropertyBorderTopRightRadius") }}
+
 {%- macro apply_color(property_id, default_getter="color", initial_color=none, inherit_color=false) %}
 {%- set property = properties[property_id] %}
-{%- call wrap_with_condition(property.condition) %}
 {%- set visited_link_setter = "setVisitedLink" + property.camel_case_name %}
-{{ apply_initial(property_id) }}
+{{ declare_initial_function(property_id) }}
 {
     Color color = {{ initial_color or "Color" -}}();
-    if (styleResolver->applyPropertyToRegularStyle())
+    if (state.applyPropertyToRegularStyle())
         {{ set_value(property) }}(color);
-    if (styleResolver->applyPropertyToVisitedLinkStyle())
-        styleResolver->style()->{{visited_link_setter}}(color);
+    if (state.applyPropertyToVisitedLinkStyle())
+        state.style()->{{visited_link_setter}}(color);
 }
 
-{{ apply_inherit(property_id) }}
+{{ 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 = styleResolver->parentStyle()->{{property.getter}}();
+    Color color = state.parentStyle()->{{property.getter}}();
     if (!color.isValid())
-        color = styleResolver->parentStyle()->{{default_getter}}();
-    if (styleResolver->applyPropertyToRegularStyle())
+        color = state.parentStyle()->{{default_getter}}();
+    if (state.applyPropertyToRegularStyle())
         {{ set_value(property) }}(color);
-    if (styleResolver->applyPropertyToVisitedLinkStyle())
-        styleResolver->style()->{{visited_link_setter}}(color);
+    if (state.applyPropertyToVisitedLinkStyle())
+        state.style()->{{visited_link_setter}}(color);
 }
 
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
     if (!value->isPrimitiveValue())
         return;
@@ -193,17 +301,16 @@
 
 {%- if inherit_color %}
     if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
-        applyInherit{{property_id}}(styleResolver);
+        applyInherit{{property_id}}(styleResolver, state);
         return;
     }
 {%- endif %}
 
-    if (styleResolver->applyPropertyToRegularStyle())
-        {{ set_value(property) }}(styleResolver->resolveColorFromPrimitiveValue(primitiveValue));
-    if (styleResolver->applyPropertyToVisitedLinkStyle())
-        styleResolver->style()->{{visited_link_setter}}(styleResolver->resolveColorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
+    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 */));
 }
-{%- endcall %}
 {%- endmacro %}
 
 {{ apply_color("CSSPropertyBackgroundColor", default_getter="invalidColor") }}
@@ -219,24 +326,98 @@
 {{ apply_color("CSSPropertyWebkitTextFillColor") }}
 {{ apply_color("CSSPropertyWebkitTextStrokeColor") }}
 
+{%- macro apply_value_compute_length(property_id) %}
+{{ declare_value_function(property_id) }}
+{
+    {%- set property = properties[property_id] %}
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    float zoom = state.style()->effectiveZoom();
+    {{ set_value(property) }}(primitiveValue->computeLength<{{property.type_name}}>(state.style(), state.rootElementStyle(), zoom));
+}
+{%- endmacro %}
+
+{{ apply_value_compute_length("CSSPropertyOutlineOffset") }}
+{{ apply_value_compute_length("CSSPropertyWebkitBorderHorizontalSpacing") }}
+{{ apply_value_compute_length("CSSPropertyWebkitBorderVerticalSpacing") }}
+{{ apply_value_compute_length("CSSPropertyWebkitTransformOriginZ") }}
+
+{%- 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 %}
-{{ apply_initial(property_id) }}
+{{ declare_initial_function(property_id) }}
 {
-    FillLayer* currChild = styleResolver->style()->{{access_layers}}();
+    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}}();
 }
 
-{{ apply_inherit(property_id) }}
+{{ declare_inherit_function(property_id) }}
 {
-    FillLayer* currChild = styleResolver->style()->{{access_layers}}();
+    FillLayer* currChild = state.style()->{{access_layers}}();
     FillLayer* prevChild = 0;
-    const FillLayer* currParent = styleResolver->parentStyle()->{{layer_type|lower}}Layers();
+    const FillLayer* currParent = state.parentStyle()->{{layer_type|lower}}Layers();
     while (currParent && currParent->is{{fill_type}}Set()) {
         if (!currChild) {
             /* Need to make a new layer.*/
@@ -256,9 +437,9 @@
     }
 }
 
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
-    FillLayer* currChild = styleResolver->style()->{{access_layers}}();
+    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. */
@@ -269,12 +450,12 @@
                 currChild = new FillLayer({{fill_layer_type}});
                 prevChild->setNext(currChild);
             }
-            styleResolver->styleMap()->{{map_fill}}({{property_id}}, currChild, valueList->itemWithoutBoundsCheck(i));
+            state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList->itemWithoutBoundsCheck(i));
             prevChild = currChild;
             currChild = currChild->next();
         }
     } else {
-        styleResolver->styleMap()->{{map_fill}}({{property_id}}, currChild, value);
+        state.styleMap().{{map_fill}}({{property_id}}, currChild, value);
         currChild = currChild->next();
     }
     while (currChild) {
@@ -306,8 +487,86 @@
 {{ 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) }}
+{
+    FontDescription fontDescription = state.fontDescription();
+    fontDescription.{{setter}}({{initial}});
+    state.setFontDescription(fontDescription);
+}
+
+{{ declare_inherit_function(property_id) }}
+{
+    FontDescription fontDescription = state.fontDescription();
+    fontDescription.{{setter}}(state.parentFontDescription().{{getter}}());
+    state.setFontDescription(fontDescription);
+}
+
+{{ declare_value_function(property_id) }}
+{
+    if (!value->isPrimitiveValue())
+        return;
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    FontDescription fontDescription = state.fontDescription();
+    fontDescription.{{setter}}(static_cast<{{type_name}}>(*primitiveValue));
+    state.setFontDescription(fontDescription);
+}
+{%- 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_line_width(property_id) %}
+{{ declare_value_function(property_id) }}
+{
+    {%- set property = properties[property_id] %}
+    {%- set T = property.type_name %}
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    CSSValueID valueID = primitiveValue->getValueID();
+    {{ T }} length;
+    if (valueID == CSSValueThin) {
+        length = 1;
+    } else if (valueID == CSSValueMedium) {
+        length = 3;
+    } else if (valueID == CSSValueThick) {
+        length = 5;
+    } else if (valueID == CSSValueInvalid) {
+        float zoom = state.style()->effectiveZoom();
+        // Any original result that was >= 1 should not be allowed to fall below 1.
+        // This keeps border lines from vanishing.
+        length = primitiveValue->computeLength<{{T}}>(state.style(), state.rootElementStyle(), zoom);
+        if (zoom < 1.0f && length < 1.0) {
+            {{ T }} originalLength = primitiveValue->computeLength<{{T}}>(state.style(), state.rootElementStyle(), 1.0);
+            if (originalLength >= 1.0)
+                length = 1.0;
+        }
+    } else {
+        ASSERT_NOT_REACHED();
+        length = 0;
+    }
+    {{ set_value(property) }}(length);
+}
+{%- endmacro %}
+
+{{ apply_value_line_width("CSSPropertyBorderBottomWidth") }}
+{{ apply_value_line_width("CSSPropertyBorderLeftWidth") }}
+{{ apply_value_line_width("CSSPropertyBorderRightWidth") }}
+{{ apply_value_line_width("CSSPropertyBorderTopWidth") }}
+{{ apply_value_line_width("CSSPropertyOutlineWidth") }}
+{{ apply_value_line_width("CSSPropertyWebkitColumnRuleWidth") }}
+
 {%- macro apply_value_number(property_id, id_for_minus_one) %}
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
     {%- set property = properties[property_id] %}
     if (!value->isPrimitiveValue())
@@ -326,8 +585,53 @@
 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitLines", "CSSValueNoLimit") }}
 {{ apply_value_number("CSSPropertyWebkitMarqueeRepetition", "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") }}
+
+{%- macro apply_value_spacing(property_id) %}
+{{ declare_value_function(property_id) }}
+{
+    {%- set property = properties[property_id] %}
+    {%- set T = property.type_name %}
+    if (!value->isPrimitiveValue())
+        return;
+
+    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+    {{ T }} length;
+    if (primitiveValue->getValueID() == CSSValueNormal) {
+        length = 0;
+    } else {
+        float zoom = state.useSVGZoomRules() ? 1.0f : state.style()->effectiveZoom();
+        length = primitiveValue->computeLength<{{T}}>(state.style(), state.rootElementStyle(), zoom);
+    }
+    {{ set_value(property) }}(length);
+}
+{%- endmacro %}
+
+{{ apply_value_spacing("CSSPropertyLetterSpacing") }}
+{{ apply_value_spacing("CSSPropertyWordSpacing") }}
+
 {%- macro apply_value_string(property_id, id_for_none) %}
-{{ apply_value(property_id) }}
+{{ declare_value_function(property_id) }}
 {
     {%- set property = properties[property_id] %}
     if (!value->isPrimitiveValue())
@@ -346,31 +650,4 @@
 {{ apply_value_string("CSSPropertyWebkitFlowFrom", "CSSValueNone") }}
 {{ apply_value_string("CSSPropertyWebkitFlowInto", "CSSValueNone") }}
 
-{{ apply_value("CSSPropertyWebkitMarqueeIncrement") }}
-{
-    if (!value->isPrimitiveValue())
-        return;
-
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    if (primitiveValue->getValueID()) {
-        switch (primitiveValue->getValueID()) {
-        case CSSValueSmall:
-            styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1px.
-            break;
-        case CSSValueNormal:
-            styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.
-            break;
-        case CSSValueLarge:
-            styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.
-            break;
-        default:
-            break;
-        }
-    } else {
-        Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle());
-        if (!marqueeLength.isUndefined())
-            styleResolver->style()->setMarqueeIncrement(marqueeLength);
-    }
-}
-
 } // namespace WebCore
diff --git a/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl b/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl
index 35cff3c..c89324c 100644
--- a/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl
+++ b/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl
@@ -5,15 +5,16 @@
 
 class CSSValue;
 class StyleResolver;
+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}}(StyleResolver* styleResolver);
-    static void applyInherit{{property_id}}(StyleResolver* styleResolver);
-    static void applyValue{{property_id}}(StyleResolver* styleResolver, CSSValue* value);
+    static void applyInitial{{property_id}}(StyleResolver*, StyleResolverState&);
+    static void applyInherit{{property_id}}(StyleResolver*, StyleResolverState&);
+    static void applyValue{{property_id}}(StyleResolver*, StyleResolverState&, CSSValue*);
 {%- endcall %}
 {%- endfor %}
 
diff --git a/Source/core/svg/GradientAttributes.h b/Source/core/svg/GradientAttributes.h
index c8baf2f..da09cb6 100644
--- a/Source/core/svg/GradientAttributes.h
+++ b/Source/core/svg/GradientAttributes.h
@@ -20,8 +20,7 @@
 #ifndef GradientAttributes_h
 #define GradientAttributes_h
 
-#include "core/svg/SVGGradientElement.h"
-#include "core/svg/SVGLength.h"
+#include "core/svg/SVGUnitTypes.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGAElement.cpp b/Source/core/svg/SVGAElement.cpp
index 0f360ee..0e89ba0 100644
--- a/Source/core/svg/SVGAElement.cpp
+++ b/Source/core/svg/SVGAElement.cpp
@@ -34,7 +34,9 @@
 #include "core/dom/MouseEvent.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/html/HTMLAnchorElement.h"
+#include "core/html/HTMLFormElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
+#include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderTypes.h"
 #include "core/page/Chrome.h"
@@ -94,7 +96,6 @@
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
         SVGURIReference::addSupportedAttributes(supportedAttributes);
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::targetAttr);
     }
@@ -115,8 +116,6 @@
 
     if (SVGURIReference::parseAttribute(name, value))
         return;
-    if (SVGLangSpace::parseAttribute(name, value))
-        return;
     if (SVGExternalResourcesRequired::parseAttribute(name, value))
         return;
 
@@ -136,7 +135,7 @@
     // as none of the other properties changes the linking behaviour for our <a> element.
     if (SVGURIReference::isKnownAttribute(attrName)) {
         bool wasLink = isLink();
-        setIsLink(!href().isNull());
+        setIsLink(!hrefCurrentValue().isNull());
 
         if (wasLink != isLink())
             setNeedsStyleRecalc();
@@ -161,7 +160,7 @@
         }
 
         if (isLinkClick(event)) {
-            String url = stripLeadingAndTrailingHTMLSpaces(href());
+            String url = stripLeadingAndTrailingHTMLSpaces(hrefCurrentValue());
 
             if (url[0] == '#') {
                 Element* targetElement = treeScope()->getElementById(url.substring(1));
@@ -183,7 +182,9 @@
             Frame* frame = document()->frame();
             if (!frame)
                 return;
-            frame->loader()->urlSelected(document()->completeURL(url), target, event, false, MaybeSendReferrer);
+            FrameLoadRequest frameRequest(document()->securityOrigin(), ResourceRequest(document()->completeURL(url)), target);
+            frameRequest.setTriggeringEvent(event);
+            frame->loader()->load(frameRequest);
             return;
         }
     }
diff --git a/Source/core/svg/SVGAElement.h b/Source/core/svg/SVGAElement.h
index 5e72e1f..63d76f0 100644
--- a/Source/core/svg/SVGAElement.h
+++ b/Source/core/svg/SVGAElement.h
@@ -41,7 +41,7 @@
     virtual bool isValid() const { return SVGTests::isValid(); }
     
     virtual String title() const;
-    virtual String target() const { return svgTarget(); }
+    virtual String target() const { return svgTargetCurrentValue(); }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
diff --git a/Source/core/svg/SVGAElement.idl b/Source/core/svg/SVGAElement.idl
index 426b395..7180fc0 100644
--- a/Source/core/svg/SVGAElement.idl
+++ b/Source/core/svg/SVGAElement.idl
@@ -24,7 +24,7 @@
  */
 
 interface SVGAElement : SVGGraphicsElement {
-    readonly attribute SVGAnimatedString target;
+    [ImplementedAs=svgTarget] readonly attribute SVGAnimatedString target;
 };
 
 SVGAElement implements SVGExternalResourcesRequired;
diff --git a/Source/core/svg/SVGAltGlyphElement.cpp b/Source/core/svg/SVGAltGlyphElement.cpp
index c102595..87d2e6a 100644
--- a/Source/core/svg/SVGAltGlyphElement.cpp
+++ b/Source/core/svg/SVGAltGlyphElement.cpp
@@ -57,7 +57,7 @@
 
 void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 const AtomicString& SVGAltGlyphElement::glyphRef() const
@@ -67,7 +67,7 @@
 
 void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 const AtomicString& SVGAltGlyphElement::format() const
diff --git a/Source/core/svg/SVGAngle.cpp b/Source/core/svg/SVGAngle.cpp
index a90953b..c703678 100644
--- a/Source/core/svg/SVGAngle.cpp
+++ b/Source/core/svg/SVGAngle.cpp
@@ -163,7 +163,7 @@
     bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUnits, unitType)
                                   : parseValue<UChar>(value, valueInSpecifiedUnits, unitType);
     if (!success) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
@@ -174,7 +174,7 @@
 void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionCode& ec)
 {
     if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
@@ -187,7 +187,7 @@
 void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionCode& ec)
 {
     if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
diff --git a/Source/core/svg/SVGAnimateElement.cpp b/Source/core/svg/SVGAnimateElement.cpp
index e6eedae..6f654df 100644
--- a/Source/core/svg/SVGAnimateElement.cpp
+++ b/Source/core/svg/SVGAnimateElement.cpp
@@ -29,6 +29,8 @@
 #include "core/css/CSSParser.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/QualifiedName.h"
+#include "core/svg/SVGAnimatedType.h"
+#include "core/svg/SVGAnimatedTypeAnimator.h"
 #include "core/svg/SVGAnimatorFactory.h"
 
 namespace WebCore {
@@ -241,14 +243,14 @@
     if (!propertySet->setProperty(id, value, false, 0))
         return;
 
-    targetElement->setNeedsStyleRecalc(SyntheticStyleChange);
+    targetElement->setNeedsStyleRecalc(LocalStyleChange);
 }
 
 static inline void removeCSSPropertyFromTarget(SVGElement* targetElement, CSSPropertyID id)
 {
     ASSERT(!targetElement->m_deletionHasBegun);
     targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id);
-    targetElement->setNeedsStyleRecalc(SyntheticStyleChange);
+    targetElement->setNeedsStyleRecalc(LocalStyleChange);
 }
 
 static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName, const String& valueAsString)
diff --git a/Source/core/svg/SVGAnimateElement.h b/Source/core/svg/SVGAnimateElement.h
index 15fca13..1e39832 100644
--- a/Source/core/svg/SVGAnimateElement.h
+++ b/Source/core/svg/SVGAnimateElement.h
@@ -23,14 +23,14 @@
 #ifndef SVGAnimateElement_h
 #define SVGAnimateElement_h
 
-#include "core/svg/SVGAnimatedType.h"
-#include "core/svg/SVGAnimatedTypeAnimator.h"
 #include "core/svg/SVGAnimationElement.h"
 #include <wtf/OwnPtr.h>
 
 namespace WebCore {
     
 class SVGAnimatedProperty;
+class SVGAnimatedType;
+class SVGAnimatedTypeAnimator;
 
 class SVGAnimateElement : public SVGAnimationElement {
 public:
diff --git a/Source/core/svg/SVGAnimateMotionElement.cpp b/Source/core/svg/SVGAnimateMotionElement.cpp
index 1a468f3..23ede7d 100644
--- a/Source/core/svg/SVGAnimateMotionElement.cpp
+++ b/Source/core/svg/SVGAnimateMotionElement.cpp
@@ -24,6 +24,7 @@
 #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"
diff --git a/Source/core/svg/SVGAnimateMotionElement.h b/Source/core/svg/SVGAnimateMotionElement.h
index c6777d0..2be152c 100644
--- a/Source/core/svg/SVGAnimateMotionElement.h
+++ b/Source/core/svg/SVGAnimateMotionElement.h
@@ -22,10 +22,11 @@
 #define SVGAnimateMotionElement_h
 
 #include "core/platform/graphics/Path.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGAnimationElement.h"
 
 namespace WebCore {
+
+class AffineTransform;
             
 class SVGAnimateMotionElement FINAL : public SVGAnimationElement {
 public:
diff --git a/Source/core/svg/SVGAnimatedRect.cpp b/Source/core/svg/SVGAnimatedRect.cpp
index 8301cc6..6c74641 100644
--- a/Source/core/svg/SVGAnimatedRect.cpp
+++ b/Source/core/svg/SVGAnimatedRect.cpp
@@ -33,7 +33,7 @@
 
 PassOwnPtr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
 {
-    OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createRect(new FloatRect);
+    OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createRect(new SVGRect);
     parseRect(string, animatedType->rect());
     return animatedType.release();
 }
@@ -76,10 +76,10 @@
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
-    const FloatRect& fromRect = m_animationElement->animationMode() == ToAnimation ? animated->rect() : from->rect();
-    const FloatRect& toRect = to->rect();
-    const FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->rect();
-    FloatRect& animatedRect = animated->rect();
+    const SVGRect& fromRect = m_animationElement->animationMode() == ToAnimation ? animated->rect() : from->rect();
+    const SVGRect& toRect = to->rect();
+    const SVGRect& toAtEndOfDurationRect = toAtEndOfDuration->rect();
+    SVGRect& animatedRect = animated->rect();
 
     float animatedX = animatedRect.x();
     float animatedY = animatedRect.y();
@@ -90,7 +90,7 @@
     m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.width(), toRect.width(), toAtEndOfDurationRect.width(), animatedWidth);
     m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.height(), toRect.height(), toAtEndOfDurationRect.height(), animatedHeight);
 
-    animatedRect = FloatRect(animatedX, animatedY, animatedWidth, animatedHeight);
+    animatedRect = SVGRect(animatedX, animatedY, animatedWidth, animatedHeight);
 }
 
 float SVGAnimatedRectAnimator::calculateDistance(const String&, const String&)
diff --git a/Source/core/svg/SVGAnimatedRect.h b/Source/core/svg/SVGAnimatedRect.h
index aa3997a..ccbaef8 100644
--- a/Source/core/svg/SVGAnimatedRect.h
+++ b/Source/core/svg/SVGAnimatedRect.h
@@ -27,14 +27,14 @@
 
 namespace WebCore {
 
-typedef SVGAnimatedPropertyTearOff<FloatRect> SVGAnimatedRect;
+typedef SVGAnimatedPropertyTearOff<SVGRect> SVGAnimatedRect;
 
 // Helper macros to declare/define a SVGAnimatedRect object
 #define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \
-DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty)
+DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, SVGRect, UpperProperty, LowerProperty)
 
 #define DEFINE_ANIMATED_RECT(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
-DEFINE_ANIMATED_PROPERTY(AnimatedRect, OwnerType, DOMAttribute, DOMAttribute.localName(), UpperProperty, LowerProperty, SVGAnimatedRect, FloatRect)
+DEFINE_ANIMATED_PROPERTY(AnimatedRect, OwnerType, DOMAttribute, DOMAttribute.localName(), UpperProperty, LowerProperty, SVGAnimatedRect, SVGRect)
 
 class SVGAnimationElement;
 
@@ -53,8 +53,6 @@
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
-
-    static bool parseSVGRect(const String&, FloatRect&);
 };
 
 } // namespace WebCore
diff --git a/Source/core/svg/SVGAnimatedType.cpp b/Source/core/svg/SVGAnimatedType.cpp
index e8f624b..dbcff24 100644
--- a/Source/core/svg/SVGAnimatedType.cpp
+++ b/Source/core/svg/SVGAnimatedType.cpp
@@ -203,7 +203,7 @@
     return animatedType.release();
 }
 
-PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createRect(FloatRect* rect)
+PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createRect(SVGRect* rect)
 {
     ASSERT(rect);
     OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedRect));
diff --git a/Source/core/svg/SVGAnimatedType.h b/Source/core/svg/SVGAnimatedType.h
index 2051587..53c6216 100644
--- a/Source/core/svg/SVGAnimatedType.h
+++ b/Source/core/svg/SVGAnimatedType.h
@@ -20,7 +20,6 @@
 #ifndef SVGAnimatedType_h
 #define SVGAnimatedType_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/svg/SVGAngle.h"
 #include "core/svg/SVGColor.h"
 #include "core/svg/SVGLength.h"
@@ -28,6 +27,7 @@
 #include "core/svg/SVGNumberList.h"
 #include "core/svg/SVGPointList.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
+#include "core/svg/SVGRect.h"
 #include "core/svg/SVGTransformList.h"
 #include "core/svg/properties/SVGPropertyInfo.h"
 
@@ -54,7 +54,7 @@
     static PassOwnPtr<SVGAnimatedType> createPath(PassOwnPtr<SVGPathByteStream>);
     static PassOwnPtr<SVGAnimatedType> createPointList(SVGPointList*);
     static PassOwnPtr<SVGAnimatedType> createPreserveAspectRatio(SVGPreserveAspectRatio*);
-    static PassOwnPtr<SVGAnimatedType> createRect(FloatRect*);
+    static PassOwnPtr<SVGAnimatedType> createRect(SVGRect*);
     static PassOwnPtr<SVGAnimatedType> createString(String*);
     static PassOwnPtr<SVGAnimatedType> createTransformList(SVGTransformList*);
     static bool supportsAnimVal(AnimatedPropertyType);
@@ -146,7 +146,7 @@
         return *m_data.preserveAspectRatio;
     }
 
-    const FloatRect& rect() const
+    const SVGRect& rect() const
     {
         ASSERT(m_type == AnimatedRect);
         return *m_data.rect;
@@ -249,7 +249,7 @@
         return *m_data.preserveAspectRatio;
     }
 
-    FloatRect& rect()
+    SVGRect& rect()
     {
         ASSERT(m_type == AnimatedRect);
         return *m_data.rect;
@@ -295,7 +295,7 @@
         SVGPathByteStream* path;
         SVGPreserveAspectRatio* preserveAspectRatio;
         SVGPointList* pointList;
-        FloatRect* rect;
+        SVGRect* rect;
         String* string;
         SVGTransformList* transformList;
     } m_data;
diff --git a/Source/core/svg/SVGAnimatedTypeAnimator.cpp b/Source/core/svg/SVGAnimatedTypeAnimator.cpp
new file mode 100644
index 0000000..290b538
--- /dev/null
+++ b/Source/core/svg/SVGAnimatedTypeAnimator.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. 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/svg/SVGAnimatedTypeAnimator.h"
+
+#include "core/svg/SVGElement.h"
+#include "core/svg/properties/SVGAttributeToPropertyMap.h"
+
+namespace WebCore {
+
+SVGElementAnimatedProperties::SVGElementAnimatedProperties()
+    : element(0)
+{ }
+
+SVGElementAnimatedProperties::SVGElementAnimatedProperties(SVGElement* element, Vector<RefPtr<SVGAnimatedProperty> >& properties)
+    : element(element)
+    , properties(properties)
+{ }
+
+SVGAnimatedTypeAnimator::SVGAnimatedTypeAnimator(AnimatedPropertyType type, SVGAnimationElement* animationElement, SVGElement* contextElement)
+    : m_type(type)
+    , m_animationElement(animationElement)
+    , m_contextElement(contextElement)
+{
+}
+
+SVGAnimatedTypeAnimator::~SVGAnimatedTypeAnimator()
+{
+}
+
+void SVGAnimatedTypeAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+{
+    from = constructFromString(fromString);
+    to = constructFromString(toString);
+}
+
+void SVGAnimatedTypeAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
+{
+    from = constructFromString(fromString);
+    to = constructFromString(byString);
+    addAnimatedTypes(from.get(), to.get());
+}
+
+SVGElementAnimatedPropertyList SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName(SVGElement* targetElement, const QualifiedName& attributeName)
+{
+    ASSERT(targetElement);
+
+    SVGElementAnimatedPropertyList propertiesByInstance;
+
+    Vector<RefPtr<SVGAnimatedProperty> > targetProperties;
+    targetElement->localAttributeToPropertyMap().animatedPropertiesForAttribute(targetElement, attributeName, targetProperties);
+
+    if (!SVGAnimatedType::supportsAnimVal(m_type))
+        return SVGElementAnimatedPropertyList();
+
+    SVGElementAnimatedProperties propertiesPair(targetElement, targetProperties);
+    propertiesByInstance.append(propertiesPair);
+
+    const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement();
+    const HashSet<SVGElementInstance*>::const_iterator end = instances.end();
+    for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {
+        SVGElement* shadowTreeElement = (*it)->shadowTreeElement();
+        if (!shadowTreeElement)
+            continue;
+
+        Vector<RefPtr<SVGAnimatedProperty> > instanceProperties;
+        targetElement->localAttributeToPropertyMap().animatedPropertiesForAttribute(shadowTreeElement, attributeName, instanceProperties);
+
+        SVGElementAnimatedProperties instancePropertiesPair(shadowTreeElement, instanceProperties);
+        propertiesByInstance.append(instancePropertiesPair);
+    }
+
+#if !ASSERT_DISABLED
+    SVGElementAnimatedPropertyList::const_iterator propertiesEnd = propertiesByInstance.end();
+    for (SVGElementAnimatedPropertyList::const_iterator it = propertiesByInstance.begin(); it != propertiesEnd; ++it) {
+        size_t propertiesSize = it->properties.size();
+        for (size_t i = 0; i < propertiesSize; ++i) {
+            RefPtr<SVGAnimatedProperty> property = it->properties[i];
+            if (property->animatedPropertyType() != m_type) {
+                ASSERT(m_type == AnimatedAngle);
+                ASSERT(property->animatedPropertyType() == AnimatedEnumeration);
+            }
+        }
+    }
+#endif
+
+    return propertiesByInstance;
+}
+
+}
diff --git a/Source/core/svg/SVGAnimatedTypeAnimator.h b/Source/core/svg/SVGAnimatedTypeAnimator.h
index b690fdd..0c7e880 100644
--- a/Source/core/svg/SVGAnimatedTypeAnimator.h
+++ b/Source/core/svg/SVGAnimatedTypeAnimator.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -23,20 +24,14 @@
 #include "core/svg/SVGAnimatedType.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/properties/SVGAnimatedProperty.h"
-#include "core/svg/properties/SVGAttributeToPropertyMap.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
 struct SVGElementAnimatedProperties {
-    SVGElementAnimatedProperties()
-        : element(0)
-    { }
+    SVGElementAnimatedProperties();
 
-    SVGElementAnimatedProperties(SVGElement* element, Vector<RefPtr<SVGAnimatedProperty> >& properties)
-        : element(element)
-        , properties(properties)
-    { }
+    SVGElementAnimatedProperties(SVGElement*, Vector<RefPtr<SVGAnimatedProperty> >&);
 
     SVGElement* element;
     Vector<RefPtr<SVGAnimatedProperty> > properties;
@@ -48,7 +43,7 @@
 class SVGAnimatedTypeAnimator {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    virtual ~SVGAnimatedTypeAnimator() { }
+    virtual ~SVGAnimatedTypeAnimator();
     virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&) = 0;
 
     virtual PassOwnPtr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) = 0;
@@ -61,75 +56,16 @@
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) = 0;
     virtual float calculateDistance(const String& fromString, const String& toString) = 0;
 
-    void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
-    {
-        from = constructFromString(fromString);
-        to = constructFromString(toString);
-    }
-
-    void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
-    {
-        from = constructFromString(fromString);
-        to = constructFromString(byString);
-        addAnimatedTypes(from.get(), to.get());
-    }
+    void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString);
+    void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString);
 
     void setContextElement(SVGElement* contextElement) { m_contextElement = contextElement; }
     AnimatedPropertyType type() const { return m_type; }
 
-    SVGElementAnimatedPropertyList findAnimatedPropertiesForAttributeName(SVGElement* targetElement, const QualifiedName& attributeName)
-    {
-        ASSERT(targetElement);
-
-        SVGElementAnimatedPropertyList propertiesByInstance;
-
-        Vector<RefPtr<SVGAnimatedProperty> > targetProperties;
-        targetElement->localAttributeToPropertyMap().animatedPropertiesForAttribute(targetElement, attributeName, targetProperties);
-
-        if (!SVGAnimatedType::supportsAnimVal(m_type))
-            return SVGElementAnimatedPropertyList();
-
-        SVGElementAnimatedProperties propertiesPair(targetElement, targetProperties);
-        propertiesByInstance.append(propertiesPair);
-
-        const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement();
-        const HashSet<SVGElementInstance*>::const_iterator end = instances.end();
-        for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {
-            SVGElement* shadowTreeElement = (*it)->shadowTreeElement();
-            if (!shadowTreeElement)
-                continue;
-
-            Vector<RefPtr<SVGAnimatedProperty> > instanceProperties;
-            targetElement->localAttributeToPropertyMap().animatedPropertiesForAttribute(shadowTreeElement, attributeName, instanceProperties);
-
-            SVGElementAnimatedProperties instancePropertiesPair(shadowTreeElement, instanceProperties);
-            propertiesByInstance.append(instancePropertiesPair);
-        }
-
-#if !ASSERT_DISABLED
-        SVGElementAnimatedPropertyList::const_iterator propertiesEnd = propertiesByInstance.end();
-        for (SVGElementAnimatedPropertyList::const_iterator it = propertiesByInstance.begin(); it != propertiesEnd; ++it) {
-            size_t propertiesSize = it->properties.size();
-            for (size_t i = 0; i < propertiesSize; ++i) {
-                RefPtr<SVGAnimatedProperty> property = it->properties[i];
-                if (property->animatedPropertyType() != m_type) {
-                    ASSERT(m_type == AnimatedAngle);
-                    ASSERT(property->animatedPropertyType() == AnimatedEnumeration);
-                }
-            }
-        }
-#endif
-
-        return propertiesByInstance;
-    }
+    SVGElementAnimatedPropertyList findAnimatedPropertiesForAttributeName(SVGElement*, const QualifiedName&);
 
 protected:
-    SVGAnimatedTypeAnimator(AnimatedPropertyType type, SVGAnimationElement* animationElement, SVGElement* contextElement)
-        : m_type(type)
-        , m_animationElement(animationElement)
-        , m_contextElement(contextElement)
-    {
-    }
+    SVGAnimatedTypeAnimator(AnimatedPropertyType, SVGAnimationElement*, SVGElement*);
 
     // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
     template<typename AnimValType>
diff --git a/Source/core/svg/SVGAnimationElement.cpp b/Source/core/svg/SVGAnimationElement.cpp
index 8373fbb..0717ce7 100644
--- a/Source/core/svg/SVGAnimationElement.cpp
+++ b/Source/core/svg/SVGAnimationElement.cpp
@@ -30,6 +30,7 @@
 #include "SVGNames.h"
 #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/SVGParserUtilities.h"
@@ -58,6 +59,8 @@
 {
     ScriptWrappable::init(this);
     registerAnimatedPropertiesForSVGAnimationElement();
+
+    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 5f37fe0..9108719 100644
--- a/Source/core/svg/SVGAnimationElement.h
+++ b/Source/core/svg/SVGAnimationElement.h
@@ -28,9 +28,7 @@
 #include "core/platform/graphics/UnitBezier.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGExternalResourcesRequired.h"
-#include "core/svg/SVGStringList.h"
 #include "core/svg/SVGTests.h"
-#include "core/svg/animation/SMILTime.h"
 #include "core/svg/animation/SVGSMILElement.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGCircleElement.cpp b/Source/core/svg/SVGCircleElement.cpp
index 761807b..3039498 100644
--- a/Source/core/svg/SVGCircleElement.cpp
+++ b/Source/core/svg/SVGCircleElement.cpp
@@ -129,9 +129,9 @@
 
 bool SVGCircleElement::selfHasRelativeLengths() const
 {
-    return cx().isRelative()
-        || cy().isRelative()
-        || r().isRelative();
+    return cxCurrentValue().isRelative()
+        || cyCurrentValue().isRelative()
+        || rCurrentValue().isRelative();
 }
 
 RenderObject* SVGCircleElement::createRenderer(RenderStyle*)
diff --git a/Source/core/svg/SVGClipPathElement.cpp b/Source/core/svg/SVGClipPathElement.cpp
index 23b9971..db973a9 100644
--- a/Source/core/svg/SVGClipPathElement.cpp
+++ b/Source/core/svg/SVGClipPathElement.cpp
@@ -57,7 +57,6 @@
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::clipPathUnitsAttr);
     }
@@ -78,8 +77,6 @@
         return;
     }
 
-    if (SVGLangSpace::parseAttribute(name, value))
-        return;
     if (SVGExternalResourcesRequired::parseAttribute(name, value))
         return;
 
diff --git a/Source/core/svg/SVGColor.cpp b/Source/core/svg/SVGColor.cpp
index 91f93ed..6279065 100644
--- a/Source/core/svg/SVGColor.cpp
+++ b/Source/core/svg/SVGColor.cpp
@@ -59,17 +59,17 @@
 {
     // The whole SVGColor interface is deprecated in SVG 1.1 (2nd edition).
     // The setters are the most problematic part so we remove the support for those first.
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 void SVGColor::setRGBColorICCColor(const String&, const String&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 void SVGColor::setColor(unsigned short, const String&, const String&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 String SVGColor::customCssText() const
diff --git a/Source/core/svg/SVGComponentTransferFunctionElement.cpp b/Source/core/svg/SVGComponentTransferFunctionElement.cpp
index 996a171..ccd0676 100644
--- a/Source/core/svg/SVGComponentTransferFunctionElement.cpp
+++ b/Source/core/svg/SVGComponentTransferFunctionElement.cpp
@@ -140,13 +140,13 @@
 ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const
 {
     ComponentTransferFunction func;
-    func.type = type();
-    func.slope = slope();
-    func.intercept = intercept();
-    func.amplitude = amplitude();
-    func.exponent = exponent();
-    func.offset = offset();
-    func.tableValues = tableValues();
+    func.type = typeCurrentValue();
+    func.slope = slopeCurrentValue();
+    func.intercept = interceptCurrentValue();
+    func.amplitude = amplitudeCurrentValue();
+    func.exponent = exponentCurrentValue();
+    func.offset = offsetCurrentValue();
+    func.tableValues = tableValuesCurrentValue();
     return func;
 }
 
diff --git a/Source/core/svg/SVGCursorElement.cpp b/Source/core/svg/SVGCursorElement.cpp
index 73decae..3b04d6e 100644
--- a/Source/core/svg/SVGCursorElement.cpp
+++ b/Source/core/svg/SVGCursorElement.cpp
@@ -23,6 +23,7 @@
 #include "core/svg/SVGCursorElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/Document.h"
 #include "core/svg/SVGElementInstance.h"
 
@@ -137,7 +138,7 @@
 {
     SVGElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document()->completeURL(href()));
+    addSubresourceURL(urls, document()->completeURL(hrefCurrentValue()));
 }
 
 }
diff --git a/Source/core/svg/SVGDocument.cpp b/Source/core/svg/SVGDocument.cpp
index 17e522b..06dd368 100644
--- a/Source/core/svg/SVGDocument.cpp
+++ b/Source/core/svg/SVGDocument.cpp
@@ -35,8 +35,8 @@
 
 namespace WebCore {
 
-SVGDocument::SVGDocument(Frame* frame, const KURL& url)
-    : Document(frame, url, SVGDocumentClass)
+SVGDocument::SVGDocument(const DocumentInit& initializer)
+    : Document(initializer, SVGDocumentClass)
 {
     ScriptWrappable::init(this);
 }
diff --git a/Source/core/svg/SVGDocument.h b/Source/core/svg/SVGDocument.h
index 42c82a5..273db02 100644
--- a/Source/core/svg/SVGDocument.h
+++ b/Source/core/svg/SVGDocument.h
@@ -32,9 +32,9 @@
 
 class SVGDocument FINAL : public Document {
 public:
-    static PassRefPtr<SVGDocument> create(Frame* frame, const KURL& url)
+    static PassRefPtr<SVGDocument> create(const DocumentInit& initializer = DocumentInit())
     {
-        return adoptRef(new SVGDocument(frame, url));
+        return adoptRef(new SVGDocument(initializer));
     }
 
     SVGSVGElement* rootElement() const;
@@ -48,7 +48,7 @@
     void updatePan(const FloatPoint& pos) const;
 
 private:
-    SVGDocument(Frame*, const KURL&);
+    SVGDocument(const DocumentInit&);
 
     virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
 
diff --git a/Source/core/svg/SVGDocumentExtensions.h b/Source/core/svg/SVGDocumentExtensions.h
index 65a2faf..7f29f65 100644
--- a/Source/core/svg/SVGDocumentExtensions.h
+++ b/Source/core/svg/SVGDocumentExtensions.h
@@ -24,9 +24,7 @@
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/text/AtomicStringHash.h>
-#include <wtf/text/StringImpl.h>
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index bd26841..d2ce74e 100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -27,6 +27,7 @@
 
 #include "HTMLNames.h"
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "XMLNames.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/css/CSSCursorImageValue.h"
@@ -89,7 +90,11 @@
 
 void SVGElement::willRecalcStyle(StyleChange change)
 {
-    if (!hasSVGRareData() || needsLayerUpdate())
+    // FIXME: This assumes that when shouldNotifyRendererWithIdenticalStyles() is true
+    // the change came from a SMIL animation, but what if there were non-SMIL changes
+    // since then? I think we should remove the shouldNotifyRendererWithIdenticalStyles
+    // check.
+    if (!hasSVGRareData() || shouldNotifyRendererWithIdenticalStyles())
         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.
@@ -315,6 +320,10 @@
         setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, name, value));
     else if (name == onmousedownAttr)
         setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, name, value));
+    else if (name == onmouseenterAttr)
+        setAttributeEventListener(eventNames().mouseenterEvent, createAttributeEventListener(this, name, value));
+    else if (name == onmouseleaveAttr)
+        setAttributeEventListener(eventNames().mouseleaveEvent, createAttributeEventListener(this, name, value));
     else if (name == onmousemoveAttr)
         setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, name, value));
     else if (name == onmouseoutAttr)
diff --git a/Source/core/svg/SVGElementInstance.cpp b/Source/core/svg/SVGElementInstance.cpp
index 513c6cb..a7b6398 100644
--- a/Source/core/svg/SVGElementInstance.cpp
+++ b/Source/core/svg/SVGElementInstance.cpp
@@ -27,6 +27,7 @@
 #include "core/dom/Event.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
+#include "core/svg/SVGElement.h"
 #include "core/svg/SVGElementInstanceList.h"
 #include "core/svg/SVGUseElement.h"
 
@@ -36,6 +37,55 @@
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, instanceCounter, ("WebCoreSVGElementInstance"));
 
+// EventTarget API
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), abort);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), blur);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), change);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), click);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), contextmenu);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), dblclick);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), error);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), focus);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), input);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), keydown);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), keypress);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), keyup);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), load);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mousedown);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mouseenter);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mouseleave);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mousemove);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mouseout);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mouseover);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mouseup);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), mousewheel);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), beforecut);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), cut);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), beforecopy);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), copy);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), beforepaste);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), paste);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), dragenter);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), dragover);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), dragleave);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), drop);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), dragstart);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), drag);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), dragend);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), reset);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), resize);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), scroll);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), search);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), select);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), selectstart);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), submit);
+DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(SVGElementInstance, correspondingElement(), unload);
+
+PassRefPtr<SVGElementInstance> SVGElementInstance::create(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement)
+{
+    return adoptRef(new SVGElementInstance(correspondingUseElement, directUseElement, originalElement));
+}
+
 SVGElementInstance::SVGElementInstance(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement)
     : m_parentInstance(0)
     , m_correspondingUseElement(correspondingUseElement)
@@ -172,6 +222,16 @@
     m_element->removeAllEventListeners();
 }
 
+Node* SVGElementInstance::toNode()
+{
+    return shadowTreeElement();
+}
+
+Document* SVGElementInstance::ownerDocument() const
+{
+    return m_element ? m_element->ownerDocument() : 0;
+}
+
 bool SVGElementInstance::dispatchEvent(PassRefPtr<Event> event)
 {
     SVGElement* element = shadowTreeElement();
diff --git a/Source/core/svg/SVGElementInstance.h b/Source/core/svg/SVGElementInstance.h
index 7f84692..8e0e86e 100644
--- a/Source/core/svg/SVGElementInstance.h
+++ b/Source/core/svg/SVGElementInstance.h
@@ -24,7 +24,6 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/EventTarget.h"
 #include "core/platform/TreeShared.h"
-#include "core/svg/SVGElement.h"
 
 namespace WebCore {
 
@@ -33,17 +32,16 @@
 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container);
 };
 
-class SVGUseElement;
+class Document;
+class SVGElement;
 class SVGElementInstanceList;
 class SVGStyledElement;
+class SVGUseElement;
 
 // SVGElementInstance mimics Node, but without providing all its functionality
 class SVGElementInstance : public EventTarget, public ScriptWrappable, public TreeShared<SVGElementInstance> {
 public:
-    static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement)
-    {
-        return adoptRef(new SVGElementInstance(correspondingUseElement, directUseElement, originalElement));
-    }
+    static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement);
 
     virtual ~SVGElementInstance();
 
@@ -75,7 +73,7 @@
     SVGElementInstance* firstChild() const { return m_firstChild; }
     SVGElementInstance* lastChild() const { return m_lastChild; }
 
-    Document* ownerDocument() const { return m_element ? m_element->ownerDocument() : 0; }
+    inline Document* ownerDocument() const;
 
     class InvalidationGuard {
         WTF_MAKE_NONCOPYABLE(InvalidationGuard);
@@ -102,46 +100,48 @@
     using TreeShared<SVGElementInstance>::deref;
 
     // EventTarget API
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextmenu);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), input);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keydown);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keypress);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keyup);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), load);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousedown);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousemove);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseout);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseover);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseup);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousewheel);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecut);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), cut);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecopy);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), copy);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforepaste);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), paste);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragenter);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragover);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragleave);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drop);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragstart);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drag);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragend);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), reset);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), resize);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), scroll);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), search);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), select);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectstart);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit);
-    DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextmenu);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), input);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keydown);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keypress);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keyup);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), load);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousedown);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseenter);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseleave);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousemove);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseout);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseover);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseup);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousewheel);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecut);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), cut);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecopy);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), copy);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforepaste);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), paste);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragenter);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragover);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragleave);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drop);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragstart);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drag);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragend);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), reset);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), resize);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), scroll);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), search);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), select);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectstart);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit);
+    DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload);
 
 private:
     friend class SVGUseElement;
@@ -152,7 +152,7 @@
     void removedLastRef();
     bool hasTreeSharedParent() const { return !!m_parentInstance; }
 
-    virtual Node* toNode() { return shadowTreeElement(); }
+    virtual Node* toNode();
 
     void appendChild(PassRefPtr<SVGElementInstance> child);
     void setShadowTreeElement(SVGElement*);
diff --git a/Source/core/svg/SVGElementInstance.idl b/Source/core/svg/SVGElementInstance.idl
index 083e3ed..82cf40b 100644
--- a/Source/core/svg/SVGElementInstance.idl
+++ b/Source/core/svg/SVGElementInstance.idl
@@ -24,9 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-[
-    EventTarget
-] interface SVGElementInstance : EventTarget
+interface SVGElementInstance : EventTarget
 {
     readonly attribute SVGElement correspondingElement;
     readonly attribute SVGUseElement correspondingUseElement;
@@ -52,6 +50,8 @@
     [NotEnumerable] attribute EventListener onkeyup;
     [NotEnumerable] attribute EventListener onload;
     [NotEnumerable] attribute EventListener onmousedown;
+    [NotEnumerable] attribute EventListener onmouseenter;
+    [NotEnumerable] attribute EventListener onmouseleave;
     [NotEnumerable] attribute EventListener onmousemove;
     [NotEnumerable] attribute EventListener onmouseout;
     [NotEnumerable] attribute EventListener onmouseover;
diff --git a/Source/core/svg/SVGElementInstanceList.cpp b/Source/core/svg/SVGElementInstanceList.cpp
index 94157d7..c9f112d 100644
--- a/Source/core/svg/SVGElementInstanceList.cpp
+++ b/Source/core/svg/SVGElementInstanceList.cpp
@@ -20,6 +20,7 @@
 #include "config.h"
 
 #include "core/svg/SVGElementInstanceList.h"
+#include "core/svg/SVGElementInstance.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGElementInstanceList.h b/Source/core/svg/SVGElementInstanceList.h
index 4b54fd1..f0fe1eb 100644
--- a/Source/core/svg/SVGElementInstanceList.h
+++ b/Source/core/svg/SVGElementInstanceList.h
@@ -21,11 +21,12 @@
 #define SVGElementInstanceList_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/svg/SVGElementInstance.h"
 #include "wtf/RefCounted.h"
 
 namespace WebCore {
 
+class SVGElementInstance;
+
 class SVGElementInstanceList : public RefCounted<SVGElementInstanceList>, public ScriptWrappable {
 public:
     static PassRefPtr<SVGElementInstanceList> create(PassRefPtr<SVGElementInstance> root) { return adoptRef(new SVGElementInstanceList(root)); }
diff --git a/Source/core/svg/SVGElementRareData.h b/Source/core/svg/SVGElementRareData.h
index f86b0ab..8bb4484 100644
--- a/Source/core/svg/SVGElementRareData.h
+++ b/Source/core/svg/SVGElementRareData.h
@@ -20,7 +20,6 @@
 #ifndef SVGElementRareData_h
 #define SVGElementRareData_h
 
-#include "core/css/CSSParserMode.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/resolver/StyleResolver.h"
 #include <wtf/HashSet.h>
diff --git a/Source/core/svg/SVGEllipseElement.cpp b/Source/core/svg/SVGEllipseElement.cpp
index 26d1f8d..cda30d5 100644
--- a/Source/core/svg/SVGEllipseElement.cpp
+++ b/Source/core/svg/SVGEllipseElement.cpp
@@ -136,10 +136,10 @@
  
 bool SVGEllipseElement::selfHasRelativeLengths() const
 {
-    return cx().isRelative()
-        || cy().isRelative()
-        || rx().isRelative()
-        || ry().isRelative();
+    return cxCurrentValue().isRelative()
+        || cyCurrentValue().isRelative()
+        || rxCurrentValue().isRelative()
+        || ryCurrentValue().isRelative();
 }
 
 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*)
diff --git a/Source/core/svg/SVGFEBlendElement.cpp b/Source/core/svg/SVGFEBlendElement.cpp
index ab5d37a..d118b63 100644
--- a/Source/core/svg/SVGFEBlendElement.cpp
+++ b/Source/core/svg/SVGFEBlendElement.cpp
@@ -97,7 +97,7 @@
 {
     FEBlend* blend = static_cast<FEBlend*>(effect);
     if (attrName == SVGNames::modeAttr)
-        return blend->setBlendMode(mode());
+        return blend->setBlendMode(modeCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -127,13 +127,13 @@
 
 PassRefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    FilterEffect* input2 = filterBuilder->getEffectById(in2());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
+    FilterEffect* input2 = filterBuilder->getEffectById(in2CurrentValue());
 
     if (!input1 || !input2)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEBlend::create(filter, mode());
+    RefPtr<FilterEffect> effect = FEBlend::create(filter, modeCurrentValue());
     FilterEffectVector& inputEffects = effect->inputEffects();
     inputEffects.reserveCapacity(2);
     inputEffects.append(input1);
diff --git a/Source/core/svg/SVGFEColorMatrixElement.cpp b/Source/core/svg/SVGFEColorMatrixElement.cpp
index 5a82e7a..c65485b 100644
--- a/Source/core/svg/SVGFEColorMatrixElement.cpp
+++ b/Source/core/svg/SVGFEColorMatrixElement.cpp
@@ -100,9 +100,9 @@
 {
     FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect);
     if (attrName == SVGNames::typeAttr)
-        return colorMatrix->setType(type());
+        return colorMatrix->setType(typeCurrentValue());
     if (attrName == SVGNames::valuesAttr)
-        return colorMatrix->setValues(values());
+        return colorMatrix->setValues(valuesCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -132,13 +132,13 @@
 
 PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
 
     Vector<float> filterValues;
-    ColorMatrixType filterType = type();
+    ColorMatrixType filterType = typeCurrentValue();
 
     // Use defaults if values is empty (SVG 1.1 15.10).
     if (!hasAttribute(SVGNames::valuesAttr)) {
@@ -157,7 +157,7 @@
             break;
         }
     } else {
-        filterValues = values();
+        filterValues = valuesCurrentValue();
         unsigned size = filterValues.size();
 
         if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
diff --git a/Source/core/svg/SVGFEComponentTransferElement.cpp b/Source/core/svg/SVGFEComponentTransferElement.cpp
index aead2ac..a12b9db 100644
--- a/Source/core/svg/SVGFEComponentTransferElement.cpp
+++ b/Source/core/svg/SVGFEComponentTransferElement.cpp
@@ -78,7 +78,7 @@
 
 PassRefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
     
     if (!input1)
         return 0;
diff --git a/Source/core/svg/SVGFECompositeElement.cpp b/Source/core/svg/SVGFECompositeElement.cpp
index 9663046..ac50a56 100644
--- a/Source/core/svg/SVGFECompositeElement.cpp
+++ b/Source/core/svg/SVGFECompositeElement.cpp
@@ -129,15 +129,15 @@
 {
     FEComposite* composite = static_cast<FEComposite*>(effect);
     if (attrName == SVGNames::operatorAttr)
-        return composite->setOperation(_operator());
+        return composite->setOperation(_operatorCurrentValue());
     if (attrName == SVGNames::k1Attr)
-        return composite->setK1(k1());
+        return composite->setK1(k1CurrentValue());
     if (attrName == SVGNames::k2Attr)
-        return composite->setK2(k2());
+        return composite->setK2(k2CurrentValue());
     if (attrName == SVGNames::k3Attr)
-        return composite->setK3(k3());
+        return composite->setK3(k3CurrentValue());
     if (attrName == SVGNames::k4Attr)
-        return composite->setK4(k4());
+        return composite->setK4(k4CurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -172,13 +172,13 @@
 
 PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    FilterEffect* input2 = filterBuilder->getEffectById(in2());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
+    FilterEffect* input2 = filterBuilder->getEffectById(in2CurrentValue());
     
     if (!input1 || !input2)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEComposite::create(filter, _operator(), k1(), k2(), k3(), k4());
+    RefPtr<FilterEffect> effect = FEComposite::create(filter, _operatorCurrentValue(), k1CurrentValue(), k2CurrentValue(), k3CurrentValue(), k4CurrentValue());
     FilterEffectVector& inputEffects = effect->inputEffects();
     inputEffects.reserveCapacity(2);
     inputEffects.append(input1);
diff --git a/Source/core/svg/SVGFEConvolveMatrixElement.cpp b/Source/core/svg/SVGFEConvolveMatrixElement.cpp
index dd21761..8137976 100644
--- a/Source/core/svg/SVGFEConvolveMatrixElement.cpp
+++ b/Source/core/svg/SVGFEConvolveMatrixElement.cpp
@@ -218,19 +218,19 @@
 {
     FEConvolveMatrix* convolveMatrix = static_cast<FEConvolveMatrix*>(effect);
     if (attrName == SVGNames::edgeModeAttr)
-        return convolveMatrix->setEdgeMode(edgeMode());
+        return convolveMatrix->setEdgeMode(edgeModeCurrentValue());
     if (attrName == SVGNames::divisorAttr)
-        return convolveMatrix->setDivisor(divisor());
+        return convolveMatrix->setDivisor(divisorCurrentValue());
     if (attrName == SVGNames::biasAttr)
-        return convolveMatrix->setBias(bias());
+        return convolveMatrix->setBias(biasCurrentValue());
     if (attrName == SVGNames::targetXAttr)
-       return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));
+        return convolveMatrix->setTargetOffset(IntPoint(targetXCurrentValue(), targetYCurrentValue()));
     if (attrName == SVGNames::targetYAttr)
-       return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));
+        return convolveMatrix->setTargetOffset(IntPoint(targetXCurrentValue(), targetYCurrentValue()));
     if (attrName == SVGNames::kernelUnitLengthAttr)
-       return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY()));
+        return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthXCurrentValue(), kernelUnitLengthYCurrentValue()));
     if (attrName == SVGNames::preserveAlphaAttr)
-        return convolveMatrix->setPreserveAlpha(preserveAlpha());
+        return convolveMatrix->setPreserveAlpha(preserveAlphaCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -282,13 +282,13 @@
 
 PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
 
-    int orderXValue = orderX();
-    int orderYValue = orderY();
+    int orderXValue = orderXCurrentValue();
+    int orderYValue = orderYCurrentValue();
     if (!hasAttribute(SVGNames::orderAttr)) {
         orderXValue = 3;
         orderYValue = 3;
@@ -296,14 +296,14 @@
     // Spec says order must be > 0. Bail if it is not.
     if (orderXValue < 1 || orderYValue < 1)
         return 0;
-    SVGNumberList& kernelMatrix = this->kernelMatrix();
+    SVGNumberList& kernelMatrix = this->kernelMatrixCurrentValue();
     int kernelMatrixSize = kernelMatrix.size();
     // The spec says this is a requirement, and should bail out if fails
     if (orderXValue * orderYValue != kernelMatrixSize)
         return 0;
 
-    int targetXValue = targetX();
-    int targetYValue = targetY();
+    int targetXValue = targetXCurrentValue();
+    int targetYValue = targetYCurrentValue();
     if (hasAttribute(SVGNames::targetXAttr) && (targetXValue < 0 || targetXValue >= orderXValue))
         return 0;
     // The spec says the default value is: targetX = floor ( orderX / 2 ))
@@ -316,8 +316,8 @@
         targetYValue = static_cast<int>(floorf(orderYValue / 2));
 
     // Spec says default kernelUnitLength is 1.0, and a specified length cannot be 0.
-    int kernelUnitLengthXValue = kernelUnitLengthX();
-    int kernelUnitLengthYValue = kernelUnitLengthY();
+    int kernelUnitLengthXValue = kernelUnitLengthXCurrentValue();
+    int kernelUnitLengthYValue = kernelUnitLengthYCurrentValue();
     if (!hasAttribute(SVGNames::kernelUnitLengthAttr)) {
         kernelUnitLengthXValue = 1;
         kernelUnitLengthYValue = 1;
@@ -325,7 +325,7 @@
     if (kernelUnitLengthXValue <= 0 || kernelUnitLengthYValue <= 0)
         return 0;
 
-    float divisorValue = divisor();
+    float divisorValue = divisorCurrentValue();
     if (hasAttribute(SVGNames::divisorAttr) && !divisorValue)
         return 0;
     if (!hasAttribute(SVGNames::divisorAttr)) {
@@ -337,8 +337,8 @@
 
     RefPtr<FilterEffect> effect = FEConvolveMatrix::create(filter,
                     IntSize(orderXValue, orderYValue), divisorValue,
-                    bias(), IntPoint(targetXValue, targetYValue), edgeMode(),
-                    FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix);
+                    biasCurrentValue(), IntPoint(targetXValue, targetYValue), edgeModeCurrentValue(),
+                    FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlphaCurrentValue(), kernelMatrix);
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFEDiffuseLightingElement.cpp b/Source/core/svg/SVGFEDiffuseLightingElement.cpp
index 9a2dfaa..c88c8be 100644
--- a/Source/core/svg/SVGFEDiffuseLightingElement.cpp
+++ b/Source/core/svg/SVGFEDiffuseLightingElement.cpp
@@ -133,9 +133,9 @@
         return diffuseLighting->setLightingColor(renderer->style()->svgStyle()->lightingColor());
     }
     if (attrName == SVGNames::surfaceScaleAttr)
-        return diffuseLighting->setSurfaceScale(surfaceScale());
+        return diffuseLighting->setSurfaceScale(surfaceScaleCurrentValue());
     if (attrName == SVGNames::diffuseConstantAttr)
-        return diffuseLighting->setDiffuseConstant(diffuseConstant());
+        return diffuseLighting->setDiffuseConstant(diffuseConstantCurrentValue());
 
     LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSource());
     const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(this);
@@ -143,25 +143,25 @@
     ASSERT(lightElement);
 
     if (attrName == SVGNames::azimuthAttr)
-        return lightSource->setAzimuth(lightElement->azimuth());
+        return lightSource->setAzimuth(lightElement->azimuthCurrentValue());
     if (attrName == SVGNames::elevationAttr)
-        return lightSource->setElevation(lightElement->elevation());
+        return lightSource->setElevation(lightElement->elevationCurrentValue());
     if (attrName == SVGNames::xAttr)
-        return lightSource->setX(lightElement->x());
+        return lightSource->setX(lightElement->xCurrentValue());
     if (attrName == SVGNames::yAttr)
-        return lightSource->setY(lightElement->y());
+        return lightSource->setY(lightElement->yCurrentValue());
     if (attrName == SVGNames::zAttr)
-        return lightSource->setZ(lightElement->z());
+        return lightSource->setZ(lightElement->zCurrentValue());
     if (attrName == SVGNames::pointsAtXAttr)
-        return lightSource->setPointsAtX(lightElement->pointsAtX());
+        return lightSource->setPointsAtX(lightElement->pointsAtXCurrentValue());
     if (attrName == SVGNames::pointsAtYAttr)
-        return lightSource->setPointsAtY(lightElement->pointsAtY());
+        return lightSource->setPointsAtY(lightElement->pointsAtYCurrentValue());
     if (attrName == SVGNames::pointsAtZAttr)
-        return lightSource->setPointsAtZ(lightElement->pointsAtZ());
+        return lightSource->setPointsAtZ(lightElement->pointsAtZCurrentValue());
     if (attrName == SVGNames::specularExponentAttr)
-        return lightSource->setSpecularExponent(lightElement->specularExponent());
+        return lightSource->setSpecularExponent(lightElement->specularExponentCurrentValue());
     if (attrName == SVGNames::limitingConeAngleAttr)
-        return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle());
+        return lightSource->setLimitingConeAngle(lightElement->limitingConeAngleCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -203,7 +203,7 @@
 
 PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
@@ -219,8 +219,8 @@
     ASSERT(renderer->style());
     Color color = renderer->style()->svgStyle()->lightingColor();
 
-    RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, surfaceScale(), diffuseConstant(),
-                                                                kernelUnitLengthX(), kernelUnitLengthY(), lightSource.release());
+    RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, surfaceScaleCurrentValue(), diffuseConstantCurrentValue(),
+        kernelUnitLengthXCurrentValue(), kernelUnitLengthYCurrentValue(), lightSource.release());
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFEDisplacementMapElement.cpp b/Source/core/svg/SVGFEDisplacementMapElement.cpp
index 340b180..172197a 100644
--- a/Source/core/svg/SVGFEDisplacementMapElement.cpp
+++ b/Source/core/svg/SVGFEDisplacementMapElement.cpp
@@ -115,11 +115,11 @@
 {
     FEDisplacementMap* displacementMap = static_cast<FEDisplacementMap*>(effect);
     if (attrName == SVGNames::xChannelSelectorAttr)
-        return displacementMap->setXChannelSelector(xChannelSelector());
+        return displacementMap->setXChannelSelector(xChannelSelectorCurrentValue());
     if (attrName == SVGNames::yChannelSelectorAttr)
-        return displacementMap->setYChannelSelector(yChannelSelector());
+        return displacementMap->setYChannelSelector(yChannelSelectorCurrentValue());
     if (attrName == SVGNames::scaleAttr)
-        return displacementMap->setScale(scale());
+        return displacementMap->setScale(scaleCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -149,13 +149,13 @@
 
 PassRefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    FilterEffect* input2 = filterBuilder->getEffectById(in2());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
+    FilterEffect* input2 = filterBuilder->getEffectById(in2CurrentValue());
     
     if (!input1 || !input2)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, xChannelSelector(), yChannelSelector(), scale());
+    RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, xChannelSelectorCurrentValue(), yChannelSelectorCurrentValue(), scaleCurrentValue());
     FilterEffectVector& inputEffects = effect->inputEffects();
     inputEffects.reserveCapacity(2);
     inputEffects.append(input1);
diff --git a/Source/core/svg/SVGFEDistantLightElement.cpp b/Source/core/svg/SVGFEDistantLightElement.cpp
index ba480c5..9a93c7c 100644
--- a/Source/core/svg/SVGFEDistantLightElement.cpp
+++ b/Source/core/svg/SVGFEDistantLightElement.cpp
@@ -40,7 +40,7 @@
 
 PassRefPtr<LightSource> SVGFEDistantLightElement::lightSource() const
 {
-    return DistantLightSource::create(azimuth(), elevation());
+    return DistantLightSource::create(azimuthCurrentValue(), elevationCurrentValue());
 }
 
 }
diff --git a/Source/core/svg/SVGFEDropShadowElement.cpp b/Source/core/svg/SVGFEDropShadowElement.cpp
index 64609a3..7e18c8d 100644
--- a/Source/core/svg/SVGFEDropShadowElement.cpp
+++ b/Source/core/svg/SVGFEDropShadowElement.cpp
@@ -154,7 +154,7 @@
     if (!renderer)
         return 0;
 
-    if (stdDeviationX() < 0 || stdDeviationY() < 0)
+    if (stdDeviationXCurrentValue() < 0 || stdDeviationYCurrentValue() < 0)
         return 0;
 
     ASSERT(renderer->style());
@@ -163,11 +163,11 @@
     Color color = svgStyle->floodColor();
     float opacity = svgStyle->floodOpacity();
 
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
     if (!input1)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationX(), stdDeviationY(), dx(), dy(), color, opacity);
+    RefPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationXCurrentValue(), stdDeviationYCurrentValue(), dxCurrentValue(), dyCurrentValue(), color, opacity);
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFEGaussianBlurElement.cpp b/Source/core/svg/SVGFEGaussianBlurElement.cpp
index 30883f8..39b2e0a 100644
--- a/Source/core/svg/SVGFEGaussianBlurElement.cpp
+++ b/Source/core/svg/SVGFEGaussianBlurElement.cpp
@@ -127,15 +127,15 @@
 
 PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
 
-    if (stdDeviationX() < 0 || stdDeviationY() < 0)
+    if (stdDeviationXCurrentValue() < 0 || stdDeviationYCurrentValue() < 0)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX(), stdDeviationY());
+    RefPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationXCurrentValue(), stdDeviationYCurrentValue());
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFEImageElement.cpp b/Source/core/svg/SVGFEImageElement.cpp
index 3b9af6c..e6f28f8 100644
--- a/Source/core/svg/SVGFEImageElement.cpp
+++ b/Source/core/svg/SVGFEImageElement.cpp
@@ -24,6 +24,7 @@
 #include "core/svg/SVGFEImageElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/Document.h"
 #include "core/loader/cache/CachedImage.h"
 #include "core/loader/cache/CachedResourceLoader.h"
@@ -78,7 +79,7 @@
 
 void SVGFEImageElement::requestImageResource()
 {
-    CachedResourceRequest request(ResourceRequest(ownerDocument()->completeURL(href())), localName());
+    CachedResourceRequest request(ResourceRequest(ownerDocument()->completeURL(hrefCurrentValue())), localName());
     m_cachedImage = document()->cachedResourceLoader()->requestImage(request);
 
     if (m_cachedImage)
@@ -92,7 +93,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id);
     if (!target) {
         if (id.isEmpty())
             requestImageResource();
@@ -114,7 +115,6 @@
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
         SVGURIReference::addSupportedAttributes(supportedAttributes);
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::preserveAspectRatioAttr);
     }
@@ -137,8 +137,6 @@
 
     if (SVGURIReference::parseAttribute(name, value))
         return;
-    if (SVGLangSpace::parseAttribute(name, value))
-        return;
     if (SVGExternalResourcesRequired::parseAttribute(name, value))
         return;
 
@@ -164,7 +162,7 @@
         return;
     }
 
-    if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName))
+    if (SVGExternalResourcesRequired::isKnownAttribute(attrName))
         return;
 
     ASSERT_NOT_REACHED();
@@ -201,15 +199,15 @@
 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* filter)
 {
     if (m_cachedImage)
-        return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(renderer()), preserveAspectRatio());
-    return FEImage::createWithIRIReference(filter, document(), href(), preserveAspectRatio());
+        return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(renderer()), preserveAspectRatioCurrentValue());
+    return FEImage::createWithIRIReference(filter, document(), hrefCurrentValue(), preserveAspectRatioCurrentValue());
 }
 
 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
 {
     SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document()->completeURL(href()));
+    addSubresourceURL(urls, document()->completeURL(hrefCurrentValue()));
 }
 
 }
diff --git a/Source/core/svg/SVGFEMergeElement.cpp b/Source/core/svg/SVGFEMergeElement.cpp
index f5a3fe1..f632e3f 100644
--- a/Source/core/svg/SVGFEMergeElement.cpp
+++ b/Source/core/svg/SVGFEMergeElement.cpp
@@ -47,7 +47,7 @@
     FilterEffectVector& mergeInputs = effect->inputEffects();
     for (Node* node = firstChild(); node; node = node->nextSibling()) {
         if (node->hasTagName(SVGNames::feMergeNodeTag)) {
-            FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(node)->in1());
+            FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(node)->in1CurrentValue());
             if (!mergeEffect)
                 return 0;
             mergeInputs.append(mergeEffect);
diff --git a/Source/core/svg/SVGFEMorphologyElement.cpp b/Source/core/svg/SVGFEMorphologyElement.cpp
index 4718315..e8e2489 100644
--- a/Source/core/svg/SVGFEMorphologyElement.cpp
+++ b/Source/core/svg/SVGFEMorphologyElement.cpp
@@ -122,11 +122,11 @@
 {
     FEMorphology* morphology = static_cast<FEMorphology*>(effect);
     if (attrName == SVGNames::operatorAttr)
-        return morphology->setMorphologyOperator(_operator());
+        return morphology->setMorphologyOperator(_operatorCurrentValue());
     if (attrName == SVGNames::radiusAttr) {
         // Both setRadius functions should be evaluated separately.
-        bool isRadiusXChanged = morphology->setRadiusX(radiusX());
-        bool isRadiusYChanged = morphology->setRadiusY(radiusY());
+        bool isRadiusXChanged = morphology->setRadiusX(radiusXCurrentValue());
+        bool isRadiusYChanged = morphology->setRadiusY(radiusYCurrentValue());
         return isRadiusXChanged || isRadiusYChanged;
     }
 
@@ -158,9 +158,9 @@
 
 PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
-    float xRadius = radiusX();
-    float yRadius = radiusY();
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
+    float xRadius = radiusXCurrentValue();
+    float yRadius = radiusYCurrentValue();
 
     if (!input1)
         return 0;
@@ -168,7 +168,7 @@
     if (xRadius < 0 || yRadius < 0)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEMorphology::create(filter, _operator(), xRadius, yRadius);
+    RefPtr<FilterEffect> effect = FEMorphology::create(filter, _operatorCurrentValue(), xRadius, yRadius);
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFEOffsetElement.cpp b/Source/core/svg/SVGFEOffsetElement.cpp
index f95f2e1..e1a55a0 100644
--- a/Source/core/svg/SVGFEOffsetElement.cpp
+++ b/Source/core/svg/SVGFEOffsetElement.cpp
@@ -109,12 +109,12 @@
 
 PassRefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
 
-    RefPtr<FilterEffect> effect = FEOffset::create(filter, dx(), dy());
+    RefPtr<FilterEffect> effect = FEOffset::create(filter, dxCurrentValue(), dyCurrentValue());
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFEPointLightElement.cpp b/Source/core/svg/SVGFEPointLightElement.cpp
index 5c3475f..d98c1fc 100644
--- a/Source/core/svg/SVGFEPointLightElement.cpp
+++ b/Source/core/svg/SVGFEPointLightElement.cpp
@@ -40,7 +40,7 @@
 
 PassRefPtr<LightSource> SVGFEPointLightElement::lightSource() const
 {
-    return PointLightSource::create(FloatPoint3D(x(), y(), z()));
+    return PointLightSource::create(FloatPoint3D(xCurrentValue(), yCurrentValue(), zCurrentValue()));
 }
 
 }
diff --git a/Source/core/svg/SVGFESpecularLightingElement.cpp b/Source/core/svg/SVGFESpecularLightingElement.cpp
index 9589032..3519043 100644
--- a/Source/core/svg/SVGFESpecularLightingElement.cpp
+++ b/Source/core/svg/SVGFESpecularLightingElement.cpp
@@ -142,11 +142,11 @@
         return specularLighting->setLightingColor(renderer->style()->svgStyle()->lightingColor());
     }
     if (attrName == SVGNames::surfaceScaleAttr)
-        return specularLighting->setSurfaceScale(surfaceScale());
+        return specularLighting->setSurfaceScale(surfaceScaleCurrentValue());
     if (attrName == SVGNames::specularConstantAttr)
-        return specularLighting->setSpecularConstant(specularConstant());
+        return specularLighting->setSpecularConstant(specularConstantCurrentValue());
     if (attrName == SVGNames::specularExponentAttr)
-        return specularLighting->setSpecularExponent(specularExponent());
+        return specularLighting->setSpecularExponent(specularExponentCurrentValue());
 
     LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightSource());
     const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(this);
@@ -154,25 +154,25 @@
     ASSERT(lightElement);
 
     if (attrName == SVGNames::azimuthAttr)
-        return lightSource->setAzimuth(lightElement->azimuth());
+        return lightSource->setAzimuth(lightElement->azimuthCurrentValue());
     if (attrName == SVGNames::elevationAttr)
-        return lightSource->setElevation(lightElement->elevation());
+        return lightSource->setElevation(lightElement->elevationCurrentValue());
     if (attrName == SVGNames::xAttr)
-        return lightSource->setX(lightElement->x());
+        return lightSource->setX(lightElement->xCurrentValue());
     if (attrName == SVGNames::yAttr)
-        return lightSource->setY(lightElement->y());
+        return lightSource->setY(lightElement->yCurrentValue());
     if (attrName == SVGNames::zAttr)
-        return lightSource->setZ(lightElement->z());
+        return lightSource->setZ(lightElement->zCurrentValue());
     if (attrName == SVGNames::pointsAtXAttr)
-        return lightSource->setPointsAtX(lightElement->pointsAtX());
+        return lightSource->setPointsAtX(lightElement->pointsAtXCurrentValue());
     if (attrName == SVGNames::pointsAtYAttr)
-        return lightSource->setPointsAtY(lightElement->pointsAtY());
+        return lightSource->setPointsAtY(lightElement->pointsAtYCurrentValue());
     if (attrName == SVGNames::pointsAtZAttr)
-        return lightSource->setPointsAtZ(lightElement->pointsAtZ());
+        return lightSource->setPointsAtZ(lightElement->pointsAtZCurrentValue());
     if (attrName == SVGNames::specularExponentAttr)
-        return lightSource->setSpecularExponent(lightElement->specularExponent());
+        return lightSource->setSpecularExponent(lightElement->specularExponentCurrentValue());
     if (attrName == SVGNames::limitingConeAngleAttr)
-        return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle());
+        return lightSource->setLimitingConeAngle(lightElement->limitingConeAngleCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -214,7 +214,7 @@
 
 PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
@@ -230,8 +230,8 @@
     ASSERT(renderer->style());
     Color color = renderer->style()->svgStyle()->lightingColor();
 
-    RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, surfaceScale(), specularConstant(),
-                                          specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), lightSource.release());
+    RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, surfaceScaleCurrentValue(), specularConstantCurrentValue(),
+        specularExponentCurrentValue(), kernelUnitLengthXCurrentValue(), kernelUnitLengthYCurrentValue(), lightSource.release());
     effect->inputEffects().append(input1);
     return effect.release();
 }
diff --git a/Source/core/svg/SVGFESpotLightElement.cpp b/Source/core/svg/SVGFESpotLightElement.cpp
index b91c4cd..aa09fb1 100644
--- a/Source/core/svg/SVGFESpotLightElement.cpp
+++ b/Source/core/svg/SVGFESpotLightElement.cpp
@@ -40,10 +40,10 @@
 
 PassRefPtr<LightSource> SVGFESpotLightElement::lightSource() const
 {
-    FloatPoint3D pos(x(), y(), z());
-    FloatPoint3D direction(pointsAtX(), pointsAtY(), pointsAtZ());
+    FloatPoint3D pos(xCurrentValue(), yCurrentValue(), zCurrentValue());
+    FloatPoint3D direction(pointsAtXCurrentValue(), pointsAtYCurrentValue(), pointsAtZCurrentValue());
 
-    return SpotLightSource::create(pos, direction, specularExponent(), limitingConeAngle());
+    return SpotLightSource::create(pos, direction, specularExponentCurrentValue(), limitingConeAngleCurrentValue());
 }
 
 }
diff --git a/Source/core/svg/SVGFETileElement.cpp b/Source/core/svg/SVGFETileElement.cpp
index 9ca6f3c..59587bb 100644
--- a/Source/core/svg/SVGFETileElement.cpp
+++ b/Source/core/svg/SVGFETileElement.cpp
@@ -92,7 +92,7 @@
 
 PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
 {
-    FilterEffect* input1 = filterBuilder->getEffectById(in1());
+    FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue());
 
     if (!input1)
         return 0;
diff --git a/Source/core/svg/SVGFETurbulenceElement.cpp b/Source/core/svg/SVGFETurbulenceElement.cpp
index 2aebbb6..b7745e1 100644
--- a/Source/core/svg/SVGFETurbulenceElement.cpp
+++ b/Source/core/svg/SVGFETurbulenceElement.cpp
@@ -134,18 +134,18 @@
 {
     FETurbulence* turbulence = static_cast<FETurbulence*>(effect);
     if (attrName == SVGNames::typeAttr)
-        return turbulence->setType(type());
+        return turbulence->setType(typeCurrentValue());
     if (attrName == SVGNames::stitchTilesAttr)
-        return turbulence->setStitchTiles(stitchTiles());
+        return turbulence->setStitchTiles(stitchTilesCurrentValue());
     if (attrName == SVGNames::baseFrequencyAttr) {
-        bool baseFrequencyXChanged = turbulence->setBaseFrequencyX(baseFrequencyX());
-        bool baseFrequencyYChanged = turbulence->setBaseFrequencyY(baseFrequencyY());
+        bool baseFrequencyXChanged = turbulence->setBaseFrequencyX(baseFrequencyXCurrentValue());
+        bool baseFrequencyYChanged = turbulence->setBaseFrequencyY(baseFrequencyYCurrentValue());
         return (baseFrequencyXChanged || baseFrequencyYChanged);
     }
     if (attrName == SVGNames::seedAttr)
-        return turbulence->setSeed(seed());
+        return turbulence->setSeed(seedCurrentValue());
     if (attrName == SVGNames::numOctavesAttr)
-       return turbulence->setNumOctaves(numOctaves());
+        return turbulence->setNumOctaves(numOctavesCurrentValue());
 
     ASSERT_NOT_REACHED();
     return false;
@@ -174,9 +174,9 @@
 
 PassRefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*, Filter* filter)
 {
-    if (baseFrequencyX() < 0 || baseFrequencyY() < 0)
+    if (baseFrequencyXCurrentValue() < 0 || baseFrequencyYCurrentValue() < 0)
         return 0;
-    return FETurbulence::create(filter, type(), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH);
+    return FETurbulence::create(filter, typeCurrentValue(), baseFrequencyXCurrentValue(), baseFrequencyYCurrentValue(), numOctavesCurrentValue(), seedCurrentValue(), stitchTilesCurrentValue() == SVG_STITCHTYPE_STITCH);
 }
 
 }
diff --git a/Source/core/svg/SVGFilterElement.cpp b/Source/core/svg/SVGFilterElement.cpp
index 0f2cbb3..1e65855 100644
--- a/Source/core/svg/SVGFilterElement.cpp
+++ b/Source/core/svg/SVGFilterElement.cpp
@@ -26,6 +26,7 @@
 #include "core/svg/SVGFilterElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/rendering/svg/RenderSVGResourceFilter.h"
 #include "core/svg/SVGElementInstance.h"
@@ -105,7 +106,6 @@
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
         SVGURIReference::addSupportedAttributes(supportedAttributes);
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::filterUnitsAttr);
         supportedAttributes.add(SVGNames::primitiveUnitsAttr);
@@ -147,7 +147,6 @@
             setFilterResYBaseValue(y);
         }
     } else if (SVGURIReference::parseAttribute(name, value)
-             || SVGLangSpace::parseAttribute(name, value)
              || SVGExternalResourcesRequired::parseAttribute(name, value)) {
     } else
         ASSERT_NOT_REACHED();
@@ -231,10 +230,10 @@
 
 bool SVGFilterElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative();
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGFilterElement.h b/Source/core/svg/SVGFilterElement.h
index f3429fc..e384ea9 100644
--- a/Source/core/svg/SVGFilterElement.h
+++ b/Source/core/svg/SVGFilterElement.h
@@ -75,10 +75,10 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGFilterElement* toSVGFilterElement(SVGElement* element)
+inline SVGFilterElement* toSVGFilterElement(Node* node)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::filterTag));
-    return static_cast<SVGFilterElement*>(element);
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::filterTag));
+    return static_cast<SVGFilterElement*>(node);
 }
 
 }
diff --git a/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp b/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp
index 67c29ee..7c4c76f 100644
--- a/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp
+++ b/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp
@@ -150,6 +150,12 @@
     return false;
 }
 
+void SVGFilterPrimitiveStandardAttributes::primitiveAttributeChanged(const QualifiedName& attribute)
+{
+    if (RenderObject* primitiveRenderer = renderer())
+        static_cast<RenderSVGResourceFilterPrimitive*>(primitiveRenderer)->primitiveAttributeChanged(attribute);
+}
+
 void invalidateFilterPrimitiveParent(SVGElement* element)
 {
     if (!element)
diff --git a/Source/core/svg/SVGFilterPrimitiveStandardAttributes.h b/Source/core/svg/SVGFilterPrimitiveStandardAttributes.h
index 18870ab..776ed34 100644
--- a/Source/core/svg/SVGFilterPrimitiveStandardAttributes.h
+++ b/Source/core/svg/SVGFilterPrimitiveStandardAttributes.h
@@ -21,8 +21,7 @@
 #ifndef SVGFilterPrimitiveStandardAttributes_h
 #define SVGFilterPrimitiveStandardAttributes_h
 
-#include "core/rendering/svg/RenderSVGResourceFilter.h"
-#include "core/rendering/svg/RenderSVGResourceFilterPrimitive.h"
+#include "core/rendering/svg/RenderSVGResource.h"
 #include "core/svg/SVGAnimatedLength.h"
 #include "core/svg/SVGAnimatedString.h"
 #include "core/svg/SVGStyledElement.h"
@@ -34,6 +33,7 @@
 
 class Filter;
 class FilterEffect;
+class RenderSVGResourceFilterPrimitive;
 class SVGFilterBuilder;
 
 class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement {
@@ -58,11 +58,7 @@
             RenderSVGResource::markForLayoutAndParentResourceInvalidation(primitiveRenderer);
     }
 
-    inline void primitiveAttributeChanged(const QualifiedName& attribute)
-    {
-        if (RenderObject* primitiveRenderer = renderer())
-            static_cast<RenderSVGResourceFilterPrimitive*>(primitiveRenderer)->primitiveAttributeChanged(attribute);
-    }
+    void primitiveAttributeChanged(const QualifiedName&);
 
 private:
     virtual bool isFilterEffect() const { return true; }
diff --git a/Source/core/svg/SVGFitToViewBox.h b/Source/core/svg/SVGFitToViewBox.h
index e55d271..ab7ddf1 100644
--- a/Source/core/svg/SVGFitToViewBox.h
+++ b/Source/core/svg/SVGFitToViewBox.h
@@ -22,7 +22,6 @@
 #define SVGFitToViewBox_h
 
 #include "SVGNames.h"
-#include "core/dom/Attribute.h"
 #include "core/dom/QualifiedName.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
diff --git a/Source/core/svg/SVGFontData.cpp b/Source/core/svg/SVGFontData.cpp
index 2dcf9f8..e3acea3 100644
--- a/Source/core/svg/SVGFontData.cpp
+++ b/Source/core/svg/SVGFontData.cpp
@@ -31,6 +31,8 @@
 #include "core/rendering/svg/SVGTextRunRenderingContext.h"
 #include "core/svg/SVGAltGlyphElement.h"
 #include "core/svg/SVGFontElement.h"
+#include "core/svg/SVGFontFaceElement.h"
+#include "core/svg/SVGGlyphElement.h"
 #include <wtf/text/StringBuilder.h>
 #include <wtf/unicode/CharacterNames.h>
 #include <wtf/unicode/Unicode.h>
@@ -145,7 +147,7 @@
     }
 
     if (mirror)
-        remainingTextInRun = createStringWithMirroredCharacters(remainingTextInRun.bloatedCharacters(), remainingTextInRun.length());
+        remainingTextInRun = createStringWithMirroredCharacters(remainingTextInRun);
     if (!currentCharacter && arabicForms.isEmpty())
         arabicForms = charactersWithArabicForm(remainingTextInRun, mirror);
 
@@ -286,16 +288,28 @@
     return haveGlyphs;
 }
 
-String SVGFontData::createStringWithMirroredCharacters(const UChar* characters, unsigned length) const
+String SVGFontData::createStringWithMirroredCharacters(const String& string) const
 {
+    if (string.isEmpty())
+        return emptyString();
+
+    unsigned length = string.length();
+
     StringBuilder mirroredCharacters;
     mirroredCharacters.reserveCapacity(length);
 
-    unsigned i = 0;
-    while (i < length) {
-        UChar32 character;
-        U16_NEXT(characters, i, length, character);
-        mirroredCharacters.append(mirroredChar(character));
+    if (string.is8Bit()) {
+        const LChar* characters = string.characters8();
+        for (unsigned i = 0; i < length; ++i)
+            mirroredCharacters.append(mirroredChar(characters[i]));
+    } else {
+        const UChar* characters = string.characters16();
+        unsigned i = 0;
+        while (i < length) {
+            UChar32 character;
+            U16_NEXT(characters, i, length, character);
+            mirroredCharacters.append(mirroredChar(character));
+        }
     }
 
     return mirroredCharacters.toString();
diff --git a/Source/core/svg/SVGFontData.h b/Source/core/svg/SVGFontData.h
index b64f236..1e20938 100644
--- a/Source/core/svg/SVGFontData.h
+++ b/Source/core/svg/SVGFontData.h
@@ -22,10 +22,12 @@
 
 #if ENABLE(SVG_FONTS)
 #include "core/platform/graphics/SimpleFontData.h"
-#include "core/svg/SVGFontFaceElement.h"
 
 namespace WebCore {
 
+class SVGFontElement;
+class SVGFontFaceElement;
+
 class SVGFontData : public SimpleFontData::AdditionalFontData {
 public:
     static PassOwnPtr<SVGFontData> create(SVGFontFaceElement* element)
@@ -56,7 +58,7 @@
     bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const;
     bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const;
 
-    String createStringWithMirroredCharacters(const UChar* characters, unsigned length) const;
+    String createStringWithMirroredCharacters(const String&) const;
 
     // Ths SVGFontFaceElement is kept alive --
     // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document
diff --git a/Source/core/svg/SVGFontElement.cpp b/Source/core/svg/SVGFontElement.cpp
index 1ebcdbf..06aca0f 100644
--- a/Source/core/svg/SVGFontElement.cpp
+++ b/Source/core/svg/SVGFontElement.cpp
@@ -99,9 +99,8 @@
         unsigned unicodeLength = unicode.length();
         ASSERT(unicodeLength > 1);
 
-        const UChar* characters = unicode.bloatedCharacters();
         for (unsigned i = 0; i < unicodeLength; ++i) {
-            String lookupString(characters + i, 1);
+            String lookupString = unicode.substring(i, 1);
             m_glyphMap.collectGlyphsForString(lookupString, glyphs);
             if (!glyphs.isEmpty()) {
                 glyphs.clear();
diff --git a/Source/core/svg/SVGFontElement.h b/Source/core/svg/SVGFontElement.h
index 6f6f6cd..ff9ae3a 100644
--- a/Source/core/svg/SVGFontElement.h
+++ b/Source/core/svg/SVGFontElement.h
@@ -23,9 +23,9 @@
 #define SVGFontElement_h
 
 #if ENABLE(SVG_FONTS)
+#include "SVGNames.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGExternalResourcesRequired.h"
-#include "core/svg/SVGGlyphElement.h"
 #include "core/svg/SVGGlyphMap.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "core/svg/SVGStyledElement.h"
@@ -89,6 +89,12 @@
     bool m_isGlyphCacheValid;
 };
 
+inline SVGFontElement* toSVGFontElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::fontTag));
+    return static_cast<SVGFontElement*>(node);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG_FONTS)
diff --git a/Source/core/svg/SVGFontFaceElement.cpp b/Source/core/svg/SVGFontFaceElement.cpp
index 034fe6c..00a0730 100644
--- a/Source/core/svg/SVGFontFaceElement.cpp
+++ b/Source/core/svg/SVGFontFaceElement.cpp
@@ -288,7 +288,7 @@
     RefPtr<CSSValueList> list;
 
     if (describesParentFont) {
-        m_fontElement = static_cast<SVGFontElement*>(parentNode());
+        m_fontElement = toSVGFontElement(parentNode());
 
         list = CSSValueList::createCommaSeparated();
         list->append(CSSFontFaceSrcValue::createLocal(fontFamily()));
diff --git a/Source/core/svg/SVGForeignObjectElement.cpp b/Source/core/svg/SVGForeignObjectElement.cpp
index bb1bf66..ffeec99 100644
--- a/Source/core/svg/SVGForeignObjectElement.cpp
+++ b/Source/core/svg/SVGForeignObjectElement.cpp
@@ -23,6 +23,7 @@
 #include "core/svg/SVGForeignObjectElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/rendering/svg/RenderSVGForeignObject.h"
 #include "core/rendering/svg/RenderSVGResource.h"
@@ -71,7 +72,6 @@
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::xAttr);
         supportedAttributes.add(SVGNames::yAttr);
@@ -95,8 +95,7 @@
         setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::heightAttr)
         setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
-    else if (SVGLangSpace::parseAttribute(name, value)
-               || SVGExternalResourcesRequired::parseAttribute(name, value)) {
+    else if (SVGExternalResourcesRequired::parseAttribute(name, value)) {
     } else
         ASSERT_NOT_REACHED();
 
@@ -159,10 +158,10 @@
 
 bool SVGForeignObjectElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative();
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGGElement.cpp b/Source/core/svg/SVGGElement.cpp
index 8693bc3..4eb8f30 100644
--- a/Source/core/svg/SVGGElement.cpp
+++ b/Source/core/svg/SVGGElement.cpp
@@ -54,10 +54,8 @@
 bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName)
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
-    if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
+    if (supportedAttributes.isEmpty())
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
-    }
     return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
 }
 
@@ -70,8 +68,6 @@
 
     if (SVGLangSpace::parseAttribute(name, value))
         return;
-    if (SVGExternalResourcesRequired::parseAttribute(name, value))
-        return;
 
     ASSERT_NOT_REACHED();
 }
diff --git a/Source/core/svg/SVGGlyphElement.cpp b/Source/core/svg/SVGGlyphElement.cpp
index a900a82..865f2a6 100644
--- a/Source/core/svg/SVGGlyphElement.cpp
+++ b/Source/core/svg/SVGGlyphElement.cpp
@@ -46,10 +46,8 @@
 void SVGGlyphElement::invalidateGlyphCache()
 {
     ContainerNode* fontNode = parentNode();
-    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
-        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
-            element->invalidateGlyphCache();
-    }
+    if (fontNode && fontNode->hasTagName(SVGNames::fontTag))
+        toSVGFontElement(fontNode)->invalidateGlyphCache();
 }
 
 void SVGGlyphElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
diff --git a/Source/core/svg/SVGGlyphMap.h b/Source/core/svg/SVGGlyphMap.h
index 90586a8..e3ef06c 100644
--- a/Source/core/svg/SVGGlyphMap.h
+++ b/Source/core/svg/SVGGlyphMap.h
@@ -21,12 +21,11 @@
 #define SVGGlyphMap_h
 
 #if ENABLE(SVG_FONTS)
+#include "core/platform/graphics/Latin1TextIterator.h"
 #include "core/platform/graphics/SVGGlyph.h"
 #include "core/platform/graphics/SurrogatePairAwareTextIterator.h"
-#include "core/svg/SVGGlyphElement.h"
-
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
+#include "wtf/HashMap.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
@@ -63,23 +62,16 @@
             return;
         }
     
-        GlyphMapLayer* currentLayer = &m_rootLayer;
+        unsigned length = unicodeString.length();
+
         RefPtr<GlyphMapNode> node;
-        size_t length = unicodeString.length();
-
-        UChar32 character = 0;
-        unsigned clusterLength = 0;
-        SurrogatePairAwareTextIterator textIterator(unicodeString.bloatedCharacters(), 0, length, length);
-        while (textIterator.consume(character, clusterLength)) {
-            node = currentLayer->get(character);
-            if (!node) {
-                node = GlyphMapNode::create();
-                currentLayer->set(character, node);
-            }
-            currentLayer = &node->children;
-            textIterator.advance(clusterLength);
+        if (unicodeString.is8Bit()) {
+            Latin1TextIterator textIterator(unicodeString.characters8(), 0, length, length);
+            node = findOrCreateNode(textIterator);
+        } else {
+            SurrogatePairAwareTextIterator textIterator(unicodeString.characters16(), 0, length, length);
+            node = findOrCreateNode(textIterator);
         }
-
         if (!node)
             return;
 
@@ -112,21 +104,17 @@
 
     void collectGlyphsForString(const String& string, Vector<SVGGlyph>& glyphs)
     {
-        GlyphMapLayer* currentLayer = &m_rootLayer;
+        unsigned length = string.length();
 
-        const UChar* characters = string.bloatedCharacters();
-        size_t length = string.length();
+        if (!length)
+            return;
 
-        UChar32 character = 0;
-        unsigned clusterLength = 0;
-        SurrogatePairAwareTextIterator textIterator(characters, 0, length, length);
-        while (textIterator.consume(character, clusterLength)) {
-            RefPtr<GlyphMapNode> node = currentLayer->get(character);
-            if (!node)
-                break;
-            glyphs.append(node->glyphs);
-            currentLayer = &node->children;
-            textIterator.advance(clusterLength);
+        if (string.is8Bit()) {
+            Latin1TextIterator textIterator(string.characters8(), 0, length, length);
+            collectGlyphsForIterator(textIterator, glyphs);
+        } else {
+            SurrogatePairAwareTextIterator textIterator(string.characters16(), 0, length, length);
+            collectGlyphsForIterator(textIterator, glyphs);
         }
 
         std::sort(glyphs.begin(), glyphs.end(), compareGlyphPriority);
@@ -154,6 +142,44 @@
     }
 
 private:
+    template<typename Iterator>
+    PassRefPtr<GlyphMapNode> findOrCreateNode(Iterator& textIterator)
+    {
+        GlyphMapLayer* currentLayer = &m_rootLayer;
+
+        RefPtr<GlyphMapNode> node;
+        UChar32 character = 0;
+        unsigned clusterLength = 0;
+        while (textIterator.consume(character, clusterLength)) {
+            node = currentLayer->get(character);
+            if (!node) {
+                node = GlyphMapNode::create();
+                currentLayer->set(character, node);
+            }
+            currentLayer = &node->children;
+            textIterator.advance(clusterLength);
+        }
+
+        return node.release();
+    }
+
+    template<typename Iterator>
+    void collectGlyphsForIterator(Iterator& textIterator, Vector<SVGGlyph>& glyphs)
+    {
+        GlyphMapLayer* currentLayer = &m_rootLayer;
+
+        UChar32 character = 0;
+        unsigned clusterLength = 0;
+        while (textIterator.consume(character, clusterLength)) {
+            RefPtr<GlyphMapNode> node = currentLayer->get(character);
+            if (!node)
+                break;
+            glyphs.append(node->glyphs);
+            currentLayer = &node->children;
+            textIterator.advance(clusterLength);
+        }
+    }
+
     GlyphMapLayer m_rootLayer;
     Vector<SVGGlyph> m_glyphTable;
     HashMap<String, Glyph> m_namedGlyphs;
diff --git a/Source/core/svg/SVGGlyphRefElement.cpp b/Source/core/svg/SVGGlyphRefElement.cpp
index cd3094e..a3cddab 100644
--- a/Source/core/svg/SVGGlyphRefElement.cpp
+++ b/Source/core/svg/SVGGlyphRefElement.cpp
@@ -64,27 +64,36 @@
     return true;
 }
 
-void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+template<typename CharType>
+void SVGGlyphRefElement::parseAttributeInternal(const QualifiedName& name, const AtomicString& value)
 {
-    const UChar* startPtr = value.characters();
-    const UChar* endPtr = startPtr + value.length();
+    const CharType* ptr = value.isEmpty() ? 0 : value.string().getCharacters<CharType>();
+    const CharType* end = ptr + value.length();
 
     // FIXME: We need some error handling here.
-    if (name == SVGNames::xAttr)
-        parseNumber(startPtr, endPtr, m_x);
-    else if (name == SVGNames::yAttr)
-        parseNumber(startPtr, endPtr, m_y);
-    else if (name == SVGNames::dxAttr)
-        parseNumber(startPtr, endPtr, m_dx);
-    else if (name == SVGNames::dyAttr)
-        parseNumber(startPtr, endPtr, m_dy);
-    else {
+    if (name == SVGNames::xAttr) {
+        parseNumber(ptr, end, m_x);
+    } else if (name == SVGNames::yAttr) {
+        parseNumber(ptr, end, m_y);
+    } else if (name == SVGNames::dxAttr) {
+        parseNumber(ptr, end, m_dx);
+    } else if (name == SVGNames::dyAttr) {
+        parseNumber(ptr, end, m_dy);
+    } else {
         if (SVGURIReference::parseAttribute(name, value))
             return;
         SVGStyledElement::parseAttribute(name, value);
     }
 }
 
+void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+    if (value.isEmpty() || value.is8Bit())
+        parseAttributeInternal<LChar>(name, value);
+    else
+        parseAttributeInternal<UChar>(name, value);
+}
+
 const AtomicString& SVGGlyphRefElement::glyphRef() const
 {
     return fastGetAttribute(SVGNames::glyphRefAttr);
diff --git a/Source/core/svg/SVGGlyphRefElement.h b/Source/core/svg/SVGGlyphRefElement.h
index 5fc0466..6d94a14 100644
--- a/Source/core/svg/SVGGlyphRefElement.h
+++ b/Source/core/svg/SVGGlyphRefElement.h
@@ -49,6 +49,9 @@
 private:
     SVGGlyphRefElement(const QualifiedName&, Document*);
 
+    template<typename CharType>
+    void parseAttributeInternal(const QualifiedName&, const AtomicString&);
+
     virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGlyphRefElement)
diff --git a/Source/core/svg/SVGGradientElement.cpp b/Source/core/svg/SVGGradientElement.cpp
index 777539d..baa9881 100644
--- a/Source/core/svg/SVGGradientElement.cpp
+++ b/Source/core/svg/SVGGradientElement.cpp
@@ -24,6 +24,7 @@
 #include "core/svg/SVGGradientElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/Attribute.h"
 #include "core/rendering/svg/RenderSVGHiddenContainer.h"
 #include "core/rendering/svg/RenderSVGPath.h"
@@ -149,7 +150,7 @@
         Color color = stop->stopColorIncludingOpacity();
 
         // Figure out right monotonic offset
-        float offset = stop->offset();
+        float offset = stop->offsetCurrentValue();
         offset = std::min(std::max(previousOffset, offset), 1.0f);
         previousOffset = offset;
 
diff --git a/Source/core/svg/SVGGraphicsElement.cpp b/Source/core/svg/SVGGraphicsElement.cpp
index 2dfd3de..1e56fd3 100644
--- a/Source/core/svg/SVGGraphicsElement.cpp
+++ b/Source/core/svg/SVGGraphicsElement.cpp
@@ -75,7 +75,7 @@
         // Flatten any 3D transform.
         matrix = transform.toAffineTransform();
     } else {
-        transform().concatenate(matrix);
+        transformCurrentValue().concatenate(matrix);
     }
 
     if (m_supplementalTransform)
@@ -155,7 +155,7 @@
     return SVGTransformable::farthestViewportElement(this);
 }
 
-FloatRect SVGGraphicsElement::getBBox(StyleUpdateStrategy styleUpdateStrategy)
+SVGRect SVGGraphicsElement::getBBox(StyleUpdateStrategy styleUpdateStrategy)
 {
     return SVGTransformable::getBBox(this, styleUpdateStrategy);
 }
diff --git a/Source/core/svg/SVGGraphicsElement.h b/Source/core/svg/SVGGraphicsElement.h
index 01a0ca3..8114ae8 100644
--- a/Source/core/svg/SVGGraphicsElement.h
+++ b/Source/core/svg/SVGGraphicsElement.h
@@ -44,7 +44,7 @@
     virtual AffineTransform animatedLocalTransform() const;
     virtual AffineTransform* supplementalTransform();
 
-    virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate);
+    virtual SVGRect getBBox(StyleUpdateStrategy = AllowStyleUpdate);
 
     // "base class" methods for all the elements which render as paths
     virtual void toClipPath(Path&);
diff --git a/Source/core/svg/SVGHKernElement.cpp b/Source/core/svg/SVGHKernElement.cpp
index d9f0b07..70cec60 100644
--- a/Source/core/svg/SVGHKernElement.cpp
+++ b/Source/core/svg/SVGHKernElement.cpp
@@ -44,10 +44,8 @@
 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode* rootParent)
 {
     ContainerNode* fontNode = parentNode();
-    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
-        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
-            element->invalidateGlyphCache();
-    }
+    if (fontNode && fontNode->hasTagName(SVGNames::fontTag))
+        toSVGFontElement(fontNode)->invalidateGlyphCache();
 
     return SVGElement::insertedInto(rootParent);
 }
@@ -55,10 +53,8 @@
 void SVGHKernElement::removedFrom(ContainerNode* rootParent)
 {
     ContainerNode* fontNode = parentNode();
-    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
-        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
-            element->invalidateGlyphCache();
-    }
+    if (fontNode && fontNode->hasTagName(SVGNames::fontTag))
+        toSVGFontElement(fontNode)->invalidateGlyphCache();
 
     SVGElement::removedFrom(rootParent);
 }
diff --git a/Source/core/svg/SVGImageElement.cpp b/Source/core/svg/SVGImageElement.cpp
index 5b85037..945da4f 100644
--- a/Source/core/svg/SVGImageElement.cpp
+++ b/Source/core/svg/SVGImageElement.cpp
@@ -175,10 +175,10 @@
 
 bool SVGImageElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative();
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative();
 }
 
 RenderObject* SVGImageElement::createRenderer(RenderStyle*)
@@ -223,7 +223,7 @@
 {
     SVGGraphicsElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document()->completeURL(href()));
+    addSubresourceURL(urls, document()->completeURL(hrefCurrentValue()));
 }
 
 void SVGImageElement::didMoveToNewDocument(Document* oldDocument)
diff --git a/Source/core/svg/SVGImageElement.h b/Source/core/svg/SVGImageElement.h
index 9dd3f42..9f78f40 100644
--- a/Source/core/svg/SVGImageElement.h
+++ b/Source/core/svg/SVGImageElement.h
@@ -21,6 +21,7 @@
 #ifndef SVGImageElement_h
 #define SVGImageElement_h
 
+#include "SVGNames.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGAnimatedLength.h"
 #include "core/svg/SVGAnimatedPreserveAspectRatio.h"
@@ -75,6 +76,12 @@
     SVGImageLoader m_imageLoader;
 };
 
+inline SVGImageElement* toSVGImageElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::imageTag));
+    return static_cast<SVGImageElement*>(node);
+}
+
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGImageLoader.cpp b/Source/core/svg/SVGImageLoader.cpp
index e4a333f..1cbd94f 100644
--- a/Source/core/svg/SVGImageLoader.cpp
+++ b/Source/core/svg/SVGImageLoader.cpp
@@ -40,7 +40,7 @@
     if (image()->errorOccurred())
         element()->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
     else {
-        SVGImageElement* imageElement = static_cast<SVGImageElement*>(element());
+        SVGImageElement* imageElement = toSVGImageElement(element());
         if (imageElement->externalResourcesRequiredBaseValue())
             imageElement->sendSVGLoadEventIfPossible(true);
     }
diff --git a/Source/core/svg/SVGLength.cpp b/Source/core/svg/SVGLength.cpp
index c2f879c..e277a2b 100644
--- a/Source/core/svg/SVGLength.cpp
+++ b/Source/core/svg/SVGLength.cpp
@@ -246,7 +246,7 @@
         parseValueInternal<UChar>(string, convertedNumber, type);
 
     if (!success) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
@@ -262,7 +262,7 @@
 void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, ExceptionCode& ec)
 {
     if (type == LengthTypeUnknown || type > LengthTypePC) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
@@ -273,7 +273,7 @@
 void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context, ExceptionCode& ec)
 {
     if (type == LengthTypeUnknown || type > LengthTypePC) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp
index f01a29b..b7fc72c 100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -99,7 +99,7 @@
 
     switch (fromUnit) {
     case LengthTypeUnknown:
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     case LengthTypeNumber:
         return value;
@@ -131,7 +131,7 @@
 {
     switch (toUnit) {
     case LengthTypeUnknown:
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     case LengthTypeNumber:
         return value;
@@ -164,7 +164,7 @@
     float width = 0;
     float height = 0;
     if (!determineViewport(width, height)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -186,7 +186,7 @@
     float width = 0;
     float height = 0;
     if (!determineViewport(width, height)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -224,13 +224,13 @@
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
-    float fontSize = style->fontSize();
+    float fontSize = style->specifiedFontSize();
     if (!fontSize) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -241,18 +241,18 @@
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
-    return value * style->fontSize();
+    return value * style->specifiedFontSize();
 }
 
 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCode& ec) const
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -260,7 +260,7 @@
     // if this causes problems in real world cases maybe it would be best to remove this
     float xHeight = ceilf(style->fontMetrics().xHeight());
     if (!xHeight) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -271,7 +271,7 @@
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
diff --git a/Source/core/svg/SVGLengthContext.h b/Source/core/svg/SVGLengthContext.h
index 5a5fd47..2de1c2c 100644
--- a/Source/core/svg/SVGLengthContext.h
+++ b/Source/core/svg/SVGLengthContext.h
@@ -57,7 +57,7 @@
     template<typename T>
     static FloatRect resolveRectangle(const T* context, SVGUnitTypes::SVGUnitType type, const FloatRect& viewport)
     {
-        return SVGLengthContext::resolveRectangle(context, type, viewport, context->x(), context->y(), context->width(), context->height());
+        return SVGLengthContext::resolveRectangle(context, type, viewport, context->xCurrentValue(), context->yCurrentValue(), context->widthCurrentValue(), context->heightCurrentValue());
     }
 
     static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitType, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVGLength& width, const SVGLength& height);
diff --git a/Source/core/svg/SVGLineElement.cpp b/Source/core/svg/SVGLineElement.cpp
index 6f50d20..715f8af 100644
--- a/Source/core/svg/SVGLineElement.cpp
+++ b/Source/core/svg/SVGLineElement.cpp
@@ -135,10 +135,10 @@
 
 bool SVGLineElement::selfHasRelativeLengths() const
 {
-    return x1().isRelative()
-        || y1().isRelative()
-        || x2().isRelative()
-        || y2().isRelative();
+    return x1CurrentValue().isRelative()
+        || y1CurrentValue().isRelative()
+        || x2CurrentValue().isRelative()
+        || y2CurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGLinearGradientElement.cpp b/Source/core/svg/SVGLinearGradientElement.cpp
index 2362070..b74bf9c 100644
--- a/Source/core/svg/SVGLinearGradientElement.cpp
+++ b/Source/core/svg/SVGLinearGradientElement.cpp
@@ -130,14 +130,14 @@
             return false;
 
         if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr))
-            attributes.setSpreadMethod(current->spreadMethod());
+            attributes.setSpreadMethod(current->spreadMethodCurrentValue());
 
         if (!attributes.hasGradientUnits() && current->hasAttribute(SVGNames::gradientUnitsAttr))
-            attributes.setGradientUnits(current->gradientUnits());
+            attributes.setGradientUnits(current->gradientUnitsCurrentValue());
 
         if (!attributes.hasGradientTransform() && current->hasAttribute(SVGNames::gradientTransformAttr)) {
             AffineTransform transform;
-            current->gradientTransform().concatenate(transform);
+            current->gradientTransformCurrentValue().concatenate(transform);
             attributes.setGradientTransform(transform);
         }
 
@@ -151,22 +151,22 @@
             SVGLinearGradientElement* linear = static_cast<SVGLinearGradientElement*>(current);
 
             if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr))
-                attributes.setX1(linear->x1());
+                attributes.setX1(linear->x1CurrentValue());
 
             if (!attributes.hasY1() && current->hasAttribute(SVGNames::y1Attr))
-                attributes.setY1(linear->y1());
+                attributes.setY1(linear->y1CurrentValue());
 
             if (!attributes.hasX2() && current->hasAttribute(SVGNames::x2Attr))
-                attributes.setX2(linear->x2());
+                attributes.setX2(linear->x2CurrentValue());
 
             if (!attributes.hasY2() && current->hasAttribute(SVGNames::y2Attr))
-                attributes.setY2(linear->y2());
+                attributes.setY2(linear->y2CurrentValue());
         }
 
         processedGradients.add(current);
 
         // Respect xlink:href, take attributes from referenced element
-        Node* refNode = SVGURIReference::targetElementFromIRIString(current->href(), document());
+        Node* refNode = SVGURIReference::targetElementFromIRIString(current->hrefCurrentValue(), document());
         if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refNode->hasTagName(SVGNames::radialGradientTag))) {
             current = static_cast<SVGGradientElement*>(refNode);
 
@@ -186,10 +186,10 @@
 
 bool SVGLinearGradientElement::selfHasRelativeLengths() const
 {
-    return x1().isRelative()
-        || y1().isRelative()
-        || x2().isRelative()
-        || y2().isRelative();
+    return x1CurrentValue().isRelative()
+        || y1CurrentValue().isRelative()
+        || x2CurrentValue().isRelative()
+        || y2CurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGLocatable.cpp b/Source/core/svg/SVGLocatable.cpp
index 20cd2dd..3549580 100644
--- a/Source/core/svg/SVGLocatable.cpp
+++ b/Source/core/svg/SVGLocatable.cpp
@@ -61,7 +61,7 @@
     return farthest;
 }
 
-FloatRect SVGLocatable::getBBox(SVGElement* element, StyleUpdateStrategy styleUpdateStrategy)
+SVGRect SVGLocatable::getBBox(SVGElement* element, StyleUpdateStrategy styleUpdateStrategy)
 {
     ASSERT(element);
     if (styleUpdateStrategy == AllowStyleUpdate)
@@ -69,7 +69,7 @@
 
     // FIXME: Eventually we should support getBBox for detached elements.
     if (!element->renderer())
-        return FloatRect();
+        return SVGRect();
 
     return element->renderer()->objectBoundingBox();
 }
@@ -105,7 +105,7 @@
     if (target && target->isSVGGraphicsElement()) {
         AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(styleUpdateStrategy);
         if (!targetCTM.isInvertible()) {
-            ec = INVALID_STATE_ERR;
+            ec = InvalidStateError;
             return ctm;
         }
         ctm = targetCTM.inverse() * ctm;
diff --git a/Source/core/svg/SVGLocatable.h b/Source/core/svg/SVGLocatable.h
index a284ec3..bac961d 100644
--- a/Source/core/svg/SVGLocatable.h
+++ b/Source/core/svg/SVGLocatable.h
@@ -23,10 +23,10 @@
 #define SVGLocatable_h
 
 #include "core/platform/graphics/transforms/AffineTransform.h"
+#include "core/svg/SVGRect.h"
 
 namespace WebCore {
 
-class FloatRect;
 class SVGElement;
 
 typedef int ExceptionCode;
@@ -41,7 +41,7 @@
 
     enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate };
     
-    virtual FloatRect getBBox(StyleUpdateStrategy) = 0;
+    virtual SVGRect getBBox(StyleUpdateStrategy) = 0;
     virtual AffineTransform getCTM(StyleUpdateStrategy) = 0;
     virtual AffineTransform getScreenCTM(StyleUpdateStrategy) = 0;
     AffineTransform getTransformToElement(SVGElement*, ExceptionCode&, StyleUpdateStrategy = AllowStyleUpdate);
@@ -57,7 +57,7 @@
 protected:
     virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return AffineTransform(); }
 
-    static FloatRect getBBox(SVGElement*, StyleUpdateStrategy);
+    static SVGRect getBBox(SVGElement*, StyleUpdateStrategy);
     static AffineTransform computeCTM(SVGElement*, CTMScope, StyleUpdateStrategy);
 };
 
diff --git a/Source/core/svg/SVGMPathElement.cpp b/Source/core/svg/SVGMPathElement.cpp
index f28e4be..93a21c8 100644
--- a/Source/core/svg/SVGMPathElement.cpp
+++ b/Source/core/svg/SVGMPathElement.cpp
@@ -22,8 +22,10 @@
 #include "core/svg/SVGMPathElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/Document.h"
 #include "core/svg/SVGAnimateMotionElement.h"
+#include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGPathElement.h"
 
 namespace WebCore {
@@ -62,7 +64,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id);
     if (!target) {
         // Do not register as pending if we are already pending this resource.
         if (document()->accessSVGExtensions()->isElementPendingResource(this, id))
@@ -150,7 +152,7 @@
 
 SVGPathElement* SVGMPathElement::pathElement()
 {
-    Element* target = targetElementFromIRIString(href(), document());
+    Element* target = targetElementFromIRIString(hrefCurrentValue(), document());
     if (target && target->hasTagName(SVGNames::pathTag))
         return static_cast<SVGPathElement*>(target);
     return 0;
diff --git a/Source/core/svg/SVGMPathElement.h b/Source/core/svg/SVGMPathElement.h
index 835b3a2..f1e83a5 100644
--- a/Source/core/svg/SVGMPathElement.h
+++ b/Source/core/svg/SVGMPathElement.h
@@ -22,7 +22,7 @@
 
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGAnimatedString.h"
-#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGElement.h"
 #include "core/svg/SVGExternalResourcesRequired.h"
 #include "core/svg/SVGURIReference.h"
 
diff --git a/Source/core/svg/SVGMarkerElement.cpp b/Source/core/svg/SVGMarkerElement.cpp
index a101cbe..1f2efeb 100644
--- a/Source/core/svg/SVGMarkerElement.cpp
+++ b/Source/core/svg/SVGMarkerElement.cpp
@@ -104,14 +104,13 @@
 
 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
 {
-    return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight);
+    return SVGFitToViewBox::viewBoxToViewTransform(viewBoxCurrentValue(), preserveAspectRatioCurrentValue(), viewWidth, viewHeight);
 }
 
 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::markerUnitsAttr);
@@ -149,8 +148,7 @@
             setOrientTypeBaseValue(orientType);
         if (orientType == SVGMarkerOrientAngle)
             setOrientAngleBaseValue(angle);
-    } else if (SVGLangSpace::parseAttribute(name, value)
-             || SVGExternalResourcesRequired::parseAttribute(name, value)
+    } else if (SVGExternalResourcesRequired::parseAttribute(name, value)
              || SVGFitToViewBox::parseAttribute(this, name, value)) {
     } else
         ASSERT_NOT_REACHED();
@@ -219,10 +217,10 @@
 
 bool SVGMarkerElement::selfHasRelativeLengths() const
 {
-    return refX().isRelative()
-        || refY().isRelative()
-        || markerWidth().isRelative()
-        || markerHeight().isRelative();
+    return refXCurrentValue().isRelative()
+        || refYCurrentValue().isRelative()
+        || markerWidthCurrentValue().isRelative()
+        || markerHeightCurrentValue().isRelative();
 }
 
 void SVGMarkerElement::synchronizeOrientType(SVGElement* contextElement)
@@ -248,7 +246,7 @@
            (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value);
 }
   
-PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarkerElement::orientTypeAnimated()
+PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarkerElement::orientType()
 {
     m_orientType.shouldSynchronize = true;
     return static_pointer_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> >(lookupOrCreateOrientTypeWrapper(this));
diff --git a/Source/core/svg/SVGMarkerElement.h b/Source/core/svg/SVGMarkerElement.h
index 07ac433..71593e7 100644
--- a/Source/core/svg/SVGMarkerElement.h
+++ b/Source/core/svg/SVGMarkerElement.h
@@ -155,10 +155,10 @@
     // Custom 'orientType' property.
     static void synchronizeOrientType(SVGElement* contextElement);
     static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
-    SVGMarkerOrientType& orientType() const { return m_orientType.value; }
+    SVGMarkerOrientType& orientTypeCurrentValue() const { return m_orientType.value; }
     SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
     void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
-    PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > orientTypeAnimated();
+    PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > orientType();
 
 private:
     mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType;
diff --git a/Source/core/svg/SVGMaskElement.cpp b/Source/core/svg/SVGMaskElement.cpp
index df45587..838cf5d 100644
--- a/Source/core/svg/SVGMaskElement.cpp
+++ b/Source/core/svg/SVGMaskElement.cpp
@@ -79,7 +79,6 @@
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
         SVGTests::addSupportedAttributes(supportedAttributes);
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::maskUnitsAttr);
         supportedAttributes.add(SVGNames::maskContentUnitsAttr);
@@ -116,7 +115,6 @@
     else if (name == SVGNames::heightAttr)
         setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
     else if (SVGTests::parseAttribute(name, value)
-             || SVGLangSpace::parseAttribute(name, value)
              || SVGExternalResourcesRequired::parseAttribute(name, value)) {
     } else
         ASSERT_NOT_REACHED();
@@ -161,10 +159,10 @@
 
 bool SVGMaskElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative();
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGMatrix.h b/Source/core/svg/SVGMatrix.h
index edbe92d..5b5a541 100644
--- a/Source/core/svg/SVGMatrix.h
+++ b/Source/core/svg/SVGMatrix.h
@@ -111,7 +111,7 @@
             // FIXME: This used to have a more specific error message:
             // "An attempt was made to invert a matrix that is not invertible."
             // When switching to SVG2 style exceptions we lost this information.
-            ec = INVALID_STATE_ERR;
+            ec = InvalidStateError;
         }
 
         return transform;
@@ -120,7 +120,7 @@
     SVGMatrix rotateFromVector(double x, double y, ExceptionCode& ec)
     {
         if (!x || !y)
-            ec = INVALID_ACCESS_ERR;
+            ec = InvalidAccessError;
 
         AffineTransform copy = *this;
         copy.rotateFromVector(x, y);
diff --git a/Source/core/svg/SVGPaint.cpp b/Source/core/svg/SVGPaint.cpp
index aa1c79e..e300655 100644
--- a/Source/core/svg/SVGPaint.cpp
+++ b/Source/core/svg/SVGPaint.cpp
@@ -66,7 +66,7 @@
 
 void SVGPaint::setPaint(unsigned short, const String&, const String&, const String&, ExceptionCode& ec)
 {
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 String SVGPaint::customCssText() const
diff --git a/Source/core/svg/SVGPathBlender.cpp b/Source/core/svg/SVGPathBlender.cpp
index aa575a0..7dce176 100644
--- a/Source/core/svg/SVGPathBlender.cpp
+++ b/Source/core/svg/SVGPathBlender.cpp
@@ -23,6 +23,7 @@
 
 #include "core/platform/animation/AnimationUtilities.h"
 #include "core/svg/SVGPathSeg.h"
+#include "core/svg/SVGPathSource.h"
 #include <wtf/TemporaryChange.h>
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGPathBlender.h b/Source/core/svg/SVGPathBlender.h
index 004df25..8990e63 100644
--- a/Source/core/svg/SVGPathBlender.h
+++ b/Source/core/svg/SVGPathBlender.h
@@ -21,7 +21,6 @@
 #define SVGPathBlender_h
 
 #include "core/svg/SVGPathConsumer.h"
-#include "core/svg/SVGPathSource.h"
 
 namespace WebCore {
 
@@ -30,6 +29,8 @@
     BlendVertical
 };
 
+class SVGPathSource;
+
 class SVGPathBlender {
     WTF_MAKE_NONCOPYABLE(SVGPathBlender); WTF_MAKE_FAST_ALLOCATED;
 public:
diff --git a/Source/core/svg/SVGPathBuilder.cpp b/Source/core/svg/SVGPathBuilder.cpp
index cf73da9..a9de7c6 100644
--- a/Source/core/svg/SVGPathBuilder.cpp
+++ b/Source/core/svg/SVGPathBuilder.cpp
@@ -22,9 +22,10 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGPathBuilder.h"
 
+#include "core/platform/graphics/Path.h"
+
 namespace WebCore {
 
 SVGPathBuilder::SVGPathBuilder()
diff --git a/Source/core/svg/SVGPathBuilder.h b/Source/core/svg/SVGPathBuilder.h
index c8eb8a4..e3a9c4d 100644
--- a/Source/core/svg/SVGPathBuilder.h
+++ b/Source/core/svg/SVGPathBuilder.h
@@ -25,11 +25,12 @@
 #define SVGPathBuilder_h
 
 #include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/Path.h"
 #include "core/svg/SVGPathConsumer.h"
 
 namespace WebCore {
 
+class Path;
+
 class SVGPathBuilder : public SVGPathConsumer {
 public:
     SVGPathBuilder();
diff --git a/Source/core/svg/SVGPathElement.cpp b/Source/core/svg/SVGPathElement.cpp
index 639b998..2cf28ec 100644
--- a/Source/core/svg/SVGPathElement.cpp
+++ b/Source/core/svg/SVGPathElement.cpp
@@ -27,17 +27,26 @@
 #include "core/rendering/svg/RenderSVGResource.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/SVGMPathElement.h"
-#include "core/svg/SVGPathSegArc.h"
+#include "core/svg/SVGPathSegArcAbs.h"
+#include "core/svg/SVGPathSegArcRel.h"
 #include "core/svg/SVGPathSegClosePath.h"
-#include "core/svg/SVGPathSegCurvetoCubic.h"
-#include "core/svg/SVGPathSegCurvetoCubicSmooth.h"
-#include "core/svg/SVGPathSegCurvetoQuadratic.h"
-#include "core/svg/SVGPathSegCurvetoQuadraticSmooth.h"
-#include "core/svg/SVGPathSegLineto.h"
-#include "core/svg/SVGPathSegLinetoHorizontal.h"
-#include "core/svg/SVGPathSegLinetoVertical.h"
+#include "core/svg/SVGPathSegCurvetoCubicAbs.h"
+#include "core/svg/SVGPathSegCurvetoCubicRel.h"
+#include "core/svg/SVGPathSegCurvetoCubicSmoothAbs.h"
+#include "core/svg/SVGPathSegCurvetoCubicSmoothRel.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticAbs.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticRel.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticSmoothRel.h"
+#include "core/svg/SVGPathSegLinetoAbs.h"
+#include "core/svg/SVGPathSegLinetoHorizontalAbs.h"
+#include "core/svg/SVGPathSegLinetoHorizontalRel.h"
+#include "core/svg/SVGPathSegLinetoRel.h"
+#include "core/svg/SVGPathSegLinetoVerticalAbs.h"
+#include "core/svg/SVGPathSegLinetoVerticalRel.h"
 #include "core/svg/SVGPathSegList.h"
-#include "core/svg/SVGPathSegMoveto.h"
+#include "core/svg/SVGPathSegMovetoAbs.h"
+#include "core/svg/SVGPathSegMovetoRel.h"
 #include "core/svg/SVGPathUtilities.h"
 #include "core/svg/properties/SVGPathSegListPropertyTearOff.h"
 
@@ -92,9 +101,9 @@
     return totalLength;
 }
 
-FloatPoint SVGPathElement::getPointAtLength(float length)
+SVGPoint SVGPathElement::getPointAtLength(float length)
 {
-    FloatPoint point;
+    SVGPoint point;
     getPointAtLengthOfSVGPathByteStream(pathByteStream(), length, point);
     return point;
 }
@@ -205,7 +214,6 @@
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::dAttr);
         supportedAttributes.add(SVGNames::pathLengthAttr);
@@ -233,8 +241,6 @@
         return;
     }
 
-    if (SVGLangSpace::parseAttribute(name, value))
-        return;
     if (SVGExternalResourcesRequired::parseAttribute(name, value))
         return;
 
diff --git a/Source/core/svg/SVGPathElement.h b/Source/core/svg/SVGPathElement.h
index 14e31ae..99f68e9 100644
--- a/Source/core/svg/SVGPathElement.h
+++ b/Source/core/svg/SVGPathElement.h
@@ -58,7 +58,7 @@
     static PassRefPtr<SVGPathElement> create(const QualifiedName&, Document*);
     
     float getTotalLength();
-    FloatPoint getPointAtLength(float distance);
+    SVGPoint getPointAtLength(float distance);
     unsigned getPathSegAtLength(float distance);
 
     PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath(SVGPathSegRole role = PathSegUndefinedRole);
diff --git a/Source/core/svg/SVGPathParser.cpp b/Source/core/svg/SVGPathParser.cpp
index 289c506..a802ea9 100644
--- a/Source/core/svg/SVGPathParser.cpp
+++ b/Source/core/svg/SVGPathParser.cpp
@@ -26,6 +26,7 @@
 #include "core/svg/SVGPathParser.h"
 
 #include "core/platform/graphics/transforms/AffineTransform.h"
+#include "core/svg/SVGPathSource.h"
 #include <wtf/MathExtras.h>
 
 static const float gOneOverThree = 1 / 3.f;
diff --git a/Source/core/svg/SVGPathParser.h b/Source/core/svg/SVGPathParser.h
index ff4ff16..50ebce1 100644
--- a/Source/core/svg/SVGPathParser.h
+++ b/Source/core/svg/SVGPathParser.h
@@ -26,12 +26,13 @@
 
 #include "core/svg/SVGPathConsumer.h"
 #include "core/svg/SVGPathSeg.h"
-#include "core/svg/SVGPathSource.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
+class SVGPathSource;
+
 class SVGPathParser {
     WTF_MAKE_NONCOPYABLE(SVGPathParser); WTF_MAKE_FAST_ALLOCATED;
 public:
diff --git a/Source/core/svg/SVGPathSegArc.h b/Source/core/svg/SVGPathSegArc.h
index b787a37..eaf9849 100644
--- a/Source/core/svg/SVGPathSegArc.h
+++ b/Source/core/svg/SVGPathSegArc.h
@@ -99,42 +99,6 @@
     bool m_sweepFlag : 1;
 };
 
-class SVGPathSegArcAbs : public SVGPathSegArc {
-public:
-    static PassRefPtr<SVGPathSegArcAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
-    {
-        return adoptRef(new SVGPathSegArcAbs(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag));
-    }
-
-private:
-    SVGPathSegArcAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
-        : SVGPathSegArc(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_ARC_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "A"; }
-};
-
-class SVGPathSegArcRel : public SVGPathSegArc {
-public:
-    static PassRefPtr<SVGPathSegArcRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
-    {
-        return adoptRef(new SVGPathSegArcRel(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag));
-    }
-
-private:
-    SVGPathSegArcRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
-        : SVGPathSegArc(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_ARC_REL; }
-    virtual String pathSegTypeAsLetter() const { return "a"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegArcAbs.h b/Source/core/svg/SVGPathSegArcAbs.h
new file mode 100644
index 0000000..85e686e
--- /dev/null
+++ b/Source/core/svg/SVGPathSegArcAbs.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegArcAbs_h
+#define SVGPathSegArcAbs_h
+
+#include "core/svg/SVGPathSegArc.h"
+
+namespace WebCore {
+
+class SVGPathSegArcAbs : public SVGPathSegArc {
+public:
+    static PassRefPtr<SVGPathSegArcAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
+    {
+        return adoptRef(new SVGPathSegArcAbs(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag));
+    }
+
+private:
+    SVGPathSegArcAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
+        : SVGPathSegArc(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_ARC_ABS; }
+    virtual String pathSegTypeAsLetter() const { return "A"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegArcRel.h b/Source/core/svg/SVGPathSegArcRel.h
new file mode 100644
index 0000000..076c930
--- /dev/null
+++ b/Source/core/svg/SVGPathSegArcRel.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegArcRel_h
+#define SVGPathSegArcRel_h
+
+#include "core/svg/SVGPathSegArc.h"
+
+namespace WebCore {
+
+class SVGPathSegArcRel : public SVGPathSegArc {
+public:
+    static PassRefPtr<SVGPathSegArcRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
+    {
+        return adoptRef(new SVGPathSegArcRel(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag));
+    }
+
+private:
+    SVGPathSegArcRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
+        : SVGPathSegArc(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_ARC_REL; }
+    virtual String pathSegTypeAsLetter() const { return "a"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoCubic.h b/Source/core/svg/SVGPathSegCurvetoCubic.h
index 4eaa4cc..c344aac 100644
--- a/Source/core/svg/SVGPathSegCurvetoCubic.h
+++ b/Source/core/svg/SVGPathSegCurvetoCubic.h
@@ -89,42 +89,6 @@
     float m_y2;
 };
 
-class SVGPathSegCurvetoCubicAbs : public SVGPathSegCurvetoCubic { 
-public:
-    static PassRefPtr<SVGPathSegCurvetoCubicAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
-    {
-        return adoptRef(new SVGPathSegCurvetoCubicAbs(element, role, x, y, x1, y1, x2, y2));
-    }
-
-private:
-    SVGPathSegCurvetoCubicAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
-        : SVGPathSegCurvetoCubic(element, role, x, y, x1, y1, x2, y2)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "C"; }
-};
-
-class SVGPathSegCurvetoCubicRel : public SVGPathSegCurvetoCubic { 
-public:
-    static PassRefPtr<SVGPathSegCurvetoCubicRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
-    {
-        return adoptRef(new SVGPathSegCurvetoCubicRel(element, role, x, y, x1, y1, x2, y2));
-    }
-
-private:
-    SVGPathSegCurvetoCubicRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
-        : SVGPathSegCurvetoCubic(element, role, x, y, x1, y1, x2, y2)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_REL; }
-    virtual String pathSegTypeAsLetter() const { return "c"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegCurvetoCubicAbs.h b/Source/core/svg/SVGPathSegCurvetoCubicAbs.h
new file mode 100644
index 0000000..56718a8
--- /dev/null
+++ b/Source/core/svg/SVGPathSegCurvetoCubicAbs.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegCurvetoCubicAbs_h
+#define SVGPathSegCurvetoCubicAbs_h
+
+#include "core/svg/SVGPathSegCurvetoCubic.h"
+
+namespace WebCore {
+
+class SVGPathSegCurvetoCubicAbs : public SVGPathSegCurvetoCubic {
+public:
+    static PassRefPtr<SVGPathSegCurvetoCubicAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
+    {
+        return adoptRef(new SVGPathSegCurvetoCubicAbs(element, role, x, y, x1, y1, x2, y2));
+    }
+
+private:
+    SVGPathSegCurvetoCubicAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
+        : SVGPathSegCurvetoCubic(element, role, x, y, x1, y1, x2, y2)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_ABS; }
+    virtual String pathSegTypeAsLetter() const { return "C"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoCubicRel.h b/Source/core/svg/SVGPathSegCurvetoCubicRel.h
new file mode 100644
index 0000000..3910fcd
--- /dev/null
+++ b/Source/core/svg/SVGPathSegCurvetoCubicRel.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegCurvetoCubicRel_h
+#define SVGPathSegCurvetoCubicRel_h
+
+#include "core/svg/SVGPathSegCurvetoCubic.h"
+
+namespace WebCore {
+
+class SVGPathSegCurvetoCubicRel : public SVGPathSegCurvetoCubic {
+public:
+    static PassRefPtr<SVGPathSegCurvetoCubicRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
+    {
+        return adoptRef(new SVGPathSegCurvetoCubicRel(element, role, x, y, x1, y1, x2, y2));
+    }
+
+private:
+    SVGPathSegCurvetoCubicRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)
+        : SVGPathSegCurvetoCubic(element, role, x, y, x1, y1, x2, y2)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_REL; }
+    virtual String pathSegTypeAsLetter() const { return "c"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoCubicSmooth.h b/Source/core/svg/SVGPathSegCurvetoCubicSmooth.h
index db9ae74..5b7a901 100644
--- a/Source/core/svg/SVGPathSegCurvetoCubicSmooth.h
+++ b/Source/core/svg/SVGPathSegCurvetoCubicSmooth.h
@@ -71,42 +71,6 @@
     float m_y2;
 };
 
-class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSegCurvetoCubicSmooth { 
-public:
-    static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
-    {
-        return adoptRef(new SVGPathSegCurvetoCubicSmoothAbs(element, role, x, y, x2, y2));
-    }
-
-private:
-    SVGPathSegCurvetoCubicSmoothAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
-        : SVGPathSegCurvetoCubicSmooth(element, role, x, y, x2, y2)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "S"; }
-};
-
-class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSegCurvetoCubicSmooth { 
-public:
-    static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
-    {
-        return adoptRef(new SVGPathSegCurvetoCubicSmoothRel(element, role, x, y, x2, y2));
-    }
-
-private:
-    SVGPathSegCurvetoCubicSmoothRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
-        : SVGPathSegCurvetoCubicSmooth(element, role, x, y, x2, y2)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_REL; }
-    virtual String pathSegTypeAsLetter() const { return "s"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegCurvetoCubicSmoothAbs.h b/Source/core/svg/SVGPathSegCurvetoCubicSmoothAbs.h
new file mode 100644
index 0000000..3e36a58
--- /dev/null
+++ b/Source/core/svg/SVGPathSegCurvetoCubicSmoothAbs.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegCurvetoCubicSmoothAbs_h
+#define SVGPathSegCurvetoCubicSmoothAbs_h
+
+#include "core/svg/SVGPathSegCurvetoCubicSmooth.h"
+
+namespace WebCore {
+
+class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSegCurvetoCubicSmooth {
+public:
+    static PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
+    {
+        return adoptRef(new SVGPathSegCurvetoCubicSmoothAbs(element, role, x, y, x2, y2));
+    }
+
+private:
+    SVGPathSegCurvetoCubicSmoothAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
+        : SVGPathSegCurvetoCubicSmooth(element, role, x, y, x2, y2)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; }
+    virtual String pathSegTypeAsLetter() const { return "S"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoCubicSmoothRel.h b/Source/core/svg/SVGPathSegCurvetoCubicSmoothRel.h
new file mode 100644
index 0000000..4b7be69
--- /dev/null
+++ b/Source/core/svg/SVGPathSegCurvetoCubicSmoothRel.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegCurvetoCubicSmoothRel_h
+#define SVGPathSegCurvetoCubicSmoothRel_h
+
+#include "core/svg/SVGPathSegCurvetoCubicSmooth.h"
+
+namespace WebCore {
+
+class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSegCurvetoCubicSmooth {
+public:
+    static PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
+    {
+        return adoptRef(new SVGPathSegCurvetoCubicSmoothRel(element, role, x, y, x2, y2));
+    }
+
+private:
+    SVGPathSegCurvetoCubicSmoothRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x2, float y2)
+        : SVGPathSegCurvetoCubicSmooth(element, role, x, y, x2, y2)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_CUBIC_SMOOTH_REL; }
+    virtual String pathSegTypeAsLetter() const { return "s"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoQuadratic.h b/Source/core/svg/SVGPathSegCurvetoQuadratic.h
index 97b6fb4..a21bdec 100644
--- a/Source/core/svg/SVGPathSegCurvetoQuadratic.h
+++ b/Source/core/svg/SVGPathSegCurvetoQuadratic.h
@@ -71,42 +71,6 @@
     float m_y1;
 };
 
-class SVGPathSegCurvetoQuadraticAbs : public SVGPathSegCurvetoQuadratic {
-public:
-    static PassRefPtr<SVGPathSegCurvetoQuadraticAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
-    {
-        return adoptRef(new SVGPathSegCurvetoQuadraticAbs(element, role, x, y, x1, y1));
-    }
-
-private:
-    SVGPathSegCurvetoQuadraticAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
-        : SVGPathSegCurvetoQuadratic(element, role, x, y, x1, y1)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "Q"; }
-};
-
-class SVGPathSegCurvetoQuadraticRel : public SVGPathSegCurvetoQuadratic {
-public:
-    static PassRefPtr<SVGPathSegCurvetoQuadraticRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
-    {
-        return adoptRef(new SVGPathSegCurvetoQuadraticRel(element, role, x, y, x1, y1));
-    }
-
-private:
-    SVGPathSegCurvetoQuadraticRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
-        : SVGPathSegCurvetoQuadratic(element, role, x, y, x1, y1)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_REL; }
-    virtual String pathSegTypeAsLetter() const { return "q"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegCurvetoQuadraticAbs.h b/Source/core/svg/SVGPathSegCurvetoQuadraticAbs.h
new file mode 100644
index 0000000..6d25dfe
--- /dev/null
+++ b/Source/core/svg/SVGPathSegCurvetoQuadraticAbs.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegCurvetoQuadraticAbs_h
+#define SVGPathSegCurvetoQuadraticAbs_h
+
+#include "core/svg/SVGPathSegCurvetoQuadratic.h"
+
+namespace WebCore {
+
+class SVGPathSegCurvetoQuadraticAbs : public SVGPathSegCurvetoQuadratic {
+public:
+    static PassRefPtr<SVGPathSegCurvetoQuadraticAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
+    {
+        return adoptRef(new SVGPathSegCurvetoQuadraticAbs(element, role, x, y, x1, y1));
+    }
+
+private:
+    SVGPathSegCurvetoQuadraticAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
+        : SVGPathSegCurvetoQuadratic(element, role, x, y, x1, y1)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_ABS; }
+    virtual String pathSegTypeAsLetter() const { return "Q"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoQuadraticRel.h b/Source/core/svg/SVGPathSegCurvetoQuadraticRel.h
new file mode 100644
index 0000000..2c51a8b
--- /dev/null
+++ b/Source/core/svg/SVGPathSegCurvetoQuadraticRel.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegCurvetoQuadraticRel_h
+#define SVGPathSegCurvetoQuadraticRel_h
+
+#include "core/svg/SVGPathSegCurvetoQuadratic.h"
+
+namespace WebCore {
+
+class SVGPathSegCurvetoQuadraticRel : public SVGPathSegCurvetoQuadratic {
+public:
+    static PassRefPtr<SVGPathSegCurvetoQuadraticRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
+    {
+        return adoptRef(new SVGPathSegCurvetoQuadraticRel(element, role, x, y, x1, y1));
+    }
+
+private:
+    SVGPathSegCurvetoQuadraticRel(SVGPathElement* element, SVGPathSegRole role, float x, float y, float x1, float y1)
+        : SVGPathSegCurvetoQuadratic(element, role, x, y, x1, y1)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_REL; }
+    virtual String pathSegTypeAsLetter() const { return "q"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegCurvetoQuadraticSmooth.h b/Source/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h
similarity index 68%
copy from Source/core/svg/SVGPathSegCurvetoQuadraticSmooth.h
copy to Source/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h
index a177c40..87b4942 100644
--- a/Source/core/svg/SVGPathSegCurvetoQuadraticSmooth.h
+++ b/Source/core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -18,8 +19,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGPathSegCurvetoQuadraticSmooth_h
-#define SVGPathSegCurvetoQuadraticSmooth_h
+#ifndef SVGPathSegCurvetoQuadraticSmoothAbs_h
+#define SVGPathSegCurvetoQuadraticSmoothAbs_h
 
 #include "core/svg/SVGPathSegWithContext.h"
 
@@ -43,24 +44,6 @@
     virtual String pathSegTypeAsLetter() const { return "T"; }
 };
 
-class SVGPathSegCurvetoQuadraticSmoothRel : public SVGPathSegSingleCoordinate {
-public:
-    static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-    {
-        return adoptRef(new SVGPathSegCurvetoQuadraticSmoothRel(element, role, x, y));
-    }
-
-private:
-    SVGPathSegCurvetoQuadraticSmoothRel(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-        : SVGPathSegSingleCoordinate(element, role, x, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL; }
-    virtual String pathSegTypeAsLetter() const { return "t"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegCurvetoQuadraticSmooth.h b/Source/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.h
similarity index 68%
rename from Source/core/svg/SVGPathSegCurvetoQuadraticSmooth.h
rename to Source/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.h
index a177c40..8506e15 100644
--- a/Source/core/svg/SVGPathSegCurvetoQuadraticSmooth.h
+++ b/Source/core/svg/SVGPathSegCurvetoQuadraticSmoothRel.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -18,31 +19,13 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGPathSegCurvetoQuadraticSmooth_h
-#define SVGPathSegCurvetoQuadraticSmooth_h
+#ifndef SVGPathSegCurvetoQuadraticSmoothRel_h
+#define SVGPathSegCurvetoQuadraticSmoothRel_h
 
 #include "core/svg/SVGPathSegWithContext.h"
 
 namespace WebCore {
 
-class SVGPathSegCurvetoQuadraticSmoothAbs : public SVGPathSegSingleCoordinate {
-public:
-    static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-    {
-        return adoptRef(new SVGPathSegCurvetoQuadraticSmoothAbs(element, role, x, y));
-    }
-
-private:
-    SVGPathSegCurvetoQuadraticSmoothAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-        : SVGPathSegSingleCoordinate(element, role, x, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "T"; }
-};
-
 class SVGPathSegCurvetoQuadraticSmoothRel : public SVGPathSegSingleCoordinate {
 public:
     static PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
diff --git a/Source/core/svg/SVGPathSegLineto.h b/Source/core/svg/SVGPathSegLinetoAbs.h
similarity index 70%
copy from Source/core/svg/SVGPathSegLineto.h
copy to Source/core/svg/SVGPathSegLinetoAbs.h
index c78526d..ee575ea 100644
--- a/Source/core/svg/SVGPathSegLineto.h
+++ b/Source/core/svg/SVGPathSegLinetoAbs.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -18,8 +19,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGPathSegLineto_h
-#define SVGPathSegLineto_h
+#ifndef SVGPathSegLinetoAbs_h
+#define SVGPathSegLinetoAbs_h
 
 #include "core/svg/SVGPathSegWithContext.h"
 
@@ -43,24 +44,6 @@
     virtual String pathSegTypeAsLetter() const { return "L"; }
 };
 
-class SVGPathSegLinetoRel : public SVGPathSegSingleCoordinate {
-public:
-    static PassRefPtr<SVGPathSegLinetoRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-    {
-        return adoptRef(new SVGPathSegLinetoRel(element, role, x, y));
-    }
-
-private:
-    SVGPathSegLinetoRel(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-        : SVGPathSegSingleCoordinate(element, role, x, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_REL; }
-    virtual String pathSegTypeAsLetter() const { return "l"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegLinetoHorizontal.h b/Source/core/svg/SVGPathSegLinetoHorizontal.h
index 9dc04b0..7b3dde1 100644
--- a/Source/core/svg/SVGPathSegLinetoHorizontal.h
+++ b/Source/core/svg/SVGPathSegLinetoHorizontal.h
@@ -44,42 +44,6 @@
     float m_x;
 };
 
-class SVGPathSegLinetoHorizontalAbs : public SVGPathSegLinetoHorizontal {
-public:
-    static PassRefPtr<SVGPathSegLinetoHorizontalAbs> create(SVGPathElement* element, SVGPathSegRole role, float x)
-    {
-        return adoptRef(new SVGPathSegLinetoHorizontalAbs(element, role, x));
-    }
-
-private:
-    SVGPathSegLinetoHorizontalAbs(SVGPathElement* element, SVGPathSegRole role, float x)
-        : SVGPathSegLinetoHorizontal(element, role, x)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_HORIZONTAL_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "H"; }
-};
-
-class SVGPathSegLinetoHorizontalRel : public SVGPathSegLinetoHorizontal {
-public:
-    static PassRefPtr<SVGPathSegLinetoHorizontalRel> create(SVGPathElement* element, SVGPathSegRole role, float x)
-    {
-        return adoptRef(new SVGPathSegLinetoHorizontalRel(element, role, x));
-    }
-
-private:
-    SVGPathSegLinetoHorizontalRel(SVGPathElement* element, SVGPathSegRole role, float x)
-        : SVGPathSegLinetoHorizontal(element, role, x)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_HORIZONTAL_REL; }
-    virtual String pathSegTypeAsLetter() const { return "h"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegLinetoHorizontalAbs.h b/Source/core/svg/SVGPathSegLinetoHorizontalAbs.h
new file mode 100644
index 0000000..8e8f806
--- /dev/null
+++ b/Source/core/svg/SVGPathSegLinetoHorizontalAbs.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegLinetoHorizontalAbs_h
+#define SVGPathSegLinetoHorizontalAbs_h
+
+#include "core/svg/SVGPathSegLinetoHorizontal.h"
+
+namespace WebCore {
+
+class SVGPathSegLinetoHorizontalAbs : public SVGPathSegLinetoHorizontal {
+public:
+    static PassRefPtr<SVGPathSegLinetoHorizontalAbs> create(SVGPathElement* element, SVGPathSegRole role, float x)
+    {
+        return adoptRef(new SVGPathSegLinetoHorizontalAbs(element, role, x));
+    }
+
+private:
+    SVGPathSegLinetoHorizontalAbs(SVGPathElement* element, SVGPathSegRole role, float x)
+        : SVGPathSegLinetoHorizontal(element, role, x)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_HORIZONTAL_ABS; }
+    virtual String pathSegTypeAsLetter() const { return "H"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegLinetoHorizontalRel.h b/Source/core/svg/SVGPathSegLinetoHorizontalRel.h
new file mode 100644
index 0000000..974c41c
--- /dev/null
+++ b/Source/core/svg/SVGPathSegLinetoHorizontalRel.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegLinetoHorizontalRel_h
+#define SVGPathSegLinetoHorizontalRel_h
+
+#include "core/svg/SVGPathSegLinetoHorizontal.h"
+
+namespace WebCore {
+
+class SVGPathSegLinetoHorizontalRel : public SVGPathSegLinetoHorizontal {
+public:
+    static PassRefPtr<SVGPathSegLinetoHorizontalRel> create(SVGPathElement* element, SVGPathSegRole role, float x)
+    {
+        return adoptRef(new SVGPathSegLinetoHorizontalRel(element, role, x));
+    }
+
+private:
+    SVGPathSegLinetoHorizontalRel(SVGPathElement* element, SVGPathSegRole role, float x)
+        : SVGPathSegLinetoHorizontal(element, role, x)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_HORIZONTAL_REL; }
+    virtual String pathSegTypeAsLetter() const { return "h"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegLineto.h b/Source/core/svg/SVGPathSegLinetoRel.h
similarity index 70%
rename from Source/core/svg/SVGPathSegLineto.h
rename to Source/core/svg/SVGPathSegLinetoRel.h
index c78526d..53dc883 100644
--- a/Source/core/svg/SVGPathSegLineto.h
+++ b/Source/core/svg/SVGPathSegLinetoRel.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -18,31 +19,13 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGPathSegLineto_h
-#define SVGPathSegLineto_h
+#ifndef SVGPathSegLinetoRel_h
+#define SVGPathSegLinetoRel_h
 
 #include "core/svg/SVGPathSegWithContext.h"
 
 namespace WebCore {
 
-class SVGPathSegLinetoAbs : public SVGPathSegSingleCoordinate {
-public:
-    static PassRefPtr<SVGPathSegLinetoAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-    {
-        return adoptRef(new SVGPathSegLinetoAbs(element, role, x, y));
-    }
-
-private:
-    SVGPathSegLinetoAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-        : SVGPathSegSingleCoordinate(element, role, x, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "L"; }
-};
-
 class SVGPathSegLinetoRel : public SVGPathSegSingleCoordinate {
 public:
     static PassRefPtr<SVGPathSegLinetoRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
diff --git a/Source/core/svg/SVGPathSegLinetoVertical.h b/Source/core/svg/SVGPathSegLinetoVertical.h
index 9fb4d8c..961a958 100644
--- a/Source/core/svg/SVGPathSegLinetoVertical.h
+++ b/Source/core/svg/SVGPathSegLinetoVertical.h
@@ -44,42 +44,6 @@
     float m_y;
 };
 
-class SVGPathSegLinetoVerticalAbs : public SVGPathSegLinetoVertical {
-public:
-    static PassRefPtr<SVGPathSegLinetoVerticalAbs> create(SVGPathElement* element, SVGPathSegRole role, float y)
-    {
-        return adoptRef(new SVGPathSegLinetoVerticalAbs(element, role, y));
-    }
-
-private:
-    SVGPathSegLinetoVerticalAbs(SVGPathElement* element, SVGPathSegRole role, float y)
-        : SVGPathSegLinetoVertical(element, role, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_VERTICAL_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "V"; }
-};
-
-class SVGPathSegLinetoVerticalRel : public SVGPathSegLinetoVertical {
-public:
-    static PassRefPtr<SVGPathSegLinetoVerticalRel> create(SVGPathElement* element, SVGPathSegRole role, float y)
-    {
-        return adoptRef(new SVGPathSegLinetoVerticalRel(element, role, y));
-    }
-
-private:
-    SVGPathSegLinetoVerticalRel(SVGPathElement* element, SVGPathSegRole role, float y)
-        : SVGPathSegLinetoVertical(element, role, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_VERTICAL_REL; }
-    virtual String pathSegTypeAsLetter() const { return "v"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegLinetoVerticalAbs.h b/Source/core/svg/SVGPathSegLinetoVerticalAbs.h
new file mode 100644
index 0000000..66d86a1
--- /dev/null
+++ b/Source/core/svg/SVGPathSegLinetoVerticalAbs.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegLinetoVerticalAbs_h
+#define SVGPathSegLinetoVerticalAbs_h
+
+#include "core/svg/SVGPathSegLinetoVertical.h"
+
+namespace WebCore {
+
+class SVGPathSegLinetoVerticalAbs : public SVGPathSegLinetoVertical {
+public:
+    static PassRefPtr<SVGPathSegLinetoVerticalAbs> create(SVGPathElement* element, SVGPathSegRole role, float y)
+    {
+        return adoptRef(new SVGPathSegLinetoVerticalAbs(element, role, y));
+    }
+
+private:
+    SVGPathSegLinetoVerticalAbs(SVGPathElement* element, SVGPathSegRole role, float y)
+        : SVGPathSegLinetoVertical(element, role, y)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_VERTICAL_ABS; }
+    virtual String pathSegTypeAsLetter() const { return "V"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegLinetoVerticalRel.h b/Source/core/svg/SVGPathSegLinetoVerticalRel.h
new file mode 100644
index 0000000..f420315
--- /dev/null
+++ b/Source/core/svg/SVGPathSegLinetoVerticalRel.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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 SVGPathSegLinetoVerticalRel_h
+#define SVGPathSegLinetoVerticalRel_h
+
+#include "core/svg/SVGPathSegLinetoVertical.h"
+
+namespace WebCore {
+
+class SVGPathSegLinetoVerticalRel : public SVGPathSegLinetoVertical {
+public:
+    static PassRefPtr<SVGPathSegLinetoVerticalRel> create(SVGPathElement* element, SVGPathSegRole role, float y)
+    {
+        return adoptRef(new SVGPathSegLinetoVerticalRel(element, role, y));
+    }
+
+private:
+    SVGPathSegLinetoVerticalRel(SVGPathElement* element, SVGPathSegRole role, float y)
+        : SVGPathSegLinetoVertical(element, role, y)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    virtual unsigned short pathSegType() const { return PATHSEG_LINETO_VERTICAL_REL; }
+    virtual String pathSegTypeAsLetter() const { return "v"; }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/svg/SVGPathSegListBuilder.cpp b/Source/core/svg/SVGPathSegListBuilder.cpp
index bb86a92..afc00b4 100644
--- a/Source/core/svg/SVGPathSegListBuilder.cpp
+++ b/Source/core/svg/SVGPathSegListBuilder.cpp
@@ -27,17 +27,26 @@
 
 #include "core/dom/ExceptionCode.h"
 #include "core/svg/SVGPathElement.h"
-#include "core/svg/SVGPathSegArc.h"
+#include "core/svg/SVGPathSegArcAbs.h"
+#include "core/svg/SVGPathSegArcRel.h"
 #include "core/svg/SVGPathSegClosePath.h"
-#include "core/svg/SVGPathSegCurvetoCubic.h"
-#include "core/svg/SVGPathSegCurvetoCubicSmooth.h"
-#include "core/svg/SVGPathSegCurvetoQuadratic.h"
-#include "core/svg/SVGPathSegCurvetoQuadraticSmooth.h"
-#include "core/svg/SVGPathSegLineto.h"
-#include "core/svg/SVGPathSegLinetoHorizontal.h"
-#include "core/svg/SVGPathSegLinetoVertical.h"
+#include "core/svg/SVGPathSegCurvetoCubicAbs.h"
+#include "core/svg/SVGPathSegCurvetoCubicRel.h"
+#include "core/svg/SVGPathSegCurvetoCubicSmoothAbs.h"
+#include "core/svg/SVGPathSegCurvetoCubicSmoothRel.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticAbs.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticRel.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h"
+#include "core/svg/SVGPathSegCurvetoQuadraticSmoothRel.h"
+#include "core/svg/SVGPathSegLinetoAbs.h"
+#include "core/svg/SVGPathSegLinetoHorizontalAbs.h"
+#include "core/svg/SVGPathSegLinetoHorizontalRel.h"
+#include "core/svg/SVGPathSegLinetoRel.h"
+#include "core/svg/SVGPathSegLinetoVerticalAbs.h"
+#include "core/svg/SVGPathSegLinetoVerticalRel.h"
 #include "core/svg/SVGPathSegList.h"
-#include "core/svg/SVGPathSegMoveto.h"
+#include "core/svg/SVGPathSegMovetoAbs.h"
+#include "core/svg/SVGPathSegMovetoRel.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPathSegListBuilder.h b/Source/core/svg/SVGPathSegListBuilder.h
index 04e30e4..1c9e06d 100644
--- a/Source/core/svg/SVGPathSegListBuilder.h
+++ b/Source/core/svg/SVGPathSegListBuilder.h
@@ -26,11 +26,12 @@
 
 #include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathConsumer.h"
-#include "core/svg/SVGPathElement.h"
 #include "core/svg/SVGPathSegList.h"
 
 namespace WebCore {
 
+class SVGPathElement;
+
 class SVGPathSegListBuilder : public SVGPathConsumer {
 public:
     SVGPathSegListBuilder();
diff --git a/Source/core/svg/SVGPathSegMoveto.h b/Source/core/svg/SVGPathSegMovetoAbs.h
similarity index 70%
rename from Source/core/svg/SVGPathSegMoveto.h
rename to Source/core/svg/SVGPathSegMovetoAbs.h
index afa0cb1..4b6527e 100644
--- a/Source/core/svg/SVGPathSegMoveto.h
+++ b/Source/core/svg/SVGPathSegMovetoAbs.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -18,8 +19,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGPathSegMoveto_h
-#define SVGPathSegMoveto_h
+#ifndef SVGPathSegMovetoAbs_h
+#define SVGPathSegMovetoAbs_h
 
 #include "core/svg/SVGPathSegWithContext.h"
 
@@ -43,24 +44,6 @@
     virtual String pathSegTypeAsLetter() const { return "M"; }
 };
 
-class SVGPathSegMovetoRel : public SVGPathSegSingleCoordinate {
-public:
-    static PassRefPtr<SVGPathSegMovetoRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-    {
-        return adoptRef(new SVGPathSegMovetoRel(element, role, x, y));
-    }
-
-private:
-    SVGPathSegMovetoRel(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-        : SVGPathSegSingleCoordinate(element, role, x, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_MOVETO_REL; }
-    virtual String pathSegTypeAsLetter() const { return "m"; }
-};
-
 } // namespace WebCore
 
 #endif
diff --git a/Source/core/svg/SVGPathSegMoveto.h b/Source/core/svg/SVGPathSegMovetoRel.h
similarity index 70%
copy from Source/core/svg/SVGPathSegMoveto.h
copy to Source/core/svg/SVGPathSegMovetoRel.h
index afa0cb1..023c3e9 100644
--- a/Source/core/svg/SVGPathSegMoveto.h
+++ b/Source/core/svg/SVGPathSegMovetoRel.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -18,31 +19,13 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGPathSegMoveto_h
-#define SVGPathSegMoveto_h
+#ifndef SVGPathSegMovetoRel_h
+#define SVGPathSegMovetoRel_h
 
 #include "core/svg/SVGPathSegWithContext.h"
 
 namespace WebCore {
 
-class SVGPathSegMovetoAbs : public SVGPathSegSingleCoordinate {
-public:
-    static PassRefPtr<SVGPathSegMovetoAbs> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-    {
-        return adoptRef(new SVGPathSegMovetoAbs(element, role, x, y));
-    }
-
-private:
-    SVGPathSegMovetoAbs(SVGPathElement* element, SVGPathSegRole role, float x, float y)
-        : SVGPathSegSingleCoordinate(element, role, x, y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual unsigned short pathSegType() const { return PATHSEG_MOVETO_ABS; }
-    virtual String pathSegTypeAsLetter() const { return "M"; }
-};
-
 class SVGPathSegMovetoRel : public SVGPathSegSingleCoordinate {
 public:
     static PassRefPtr<SVGPathSegMovetoRel> create(SVGPathElement* element, SVGPathSegRole role, float x, float y)
diff --git a/Source/core/svg/SVGPathTraversalStateBuilder.cpp b/Source/core/svg/SVGPathTraversalStateBuilder.cpp
index bf70b35..2a467e5 100644
--- a/Source/core/svg/SVGPathTraversalStateBuilder.cpp
+++ b/Source/core/svg/SVGPathTraversalStateBuilder.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "config.h"
+#include "core/platform/graphics/PathTraversalState.h"
 
 #include "core/svg/SVGPathTraversalStateBuilder.h"
 
@@ -86,7 +87,7 @@
     return m_traversalState->m_totalLength;
 }
 
-FloatPoint SVGPathTraversalStateBuilder::currentPoint()
+SVGPoint SVGPathTraversalStateBuilder::currentPoint()
 {
     ASSERT(m_traversalState);
     return m_traversalState->m_current;
diff --git a/Source/core/svg/SVGPathTraversalStateBuilder.h b/Source/core/svg/SVGPathTraversalStateBuilder.h
index 68f9bc4..59c2434 100644
--- a/Source/core/svg/SVGPathTraversalStateBuilder.h
+++ b/Source/core/svg/SVGPathTraversalStateBuilder.h
@@ -21,19 +21,20 @@
 #ifndef SVGPathTraversalStateBuilder_h
 #define SVGPathTraversalStateBuilder_h
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/PathTraversalState.h"
 #include "core/svg/SVGPathConsumer.h"
+#include "core/svg/SVGPoint.h"
 
 namespace WebCore {
 
+class PathTraversalState;
+
 class SVGPathTraversalStateBuilder : public SVGPathConsumer {
 public:
     SVGPathTraversalStateBuilder();
 
     unsigned pathSegmentIndex();
     float totalLength();
-    FloatPoint currentPoint();
+    SVGPoint currentPoint();
 
     void setCurrentTraversalState(PathTraversalState* traversalState) { m_traversalState = traversalState; }
     void setDesiredLength(float);
diff --git a/Source/core/svg/SVGPathUtilities.cpp b/Source/core/svg/SVGPathUtilities.cpp
index 12bf2d3..36950a6 100644
--- a/Source/core/svg/SVGPathUtilities.cpp
+++ b/Source/core/svg/SVGPathUtilities.cpp
@@ -312,7 +312,7 @@
     return ok;
 }
 
-bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, FloatPoint& point)
+bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, SVGPoint& point)
 {
     ASSERT(stream);
     if (stream->isEmpty())
diff --git a/Source/core/svg/SVGPathUtilities.h b/Source/core/svg/SVGPathUtilities.h
index 89f16d4..5fa2d46 100644
--- a/Source/core/svg/SVGPathUtilities.h
+++ b/Source/core/svg/SVGPathUtilities.h
@@ -20,9 +20,8 @@
 #ifndef SVGPathUtilities_h
 #define SVGPathUtilities_h
 
-#include "core/svg/SVGPathByteStream.h"
 #include "core/svg/SVGPathConsumer.h"
-#include "core/svg/SVGPathSeg.h"
+#include "core/svg/SVGPoint.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -31,6 +30,7 @@
 class Path;
 class SVGPathByteStream;
 class SVGPathElement;
+class SVGPathSeg;
 class SVGPathSegList;
 
 // String/SVGPathByteStream -> Path
@@ -54,7 +54,7 @@
 
 bool getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream*, float length, unsigned& pathSeg);
 bool getTotalLengthOfSVGPathByteStream(SVGPathByteStream*, float& totalLength);
-bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream*, float length, FloatPoint&);
+bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream*, float length, SVGPoint&);
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGPatternElement.cpp b/Source/core/svg/SVGPatternElement.cpp
index bcc40f8..b38307f 100644
--- a/Source/core/svg/SVGPatternElement.cpp
+++ b/Source/core/svg/SVGPatternElement.cpp
@@ -24,6 +24,7 @@
 #include "core/svg/SVGPatternElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGResourcePattern.h"
 #include "core/svg/PatternAttributes.h"
@@ -86,7 +87,6 @@
     if (supportedAttributes.isEmpty()) {
         SVGURIReference::addSupportedAttributes(supportedAttributes);
         SVGTests::addSupportedAttributes(supportedAttributes);
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::patternUnitsAttr);
@@ -132,7 +132,6 @@
         setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     else if (SVGURIReference::parseAttribute(name, value)
              || SVGTests::parseAttribute(name, value)
-             || SVGLangSpace::parseAttribute(name, value)
              || SVGExternalResourcesRequired::parseAttribute(name, value)
              || SVGFitToViewBox::parseAttribute(this, name, value)) {
     } else
@@ -183,32 +182,32 @@
     const SVGPatternElement* current = this;
     while (current) {
         if (!attributes.hasX() && current->hasAttribute(SVGNames::xAttr))
-            attributes.setX(current->x());
+            attributes.setX(current->xCurrentValue());
 
         if (!attributes.hasY() && current->hasAttribute(SVGNames::yAttr))
-            attributes.setY(current->y());
+            attributes.setY(current->yCurrentValue());
 
         if (!attributes.hasWidth() && current->hasAttribute(SVGNames::widthAttr))
-            attributes.setWidth(current->width());
+            attributes.setWidth(current->widthCurrentValue());
 
         if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAttr))
-            attributes.setHeight(current->height());
+            attributes.setHeight(current->heightCurrentValue());
 
         if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr) && current->viewBoxIsValid())
-            attributes.setViewBox(current->viewBox());
+            attributes.setViewBox(current->viewBoxCurrentValue());
 
         if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNames::preserveAspectRatioAttr))
-            attributes.setPreserveAspectRatio(current->preserveAspectRatio());
+            attributes.setPreserveAspectRatio(current->preserveAspectRatioCurrentValue());
 
         if (!attributes.hasPatternUnits() && current->hasAttribute(SVGNames::patternUnitsAttr))
-            attributes.setPatternUnits(current->patternUnits());
+            attributes.setPatternUnits(current->patternUnitsCurrentValue());
 
         if (!attributes.hasPatternContentUnits() && current->hasAttribute(SVGNames::patternContentUnitsAttr))
-            attributes.setPatternContentUnits(current->patternContentUnits());
+            attributes.setPatternContentUnits(current->patternContentUnitsCurrentValue());
 
         if (!attributes.hasPatternTransform() && current->hasAttribute(SVGNames::patternTransformAttr)) {
             AffineTransform transform;
-            current->patternTransform().concatenate(transform);
+            current->patternTransformCurrentValue().concatenate(transform);
             attributes.setPatternTransform(transform);
         }
 
@@ -218,7 +217,7 @@
         processedPatterns.add(current);
 
         // Respect xlink:href, take attributes from referenced element
-        Node* refNode = SVGURIReference::targetElementFromIRIString(current->href(), document());
+        Node* refNode = SVGURIReference::targetElementFromIRIString(current->hrefCurrentValue(), document());
         if (refNode && refNode->hasTagName(SVGNames::patternTag)) {
             current = static_cast<const SVGPatternElement*>(const_cast<const Node*>(refNode));
 
@@ -235,16 +234,16 @@
 AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const
 {
     AffineTransform matrix;
-    patternTransform().concatenate(matrix);
+    patternTransformCurrentValue().concatenate(matrix);
     return matrix;
 }
 
 bool SVGPatternElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative();
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGPoint.h b/Source/core/svg/SVGPoint.h
new file mode 100644
index 0000000..78f91bb
--- /dev/null
+++ b/Source/core/svg/SVGPoint.h
@@ -0,0 +1,37 @@
+/*
+ * 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this 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 SVGPoint_h
+#define SVGPoint_h
+
+#include "core/platform/graphics/FloatRect.h"
+
+namespace WebCore {
+
+typedef FloatPoint SVGPoint;
+
+} // namespace WebCore
+
+#endif // SVGPoint_h
diff --git a/Source/core/svg/SVGPointList.h b/Source/core/svg/SVGPointList.h
index 570e6df..7b7ffd6 100644
--- a/Source/core/svg/SVGPointList.h
+++ b/Source/core/svg/SVGPointList.h
@@ -21,15 +21,13 @@
 #ifndef SVGPointList_h
 #define SVGPointList_h
 
-#include "core/dom/QualifiedName.h"
+#include "core/svg/SVGPoint.h"
 #include "core/svg/properties/SVGPropertyTraits.h"
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-class FloatPoint;
-
-class SVGPointList : public Vector<FloatPoint> {
+class SVGPointList : public Vector<SVGPoint> {
 public:
     SVGPointList() { }
 
@@ -39,7 +37,7 @@
 template<>
 struct SVGPropertyTraits<SVGPointList> {
     static SVGPointList initialValue() { return SVGPointList(); }
-    typedef FloatPoint ListItemType;
+    typedef SVGPoint ListItemType;
 };
 
 } // namespace WebCore
diff --git a/Source/core/svg/SVGPreserveAspectRatio.cpp b/Source/core/svg/SVGPreserveAspectRatio.cpp
index d51dc04..0b0e966 100644
--- a/Source/core/svg/SVGPreserveAspectRatio.cpp
+++ b/Source/core/svg/SVGPreserveAspectRatio.cpp
@@ -40,7 +40,7 @@
 void SVGPreserveAspectRatio::setAlign(unsigned short align, ExceptionCode& ec)
 {
     if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
@@ -50,7 +50,7 @@
 void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, ExceptionCode& ec)
 {
     if (meetOrSlice == SVG_MEETORSLICE_UNKNOWN || meetOrSlice > SVG_MEETORSLICE_SLICE) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return;
     }
 
diff --git a/Source/core/svg/SVGRadialGradientElement.cpp b/Source/core/svg/SVGRadialGradientElement.cpp
index 9f27105..9fcd9a7 100644
--- a/Source/core/svg/SVGRadialGradientElement.cpp
+++ b/Source/core/svg/SVGRadialGradientElement.cpp
@@ -141,14 +141,14 @@
             return false;
 
         if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr))
-            attributes.setSpreadMethod(current->spreadMethod());
+            attributes.setSpreadMethod(current->spreadMethodCurrentValue());
 
         if (!attributes.hasGradientUnits() && current->hasAttribute(SVGNames::gradientUnitsAttr))
-            attributes.setGradientUnits(current->gradientUnits());
+            attributes.setGradientUnits(current->gradientUnitsCurrentValue());
 
         if (!attributes.hasGradientTransform() && current->hasAttribute(SVGNames::gradientTransformAttr)) {
             AffineTransform transform;
-            current->gradientTransform().concatenate(transform);
+            current->gradientTransformCurrentValue().concatenate(transform);
             attributes.setGradientTransform(transform);
         }
 
@@ -162,28 +162,28 @@
             SVGRadialGradientElement* radial = static_cast<SVGRadialGradientElement*>(current);
 
             if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr))
-                attributes.setCx(radial->cx());
+                attributes.setCx(radial->cxCurrentValue());
 
             if (!attributes.hasCy() && current->hasAttribute(SVGNames::cyAttr))
-                attributes.setCy(radial->cy());
+                attributes.setCy(radial->cyCurrentValue());
 
             if (!attributes.hasR() && current->hasAttribute(SVGNames::rAttr))
-                attributes.setR(radial->r());
+                attributes.setR(radial->rCurrentValue());
 
             if (!attributes.hasFx() && current->hasAttribute(SVGNames::fxAttr))
-                attributes.setFx(radial->fx());
+                attributes.setFx(radial->fxCurrentValue());
 
             if (!attributes.hasFy() && current->hasAttribute(SVGNames::fyAttr))
-                attributes.setFy(radial->fy());
+                attributes.setFy(radial->fyCurrentValue());
 
             if (!attributes.hasFr() && current->hasAttribute(SVGNames::frAttr))
-                attributes.setFr(radial->fr());
+                attributes.setFr(radial->frCurrentValue());
         }
 
         processedGradients.add(current);
 
         // Respect xlink:href, take attributes from referenced element
-        Node* refNode = SVGURIReference::targetElementFromIRIString(current->href(), document());
+        Node* refNode = SVGURIReference::targetElementFromIRIString(current->hrefCurrentValue(), document());
         if (refNode && (refNode->hasTagName(SVGNames::radialGradientTag) || refNode->hasTagName(SVGNames::linearGradientTag))) {
             current = static_cast<SVGGradientElement*>(refNode);
 
@@ -209,12 +209,12 @@
 
 bool SVGRadialGradientElement::selfHasRelativeLengths() const
 {
-    return cx().isRelative()
-        || cy().isRelative()
-        || r().isRelative()
-        || fx().isRelative()
-        || fy().isRelative()
-        || fr().isRelative();
+    return cxCurrentValue().isRelative()
+        || cyCurrentValue().isRelative()
+        || rCurrentValue().isRelative()
+        || fxCurrentValue().isRelative()
+        || fyCurrentValue().isRelative()
+        || frCurrentValue().isRelative();
 }
 
 }
diff --git a/Source/core/svg/SVGRect.h b/Source/core/svg/SVGRect.h
index 24d40c0..7430757 100644
--- a/Source/core/svg/SVGRect.h
+++ b/Source/core/svg/SVGRect.h
@@ -26,10 +26,12 @@
 
 namespace WebCore {
 
+typedef FloatRect SVGRect;
+
 template<>
-struct SVGPropertyTraits<FloatRect> {
-    static FloatRect initialValue() { return FloatRect(); }
-    static String toString(const FloatRect& type)
+struct SVGPropertyTraits<SVGRect> {
+    static SVGRect initialValue() { return SVGRect(); }
+    static String toString(const SVGRect& type)
     {
         StringBuilder builder;
         builder.append(String::number(type.x()));
diff --git a/Source/core/svg/SVGRectElement.cpp b/Source/core/svg/SVGRectElement.cpp
index b00d3df..8d01fcc 100644
--- a/Source/core/svg/SVGRectElement.cpp
+++ b/Source/core/svg/SVGRectElement.cpp
@@ -150,12 +150,12 @@
 
 bool SVGRectElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative()
-        || rx().isRelative()
-        || ry().isRelative();
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative()
+        || rxCurrentValue().isRelative()
+        || ryCurrentValue().isRelative();
 }
 
 RenderObject* SVGRectElement::createRenderer(RenderStyle*)
diff --git a/Source/core/svg/SVGSVGElement.cpp b/Source/core/svg/SVGSVGElement.cpp
index 1fb7667..4b8be97 100644
--- a/Source/core/svg/SVGSVGElement.cpp
+++ b/Source/core/svg/SVGSVGElement.cpp
@@ -131,11 +131,11 @@
     setAttribute(SVGNames::contentStyleTypeAttr, type);
 }
 
-FloatRect SVGSVGElement::viewport() const
+SVGRect SVGSVGElement::viewport() const
 {
     // FIXME: This method doesn't follow the spec and is basically untested. Parent documents are not considered here.
     // As we have no test coverage for this, we're going to disable it completly for now.
-    return FloatRect();
+    return SVGRect();
 }
 
 float SVGSVGElement::pixelUnitToMillimeterX() const
@@ -327,7 +327,7 @@
     // FIXME: Implement me (see bug 11275)
 }
 
-PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const FloatRect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect) const
+PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const SVGRect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect) const
 {
     Vector<RefPtr<Node> > nodes;
     Element* element = ElementTraversal::next(referenceElement ? referenceElement : this);
@@ -348,24 +348,24 @@
     return StaticNodeList::adopt(nodes);
 }
 
-PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(const FloatRect& rect, SVGElement* referenceElement) const
+PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(const SVGRect& rect, SVGElement* referenceElement) const
 {
     return collectIntersectionOrEnclosureList(rect, referenceElement, CollectIntersectionList);
 }
 
-PassRefPtr<NodeList> SVGSVGElement::getEnclosureList(const FloatRect& rect, SVGElement* referenceElement) const
+PassRefPtr<NodeList> SVGSVGElement::getEnclosureList(const SVGRect& rect, SVGElement* referenceElement) const
 {
     return collectIntersectionOrEnclosureList(rect, referenceElement, CollectEnclosureList);
 }
 
-bool SVGSVGElement::checkIntersection(SVGElement* element, const FloatRect& rect) const
+bool SVGSVGElement::checkIntersection(SVGElement* element, const SVGRect& rect) const
 {
     if (!element)
         return false;
     return RenderSVGModelObject::checkIntersection(element->renderer(), rect);
 }
 
-bool SVGSVGElement::checkEnclosure(SVGElement* element, const FloatRect& rect) const
+bool SVGSVGElement::checkEnclosure(SVGElement* element, const SVGRect& rect) const
 {
     if (!element)
         return false;
@@ -393,9 +393,9 @@
     return SVGAngle();
 }
 
-FloatPoint SVGSVGElement::createSVGPoint()
+SVGPoint SVGSVGElement::createSVGPoint()
 {
-    return FloatPoint();
+    return SVGPoint();
 }
 
 SVGMatrix SVGSVGElement::createSVGMatrix()
@@ -403,9 +403,9 @@
     return SVGMatrix();
 }
 
-FloatRect SVGSVGElement::createSVGRect()
+SVGRect SVGSVGElement::createSVGRect()
 {
-    return FloatRect();
+    return SVGRect();
 }
 
 SVGTransform SVGSVGElement::createSVGTransform()
@@ -429,7 +429,7 @@
     AffineTransform transform;
     if (!isOutermostSVGSVGElement()) {
         SVGLengthContext lengthContext(this);
-        transform.translate(x().value(lengthContext), y().value(lengthContext));
+        transform.translate(xCurrentValue().value(lengthContext), yCurrentValue().value(lengthContext));
     } else if (mode == SVGLocatable::ScreenScope) {
         if (RenderObject* renderer = this->renderer()) {
             FloatPoint location;
@@ -537,34 +537,34 @@
 
 bool SVGSVGElement::selfHasRelativeLengths() const
 {
-    return x().isRelative()
-        || y().isRelative()
-        || width().isRelative()
-        || height().isRelative()
+    return xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative()
         || hasAttribute(SVGNames::viewBoxAttr);
 }
 
-FloatRect SVGSVGElement::currentViewBoxRect() const
+SVGRect SVGSVGElement::currentViewBoxRect() const
 {
     if (m_useCurrentView)
-        return m_viewSpec ? m_viewSpec->viewBox() : FloatRect();
+        return m_viewSpec ? m_viewSpec->viewBoxCurrentValue() : SVGRect();
 
-    FloatRect useViewBox = viewBox();
+    FloatRect useViewBox = viewBoxCurrentValue();
     if (!useViewBox.isEmpty())
         return useViewBox;
     if (!renderer() || !renderer()->isSVGRoot())
-        return FloatRect();
+        return SVGRect();
     if (!toRenderSVGRoot(renderer())->isEmbeddedThroughSVGImage())
-        return FloatRect();
+        return SVGRect();
 
     Length intrinsicWidth = this->intrinsicWidth();
     Length intrinsicHeight = this->intrinsicHeight();
     if (!intrinsicWidth.isFixed() || !intrinsicHeight.isFixed())
-        return FloatRect();
+        return SVGRect();
 
     // If no viewBox is specified but non-relative width/height values, then we
     // should always synthesize a viewBox if we're embedded through a SVGImage.    
-    return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)));
+    return SVGRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)));
 }
 
 FloatSize SVGSVGElement::currentViewportSize() const
@@ -637,11 +637,11 @@
 Length SVGSVGElement::intrinsicWidth(ConsiderCSSMode mode) const
 {
     if (widthAttributeEstablishesViewport() || mode == IgnoreCSSProperties) {
-        if (width().unitType() == LengthTypePercentage)
-            return Length(width().valueAsPercentage() * 100, Percent);
+        if (widthCurrentValue().unitType() == LengthTypePercentage)
+            return Length(widthCurrentValue().valueAsPercentage() * 100, Percent);
 
         SVGLengthContext lengthContext(this);
-        return Length(width().value(lengthContext), Fixed);
+        return Length(widthCurrentValue().value(lengthContext), Fixed);
     }
 
     ASSERT(renderer());
@@ -651,11 +651,11 @@
 Length SVGSVGElement::intrinsicHeight(ConsiderCSSMode mode) const
 {
     if (heightAttributeEstablishesViewport() || mode == IgnoreCSSProperties) {
-        if (height().unitType() == LengthTypePercentage)
-            return Length(height().valueAsPercentage() * 100, Percent);
+        if (heightCurrentValue().unitType() == LengthTypePercentage)
+            return Length(heightCurrentValue().valueAsPercentage() * 100, Percent);
 
         SVGLengthContext lengthContext(this);
-        return Length(height().value(lengthContext), Fixed);
+        return Length(heightCurrentValue().value(lengthContext), Fixed);
     }
 
     ASSERT(renderer());
@@ -665,9 +665,9 @@
 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
 {
     if (!m_useCurrentView || !m_viewSpec)
-        return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatio(), viewWidth, viewHeight);
+        return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatioCurrentValue(), viewWidth, viewHeight);
 
-    AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec->preserveAspectRatio(), viewWidth, viewHeight);
+    AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec->preserveAspectRatioCurrentValue(), viewWidth, viewHeight);
     const SVGTransformList& transformList = m_viewSpec->transformBaseValue();
     if (transformList.isEmpty())
         return ctm;
@@ -738,9 +738,9 @@
     m_useCurrentView = true;
 
     if (viewElement->hasAttribute(SVGNames::viewBoxAttr))
-        view->setViewBoxBaseValue(viewElement->viewBox());
+        view->setViewBoxBaseValue(viewElement->viewBoxCurrentValue());
     else
-        view->setViewBoxBaseValue(viewBox());
+        view->setViewBoxBaseValue(viewBoxCurrentValue());
 
     if (viewElement->hasAttribute(SVGNames::preserveAspectRatioAttr))
         view->setPreserveAspectRatioBaseValue(viewElement->preserveAspectRatioBaseValue());
diff --git a/Source/core/svg/SVGSVGElement.h b/Source/core/svg/SVGSVGElement.h
index 45cc287..b0c0a3b 100644
--- a/Source/core/svg/SVGSVGElement.h
+++ b/Source/core/svg/SVGSVGElement.h
@@ -59,7 +59,7 @@
     const AtomicString& contentStyleType() const;
     void setContentStyleType(const AtomicString& type);
 
-    FloatRect viewport() const;
+    SVGRect viewport() const;
 
     float pixelUnitToMillimeterX() const;
     float pixelUnitToMillimeterY() const;
@@ -78,12 +78,12 @@
     Length intrinsicWidth(ConsiderCSSMode = RespectCSSProperties) const;
     Length intrinsicHeight(ConsiderCSSMode = RespectCSSProperties) const;
     FloatSize currentViewportSize() const;
-    FloatRect currentViewBoxRect() const;
+    SVGRect currentViewBoxRect() const;
 
     float currentScale() const;
     void setCurrentScale(float scale);
 
-    FloatPoint& currentTranslate() { return m_translation; }
+    SVGPoint& currentTranslate() { return m_translation; }
     void setCurrentTranslate(const FloatPoint&);
 
     // Only used from the bindings.
@@ -103,18 +103,18 @@
     void unsuspendRedrawAll();
     void forceRedraw();
 
-    PassRefPtr<NodeList> getIntersectionList(const FloatRect&, SVGElement* referenceElement) const;
-    PassRefPtr<NodeList> getEnclosureList(const FloatRect&, SVGElement* referenceElement) const;
-    bool checkIntersection(SVGElement*, const FloatRect&) const;
-    bool checkEnclosure(SVGElement*, const FloatRect&) const;
+    PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referenceElement) const;
+    PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceElement) const;
+    bool checkIntersection(SVGElement*, const SVGRect&) const;
+    bool checkEnclosure(SVGElement*, const SVGRect&) const;
     void deselectAll();
 
     static float createSVGNumber();
     static SVGLength createSVGLength();
     static SVGAngle createSVGAngle();
-    static FloatPoint createSVGPoint();
+    static SVGPoint createSVGPoint();
     static SVGMatrix createSVGMatrix();
-    static FloatRect createSVGRect();
+    static SVGRect createSVGRect();
     static SVGTransform createSVGTransform();
     static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&);
 
@@ -130,7 +130,7 @@
     SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
     void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
 
-    bool hasEmptyViewBox() const { return viewBoxIsValid() && viewBox().isEmpty(); }
+    bool hasEmptyViewBox() const { return viewBoxIsValid() && viewBoxCurrentValue().isEmpty(); }
 
 private:
     SVGSVGElement(const QualifiedName&, Document*);
@@ -157,7 +157,7 @@
         CollectEnclosureList
     };
 
-    PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const FloatRect&, SVGElement*, CollectIntersectionOrEnclosure) const;
+    PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGElement*, CollectIntersectionOrEnclosure) const;
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
         DECLARE_ANIMATED_LENGTH(X, x)
@@ -174,7 +174,7 @@
     bool m_useCurrentView;
     SVGZoomAndPanType m_zoomAndPan;
     RefPtr<SMILTimeContainer> m_timeContainer;
-    FloatPoint m_translation;
+    SVGPoint m_translation;
     RefPtr<SVGViewSpec> m_viewSpec;
 };
 
diff --git a/Source/core/svg/SVGScriptElement.cpp b/Source/core/svg/SVGScriptElement.cpp
index 754f98d..2441228 100644
--- a/Source/core/svg/SVGScriptElement.cpp
+++ b/Source/core/svg/SVGScriptElement.cpp
@@ -23,10 +23,12 @@
 #include "core/svg/SVGScriptElement.h"
 
 #include "HTMLNames.h"
+#include "XLinkNames.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
 #include "core/dom/EventNames.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h"
 
@@ -43,8 +45,8 @@
 
 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool alreadyStarted)
     : SVGElement(tagName, document)
-    , ScriptElement(this, wasInsertedByParser, alreadyStarted)
     , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
+    , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted))
 {
     ASSERT(hasTagName(SVGNames::scriptTag));
     ScriptWrappable::init(this);
@@ -106,7 +108,7 @@
         return;
 
     if (SVGURIReference::isKnownAttribute(attrName)) {
-        handleSourceAttribute(href());
+        m_loader->handleSourceAttribute(hrefCurrentValue());
         return;
     }
 
@@ -119,7 +121,7 @@
 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent)
 {
     SVGElement::insertedInto(rootParent);
-    ScriptElement::insertedInto(rootParent);
+    m_loader->insertedInto(rootParent);
     if (rootParent->inDocument())
         SVGExternalResourcesRequired::insertedIntoDocument(this);
     return InsertionDone;
@@ -128,7 +130,7 @@
 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-    ScriptElement::childrenChanged();
+    m_loader->childrenChanged();
 }
 
 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const
@@ -156,12 +158,12 @@
 {
     SVGElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document()->completeURL(href()));
+    addSubresourceURL(urls, document()->completeURL(hrefCurrentValue()));
 }
 
 String SVGScriptElement::sourceAttributeValue() const
 {
-    return href();
+    return hrefCurrentValue();
 }
 
 String SVGScriptElement::charsetAttributeValue() const
@@ -206,7 +208,27 @@
 
 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren()
 {
-    return adoptRef(new SVGScriptElement(tagQName(), document(), false, alreadyStarted()));
+    return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_loader->alreadyStarted()));
+}
+
+void SVGScriptElement::setHaveFiredLoadEvent(bool haveFiredLoadEvent)
+{
+    m_loader->setHaveFiredLoadEvent(haveFiredLoadEvent);
+}
+
+bool SVGScriptElement::isParserInserted() const
+{
+    return m_loader->isParserInserted();
+}
+
+bool SVGScriptElement::haveFiredLoadEvent() const
+{
+    return m_loader->haveFiredLoadEvent();
+}
+
+Timer<SVGElement>* SVGScriptElement::svgLoadEventTimer()
+{
+    return &m_svgLoadEventTimer;
 }
 
 }
diff --git a/Source/core/svg/SVGScriptElement.h b/Source/core/svg/SVGScriptElement.h
index 820d5b2..667725c 100644
--- a/Source/core/svg/SVGScriptElement.h
+++ b/Source/core/svg/SVGScriptElement.h
@@ -22,7 +22,7 @@
 #define SVGScriptElement_h
 
 #include "SVGNames.h"
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoaderClient.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGAnimatedString.h"
 #include "core/svg/SVGElement.h"
@@ -31,16 +31,21 @@
 
 namespace WebCore {
 
-class SVGScriptElement FINAL : public SVGElement
-                             , public SVGURIReference
-                             , public SVGExternalResourcesRequired
-                             , public ScriptElement {
+class ScriptLoader;
+
+class SVGScriptElement FINAL
+    : public SVGElement
+    , public SVGURIReference
+    , public SVGExternalResourcesRequired
+    , public ScriptLoaderClient {
 public:
     static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser);
 
     String type() const;
     void setType(const String&);
 
+    ScriptLoader* loader() const { return m_loader.get(); }
+
 private:
     SVGScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
 
@@ -72,10 +77,10 @@
     virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
 
     // SVGExternalResourcesRequired
-    virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { ScriptElement::setHaveFiredLoadEvent(haveFiredLoadEvent); }
-    virtual bool isParserInserted() const { return ScriptElement::isParserInserted(); }
-    virtual bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoadEvent(); }
-    virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadEventTimer; }
+    virtual void setHaveFiredLoadEvent(bool) OVERRIDE;
+    virtual bool isParserInserted() const OVERRIDE;
+    virtual bool haveFiredLoadEvent() const OVERRIDE;
+    virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE;
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement)
         DECLARE_ANIMATED_STRING(Href, href)
@@ -84,6 +89,7 @@
 
     String m_type;
     Timer<SVGElement> m_svgLoadEventTimer;
+    OwnPtr<ScriptLoader> m_loader;
 };
 
 inline SVGScriptElement* toSVGScriptElement(Node* node)
diff --git a/Source/core/svg/SVGStyleElement.cpp b/Source/core/svg/SVGStyleElement.cpp
index 4d87e87..2a704a4 100644
--- a/Source/core/svg/SVGStyleElement.cpp
+++ b/Source/core/svg/SVGStyleElement.cpp
@@ -100,10 +100,8 @@
 bool SVGStyleElement::isSupportedAttribute(const QualifiedName& attrName)
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
-    if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
+    if (supportedAttributes.isEmpty())
         supportedAttributes.add(SVGNames::titleAttr);
-    }
     return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
 }
 
@@ -120,9 +118,6 @@
         return;
     }
 
-    if (SVGLangSpace::parseAttribute(name, value))
-        return;
-
     ASSERT_NOT_REACHED();
 }
 
diff --git a/Source/core/svg/SVGStyledElement.cpp b/Source/core/svg/SVGStyledElement.cpp
index 9a683d4..718a938 100644
--- a/Source/core/svg/SVGStyledElement.cpp
+++ b/Source/core/svg/SVGStyledElement.cpp
@@ -330,7 +330,7 @@
     }
 
     if (attrName == HTMLNames::classAttr) {
-        classAttributeChanged(className());
+        classAttributeChanged(classNameCurrentValue());
         SVGElementInstance::invalidateAllInstancesOfElement(this);
         return;
     }
diff --git a/Source/core/svg/SVGStyledElement.h b/Source/core/svg/SVGStyledElement.h
index 4b676d1..9108c37 100644
--- a/Source/core/svg/SVGStyledElement.h
+++ b/Source/core/svg/SVGStyledElement.h
@@ -23,6 +23,7 @@
 
 #include "CSSPropertyNames.h"
 #include "core/svg/SVGAnimatedString.h"
+#include "core/svg/SVGElement.h"
 #include "core/svg/SVGLocatable.h"
 #include <wtf/HashSet.h>
 #include <wtf/PassRefPtr.h>
diff --git a/Source/core/svg/SVGSymbolElement.cpp b/Source/core/svg/SVGSymbolElement.cpp
index 8693727..02975cf 100644
--- a/Source/core/svg/SVGSymbolElement.cpp
+++ b/Source/core/svg/SVGSymbolElement.cpp
@@ -58,7 +58,6 @@
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
         SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
         SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
     }
@@ -72,8 +71,6 @@
         return;
     }
 
-    if (SVGLangSpace::parseAttribute(name, value))
-        return;
     if (SVGExternalResourcesRequired::parseAttribute(name, value))
         return;
     if (SVGFitToViewBox::parseAttribute(this, name, value))
diff --git a/Source/core/svg/SVGTRefElement.cpp b/Source/core/svg/SVGTRefElement.cpp
index 553ba68..5d2e051 100644
--- a/Source/core/svg/SVGTRefElement.cpp
+++ b/Source/core/svg/SVGTRefElement.cpp
@@ -180,7 +180,7 @@
 
     // Mark the referenced ID as pending.
     String id;
-    SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id);
     if (!id.isEmpty())
         document()->accessSVGExtensions()->addPendingResource(id, this);
 }
@@ -260,7 +260,7 @@
         return;
 
     String id;
-    RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id);
     if (!target.get()) {
         if (id.isEmpty())
             return;
diff --git a/Source/core/svg/SVGTests.h b/Source/core/svg/SVGTests.h
index 19fa13f..2b2d6a2 100644
--- a/Source/core/svg/SVGTests.h
+++ b/Source/core/svg/SVGTests.h
@@ -22,7 +22,6 @@
 #define SVGTests_h
 
 #include "core/svg/SVGStringList.h"
-#include "core/svg/properties/SVGAnimatedProperty.h"
 #include "core/svg/properties/SVGAnimatedPropertyMacros.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGTextContentElement.cpp b/Source/core/svg/SVGTextContentElement.cpp
index 9a41300..590a7f4 100644
--- a/Source/core/svg/SVGTextContentElement.cpp
+++ b/Source/core/svg/SVGTextContentElement.cpp
@@ -89,7 +89,7 @@
            (ownerType, textLengthPropertyInfo(), ownerType->m_textLength.value);
 }
 
-PassRefPtr<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated()
+PassRefPtr<SVGAnimatedLength> SVGTextContentElement::textLength()
 {
     DEFINE_STATIC_LOCAL(SVGLength, defaultTextLength, (LengthModeOther));
     if (m_specifiedTextLength == defaultTextLength)
@@ -118,44 +118,44 @@
 
     unsigned numberOfChars = getNumberOfChars();
     if (charnum >= numberOfChars) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0.0f;
     }
 
     return SVGTextQuery(renderer()).subStringLength(charnum, nchars);
 }
 
-FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec)
+SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return FloatPoint();
     }
 
     return SVGTextQuery(renderer()).startPositionOfCharacter(charnum);
 }
 
-FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec)
+SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return FloatPoint();
     }
 
     return SVGTextQuery(renderer()).endPositionOfCharacter(charnum);
 }
 
-FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec)
+SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = INDEX_SIZE_ERR;
-        return FloatRect();
+        ec = IndexSizeError;
+        return SVGRect();
     }
 
     return SVGTextQuery(renderer()).extentOfCharacter(charnum);
@@ -166,14 +166,14 @@
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return 0.0f;
     }
 
     return SVGTextQuery(renderer()).rotationOfCharacter(charnum);
 }
 
-int SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point)
+int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point)
 {
     document()->updateLayoutIgnorePendingStylesheets();
     return SVGTextQuery(renderer()).characterNumberAtPosition(point);
@@ -183,7 +183,7 @@
 {
     unsigned numberOfChars = getNumberOfChars();
     if (charnum >= numberOfChars) {
-        ec = INDEX_SIZE_ERR;
+        ec = IndexSizeError;
         return;
     }
 
diff --git a/Source/core/svg/SVGTextContentElement.h b/Source/core/svg/SVGTextContentElement.h
index 6b1d0fa..f937bd1 100644
--- a/Source/core/svg/SVGTextContentElement.h
+++ b/Source/core/svg/SVGTextContentElement.h
@@ -77,11 +77,11 @@
     unsigned getNumberOfChars();
     float getComputedTextLength();
     float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&);
-    FloatPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&);
-    FloatPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&);
-    FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&);
+    SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&);
+    SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&);
+    SVGRect getExtentOfChar(unsigned charnum, ExceptionCode&);
     float getRotationOfChar(unsigned charnum, ExceptionCode&);
-    int getCharNumAtPosition(const FloatPoint&);
+    int getCharNumAtPosition(const SVGPoint&);
     void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&);
 
     static SVGTextContentElement* elementFromRenderer(RenderObject*);
@@ -89,7 +89,7 @@
     // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro
     // as its getter needs special handling (return getComputedTextLength(), instead of m_textLength).
     SVGLength& specifiedTextLength() { return m_specifiedTextLength; }
-    PassRefPtr<SVGAnimatedLength> textLengthAnimated();
+    PassRefPtr<SVGAnimatedLength> textLength();
     static const SVGPropertyInfo* textLengthPropertyInfo();
 
 protected:
diff --git a/Source/core/svg/SVGTextElement.cpp b/Source/core/svg/SVGTextElement.cpp
index ff72883..ef3a4a3 100644
--- a/Source/core/svg/SVGTextElement.cpp
+++ b/Source/core/svg/SVGTextElement.cpp
@@ -57,8 +57,9 @@
         style->applyTransform(t, IntSize(0, 0), RenderStyle::ExcludeTransformOrigin);
         // Flatten any 3D transform
         matrix = t.toAffineTransform();
-    } else
-        transform().concatenate(matrix);
+    } else {
+        transformCurrentValue().concatenate(matrix);
+    }
 
     const AffineTransform* transform = const_cast<SVGTextElement*>(this)->supplementalTransform();
     if (transform)
diff --git a/Source/core/svg/SVGTextElement.h b/Source/core/svg/SVGTextElement.h
index 998a069..6765d0c 100644
--- a/Source/core/svg/SVGTextElement.h
+++ b/Source/core/svg/SVGTextElement.h
@@ -21,7 +21,6 @@
 #ifndef SVGTextElement_h
 #define SVGTextElement_h
 
-#include "core/svg/SVGAnimatedTransformList.h"
 #include "core/svg/SVGTextPositioningElement.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGTextPathElement.cpp b/Source/core/svg/SVGTextPathElement.cpp
index 5541cb3..e0f85cb 100644
--- a/Source/core/svg/SVGTextPathElement.cpp
+++ b/Source/core/svg/SVGTextPathElement.cpp
@@ -23,6 +23,7 @@
 #include "core/svg/SVGTextPathElement.h"
 
 #include "SVGNames.h"
+#include "XLinkNames.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/rendering/svg/RenderSVGResource.h"
 #include "core/rendering/svg/RenderSVGTextPath.h"
@@ -160,7 +161,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+    Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id);
     if (!target) {
         // Do not register as pending if we are already pending this resource.
         if (document()->accessSVGExtensions()->isElementPendingResource(this, id))
@@ -193,7 +194,7 @@
 
 bool SVGTextPathElement::selfHasRelativeLengths() const
 {
-    return startOffset().isRelative()
+    return startOffsetCurrentValue().isRelative()
         || SVGTextContentElement::selfHasRelativeLengths();
 }
 
diff --git a/Source/core/svg/SVGTransform.cpp b/Source/core/svg/SVGTransform.cpp
index c1fe23b..881df41 100644
--- a/Source/core/svg/SVGTransform.cpp
+++ b/Source/core/svg/SVGTransform.cpp
@@ -59,7 +59,7 @@
     m_matrix = matrix;
 }
 
-void SVGTransform::updateMatrix()
+void SVGTransform::updateSvgMatrix()
 {
     // The underlying matrix has been changed, alter the transformation type.
     // Spec: In case the matrix object is changed directly (i.e., without using the methods on the SVGTransform interface itself)
diff --git a/Source/core/svg/SVGTransform.h b/Source/core/svg/SVGTransform.h
index deb2ef8..9a36729 100644
--- a/Source/core/svg/SVGTransform.h
+++ b/Source/core/svg/SVGTransform.h
@@ -54,7 +54,7 @@
 
     SVGMatrix& svgMatrix() { return static_cast<SVGMatrix&>(m_matrix); }
     AffineTransform matrix() const { return m_matrix; }
-    void updateMatrix();
+    void updateSvgMatrix();
 
     float angle() const { return m_angle; }
     FloatPoint rotationCenter() const { return m_center; }
diff --git a/Source/core/svg/SVGTransform.idl b/Source/core/svg/SVGTransform.idl
index df5d9b3..99d7fc2 100644
--- a/Source/core/svg/SVGTransform.idl
+++ b/Source/core/svg/SVGTransform.idl
@@ -30,7 +30,7 @@
     const unsigned short SVG_TRANSFORM_SKEWY = 6;
 
     readonly attribute unsigned short type;
-    readonly attribute SVGMatrix matrix;
+    [ImplementedAs=svgMatrix] readonly attribute SVGMatrix matrix;
     readonly attribute float angle;
 
     [StrictTypeChecking] void setMatrix(SVGMatrix matrix);
diff --git a/Source/core/svg/SVGTransformable.h b/Source/core/svg/SVGTransformable.h
index b7c6f3d..cafc4ba 100644
--- a/Source/core/svg/SVGTransformable.h
+++ b/Source/core/svg/SVGTransformable.h
@@ -23,12 +23,12 @@
 
 #include "core/svg/SVGLocatable.h"
 #include "core/svg/SVGTransform.h"
-#include "core/svg/SVGTransformList.h"
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
     
 class AffineTransform;
+class SVGTransformList;
 
 class SVGTransformable : virtual public SVGLocatable {
 public:
diff --git a/Source/core/svg/SVGURIReference.cpp b/Source/core/svg/SVGURIReference.cpp
index 3a2563f..270e261 100644
--- a/Source/core/svg/SVGURIReference.cpp
+++ b/Source/core/svg/SVGURIReference.cpp
@@ -22,6 +22,7 @@
 
 #include "core/svg/SVGURIReference.h"
 
+#include "XLinkNames.h"
 #include "core/dom/Document.h"
 #include "weborigin/KURL.h"
 
diff --git a/Source/core/svg/SVGURIReference.h b/Source/core/svg/SVGURIReference.h
index 823211a..de25107 100644
--- a/Source/core/svg/SVGURIReference.h
+++ b/Source/core/svg/SVGURIReference.h
@@ -21,7 +21,6 @@
 #ifndef SVGURIReference_h
 #define SVGURIReference_h
 
-#include "XLinkNames.h"
 #include "core/dom/Document.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 418d1b7..a1aeec2 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -188,7 +188,7 @@
 
 Document* SVGUseElement::referencedDocument() const
 {
-    if (!isExternalURIReference(href(), document()))
+    if (!isExternalURIReference(hrefCurrentValue(), document()))
         return document();
     return externalDocument();
 }
@@ -229,9 +229,9 @@
         return;
 
     if (SVGURIReference::isKnownAttribute(attrName)) {
-        bool isExternalReference = isExternalURIReference(href(), document());
+        bool isExternalReference = isExternalURIReference(hrefCurrentValue(), document());
         if (isExternalReference) {
-            KURL url = document()->completeURL(href());
+            KURL url = document()->completeURL(hrefCurrentValue());
             if (url.hasFragmentIdentifier()) {
                 CachedResourceRequest request(ResourceRequest(url.string()), localName());
                 setCachedDocument(document()->cachedResourceLoader()->requestSVGDocument(request));
@@ -398,7 +398,7 @@
         return;
 
     String id;
-    Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id, externalDocument());
+    Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentValue(), document(), &id, externalDocument());
     if (!target || !target->inDocument()) {
         // If we can't find the target of an external element, just give up.
         // We can't observe if the target somewhen enters the external document, nor should we do it.
@@ -551,7 +551,7 @@
             toSVGGraphicsElement(n)->toClipPath(path);
             // FIXME: Avoid manual resolution of x/y here. Its potentially harmful.
             SVGLengthContext lengthContext(this);
-            path.translate(FloatSize(x().value(lengthContext), y().value(lengthContext)));
+            path.translate(FloatSize(xCurrentValue().value(lengthContext), yCurrentValue().value(lengthContext)));
             path.transform(animatedLocalTransform());
         }
     }
@@ -633,7 +633,7 @@
 
 bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, SVGElement*& newTarget)
 {
-    Element* targetElement = SVGURIReference::targetElementFromIRIString(use->href(), referencedDocument());
+    Element* targetElement = SVGURIReference::targetElementFromIRIString(use->hrefCurrentValue(), referencedDocument());
     newTarget = 0;
     if (targetElement && targetElement->isSVGElement())
         newTarget = toSVGElement(targetElement);
@@ -705,7 +705,7 @@
         SVGUseElement* use = static_cast<SVGUseElement*>(element);
         ASSERT(!use->cachedDocumentIsStillLoading());
 
-        Element* targetElement = SVGURIReference::targetElementFromIRIString(use->href(), referencedDocument());
+        Element* targetElement = SVGURIReference::targetElementFromIRIString(use->hrefCurrentValue(), referencedDocument());
         SVGElement* target = 0;
         if (targetElement && targetElement->isSVGElement())
             target = toSVGElement(targetElement);
@@ -918,10 +918,10 @@
 
 bool SVGUseElement::selfHasRelativeLengths() const
 {
-    if (x().isRelative()
-     || y().isRelative()
-     || width().isRelative()
-     || height().isRelative())
+    if (xCurrentValue().isRelative()
+        || yCurrentValue().isRelative()
+        || widthCurrentValue().isRelative()
+        || heightCurrentValue().isRelative())
         return true;
 
     if (!m_targetElementInstance)
diff --git a/Source/core/svg/SVGVKernElement.cpp b/Source/core/svg/SVGVKernElement.cpp
index 65a03fe..d78c777 100644
--- a/Source/core/svg/SVGVKernElement.cpp
+++ b/Source/core/svg/SVGVKernElement.cpp
@@ -24,6 +24,7 @@
 
 #include "SVGNames.h"
 #include "core/svg/SVGFontElement.h"
+#include "core/svg/SVGParserUtilities.h"
 
 namespace WebCore {
 
@@ -43,10 +44,8 @@
 {
     if (rootParent->inDocument()) {
         ContainerNode* fontNode = parentNode();
-        if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
-            if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
-                element->invalidateGlyphCache();
-        }
+        if (fontNode && fontNode->hasTagName(SVGNames::fontTag))
+            toSVGFontElement(fontNode)->invalidateGlyphCache();
     }
 
     return SVGElement::insertedInto(rootParent);
@@ -55,10 +54,9 @@
 void SVGVKernElement::removedFrom(ContainerNode* rootParent)
 {
     ContainerNode* fontNode = parentNode();
-    if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
-        if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
-            element->invalidateGlyphCache();
-    }
+    if (fontNode && fontNode->hasTagName(SVGNames::fontTag))
+        toSVGFontElement(fontNode)->invalidateGlyphCache();
+
     SVGElement::removedFrom(rootParent);
 }
 
diff --git a/Source/core/svg/SVGVKernElement.h b/Source/core/svg/SVGVKernElement.h
index 1238ac9..3a788b3 100644
--- a/Source/core/svg/SVGVKernElement.h
+++ b/Source/core/svg/SVGVKernElement.h
@@ -21,12 +21,8 @@
 #define SVGVKernElement_h
 
 #if ENABLE(SVG_FONTS)
+#include "core/svg/SVGElement.h"
 #include "core/svg/SVGFontElement.h"
-#include "core/svg/SVGParserUtilities.h"
-#include "core/svg/SVGStyledElement.h"
-
-#include <limits>
-#include <wtf/Forward.h>
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGViewSpec.cpp b/Source/core/svg/SVGViewSpec.cpp
index cbc3cf1..9f3c344 100644
--- a/Source/core/svg/SVGViewSpec.cpp
+++ b/Source/core/svg/SVGViewSpec.cpp
@@ -106,7 +106,7 @@
 void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionCode& ec)
 {
     // SVGViewSpec and all of its content is read-only.
-    ec = NO_MODIFICATION_ALLOWED_ERR;
+    ec = NoModificationAllowedError;
 }
 
 void SVGViewSpec::setTransformString(const String& transform)
@@ -156,14 +156,14 @@
     return static_cast<SVGTransformListPropertyTearOff*>(static_pointer_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal());
 }
 
-PassRefPtr<SVGAnimatedRect> SVGViewSpec::viewBoxAnimated()
+PassRefPtr<SVGAnimatedRect> SVGViewSpec::viewBox()
 {
     if (!m_contextElement)
         return 0;
     return static_pointer_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this));
 }
 
-PassRefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatioAnimated()
+PassRefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatio()
 {
     if (!m_contextElement)
         return 0;
diff --git a/Source/core/svg/SVGViewSpec.h b/Source/core/svg/SVGViewSpec.h
index 06f6d31..17308ee 100644
--- a/Source/core/svg/SVGViewSpec.h
+++ b/Source/core/svg/SVGViewSpec.h
@@ -71,14 +71,14 @@
     SVGTransformList transformBaseValue() const { return m_transform; }
 
     // Custom animated 'viewBox' property.
-    PassRefPtr<SVGAnimatedRect> viewBoxAnimated();
-    FloatRect& viewBox() { return m_viewBox; }
+    PassRefPtr<SVGAnimatedRect> viewBox();
+    FloatRect& viewBoxCurrentValue() { return m_viewBox; }
     FloatRect viewBoxBaseValue() const { return m_viewBox; }
     void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; }
 
     // Custom animated 'preserveAspectRatio' property.
-    PassRefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
-    SVGPreserveAspectRatio& preserveAspectRatio() { return m_preserveAspectRatio; }
+    PassRefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatio();
+    SVGPreserveAspectRatio& preserveAspectRatioCurrentValue() { return m_preserveAspectRatio; }
     SVGPreserveAspectRatio preserveAspectRatioBaseValue() const { return m_preserveAspectRatio; }
     void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; }
 
diff --git a/Source/core/svg/SVGZoomAndPan.h b/Source/core/svg/SVGZoomAndPan.h
index 061b9fc..8bc89b8 100644
--- a/Source/core/svg/SVGZoomAndPan.h
+++ b/Source/core/svg/SVGZoomAndPan.h
@@ -22,11 +22,8 @@
 #define SVGZoomAndPan_h
 
 #include "SVGNames.h"
-#include "core/dom/Attribute.h"
 #include "core/dom/QualifiedName.h"
 #include <wtf/HashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
@@ -64,10 +61,16 @@
         ASSERT(target);
         ASSERT(target->document());
         if (name == SVGNames::zoomAndPanAttr) {
-            const UChar* start = value.characters();
-            const UChar* end = start + value.length();
             SVGZoomAndPanType zoomAndPan = SVGZoomAndPanUnknown;
-            parseZoomAndPan(start, end, zoomAndPan);
+            if (!value.isEmpty()) {
+                if (value.is8Bit()) {
+                    const LChar* start = value.characters8();
+                    parseZoomAndPan(start, start + value.length(), zoomAndPan);
+                } else {
+                    const UChar* start = value.characters16();
+                    parseZoomAndPan(start, start + value.length(), zoomAndPan);
+                }
+            }
             target->setZoomAndPan(zoomAndPan);
             return true;
         }
diff --git a/Source/core/svg/SVGZoomEvent.cpp b/Source/core/svg/SVGZoomEvent.cpp
index bbdcdd4..f5403d6 100644
--- a/Source/core/svg/SVGZoomEvent.cpp
+++ b/Source/core/svg/SVGZoomEvent.cpp
@@ -34,7 +34,7 @@
     ScriptWrappable::init(this);
 }
 
-FloatRect SVGZoomEvent::zoomRectScreen() const
+SVGRect SVGZoomEvent::zoomRectScreen() const
 {
     return m_zoomRectScreen;
 }
@@ -49,7 +49,7 @@
     m_previousScale = scale;
 }
 
-FloatPoint SVGZoomEvent::previousTranslate() const
+SVGPoint SVGZoomEvent::previousTranslate() const
 {
     return m_previousTranslate;
 }
@@ -64,7 +64,7 @@
     m_newScale = scale;
 }
 
-FloatPoint SVGZoomEvent::newTranslate() const
+SVGPoint SVGZoomEvent::newTranslate() const
 {
     return m_newTranslate;
 }
diff --git a/Source/core/svg/SVGZoomEvent.h b/Source/core/svg/SVGZoomEvent.h
index 13d8e2a..3d2ea73 100644
--- a/Source/core/svg/SVGZoomEvent.h
+++ b/Source/core/svg/SVGZoomEvent.h
@@ -23,7 +23,8 @@
 #define SVGZoomEvent_h
 
 #include "core/dom/UIEvent.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "core/svg/SVGPoint.h"
+#include "core/svg/SVGRect.h"
 
 namespace WebCore {
 
@@ -32,17 +33,17 @@
     static PassRefPtr<SVGZoomEvent> create() { return adoptRef(new SVGZoomEvent); }
 
     // 'SVGZoomEvent' functions
-    FloatRect zoomRectScreen() const;
+    SVGRect zoomRectScreen() const;
 
     float previousScale() const;
     void setPreviousScale(float);
 
-    FloatPoint previousTranslate() const;
+    SVGPoint previousTranslate() const;
 
     float newScale() const;
     void setNewScale(float);
 
-    FloatPoint newTranslate() const;
+    SVGPoint newTranslate() const;
 
     virtual const AtomicString& interfaceName() const;
 
@@ -52,10 +53,10 @@
     float m_newScale;
     float m_previousScale;
 
-    FloatRect m_zoomRectScreen;
+    SVGRect m_zoomRectScreen;
 
-    FloatPoint m_newTranslate;
-    FloatPoint m_previousTranslate;
+    SVGPoint m_newTranslate;
+    SVGPoint m_previousTranslate;
 };
 
 } // namespace WebCore
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp
index c8231a1..a78255a 100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -280,10 +280,10 @@
 
     intrinsicWidth = rootElement->intrinsicWidth();
     intrinsicHeight = rootElement->intrinsicHeight();
-    if (rootElement->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
+    if (rootElement->preserveAspectRatioCurrentValue().align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
         return;
 
-    intrinsicRatio = rootElement->viewBox().size();
+    intrinsicRatio = rootElement->viewBoxCurrentValue().size();
     if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
         intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
 }
diff --git a/Source/core/svg/properties/SVGAnimatedProperty.cpp b/Source/core/svg/properties/SVGAnimatedProperty.cpp
new file mode 100644
index 0000000..e15971c
--- /dev/null
+++ b/Source/core/svg/properties/SVGAnimatedProperty.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. 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/svg/properties/SVGAnimatedProperty.h"
+
+#include "core/svg/SVGElement.h"
+
+namespace WebCore {
+
+SVGAnimatedProperty::SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType)
+    : m_contextElement(contextElement)
+    , m_attributeName(attributeName)
+    , m_animatedPropertyType(animatedPropertyType)
+    , m_isAnimating(false)
+    , m_isReadOnly(false)
+{
+}
+
+SVGAnimatedProperty::~SVGAnimatedProperty()
+{
+    // 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->value == this) {
+            cache->remove(it->key);
+            break;
+        }
+    }
+
+    // Assure that animationEnded() was called, if animationStarted() was called before.
+    ASSERT(!m_isAnimating);
+}
+
+void SVGAnimatedProperty::commitChange()
+{
+    ASSERT(m_contextElement);
+    ASSERT(!m_contextElement->m_deletionHasBegun);
+    m_contextElement->invalidateSVGAttributes();
+    m_contextElement->svgAttributeChanged(m_attributeName);
+}
+
+SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache()
+{
+    static Cache* s_cache = new Cache;
+    return s_cache;
+}
+
+} // namespace WebCore
diff --git a/Source/core/svg/properties/SVGAnimatedProperty.h b/Source/core/svg/properties/SVGAnimatedProperty.h
index 39c956e..efdc5b2 100644
--- a/Source/core/svg/properties/SVGAnimatedProperty.h
+++ b/Source/core/svg/properties/SVGAnimatedProperty.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,7 +21,6 @@
 #ifndef SVGAnimatedProperty_h
 #define SVGAnimatedProperty_h
 
-#include "core/svg/SVGElement.h"
 #include "core/svg/properties/SVGAnimatedPropertyDescription.h"
 #include "core/svg/properties/SVGPropertyInfo.h"
 #include <wtf/RefCounted.h>
@@ -38,34 +38,14 @@
     bool isReadOnly() const { return m_isReadOnly; }
     void setIsReadOnly() { m_isReadOnly = true; }
 
-    void commitChange()
-    {
-        ASSERT(m_contextElement);
-        ASSERT(!m_contextElement->m_deletionHasBegun);
-        m_contextElement->invalidateSVGAttributes();
-        m_contextElement->svgAttributeChanged(m_attributeName);
-    }
+    void commitChange();
 
     virtual bool isAnimatedListTearOff() const { return false; }
 
     // Caching facilities.
     typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache;
 
-    virtual ~SVGAnimatedProperty()
-    {
-        // 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->value == this) {
-                cache->remove(it->key);
-                break;
-            }
-        }
-
-        // Assure that animationEnded() was called, if animationStarted() was called before.
-        ASSERT(!m_isAnimating);
-    }
+    virtual ~SVGAnimatedProperty();
 
     template<typename OwnerType, typename TearOffType, typename PropertyType>
     static PassRefPtr<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property)
@@ -97,21 +77,10 @@
     }
 
 protected:
-    SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType)
-        : m_contextElement(contextElement)
-        , m_attributeName(attributeName)
-        , m_animatedPropertyType(animatedPropertyType)
-        , m_isAnimating(false)
-        , m_isReadOnly(false)
-    {
-    }
+    SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType);
 
 private:
-    static Cache* animatedPropertyCache()
-    {
-        static Cache* s_cache = new Cache;                
-        return s_cache;
-    }
+    static Cache* animatedPropertyCache();
 
     RefPtr<SVGElement> m_contextElement;
     const QualifiedName& m_attributeName;
diff --git a/Source/core/svg/properties/SVGAnimatedPropertyMacros.h b/Source/core/svg/properties/SVGAnimatedPropertyMacros.h
index c7b7dc1..4d2d36e 100644
--- a/Source/core/svg/properties/SVGAnimatedPropertyMacros.h
+++ b/Source/core/svg/properties/SVGAnimatedPropertyMacros.h
@@ -22,6 +22,7 @@
 #ifndef SVGAnimatedPropertyMacros_h
 #define SVGAnimatedPropertyMacros_h
 
+#include "core/dom/Element.h"
 #include "core/svg/properties/SVGAnimatedProperty.h"
 #include "core/svg/properties/SVGAttributeToPropertyMap.h"
 #include "core/svg/properties/SVGPropertyTraits.h"
@@ -55,7 +56,7 @@
     {
     }
 
-    void synchronize(SVGElement* ownerElement, const QualifiedName& attrName, const AtomicString& value)
+    void synchronize(Element* ownerElement, const QualifiedName& attrName, const AtomicString& value)
     {
         ownerElement->setSynchronizedLazyAttribute(attrName, value);
     }
@@ -105,7 +106,7 @@
                          &OwnerType::lookupOrCreate##UpperProperty##Wrapper)); \
     return &s_propertyInfo; \
 } \
-PropertyType& OwnerType::LowerProperty() const \
+PropertyType& OwnerType::LowerProperty##CurrentValue() const \
 { \
     if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \
         if (wrapper->isAnimating()) \
@@ -125,7 +126,7 @@
     m_##LowerProperty.isValid = validValue; \
 } \
 \
-PassRefPtr<TearOffType> OwnerType::LowerProperty##Animated() \
+PassRefPtr<TearOffType> OwnerType::LowerProperty() \
 { \
     m_##LowerProperty.shouldSynchronize = true; \
     return static_pointer_cast<TearOffType>(lookupOrCreate##UpperProperty##Wrapper(this)); \
@@ -168,10 +169,10 @@
 #define DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \
 public: \
     static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \
-    PropertyType& LowerProperty() const; \
+    PropertyType& LowerProperty##CurrentValue() const; \
     PropertyType& LowerProperty##BaseValue() const; \
     void set##UpperProperty##BaseValue(const PropertyType& type, const bool = true); \
-    PassRefPtr<TearOffType> LowerProperty##Animated(); \
+    PassRefPtr<TearOffType> LowerProperty(); \
     bool LowerProperty##IsValid() const; \
 \
 private: \
diff --git a/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp b/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp
index e22415f..efc164e 100644
--- a/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp
+++ b/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp
@@ -20,9 +20,8 @@
 #include "config.h"
 
 #include "core/svg/properties/SVGAttributeToPropertyMap.h"
-
 #include "core/svg/properties/SVGAnimatedProperty.h"
-#include "core/svg/properties/SVGPropertyInfo.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/properties/SVGAttributeToPropertyMap.h b/Source/core/svg/properties/SVGAttributeToPropertyMap.h
index e4b2f64..f277b5b 100644
--- a/Source/core/svg/properties/SVGAttributeToPropertyMap.h
+++ b/Source/core/svg/properties/SVGAttributeToPropertyMap.h
@@ -21,7 +21,7 @@
 #define SVGAttributeToPropertyMap_h
 
 #include "core/svg/properties/SVGPropertyInfo.h"
-#include <wtf/HashMap.h>
+#include "wtf/HashMap.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/properties/SVGListProperty.h b/Source/core/svg/properties/SVGListProperty.h
index b44b3c5..a6ab46f 100644
--- a/Source/core/svg/properties/SVGListProperty.h
+++ b/Source/core/svg/properties/SVGListProperty.h
@@ -21,7 +21,6 @@
 #define SVGListProperty_h
 
 #include "core/dom/ExceptionCode.h"
-#include "core/svg/properties/SVGAnimatedProperty.h"
 #include "core/svg/properties/SVGPropertyTearOff.h"
 #include "core/svg/properties/SVGPropertyTraits.h"
 
@@ -52,7 +51,7 @@
     bool canAlterList(ExceptionCode& ec) const
     {
         if (m_role == AnimValRole) {
-            ec = NO_MODIFICATION_ALLOWED_ERR;
+            ec = NoModificationAllowedError;
             return false;
         }
 
@@ -172,7 +171,7 @@
     bool canGetItem(unsigned index, ExceptionCode& ec)
     {
         if (index >= m_values->size()) {
-            ec = INDEX_SIZE_ERR;
+            ec = IndexSizeError;
             return false;
         }
 
@@ -274,7 +273,7 @@
             return false;
 
         if (index >= m_values->size()) {
-            ec = INDEX_SIZE_ERR;
+            ec = IndexSizeError;
             return false;
         }
 
@@ -295,7 +294,7 @@
 
         if (m_values->isEmpty()) {
             // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
-            ec = INDEX_SIZE_ERR;
+            ec = IndexSizeError;
             return ListItemType();
         }
 
@@ -329,7 +328,7 @@
         if (m_values->isEmpty()) {
             ASSERT(m_wrappers->isEmpty());
             // 'passNewItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
-            ec = INDEX_SIZE_ERR;
+            ec = IndexSizeError;
             return 0;
         }
 
@@ -353,7 +352,7 @@
             return false;
 
         if (index >= m_values->size()) {
-            ec = INDEX_SIZE_ERR;
+            ec = IndexSizeError;
             return false;
         }
 
diff --git a/Source/core/svg/properties/SVGTransformListPropertyTearOff.h b/Source/core/svg/properties/SVGTransformListPropertyTearOff.h
index 8e43b0b..3387b6d 100644
--- a/Source/core/svg/properties/SVGTransformListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGTransformListPropertyTearOff.h
@@ -41,7 +41,7 @@
     {
         ASSERT(m_values);
         if (!matrix) {
-            ec = TYPE_MISMATCH_ERR;
+            ec = TypeMismatchError;
             return 0;
         }
         return SVGPropertyTearOff<SVGTransform>::create(m_values->createSVGTransformFromMatrix(matrix->propertyReference()));
diff --git a/Source/core/testing/InspectorFrontendClientLocal.cpp b/Source/core/testing/InspectorFrontendClientLocal.cpp
index decd7d0..a68a070 100644
--- a/Source/core/testing/InspectorFrontendClientLocal.cpp
+++ b/Source/core/testing/InspectorFrontendClientLocal.cpp
@@ -37,45 +37,62 @@
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/Timer.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebThread.h"
 #include <wtf/Deque.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class InspectorBackendDispatchTask {
+class InspectorBackendMessageQueue : public RefCounted<InspectorBackendMessageQueue> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorBackendDispatchTask(InspectorController* inspectorController)
+    explicit InspectorBackendMessageQueue(InspectorController* inspectorController)
         : m_inspectorController(inspectorController)
-        , m_timer(this, &InspectorBackendDispatchTask::onTimer)
     {
     }
 
     void dispatch(const String& message)
     {
+        ASSERT(m_inspectorController);
         m_messages.append(message);
-        if (!m_timer.isActive())
-            m_timer.startOneShot(0);
+        schedule();
     }
 
-    void reset()
+    void stop()
     {
+        m_inspectorController = 0;
         m_messages.clear();
-        m_timer.stop();
     }
 
-    void onTimer(Timer<InspectorBackendDispatchTask>*)
+private:
+    void schedule()
     {
+        class TaskImpl : public WebKit::WebThread::Task {
+        public:
+            RefPtr<InspectorBackendMessageQueue> owner;
+            virtual void run()
+            {
+                owner->deliver();
+            }
+        };
+        TaskImpl* taskImpl = new TaskImpl;
+        taskImpl->owner = this;
+        WebKit::Platform::current()->currentThread()->postTask(taskImpl);
+    }
+
+    void deliver()
+    {
+        if (!m_inspectorController)
+            return;
         if (!m_messages.isEmpty()) {
             // Dispatch can lead to the timer destruction -> schedule the next shot first.
-            m_timer.startOneShot(0);
+            schedule();
             m_inspectorController->dispatchMessageFromFrontend(m_messages.takeFirst());
         }
     }
 
-private:
     InspectorController* m_inspectorController;
-    Timer<InspectorBackendDispatchTask> m_timer;
     Deque<String> m_messages;
 };
 
@@ -84,11 +101,12 @@
     , m_frontendPage(frontendPage)
 {
     m_frontendPage->settings()->setAllowFileAccessFromFileURLs(true);
-    m_dispatchTask = adoptPtr(new InspectorBackendDispatchTask(inspectorController));
+    m_messageQueue = adoptRef(new InspectorBackendMessageQueue(inspectorController));
 }
 
 InspectorFrontendClientLocal::~InspectorFrontendClientLocal()
 {
+    m_messageQueue->stop();
     if (m_frontendHost)
         m_frontendHost->disconnectClient();
     m_frontendPage = 0;
@@ -106,7 +124,7 @@
 
 void InspectorFrontendClientLocal::sendMessageToBackend(const String& message)
 {
-    m_dispatchTask->dispatch(message);
+    m_messageQueue->dispatch(message);
 }
 
 } // namespace WebCore
diff --git a/Source/core/testing/InspectorFrontendClientLocal.h b/Source/core/testing/InspectorFrontendClientLocal.h
index ba5f7d3..1d0d644 100644
--- a/Source/core/testing/InspectorFrontendClientLocal.h
+++ b/Source/core/testing/InspectorFrontendClientLocal.h
@@ -40,7 +40,7 @@
 
 class Frame;
 class InspectorController;
-class InspectorBackendDispatchTask;
+class InspectorBackendMessageQueue;
 class InspectorFrontendHost;
 class Page;
 
@@ -80,7 +80,7 @@
     Page* m_frontendPage;
     // TODO(yurys): this ref shouldn't be needed.
     RefPtr<InspectorFrontendHost> m_frontendHost;
-    OwnPtr<InspectorBackendDispatchTask> m_dispatchTask;
+    RefPtr<InspectorBackendMessageQueue> m_messageQueue;
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallback.h b/Source/core/testing/InternalProfilers.cpp
similarity index 65%
copy from Source/core/dom/CustomElementCallback.h
copy to Source/core/testing/InternalProfilers.cpp
index d71e35a..4560ee4 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/testing/InternalProfilers.cpp
@@ -28,34 +28,37 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
+#include "config.h"
+#include "InternalProfilers.h"
 
-#include "wtf/RefCounted.h"
+#include "public/platform/Platform.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/WTFString.h"
+#include <algorithm>
 
 namespace WebCore {
 
-class Element;
-
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
-public:
-    virtual ~CustomElementCallback() { }
-
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
-
-protected:
-    enum CallbackType {
-        None,
-        Ready
-    };
-
-    CustomElementCallback(CallbackType which) : m_which(which) { }
-
-private:
-    CallbackType m_which;
-};
-
+void InternalProfilers::startHeapProfiling(const String& prefix)
+{
+    WebKit::Platform::current()->startHeapProfiling(prefix);
 }
 
-#endif // CustomElementCallback_h
+void InternalProfilers::stopHeapProfiling()
+{
+    WebKit::Platform::current()->stopHeapProfiling();
+}
+
+void InternalProfilers::dumpHeapProfiling(const String& reason)
+{
+    WebKit::Platform::current()->dumpHeapProfiling(reason);
+}
+
+String InternalProfilers::getHeapProfile()
+{
+    String text = WebKit::Platform::current()->getHeapProfile();
+    // Only return the first line which contains total numbers
+    // because whole dump is too big and too noisy to process in JavaScript.
+    return text.substring(0, text.find('\n'));
+}
+
+}
diff --git a/Source/core/dom/CustomElementCallback.h b/Source/core/testing/InternalProfilers.h
similarity index 76%
rename from Source/core/dom/CustomElementCallback.h
rename to Source/core/testing/InternalProfilers.h
index d71e35a..f948cff 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/testing/InternalProfilers.h
@@ -28,34 +28,27 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
+#ifndef InternalProfilers_h
+#define InternalProfilers_h
 
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 
 namespace WebCore {
 
-class Element;
 
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
+
+class InternalProfilers : public RefCounted<InternalProfilers> {
 public:
-    virtual ~CustomElementCallback() { }
+    static PassRefPtr<InternalProfilers> create() { return adoptRef(new InternalProfilers()); }
 
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
-
-protected:
-    enum CallbackType {
-        None,
-        Ready
-    };
-
-    CustomElementCallback(CallbackType which) : m_which(which) { }
-
-private:
-    CallbackType m_which;
+    void startHeapProfiling(const String& prefix);
+    void stopHeapProfiling();
+    void dumpHeapProfiling(const String& reason);
+    String getHeapProfile();
 };
 
-}
+} // namespace WebCore
 
-#endif // CustomElementCallback_h
+#endif
diff --git a/Source/core/dom/CustomElementCallback.h b/Source/core/testing/InternalProfilers.idl
similarity index 73%
copy from Source/core/dom/CustomElementCallback.h
copy to Source/core/testing/InternalProfilers.idl
index d71e35a..7030e9e 100644
--- a/Source/core/dom/CustomElementCallback.h
+++ b/Source/core/testing/InternalProfilers.idl
@@ -28,34 +28,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CustomElementCallback_h
-#define CustomElementCallback_h
-
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class Element;
-
-class CustomElementCallback : public RefCounted<CustomElementCallback> {
-public:
-    virtual ~CustomElementCallback() { }
-
-    bool hasReady() const { return m_which == Ready; }
-    virtual void ready(Element*) = 0;
-
-protected:
-    enum CallbackType {
-        None,
-        Ready
-    };
-
-    CustomElementCallback(CallbackType which) : m_which(which) { }
-
-private:
-    CallbackType m_which;
+[
+    NoInterfaceObject
+] interface InternalProfilers {
+    void startHeapProfiling(DOMString prefix);
+    void stopHeapProfiling();
+    void dumpHeapProfiling(DOMString reason);
+    DOMString getHeapProfile();
 };
-
-}
-
-#endif // CustomElementCallback_h
diff --git a/Source/core/testing/InternalSettings.cpp b/Source/core/testing/InternalSettings.cpp
index 4704e08..ac1225e 100644
--- a/Source/core/testing/InternalSettings.cpp
+++ b/Source/core/testing/InternalSettings.cpp
@@ -37,19 +37,19 @@
 
 #define InternalSettingsGuardForSettingsReturn(returnValue) \
     if (!settings()) { \
-        ec = INVALID_ACCESS_ERR; \
+        ec = InvalidAccessError; \
         return returnValue; \
     }
 
 #define InternalSettingsGuardForSettings()  \
     if (!settings()) { \
-        ec = INVALID_ACCESS_ERR; \
+        ec = InvalidAccessError; \
         return; \
     }
 
 #define InternalSettingsGuardForPage() \
     if (!page()) { \
-        ec = INVALID_ACCESS_ERR; \
+        ec = InvalidAccessError; \
         return; \
     }
 
@@ -289,7 +289,7 @@
     else if (equalIgnoringCase(editingBehavior, "android"))
         settings()->setEditingBehaviorType(EditingAndroidBehavior);
     else
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
 }
 
 void InternalSettings::setDialogElementEnabled(bool enabled)
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index f766d92..a9cf5c5 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -29,6 +29,7 @@
 
 #include "HTMLNames.h"
 #include "InspectorFrontendClientLocal.h"
+#include "InternalProfilers.h"
 #include "InternalRuntimeFlags.h"
 #include "InternalSettings.h"
 #include "MallocStatistics.h"
@@ -228,6 +229,13 @@
     return m_runtimeFlags.get();
 }
 
+InternalProfilers* Internals::profilers()
+{
+    if (!m_profilers)
+        m_profilers = InternalProfilers::create();
+    return m_profilers.get();
+}
+
 unsigned Internals::workerThreadCount() const
 {
     return WorkerThread::workerThreadCount();
@@ -264,7 +272,7 @@
 {
     Document* document = contextDocument();
     if (!document) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -274,7 +282,7 @@
 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionCode& ec)
 {
     if (!insertionPoint || !insertionPoint->isInsertionPoint()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return false;
     }
 
@@ -284,7 +292,7 @@
 Node* Internals::treeScopeRootNode(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -294,7 +302,7 @@
 Node* Internals::parentTreeScope(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     const TreeScope* parentTreeScope = node->treeScope()->parentTreeScope();
@@ -304,7 +312,7 @@
 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, ExceptionCode& ec)
 {
     if (!host || !host->shadow()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -314,7 +322,7 @@
 bool Internals::hasSelectorForClassInShadow(Element* host, const String& className, ExceptionCode& ec)
 {
     if (!host || !host->shadow()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -324,7 +332,7 @@
 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionCode& ec)
 {
     if (!host || !host->shadow()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -334,7 +342,7 @@
 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& pseudoClass, ExceptionCode& ec)
 {
     if (!host || !host->shadow()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -361,7 +369,7 @@
 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node* node2, ExceptionCode& ec) const
 {
     if (!node1 || !node2) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const TreeScope*>(toDocument(node1)) :
@@ -369,7 +377,7 @@
     const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const TreeScope*>(toDocument(node2)) :
         node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2)) : 0;
     if (!treeScope1 || !treeScope2) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     return treeScope1->comparePosition(treeScope2);
@@ -378,47 +386,54 @@
 unsigned Internals::numberOfActiveAnimations() const
 {
     Frame* contextFrame = frame();
-    if (AnimationController* controller = contextFrame->animation())
-        return controller->numberOfActiveAnimations(contextFrame->document());
+    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
+        if (AnimationController* controller = contextFrame->animation())
+            return controller->numberOfActiveAnimations(contextFrame->document());
+    }
     return 0;
 }
 
 void Internals::suspendAnimations(Document* document, ExceptionCode& ec) const
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
-    AnimationController* controller = document->frame()->animation();
-    if (!controller)
-        return;
+    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
+        AnimationController* controller = document->frame()->animation();
+        if (!controller)
+            return;
 
-    controller->suspendAnimations();
+        controller->suspendAnimations();
+    }
 }
 
 void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
-    AnimationController* controller = document->frame()->animation();
-    if (!controller)
-        return;
+    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
+        AnimationController* controller = document->frame()->animation();
+        if (!controller)
+            return;
 
-    controller->resumeAnimations();
+        controller->resumeAnimations();
+    }
 }
 
 void Internals::pauseAnimations(double pauseTime, ExceptionCode& ec)
 {
     if (pauseTime < 0) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
-    frame()->animation()->pauseAnimationsForTesting(pauseTime);
+    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
+        frame()->animation()->pauseAnimationsForTesting(pauseTime);
 }
 
 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) const
@@ -426,7 +441,7 @@
     if (root && root->isShadowRoot())
         return ScopeContentDistribution::hasShadowElement(toShadowRoot(root));
 
-    ec = INVALID_ACCESS_ERR;
+    ec = InvalidAccessError;
     return 0;
 }
 
@@ -435,14 +450,14 @@
     if (root && root->isShadowRoot())
         return ScopeContentDistribution::hasContentElement(toShadowRoot(root));
 
-    ec = INVALID_ACCESS_ERR;
+    ec = InvalidAccessError;
     return 0;
 }
 
 size_t Internals::countElementShadow(const Node* root, ExceptionCode& ec) const
 {
     if (!root || !root->isShadowRoot()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -452,7 +467,7 @@
 bool Internals::attached(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return false;
     }
 
@@ -462,7 +477,7 @@
 Node* Internals::nextSiblingByWalker(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -473,7 +488,7 @@
 Node* Internals::firstChildByWalker(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -484,7 +499,7 @@
 Node* Internals::lastChildByWalker(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -495,7 +510,7 @@
 Node* Internals::nextNodeByWalker(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -506,7 +521,7 @@
 Node* Internals::previousNodeByWalker(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -517,13 +532,13 @@
 String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
     String representation = externalRepresentation(element);
     if (representation.isEmpty()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -535,14 +550,14 @@
     if (scope && (scope->isElementNode() || scope->isShadowRoot()))
         return scope->numberOfScopedHTMLStyleChildren();
 
-    ec = INVALID_ACCESS_ERR;
+    ec = InvalidAccessError;
     return 0;
 }
 
 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Node* node, ExceptionCode& ec) const
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -553,7 +568,7 @@
 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionCode& ec)
 {
     if (!host) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -573,7 +588,7 @@
 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionCode& ec)
 {
     if (!host) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -585,7 +600,7 @@
 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionCode& ec)
 {
     if (!host) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -597,7 +612,7 @@
 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionCode& ec)
 {
     if (!shadow || !shadow->isShadowRoot()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -607,7 +622,7 @@
 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionCode& ec)
 {
     if (!shadow || !shadow->isShadowRoot()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -617,7 +632,7 @@
 String Internals::shadowRootType(const Node* root, ExceptionCode& ec) const
 {
     if (!root || !root->isShadowRoot()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -635,7 +650,7 @@
 Element* Internals::includerFor(Node* node, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -645,7 +660,7 @@
 String Internals::shadowPseudoId(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -655,7 +670,7 @@
 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -683,12 +698,12 @@
 {
     HistoryItem* mainItem = frame()->loader()->history()->previousItem();
     if (!mainItem) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return Vector<String>();
     }
     String uniqueName = frame()->tree()->uniqueName();
     if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return Vector<String>();
     }
     return mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState();
@@ -698,7 +713,7 @@
 {
     HistoryItem* mainItem = frame()->loader()->history()->previousItem();
     if (!mainItem) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     String uniqueName = frame()->tree()->uniqueName();
@@ -707,7 +722,7 @@
     else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
         subItem->setDocumentState(state);
     else
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
 }
 
 void Internals::enableMockSpeechSynthesizer()
@@ -746,7 +761,7 @@
 {
     Document* document = contextDocument();
     if (!document || !document->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return ClientRect::create();
     }
 
@@ -757,7 +772,7 @@
 {
     Document* document = contextDocument();
     if (!document || !document->frame() || !document->frame()->selection()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return ClientRect::create();
     }
 
@@ -767,7 +782,7 @@
 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return ClientRect::create();
     }
 
@@ -781,7 +796,7 @@
 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document, ExceptionCode& ec)
 {
     if (!document || !document->page() || !document->page()->inspectorController()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return ClientRectList::create();
     }
 
@@ -793,13 +808,13 @@
 unsigned Internals::markerCountForNode(Node* node, const String& markerType, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
     DocumentMarker::MarkerTypes markerTypes = 0;
     if (!markerTypesFrom(markerType, markerTypes)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -809,13 +824,13 @@
 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
 {
     if (!node) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
     DocumentMarker::MarkerTypes markerTypes = 0;
     if (!markerTypesFrom(markerType, markerTypes)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
@@ -850,7 +865,7 @@
 void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec)
 {
     if (!document || !document->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -868,7 +883,7 @@
 void Internals::setPagination(Document* document, const String& mode, int gap, int pageLength, ExceptionCode& ec)
 {
     if (!document || !document->page()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     Page* page = document->page();
@@ -885,7 +900,7 @@
     else if (mode == "BottomToTopPaginated")
         pagination.mode = Pagination::BottomToTopPaginated;
     else {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
@@ -897,7 +912,7 @@
 String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
 {
     if (!document || !document->page()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
     Page* page = document->page();
@@ -917,7 +932,7 @@
 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
 {
     if (!textField) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return false;
     }
 
@@ -926,35 +941,35 @@
 
     // FIXME: We should be using hasTagName instead but Windows port doesn't link QualifiedNames properly.
     if (textField->tagName() == "TEXTAREA")
-        return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEdit();
+        return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit();
 
-    ec = INVALID_NODE_TYPE_ERR;
+    ec = InvalidNodeTypeError;
     return false;
 }
 
 bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return false;
     }
 
     if (element->hasTagName(inputTag))
         return toHTMLInputElement(element)->shouldAutocomplete();
 
-    ec = INVALID_NODE_TYPE_ERR;
+    ec = InvalidNodeTypeError;
     return false;
 }
 
 String Internals::suggestedValue(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
     if (!element->hasTagName(inputTag)) {
-        ec = INVALID_NODE_TYPE_ERR;
+        ec = InvalidNodeTypeError;
         return String();
     }
 
@@ -964,12 +979,12 @@
 void Internals::setSuggestedValue(Element* element, const String& value, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
     if (!element->hasTagName(inputTag)) {
-        ec = INVALID_NODE_TYPE_ERR;
+        ec = InvalidNodeTypeError;
         return;
     }
 
@@ -979,12 +994,12 @@
 void Internals::setEditingValue(Element* element, const String& value, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
     if (!element->hasTagName(inputTag)) {
-        ec = INVALID_NODE_TYPE_ERR;
+        ec = InvalidNodeTypeError;
         return;
     }
 
@@ -994,7 +1009,7 @@
 void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec)
 {
     if (!element->hasTagName(inputTag)) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     toHTMLInputElement(element)->setAutofilled(enabled);
@@ -1003,7 +1018,7 @@
 void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionCode& ec)
 {
     if (!element || !element->document() || !element->document()->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     FrameView* frameView = element->document()->view();
@@ -1013,7 +1028,7 @@
 void Internals::paintControlTints(Document* document, ExceptionCode& ec)
 {
     if (!document || !document->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -1024,7 +1039,7 @@
 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionCode& ec)
 {
     if (!scope) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1034,7 +1049,7 @@
 unsigned Internals::locationFromRange(Element* scope, const Range* range, ExceptionCode& ec)
 {
     if (!scope || !range) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1047,7 +1062,7 @@
 unsigned Internals::lengthFromRange(Element* scope, const Range* range, ExceptionCode& ec)
 {
     if (!scope || !range) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1060,7 +1075,7 @@
 String Internals::rangeAsText(const Range* range, ExceptionCode& ec)
 {
     if (!range) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1070,7 +1085,7 @@
 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1092,7 +1107,7 @@
 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1110,7 +1125,7 @@
 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1132,7 +1147,7 @@
 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1150,7 +1165,7 @@
 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1174,7 +1189,7 @@
     SpellChecker* checker = spellchecker(document);
 
     if (!checker) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return -1;
     }
 
@@ -1186,7 +1201,7 @@
     SpellChecker* checker = spellchecker(document);
 
     if (!checker) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return -1;
     }
 
@@ -1206,7 +1221,7 @@
 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec)
 {
     if (!document) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1216,7 +1231,7 @@
 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionCode& ec)
 {
     if (!document) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1233,7 +1248,7 @@
 PassRefPtr<ClientRectList> Internals::touchEventTargetClientRects(Document* document, ExceptionCode& ec)
 {
     if (!document || !document->view() || !document->page()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
     if (!document->page()->scrollingCoordinator())
@@ -1255,7 +1270,7 @@
     unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const
 {
     if (!document || !document->frame() || !document->frame()->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1410,11 +1425,21 @@
     m_frontendWindow.release();
 }
 
+Vector<unsigned long> Internals::setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes)
+{
+    Vector<unsigned long> result;
+    result.append(memoryCache()->minDeadCapacity());
+    result.append(memoryCache()->maxDeadCapacity());
+    result.append(memoryCache()->capacity());
+    memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes);
+    return result;
+}
+
 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec)
 {
     Page* page = contextDocument()->frame()->page();
     if (!page || !page->inspectorController()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     page->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
@@ -1446,7 +1471,7 @@
 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionCode& ec)
 {
     if (!document) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return false;
     }
 
@@ -1466,7 +1491,7 @@
 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionCode& ec, RenderLayer::PaintOrderListType type)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1474,13 +1499,13 @@
 
     RenderObject* renderer = element->renderer();
     if (!renderer || !renderer->isBox()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
     RenderLayer* layer = toRenderBox(renderer)->layer();
     if (!layer) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1502,7 +1527,7 @@
 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionCode& ec) const
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1512,7 +1537,7 @@
 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, ExceptionCode& ec) const
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1520,13 +1545,13 @@
 
     RenderObject* renderer = element->renderer();
     if (!renderer || !renderer->isBox()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
     RenderLayer* layer = toRenderBox(renderer)->layer();
     if (!layer) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1541,7 +1566,7 @@
 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsCompositedScrolling, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -1549,13 +1574,13 @@
 
     RenderObject* renderer = element->renderer();
     if (!renderer || !renderer->isBox()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
     RenderLayer* layer = toRenderBox(renderer)->layer();
     if (!layer) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -1565,7 +1590,7 @@
 String Internals::repaintRectsAsText(Document* document, ExceptionCode& ec) const
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1580,7 +1605,7 @@
 String Internals::mainThreadScrollingReasons(Document* document, ExceptionCode& ec) const
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1594,7 +1619,7 @@
 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionCode& ec) const
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1608,7 +1633,7 @@
 void Internals::garbageCollectDocumentResources(Document* document, ExceptionCode& ec) const
 {
     if (!document) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -1688,7 +1713,7 @@
 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode& ec) const
 {
     if (!frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1698,7 +1723,7 @@
 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionCode& ec) const
 {
     if (!frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1709,7 +1734,7 @@
 {
     Document* document = contextDocument();
     if (!document || !document->page()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     Page* page = document->page();
@@ -1720,7 +1745,7 @@
 {
     Document* document = contextDocument();
     if (!document || !document->page()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     Page* page = document->page();
@@ -1730,7 +1755,7 @@
 void Internals::setIsCursorVisible(Document* document, bool isVisible, ExceptionCode& ec)
 {
     if (!document || !document->page()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     document->page()->setIsCursorVisible(isVisible);
@@ -1793,7 +1818,7 @@
 void Internals::startTrackingRepaints(Document* document, ExceptionCode& ec)
 {
     if (!document || !document->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -1804,7 +1829,7 @@
 void Internals::stopTrackingRepaints(Document* document, ExceptionCode& ec)
 {
     if (!document || !document->view()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -1868,7 +1893,7 @@
 String Internals::getCurrentCursorInfo(Document* document, ExceptionCode& ec)
 {
     if (!document || !document->frame()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
@@ -1901,7 +1926,7 @@
 {
     String stringValue = value->toWireString();
     RefPtr<ArrayBuffer> buffer = ArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar));
-    stringValue.copyTo(static_cast<UChar*>(buffer->data()), stringValue.length());
+    stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0, stringValue.length());
     return buffer.release();
 }
 
@@ -1925,7 +1950,7 @@
 {
     Document* document = contextDocument();
     if (!document || !document->frame() || !document->frame()->selection()) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return 0;
     }
 
@@ -1935,7 +1960,7 @@
 String Internals::markerTextForListItem(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
     return WebCore::markerTextForListItem(element);
@@ -1944,7 +1969,7 @@
 String Internals::getImageSourceURL(Element* element, ExceptionCode& ec)
 {
     if (!element) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
     return element->imageSourceURL();
@@ -1953,7 +1978,7 @@
 String Internals::baseURL(Document* document, ExceptionCode& ec)
 {
     if (!document) {
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
diff --git a/Source/core/testing/Internals.h b/Source/core/testing/Internals.h
index 9e2f433..563a10d 100644
--- a/Source/core/testing/Internals.h
+++ b/Source/core/testing/Internals.h
@@ -49,6 +49,7 @@
 class Frame;
 class InspectorFrontendChannelDummy;
 class InternalRuntimeFlags;
+class InternalProfilers;
 class InternalSettings;
 class Node;
 class Page;
@@ -198,6 +199,7 @@
 
     InternalSettings* settings() const;
     InternalRuntimeFlags* runtimeFlags() const;
+    InternalProfilers* profilers();
     unsigned workerThreadCount() const;
 
     void setDeviceProximity(Document*, const String& eventType, double value, double min, double max, ExceptionCode&);
@@ -229,6 +231,7 @@
     Vector<String> consoleMessageArgumentCounts(Document*) const;
     PassRefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
     void closeDummyInspectorFrontend();
+    Vector<unsigned long> setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes);
     void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);
 
     String counterValue(Element*);
@@ -292,6 +295,7 @@
     RefPtr<DOMWindow> m_frontendWindow;
     OwnPtr<InspectorFrontendChannelDummy> m_frontendChannel;
     RefPtr<InternalRuntimeFlags> m_runtimeFlags;
+    RefPtr<InternalProfilers> m_profilers;
 };
 
 } // namespace WebCore
diff --git a/Source/core/testing/Internals.idl b/Source/core/testing/Internals.idl
index d9e537e..9f45bbc 100644
--- a/Source/core/testing/Internals.idl
+++ b/Source/core/testing/Internals.idl
@@ -160,6 +160,7 @@
     [RaisesException] boolean isPageBoxVisible(Document document, long pageNumber);
 
     readonly attribute InternalSettings settings;
+    readonly attribute InternalProfilers profilers;
     readonly attribute InternalRuntimeFlags runtimeFlags;
     readonly attribute unsigned long workerThreadCount;
 
@@ -167,6 +168,7 @@
     // The values of these constants must be kept in sync with the values of LayerTreeAsTextBehaviorFlags in GraphicsLayerClient.h.
     const unsigned short LAYER_TREE_INCLUDES_REPAINT_RECTS = 2;
     const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 4;
+    const unsigned short LAYER_TREE_INCLUDES_ROOT_LAYER = 8;
     [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags);
     [RaisesException] DOMString elementLayerTreeAsText(Element element, optional unsigned short flags);
 
@@ -197,6 +199,7 @@
     sequence<DOMString> consoleMessageArgumentCounts(Document document);
     Window openDummyInspectorFrontend(DOMString url);
     void closeDummyInspectorFrontend();
+    unsigned long[] setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes);
     [RaisesException] void setInspectorResourcesDataSizeLimits(long maximumResourcesContentSize, long maximumSingleResourceContentSize);
 
     DOMString counterValue(Element element);
diff --git a/Source/core/tests/FakeWebGraphicsContext3D.h b/Source/core/tests/FakeWebGraphicsContext3D.h
new file mode 100644
index 0000000..693e246
--- /dev/null
+++ b/Source/core/tests/FakeWebGraphicsContext3D.h
@@ -0,0 +1,273 @@
+/*
+ * 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/HTMLDimension.cpp b/Source/core/tests/HTMLDimension.cpp
new file mode 100644
index 0000000..043d506
--- /dev/null
+++ b/Source/core/tests/HTMLDimension.cpp
@@ -0,0 +1,227 @@
+/*
+ * 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/HTMLDimension.h"
+
+#include "wtf/text/WTFString.h"
+#include <gtest/gtest.h>
+
+namespace WebCore {
+
+// This assertion-prettify function needs to be in the WebCore namespace.
+void PrintTo(const Length& length, ::std::ostream* os)
+{
+    *os << "Length => lengthType: " << length.type() << ", value=" << length.value();
+}
+
+}
+
+using namespace WebCore;
+
+namespace {
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsEmptyString)
+{
+    Vector<Length> result = parseListOfDimensions(String(""));
+    ASSERT_EQ(Vector<Length>(), result);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsNoNumberAbsolute)
+{
+    Vector<Length> result = parseListOfDimensions(String(" \t"));
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(0, Relative), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsNoNumberPercent)
+{
+    Vector<Length> result = parseListOfDimensions(String(" \t%"));
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(0, Percent), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsNoNumberRelative)
+{
+    Vector<Length> result = parseListOfDimensions(String("\t *"));
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(0, Relative), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSingleAbsolute)
+{
+    Vector<Length> result = parseListOfDimensions(String("10"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSinglePercentageWithSpaces)
+{
+    Vector<Length> result = parseListOfDimensions(String("50  %"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(50, Percent), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSingleRelative)
+{
+    Vector<Length> result = parseListOfDimensions(String("25*"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(25, Relative), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsDoubleAbsolute)
+{
+    Vector<Length> result = parseListOfDimensions(String("10.054"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10.054, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsLeadingSpaceAbsolute)
+{
+    Vector<Length> result = parseListOfDimensions(String("\t \t 10"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsLeadingSpaceRelative)
+{
+    Vector<Length> result = parseListOfDimensions(String(" \r25*"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(25, Relative), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsLeadingSpacePercentage)
+{
+    Vector<Length> result = parseListOfDimensions(String("\n 25%"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(25, Percent), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsDoublePercentage)
+{
+    Vector<Length> result = parseListOfDimensions(String("10.054%"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10.054, Percent), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsDoubleRelative)
+{
+    Vector<Length> result = parseListOfDimensions(String("10.054*"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10.054, Relative), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSpacesInIntegerDoubleAbsolute)
+{
+    Vector<Length> result = parseListOfDimensions(String("1\n0 .025%"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(1, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSpacesInIntegerDoublePercent)
+{
+    Vector<Length> result = parseListOfDimensions(String("1\n0 .025%"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(1, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSpacesInIntegerDoubleRelative)
+{
+    Vector<Length> result = parseListOfDimensions(String("1\n0 .025*"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(1, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSpacesInFractionAfterDotDoublePercent)
+{
+    Vector<Length> result = parseListOfDimensions(String("10.  0 25%"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10.025, Percent), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsSpacesInFractionAfterDigitDoublePercent)
+{
+    Vector<Length> result = parseListOfDimensions(String("10.05\r25%"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10.0525, Percent), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsTrailingComma)
+{
+    Vector<Length> result = parseListOfDimensions(String("10,"));
+
+    ASSERT_EQ(1U, result.size());
+    ASSERT_EQ(Length(10, Fixed), result[0]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsTwoDimensions)
+{
+    Vector<Length> result = parseListOfDimensions(String("10*,25 %"));
+
+    ASSERT_EQ(2U, result.size());
+    ASSERT_EQ(Length(10, Relative), result[0]);
+    ASSERT_EQ(Length(25, Percent), result[1]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsMultipleDimensionsWithSpaces)
+{
+    Vector<Length> result = parseListOfDimensions(String("10   *   ,\t25 , 10.05\n5%"));
+
+    ASSERT_EQ(3U, result.size());
+    ASSERT_EQ(Length(10, Relative), result[0]);
+    ASSERT_EQ(Length(25, Fixed), result[1]);
+    ASSERT_EQ(Length(10.055, Percent), result[2]);
+}
+
+TEST(WebCoreHTMLDimension, parseListOfDimensionsMultipleDimensionsWithOneEmpty)
+{
+    Vector<Length> result = parseListOfDimensions(String("2*,,8.%"));
+
+    ASSERT_EQ(3U, result.size());
+    ASSERT_EQ(Length(2, Relative), result[0]);
+    ASSERT_EQ(Length(0, Relative), result[1]);
+    ASSERT_EQ(Length(8., Percent), result[2]);
+}
+
+}
diff --git a/Source/core/webcore_derived.target.darwin-arm.mk b/Source/core/webcore_derived.target.darwin-arm.mk
index d52cef9..d55f90b 100644
--- a/Source/core/webcore_derived.target.darwin-arm.mk
+++ b/Source/core/webcore_derived.target.darwin-arm.mk
@@ -79,6 +79,8 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/ColorSuggestionPicker.cpp
@@ -107,17 +109,19 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp
+$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp
+$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp
+$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp
 	mkdir -p $(@D); cp $< $@
@@ -152,6 +156,7 @@
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
 	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
 	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
@@ -166,6 +171,7 @@
 	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
+	$(gyp_intermediate_dir)/CSSParser.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -179,19 +185,21 @@
 
 GYP_COPIED_SOURCE_ORIGIN_DIRS := \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/webcore
+	$(gyp_shared_intermediate_dir)/webkit
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/bindings/v8/ActiveDOMCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/ArrayValue.cpp \
 	third_party/WebKit/Source/bindings/v8/BindingSecurity.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementBinding.cpp \
 	third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp \
-	third_party/WebKit/Source/bindings/v8/CustomElementHelpers.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementWrapper.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMDataStore.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMWrapperWorld.cpp \
 	third_party/WebKit/Source/bindings/v8/DateExtension.cpp \
 	third_party/WebKit/Source/bindings/v8/Dictionary.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionState.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionStatePlaceholder.cpp \
 	third_party/WebKit/Source/bindings/v8/IDBBindingUtilities.cpp \
 	third_party/WebKit/Source/bindings/v8/NPV8Object.cpp \
 	third_party/WebKit/Source/bindings/v8/PageScriptDebugServer.cpp \
@@ -207,6 +215,7 @@
 	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
+	third_party/WebKit/Source/bindings/v8/ScriptPromiseResolver.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptScope.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptState.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptString.cpp \
@@ -215,7 +224,7 @@
 	third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Binding.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Callback.cpp \
-	third_party/WebKit/Source/bindings/v8/V8CustomElementCallback.cpp \
+	third_party/WebKit/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMConfiguration.cpp \
 	third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMWrapper.cpp \
@@ -368,8 +377,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -381,7 +391,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -389,9 +398,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -403,7 +410,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -431,7 +437,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
@@ -541,8 +546,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -554,7 +560,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -562,9 +567,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -576,7 +579,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -604,7 +606,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
diff --git a/Source/core/webcore_derived.target.darwin-mips.mk b/Source/core/webcore_derived.target.darwin-mips.mk
index 00ba22d..30a32ac 100644
--- a/Source/core/webcore_derived.target.darwin-mips.mk
+++ b/Source/core/webcore_derived.target.darwin-mips.mk
@@ -79,6 +79,8 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/ColorSuggestionPicker.cpp
@@ -107,17 +109,19 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp
+$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp
+$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp
+$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp
 	mkdir -p $(@D); cp $< $@
@@ -152,6 +156,7 @@
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
 	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
 	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
@@ -166,6 +171,7 @@
 	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
+	$(gyp_intermediate_dir)/CSSParser.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -179,19 +185,21 @@
 
 GYP_COPIED_SOURCE_ORIGIN_DIRS := \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/webcore
+	$(gyp_shared_intermediate_dir)/webkit
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/bindings/v8/ActiveDOMCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/ArrayValue.cpp \
 	third_party/WebKit/Source/bindings/v8/BindingSecurity.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementBinding.cpp \
 	third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp \
-	third_party/WebKit/Source/bindings/v8/CustomElementHelpers.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementWrapper.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMDataStore.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMWrapperWorld.cpp \
 	third_party/WebKit/Source/bindings/v8/DateExtension.cpp \
 	third_party/WebKit/Source/bindings/v8/Dictionary.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionState.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionStatePlaceholder.cpp \
 	third_party/WebKit/Source/bindings/v8/IDBBindingUtilities.cpp \
 	third_party/WebKit/Source/bindings/v8/NPV8Object.cpp \
 	third_party/WebKit/Source/bindings/v8/PageScriptDebugServer.cpp \
@@ -207,6 +215,7 @@
 	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
+	third_party/WebKit/Source/bindings/v8/ScriptPromiseResolver.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptScope.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptState.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptString.cpp \
@@ -215,7 +224,7 @@
 	third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Binding.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Callback.cpp \
-	third_party/WebKit/Source/bindings/v8/V8CustomElementCallback.cpp \
+	third_party/WebKit/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMConfiguration.cpp \
 	third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMWrapper.cpp \
@@ -369,6 +378,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -380,7 +391,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -388,9 +398,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -402,7 +410,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -430,7 +437,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
@@ -541,6 +547,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -552,7 +560,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -560,9 +567,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -574,7 +579,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -602,7 +606,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
diff --git a/Source/core/webcore_derived.target.darwin-x86.mk b/Source/core/webcore_derived.target.darwin-x86.mk
index b8e77da..6ffa4e8 100644
--- a/Source/core/webcore_derived.target.darwin-x86.mk
+++ b/Source/core/webcore_derived.target.darwin-x86.mk
@@ -79,6 +79,8 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/ColorSuggestionPicker.cpp
@@ -107,17 +109,19 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp
+$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp
+$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp
+$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp
 	mkdir -p $(@D); cp $< $@
@@ -152,6 +156,7 @@
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
 	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
 	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
@@ -166,6 +171,7 @@
 	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
+	$(gyp_intermediate_dir)/CSSParser.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -179,19 +185,21 @@
 
 GYP_COPIED_SOURCE_ORIGIN_DIRS := \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/webcore
+	$(gyp_shared_intermediate_dir)/webkit
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/bindings/v8/ActiveDOMCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/ArrayValue.cpp \
 	third_party/WebKit/Source/bindings/v8/BindingSecurity.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementBinding.cpp \
 	third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp \
-	third_party/WebKit/Source/bindings/v8/CustomElementHelpers.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementWrapper.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMDataStore.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMWrapperWorld.cpp \
 	third_party/WebKit/Source/bindings/v8/DateExtension.cpp \
 	third_party/WebKit/Source/bindings/v8/Dictionary.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionState.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionStatePlaceholder.cpp \
 	third_party/WebKit/Source/bindings/v8/IDBBindingUtilities.cpp \
 	third_party/WebKit/Source/bindings/v8/NPV8Object.cpp \
 	third_party/WebKit/Source/bindings/v8/PageScriptDebugServer.cpp \
@@ -207,6 +215,7 @@
 	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
+	third_party/WebKit/Source/bindings/v8/ScriptPromiseResolver.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptScope.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptState.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptString.cpp \
@@ -215,7 +224,7 @@
 	third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Binding.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Callback.cpp \
-	third_party/WebKit/Source/bindings/v8/V8CustomElementCallback.cpp \
+	third_party/WebKit/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMConfiguration.cpp \
 	third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMWrapper.cpp \
@@ -370,8 +379,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -383,7 +393,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -391,9 +400,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -405,7 +412,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -433,7 +439,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
@@ -546,8 +551,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -559,7 +565,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -567,9 +572,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -581,7 +584,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -609,7 +611,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
diff --git a/Source/core/webcore_derived.target.linux-arm.mk b/Source/core/webcore_derived.target.linux-arm.mk
index d52cef9..d55f90b 100644
--- a/Source/core/webcore_derived.target.linux-arm.mk
+++ b/Source/core/webcore_derived.target.linux-arm.mk
@@ -79,6 +79,8 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/ColorSuggestionPicker.cpp
@@ -107,17 +109,19 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp
+$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp
+$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp
+$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp
 	mkdir -p $(@D); cp $< $@
@@ -152,6 +156,7 @@
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
 	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
 	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
@@ -166,6 +171,7 @@
 	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
+	$(gyp_intermediate_dir)/CSSParser.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -179,19 +185,21 @@
 
 GYP_COPIED_SOURCE_ORIGIN_DIRS := \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/webcore
+	$(gyp_shared_intermediate_dir)/webkit
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/bindings/v8/ActiveDOMCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/ArrayValue.cpp \
 	third_party/WebKit/Source/bindings/v8/BindingSecurity.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementBinding.cpp \
 	third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp \
-	third_party/WebKit/Source/bindings/v8/CustomElementHelpers.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementWrapper.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMDataStore.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMWrapperWorld.cpp \
 	third_party/WebKit/Source/bindings/v8/DateExtension.cpp \
 	third_party/WebKit/Source/bindings/v8/Dictionary.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionState.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionStatePlaceholder.cpp \
 	third_party/WebKit/Source/bindings/v8/IDBBindingUtilities.cpp \
 	third_party/WebKit/Source/bindings/v8/NPV8Object.cpp \
 	third_party/WebKit/Source/bindings/v8/PageScriptDebugServer.cpp \
@@ -207,6 +215,7 @@
 	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
+	third_party/WebKit/Source/bindings/v8/ScriptPromiseResolver.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptScope.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptState.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptString.cpp \
@@ -215,7 +224,7 @@
 	third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Binding.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Callback.cpp \
-	third_party/WebKit/Source/bindings/v8/V8CustomElementCallback.cpp \
+	third_party/WebKit/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMConfiguration.cpp \
 	third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMWrapper.cpp \
@@ -368,8 +377,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -381,7 +391,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -389,9 +398,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -403,7 +410,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -431,7 +437,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
@@ -541,8 +546,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -554,7 +560,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -562,9 +567,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -576,7 +579,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -604,7 +606,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
diff --git a/Source/core/webcore_derived.target.linux-mips.mk b/Source/core/webcore_derived.target.linux-mips.mk
index 00ba22d..30a32ac 100644
--- a/Source/core/webcore_derived.target.linux-mips.mk
+++ b/Source/core/webcore_derived.target.linux-mips.mk
@@ -79,6 +79,8 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/ColorSuggestionPicker.cpp
@@ -107,17 +109,19 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp
+$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp
+$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp
+$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp
 	mkdir -p $(@D); cp $< $@
@@ -152,6 +156,7 @@
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
 	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
 	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
@@ -166,6 +171,7 @@
 	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
+	$(gyp_intermediate_dir)/CSSParser.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -179,19 +185,21 @@
 
 GYP_COPIED_SOURCE_ORIGIN_DIRS := \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/webcore
+	$(gyp_shared_intermediate_dir)/webkit
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/bindings/v8/ActiveDOMCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/ArrayValue.cpp \
 	third_party/WebKit/Source/bindings/v8/BindingSecurity.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementBinding.cpp \
 	third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp \
-	third_party/WebKit/Source/bindings/v8/CustomElementHelpers.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementWrapper.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMDataStore.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMWrapperWorld.cpp \
 	third_party/WebKit/Source/bindings/v8/DateExtension.cpp \
 	third_party/WebKit/Source/bindings/v8/Dictionary.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionState.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionStatePlaceholder.cpp \
 	third_party/WebKit/Source/bindings/v8/IDBBindingUtilities.cpp \
 	third_party/WebKit/Source/bindings/v8/NPV8Object.cpp \
 	third_party/WebKit/Source/bindings/v8/PageScriptDebugServer.cpp \
@@ -207,6 +215,7 @@
 	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
+	third_party/WebKit/Source/bindings/v8/ScriptPromiseResolver.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptScope.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptState.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptString.cpp \
@@ -215,7 +224,7 @@
 	third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Binding.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Callback.cpp \
-	third_party/WebKit/Source/bindings/v8/V8CustomElementCallback.cpp \
+	third_party/WebKit/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMConfiguration.cpp \
 	third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMWrapper.cpp \
@@ -369,6 +378,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -380,7 +391,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -388,9 +398,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -402,7 +410,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -430,7 +437,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
@@ -541,6 +547,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -552,7 +560,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -560,9 +567,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -574,7 +579,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -602,7 +606,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
diff --git a/Source/core/webcore_derived.target.linux-x86.mk b/Source/core/webcore_derived.target.linux-x86.mk
index b8e77da..6ffa4e8 100644
--- a/Source/core/webcore_derived.target.linux-x86.mk
+++ b/Source/core/webcore_derived.target.linux-x86.mk
@@ -79,6 +79,8 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/webkit/HTMLNames.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/webkit/CachedResourceInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/webkit/ColorSuggestionPicker.cpp
@@ -107,17 +109,19 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/webkit/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSParser.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/webkit/XPathGrammar.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorFrontend.cpp
+$(gyp_intermediate_dir)/InspectorFrontend.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorFrontend.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorBackendDispatcher.cpp
+$(gyp_intermediate_dir)/InspectorBackendDispatcher.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorBackendDispatcher.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorTypeBuilder.cpp
+$(gyp_intermediate_dir)/InspectorTypeBuilder.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorTypeBuilder.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webcore/InspectorInstrumentationImpl.cpp
+$(gyp_intermediate_dir)/InspectorInstrumentationImpl.cpp: $(gyp_shared_intermediate_dir)/webkit/InspectorInstrumentationImpl.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/webkit/SVGElementFactory.cpp
 	mkdir -p $(@D); cp $< $@
@@ -152,6 +156,7 @@
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
 	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
 	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/CachedResourceInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
@@ -166,6 +171,7 @@
 	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
+	$(gyp_intermediate_dir)/CSSParser.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -179,19 +185,21 @@
 
 GYP_COPIED_SOURCE_ORIGIN_DIRS := \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/webcore
+	$(gyp_shared_intermediate_dir)/webkit
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/bindings/v8/ActiveDOMCallback.cpp \
 	third_party/WebKit/Source/bindings/v8/ArrayValue.cpp \
 	third_party/WebKit/Source/bindings/v8/BindingSecurity.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementBinding.cpp \
 	third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp \
-	third_party/WebKit/Source/bindings/v8/CustomElementHelpers.cpp \
+	third_party/WebKit/Source/bindings/v8/CustomElementWrapper.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMDataStore.cpp \
 	third_party/WebKit/Source/bindings/v8/DOMWrapperWorld.cpp \
 	third_party/WebKit/Source/bindings/v8/DateExtension.cpp \
 	third_party/WebKit/Source/bindings/v8/Dictionary.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionState.cpp \
+	third_party/WebKit/Source/bindings/v8/ExceptionStatePlaceholder.cpp \
 	third_party/WebKit/Source/bindings/v8/IDBBindingUtilities.cpp \
 	third_party/WebKit/Source/bindings/v8/NPV8Object.cpp \
 	third_party/WebKit/Source/bindings/v8/PageScriptDebugServer.cpp \
@@ -207,6 +215,7 @@
 	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
+	third_party/WebKit/Source/bindings/v8/ScriptPromiseResolver.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptScope.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptState.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptString.cpp \
@@ -215,7 +224,7 @@
 	third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Binding.cpp \
 	third_party/WebKit/Source/bindings/v8/V8Callback.cpp \
-	third_party/WebKit/Source/bindings/v8/V8CustomElementCallback.cpp \
+	third_party/WebKit/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMConfiguration.cpp \
 	third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp \
 	third_party/WebKit/Source/bindings/v8/V8DOMWrapper.cpp \
@@ -370,8 +379,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -383,7 +393,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -391,9 +400,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -405,7 +412,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -433,7 +439,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
@@ -546,8 +551,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -559,7 +565,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -567,9 +572,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -581,7 +584,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -609,7 +611,6 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webcore \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit/bindings \
 	$(LOCAL_PATH)/third_party/WebKit \
diff --git a/Source/core/webcore_dom.target.darwin-arm.mk b/Source/core/webcore_dom.target.darwin-arm.mk
index 2127fbe..66f48de 100644
--- a/Source/core/webcore_dom.target.darwin-arm.mk
+++ b/Source/core/webcore_dom.target.darwin-arm.mk
@@ -46,8 +46,11 @@
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.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/CustomElementDefinition.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/CustomEvent.cpp \
@@ -67,6 +70,7 @@
 	third_party/WebKit/Source/core/dom/DocumentEventQueue.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/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
@@ -138,8 +142,8 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ResourceProgressEvent.cpp \
 	third_party/WebKit/Source/core/dom/ScopedEventQueue.cpp \
-	third_party/WebKit/Source/core/dom/ScriptElement.cpp \
 	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
@@ -149,9 +153,11 @@
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
 	third_party/WebKit/Source/core/dom/StyleElement.cpp \
+	third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/TagNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextEvent.cpp \
+	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
 	third_party/WebKit/Source/core/dom/TouchEvent.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
@@ -220,8 +226,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -233,7 +240,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -241,9 +247,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -255,7 +259,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -382,8 +385,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -395,7 +399,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -403,9 +406,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -417,7 +418,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_dom.target.darwin-mips.mk b/Source/core/webcore_dom.target.darwin-mips.mk
index 4e8a700..3437b65 100644
--- a/Source/core/webcore_dom.target.darwin-mips.mk
+++ b/Source/core/webcore_dom.target.darwin-mips.mk
@@ -46,8 +46,11 @@
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.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/CustomElementDefinition.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/CustomEvent.cpp \
@@ -67,6 +70,7 @@
 	third_party/WebKit/Source/core/dom/DocumentEventQueue.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/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
@@ -138,8 +142,8 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ResourceProgressEvent.cpp \
 	third_party/WebKit/Source/core/dom/ScopedEventQueue.cpp \
-	third_party/WebKit/Source/core/dom/ScriptElement.cpp \
 	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
@@ -149,9 +153,11 @@
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
 	third_party/WebKit/Source/core/dom/StyleElement.cpp \
+	third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/TagNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextEvent.cpp \
+	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
 	third_party/WebKit/Source/core/dom/TouchEvent.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
@@ -221,6 +227,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -232,7 +240,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -240,9 +247,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -254,7 +259,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -382,6 +386,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -393,7 +399,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -401,9 +406,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -415,7 +418,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_dom.target.darwin-x86.mk b/Source/core/webcore_dom.target.darwin-x86.mk
index b5936eb..2546eb4 100644
--- a/Source/core/webcore_dom.target.darwin-x86.mk
+++ b/Source/core/webcore_dom.target.darwin-x86.mk
@@ -46,8 +46,11 @@
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.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/CustomElementDefinition.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/CustomEvent.cpp \
@@ -67,6 +70,7 @@
 	third_party/WebKit/Source/core/dom/DocumentEventQueue.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/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
@@ -138,8 +142,8 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ResourceProgressEvent.cpp \
 	third_party/WebKit/Source/core/dom/ScopedEventQueue.cpp \
-	third_party/WebKit/Source/core/dom/ScriptElement.cpp \
 	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
@@ -149,9 +153,11 @@
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
 	third_party/WebKit/Source/core/dom/StyleElement.cpp \
+	third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/TagNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextEvent.cpp \
+	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
 	third_party/WebKit/Source/core/dom/TouchEvent.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
@@ -222,8 +228,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -235,7 +242,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -243,9 +249,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -257,7 +261,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -387,8 +390,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -400,7 +404,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -408,9 +411,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -422,7 +423,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_dom.target.linux-arm.mk b/Source/core/webcore_dom.target.linux-arm.mk
index 2127fbe..66f48de 100644
--- a/Source/core/webcore_dom.target.linux-arm.mk
+++ b/Source/core/webcore_dom.target.linux-arm.mk
@@ -46,8 +46,11 @@
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.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/CustomElementDefinition.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/CustomEvent.cpp \
@@ -67,6 +70,7 @@
 	third_party/WebKit/Source/core/dom/DocumentEventQueue.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/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
@@ -138,8 +142,8 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ResourceProgressEvent.cpp \
 	third_party/WebKit/Source/core/dom/ScopedEventQueue.cpp \
-	third_party/WebKit/Source/core/dom/ScriptElement.cpp \
 	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
@@ -149,9 +153,11 @@
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
 	third_party/WebKit/Source/core/dom/StyleElement.cpp \
+	third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/TagNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextEvent.cpp \
+	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
 	third_party/WebKit/Source/core/dom/TouchEvent.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
@@ -220,8 +226,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -233,7 +240,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -241,9 +247,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -255,7 +259,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -382,8 +385,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -395,7 +399,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -403,9 +406,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -417,7 +418,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_dom.target.linux-mips.mk b/Source/core/webcore_dom.target.linux-mips.mk
index 4e8a700..3437b65 100644
--- a/Source/core/webcore_dom.target.linux-mips.mk
+++ b/Source/core/webcore_dom.target.linux-mips.mk
@@ -46,8 +46,11 @@
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.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/CustomElementDefinition.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/CustomEvent.cpp \
@@ -67,6 +70,7 @@
 	third_party/WebKit/Source/core/dom/DocumentEventQueue.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/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
@@ -138,8 +142,8 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ResourceProgressEvent.cpp \
 	third_party/WebKit/Source/core/dom/ScopedEventQueue.cpp \
-	third_party/WebKit/Source/core/dom/ScriptElement.cpp \
 	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
@@ -149,9 +153,11 @@
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
 	third_party/WebKit/Source/core/dom/StyleElement.cpp \
+	third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/TagNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextEvent.cpp \
+	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
 	third_party/WebKit/Source/core/dom/TouchEvent.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
@@ -221,6 +227,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -232,7 +240,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -240,9 +247,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -254,7 +259,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -382,6 +386,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -393,7 +399,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -401,9 +406,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -415,7 +418,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_dom.target.linux-x86.mk b/Source/core/webcore_dom.target.linux-x86.mk
index b5936eb..2546eb4 100644
--- a/Source/core/webcore_dom.target.linux-x86.mk
+++ b/Source/core/webcore_dom.target.linux-x86.mk
@@ -46,8 +46,11 @@
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.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/CustomElementDefinition.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/CustomEvent.cpp \
@@ -67,6 +70,7 @@
 	third_party/WebKit/Source/core/dom/DocumentEventQueue.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/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
@@ -138,8 +142,8 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ResourceProgressEvent.cpp \
 	third_party/WebKit/Source/core/dom/ScopedEventQueue.cpp \
-	third_party/WebKit/Source/core/dom/ScriptElement.cpp \
 	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
@@ -149,9 +153,11 @@
 	third_party/WebKit/Source/core/dom/StaticNodeList.cpp \
 	third_party/WebKit/Source/core/dom/StringCallback.cpp \
 	third_party/WebKit/Source/core/dom/StyleElement.cpp \
+	third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp \
 	third_party/WebKit/Source/core/dom/TagNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextEvent.cpp \
+	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
 	third_party/WebKit/Source/core/dom/TouchEvent.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
@@ -222,8 +228,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -235,7 +242,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -243,9 +249,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -257,7 +261,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -387,8 +390,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -400,7 +404,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -408,9 +411,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -422,7 +423,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_html.target.darwin-arm.mk b/Source/core/webcore_html.target.darwin-arm.mk
index 4a85e31..0f0db47 100644
--- a/Source/core/webcore_html.target.darwin-arm.mk
+++ b/Source/core/webcore_html.target.darwin-arm.mk
@@ -62,6 +62,7 @@
 	third_party/WebKit/Source/core/html/HTMLDataListElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDialogElement.cpp \
+	third_party/WebKit/Source/core/html/HTMLDimension.cpp \
 	third_party/WebKit/Source/core/html/HTMLDirectoryElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDivElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDocument.cpp \
@@ -84,6 +85,7 @@
 	third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageLoader.cpp \
+	third_party/WebKit/Source/core/html/HTMLImport.cpp \
 	third_party/WebKit/Source/core/html/HTMLImportsController.cpp \
 	third_party/WebKit/Source/core/html/HTMLInputElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp \
@@ -149,6 +151,7 @@
 	third_party/WebKit/Source/core/html/MediaDocument.cpp \
 	third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp \
 	third_party/WebKit/Source/core/html/MediaKeyEvent.cpp \
+	third_party/WebKit/Source/core/html/HTMLMediaSource.cpp \
 	third_party/WebKit/Source/core/html/MonthInputType.cpp \
 	third_party/WebKit/Source/core/html/NumberInputType.cpp \
 	third_party/WebKit/Source/core/html/PasswordInputType.cpp \
@@ -260,12 +263,12 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
+	third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
-	third_party/WebKit/Source/core/html/shadow/TextFieldDecorationElement.cpp \
 	third_party/WebKit/Source/core/html/ime/Composition.cpp \
 	third_party/WebKit/Source/core/html/ime/InputMethodContext.cpp \
 	third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp \
@@ -323,8 +326,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -336,7 +340,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -344,9 +347,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -358,7 +359,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -485,8 +485,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -498,7 +499,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -506,9 +506,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -520,7 +518,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_html.target.darwin-mips.mk b/Source/core/webcore_html.target.darwin-mips.mk
index 58c87fb..3259dd4 100644
--- a/Source/core/webcore_html.target.darwin-mips.mk
+++ b/Source/core/webcore_html.target.darwin-mips.mk
@@ -62,6 +62,7 @@
 	third_party/WebKit/Source/core/html/HTMLDataListElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDialogElement.cpp \
+	third_party/WebKit/Source/core/html/HTMLDimension.cpp \
 	third_party/WebKit/Source/core/html/HTMLDirectoryElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDivElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDocument.cpp \
@@ -84,6 +85,7 @@
 	third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageLoader.cpp \
+	third_party/WebKit/Source/core/html/HTMLImport.cpp \
 	third_party/WebKit/Source/core/html/HTMLImportsController.cpp \
 	third_party/WebKit/Source/core/html/HTMLInputElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp \
@@ -149,6 +151,7 @@
 	third_party/WebKit/Source/core/html/MediaDocument.cpp \
 	third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp \
 	third_party/WebKit/Source/core/html/MediaKeyEvent.cpp \
+	third_party/WebKit/Source/core/html/HTMLMediaSource.cpp \
 	third_party/WebKit/Source/core/html/MonthInputType.cpp \
 	third_party/WebKit/Source/core/html/NumberInputType.cpp \
 	third_party/WebKit/Source/core/html/PasswordInputType.cpp \
@@ -260,12 +263,12 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
+	third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
-	third_party/WebKit/Source/core/html/shadow/TextFieldDecorationElement.cpp \
 	third_party/WebKit/Source/core/html/ime/Composition.cpp \
 	third_party/WebKit/Source/core/html/ime/InputMethodContext.cpp \
 	third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp \
@@ -324,6 +327,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -335,7 +340,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -343,9 +347,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -357,7 +359,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -485,6 +486,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -496,7 +499,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -504,9 +506,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -518,7 +518,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_html.target.darwin-x86.mk b/Source/core/webcore_html.target.darwin-x86.mk
index 787c818..40def83 100644
--- a/Source/core/webcore_html.target.darwin-x86.mk
+++ b/Source/core/webcore_html.target.darwin-x86.mk
@@ -62,6 +62,7 @@
 	third_party/WebKit/Source/core/html/HTMLDataListElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDialogElement.cpp \
+	third_party/WebKit/Source/core/html/HTMLDimension.cpp \
 	third_party/WebKit/Source/core/html/HTMLDirectoryElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDivElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDocument.cpp \
@@ -84,6 +85,7 @@
 	third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageLoader.cpp \
+	third_party/WebKit/Source/core/html/HTMLImport.cpp \
 	third_party/WebKit/Source/core/html/HTMLImportsController.cpp \
 	third_party/WebKit/Source/core/html/HTMLInputElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp \
@@ -149,6 +151,7 @@
 	third_party/WebKit/Source/core/html/MediaDocument.cpp \
 	third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp \
 	third_party/WebKit/Source/core/html/MediaKeyEvent.cpp \
+	third_party/WebKit/Source/core/html/HTMLMediaSource.cpp \
 	third_party/WebKit/Source/core/html/MonthInputType.cpp \
 	third_party/WebKit/Source/core/html/NumberInputType.cpp \
 	third_party/WebKit/Source/core/html/PasswordInputType.cpp \
@@ -260,12 +263,12 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
+	third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
-	third_party/WebKit/Source/core/html/shadow/TextFieldDecorationElement.cpp \
 	third_party/WebKit/Source/core/html/ime/Composition.cpp \
 	third_party/WebKit/Source/core/html/ime/InputMethodContext.cpp \
 	third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp \
@@ -325,8 +328,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -338,7 +342,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -346,9 +349,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -360,7 +361,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -490,8 +490,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -503,7 +504,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -511,9 +511,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -525,7 +523,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_html.target.linux-arm.mk b/Source/core/webcore_html.target.linux-arm.mk
index 4a85e31..0f0db47 100644
--- a/Source/core/webcore_html.target.linux-arm.mk
+++ b/Source/core/webcore_html.target.linux-arm.mk
@@ -62,6 +62,7 @@
 	third_party/WebKit/Source/core/html/HTMLDataListElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDialogElement.cpp \
+	third_party/WebKit/Source/core/html/HTMLDimension.cpp \
 	third_party/WebKit/Source/core/html/HTMLDirectoryElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDivElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDocument.cpp \
@@ -84,6 +85,7 @@
 	third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageLoader.cpp \
+	third_party/WebKit/Source/core/html/HTMLImport.cpp \
 	third_party/WebKit/Source/core/html/HTMLImportsController.cpp \
 	third_party/WebKit/Source/core/html/HTMLInputElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp \
@@ -149,6 +151,7 @@
 	third_party/WebKit/Source/core/html/MediaDocument.cpp \
 	third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp \
 	third_party/WebKit/Source/core/html/MediaKeyEvent.cpp \
+	third_party/WebKit/Source/core/html/HTMLMediaSource.cpp \
 	third_party/WebKit/Source/core/html/MonthInputType.cpp \
 	third_party/WebKit/Source/core/html/NumberInputType.cpp \
 	third_party/WebKit/Source/core/html/PasswordInputType.cpp \
@@ -260,12 +263,12 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
+	third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
-	third_party/WebKit/Source/core/html/shadow/TextFieldDecorationElement.cpp \
 	third_party/WebKit/Source/core/html/ime/Composition.cpp \
 	third_party/WebKit/Source/core/html/ime/InputMethodContext.cpp \
 	third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp \
@@ -323,8 +326,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -336,7 +340,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -344,9 +347,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -358,7 +359,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -485,8 +485,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -498,7 +499,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -506,9 +506,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -520,7 +518,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_html.target.linux-mips.mk b/Source/core/webcore_html.target.linux-mips.mk
index 58c87fb..3259dd4 100644
--- a/Source/core/webcore_html.target.linux-mips.mk
+++ b/Source/core/webcore_html.target.linux-mips.mk
@@ -62,6 +62,7 @@
 	third_party/WebKit/Source/core/html/HTMLDataListElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDialogElement.cpp \
+	third_party/WebKit/Source/core/html/HTMLDimension.cpp \
 	third_party/WebKit/Source/core/html/HTMLDirectoryElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDivElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDocument.cpp \
@@ -84,6 +85,7 @@
 	third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageLoader.cpp \
+	third_party/WebKit/Source/core/html/HTMLImport.cpp \
 	third_party/WebKit/Source/core/html/HTMLImportsController.cpp \
 	third_party/WebKit/Source/core/html/HTMLInputElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp \
@@ -149,6 +151,7 @@
 	third_party/WebKit/Source/core/html/MediaDocument.cpp \
 	third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp \
 	third_party/WebKit/Source/core/html/MediaKeyEvent.cpp \
+	third_party/WebKit/Source/core/html/HTMLMediaSource.cpp \
 	third_party/WebKit/Source/core/html/MonthInputType.cpp \
 	third_party/WebKit/Source/core/html/NumberInputType.cpp \
 	third_party/WebKit/Source/core/html/PasswordInputType.cpp \
@@ -260,12 +263,12 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
+	third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
-	third_party/WebKit/Source/core/html/shadow/TextFieldDecorationElement.cpp \
 	third_party/WebKit/Source/core/html/ime/Composition.cpp \
 	third_party/WebKit/Source/core/html/ime/InputMethodContext.cpp \
 	third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp \
@@ -324,6 +327,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -335,7 +340,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -343,9 +347,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -357,7 +359,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -485,6 +486,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -496,7 +499,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -504,9 +506,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -518,7 +518,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_html.target.linux-x86.mk b/Source/core/webcore_html.target.linux-x86.mk
index 787c818..40def83 100644
--- a/Source/core/webcore_html.target.linux-x86.mk
+++ b/Source/core/webcore_html.target.linux-x86.mk
@@ -62,6 +62,7 @@
 	third_party/WebKit/Source/core/html/HTMLDataListElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDialogElement.cpp \
+	third_party/WebKit/Source/core/html/HTMLDimension.cpp \
 	third_party/WebKit/Source/core/html/HTMLDirectoryElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDivElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLDocument.cpp \
@@ -84,6 +85,7 @@
 	third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLImageLoader.cpp \
+	third_party/WebKit/Source/core/html/HTMLImport.cpp \
 	third_party/WebKit/Source/core/html/HTMLImportsController.cpp \
 	third_party/WebKit/Source/core/html/HTMLInputElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLKeygenElement.cpp \
@@ -149,6 +151,7 @@
 	third_party/WebKit/Source/core/html/MediaDocument.cpp \
 	third_party/WebKit/Source/core/html/MediaFragmentURIParser.cpp \
 	third_party/WebKit/Source/core/html/MediaKeyEvent.cpp \
+	third_party/WebKit/Source/core/html/HTMLMediaSource.cpp \
 	third_party/WebKit/Source/core/html/MonthInputType.cpp \
 	third_party/WebKit/Source/core/html/NumberInputType.cpp \
 	third_party/WebKit/Source/core/html/PasswordInputType.cpp \
@@ -260,12 +263,12 @@
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp \
 	third_party/WebKit/Source/core/html/shadow/MeterShadowElement.cpp \
+	third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ProgressShadowElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/ShadowElementNames.cpp \
 	third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp \
 	third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp \
-	third_party/WebKit/Source/core/html/shadow/TextFieldDecorationElement.cpp \
 	third_party/WebKit/Source/core/html/ime/Composition.cpp \
 	third_party/WebKit/Source/core/html/ime/InputMethodContext.cpp \
 	third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp \
@@ -325,8 +328,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -338,7 +342,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -346,9 +349,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -360,7 +361,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -490,8 +490,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -503,7 +504,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -511,9 +511,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -525,7 +523,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform.target.darwin-arm.mk b/Source/core/webcore_platform.target.darwin-arm.mk
index 6d32bc2..f027fa6 100644
--- a/Source/core/webcore_platform.target.darwin-arm.mk
+++ b/Source/core/webcore_platform.target.darwin-arm.mk
@@ -240,6 +240,7 @@
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperations.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/PointLightSource.cpp \
+	third_party/WebKit/Source/core/platform/graphics/filters/ReferenceFilter.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceAlpha.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceGraphic.cpp \
@@ -293,7 +294,6 @@
 	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/DeviceMotionClientMock.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/PlatformSpeechSynthesizerMock.cpp \
@@ -382,8 +382,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -395,7 +396,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -403,9 +403,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -417,7 +415,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -545,8 +542,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -558,7 +556,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -566,9 +563,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -580,7 +575,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform.target.darwin-mips.mk b/Source/core/webcore_platform.target.darwin-mips.mk
index 8e5d890..5e5ca4e 100644
--- a/Source/core/webcore_platform.target.darwin-mips.mk
+++ b/Source/core/webcore_platform.target.darwin-mips.mk
@@ -240,6 +240,7 @@
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperations.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/PointLightSource.cpp \
+	third_party/WebKit/Source/core/platform/graphics/filters/ReferenceFilter.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceAlpha.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceGraphic.cpp \
@@ -293,7 +294,6 @@
 	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/DeviceMotionClientMock.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/PlatformSpeechSynthesizerMock.cpp \
@@ -383,6 +383,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -394,7 +396,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -402,9 +403,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -416,7 +415,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -545,6 +543,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -556,7 +556,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -564,9 +563,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -578,7 +575,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform.target.darwin-x86.mk b/Source/core/webcore_platform.target.darwin-x86.mk
index 3933698..d685b3f 100644
--- a/Source/core/webcore_platform.target.darwin-x86.mk
+++ b/Source/core/webcore_platform.target.darwin-x86.mk
@@ -240,6 +240,7 @@
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperations.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/PointLightSource.cpp \
+	third_party/WebKit/Source/core/platform/graphics/filters/ReferenceFilter.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceAlpha.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceGraphic.cpp \
@@ -293,7 +294,6 @@
 	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/DeviceMotionClientMock.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/PlatformSpeechSynthesizerMock.cpp \
@@ -384,8 +384,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -397,7 +398,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -405,9 +405,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -419,7 +417,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -550,8 +547,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -563,7 +561,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -571,9 +568,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -585,7 +580,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform.target.linux-arm.mk b/Source/core/webcore_platform.target.linux-arm.mk
index 6d32bc2..f027fa6 100644
--- a/Source/core/webcore_platform.target.linux-arm.mk
+++ b/Source/core/webcore_platform.target.linux-arm.mk
@@ -240,6 +240,7 @@
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperations.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/PointLightSource.cpp \
+	third_party/WebKit/Source/core/platform/graphics/filters/ReferenceFilter.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceAlpha.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceGraphic.cpp \
@@ -293,7 +294,6 @@
 	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/DeviceMotionClientMock.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/PlatformSpeechSynthesizerMock.cpp \
@@ -382,8 +382,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -395,7 +396,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -403,9 +403,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -417,7 +415,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -545,8 +542,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -558,7 +556,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -566,9 +563,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -580,7 +575,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform.target.linux-mips.mk b/Source/core/webcore_platform.target.linux-mips.mk
index 8e5d890..5e5ca4e 100644
--- a/Source/core/webcore_platform.target.linux-mips.mk
+++ b/Source/core/webcore_platform.target.linux-mips.mk
@@ -240,6 +240,7 @@
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperations.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/PointLightSource.cpp \
+	third_party/WebKit/Source/core/platform/graphics/filters/ReferenceFilter.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceAlpha.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceGraphic.cpp \
@@ -293,7 +294,6 @@
 	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/DeviceMotionClientMock.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/PlatformSpeechSynthesizerMock.cpp \
@@ -383,6 +383,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -394,7 +396,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -402,9 +403,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -416,7 +415,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -545,6 +543,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -556,7 +556,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -564,9 +563,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -578,7 +575,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform.target.linux-x86.mk b/Source/core/webcore_platform.target.linux-x86.mk
index 3933698..d685b3f 100644
--- a/Source/core/webcore_platform.target.linux-x86.mk
+++ b/Source/core/webcore_platform.target.linux-x86.mk
@@ -240,6 +240,7 @@
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/FilterOperations.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/PointLightSource.cpp \
+	third_party/WebKit/Source/core/platform/graphics/filters/ReferenceFilter.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceAlpha.cpp \
 	third_party/WebKit/Source/core/platform/graphics/filters/SourceGraphic.cpp \
@@ -293,7 +294,6 @@
 	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/DeviceMotionClientMock.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/PlatformSpeechSynthesizerMock.cpp \
@@ -384,8 +384,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -397,7 +398,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -405,9 +405,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -419,7 +417,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -550,8 +547,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -563,7 +561,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -571,9 +568,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -585,7 +580,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform_geometry.target.darwin-arm.mk b/Source/core/webcore_platform_geometry.target.darwin-arm.mk
index 308c04c..b63850e 100644
--- a/Source/core/webcore_platform_geometry.target.darwin-arm.mk
+++ b/Source/core/webcore_platform_geometry.target.darwin-arm.mk
@@ -76,8 +76,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -89,7 +90,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -97,9 +97,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -111,7 +109,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -238,8 +235,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -251,7 +249,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -259,9 +256,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -273,7 +268,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform_geometry.target.darwin-mips.mk b/Source/core/webcore_platform_geometry.target.darwin-mips.mk
index 4f47789..8dde62b 100644
--- a/Source/core/webcore_platform_geometry.target.darwin-mips.mk
+++ b/Source/core/webcore_platform_geometry.target.darwin-mips.mk
@@ -77,6 +77,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -88,7 +90,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -96,9 +97,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -110,7 +109,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -238,6 +236,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -249,7 +249,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -257,9 +256,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -271,7 +268,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform_geometry.target.darwin-x86.mk b/Source/core/webcore_platform_geometry.target.darwin-x86.mk
index 9ae7c3c..4504f1c 100644
--- a/Source/core/webcore_platform_geometry.target.darwin-x86.mk
+++ b/Source/core/webcore_platform_geometry.target.darwin-x86.mk
@@ -78,8 +78,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -91,7 +92,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -99,9 +99,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -113,7 +111,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -243,8 +240,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -256,7 +254,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -264,9 +261,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -278,7 +273,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform_geometry.target.linux-arm.mk b/Source/core/webcore_platform_geometry.target.linux-arm.mk
index 308c04c..b63850e 100644
--- a/Source/core/webcore_platform_geometry.target.linux-arm.mk
+++ b/Source/core/webcore_platform_geometry.target.linux-arm.mk
@@ -76,8 +76,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -89,7 +90,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -97,9 +97,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -111,7 +109,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -238,8 +235,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -251,7 +249,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -259,9 +256,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -273,7 +268,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform_geometry.target.linux-mips.mk b/Source/core/webcore_platform_geometry.target.linux-mips.mk
index 4f47789..8dde62b 100644
--- a/Source/core/webcore_platform_geometry.target.linux-mips.mk
+++ b/Source/core/webcore_platform_geometry.target.linux-mips.mk
@@ -77,6 +77,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -88,7 +90,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -96,9 +97,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -110,7 +109,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -238,6 +236,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -249,7 +249,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -257,9 +256,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -271,7 +268,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_platform_geometry.target.linux-x86.mk b/Source/core/webcore_platform_geometry.target.linux-x86.mk
index 9ae7c3c..4504f1c 100644
--- a/Source/core/webcore_platform_geometry.target.linux-x86.mk
+++ b/Source/core/webcore_platform_geometry.target.linux-x86.mk
@@ -78,8 +78,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -91,7 +92,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -99,9 +99,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -113,7 +111,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -243,8 +240,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -256,7 +254,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -264,9 +261,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -278,7 +273,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_remaining.target.darwin-arm.mk b/Source/core/webcore_remaining.target.darwin-arm.mk
index 3c68171..8b25e40 100644
--- a/Source/core/webcore_remaining.target.darwin-arm.mk
+++ b/Source/core/webcore_remaining.target.darwin-arm.mk
@@ -52,9 +52,11 @@
 	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/AnimatableNumber.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/Animation.cpp \
 	third_party/WebKit/Source/core/animation/DocumentTimeline.cpp \
+	third_party/WebKit/Source/core/animation/KeyframeAnimationEffect.cpp \
 	third_party/WebKit/Source/core/animation/Player.cpp \
 	third_party/WebKit/Source/core/animation/TimedItem.cpp \
 	third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp \
@@ -96,7 +98,6 @@
 	third_party/WebKit/Source/core/css/CSSMixFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSOMUtils.cpp \
 	third_party/WebKit/Source/core/css/CSSPageRule.cpp \
-	third_party/WebKit/Source/core/css/CSSParser.cpp \
 	third_party/WebKit/Source/core/css/CSSParserValues.cpp \
 	third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp \
 	third_party/WebKit/Source/core/css/CSSProperty.cpp \
@@ -121,7 +122,6 @@
 	third_party/WebKit/Source/core/css/CSSValueList.cpp \
 	third_party/WebKit/Source/core/css/CSSValuePool.cpp \
 	third_party/WebKit/Source/core/css/CSSViewportRule.cpp \
-	third_party/WebKit/Source/core/css/DeprecatedStyleBuilder.cpp \
 	third_party/WebKit/Source/core/css/DOMWindowCSS.cpp \
 	third_party/WebKit/Source/core/css/DocumentRuleSets.cpp \
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
@@ -146,7 +146,6 @@
 	third_party/WebKit/Source/core/css/RuleSet.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSComputedStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSParser.cpp \
-	third_party/WebKit/Source/core/css/SVGCSSStyleSelector.cpp \
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
@@ -163,7 +162,12 @@
 	third_party/WebKit/Source/core/css/StyleSheetList.cpp \
 	third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp \
 	third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchResult.cpp \
+	third_party/WebKit/Source/core/css/resolver/MediaQueryResult.cpp \
 	third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp \
+	third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp \
@@ -313,7 +317,6 @@
 	third_party/WebKit/Source/core/loader/EmptyClients.cpp \
 	third_party/WebKit/Source/core/loader/FormState.cpp \
 	third_party/WebKit/Source/core/loader/FormSubmission.cpp \
-	third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoader.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp \
 	third_party/WebKit/Source/core/loader/HistoryController.cpp \
@@ -353,7 +356,6 @@
 	third_party/WebKit/Source/core/loader/cache/CachedResourceHandle.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceLoader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceRequest.cpp \
-	third_party/WebKit/Source/core/loader/cache/CachedResourceRequestInitiators.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedScript.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedShader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedTextTrack.cpp \
@@ -365,6 +367,7 @@
 	third_party/WebKit/Source/core/page/Console.cpp \
 	third_party/WebKit/Source/core/page/ContentSecurityPolicy.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 \
@@ -383,6 +386,8 @@
 	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/ImageBitmapCallback.cpp \
 	third_party/WebKit/Source/core/page/Location.cpp \
 	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
@@ -457,6 +462,7 @@
 	third_party/WebKit/Source/core/workers/WorkerThread.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.cpp \
+	third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.cpp \
 	third_party/WebKit/Source/core/xml/DOMParser.cpp \
 	third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp \
 	third_party/WebKit/Source/core/xml/XMLErrors.cpp \
@@ -527,8 +533,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -540,7 +547,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -548,9 +554,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -562,7 +566,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -691,8 +694,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -704,7 +708,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -712,9 +715,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -726,7 +727,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_remaining.target.darwin-mips.mk b/Source/core/webcore_remaining.target.darwin-mips.mk
index deb57fa..8d56fd9 100644
--- a/Source/core/webcore_remaining.target.darwin-mips.mk
+++ b/Source/core/webcore_remaining.target.darwin-mips.mk
@@ -52,9 +52,11 @@
 	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/AnimatableNumber.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/Animation.cpp \
 	third_party/WebKit/Source/core/animation/DocumentTimeline.cpp \
+	third_party/WebKit/Source/core/animation/KeyframeAnimationEffect.cpp \
 	third_party/WebKit/Source/core/animation/Player.cpp \
 	third_party/WebKit/Source/core/animation/TimedItem.cpp \
 	third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp \
@@ -96,7 +98,6 @@
 	third_party/WebKit/Source/core/css/CSSMixFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSOMUtils.cpp \
 	third_party/WebKit/Source/core/css/CSSPageRule.cpp \
-	third_party/WebKit/Source/core/css/CSSParser.cpp \
 	third_party/WebKit/Source/core/css/CSSParserValues.cpp \
 	third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp \
 	third_party/WebKit/Source/core/css/CSSProperty.cpp \
@@ -121,7 +122,6 @@
 	third_party/WebKit/Source/core/css/CSSValueList.cpp \
 	third_party/WebKit/Source/core/css/CSSValuePool.cpp \
 	third_party/WebKit/Source/core/css/CSSViewportRule.cpp \
-	third_party/WebKit/Source/core/css/DeprecatedStyleBuilder.cpp \
 	third_party/WebKit/Source/core/css/DOMWindowCSS.cpp \
 	third_party/WebKit/Source/core/css/DocumentRuleSets.cpp \
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
@@ -146,7 +146,6 @@
 	third_party/WebKit/Source/core/css/RuleSet.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSComputedStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSParser.cpp \
-	third_party/WebKit/Source/core/css/SVGCSSStyleSelector.cpp \
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
@@ -163,7 +162,12 @@
 	third_party/WebKit/Source/core/css/StyleSheetList.cpp \
 	third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp \
 	third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchResult.cpp \
+	third_party/WebKit/Source/core/css/resolver/MediaQueryResult.cpp \
 	third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp \
+	third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp \
@@ -313,7 +317,6 @@
 	third_party/WebKit/Source/core/loader/EmptyClients.cpp \
 	third_party/WebKit/Source/core/loader/FormState.cpp \
 	third_party/WebKit/Source/core/loader/FormSubmission.cpp \
-	third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoader.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp \
 	third_party/WebKit/Source/core/loader/HistoryController.cpp \
@@ -353,7 +356,6 @@
 	third_party/WebKit/Source/core/loader/cache/CachedResourceHandle.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceLoader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceRequest.cpp \
-	third_party/WebKit/Source/core/loader/cache/CachedResourceRequestInitiators.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedScript.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedShader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedTextTrack.cpp \
@@ -365,6 +367,7 @@
 	third_party/WebKit/Source/core/page/Console.cpp \
 	third_party/WebKit/Source/core/page/ContentSecurityPolicy.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 \
@@ -383,6 +386,8 @@
 	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/ImageBitmapCallback.cpp \
 	third_party/WebKit/Source/core/page/Location.cpp \
 	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
@@ -457,6 +462,7 @@
 	third_party/WebKit/Source/core/workers/WorkerThread.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.cpp \
+	third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.cpp \
 	third_party/WebKit/Source/core/xml/DOMParser.cpp \
 	third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp \
 	third_party/WebKit/Source/core/xml/XMLErrors.cpp \
@@ -528,6 +534,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -539,7 +547,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -547,9 +554,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -561,7 +566,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -691,6 +695,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -702,7 +708,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -710,9 +715,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -724,7 +727,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_remaining.target.darwin-x86.mk b/Source/core/webcore_remaining.target.darwin-x86.mk
index 2af3021..5730f8f 100644
--- a/Source/core/webcore_remaining.target.darwin-x86.mk
+++ b/Source/core/webcore_remaining.target.darwin-x86.mk
@@ -52,9 +52,11 @@
 	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/AnimatableNumber.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/Animation.cpp \
 	third_party/WebKit/Source/core/animation/DocumentTimeline.cpp \
+	third_party/WebKit/Source/core/animation/KeyframeAnimationEffect.cpp \
 	third_party/WebKit/Source/core/animation/Player.cpp \
 	third_party/WebKit/Source/core/animation/TimedItem.cpp \
 	third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp \
@@ -96,7 +98,6 @@
 	third_party/WebKit/Source/core/css/CSSMixFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSOMUtils.cpp \
 	third_party/WebKit/Source/core/css/CSSPageRule.cpp \
-	third_party/WebKit/Source/core/css/CSSParser.cpp \
 	third_party/WebKit/Source/core/css/CSSParserValues.cpp \
 	third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp \
 	third_party/WebKit/Source/core/css/CSSProperty.cpp \
@@ -121,7 +122,6 @@
 	third_party/WebKit/Source/core/css/CSSValueList.cpp \
 	third_party/WebKit/Source/core/css/CSSValuePool.cpp \
 	third_party/WebKit/Source/core/css/CSSViewportRule.cpp \
-	third_party/WebKit/Source/core/css/DeprecatedStyleBuilder.cpp \
 	third_party/WebKit/Source/core/css/DOMWindowCSS.cpp \
 	third_party/WebKit/Source/core/css/DocumentRuleSets.cpp \
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
@@ -146,7 +146,6 @@
 	third_party/WebKit/Source/core/css/RuleSet.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSComputedStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSParser.cpp \
-	third_party/WebKit/Source/core/css/SVGCSSStyleSelector.cpp \
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
@@ -163,7 +162,12 @@
 	third_party/WebKit/Source/core/css/StyleSheetList.cpp \
 	third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp \
 	third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchResult.cpp \
+	third_party/WebKit/Source/core/css/resolver/MediaQueryResult.cpp \
 	third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp \
+	third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp \
@@ -313,7 +317,6 @@
 	third_party/WebKit/Source/core/loader/EmptyClients.cpp \
 	third_party/WebKit/Source/core/loader/FormState.cpp \
 	third_party/WebKit/Source/core/loader/FormSubmission.cpp \
-	third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoader.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp \
 	third_party/WebKit/Source/core/loader/HistoryController.cpp \
@@ -353,7 +356,6 @@
 	third_party/WebKit/Source/core/loader/cache/CachedResourceHandle.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceLoader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceRequest.cpp \
-	third_party/WebKit/Source/core/loader/cache/CachedResourceRequestInitiators.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedScript.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedShader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedTextTrack.cpp \
@@ -365,6 +367,7 @@
 	third_party/WebKit/Source/core/page/Console.cpp \
 	third_party/WebKit/Source/core/page/ContentSecurityPolicy.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 \
@@ -383,6 +386,8 @@
 	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/ImageBitmapCallback.cpp \
 	third_party/WebKit/Source/core/page/Location.cpp \
 	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
@@ -457,6 +462,7 @@
 	third_party/WebKit/Source/core/workers/WorkerThread.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.cpp \
+	third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.cpp \
 	third_party/WebKit/Source/core/xml/DOMParser.cpp \
 	third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp \
 	third_party/WebKit/Source/core/xml/XMLErrors.cpp \
@@ -529,8 +535,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -542,7 +549,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -550,9 +556,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -564,7 +568,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -696,8 +699,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -709,7 +713,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -717,9 +720,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -731,7 +732,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_remaining.target.linux-arm.mk b/Source/core/webcore_remaining.target.linux-arm.mk
index 3c68171..8b25e40 100644
--- a/Source/core/webcore_remaining.target.linux-arm.mk
+++ b/Source/core/webcore_remaining.target.linux-arm.mk
@@ -52,9 +52,11 @@
 	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/AnimatableNumber.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/Animation.cpp \
 	third_party/WebKit/Source/core/animation/DocumentTimeline.cpp \
+	third_party/WebKit/Source/core/animation/KeyframeAnimationEffect.cpp \
 	third_party/WebKit/Source/core/animation/Player.cpp \
 	third_party/WebKit/Source/core/animation/TimedItem.cpp \
 	third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp \
@@ -96,7 +98,6 @@
 	third_party/WebKit/Source/core/css/CSSMixFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSOMUtils.cpp \
 	third_party/WebKit/Source/core/css/CSSPageRule.cpp \
-	third_party/WebKit/Source/core/css/CSSParser.cpp \
 	third_party/WebKit/Source/core/css/CSSParserValues.cpp \
 	third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp \
 	third_party/WebKit/Source/core/css/CSSProperty.cpp \
@@ -121,7 +122,6 @@
 	third_party/WebKit/Source/core/css/CSSValueList.cpp \
 	third_party/WebKit/Source/core/css/CSSValuePool.cpp \
 	third_party/WebKit/Source/core/css/CSSViewportRule.cpp \
-	third_party/WebKit/Source/core/css/DeprecatedStyleBuilder.cpp \
 	third_party/WebKit/Source/core/css/DOMWindowCSS.cpp \
 	third_party/WebKit/Source/core/css/DocumentRuleSets.cpp \
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
@@ -146,7 +146,6 @@
 	third_party/WebKit/Source/core/css/RuleSet.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSComputedStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSParser.cpp \
-	third_party/WebKit/Source/core/css/SVGCSSStyleSelector.cpp \
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
@@ -163,7 +162,12 @@
 	third_party/WebKit/Source/core/css/StyleSheetList.cpp \
 	third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp \
 	third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchResult.cpp \
+	third_party/WebKit/Source/core/css/resolver/MediaQueryResult.cpp \
 	third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp \
+	third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp \
@@ -313,7 +317,6 @@
 	third_party/WebKit/Source/core/loader/EmptyClients.cpp \
 	third_party/WebKit/Source/core/loader/FormState.cpp \
 	third_party/WebKit/Source/core/loader/FormSubmission.cpp \
-	third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoader.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp \
 	third_party/WebKit/Source/core/loader/HistoryController.cpp \
@@ -353,7 +356,6 @@
 	third_party/WebKit/Source/core/loader/cache/CachedResourceHandle.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceLoader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceRequest.cpp \
-	third_party/WebKit/Source/core/loader/cache/CachedResourceRequestInitiators.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedScript.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedShader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedTextTrack.cpp \
@@ -365,6 +367,7 @@
 	third_party/WebKit/Source/core/page/Console.cpp \
 	third_party/WebKit/Source/core/page/ContentSecurityPolicy.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 \
@@ -383,6 +386,8 @@
 	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/ImageBitmapCallback.cpp \
 	third_party/WebKit/Source/core/page/Location.cpp \
 	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
@@ -457,6 +462,7 @@
 	third_party/WebKit/Source/core/workers/WorkerThread.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.cpp \
+	third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.cpp \
 	third_party/WebKit/Source/core/xml/DOMParser.cpp \
 	third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp \
 	third_party/WebKit/Source/core/xml/XMLErrors.cpp \
@@ -527,8 +533,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -540,7 +547,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -548,9 +554,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -562,7 +566,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -691,8 +694,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -704,7 +708,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -712,9 +715,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -726,7 +727,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_remaining.target.linux-mips.mk b/Source/core/webcore_remaining.target.linux-mips.mk
index deb57fa..8d56fd9 100644
--- a/Source/core/webcore_remaining.target.linux-mips.mk
+++ b/Source/core/webcore_remaining.target.linux-mips.mk
@@ -52,9 +52,11 @@
 	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/AnimatableNumber.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/Animation.cpp \
 	third_party/WebKit/Source/core/animation/DocumentTimeline.cpp \
+	third_party/WebKit/Source/core/animation/KeyframeAnimationEffect.cpp \
 	third_party/WebKit/Source/core/animation/Player.cpp \
 	third_party/WebKit/Source/core/animation/TimedItem.cpp \
 	third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp \
@@ -96,7 +98,6 @@
 	third_party/WebKit/Source/core/css/CSSMixFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSOMUtils.cpp \
 	third_party/WebKit/Source/core/css/CSSPageRule.cpp \
-	third_party/WebKit/Source/core/css/CSSParser.cpp \
 	third_party/WebKit/Source/core/css/CSSParserValues.cpp \
 	third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp \
 	third_party/WebKit/Source/core/css/CSSProperty.cpp \
@@ -121,7 +122,6 @@
 	third_party/WebKit/Source/core/css/CSSValueList.cpp \
 	third_party/WebKit/Source/core/css/CSSValuePool.cpp \
 	third_party/WebKit/Source/core/css/CSSViewportRule.cpp \
-	third_party/WebKit/Source/core/css/DeprecatedStyleBuilder.cpp \
 	third_party/WebKit/Source/core/css/DOMWindowCSS.cpp \
 	third_party/WebKit/Source/core/css/DocumentRuleSets.cpp \
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
@@ -146,7 +146,6 @@
 	third_party/WebKit/Source/core/css/RuleSet.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSComputedStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSParser.cpp \
-	third_party/WebKit/Source/core/css/SVGCSSStyleSelector.cpp \
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
@@ -163,7 +162,12 @@
 	third_party/WebKit/Source/core/css/StyleSheetList.cpp \
 	third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp \
 	third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchResult.cpp \
+	third_party/WebKit/Source/core/css/resolver/MediaQueryResult.cpp \
 	third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp \
+	third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp \
@@ -313,7 +317,6 @@
 	third_party/WebKit/Source/core/loader/EmptyClients.cpp \
 	third_party/WebKit/Source/core/loader/FormState.cpp \
 	third_party/WebKit/Source/core/loader/FormSubmission.cpp \
-	third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoader.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp \
 	third_party/WebKit/Source/core/loader/HistoryController.cpp \
@@ -353,7 +356,6 @@
 	third_party/WebKit/Source/core/loader/cache/CachedResourceHandle.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceLoader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceRequest.cpp \
-	third_party/WebKit/Source/core/loader/cache/CachedResourceRequestInitiators.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedScript.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedShader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedTextTrack.cpp \
@@ -365,6 +367,7 @@
 	third_party/WebKit/Source/core/page/Console.cpp \
 	third_party/WebKit/Source/core/page/ContentSecurityPolicy.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 \
@@ -383,6 +386,8 @@
 	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/ImageBitmapCallback.cpp \
 	third_party/WebKit/Source/core/page/Location.cpp \
 	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
@@ -457,6 +462,7 @@
 	third_party/WebKit/Source/core/workers/WorkerThread.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.cpp \
+	third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.cpp \
 	third_party/WebKit/Source/core/xml/DOMParser.cpp \
 	third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp \
 	third_party/WebKit/Source/core/xml/XMLErrors.cpp \
@@ -528,6 +534,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -539,7 +547,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -547,9 +554,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -561,7 +566,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -691,6 +695,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -702,7 +708,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -710,9 +715,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -724,7 +727,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_remaining.target.linux-x86.mk b/Source/core/webcore_remaining.target.linux-x86.mk
index 2af3021..5730f8f 100644
--- a/Source/core/webcore_remaining.target.linux-x86.mk
+++ b/Source/core/webcore_remaining.target.linux-x86.mk
@@ -52,9 +52,11 @@
 	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/AnimatableNumber.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/Animation.cpp \
 	third_party/WebKit/Source/core/animation/DocumentTimeline.cpp \
+	third_party/WebKit/Source/core/animation/KeyframeAnimationEffect.cpp \
 	third_party/WebKit/Source/core/animation/Player.cpp \
 	third_party/WebKit/Source/core/animation/TimedItem.cpp \
 	third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp \
@@ -96,7 +98,6 @@
 	third_party/WebKit/Source/core/css/CSSMixFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSOMUtils.cpp \
 	third_party/WebKit/Source/core/css/CSSPageRule.cpp \
-	third_party/WebKit/Source/core/css/CSSParser.cpp \
 	third_party/WebKit/Source/core/css/CSSParserValues.cpp \
 	third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp \
 	third_party/WebKit/Source/core/css/CSSProperty.cpp \
@@ -121,7 +122,6 @@
 	third_party/WebKit/Source/core/css/CSSValueList.cpp \
 	third_party/WebKit/Source/core/css/CSSValuePool.cpp \
 	third_party/WebKit/Source/core/css/CSSViewportRule.cpp \
-	third_party/WebKit/Source/core/css/DeprecatedStyleBuilder.cpp \
 	third_party/WebKit/Source/core/css/DOMWindowCSS.cpp \
 	third_party/WebKit/Source/core/css/DocumentRuleSets.cpp \
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
@@ -146,7 +146,6 @@
 	third_party/WebKit/Source/core/css/RuleSet.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSComputedStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/SVGCSSParser.cpp \
-	third_party/WebKit/Source/core/css/SVGCSSStyleSelector.cpp \
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
@@ -163,7 +162,12 @@
 	third_party/WebKit/Source/core/css/StyleSheetList.cpp \
 	third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp \
 	third_party/WebKit/Source/core/css/resolver/FilterOperationResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.cpp \
+	third_party/WebKit/Source/core/css/resolver/MatchResult.cpp \
+	third_party/WebKit/Source/core/css/resolver/MediaQueryResult.cpp \
 	third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp \
+	third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp \
+	third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp \
 	third_party/WebKit/Source/core/css/resolver/StyleResolverState.cpp \
@@ -313,7 +317,6 @@
 	third_party/WebKit/Source/core/loader/EmptyClients.cpp \
 	third_party/WebKit/Source/core/loader/FormState.cpp \
 	third_party/WebKit/Source/core/loader/FormSubmission.cpp \
-	third_party/WebKit/Source/core/loader/FrameLoadRequest.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoader.cpp \
 	third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp \
 	third_party/WebKit/Source/core/loader/HistoryController.cpp \
@@ -353,7 +356,6 @@
 	third_party/WebKit/Source/core/loader/cache/CachedResourceHandle.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceLoader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedResourceRequest.cpp \
-	third_party/WebKit/Source/core/loader/cache/CachedResourceRequestInitiators.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedScript.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedShader.cpp \
 	third_party/WebKit/Source/core/loader/cache/CachedTextTrack.cpp \
@@ -365,6 +367,7 @@
 	third_party/WebKit/Source/core/page/Console.cpp \
 	third_party/WebKit/Source/core/page/ContentSecurityPolicy.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 \
@@ -383,6 +386,8 @@
 	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/ImageBitmapCallback.cpp \
 	third_party/WebKit/Source/core/page/Location.cpp \
 	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
@@ -457,6 +462,7 @@
 	third_party/WebKit/Source/core/workers/WorkerThread.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp \
 	third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.cpp \
+	third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.cpp \
 	third_party/WebKit/Source/core/xml/DOMParser.cpp \
 	third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp \
 	third_party/WebKit/Source/core/xml/XMLErrors.cpp \
@@ -529,8 +535,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -542,7 +549,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -550,9 +556,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -564,7 +568,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -696,8 +699,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -709,7 +713,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -717,9 +720,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -731,7 +732,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_rendering.target.darwin-arm.mk b/Source/core/webcore_rendering.target.darwin-arm.mk
index 36cf7f3..5608945 100644
--- a/Source/core/webcore_rendering.target.darwin-arm.mk
+++ b/Source/core/webcore_rendering.target.darwin-arm.mk
@@ -42,6 +42,7 @@
 	third_party/WebKit/Source/core/rendering/LayoutState.cpp \
 	third_party/WebKit/Source/core/rendering/OrderIterator.cpp \
 	third_party/WebKit/Source/core/rendering/LayoutRepainter.cpp \
+	third_party/WebKit/Source/core/rendering/Pagination.cpp \
 	third_party/WebKit/Source/core/rendering/PointerEventsHitRules.cpp \
 	third_party/WebKit/Source/core/rendering/RenderApplet.cpp \
 	third_party/WebKit/Source/core/rendering/RenderArena.cpp \
@@ -215,8 +216,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -228,7 +230,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -236,9 +237,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -250,7 +249,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -377,8 +375,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -390,7 +389,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -398,9 +396,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -412,7 +408,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_rendering.target.darwin-mips.mk b/Source/core/webcore_rendering.target.darwin-mips.mk
index 77f60bc..61ad3e8 100644
--- a/Source/core/webcore_rendering.target.darwin-mips.mk
+++ b/Source/core/webcore_rendering.target.darwin-mips.mk
@@ -42,6 +42,7 @@
 	third_party/WebKit/Source/core/rendering/LayoutState.cpp \
 	third_party/WebKit/Source/core/rendering/OrderIterator.cpp \
 	third_party/WebKit/Source/core/rendering/LayoutRepainter.cpp \
+	third_party/WebKit/Source/core/rendering/Pagination.cpp \
 	third_party/WebKit/Source/core/rendering/PointerEventsHitRules.cpp \
 	third_party/WebKit/Source/core/rendering/RenderApplet.cpp \
 	third_party/WebKit/Source/core/rendering/RenderArena.cpp \
@@ -216,6 +217,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -227,7 +230,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -235,9 +237,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -249,7 +249,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -377,6 +376,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -388,7 +389,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -396,9 +396,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -410,7 +408,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_rendering.target.darwin-x86.mk b/Source/core/webcore_rendering.target.darwin-x86.mk
index be84b2c..4fe83b2 100644
--- a/Source/core/webcore_rendering.target.darwin-x86.mk
+++ b/Source/core/webcore_rendering.target.darwin-x86.mk
@@ -42,6 +42,7 @@
 	third_party/WebKit/Source/core/rendering/LayoutState.cpp \
 	third_party/WebKit/Source/core/rendering/OrderIterator.cpp \
 	third_party/WebKit/Source/core/rendering/LayoutRepainter.cpp \
+	third_party/WebKit/Source/core/rendering/Pagination.cpp \
 	third_party/WebKit/Source/core/rendering/PointerEventsHitRules.cpp \
 	third_party/WebKit/Source/core/rendering/RenderApplet.cpp \
 	third_party/WebKit/Source/core/rendering/RenderArena.cpp \
@@ -218,8 +219,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -231,7 +233,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -239,9 +240,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -253,7 +252,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -384,8 +382,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -397,7 +396,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -405,9 +403,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -419,7 +415,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_rendering.target.linux-arm.mk b/Source/core/webcore_rendering.target.linux-arm.mk
index 36cf7f3..5608945 100644
--- a/Source/core/webcore_rendering.target.linux-arm.mk
+++ b/Source/core/webcore_rendering.target.linux-arm.mk
@@ -42,6 +42,7 @@
 	third_party/WebKit/Source/core/rendering/LayoutState.cpp \
 	third_party/WebKit/Source/core/rendering/OrderIterator.cpp \
 	third_party/WebKit/Source/core/rendering/LayoutRepainter.cpp \
+	third_party/WebKit/Source/core/rendering/Pagination.cpp \
 	third_party/WebKit/Source/core/rendering/PointerEventsHitRules.cpp \
 	third_party/WebKit/Source/core/rendering/RenderApplet.cpp \
 	third_party/WebKit/Source/core/rendering/RenderArena.cpp \
@@ -215,8 +216,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -228,7 +230,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -236,9 +237,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -250,7 +249,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -377,8 +375,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -390,7 +389,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -398,9 +396,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -412,7 +408,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_rendering.target.linux-mips.mk b/Source/core/webcore_rendering.target.linux-mips.mk
index 77f60bc..61ad3e8 100644
--- a/Source/core/webcore_rendering.target.linux-mips.mk
+++ b/Source/core/webcore_rendering.target.linux-mips.mk
@@ -42,6 +42,7 @@
 	third_party/WebKit/Source/core/rendering/LayoutState.cpp \
 	third_party/WebKit/Source/core/rendering/OrderIterator.cpp \
 	third_party/WebKit/Source/core/rendering/LayoutRepainter.cpp \
+	third_party/WebKit/Source/core/rendering/Pagination.cpp \
 	third_party/WebKit/Source/core/rendering/PointerEventsHitRules.cpp \
 	third_party/WebKit/Source/core/rendering/RenderApplet.cpp \
 	third_party/WebKit/Source/core/rendering/RenderArena.cpp \
@@ -216,6 +217,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -227,7 +230,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -235,9 +237,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -249,7 +249,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -377,6 +376,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -388,7 +389,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -396,9 +396,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -410,7 +408,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_rendering.target.linux-x86.mk b/Source/core/webcore_rendering.target.linux-x86.mk
index be84b2c..4fe83b2 100644
--- a/Source/core/webcore_rendering.target.linux-x86.mk
+++ b/Source/core/webcore_rendering.target.linux-x86.mk
@@ -42,6 +42,7 @@
 	third_party/WebKit/Source/core/rendering/LayoutState.cpp \
 	third_party/WebKit/Source/core/rendering/OrderIterator.cpp \
 	third_party/WebKit/Source/core/rendering/LayoutRepainter.cpp \
+	third_party/WebKit/Source/core/rendering/Pagination.cpp \
 	third_party/WebKit/Source/core/rendering/PointerEventsHitRules.cpp \
 	third_party/WebKit/Source/core/rendering/RenderApplet.cpp \
 	third_party/WebKit/Source/core/rendering/RenderArena.cpp \
@@ -218,8 +219,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -231,7 +233,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -239,9 +240,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -253,7 +252,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -384,8 +382,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -397,7 +396,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -405,9 +403,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -419,7 +415,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_svg.target.darwin-arm.mk b/Source/core/webcore_svg.target.darwin-arm.mk
index 62076fd..7cb2ea7 100644
--- a/Source/core/webcore_svg.target.darwin-arm.mk
+++ b/Source/core/webcore_svg.target.darwin-arm.mk
@@ -26,6 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp \
+	third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGBlock.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGContainer.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGEllipse.cpp \
@@ -103,6 +104,7 @@
 	third_party/WebKit/Source/core/svg/SVGAnimatedString.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedTransformList.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp \
+	third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp \
@@ -239,6 +241,7 @@
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp \
+	third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
 
@@ -282,8 +285,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -295,7 +299,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -303,9 +306,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -317,7 +318,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -444,8 +444,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -457,7 +458,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -465,9 +465,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -479,7 +477,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_svg.target.darwin-mips.mk b/Source/core/webcore_svg.target.darwin-mips.mk
index 2679ec7..9386b00 100644
--- a/Source/core/webcore_svg.target.darwin-mips.mk
+++ b/Source/core/webcore_svg.target.darwin-mips.mk
@@ -26,6 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp \
+	third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGBlock.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGContainer.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGEllipse.cpp \
@@ -103,6 +104,7 @@
 	third_party/WebKit/Source/core/svg/SVGAnimatedString.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedTransformList.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp \
+	third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp \
@@ -239,6 +241,7 @@
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp \
+	third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
 
@@ -283,6 +286,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -294,7 +299,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -302,9 +306,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -316,7 +318,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -444,6 +445,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -455,7 +458,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -463,9 +465,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -477,7 +477,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_svg.target.darwin-x86.mk b/Source/core/webcore_svg.target.darwin-x86.mk
index aae016f..aa4c74f 100644
--- a/Source/core/webcore_svg.target.darwin-x86.mk
+++ b/Source/core/webcore_svg.target.darwin-x86.mk
@@ -26,6 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp \
+	third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGBlock.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGContainer.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGEllipse.cpp \
@@ -103,6 +104,7 @@
 	third_party/WebKit/Source/core/svg/SVGAnimatedString.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedTransformList.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp \
+	third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp \
@@ -239,6 +241,7 @@
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp \
+	third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
 
@@ -284,8 +287,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -297,7 +301,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -305,9 +308,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -319,7 +320,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -449,8 +449,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -462,7 +463,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -470,9 +470,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -484,7 +482,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_svg.target.linux-arm.mk b/Source/core/webcore_svg.target.linux-arm.mk
index 62076fd..7cb2ea7 100644
--- a/Source/core/webcore_svg.target.linux-arm.mk
+++ b/Source/core/webcore_svg.target.linux-arm.mk
@@ -26,6 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp \
+	third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGBlock.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGContainer.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGEllipse.cpp \
@@ -103,6 +104,7 @@
 	third_party/WebKit/Source/core/svg/SVGAnimatedString.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedTransformList.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp \
+	third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp \
@@ -239,6 +241,7 @@
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp \
+	third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
 
@@ -282,8 +285,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -295,7 +299,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -303,9 +306,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -317,7 +318,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -444,8 +444,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -457,7 +458,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -465,9 +465,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -479,7 +477,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_svg.target.linux-mips.mk b/Source/core/webcore_svg.target.linux-mips.mk
index 2679ec7..9386b00 100644
--- a/Source/core/webcore_svg.target.linux-mips.mk
+++ b/Source/core/webcore_svg.target.linux-mips.mk
@@ -26,6 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp \
+	third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGBlock.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGContainer.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGEllipse.cpp \
@@ -103,6 +104,7 @@
 	third_party/WebKit/Source/core/svg/SVGAnimatedString.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedTransformList.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp \
+	third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp \
@@ -239,6 +241,7 @@
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp \
+	third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
 
@@ -283,6 +286,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -294,7 +299,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -302,9 +306,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -316,7 +318,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -444,6 +445,8 @@
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -455,7 +458,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -463,9 +465,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -477,7 +477,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/webcore_svg.target.linux-x86.mk b/Source/core/webcore_svg.target.linux-x86.mk
index aae016f..aa4c74f 100644
--- a/Source/core/webcore_svg.target.linux-x86.mk
+++ b/Source/core/webcore_svg.target.linux-x86.mk
@@ -26,6 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp \
 	third_party/WebKit/Source/core/rendering/style/SVGRenderStyleDefs.cpp \
+	third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGBlock.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGContainer.cpp \
 	third_party/WebKit/Source/core/rendering/svg/RenderSVGEllipse.cpp \
@@ -103,6 +104,7 @@
 	third_party/WebKit/Source/core/svg/SVGAnimatedString.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedTransformList.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp \
+	third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp \
 	third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp \
@@ -239,6 +241,7 @@
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.cpp \
 	third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp \
+	third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGAttributeToPropertyMap.cpp \
 	third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
 
@@ -284,8 +287,9 @@
 MY_DEFS_Debug := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -297,7 +301,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -305,9 +308,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -319,7 +320,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
@@ -449,8 +449,9 @@
 MY_DEFS_Release := \
 	'-DANGLE_DX11' \
 	'-D_FILE_OFFSET_BITS=64' \
-	'-DUSE_LINUX_BREAKPAD' \
 	'-DNO_TCMALLOC' \
+	'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
+	'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
 	'-DDISABLE_NACL' \
 	'-DCHROMIUM_BUILD' \
 	'-DUSE_LIBJPEG_TURBO=1' \
@@ -462,7 +463,6 @@
 	'-DWEBCORE_NAVIGATOR_VENDOR="Google Inc."' \
 	'-DWEBKIT_IMPLEMENTATION=1' \
 	'-DINSIDE_WEBKIT' \
-	'-DENABLE_CANVAS_USES_MAILBOX=1' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
@@ -470,9 +470,7 @@
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_XHR_TIMEOUT=0' \
 	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
-	'-DENABLE_PARTITION_ALLOC=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -484,7 +482,6 @@
 	'-DENABLE_PRINTING=0' \
 	'-DENABLE_NAVIGATOR_CONTENT_UTILS=0' \
 	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
-	'-DENABLE_8BIT_TEXTRUN=1' \
 	'-DENABLE_OPENTYPE_VERTICAL=1' \
 	'-DWTF_USE_HARFBUZZ=1' \
 	'-DU_USING_ICU_NAMESPACE=0' \
diff --git a/Source/core/workers/AbstractWorker.cpp b/Source/core/workers/AbstractWorker.cpp
index fded518..1d1eee0 100644
--- a/Source/core/workers/AbstractWorker.cpp
+++ b/Source/core/workers/AbstractWorker.cpp
@@ -57,24 +57,24 @@
 KURL AbstractWorker::resolveURL(const String& url, ExceptionCode& ec)
 {
     if (url.isEmpty()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return KURL();
     }
 
     // FIXME: This should use the dynamic global scope (bug #27887)
     KURL scriptURL = scriptExecutionContext()->completeURL(url);
     if (!scriptURL.isValid()) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return KURL();
     }
 
     if (!scriptExecutionContext()->securityOrigin()->canRequest(scriptURL)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return KURL();
     }
 
     if (scriptExecutionContext()->contentSecurityPolicy() && !scriptExecutionContext()->contentSecurityPolicy()->allowScriptFromSource(scriptURL)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return KURL();
     }
 
diff --git a/Source/core/workers/SharedWorker.cpp b/Source/core/workers/SharedWorker.cpp
index df13db8..a282eb4 100644
--- a/Source/core/workers/SharedWorker.cpp
+++ b/Source/core/workers/SharedWorker.cpp
@@ -73,7 +73,7 @@
     ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument());
     Document* document = toDocument(context);
     if (!document->securityOrigin()->canAccessSharedWorkers(document->topOrigin())) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return 0;
     }
 
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp
index cc45d63..111cba0 100644
--- a/Source/core/workers/WorkerGlobalScope.cpp
+++ b/Source/core/workers/WorkerGlobalScope.cpp
@@ -213,7 +213,7 @@
     for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) {
         const KURL& url = scriptExecutionContext()->completeURL(*it);
         if (!url.isValid()) {
-            ec = SYNTAX_ERR;
+            ec = SyntaxError;
             return;
         }
         completedURLs.append(url);
@@ -225,9 +225,9 @@
         scriptLoader->setTargetType(ResourceRequest::TargetIsScript);
         scriptLoader->loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRequests);
 
-        // If the fetching attempt failed, throw a NETWORK_ERR exception and abort all these steps.
+        // If the fetching attempt failed, throw a NetworkError exception and abort all these steps.
         if (scriptLoader->failed()) {
-            ec = NETWORK_ERR;
+            ec = NetworkError;
             return;
         }
 
diff --git a/Source/core/workers/WorkerGlobalScope.idl b/Source/core/workers/WorkerGlobalScope.idl
index f00ed3f..e709f70 100644
--- a/Source/core/workers/WorkerGlobalScope.idl
+++ b/Source/core/workers/WorkerGlobalScope.idl
@@ -26,10 +26,9 @@
 
 [
     GlobalContext=WorkerGlobalScope,
-    EventTarget,
     CustomToV8,
     DoNotGenerateWrap
-] interface WorkerGlobalScope {
+] interface WorkerGlobalScope : EventTarget {
 
     // WorkerGlobalScope
     [Replaceable] readonly attribute WorkerGlobalScope self;
@@ -41,15 +40,6 @@
     [Custom] void importScripts(/*[Variadic] in DOMString urls */);
     [Replaceable] readonly attribute WorkerNavigator navigator;
 
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
-
     // Additional constructors
     attribute URLConstructor webkitURL; // FIXME: deprecate this.
 };
diff --git a/Source/core/workers/WorkerMessagingProxy.cpp b/Source/core/workers/WorkerMessagingProxy.cpp
index c31a70d..82a2727 100644
--- a/Source/core/workers/WorkerMessagingProxy.cpp
+++ b/Source/core/workers/WorkerMessagingProxy.cpp
@@ -264,7 +264,7 @@
     // FIXME: This need to be revisited when we support nested worker one day
     ASSERT(m_scriptExecutionContext->isDocument());
     Document* document = toDocument(m_scriptExecutionContext.get());
-    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, document->contentSecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderType(), document->topOrigin(), document->loader()->timing()->referenceMonotonicTime());
+    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, document->contentSecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderType(), document->topOrigin(), document->loader() ? document->loader()->timing()->referenceMonotonicTime() : monotonicallyIncreasingTime());
     workerThreadCreated(thread);
     thread->start();
     InspectorInstrumentation::didStartWorkerGlobalScope(m_scriptExecutionContext.get(), this, scriptURL);
diff --git a/Source/core/xml/DocumentXPathEvaluator.cpp b/Source/core/xml/DocumentXPathEvaluator.cpp
new file mode 100644
index 0000000..2fbd529
--- /dev/null
+++ b/Source/core/xml/DocumentXPathEvaluator.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2013 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/xml/DocumentXPathEvaluator.h"
+
+#include "core/dom/ScriptExecutionContext.h"
+#include "core/xml/XPathEvaluator.h"
+#include "core/xml/XPathExpression.h"
+#include "core/xml/XPathNSResolver.h"
+#include "core/xml/XPathResult.h"
+
+namespace WebCore {
+
+DocumentXPathEvaluator::DocumentXPathEvaluator()
+{
+}
+
+DocumentXPathEvaluator::~DocumentXPathEvaluator()
+{
+}
+
+DocumentXPathEvaluator* DocumentXPathEvaluator::from(ScriptExecutionContext* context)
+{
+    DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
+    if (!cache) {
+        cache = new DocumentXPathEvaluator();
+        Supplement<ScriptExecutionContext>::provideTo(context, supplementName(), adoptPtr(cache));
+    }
+    return cache;
+}
+
+PassRefPtr<XPathExpression> DocumentXPathEvaluator::createExpression(ScriptExecutionContext* context,
+    const String& expression, XPathNSResolver* resolver, ExceptionCode& ec)
+{
+    DocumentXPathEvaluator* suplement = from(context);
+    if (!suplement->m_xpathEvaluator)
+        suplement->m_xpathEvaluator = XPathEvaluator::create();
+    return suplement->m_xpathEvaluator->createExpression(expression, resolver, ec);
+}
+
+PassRefPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(ScriptExecutionContext* context, Node* nodeResolver)
+{
+    DocumentXPathEvaluator* suplement = from(context);
+    if (!suplement->m_xpathEvaluator)
+        suplement->m_xpathEvaluator = XPathEvaluator::create();
+    return suplement->m_xpathEvaluator->createNSResolver(nodeResolver);
+}
+
+PassRefPtr<XPathResult> DocumentXPathEvaluator::evaluate(ScriptExecutionContext* context, const String& expression,
+    Node* contextNode, XPathNSResolver* resolver, unsigned short type,
+    XPathResult* result, ExceptionCode& ec)
+{
+    DocumentXPathEvaluator* suplement = from(context);
+    if (!suplement->m_xpathEvaluator)
+        suplement->m_xpathEvaluator = XPathEvaluator::create();
+    return suplement->m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, ec);
+}
+
+} // namespace WebCore
diff --git a/Source/core/xml/DocumentXPathEvaluator.h b/Source/core/xml/DocumentXPathEvaluator.h
new file mode 100644
index 0000000..d0dab29
--- /dev/null
+++ b/Source/core/xml/DocumentXPathEvaluator.h
@@ -0,0 +1,62 @@
+/*
+ * 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. 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 DocumentXPathEvaluator_h
+#define DocumentXPathEvaluator_h
+
+#include "core/platform/Supplementable.h"
+#include "core/xml/XPathEvaluator.h"
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+class XPathExpression;
+class XPathNSResolver;
+class XPathResult;
+
+class DocumentXPathEvaluator : public Supplement<ScriptExecutionContext> {
+public:
+    virtual ~DocumentXPathEvaluator();
+
+    static DocumentXPathEvaluator* from(ScriptExecutionContext*);
+
+    static PassRefPtr<XPathExpression> createExpression(ScriptExecutionContext*,
+        const String& expression, XPathNSResolver*, ExceptionCode&);
+    static PassRefPtr<XPathNSResolver> createNSResolver(ScriptExecutionContext*, Node* nodeResolver);
+    static PassRefPtr<XPathResult> evaluate(ScriptExecutionContext*,
+        const String& expression, Node* contextNode, XPathNSResolver*,
+        unsigned short type, XPathResult*, ExceptionCode&);
+
+private:
+    DocumentXPathEvaluator();
+
+    static const char* supplementName() { return "DocumentXPathEvaluator"; }
+
+    RefPtr<XPathEvaluator> m_xpathEvaluator;
+};
+
+} // namespace WebCore
+
+#endif // DocumentXPathEvaluator_h
diff --git a/Source/core/xml/DocumentXPathEvaluator.idl b/Source/core/xml/DocumentXPathEvaluator.idl
new file mode 100644
index 0000000..ebe0ef4
--- /dev/null
+++ b/Source/core/xml/DocumentXPathEvaluator.idl
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+partial interface Document {
+    // DOM Level 3 XPath (XPathEvaluator interface)
+    [RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression,
+                                                       [Default=Undefined] optional XPathNSResolver resolver);
+    XPathNSResolver    createNSResolver(Node nodeResolver);
+    [Custom, RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString expression,
+                                                   [Default=Undefined] optional Node contextNode,
+                                                   [Default=Undefined] optional XPathNSResolver resolver,
+                                                   [Default=Undefined] optional unsigned short type,
+                                                   [Default=Undefined] optional XPathResult inResult);
+};
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 29d1bbc..7ac35d7 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "core/xml/XMLHttpRequest.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include <wtf/ArrayBuffer.h>
 #include <wtf/ArrayBufferView.h>
 #include <wtf/RefCountedLeakCounter.h>
@@ -45,7 +46,6 @@
 #include "core/loader/CrossOriginAccessControl.h"
 #include "core/loader/TextResourceDecoder.h"
 #include "core/loader/ThreadableLoader.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/page/ContentSecurityPolicy.h"
 #include "core/page/Settings.h"
 #include "core/platform/HistogramSupport.h"
@@ -215,7 +215,7 @@
 ScriptString XMLHttpRequest::responseText(ExceptionCode& ec)
 {
     if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != ResponseTypeText) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return ScriptString();
     }
     if (m_error || (m_state != LOADING && m_state != DONE))
@@ -226,7 +226,7 @@
 Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
 {
     if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != ResponseTypeDocument) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -244,9 +244,9 @@
             m_responseDocument = 0;
         } else {
             if (isHTML)
-                m_responseDocument = HTMLDocument::create(0, m_url);
+                m_responseDocument = HTMLDocument::create(DocumentInit(m_url));
             else
-                m_responseDocument = Document::create(0, m_url);
+                m_responseDocument = Document::create(DocumentInit(m_url));
             // FIXME: Set Last-Modified.
             m_responseDocument->setContent(m_responseText.flattenToString());
             m_responseDocument->setSecurityOrigin(securityOrigin());
@@ -263,7 +263,7 @@
 Blob* XMLHttpRequest::responseBlob(ExceptionCode& ec)
 {
     if (m_responseTypeCode != ResponseTypeBlob) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
     // We always return null before DONE.
@@ -298,7 +298,7 @@
 ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionCode& ec)
 {
     if (m_responseTypeCode != ResponseTypeArrayBuffer) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
 
@@ -319,7 +319,7 @@
     // 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) {
         logConsoleError(scriptExecutionContext(), "XMLHttpRequest.timeout cannot be set for synchronous HTTP(S) requests made from the window context.");
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
     m_timeoutMilliseconds = timeout;
@@ -328,7 +328,7 @@
 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionCode& ec)
 {
     if (m_state >= LOADING) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -338,7 +338,7 @@
     // such as file: and data: still make sense to allow.
     if (!m_async && scriptExecutionContext()->isDocument() && m_url.protocolIsInHTTPFamily()) {
         logConsoleError(scriptExecutionContext(), "XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.");
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return;
     }
 
@@ -410,7 +410,7 @@
 void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec)
 {
     if (m_state > OPENED || m_loader) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
@@ -463,25 +463,25 @@
     ASSERT(m_state == UNSENT);
 
     if (!isValidHTTPToken(method)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
     if (!isAllowedHTTPMethod(method)) {
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
     if (!ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
         // FIXME: Should this be throwing an exception?
-        ec = SECURITY_ERR;
+        ec = SecurityError;
         return;
     }
 
     if (!async && scriptExecutionContext()->isDocument()) {
         if (document()->settings() && !document()->settings()->syncXHRInDocumentsEnabled()) {
             logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests are disabled for this page.");
-            ec = INVALID_ACCESS_ERR;
+            ec = InvalidAccessError;
             return;
         }
 
@@ -491,14 +491,14 @@
         // such as file: and data: still make sense to allow.
         if (url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) {
             logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.");
-            ec = INVALID_ACCESS_ERR;
+            ec = InvalidAccessError;
             return;
         }
 
         // Similarly, timeouts are disabled for synchronous requests as well.
         if (m_timeoutMilliseconds > 0) {
             logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests must not have a timeout value set.");
-            ec = INVALID_ACCESS_ERR;
+            ec = InvalidAccessError;
             return;
         }
     }
@@ -542,7 +542,7 @@
         return false;
 
     if (m_state != OPENED || m_loader) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return false;
     }
 
@@ -574,11 +574,7 @@
         String body = createMarkup(document);
 
         // FIXME: This should use value of document.inputEncoding to determine the encoding to use.
-        WTF::TextEncoding encoding = UTF8Encoding();
-        if (body.is8Bit())
-            m_requestEntityBody = FormData::create(body.characters8(), body.length());
-        else
-            m_requestEntityBody = FormData::create(encoding.encode(body, WTF::EntitiesForUnencodables));
+        m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesForUnencodables));
         if (m_upload)
             m_requestEntityBody->setAlwaysStream(true);
     }
@@ -600,10 +596,7 @@
             m_requestHeaders.set("Content-Type", contentType);
         }
 
-        if (body.is8Bit())
-            m_requestEntityBody = FormData::create(body.characters8(), body.length());
-        else
-            m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesForUnencodables));
+        m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF::EntitiesForUnencodables));
         if (m_upload)
             m_requestEntityBody->setAlwaysStream(true);
     }
@@ -699,7 +692,7 @@
 {
     // Only GET request is supported for blob URL.
     if (m_url.protocolIs("blob") && m_method != "GET") {
-        ec = NETWORK_ERR;
+        ec = NetworkError;
         return;
     }
 
@@ -744,7 +737,7 @@
     options.credentialsRequested = m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials;
     options.crossOriginRequestPolicy = m_allowCrossOriginRequests ? AllowCrossOriginRequests : UseAccessControl;
     options.securityOrigin = securityOrigin();
-    options.initiator = cachedResourceRequestInitiators().xmlhttprequest;
+    options.initiator = CachedResourceInitiatorTypeNames::xmlhttprequest;
     options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
     options.timeoutMilliseconds = m_timeoutMilliseconds;
 
@@ -774,7 +767,7 @@
     }
 
     if (!m_exceptionCode && m_error)
-        m_exceptionCode = NETWORK_ERR;
+        m_exceptionCode = NetworkError;
     ec = m_exceptionCode;
 }
 
@@ -904,12 +897,12 @@
 void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec)
 {
     if (m_state != OPENED || m_loader) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return;
     }
 
     if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(value)) {
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return;
     }
 
@@ -937,7 +930,7 @@
 String XMLHttpRequest::getAllResponseHeaders(ExceptionCode& ec) const
 {
     if (m_state < HEADERS_RECEIVED) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return "";
     }
 
@@ -973,7 +966,7 @@
 String XMLHttpRequest::getResponseHeader(const AtomicString& name, ExceptionCode& ec) const
 {
     if (m_state < HEADERS_RECEIVED) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return String();
     }
 
@@ -1023,7 +1016,7 @@
     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.
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
     }
 
     return 0;
@@ -1036,7 +1029,7 @@
 
     if (m_state == OPENED) {
         // See comments in status() above.
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
     }
 
     return String();
@@ -1050,7 +1043,7 @@
         return;
 
     if (error.isCancellation()) {
-        m_exceptionCode = ABORT_ERR;
+        m_exceptionCode = AbortError;
         abortError();
         return;
     }
@@ -1064,7 +1057,7 @@
     if (error.domain() == errorDomainWebKitInternal)
         logConsoleError(scriptExecutionContext(), "XMLHttpRequest cannot load " + error.failingURL() + ". " + error.localizedDescription());
 
-    m_exceptionCode = NETWORK_ERR;
+    m_exceptionCode = NetworkError;
     networkError();
 }
 
@@ -1192,11 +1185,11 @@
     clearRequest();
 
     m_error = true;
-    m_exceptionCode = TIMEOUT_ERR;
+    m_exceptionCode = TimeoutError;
 
     if (!m_async) {
         m_state = DONE;
-        m_exceptionCode = TIMEOUT_ERR;
+        m_exceptionCode = TimeoutError;
         return;
     }
 
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index 91011d3..0763080 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -105,9 +105,7 @@
     String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
     ScriptString responseText(ExceptionCode&);
     Document* responseXML(ExceptionCode&);
-    Document* optionalResponseXML() const { return m_responseDocument.get(); }
     Blob* responseBlob(ExceptionCode&);
-    Blob* optionalResponseBlob() const { return m_responseBlob.get(); }
     unsigned long timeout() const { return m_timeoutMilliseconds; }
     void setTimeout(unsigned long timeout, ExceptionCode&);
 
@@ -124,13 +122,11 @@
     
     // response attribute has custom getter.
     ArrayBuffer* responseArrayBuffer(ExceptionCode&);
-    ArrayBuffer* optionalResponseArrayBuffer() const { return m_responseArrayBuffer.get(); }
 
     void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; }
     void setLastSendURL(const String& url) { m_lastSendURL = url; }
 
     XMLHttpRequestUpload* upload();
-    XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); }
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const;
 
diff --git a/Source/core/xml/XMLHttpRequest.idl b/Source/core/xml/XMLHttpRequest.idl
index fbe7217..bad83ca 100644
--- a/Source/core/xml/XMLHttpRequest.idl
+++ b/Source/core/xml/XMLHttpRequest.idl
@@ -41,9 +41,8 @@
     ActiveDOMObject,
     Constructor,
     ConstructorCallWith=ScriptExecutionContext,
-    CustomConstructor(optional XMLHttpRequestOptions options),
-    EventTarget
-] interface XMLHttpRequest {
+    CustomConstructor(optional XMLHttpRequestOptions options)
+] interface XMLHttpRequest : EventTarget {
     // From XMLHttpRequestEventTarget
     // event handler attributes
     attribute EventListener onabort;
@@ -93,13 +92,4 @@
 
     // Extension
     void overrideMimeType(DOMString override);
-
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
diff --git a/Source/core/xml/XMLHttpRequestUpload.idl b/Source/core/xml/XMLHttpRequestUpload.idl
index 2262201..d2170ed 100644
--- a/Source/core/xml/XMLHttpRequestUpload.idl
+++ b/Source/core/xml/XMLHttpRequestUpload.idl
@@ -26,9 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    EventTarget
-] interface XMLHttpRequestUpload {
+interface XMLHttpRequestUpload : EventTarget {
     // From XMLHttpRequestEventTarget
     // event handler attributes
     attribute EventListener onabort;
@@ -37,14 +35,5 @@
     attribute EventListener onloadend;
     attribute EventListener onloadstart;
     attribute EventListener onprogress;
-
-    // EventTarget interface
-    void addEventListener(DOMString type, 
-                          EventListener listener, 
-                          optional boolean useCapture);
-    void removeEventListener(DOMString type, 
-                             EventListener listener, 
-                             optional boolean useCapture);
-    [RaisesException] boolean dispatchEvent(Event evt);
 };
 
diff --git a/Source/core/xml/XMLSerializer.cpp b/Source/core/xml/XMLSerializer.cpp
index 9e1edd2..ad6305d 100644
--- a/Source/core/xml/XMLSerializer.cpp
+++ b/Source/core/xml/XMLSerializer.cpp
@@ -38,7 +38,7 @@
         // with it.  It should be the only type of node where this is possible.
         ASSERT(node->nodeType() == Node::DOCUMENT_TYPE_NODE);
 
-        ec = INVALID_ACCESS_ERR;
+        ec = InvalidAccessError;
         return String();
     }
 
diff --git a/Source/core/xml/XMLTreeViewer.cpp b/Source/core/xml/XMLTreeViewer.cpp
index c32a888..f5595df 100644
--- a/Source/core/xml/XMLTreeViewer.cpp
+++ b/Source/core/xml/XMLTreeViewer.cpp
@@ -73,7 +73,6 @@
     String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css));
     RefPtr<Text> text = m_document->createTextNode(cssString);
     m_document->getElementById("xml-viewer-style")->appendChild(text, IGNORE_EXCEPTION);
-    m_document->styleResolverChanged(RecalcStyleImmediately);
 }
 
 } // namespace WebCore
diff --git a/Source/core/xml/XPathEvaluator.cpp b/Source/core/xml/XPathEvaluator.cpp
index a33917f..5453975 100644
--- a/Source/core/xml/XPathEvaluator.cpp
+++ b/Source/core/xml/XPathEvaluator.cpp
@@ -58,7 +58,7 @@
                                                  ExceptionCode& ec)
 {
     if (!isValidContextNode(contextNode)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
diff --git a/Source/core/xml/XPathExpression.cpp b/Source/core/xml/XPathExpression.cpp
index 3a96c3e..bc2f249 100644
--- a/Source/core/xml/XPathExpression.cpp
+++ b/Source/core/xml/XPathExpression.cpp
@@ -59,7 +59,7 @@
 PassRefPtr<XPathResult> XPathExpression::evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionCode& ec)
 {
     if (!isValidContextNode(contextNode)) {
-        ec = NOT_SUPPORTED_ERR;
+        ec = NotSupportedError;
         return 0;
     }
 
@@ -73,7 +73,7 @@
 
     if (evaluationContext.hadTypeConversionError) {
         // It is not specified what to do if type conversion fails while evaluating an expression.
-        ec = SYNTAX_ERR;
+        ec = SyntaxError;
         return 0;
     }
 
diff --git a/Source/core/xml/XPathFunctions.cpp b/Source/core/xml/XPathFunctions.cpp
index 990fc72..2132316 100644
--- a/Source/core/xml/XPathFunctions.cpp
+++ b/Source/core/xml/XPathFunctions.cpp
@@ -349,7 +349,7 @@
 
         // If there are several nodes with the same id, id() should return the first one.
         // In WebKit, getElementById behaves so, too, although its behavior in this case is formally undefined.
-        Node* node = contextScope->getElementById(String(idList.characters() + startPos, endPos - startPos));
+        Node* node = contextScope->getElementById(idList.toStringPreserveCapacity().substring(startPos, endPos - startPos));
         if (node && resultSet.add(node).isNewEntry)
             result.append(node);
         
diff --git a/Source/core/xml/XPathParser.cpp b/Source/core/xml/XPathParser.cpp
index 4ef59b6..c031b15 100644
--- a/Source/core/xml/XPathParser.cpp
+++ b/Source/core/xml/XPathParser.cpp
@@ -501,9 +501,9 @@
         m_topExpr = 0;
 
         if (m_gotNamespaceError)
-            ec = NAMESPACE_ERR;
+            ec = NamespaceError;
         else
-            ec = SYNTAX_ERR;
+            ec = SyntaxError;
         return 0;
     }
 
diff --git a/Source/core/xml/XPathResult.cpp b/Source/core/xml/XPathResult.cpp
index 3f386df..79290641 100644
--- a/Source/core/xml/XPathResult.cpp
+++ b/Source/core/xml/XPathResult.cpp
@@ -185,7 +185,7 @@
     }
     
     if (invalidIteratorState()) {
-        ec = INVALID_STATE_ERR;
+        ec = InvalidStateError;
         return 0;
     }
     
diff --git a/Source/core/xml/XSLImportRule.cpp b/Source/core/xml/XSLImportRule.cpp
index 0463367..a14a51b 100644
--- a/Source/core/xml/XSLImportRule.cpp
+++ b/Source/core/xml/XSLImportRule.cpp
@@ -22,10 +22,10 @@
 #include "config.h"
 #include "core/xml/XSLImportRule.h"
 
+#include "CachedResourceInitiatorTypeNames.h"
 #include "core/dom/Document.h"
 #include "core/loader/cache/CachedResourceLoader.h"
 #include "core/loader/cache/CachedResourceRequest.h"
-#include "core/loader/cache/CachedResourceRequestInitiators.h"
 #include "core/loader/cache/CachedXSLStyleSheet.h"
 #include "core/xml/XSLStyleSheet.h"
 
@@ -98,7 +98,7 @@
             return;
     }
     
-    CachedResourceRequest request(ResourceRequest(cachedResourceLoader->document()->completeURL(absHref)), cachedResourceRequestInitiators().xml);
+    CachedResourceRequest request(ResourceRequest(cachedResourceLoader->document()->completeURL(absHref)), CachedResourceInitiatorTypeNames::xml);
     m_cachedSheet = cachedResourceLoader->requestXSLStyleSheet(request);
     
     if (m_cachedSheet) {
diff --git a/Source/core/xml/XSLTProcessor.cpp b/Source/core/xml/XSLTProcessor.cpp
index ef40795..b3626f9 100644
--- a/Source/core/xml/XSLTProcessor.cpp
+++ b/Source/core/xml/XSLTProcessor.cpp
@@ -69,7 +69,7 @@
 
     RefPtr<Document> result;
     if (sourceMIMEType == "text/plain") {
-        result = Document::create(frame, sourceIsDocument ? ownerDocument->url() : KURL());
+        result = Document::create(DocumentInit(sourceIsDocument ? ownerDocument->url() : KURL(), frame));
         transformTextStringToXHTMLDocumentString(documentSource);
     } else
         result = DOMImplementation::createDocument(sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : KURL(), false);
diff --git a/Source/core/xml/XSLTUnicodeSort.cpp b/Source/core/xml/XSLTUnicodeSort.cpp
index 2ad7102..82e373b 100644
--- a/Source/core/xml/XSLTUnicodeSort.cpp
+++ b/Source/core/xml/XSLTUnicodeSort.cpp
@@ -163,9 +163,11 @@
                             tst = 1;
                         else tst = -1;
                     } else {
-                        String str1 = String::fromUTF8((const char*)results[j]->stringval);
-                        String str2 = String::fromUTF8((const char*)results[j + incr]->stringval);
-                        tst = collator.collate(str1.bloatedCharacters(), str1.length(), str2.bloatedCharacters(), str2.length());
+                        Vector<UChar> string1;
+                        Vector<UChar> string2;
+                        String::fromUTF8(reinterpret_cast<const char*>(results[j]->stringval)).appendTo(string1);
+                        String::fromUTF8(reinterpret_cast<const char*>(results[j + incr]->stringval)).appendTo(string2);
+                        tst = collator.collate(string1.data(), string1.size(), string2.data(), string2.size());
                     }
                     if (descending)
                         tst = -tst;
@@ -218,9 +220,11 @@
                                     tst = 1;
                                 else tst = -1;
                             } else {
-                                String str1 = String::fromUTF8((const char*)res[j]->stringval);
-                                String str2 = String::fromUTF8((const char*)res[j + incr]->stringval);
-                                tst = collator.collate(str1.bloatedCharacters(), str1.length(), str2.bloatedCharacters(), str2.length());
+                                Vector<UChar> string1;
+                                Vector<UChar> string2;
+                                String::fromUTF8(reinterpret_cast<const char*>(res[j]->stringval)).appendTo(string1);
+                                String::fromUTF8(reinterpret_cast<const char*>(res[j + incr]->stringval)).appendTo(string2);
+                                tst = collator.collate(string1.data(), string1.size(), string2.data(), string2.size());
                             }
                             if (desc)
                                 tst = -tst;
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index bebcde2..a55bd1a 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -37,6 +37,7 @@
 #include <wtf/Vector.h>
 #include "HTMLNames.h"
 #include "XMLNSNames.h"
+#include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptSourceCode.h"
 #include "core/dom/CDATASection.h"
 #include "core/dom/Comment.h"
@@ -45,7 +46,7 @@
 #include "core/dom/DocumentType.h"
 #include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/ProcessingInstruction.h"
-#include "core/dom/ScriptElement.h"
+#include "core/dom/ScriptLoader.h"
 #include "core/dom/TransformSource.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLTemplateElement.h"
@@ -335,8 +336,11 @@
 
     doWrite(source.toString());
 
-    // After parsing, go ahead and dispatch image beforeload events.
-    ImageLoader::dispatchPendingBeforeLoadEvents();
+    if (isStopped())
+        return;
+
+    if (document()->frame() && document()->frame()->script()->canExecuteScripts(NotAboutToExecuteScript))
+        ImageLoader::dispatchPendingBeforeLoadEvents();
 }
 
 void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* formattedMessage, TextPosition position)
@@ -444,17 +448,17 @@
     RefPtr<Element> e = m_scriptElement;
     m_scriptElement = 0;
 
-    ScriptElement* scriptElement = toScriptElementIfPossible(e.get());
-    ASSERT(scriptElement);
+    ScriptLoader* scriptLoader = toScriptLoaderIfPossible(e.get());
+    ASSERT(scriptLoader);
 
     // JavaScript can detach this parser, make sure it's kept alive even if detached.
     RefPtr<XMLDocumentParser> protect(this);
 
     if (errorOccurred)
-        scriptElement->dispatchErrorEvent();
+        scriptLoader->dispatchErrorEvent();
     else if (!wasCanceled) {
-        scriptElement->executeScript(sourceCode);
-        scriptElement->dispatchLoadEvent();
+        scriptLoader->executeScript(sourceCode);
+        scriptLoader->dispatchLoadEvent();
     }
 
     m_scriptElement = 0;
@@ -955,8 +959,8 @@
 
     newElement->beginParsingChildren();
 
-    ScriptElement* scriptElement = toScriptElementIfPossible(newElement.get());
-    if (scriptElement)
+    ScriptLoader* scriptLoader = toScriptLoaderIfPossible(newElement.get());
+    if (scriptLoader)
         m_scriptStartPosition = textPosition();
 
     m_currentNode->parserAppendChild(newElement.get());
@@ -970,8 +974,8 @@
     if (m_view && currentNode->attached() && !newElement->attached())
         newElement->attach();
 
-    if (newElement->hasTagName(HTMLNames::htmlTag))
-        static_cast<HTMLHtmlElement*>(newElement.get())->insertedByParser();
+    if (isHTMLHtmlElement(newElement.get()))
+        toHTMLHtmlElement(newElement.get())->insertedByParser();
 
     if (!m_parsingFragment && isFirstElement && document()->frame())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
@@ -996,7 +1000,7 @@
     RefPtr<ContainerNode> n = m_currentNode;
     n->finishParsingChildren();
 
-    if (!scriptingContentIsAllowed(parserContentPolicy()) && n->isElementNode() && toScriptElementIfPossible(toElement(n.get()))) {
+    if (!scriptingContentIsAllowed(parserContentPolicy()) && n->isElementNode() && toScriptLoaderIfPossible(toElement(n.get()))) {
         popCurrentNode();
         n->remove(IGNORE_EXCEPTION);
         return;
@@ -1016,8 +1020,8 @@
         return;
     }
 
-    ScriptElement* scriptElement = toScriptElementIfPossible(element);
-    if (!scriptElement) {
+    ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element);
+    if (!scriptLoader) {
         popCurrentNode();
         return;
     }
@@ -1026,22 +1030,23 @@
     ASSERT(!m_pendingScript);
     m_requestingScript = true;
 
-    if (scriptElement->prepareScript(m_scriptStartPosition, ScriptElement::AllowLegacyTypeInTypeAttribute)) {
+    if (scriptLoader->prepareScript(m_scriptStartPosition, ScriptLoader::AllowLegacyTypeInTypeAttribute)) {
         // FIXME: Script execution should be shared between
         // the libxml2 and Qt XMLDocumentParser implementations.
 
-        if (scriptElement->readyToBeParserExecuted())
-            scriptElement->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStartPosition));
-        else if (scriptElement->willBeParserExecuted()) {
-            m_pendingScript = scriptElement->cachedScript();
+        if (scriptLoader->readyToBeParserExecuted()) {
+            scriptLoader->executeScript(ScriptSourceCode(scriptLoader->scriptContent(), document()->url(), m_scriptStartPosition));
+        } else if (scriptLoader->willBeParserExecuted()) {
+            m_pendingScript = scriptLoader->cachedScript();
             m_scriptElement = element;
             m_pendingScript->addClient(this);
 
             // m_pendingScript will be 0 if script was already loaded and addClient() executed it.
             if (m_pendingScript)
                 pauseParsing();
-        } else
+        } else {
             m_scriptElement = 0;
+        }
 
         // JavaScript may have detached the parser
         if (isDetached())