Merge "Add UI considerations to layers"
diff --git a/Android.mk b/Android.mk
index a5e12d0..551433c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -75,7 +75,6 @@
 LOCAL_C_INCLUDES := \
 	$(JNI_H_INCLUDE) \
 	$(LOCAL_PATH)/WebKit/android/icu \
-	bionic/ \
 	external/ \
 	external/icu4c/common \
 	external/icu4c/i18n \
@@ -210,7 +209,6 @@
 LOCAL_CFLAGS += -fno-strict-aliasing
 LOCAL_CFLAGS += -include "WebCorePrefix.h"
 LOCAL_CFLAGS += -fvisibility=hidden
-LOCAL_CFLAGS += -D__SGI_STL_INTERNAL_PAIR_H
 
 # Enable JSC JIT if JSC is used and ENABLE_ANDROID_JSC_JIT environment
 # variable is set to true
@@ -264,9 +262,8 @@
 
 # We have to use the android version of libdl when we are not on the simulator
 ifneq ($(TARGET_SIMULATOR),true)
-LOCAL_SHARED_LIBRARIES += libdl
-LOCAL_C_INCLUDES += \
-	external/stlport
+LOCAL_SHARED_LIBRARIES += libdl libstlport
+include external/stlport/libstlport.mk
 endif
 
 # Build the list of static libraries
diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk
index 8a24d27..062ef93 100644
--- a/WebCore/Android.derived.v8bindings.mk
+++ b/WebCore/Android.derived.v8bindings.mk
@@ -541,7 +541,8 @@
     $(intermediates)/bindings/V8XMLHttpRequestUpload.h \
     $(intermediates)/bindings/V8XMLSerializer.h \
     $(intermediates)/bindings/V8XPathException.h \
