OSDN Git Service

Fix a WebCore/WebKit layering violation
authorBen Murdoch <benm@google.com>
Fri, 8 Oct 2010 13:43:10 +0000 (14:43 +0100)
committerBen Murdoch <benm@google.com>
Fri, 8 Oct 2010 15:10:55 +0000 (16:10 +0100)
Move the call to WebViewCore::updateViewport() from HTMLBodyElement
and HTMLMetaElement to the PlatformBridge so that WebCore code does
not depend on WebKit code to compile.

In addition to being a layering violation, the inclusion of
WebViewCore.h includes WebCoreJni.h, which in a future change
causes LOG to get #undefined when using the chromium net stack.

Change-Id: I1a9fd0b545080c9c0d9d26a3e5eb3b986c3986eb

WebCore/html/HTMLBodyElement.cpp
WebCore/html/HTMLMetaElement.cpp
WebCore/platform/android/PlatformBridge.h
WebKit/android/WebCoreSupport/PlatformBridge.cpp

index 05c13ac..60126f7 100644 (file)
@@ -36,8 +36,8 @@
 #include "ScriptEventListener.h"
 
 #ifdef ANDROID_META_SUPPORT
+#include "PlatformBridge.h"
 #include "Settings.h"
-#include "WebViewCore.h"
 #endif
 
 namespace WebCore {
@@ -208,7 +208,7 @@ void HTMLBodyElement::insertedIntoDocument()
             if (!ownerElement) {
                 FrameView* view = document()->view();
                 if (view)
-                    android::WebViewCore::getWebViewCore(view)->updateViewport();
+                    PlatformBridge::updateViewport(view);
             }
         }
     }
index cdb9950..520b9ae 100644 (file)
@@ -28,8 +28,8 @@
 #include "HTMLNames.h"
 
 #ifdef ANDROID_META_SUPPORT
+#include "PlatformBridge.h"
 #include "Settings.h"
-#include "WebViewCore.h"
 #endif
 
 #if ENABLE(ANDROID_INSTALLABLE_WEB_APPS)
@@ -95,7 +95,7 @@ void HTMLMetaElement::process()
     if (updateViewport && !document()->ownerElement()) {
         FrameView* view = document()->view();
         if (view)
-            android::WebViewCore::getWebViewCore(view)->updateViewport();
+            PlatformBridge::updateViewport(view);
     }
 #else
     if (equalIgnoringCase(name(), "viewport"))
index bdab26c..948847a 100644 (file)
@@ -130,6 +130,9 @@ public:
 
     static int screenDepth();
     static FloatRect screenRect();
+
+    // Update the viewport meta data.
+    static void updateViewport(FrameView*);
 };
 
 }
index d959cf3..9d28a57 100644 (file)
@@ -160,6 +160,12 @@ FloatRect PlatformBridge::screenRect()
     return FloatRect(0.0, 0.0, info.w, info.h);
 }
 
+void PlatformBridge::updateViewport(FrameView* frameView)
+{
+    android::WebViewCore* webViewCore = android::WebViewCore::getWebViewCore(frameView);
+    webViewCore->updateViewport();
+}
+
 }  // namespace WebCore