OSDN Git Service

Remove dependency of WebCore ScreenAndroid on platform API
authorSteve Block <steveblock@google.com>
Fri, 8 Oct 2010 14:24:49 +0000 (15:24 +0100)
committerSteve Block <steveblock@google.com>
Fri, 8 Oct 2010 14:45:11 +0000 (15:45 +0100)
Note that this change forks two WebCore files, but both files are
already forked and are unlikely to be changed upstream by non-Android
contributors. All changes to both files will be upstreamed at a later
date.

Bug: 2439218
Change-Id: I1e56ee12cec17df38a1404ab06c8897c22f2fd19

WebCore/platform/android/PlatformBridge.h
WebCore/platform/android/ScreenAndroid.cpp
WebKit/android/WebCoreSupport/PlatformBridge.cpp

index 1a9c4ca..bdab26c 100644 (file)
 #ifndef PlatformBridge_h
 #define PlatformBridge_h
 
+#include "FloatRect.h"
 #include "KURL.h"
-#include "npapi.h"
 #include "PlatformString.h"
+#include "npapi.h"
 
 #include <wtf/Vector.h>
 
@@ -126,6 +127,9 @@ public:
     // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082
     static bool isWebViewPaused(const FrameView*);
     static String resolveFilePathForContentUri(const String&);
+
+    static int screenDepth();
+    static FloatRect screenRect();
 };
 
 }
index 1912a98..e779da6 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define LOG_TAG "WebCore"
-
 #include "config.h"
 #include "Screen.h"
 
-// This include must come first.
-#undef LOG // FIXME: Still have to do this to get the log to show up
-#include "utils/Log.h"
-
-#include "FloatRect.h"
-#include "Widget.h"
-#include <ui/DisplayInfo.h>
-#include <ui/PixelFormat.h>
-#include <surfaceflinger/SurfaceComposerClient.h>
-#include "ScrollView.h"
-#include "WebCoreViewBridge.h"
+#include "PlatformBridge.h"
 
 namespace WebCore {
 
-int screenDepth(Widget* page)
+int screenDepth(Widget*)
 {
-    android::DisplayInfo info;
-    android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info);
-    return info.pixelFormatInfo.bitsPerPixel;
+    return PlatformBridge::screenDepth();
 }
 
-int screenDepthPerComponent(Widget* page)
+int screenDepthPerComponent(Widget*)
 {
-    android::DisplayInfo info;
-    android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info);
-    return info.pixelFormatInfo.bitsPerPixel;
+    return PlatformBridge::screenDepth();
 }
 
-bool screenIsMonochrome(Widget* page)
+bool screenIsMonochrome(Widget*)
 {
     return false;
 }
 
 // This is used by JavaScript Screen object and media query for device info. We
 // should return the value in the device pixel.
-FloatRect screenRect(Widget* page)
+FloatRect screenRect(Widget*)
 {
-    android::DisplayInfo info;
-    android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info);
-    return FloatRect(0.0, 0.0, info.w, info.h);
+    return PlatformBridge::screenRect();
 }
 
 // Similar as screenRect, this is used by JavaScript Screen object. This is also
 // used by JavaScript Window to position and resize (usually to full screen).
-FloatRect screenAvailableRect(Widget* page)
+FloatRect screenAvailableRect(Widget*)
 {
-    android::DisplayInfo info;
-    android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info);
-    return FloatRect(0.0, 0.0, info.w, info.h);
+    return PlatformBridge::screenRect();
 }
 
 } // namespace WebCore
index 945db00..d959cf3 100644 (file)
 #include "WebRequestContext.h"
 #include "WebViewCore.h"
 #include "npruntime.h"
+
+#include <surfaceflinger/SurfaceComposerClient.h>
+#include <ui/DisplayInfo.h>
+#include <ui/PixelFormat.h>
 #include <wtf/android/AndroidThreading.h>
 #include <wtf/MainThread.h>
 
@@ -48,7 +52,7 @@ WTF::Vector<String> PlatformBridge::getSupportedKeyStrengthList()
 {
     KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient();
     if (!client)
-        return Vector<String>();
+        return WTF::Vector<String>();
 
     return client->getSupportedKeyStrengthList();
 }
@@ -142,6 +146,20 @@ String PlatformBridge::resolveFilePathForContentUri(const String& contentUri)
     return client->resolveFilePathForContentUri(contentUri);
 }
 
+int PlatformBridge::PlatformBridge::screenDepth()
+{
+    android::DisplayInfo info;
+    android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info);
+    return info.pixelFormatInfo.bitsPerPixel;
+}
+
+FloatRect PlatformBridge::screenRect()
+{
+    android::DisplayInfo info;
+    android::SurfaceComposerClient::getDisplayInfo(android::DisplayID(0), &info);
+    return FloatRect(0.0, 0.0, info.w, info.h);
+}
+
 }  // namespace WebCore