-    $(intermediates)/bindings/V8XPathNSResolver.h
+    $(intermediates)/bindings/V8XPathNSResolver.h \
+    $(intermediates)/bindings/V8XPathResult.h
 
 $(GEN): PRIVATE_PATH := $(LOCAL_PATH)
 $(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
diff --git a/WebCore/bindings/v8/ChildThreadDOMData.h b/WebCore/bindings/v8/ChildThreadDOMData.h
index dfb85e8..5097c86 100644
--- a/WebCore/bindings/v8/ChildThreadDOMData.h
+++ b/WebCore/bindings/v8/ChildThreadDOMData.h
@@ -39,7 +39,6 @@
     class ChildThreadDOMData : public DOMData {
     public:
         ChildThreadDOMData();
-
         DOMDataStore& getStore();
 
     private:
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index 1fe10b2..53ceea1 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -42,6 +42,12 @@
 #include "npruntime_impl.h"
 #include "npruntime_priv.h"
 
+#if PLATFORM(CHROMIUM)
+#include <bindings/npruntime.h>
+#else
+#include "npruntime.h"
+#endif
+
 #include <stdio.h>
 #include <v8.h>
 #include <wtf/StringExtras.h>
diff --git a/WebCore/bindings/v8/NPV8Object.h b/WebCore/bindings/v8/NPV8Object.h
index b9b376e..e5550ee 100644
--- a/WebCore/bindings/v8/NPV8Object.h
+++ b/WebCore/bindings/v8/NPV8Object.h
@@ -31,15 +31,17 @@
 #define NPV8Object_h
 
 #include "V8Index.h"
+
 #if PLATFORM(CHROMIUM)
 // FIXME: Chromium uses a different npruntime.h, which is in
 // the Chromium source repository under third_party/npapi/bindings.
 // The Google-specific changes in that file should probably be
 // moved into bridge/npruntime.h, guarded by an #if PlATFORM(CHROMIUM).
-#include "bindings/npruntime.h"
+#include <bindings/npruntime.h>
 #else
-#include "bridge/npruntime.h"  // Use WebCore version for Android and other ports.
+#include "npruntime.h" // Use WebCore version for Android and other ports.
 #endif
+
 #include <v8.h>
 
 namespace WebCore {
diff --git a/WebCore/bindings/v8/V8NPObject.h b/WebCore/bindings/v8/V8NPObject.h
index 58ad579..5924b3c 100644
--- a/WebCore/bindings/v8/V8NPObject.h
+++ b/WebCore/bindings/v8/V8NPObject.h
@@ -31,14 +31,14 @@
 #ifndef V8NPObject_h
 #define V8NPObject_h
 
-#include <v8.h>
 #if PLATFORM(CHROMIUM)
-// TODO(andreip): diff and consolidate.
-#include "third_party/npapi/bindings/npruntime.h"
+#include <bindings/npruntime.h>
 #else
-#include "bridge/npruntime.h"  // use WebCore version
+#include "npruntime.h"
 #endif
 
+#include <v8.h>
+
 // These functions can be replaced by normal JS operation.
 // Getters
 v8::Handle<v8::Value> npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo&);
diff --git a/WebCore/bindings/v8/V8NPUtils.h b/WebCore/bindings/v8/V8NPUtils.h
index ffd612f..c978d2b 100644
--- a/WebCore/bindings/v8/V8NPUtils.h
+++ b/WebCore/bindings/v8/V8NPUtils.h
@@ -30,14 +30,14 @@
 #ifndef V8NPUtils_h
 #define V8NPUtils_h
 
-#include <v8.h>
 #if PLATFORM(CHROMIUM)
-// TODO(andreip): diff and consolidate.
-#include "third_party/npapi/bindings/npruntime.h"
+#include <bindings/npruntime.h>
 #else
-#include "bridge/npruntime.h"  // use WebCore version
+#include "npruntime.h"
 #endif
 
+#include <v8.h>
+
 // Convert a V8 Value of any type (string, bool, object, etc) to a NPVariant.
 void convertV8ObjectToNPVariant(v8::Local<v8::Value>, NPObject*, NPVariant*);
 
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 6e2d8b2..9b1fff5 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -39,6 +39,7 @@
 #include "InspectorTimelineAgent.h"
 #include "Page.h"
 #include "PageGroup.h"
+#include "PlatformBridge.h"
 #include "ScriptController.h"
 #include "StorageNamespace.h"
 #include "V8Binding.h"
@@ -69,10 +70,6 @@
 #include <wtf/StringExtras.h>
 #include <wtf/UnusedParam.h>
 
-#if PLATFORM(CHROMIUM)
-#include "ChromiumBridge.h"
-#endif
-
 #ifdef ANDROID_INSTRUMENT
 #include "TimeCounter.h"
 #endif
@@ -281,8 +278,7 @@
     }
 
 #if PLATFORM(CHROMIUM)
-    // TODO (andreip): ChromeBridge -> BrowserBridge?
-    ChromiumBridge::notifyJSOutOfMemory(frame);
+    PlatformBridge::notifyJSOutOfMemory(frame);
 #endif
 
     // Disable JS.
@@ -381,34 +377,31 @@
         // Compile the script.
         v8::Local<v8::String> code = v8ExternalString(source.source());
 #if PLATFORM(CHROMIUM)
-        // TODO(andreip): ChromeBridge->BrowserBridge?
-        ChromiumBridge::traceEventBegin("v8.compile", node, "");
+        PlatformBridge::traceEventBegin("v8.compile", node, "");
 #endif
 
         // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
         // 1, whereas v8 starts at 0.
         v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1);
 #if PLATFORM(CHROMIUM)
-        // TODO(andreip): ChromeBridge->BrowserBridge?
-        ChromiumBridge::traceEventEnd("v8.compile", node, "");
+        PlatformBridge::traceEventEnd("v8.compile", node, "");
 
-        ChromiumBridge::traceEventBegin("v8.run", node, "");
+        PlatformBridge::traceEventBegin("v8.run", node, "");
 #endif
         // Set inlineCode to true for <a href="javascript:doSomething()">
         // and false for <script>doSomething</script>. We make a rough guess at
         // this based on whether the script source has a URL.
         result = runScript(script, source.url().string().isNull());
     }
