diff options
Diffstat (limited to 'WebCore/platform')
35 files changed, 363 insertions, 164 deletions
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h index 6c8629c..5371a40 100644 --- a/WebCore/platform/PlatformTouchEvent.h +++ b/WebCore/platform/PlatformTouchEvent.h @@ -1,67 +1,86 @@ /* - * Copyright 2008, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, 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 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. - */ + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ #ifndef PlatformTouchEvent_h #define PlatformTouchEvent_h -#if ENABLE(TOUCH_EVENTS) // Android +#include "PlatformTouchPoint.h" +#include <wtf/Vector.h> + +#if ENABLE(TOUCH_EVENTS) + +#if PLATFORM(QT) +QT_BEGIN_NAMESPACE +class QTouchEvent; +QT_END_NAMESPACE +#endif +#if PLATFORM(ANDROID) #include "IntPoint.h" +#endif namespace WebCore { - enum TouchEventType {TouchEventStart, TouchEventMove, TouchEventEnd, TouchEventCancel, TouchEventLongPress, TouchEventDoubleTap}; - - class PlatformTouchEvent { - public: - PlatformTouchEvent() - : m_eventType(TouchEventCancel) - { - } - - PlatformTouchEvent(const IntPoint& pos, const IntPoint& globalPos, TouchEventType eventType) - : m_position(pos) - , m_globalPosition(globalPos) - , m_eventType(eventType) - { - } - - const IntPoint& pos() const { return m_position; } - int x() const { return m_position.x(); } - int y() const { return m_position.y(); } - int globalX() const { return m_globalPosition.x(); } - int globalY() const { return m_globalPosition.y(); } - TouchEventType eventType() const { return m_eventType; } - - private: - IntPoint m_position; - IntPoint m_globalPosition; - TouchEventType m_eventType; - }; - -} // namespace WebCore +enum TouchEventType { + TouchStart + , TouchMove + , TouchEnd + , TouchCancel +#if PLATFORM(ANDROID) + , TouchLongPress + , TouchDoubleTap +#endif +}; + +class PlatformTouchEvent { +public: + PlatformTouchEvent() + : m_type(TouchStart) + , m_ctrlKey(false) + , m_altKey(false) + , m_shiftKey(false) + , m_metaKey(false) + {} +#if PLATFORM(QT) + PlatformTouchEvent(QTouchEvent*); +#elif PLATFORM(ANDROID) + PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType, PlatformTouchPoint::State); +#endif + + TouchEventType type() const { return m_type; } + const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; } + + bool ctrlKey() const { return m_ctrlKey; } + bool altKey() const { return m_altKey; } + bool shiftKey() const { return m_shiftKey; } + bool metaKey() const { return m_metaKey; } + +private: + TouchEventType m_type; + Vector<PlatformTouchPoint> m_touchPoints; + bool m_ctrlKey; + bool m_altKey; + bool m_shiftKey; + bool m_metaKey; +}; + +} #endif // ENABLE(TOUCH_EVENTS) diff --git a/WebCore/platform/PlatformTouchPoint.h b/WebCore/platform/PlatformTouchPoint.h new file mode 100644 index 0000000..53bd8ae --- /dev/null +++ b/WebCore/platform/PlatformTouchPoint.h @@ -0,0 +1,69 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef PlatformTouchPoint_h +#define PlatformTouchPoint_h + +#include "IntPoint.h" +#include <wtf/Platform.h> +#include <wtf/Vector.h> + +#if ENABLE(TOUCH_EVENTS) + +#if PLATFORM(QT) +#include <QTouchEvent> +#endif + +namespace WebCore { + +class PlatformTouchEvent; + +class PlatformTouchPoint { +public: + enum State { + TouchReleased, + TouchPressed, + TouchMoved, + TouchStationary, + TouchCancelled + }; + +#if PLATFORM(QT) + PlatformTouchPoint(const QTouchEvent::TouchPoint&); +#elif PLATFORM(ANDROID) + PlatformTouchPoint(const IntPoint& absolutePagePos, State); +#endif + + int id() const { return m_id; } + State state() const { return m_state; } + IntPoint screenPos() const { return m_screenPos; } + IntPoint pos() const { return m_pos; } + +private: + int m_id; + State m_state; + IntPoint m_screenPos; + IntPoint m_pos; +}; + +} + +#endif // ENABLE(TOUCH_EVENTS) + +#endif // PlatformTouchPoint_h diff --git a/WebCore/platform/Timer.cpp b/WebCore/platform/Timer.cpp index 4804540..ea3effd 100644 --- a/WebCore/platform/Timer.cpp +++ b/WebCore/platform/Timer.cpp @@ -37,11 +37,6 @@ #include <wtf/HashSet.h> #include <wtf/Vector.h> -#if PLATFORM(ANDROID) -#include "stl_iterator_base.h" -#include "heap.h" -#endif - using namespace std; namespace WebCore { diff --git a/WebCore/platform/android/GeolocationServiceAndroid.cpp b/WebCore/platform/android/GeolocationServiceAndroid.cpp index 43a8f5f..3ffb9b9 100644 --- a/WebCore/platform/android/GeolocationServiceAndroid.cpp +++ b/WebCore/platform/android/GeolocationServiceAndroid.cpp @@ -28,6 +28,7 @@ #include "GeolocationServiceBridge.h" #include "Geoposition.h" +#include "PlatformBridge.h" #include "PositionError.h" #include "PositionOptions.h" @@ -83,8 +84,13 @@ bool GeolocationServiceAndroid::startUpdating(PositionOptions* options) if (options->enableHighAccuracy()) m_javaBridge->setEnableGps(true); - if (!haveJavaBridge) - m_javaBridge->start(); + // We need only start the service when it's first created. + if (!haveJavaBridge) { + // If the browser is paused, don't start the service. It will be started + // when we get the call to resume. + if (!PlatformBridge::isWebViewPaused()) + m_javaBridge->start(); + } return true; } diff --git a/WebCore/platform/android/GeolocationServiceBridge.cpp b/WebCore/platform/android/GeolocationServiceBridge.cpp index c8ba85d..a30d2e6 100644 --- a/WebCore/platform/android/GeolocationServiceBridge.cpp +++ b/WebCore/platform/android/GeolocationServiceBridge.cpp @@ -31,7 +31,6 @@ #include "PositionError.h" #include "WebViewCore.h" #include <JNIHelp.h> -#include <jni_utility.h> namespace WebCore { diff --git a/WebCore/platform/android/GeolocationServiceBridge.h b/WebCore/platform/android/GeolocationServiceBridge.h index 0a83ba7..6cf9ead 100644 --- a/WebCore/platform/android/GeolocationServiceBridge.h +++ b/WebCore/platform/android/GeolocationServiceBridge.h @@ -26,7 +26,7 @@ #ifndef GeolocationServiceBridge_h #define GeolocationServiceBridge_h -#include <jni_utility.h> +#include "JNIUtility.h" #include <wtf/PassRefPtr.h> namespace WebCore { diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index 9adb314..cf9f561 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -27,13 +27,62 @@ #define PlatformBridge_h #include "KURL.h" +#include "npapi.h" #include "PlatformString.h" #include <wtf/Vector.h> +// V8 bindings use the ARRAYSIZE_UNSAFE macro. This macro was copied +// from http://src.chromium.org/viewvc/chrome/trunk/src/base/basictypes.h +// +// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize, +// but can be used on anonymous types or types defined inside +// functions. It's less safe than arraysize as it accepts some +// (although not all) pointers. Therefore, you should use arraysize +// whenever possible. +// +// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type +// size_t. +// +// ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error +// +// "warning: division by zero in ..." +// +// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer. +// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays. +// +// The following comments are on the implementation details, and can +// be ignored by the users. +// +// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in +// the array) and sizeof(*(arr)) (the # of bytes in one array +// element). If the former is divisible by the latter, perhaps arr is +// indeed an array, in which case the division result is the # of +// elements in the array. Otherwise, arr cannot possibly be an array, +// and we generate a compiler error to prevent the code from +// compiling. +// +// Since the size of bool is implementation-defined, we need to cast +// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final +// result has type size_t. +// +// This macro is not perfect as it wrongfully accepts certain +// pointers, namely where the pointer size is divisible by the pointee +// size. Since all our code has to go through a 32-bit compiler, +// where a pointer is 4 bytes, this means all pointers to a type whose +// size is 3 or greater than 4 will be (righteously) rejected. + +#define ARRAYSIZE_UNSAFE(a) \ + ((sizeof(a) / sizeof(*(a))) / \ + static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) + + +class NPObject; + namespace WebCore { class FrameView; +class Widget; // An interface to the embedding layer, which has the ability to answer // questions about the system and so on... @@ -50,6 +99,15 @@ public: // KeyGenerator static WTF::Vector<String> getSupportedKeyStrengthList(); static String getSignedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL&); + // Cookies + static void setCookies(const KURL&, const String& value); + static String cookies(const KURL&); + static bool cookiesEnabled(); + // Plugin + static NPObject* pluginScriptableObject(Widget*); + // Popups + static bool popupsAllowed(NPP); + // These ids need to be in sync with the constants in BrowserFrame.java enum rawResId { NoDomain = 1, @@ -67,6 +125,9 @@ public: static void immediateRepaint(const FrameView* view); #endif // USE(ACCELERATED_COMPOSITING) + // Whether the WebView is paused. + static bool isWebViewPaused(); }; + } #endif // PlatformBridge_h diff --git a/WebCore/platform/network/android/Cookie.cpp b/WebCore/platform/android/PlatformTouchEventAndroid.cpp index 3d10e4a..e4af8a3 100644 --- a/WebCore/platform/network/android/Cookie.cpp +++ b/WebCore/platform/android/PlatformTouchEventAndroid.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2007, The Android Open Source Project + * Copyright 2010, The Android Open Source Project * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,34 +24,22 @@ */ #include "config.h" +#include "PlatformTouchEvent.h" -#include "CookieClient.h" -#include "JavaSharedClient.h" - -using namespace android; +#if ENABLE(TOUCH_EVENTS) namespace WebCore { -class Document; - -void setCookies(Document*, const KURL& url, const String& value) +PlatformTouchEvent::PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType type, PlatformTouchPoint::State state) + : m_type(type) + , m_ctrlKey(false) + , m_altKey(false) + , m_shiftKey(false) + , m_metaKey(false) { - if (JavaSharedClient::GetCookieClient()) - JavaSharedClient::GetCookieClient()->setCookies(url, value); + m_touchPoints.append(PlatformTouchPoint(absolutePagePos, state)); } -String cookies(const Document* , const KURL& url) -{ - if (JavaSharedClient::GetCookieClient()) - return JavaSharedClient::GetCookieClient()->cookies(url); - return String(); } -bool cookiesEnabled(const Document* ) -{ - if (JavaSharedClient::GetCookieClient()) - return JavaSharedClient::GetCookieClient()->cookiesEnabled(); - return false; -} - -} +#endif diff --git a/WebCore/platform/android/PlatformTouchPointAndroid.cpp b/WebCore/platform/android/PlatformTouchPointAndroid.cpp new file mode 100644 index 0000000..d790855 --- /dev/null +++ b/WebCore/platform/android/PlatformTouchPointAndroid.cpp @@ -0,0 +1,41 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, 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 "PlatformTouchPoint.h" + +#if ENABLE(TOUCH_EVENTS) + +namespace WebCore { + +PlatformTouchPoint::PlatformTouchPoint(const IntPoint& absolutePagePos, State state) + : m_id(0) + , m_state(state) + , m_screenPos(absolutePagePos) + , m_pos(absolutePagePos) { } + +} + +#endif diff --git a/WebCore/platform/android/TemporaryLinkStubs.cpp b/WebCore/platform/android/TemporaryLinkStubs.cpp index fb9293c..9741ad5 100644 --- a/WebCore/platform/android/TemporaryLinkStubs.cpp +++ b/WebCore/platform/android/TemporaryLinkStubs.cpp @@ -81,10 +81,10 @@ #if USE(JSC) #include "API/JSClassRef.h" +#include "JNIUtilityPrivate.h" #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" #include "JavaScriptProfile.h" -#include "jni_utility_private.h" #endif using namespace WebCore; diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h index a07daf2..0031df6 100644 --- a/WebCore/platform/graphics/BitmapImage.h +++ b/WebCore/platform/graphics/BitmapImage.h @@ -148,7 +148,7 @@ public: virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE); #endif -#if PLATFORM(SGL) +#if PLATFORM(ANDROID) virtual void setURL(const String& str); #endif diff --git a/WebCore/platform/graphics/FloatPoint.h b/WebCore/platform/graphics/FloatPoint.h index 7d32bcf..45a1e83 100644 --- a/WebCore/platform/graphics/FloatPoint.h +++ b/WebCore/platform/graphics/FloatPoint.h @@ -100,7 +100,7 @@ public: operator BPoint() const; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) operator SkPoint() const; FloatPoint(const SkPoint&); #endif diff --git a/WebCore/platform/graphics/FloatRect.h b/WebCore/platform/graphics/FloatRect.h index 4b4694f..2dc854d 100644 --- a/WebCore/platform/graphics/FloatRect.h +++ b/WebCore/platform/graphics/FloatRect.h @@ -55,7 +55,7 @@ class wxRect2DDouble; class BRect; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) struct SkRect; #endif @@ -149,7 +149,7 @@ public: operator BRect() const; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) FloatRect(const SkRect&); operator SkRect() const; #endif diff --git a/WebCore/platform/graphics/Gradient.cpp b/WebCore/platform/graphics/Gradient.cpp index 77a0d21..204a2b6 100644 --- a/WebCore/platform/graphics/Gradient.cpp +++ b/WebCore/platform/graphics/Gradient.cpp @@ -161,7 +161,7 @@ void Gradient::setGradientSpaceTransform(const TransformationMatrix& gradientSpa setPlatformGradientSpaceTransform(gradientSpaceTransformation); } -#if !PLATFORM(SKIA) +#if !(PLATFORM(SKIA) && !PLATFORM(ANDROID)) void Gradient::setPlatformGradientSpaceTransform(const TransformationMatrix&) { } diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h index 7f01251..011a2cd 100644 --- a/WebCore/platform/graphics/Gradient.h +++ b/WebCore/platform/graphics/Gradient.h @@ -46,13 +46,15 @@ typedef QGradient* PlatformGradient; #elif PLATFORM(CAIRO) typedef struct _cairo_pattern cairo_pattern_t; typedef cairo_pattern_t* PlatformGradient; -#elif PLATFORM(ANDROID) && PLATFORM(SGL) +#elif PLATFORM(SKIA) +#if PLATFORM(ANDROID) #include "SkShader.h" typedef class PlatformGradientRec* PlatformGradient; -#elif PLATFORM(SKIA) +#else class SkShader; typedef class SkShader* PlatformGradient; typedef class SkShader* PlatformPattern; +#endif #else typedef void* PlatformGradient; #endif @@ -86,13 +88,11 @@ namespace WebCore { struct ColorStop; const Vector<ColorStop>& getStops() const; #else - -#if PLATFORM(ANDROID) && PLATFORM(SGL) +#if PLATFORM(ANDROID) SkShader* getShader(SkShader::TileMode); #endif PlatformGradient platformGradient(); #endif - struct ColorStop { float stop; float red; diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp index fee05ee..e80004f 100644 --- a/WebCore/platform/graphics/GraphicsContext.cpp +++ b/WebCore/platform/graphics/GraphicsContext.cpp @@ -518,7 +518,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator) generator.fill(this, rect); } -#if !PLATFORM(SKIA) +#if !(PLATFORM(SKIA) && !PLATFORM(ANDROID)) void GraphicsContext::setPlatformFillGradient(Gradient*) { } @@ -536,7 +536,7 @@ void GraphicsContext::setPlatformStrokePattern(Pattern*) } #endif -#if !PLATFORM(CG) && !PLATFORM(SKIA) +#if !PLATFORM(CG) && !(PLATFORM(SKIA) && !PLATFORM(ANDROID)) // Implement this if you want to go ahead and push the drawing mode into your native context // immediately. void GraphicsContext::setPlatformTextDrawingMode(int mode) @@ -544,7 +544,7 @@ void GraphicsContext::setPlatformTextDrawingMode(int mode) } #endif -#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !PLATFORM(SKIA) && !PLATFORM(HAIKU) +#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !(PLATFORM(SKIA) && !PLATFORM(ANDROID)) && !PLATFORM(HAIKU) void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle&) { } diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index 96a6221..ecf2101 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -46,12 +46,6 @@ QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE typedef QPainter PlatformGraphicsContext; -#elif PLATFORM(SGL) -namespace WebCore { -class PlatformGraphicsContext; -} -class SkPaint; -struct SkPoint; #elif PLATFORM(WX) class wxGCDC; class wxWindowDC; @@ -72,7 +66,15 @@ class wxWindowDC; typedef wxWindowDC PlatformGraphicsContext; #endif #elif PLATFORM(SKIA) +#if PLATFORM(ANDROID) +namespace WebCore { +class PlatformGraphicsContext; +} +class SkPaint; +struct SkPoint; +#else typedef class PlatformContextSkia PlatformGraphicsContext; +#endif #elif PLATFORM(HAIKU) class BView; typedef BView PlatformGraphicsContext; @@ -190,7 +192,7 @@ namespace WebCore { void applyFillPattern(); #endif -#if PLATFORM(SGL) +#if PLATFORM(ANDROID) // initialize a paint for bitmaps void setupBitmapPaint(SkPaint*); // initialize a paint for filling @@ -204,7 +206,7 @@ namespace WebCore { bool willFill() const; // returns true if there is a valid (non-transparent) stroke color bool willStroke() const; - + // may return NULL, since we lazily allocate the path. This is the path // that is drawn by drawPath() const SkPath* getCurrPath() const; diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h index aef6577..f25169b 100644 --- a/WebCore/platform/graphics/Image.h +++ b/WebCore/platform/graphics/Image.h @@ -148,7 +148,7 @@ public: virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE) { return false; } #endif -#if PLATFORM(SGL) +#if PLATFORM(ANDROID) virtual void setURL(const String& str) {} #endif diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h index 19c7bf7..083c7b0 100644 --- a/WebCore/platform/graphics/ImageSource.h +++ b/WebCore/platform/graphics/ImageSource.h @@ -45,12 +45,14 @@ QT_END_NAMESPACE #elif PLATFORM(CAIRO) struct _cairo_surface; typedef struct _cairo_surface cairo_surface_t; -#elif PLATFORM(ANDROID) && PLATFORM(SGL) +#elif PLATFORM(SKIA) +#if PLATFORM(ANDROID) #include "SkString.h" class SkBitmapRef; class PrivateAndroidImageSourceRec; -#elif PLATFORM(SKIA) +#else class NativeImageSkia; +#endif #elif PLATFORM(HAIKU) class BBitmap; #elif PLATFORM(WINCE) @@ -70,14 +72,14 @@ typedef CGImageRef NativeImagePtr; class ImageDecoderQt; typedef ImageDecoderQt* NativeImageSourcePtr; typedef QPixmap* NativeImagePtr; -#elif PLATFORM(ANDROID) -#if PLATFORM(SGL) +#elif PLATFORM(SKIA) +#if PLATFORM(ANDROID) class String; #ifdef ANDROID_ANIMATED_GIF class ImageDecoder; #endif struct NativeImageSourcePtr { - SkString m_url; + SkString m_url; PrivateAndroidImageSourceRec* m_image; #ifdef ANDROID_ANIMATED_GIF ImageDecoder* m_gifDecoder; @@ -85,7 +87,7 @@ struct NativeImageSourcePtr { }; typedef const Vector<char>* NativeBytePtr; typedef SkBitmapRef* NativeImagePtr; -#elif PLATFORM(SKIA) // ANDROID +#else class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; typedef NativeImageSkia* NativeImagePtr; @@ -101,8 +103,6 @@ typedef wxBitmap* NativeImagePtr; #endif #elif PLATFORM(CAIRO) typedef cairo_surface_t* NativeImagePtr; -#elif PLATFORM(SKIA) -typedef NativeImageSkia* NativeImagePtr; #elif PLATFORM(HAIKU) typedef BBitmap* NativeImagePtr; #elif PLATFORM(WINCE) @@ -166,11 +166,9 @@ public: bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded. #if PLATFORM(ANDROID) -#if PLATFORM(SGL) void clearURL(); void setURL(const String& url); #endif -#endif private: #if PLATFORM(ANDROID) // FIXME: This is protected only to allow ImageSourceSkia to set ICO decoder diff --git a/WebCore/platform/graphics/IntPoint.h b/WebCore/platform/graphics/IntPoint.h index afbfb46..ab5f3ec 100644 --- a/WebCore/platform/graphics/IntPoint.h +++ b/WebCore/platform/graphics/IntPoint.h @@ -63,7 +63,7 @@ class BPoint; class wxPoint; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) struct SkPoint; struct SkIPoint; #endif @@ -133,7 +133,7 @@ public: operator wxPoint() const; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) IntPoint(const SkIPoint&); operator SkIPoint() const; operator SkPoint() const; diff --git a/WebCore/platform/graphics/IntRect.h b/WebCore/platform/graphics/IntRect.h index cd912ff..97b21bc 100644 --- a/WebCore/platform/graphics/IntRect.h +++ b/WebCore/platform/graphics/IntRect.h @@ -57,7 +57,7 @@ class BRect; class wxRect; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) struct SkRect; struct SkIRect; #endif @@ -155,7 +155,7 @@ public: operator CGRect() const; #endif -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) IntRect(const SkIRect&); operator SkRect() const; operator SkIRect() const; diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h index fef5ad2..6618fb7 100644 --- a/WebCore/platform/graphics/Path.h +++ b/WebCore/platform/graphics/Path.h @@ -39,9 +39,6 @@ QT_BEGIN_NAMESPACE class QPainterPath; QT_END_NAMESPACE typedef QPainterPath PlatformPath; -#elif PLATFORM(SGL) -class SkPath; -typedef SkPath PlatformPath; #elif PLATFORM(WX) && USE(WXGC) class wxGraphicsPath; typedef wxGraphicsPath PlatformPath; diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h index 2f1192c..aa0a357 100644 --- a/WebCore/platform/graphics/Pattern.h +++ b/WebCore/platform/graphics/Pattern.h @@ -39,7 +39,7 @@ typedef CGPatternRef PlatformPatternPtr; #elif PLATFORM(CAIRO) #include <cairo.h> typedef cairo_pattern_t* PlatformPatternPtr; -#elif PLATFORM(SKIA) || PLATFORM(SGL) +#elif PLATFORM(SKIA) class SkShader; typedef SkShader* PlatformPatternPtr; #elif PLATFORM(QT) diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 6901f52..fa012b0 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -337,6 +337,7 @@ void GraphicsLayerAndroid::setOpacity(float opacity) MLOG("(%x) setFinalOpacity: %.2f=>%.2f (%.2f)", this, opacity, clampedOpacity, m_opacity); GraphicsLayer::setOpacity(clampedOpacity); + m_contentLayer->setOpacity(clampedOpacity); askForSync(); } diff --git a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h index 29ef11c..19bfcd1 100644 --- a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h +++ b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h @@ -89,6 +89,7 @@ public: void onPrepared(int duration, int width, int height); void onEnded(); void onPosterFetched(SkBitmap*); + void onTimeupdate(int position); private: // Android-specific methods and fields. static MediaPlayerPrivateInterface* create(MediaPlayer* player); @@ -107,6 +108,7 @@ private: float m_currentTime; bool m_paused; + bool m_hasVideo; MediaPlayer::ReadyState m_readyState; MediaPlayer::NetworkState m_networkState; diff --git a/WebCore/platform/graphics/skia/NativeImageSkia.cpp b/WebCore/platform/graphics/skia/NativeImageSkia.cpp index 477be05..2411897 100644 --- a/WebCore/platform/graphics/skia/NativeImageSkia.cpp +++ b/WebCore/platform/graphics/skia/NativeImageSkia.cpp @@ -30,7 +30,7 @@ #include "config.h" -#if PLATFORM(SKIA) +#if !PLATFORM(ANDROID) #include "skia/ext/image_operations.h" #endif @@ -65,10 +65,11 @@ bool NativeImageSkia::hasResizedBitmap(int w, int h) const SkBitmap NativeImageSkia::resizedBitmap(int w, int h) const { -#if PLATFORM(SKIA) +#if !PLATFORM(ANDROID) if (m_resizedImage.width() != w || m_resizedImage.height() != h) m_resizedImage = skia::ImageOperations::Resize(*this, skia::ImageOperations::RESIZE_LANCZOS3, w, h); #endif + return m_resizedImage; } diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.h b/WebCore/platform/graphics/transforms/TransformationMatrix.h index 33f9afe..802ad3c 100644 --- a/WebCore/platform/graphics/transforms/TransformationMatrix.h +++ b/WebCore/platform/graphics/transforms/TransformationMatrix.h @@ -37,7 +37,7 @@ #include <cairo.h> #elif PLATFORM(QT) #include <QTransform> -#elif PLATFORM(SKIA) || PLATFORM(SGL) +#elif PLATFORM(SKIA) #include <SkMatrix.h> #elif PLATFORM(WX) && USE(WXGC) #include <wx/graphics.h> @@ -301,7 +301,7 @@ public: operator cairo_matrix_t() const; #elif PLATFORM(QT) operator QTransform() const; -#elif PLATFORM(SKIA) || PLATFORM(SGL) +#elif PLATFORM(SKIA) operator SkMatrix() const; #elif PLATFORM(WX) && USE(WXGC) operator wxGraphicsMatrix() const; diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index 08f4aa2..535efa1 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -36,8 +36,7 @@ #include <wtf/RefPtr.h> #include <wtf/Vector.h> -#if (PLATFORM(SKIA) || PLATFORM(SGL)) -// TODO(benm): ANDROID: Can we define PLATFORM(SKIA) instead of PLATFORM(SGL) before upstreaming? +#if PLATFORM(SKIA) #include "NativeImageSkia.h" #elif PLATFORM(QT) #include <QImage> @@ -58,7 +57,7 @@ namespace WebCore { DisposeOverwriteBgcolor, // Clear frame to transparent DisposeOverwritePrevious, // Clear frame to previous framebuffer contents }; -#if (PLATFORM(SKIA) || PLATFORM(QT) || PLATFORM(SGL)) +#if PLATFORM(SKIA) || PLATFORM(QT) typedef uint32_t PixelData; #else typedef unsigned PixelData; @@ -102,7 +101,7 @@ namespace WebCore { memcpy(getAddr(startX, destY), startAddr, rowBytes); } -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(ANDROID) NativeImageSkia& bitmap() { return m_bitmap; } const NativeImageSkia& bitmap() const { return m_bitmap; } #endif @@ -148,7 +147,7 @@ namespace WebCore { inline PixelData* getAddr(int x, int y) { -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) return m_bitmap.getAddr32(x, y); #elif PLATFORM(QT) return reinterpret_cast<QRgb*>(m_image.scanLine(y)) + x; @@ -173,7 +172,7 @@ namespace WebCore { } } -#if (PLATFORM(SKIA) || PLATFORM(SGL)) +#if PLATFORM(SKIA) NativeImageSkia m_bitmap; #elif PLATFORM(QT) mutable QImage m_image; diff --git a/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp b/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp index 6acaed5..96342fa 100644 --- a/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp +++ b/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp @@ -26,8 +26,7 @@ #include "config.h" #include "ImageDecoder.h" - -#if PLATFORM(SGL) +#if PLATFORM(ANDROID) #include "SkBitmapRef.h" #endif @@ -85,7 +84,7 @@ bool RGBA32Buffer::setSize(int newWidth, int newHeight) NativeImagePtr RGBA32Buffer::asNewNativeImage() const { -#if PLATFORM(SGL) +#if PLATFORM(ANDROID) return new SkBitmapRef(m_bitmap); #else return new NativeImageSkia(m_bitmap); diff --git a/WebCore/platform/network/NetworkStateNotifier.h b/WebCore/platform/network/NetworkStateNotifier.h index a630ccd..d0463d4 100644 --- a/WebCore/platform/network/NetworkStateNotifier.h +++ b/WebCore/platform/network/NetworkStateNotifier.h @@ -27,6 +27,9 @@ #define NetworkStateNotifier_h #include <wtf/Noncopyable.h> +#if PLATFORM(ANDROID) +#include "Connection.h" +#endif #if PLATFORM(MAC) @@ -54,9 +57,15 @@ public: void setNetworkStateChangedFunction(void (*)()); bool onLine() const { return m_isOnLine; } +#if PLATFORM(ANDROID) + Connection::ConnectionType type() const { return m_type; } +#endif private: bool m_isOnLine; +#if PLATFORM(ANDROID) + Connection::ConnectionType m_type; +#endif void (*m_networkStateChangedFunction)(); void updateState(); @@ -78,12 +87,13 @@ private: HANDLE m_waitHandle; OVERLAPPED m_overlapped; -#elif PLATFORM(ANDROID) -public: - void networkStateChange(bool online); - #elif PLATFORM(CHROMIUM) NetworkStateNotifierPrivate p; + +#elif PLATFORM(ANDROID) +public: + void networkStateChange(bool online); + void networkTypeChange(Connection::ConnectionType type); #endif }; @@ -91,6 +101,9 @@ public: inline NetworkStateNotifier::NetworkStateNotifier() : m_isOnLine(true) +#if PLATFORM(ANDROID) + , m_type(Connection::Unknown) +#endif , m_networkStateChangedFunction(0) { } diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h index e7f6092..b764add 100644 --- a/WebCore/platform/network/ResourceHandle.h +++ b/WebCore/platform/network/ResourceHandle.h @@ -170,7 +170,7 @@ public: friend LRESULT __stdcall ResourceHandleWndProc(HWND, unsigned message, WPARAM, LPARAM); #endif -#if PLATFORM(QT) || USE(CURL) || USE(SOUP) || defined(ANDROID) +#if PLATFORM(QT) || USE(CURL) || USE(SOUP) || PLATFORM(ANDROID) ResourceHandleInternal* getInternal() { return d.get(); } #endif diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h index f7135ee..328fc89 100644 --- a/WebCore/platform/network/ResourceHandleInternal.h +++ b/WebCore/platform/network/ResourceHandleInternal.h @@ -133,9 +133,6 @@ namespace WebCore { , m_needsSiteSpecificQuirks(false) , m_currentMacChallenge(nil) #endif -#if PLATFORM(ANDROID) - , m_loader(0) -#endif , m_failureTimer(loader, &ResourceHandle::fireFailure) { const KURL& url = m_request.url(); diff --git a/WebCore/platform/network/android/AuthenticationChallenge.h b/WebCore/platform/network/android/AuthenticationChallenge.h index e272d60..954bfd8 100644 --- a/WebCore/platform/network/android/AuthenticationChallenge.h +++ b/WebCore/platform/network/android/AuthenticationChallenge.h @@ -31,8 +31,6 @@ namespace WebCore { -class ResourceHandle; - class AuthenticationChallenge : public AuthenticationChallengeBase { }; diff --git a/WebCore/platform/network/android/CookieClient.h b/WebCore/platform/network/android/CookieJarAndroid.cpp index be2963e..ba4b5dc 100644 --- a/WebCore/platform/network/android/CookieClient.h +++ b/WebCore/platform/network/android/CookieJarAndroid.cpp @@ -23,24 +23,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef COOKIE_CLIENT_H -#define COOKIE_CLIENT_H +#include "config.h" -#include "KURL.h" -#include "PlatformString.h" +#include "CookieJar.h" -using namespace WebCore; +#include "PlatformBridge.h" -namespace android { +namespace WebCore { -class CookieClient { +void setCookies(Document*, const KURL& url, const String& value) +{ + PlatformBridge::setCookies(url, value); +} + +String cookies(const Document*, const KURL& url) +{ + return PlatformBridge::cookies(url); +} -public: - virtual ~CookieClient() {} - virtual void setCookies(const KURL& url, const String& value) = 0; - virtual String cookies(const KURL& url) = 0; - virtual bool cookiesEnabled() = 0; -}; +bool cookiesEnabled(const Document*) +{ + return PlatformBridge::cookiesEnabled(); +} } -#endif diff --git a/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp b/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp index 3aa5578..134e206 100644 --- a/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp +++ b/WebCore/platform/network/android/NetworkStateNotifierAndroid.cpp @@ -39,4 +39,15 @@ void NetworkStateNotifier::networkStateChange(bool online) m_networkStateChangedFunction(); } +void NetworkStateNotifier::networkTypeChange(Connection::ConnectionType type) +{ + if (m_type == type) + return; + + m_type = type; + + if (m_networkStateChangedFunction) + m_networkStateChangedFunction(); +} + } |
