diff options
Diffstat (limited to 'WebCore/platform')
-rw-r--r-- | WebCore/platform/android/ClipboardAndroid.cpp | 118 | ||||
-rw-r--r-- | WebCore/platform/android/ClipboardAndroid.h | 15 | ||||
-rw-r--r-- | WebCore/platform/android/ContextMenuClientAndroid.cpp | 46 | ||||
-rw-r--r-- | WebCore/platform/android/ContextMenuClientAndroid.h | 50 | ||||
-rw-r--r-- | WebCore/platform/android/CursorAndroid.cpp | 46 | ||||
-rw-r--r-- | WebCore/platform/android/DragDataAndroid.cpp | 18 | ||||
-rw-r--r-- | WebCore/platform/android/FileChooserAndroid.cpp | 18 | ||||
-rw-r--r-- | WebCore/platform/android/KeyEventAndroid.cpp | 3 | ||||
-rw-r--r-- | WebCore/platform/android/LocalizedStringsAndroid.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/android/PopupMenuAndroid.cpp | 12 | ||||
-rw-r--r-- | WebCore/platform/android/RenderThemeAndroid.cpp | 35 | ||||
-rw-r--r-- | WebCore/platform/android/RenderThemeAndroid.h | 4 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GradientAndroid.cpp | 15 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 75 |
14 files changed, 105 insertions, 352 deletions
diff --git a/WebCore/platform/android/ClipboardAndroid.cpp b/WebCore/platform/android/ClipboardAndroid.cpp index 942c628..0322e01 100644 --- a/WebCore/platform/android/ClipboardAndroid.cpp +++ b/WebCore/platform/android/ClipboardAndroid.cpp @@ -34,27 +34,6 @@ namespace WebCore { -// format string for -static const char szShellDotUrlTemplate[] = "[InternetShortcut]\r\nURL=%s\r\n"; - -// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft -// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3 - -enum ClipboardDataType { ClipboardDataTypeNone, ClipboardDataTypeURL, ClipboardDataTypeText }; - -static ClipboardDataType clipboardTypeFromMIMEType(const String& type) -{ - String qType = type.stripWhiteSpace().lower(); - - // two special cases for IE compatibility - if (qType == "text" || qType == "text/plain" || qType.startsWith("text/plain;")) - return ClipboardDataTypeText; - if (qType == "url" || qType == "text/uri-list") - return ClipboardDataTypeURL; - - return ClipboardDataTypeNone; -} - ClipboardAndroid::ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging) : Clipboard(policy, isForDragging) { @@ -64,137 +43,62 @@ ClipboardAndroid::~ClipboardAndroid() { } -void ClipboardAndroid::clearData(const String& type) +void ClipboardAndroid::clearData(const String&) { - //FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> ASSERT(isForDragging()); - if (policy() != ClipboardWritable) - return; - - ClipboardDataType dataType = clipboardTypeFromMIMEType(type); - - if (dataType == ClipboardDataTypeURL) { - } - if (dataType == ClipboardDataTypeText) { - - } - } void ClipboardAndroid::clearAllData() { - //FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> ASSERT(isForDragging()); - if (policy() != ClipboardWritable) - return; - } -String ClipboardAndroid::getData(const String& type, bool& success) const +String ClipboardAndroid::getData(const String&, bool& success) const { success = false; - if (policy() != ClipboardReadable) { - return ""; - } - - /* - ClipboardDataType dataType = clipboardTypeFromMIMEType(type); - if (dataType == ClipboardDataTypeText) - return getPlainText(m_dataObject.get(), success); - else if (dataType == ClipboardDataTypeURL) - return getURL(m_dataObject.get(), success); - */ return ""; } -bool ClipboardAndroid::setData(const String &type, const String &data) +bool ClipboardAndroid::setData(const String&, const String&) { - //FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> ASSERT(isForDragging()); - if (policy() != ClipboardWritable) - return false; - - ClipboardDataType platformType = clipboardTypeFromMIMEType(type); - - if (platformType == ClipboardDataTypeURL) { - KURL url = KURL(data); -#if 0 && defined ANDROID // FIXME HACK : KURL no longer defines a public method isValid() - if (!url.isValid()) - return false; -#endif - return false; // WebCore::writeURL(m_writableDataObject.get(), url, String(), false, true); - } else if ( platformType == ClipboardDataTypeText) { - return false; - } return false; } - // extensions beyond IE's API HashSet<String> ClipboardAndroid::types() const { - HashSet<String> results; - if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) - return results; - - return results; -} - -void ClipboardAndroid::setDragImage(CachedImage* image, Node *node, const IntPoint &loc) -{ - if (policy() != ClipboardImageWritable && policy() != ClipboardWritable) - return; - - if (m_dragImage) - m_dragImage->removeClient(this); - m_dragImage = image; - if (m_dragImage) - m_dragImage->addClient(this); - - m_dragLoc = loc; - m_dragImageElement = node; + return HashSet<String>(); } -void ClipboardAndroid::setDragImage(CachedImage* img, const IntPoint &loc) +void ClipboardAndroid::setDragImage(CachedImage*, const IntPoint&) { - setDragImage(img, 0, loc); } -void ClipboardAndroid::setDragImageElement(Node *node, const IntPoint &loc) +void ClipboardAndroid::setDragImageElement(Node*, const IntPoint&) { - setDragImage(0, node, loc); } -DragImageRef ClipboardAndroid::createDragImage(IntPoint& loc) const +DragImageRef ClipboardAndroid::createDragImage(IntPoint&) const { - void* result = 0; - //FIXME: Need to be able to draw element <rdar://problem/5015942> - if (m_dragImage) { - result = createDragImageFromImage(m_dragImage->image()); - loc = m_dragLoc; - } - return result; + return 0; } - -void ClipboardAndroid::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame) +void ClipboardAndroid::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) { - } -void ClipboardAndroid::writeURL(const KURL& kurl, const String& titleStr, Frame*) +void ClipboardAndroid::writeURL(const KURL&, const String&, Frame*) { - } -void ClipboardAndroid::writeRange(Range* selectedRange, Frame* frame) +void ClipboardAndroid::writeRange(Range* selectedRange, Frame*) { ASSERT(selectedRange); } bool ClipboardAndroid::hasData() { - return false; } diff --git a/WebCore/platform/android/ClipboardAndroid.h b/WebCore/platform/android/ClipboardAndroid.h index b38b913..987463f 100644 --- a/WebCore/platform/android/ClipboardAndroid.h +++ b/WebCore/platform/android/ClipboardAndroid.h @@ -40,10 +40,10 @@ namespace WebCore { ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging); ~ClipboardAndroid(); - void clearData(const String& type); + void clearData(const String&); void clearAllData(); - String getData(const String& type, bool& success) const; - bool setData(const String& type, const String& data); + String getData(const String&, bool& success) const; + bool setData(const String&, const String&); // extensions beyond IE's API HashSet<String> types() const; @@ -51,17 +51,12 @@ namespace WebCore { void setDragImage(CachedImage*, const IntPoint&); void setDragImageElement(Node*, const IntPoint&); - virtual DragImageRef createDragImage(IntPoint& dragLoc) const; - virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*); + virtual DragImageRef createDragImage(IntPoint&) const; + virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*); virtual void writeURL(const KURL&, const String&, Frame*); virtual void writeRange(Range*, Frame*); virtual bool hasData(); - - private: - void resetFromClipboard(); - void setDragImage(CachedImage*, Node*, const IntPoint&); - Frame* m_frame; }; } // namespace WebCore diff --git a/WebCore/platform/android/ContextMenuClientAndroid.cpp b/WebCore/platform/android/ContextMenuClientAndroid.cpp deleted file mode 100644 index 7aabfc9..0000000 --- a/WebCore/platform/android/ContextMenuClientAndroid.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2007, 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. - */ - -#include "config.h" -#include "ContextMenuClientAndroid.h" - -#include "NotImplemented.h" -#include <wtf/Assertions.h> - -namespace WebCore { - -void ContextMenuClientAndroid::contextMenuDestroyed() { delete this; } - -PlatformMenuDescription ContextMenuClientAndroid::getCustomMenuFromDefaultItems(ContextMenu*) { notImplemented(); return 0; } -void ContextMenuClientAndroid::contextMenuItemSelected(ContextMenuItem*, const ContextMenu*) { notImplemented(); } - -void ContextMenuClientAndroid::downloadURL(const KURL& url) { notImplemented(); } -void ContextMenuClientAndroid::copyImageToClipboard(const HitTestResult&) { notImplemented(); } -void ContextMenuClientAndroid::searchWithGoogle(const Frame*) { notImplemented(); } -void ContextMenuClientAndroid::lookUpInDictionary(Frame*) { notImplemented(); } -void ContextMenuClientAndroid::speak(const String&) { notImplemented(); } -void ContextMenuClientAndroid::stopSpeaking() { notImplemented(); } - -} diff --git a/WebCore/platform/android/ContextMenuClientAndroid.h b/WebCore/platform/android/ContextMenuClientAndroid.h deleted file mode 100644 index 1860e4e..0000000 --- a/WebCore/platform/android/ContextMenuClientAndroid.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2007, 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. - */ - -#ifndef ContextMenuClientAndroid_h -#define ContextMenuClientAndroid_h - -#include "ContextMenuClient.h" - -namespace WebCore { - -class ContextMenuClientAndroid : public ContextMenuClient { -public: - virtual void contextMenuDestroyed(); - - virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*); - virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*); - - virtual void downloadURL(const KURL& url); - virtual void copyImageToClipboard(const HitTestResult&); - virtual void searchWithGoogle(const Frame*); - virtual void lookUpInDictionary(Frame*); - virtual void speak(const String&); - virtual void stopSpeaking(); -}; - -} // namespace WebCore - -#endif // ContextMenuClientAndroid_h diff --git a/WebCore/platform/android/CursorAndroid.cpp b/WebCore/platform/android/CursorAndroid.cpp index 7564384..5c6e473 100644 --- a/WebCore/platform/android/CursorAndroid.cpp +++ b/WebCore/platform/android/CursorAndroid.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "Cursor.h" + #include "NotImplemented.h" namespace WebCore { @@ -52,284 +53,243 @@ Cursor& Cursor::operator=(const Cursor&) return *this; } +static Cursor c; const Cursor& pointerCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& crossCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& handCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& moveCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& iBeamCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& waitCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& helpCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& eastResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northEastResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northWestResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& southResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& southEastResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& southWestResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& westResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northSouthResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& eastWestResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northEastSouthWestResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northWestSouthEastResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& columnResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& rowResizeCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& verticalTextCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& cellCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& contextMenuCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& noDropCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& copyCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& progressCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& aliasCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& noneCursor() { notImplemented(); - static Cursor c; return c; } -// new as of SVN change 36269, Sept 8, 2008 const Cursor& middlePanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& eastPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northEastPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& northWestPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& southPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& southEastPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& southWestPanningCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& westPanningCursor() { notImplemented(); - static Cursor c; return c; } -// new as of SVN change 38068, Nov 5, 2008 const Cursor& grabCursor() { notImplemented(); - static Cursor c; return c; } const Cursor& grabbingCursor() { notImplemented(); - static Cursor c; return c; } -} +} // namespace WebCore diff --git a/WebCore/platform/android/DragDataAndroid.cpp b/WebCore/platform/android/DragDataAndroid.cpp index d62df20..39b2963 100644 --- a/WebCore/platform/android/DragDataAndroid.cpp +++ b/WebCore/platform/android/DragDataAndroid.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "DragData.h" +#include "Clipboard.h" #include "Document.h" #include "DocumentFragment.h" @@ -57,11 +58,9 @@ Color DragData::asColor() const return Color(); } -class Clipboard : public RefCounted<Clipboard> {}; - PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy) const { - return PassRefPtr<Clipboard>(0); + return 0; } bool DragData::containsCompatibleContent() const @@ -74,7 +73,7 @@ bool DragData::containsURL() const return false; } -String DragData::asURL(String* title) const +String DragData::asURL(String*) const { return String(); } @@ -85,8 +84,13 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const return 0; } -// functions new to Jun-07 tip of tree merge: -void DragData::asFilenames(Vector<String>&) const {} -bool DragData::containsFiles() const { return false; } +void DragData::asFilenames(Vector<String>&) const +{ +} +bool DragData::containsFiles() const +{ + return false; } + +} // namespace WebCore diff --git a/WebCore/platform/android/FileChooserAndroid.cpp b/WebCore/platform/android/FileChooserAndroid.cpp index 004b653..2c75373 100644 --- a/WebCore/platform/android/FileChooserAndroid.cpp +++ b/WebCore/platform/android/FileChooserAndroid.cpp @@ -32,8 +32,8 @@ namespace WebCore { String FileChooser::basenameForWidth(const Font& font, int width) const { - // FIXME: This could be a lot faster, but assuming the data will not often be - // much longer than the provided width, this may be fast enough. + // FIXME: This could be a lot faster, but assuming the data will not + // often be much longer than the provided width, this may be fast enough. String output = m_filenames[0].copy(); while (font.width(TextRun(output.impl())) > width && output.length() > 4) { output = output.replace(output.length() - 4, 4, String("...")); @@ -41,13 +41,19 @@ String FileChooser::basenameForWidth(const Font& font, int width) const return output; } - // The following two strings are used for File Upload form control, ie // <input type="file">. The first is the text that appears on the button // that when pressed, the user can browse for and select a file. The // second string is rendered on the screen when no file has been selected. -String fileButtonChooseFileLabel() { return String("Uploads Disabled"); } -String fileButtonNoFileSelectedLabel() { return String("No file selected"); } +String fileButtonChooseFileLabel() +{ + return String("Uploads Disabled"); +} + +String fileButtonNoFileSelectedLabel() +{ + return String("No file selected"); +} -} // WebCore +} // namesapce WebCore diff --git a/WebCore/platform/android/KeyEventAndroid.cpp b/WebCore/platform/android/KeyEventAndroid.cpp index 1a245a4..5496bbc 100644 --- a/WebCore/platform/android/KeyEventAndroid.cpp +++ b/WebCore/platform/android/KeyEventAndroid.cpp @@ -246,7 +246,6 @@ bool PlatformKeyboardEvent::currentCapsLockState() return false; } -// functions new to Feb-19 tip of tree merge: void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode) { // Copied with modification from the mac port. @@ -265,4 +264,4 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCom } } -} // WebCore +} // namespace WebCore diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp index 540dc04..02f135f 100644 --- a/WebCore/platform/android/LocalizedStringsAndroid.cpp +++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp @@ -51,4 +51,4 @@ String imageTitle(const String& filename, const IntSize& size) return String(); } -} +} // namespace WebCore diff --git a/WebCore/platform/android/PopupMenuAndroid.cpp b/WebCore/platform/android/PopupMenuAndroid.cpp index 2cc244b..4d1fe04 100644 --- a/WebCore/platform/android/PopupMenuAndroid.cpp +++ b/WebCore/platform/android/PopupMenuAndroid.cpp @@ -27,8 +27,9 @@ namespace WebCore { -// Now we handle all of this in WebViewCore.cpp -PopupMenu::PopupMenu(PopupMenuClient* menuList) : m_popupClient(menuList) +// Now we handle all of this in WebViewCore.cpp. +PopupMenu::PopupMenu(PopupMenuClient* menuList) + : m_popupClient(menuList) { } @@ -49,8 +50,9 @@ void PopupMenu::updateFromElement() { } -// functions new to Jun-07 tip of tree merge: -bool PopupMenu::itemWritingDirectionIsNatural() { return false; } - +bool PopupMenu::itemWritingDirectionIsNatural() +{ + return false; } +} // namespace WebCore diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp index 9cccc0c..e104c8e 100644 --- a/WebCore/platform/android/RenderThemeAndroid.cpp +++ b/WebCore/platform/android/RenderThemeAndroid.cpp @@ -54,26 +54,6 @@ static SkCanvas* getCanvasFromInfo(const RenderObject::PaintInfo& info) return info.context->platformContext()->mCanvas; } -/* Helper function that paints the RenderObject - * paramters: - * the skin to use, - * the object to be painted, the PaintInfo, from which we get the canvas, the bounding rectangle, - * returns false, meaning no one else has to paint it -*/ -static bool paintBrush(RenderSkinAndroid* rSkin, RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) -{ - Node* element = o->element(); - SkCanvas* canvas = getCanvasFromInfo(i); - canvas->save(); - canvas->translate(SkIntToScalar(ir.x()), SkIntToScalar(ir.y())); - rSkin->setDim(ir.width(), ir.height()); - rSkin->notifyState(element); - rSkin->draw(i.context->platformContext()); - canvas->restore(); - return false; -} - - RenderTheme* theme() { static RenderThemeAndroid androidTheme; @@ -82,16 +62,10 @@ RenderTheme* theme() RenderThemeAndroid::RenderThemeAndroid() { - m_radio = new RenderSkinRadio(false); - m_checkbox = new RenderSkinRadio(true); - m_combo = new RenderSkinCombo(); } RenderThemeAndroid::~RenderThemeAndroid() { - delete m_radio; - delete m_checkbox; - delete m_combo; } void RenderThemeAndroid::close() @@ -194,7 +168,8 @@ void RenderThemeAndroid::adjustButtonStyle(CSSStyleSelector* selector, RenderSty bool RenderThemeAndroid::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) { - return paintBrush(m_checkbox, o, i, ir); + RenderSkinRadio::Draw(getCanvasFromInfo(i), o->element(), ir, true); + return false; } bool RenderThemeAndroid::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) @@ -213,7 +188,8 @@ bool RenderThemeAndroid::paintButton(RenderObject* o, const RenderObject::PaintI bool RenderThemeAndroid::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) { - return paintBrush(m_radio, o, i, ir); + RenderSkinRadio::Draw(getCanvasFromInfo(i), o->element(), ir, false); + return false; } void RenderThemeAndroid::setCheckboxSize(RenderStyle* style) const @@ -286,7 +262,8 @@ bool RenderThemeAndroid::paintCombo(RenderObject* o, const RenderObject::PaintIn y += (height - MAX_COMBO_HEIGHT) >> 1; height = MAX_COMBO_HEIGHT; } - return m_combo->Draw(getCanvasFromInfo(i), element, ir.x(), y, ir.width(), height); + return RenderSkinCombo::Draw(getCanvasFromInfo(i), element, ir.x(), y, + ir.width(), height); } bool RenderThemeAndroid::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& ir) diff --git a/WebCore/platform/android/RenderThemeAndroid.h b/WebCore/platform/android/RenderThemeAndroid.h index 632a2a3..3b6e9cb 100644 --- a/WebCore/platform/android/RenderThemeAndroid.h +++ b/WebCore/platform/android/RenderThemeAndroid.h @@ -97,10 +97,6 @@ private: void close(); bool supportsFocus(ControlPart appearance); - // FIXME: There should be a way to use one RenderSkinRadio for both radio and checkbox - RenderSkinRadio* m_radio; - RenderSkinRadio* m_checkbox; - RenderSkinCombo* m_combo; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/GradientAndroid.cpp b/WebCore/platform/graphics/android/GradientAndroid.cpp index af7f5ee..71b7f73 100644 --- a/WebCore/platform/graphics/android/GradientAndroid.cpp +++ b/WebCore/platform/graphics/android/GradientAndroid.cpp @@ -39,7 +39,7 @@ class PlatformGradientRec { public: PlatformGradientRec() : m_shader(NULL) {} ~PlatformGradientRec() { m_shader->safeUnref(); } - + SkShader* m_shader; SkShader::TileMode m_tileMode; }; @@ -49,6 +49,7 @@ namespace WebCore { void Gradient::platformDestroy() { delete m_gradient; + m_gradient = 0; } static U8CPU F2B(float x) @@ -64,23 +65,23 @@ SkShader* Gradient::getShader(SkShader::TileMode mode) { } SkPoint pts[2]; - + android_setpt(&pts[0], m_p0); android_setpt(&pts[1], m_p1); size_t count = m_stops.size(); SkAutoMalloc storage(count * (sizeof(SkColor) + sizeof(SkScalar))); SkColor* colors = (SkColor*)storage.get(); SkScalar* pos = (SkScalar*)(colors + count); - + Vector<ColorStop>::iterator iter = m_stops.begin(); int i = -1; while (i++, iter != m_stops.end()) { pos[i] = SkFloatToScalar(iter->stop); - colors[i] = SkColorSetARGB(F2B(iter->alpha), F2B(iter->red), + colors[i] = SkColorSetARGB(F2B(iter->alpha), F2B(iter->red), F2B(iter->green), F2B(iter->blue)); - ++iter; + ++iter; } - + SkShader* s; if (0 == count) { // it seems the spec says a zero-size gradient draws transparent @@ -110,6 +111,6 @@ void Gradient::fill(GraphicsContext* context, const FloatRect& rect) paint.setShader(this->getShader(mode)); android_gc2canvas(context)->drawRect(*android_setrect(&r, rect), paint); } - + } //namespace diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 171ed77..c2e0f02 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -297,6 +297,41 @@ private: State& operator=(const State&); }; +static SkShader::TileMode SpreadMethod2TileMode(GradientSpreadMethod sm) { + SkShader::TileMode mode = SkShader::kClamp_TileMode; + + switch (sm) { + case SpreadMethodPad: + mode = SkShader::kClamp_TileMode; + break; + case SpreadMethodReflect: + mode = SkShader::kMirror_TileMode; + break; + case SpreadMethodRepeat: + mode = SkShader::kRepeat_TileMode; + break; + } + return mode; +} + +static void extactShader(SkPaint* paint, ColorSpace cs, Pattern* pat, + Gradient* grad, GradientSpreadMethod sm) { + switch (cs) { + case PatternColorSpace: + // createPlatformPattern() returns a new inst + paint->setShader(pat->createPlatformPattern( + AffineTransform()))->safeUnref(); + break; + case GradientColorSpace: { + // grad->getShader() returns a cached obj + paint->setShader(grad->getShader(SpreadMethod2TileMode(sm))); + break; + } + default: + break; + } +} + //////////////////////////////////////////////////////////////////////////////////////////////// GraphicsContext* GraphicsContext::createOffscreenContext(int width, int height) @@ -628,6 +663,11 @@ void GraphicsContext::fillRect(const FloatRect& rect) android_setrect(&r, rect); m_data->setup_paint_fill(&paint); + + extactShader(&paint, m_common->state.fillColorSpace, + m_common->state.fillPattern.get(), + m_common->state.fillGradient.get(), spreadMethod()); + GC2Canvas(this)->drawRect(r, paint); } @@ -1011,41 +1051,6 @@ void GraphicsContext::drawPath() { this->strokePath(); } -static SkShader::TileMode SpreadMethod2TileMode(GradientSpreadMethod sm) { - SkShader::TileMode mode = SkShader::kClamp_TileMode; - - switch (sm) { - case SpreadMethodPad: - mode = SkShader::kClamp_TileMode; - break; - case SpreadMethodReflect: - mode = SkShader::kMirror_TileMode; - break; - case SpreadMethodRepeat: - mode = SkShader::kRepeat_TileMode; - break; - } - return mode; -} - -void extactShader(SkPaint* paint, ColorSpace cs, Pattern* pat, Gradient* grad, - GradientSpreadMethod sm) { - switch (cs) { - case PatternColorSpace: - // createPlatformPattern() returns a new inst - paint->setShader(pat->createPlatformPattern( - AffineTransform()))->safeUnref(); - break; - case GradientColorSpace: { - // grad->getShader() returns a cached obj - paint->setShader(grad->getShader(SpreadMethod2TileMode(sm))); - break; - } - default: - break; - } -} - void GraphicsContext::fillPath() { SkPath* path = m_data->getPath(); if (paintingDisabled() || !path) |