+#if PLATFORM(CHROMIUM)
+    PlatformBridge::traceEventEnd("v8.run", node, "");
+#endif
 
 #if ENABLE(INSPECTOR)
     if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
         timelineAgent->didEvaluateScript();
 #endif
 
-#if PLATFORM(CHROMIUM)
-    // TODO(andreip): upstream CHROMIUM guards to webkit.org
-    ChromiumBridge::traceEventEnd("v8.run", node, "");
-#endif
     return result;
 }
 
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 9aba723..44ed506 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -31,6 +31,7 @@
 #ifndef V8Proxy_h
 #define V8Proxy_h
 
+#include "PlatformBridge.h"
 #include "ScriptSourceCode.h" // for WebCore::ScriptSourceCode
 #include "SecurityOrigin.h" // for WebCore::SecurityOrigin
 #include "SharedPersistent.h"
@@ -44,8 +45,7 @@
 #include <wtf/Vector.h>
 
 #if defined(ENABLE_DOM_STATS_COUNTERS) && PLATFORM(CHROMIUM)
-#include "ChromiumBridge.h"
-#define INC_STATS(name) ChromiumBridge::incrementStatsCounter(name)
+#define INC_STATS(name) PlatformBridge::incrementStatsCounter(name)
 #else
 #define INC_STATS(name)
 #endif
diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
index 9d6296f..8968707 100644
--- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
@@ -48,20 +48,13 @@
 #include "V8Proxy.h"
 #include "V8SVGDocument.h"
 #include "V8WebGLRenderingContext.h"
-
-// ANDROID
-// TODO: Upstream to webkit.org
-#if ENABLE(XPATH)
 #include "V8XPathNSResolver.h"
 #include "V8XPathResult.h"
-#endif
 
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
-// ANDROID
-// TODO: Upstream to webkit.org
 #if ENABLE(XPATH)
 v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args)
 {
diff --git a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
index 863ce0e..ae330fb 100644
--- a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
@@ -31,12 +31,12 @@
 #include "config.h"
 #include "V8Navigator.h"
 
-#include "ExceptionCode.h"
 #include "RuntimeEnabledFeatures.h"
 #include "V8DOMWindow.h"
 #include "V8DOMWrapper.h"
 
 #if PLATFORM(ANDROID)
+#include "ExceptionCode.h"
 #include "V8CustomApplicationInstalledCallback.h"
 #include "V8Proxy.h"
 #endif
diff --git a/WebCore/bindings/v8/npruntime_impl.h b/WebCore/bindings/v8/npruntime_impl.h
index 4c43fb4..d2377eb 100644
--- a/WebCore/bindings/v8/npruntime_impl.h
+++ b/WebCore/bindings/v8/npruntime_impl.h
@@ -32,10 +32,9 @@
 #define npruntime_impl_h
 
 #if PLATFORM(CHROMIUM)
-// TODO(andreip): diff and consolidate
-#include "bindings/npruntime.h"
+#include <bindings/npruntime.h>
 #else
-#include "bridge/npruntime.h"  // use WebCore version
+#include "npruntime.h"
 #endif
 
 // This file exists to support WebCore, which expects to be able to call upon
diff --git a/WebCore/bindings/v8/npruntime_priv.h b/WebCore/bindings/v8/npruntime_priv.h
index 1fb326a..e5ac0e0 100644
--- a/WebCore/bindings/v8/npruntime_priv.h
+++ b/WebCore/bindings/v8/npruntime_priv.h
@@ -27,11 +27,9 @@
 #define npruntime_priv_h
 
 #if PLATFORM(CHROMIUM)
-// TODO(andreip): look at the diff between the two npruntime.h files
-// and try to consolidate them.
-#include "third_party/npapi/bindings/npruntime.h"
+#include <bindings/npruntime.h>
 #else
-#include "bridge/npruntime.h"
+#include "npruntime.h"
 #endif
 
 #ifdef __cplusplus