summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/wx
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/platform/wx
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/platform/wx')
-rw-r--r--WebCore/platform/wx/ClipboardWx.h11
-rw-r--r--WebCore/platform/wx/CursorWx.cpp57
-rw-r--r--WebCore/platform/wx/DragDataWx.cpp6
-rw-r--r--WebCore/platform/wx/EventLoopWx.cpp44
-rw-r--r--WebCore/platform/wx/FileSystemWx.cpp55
-rw-r--r--WebCore/platform/wx/KeyboardEventWx.cpp1
-rw-r--r--WebCore/platform/wx/LocalizedStringsWx.cpp54
-rw-r--r--WebCore/platform/wx/MimeTypeRegistryWx.cpp3
-rw-r--r--WebCore/platform/wx/MouseEventWx.cpp21
-rw-r--r--WebCore/platform/wx/MouseWheelEventWx.cpp5
-rw-r--r--WebCore/platform/wx/PasteboardWx.cpp1
-rw-r--r--WebCore/platform/wx/PopupMenuWx.cpp113
-rw-r--r--WebCore/platform/wx/RenderThemeWx.cpp165
-rw-r--r--WebCore/platform/wx/ScrollViewWx.cpp300
-rwxr-xr-xWebCore/platform/wx/TemporaryLinkStubs.cpp67
-rw-r--r--WebCore/platform/wx/ThreadingWx.cpp40
-rwxr-xr-xWebCore/platform/wx/WidgetWx.cpp103
-rw-r--r--WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp67
-rw-r--r--WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp44
-rw-r--r--WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp66
-rw-r--r--WebCore/platform/wx/wxcode/non-kerned-drawing.h (renamed from WebCore/platform/wx/PlatformScrollBar.h)52
-rw-r--r--WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp125
22 files changed, 936 insertions, 464 deletions
diff --git a/WebCore/platform/wx/ClipboardWx.h b/WebCore/platform/wx/ClipboardWx.h
index 90b7894..db5f7a8 100644
--- a/WebCore/platform/wx/ClipboardWx.h
+++ b/WebCore/platform/wx/ClipboardWx.h
@@ -35,9 +35,11 @@ namespace WebCore {
// State available during IE's events for drag and drop and copy/paste
class ClipboardWx : public Clipboard {
public:
- ClipboardWx(ClipboardAccessPolicy policy, bool forDragging);
- ~ClipboardWx() { }
-
+ static PassRefPtr<ClipboardWx> create(ClipboardAccessPolicy policy, bool forDragging)
+ {
+ return adoptRef(new ClipboardWx(policy, forDragging));
+ }
+
void clearData(const String& type);
void clearAllData();
String getData(const String& type, bool& success) const;
@@ -58,6 +60,9 @@ namespace WebCore {
virtual void writeRange(Range*, Frame*);
virtual bool hasData();
+
+ private:
+ ClipboardWx(ClipboardAccessPolicy, bool forDragging);
};
}
diff --git a/WebCore/platform/wx/CursorWx.cpp b/WebCore/platform/wx/CursorWx.cpp
index 1e51d8f..7175b01 100644
--- a/WebCore/platform/wx/CursorWx.cpp
+++ b/WebCore/platform/wx/CursorWx.cpp
@@ -181,6 +181,51 @@ const Cursor& rowResizeCursor()
static Cursor c = new wxCursor(wxCURSOR_SIZING);
return c;
}
+
+const Cursor& middlePanningCursor()
+{
+ return moveCursor();
+}
+
+const Cursor& eastPanningCursor()
+{
+ return eastResizeCursor();
+}
+
+const Cursor& northPanningCursor()
+{
+ return northResizeCursor();
+}
+
+const Cursor& northEastPanningCursor()
+{
+ return northEastResizeCursor();
+}
+
+const Cursor& northWestPanningCursor()
+{
+ return northWestResizeCursor();
+}
+
+const Cursor& southPanningCursor()
+{
+ return southResizeCursor();
+}
+
+const Cursor& southEastPanningCursor()
+{
+ return southEastResizeCursor();
+}
+
+const Cursor& southWestPanningCursor()
+{
+ return southWestResizeCursor();
+}
+
+const Cursor& westPanningCursor()
+{
+ return westResizeCursor();
+}
const Cursor& verticalTextCursor()
{
@@ -241,4 +286,16 @@ const Cursor& zoomOutCursor()
return zoomInCursor();
}
+const Cursor& grabCursor()
+{
+ // TODO: Determine if we can find a better cursor for this.
+ return pointerCursor();
+}
+
+const Cursor& grabbingCursor()
+{
+ // TODO: Determine if we can find a better cursor for this.
+ return pointerCursor();
+}
+
}
diff --git a/WebCore/platform/wx/DragDataWx.cpp b/WebCore/platform/wx/DragDataWx.cpp
index 49e4fd2..97ea38c 100644
--- a/WebCore/platform/wx/DragDataWx.cpp
+++ b/WebCore/platform/wx/DragDataWx.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,6 +25,8 @@
#include "config.h"
#include "DragData.h"
+
+#include "Clipboard.h"
#include "Document.h"
#include "DocumentFragment.h"
@@ -64,7 +66,7 @@ Color DragData::asColor() const
return Color();
}
-Clipboard* DragData::createClipboard(ClipboardAccessPolicy) const
+PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy) const
{
return 0;
}
diff --git a/WebCore/platform/wx/EventLoopWx.cpp b/WebCore/platform/wx/EventLoopWx.cpp
new file mode 100644
index 0000000..99090ca
--- /dev/null
+++ b/WebCore/platform/wx/EventLoopWx.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. ``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 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 "EventLoop.h"
+
+#include <wx/defs.h>
+#include <wx/app.h>
+
+namespace WebCore {
+
+void EventLoop::cycle()
+{
+ if (wxTheApp) {
+ if (wxTheApp->IsMainLoopRunning())
+ wxTheApp->Dispatch();
+ else
+ m_ended = true;
+ }
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/wx/FileSystemWx.cpp b/WebCore/platform/wx/FileSystemWx.cpp
index 28310f2..7de425e 100644
--- a/WebCore/platform/wx/FileSystemWx.cpp
+++ b/WebCore/platform/wx/FileSystemWx.cpp
@@ -1,7 +1,9 @@
/*
* Copyright (C) 2007 Kevin Ollivier
- * All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd.
*
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -31,6 +33,9 @@
#include "NotImplemented.h"
#include "PlatformString.h"
+#include <wx/wx.h>
+#include <wx/filename.h>
+
namespace WebCore {
bool fileExists(const String& path)
@@ -75,4 +80,52 @@ String pathByAppendingComponent(const String& path, const String& component)
return String();
}
+String homeDirectoryPath()
+{
+ notImplemented();
+ return String();
+}
+
+String pathGetFileName(const String& path)
+{
+ return wxFileName(path).GetFullName();
+}
+
+String directoryName(const String& path)
+{
+ notImplemented();
+ return String();
+}
+
+CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
+{
+ notImplemented();
+ handle = invalidPlatformFileHandle;
+ return CString();
+}
+
+void closeFile(PlatformFileHandle&)
+{
+ notImplemented();
+}
+
+int writeToFile(PlatformFileHandle, const char* data, int length)
+{
+ notImplemented();
+ return 0;
+}
+
+bool unloadModule(PlatformModule)
+{
+ notImplemented();
+ return false;
+}
+
+Vector<String> listDirectory(const String& path, const String& filter)
+{
+ Vector<String> entries;
+ notImplemented();
+ return entries;
+}
+
}
diff --git a/WebCore/platform/wx/KeyboardEventWx.cpp b/WebCore/platform/wx/KeyboardEventWx.cpp
index 2caff0e..8be87ac 100644
--- a/WebCore/platform/wx/KeyboardEventWx.cpp
+++ b/WebCore/platform/wx/KeyboardEventWx.cpp
@@ -341,6 +341,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(wxKeyEvent& event)
}
m_autoRepeat = false; // FIXME: not correct.
m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event.GetKeyCode());
+ m_nativeVirtualKeyCode = event.GetKeyCode();
m_isKeypad = (event.GetKeyCode() >= WXK_NUMPAD_SPACE) && (event.GetKeyCode() <= WXK_NUMPAD_DIVIDE);
m_shiftKey = event.ShiftDown();
m_ctrlKey = event.CmdDown();
diff --git a/WebCore/platform/wx/LocalizedStringsWx.cpp b/WebCore/platform/wx/LocalizedStringsWx.cpp
index 368f938..a315181 100644
--- a/WebCore/platform/wx/LocalizedStringsWx.cpp
+++ b/WebCore/platform/wx/LocalizedStringsWx.cpp
@@ -25,6 +25,8 @@
*/
#include "config.h"
+#include "LocalizedStrings.h"
+
#include "PlatformString.h"
namespace WebCore {
@@ -259,9 +261,61 @@ String contextMenuItemTagInspectElement()
return String("Inspect Element");
}
+String multipleFileUploadText(unsigned numberOfFiles)
+{
+ // FIXME: If this file gets localized, this should really be localized as one string with a wildcard for the number.
+ return String::number(numberOfFiles) + String(" files");
+}
+
String unknownFileSizeText()
{
return String("Unknown");
}
+String imageTitle(const String& filename, const IntSize& size)
+{
+ return String();
+}
+
+// accessibility related strings
+String AXButtonActionVerb()
+{
+ return String();
+}
+
+String AXRadioButtonActionVerb()
+{
+ return String();
+}
+
+String AXTextFieldActionVerb()
+{
+ return String();
+}
+
+String AXCheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXUncheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXLinkActionVerb()
+{
+ return String();
+}
+
+String AXDefinitionListTermText()
+{
+ return String();
+}
+
+String AXDefinitionListDefinitionText()
+{
+ return String();
+}
+
} // namespace WebCore
diff --git a/WebCore/platform/wx/MimeTypeRegistryWx.cpp b/WebCore/platform/wx/MimeTypeRegistryWx.cpp
index 7fdc9c5..c025d02 100644
--- a/WebCore/platform/wx/MimeTypeRegistryWx.cpp
+++ b/WebCore/platform/wx/MimeTypeRegistryWx.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
- * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@ struct ExtensionMap {
};
static const ExtensionMap extensionMap [] = {
{ "bmp", "image/bmp" },
+ { "css", "text/css" },
{ "gif", "image/gif" },
{ "html", "text/html" },
{ "ico", "image/x-icon" },
diff --git a/WebCore/platform/wx/MouseEventWx.cpp b/WebCore/platform/wx/MouseEventWx.cpp
index 920ffd8..c9468a9 100644
--- a/WebCore/platform/wx/MouseEventWx.cpp
+++ b/WebCore/platform/wx/MouseEventWx.cpp
@@ -20,11 +20,13 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
+#include "Assertions.h"
#include "PlatformMouseEvent.h"
+#include "SystemTime.h"
#include <wx/defs.h>
#include <wx/event.h>
@@ -34,7 +36,6 @@ namespace WebCore {
PlatformMouseEvent::PlatformMouseEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
: m_position(event.GetPosition())
, m_globalPosition(globalPoint)
- , m_clickCount(event.ButtonDClick() ? 2 : 1)
, m_shiftKey(event.ShiftDown())
, m_ctrlKey(event.CmdDown())
, m_altKey(event.AltDown())
@@ -53,12 +54,22 @@ PlatformMouseEvent::PlatformMouseEvent(const wxMouseEvent& event, const wxPoint&
else if (type == wxEVT_MOTION)
m_eventType = MouseEventMoved;
- if (event.LeftIsDown())
+ if (event.LeftIsDown() || event.Button(wxMOUSE_BTN_LEFT))
m_button = LeftButton;
- else if (event.RightIsDown())
+ else if (event.RightIsDown() || event.Button(wxMOUSE_BTN_RIGHT))
m_button = RightButton;
- else if (event.MiddleIsDown())
+ else if (event.MiddleIsDown() || event.Button(wxMOUSE_BTN_MIDDLE))
m_button = MiddleButton;
+ else if (!m_eventType == MouseEventMoved)
+ ASSERT_NOT_REACHED();
+
+
+ if (m_eventType == MouseEventMoved)
+ m_clickCount = 0;
+ else
+ m_clickCount = event.ButtonDClick() ? 2 : 1;
+
+ m_timestamp = WebCore::currentTime();
}
}
diff --git a/WebCore/platform/wx/MouseWheelEventWx.cpp b/WebCore/platform/wx/MouseWheelEventWx.cpp
index 0bfbd4a..154a710 100644
--- a/WebCore/platform/wx/MouseWheelEventWx.cpp
+++ b/WebCore/platform/wx/MouseWheelEventWx.cpp
@@ -34,14 +34,17 @@ namespace WebCore {
PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
: m_position(event.GetPosition())
, m_globalPosition(globalPoint)
+ , m_granularity(ScrollByLineWheelEvent)
, m_shiftKey(event.ShiftDown())
, m_ctrlKey(event.ControlDown())
, m_altKey(event.AltDown())
, m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers
, m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling
, m_deltaY(event.GetWheelRotation() / event.GetWheelDelta())
+ , m_isAccepted(false)
{
-
+ // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
+ m_deltaY *= horizontalLineMultiplier();
}
}
diff --git a/WebCore/platform/wx/PasteboardWx.cpp b/WebCore/platform/wx/PasteboardWx.cpp
index 023e661..3b71e9a 100644
--- a/WebCore/platform/wx/PasteboardWx.cpp
+++ b/WebCore/platform/wx/PasteboardWx.cpp
@@ -28,6 +28,7 @@
#include "Pasteboard.h"
#include "DocumentFragment.h"
#include "Editor.h"
+#include "Frame.h"
#include "KURL.h"
#include "markup.h"
#include "PlatformString.h"
diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp
new file mode 100644
index 0000000..4563b77
--- /dev/null
+++ b/WebCore/platform/wx/PopupMenuWx.cpp
@@ -0,0 +1,113 @@
+/*
+ * This file is part of the popup menu implementation for <select> elements in WebCore.
+ *
+ * Copyright (C) 2008 Apple Computer, Inc.
+ *
+ * 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.
+ *
+ */
+
+#include "config.h"
+#include "PopupMenu.h"
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "NotImplemented.h"
+#include "PopupMenuClient.h"
+#include "PlatformString.h"
+
+#include <wx/defs.h>
+#if __WXMSW__
+#include <wx/msw/winundef.h>
+#endif
+#include <wx/event.h>
+#include <wx/menu.h>
+
+static int s_menuStartId = wxNewId();
+
+
+
+namespace WebCore {
+
+PopupMenu::PopupMenu(PopupMenuClient* client)
+ : m_popupClient(client)
+ , m_menu(NULL)
+{
+}
+
+PopupMenu::~PopupMenu()
+{
+ delete m_menu;
+}
+
+void PopupMenu::show(const IntRect& r, FrameView* v, int index)
+{
+ // just delete and recreate
+ delete m_menu;
+ ASSERT(client());
+
+ wxWindow* nativeWin = v->platformWidget();
+
+ if (nativeWin) {
+ // construct the menu
+ m_menu = new wxMenu();
+ int size = client()->listSize();
+ for (int i = 0; i < size; i++) {
+ int id = s_menuStartId + i;
+
+ if (client()->itemIsSeparator(i)) {
+ m_menu->AppendSeparator();
+ }
+ else {
+ // FIXME: appending a menu item with an empty label asserts in
+ // wx. This needs to be fixed at wx level so that we can have
+ // the concept of "no selection" in choice boxes, etc.
+ if (!client()->itemText(i).isEmpty())
+ m_menu->Append(s_menuStartId + i, client()->itemText(i));
+ }
+ }
+ nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this);
+ nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY());
+ nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this);
+ }
+}
+
+void PopupMenu::OnMenuItemSelected(wxCommandEvent& event)
+{
+ if (client()) {
+ client()->valueChanged(event.GetId() - s_menuStartId);
+ client()->hidePopup();
+ }
+ // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still?
+}
+
+void PopupMenu::hide()
+{
+ // we don't need to do anything here, the native control only exists during the time
+ // show is called
+}
+
+void PopupMenu::updateFromElement()
+{
+ client()->setTextFromItem(m_popupClient->selectedIndex());
+}
+
+bool PopupMenu::itemWritingDirectionIsNatural()
+{
+ return false;
+}
+
+}
diff --git a/WebCore/platform/wx/RenderThemeWx.cpp b/WebCore/platform/wx/RenderThemeWx.cpp
index bfe2a77..05ebeb9 100644
--- a/WebCore/platform/wx/RenderThemeWx.cpp
+++ b/WebCore/platform/wx/RenderThemeWx.cpp
@@ -29,8 +29,11 @@
#include "Document.h"
#include "FrameView.h"
#include "GraphicsContext.h"
+#include "NotImplemented.h"
#include "RenderView.h"
+#include "WebKit/wx/WebView.h"
+
#include <wx/defs.h>
#include <wx/renderer.h>
#include <wx/dcclient.h>
@@ -60,14 +63,24 @@ public:
virtual void setRadioSize(RenderStyle*) const;
+ virtual void adjustRepaintRect(const RenderObject*, IntRect&);
+
virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual int minimumMenuListSize(RenderStyle*) const;
+
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
virtual bool isControlStyled(const RenderStyle*, const BorderData&,
- const BackgroundLayer&, const Color&) const;
+ const FillLayer&, const Color&) const;
virtual bool controlSupportsTints(const RenderObject*) const;
@@ -78,14 +91,33 @@ public:
virtual Color platformActiveSelectionForegroundColor() const;
virtual Color platformInactiveSelectionForegroundColor() const;
+
+ virtual int popupInternalPaddingLeft(RenderStyle*) const;
+ virtual int popupInternalPaddingRight(RenderStyle*) const;
+ virtual int popupInternalPaddingTop(RenderStyle*) const;
+ virtual int popupInternalPaddingBottom(RenderStyle*) const;
private:
void addIntrinsicMargins(RenderStyle*) const;
void close();
- bool supportsFocus(EAppearance) const;
+ bool supportsFocus(ControlPart) const;
};
+
+// Constants
+
+#define MINIMUM_MENU_LIST_SIZE 21
+#define POPUP_INTERNAL_PADDING_LEFT 6
+#define POPUP_INTERNAL_PADDING_TOP 2
+#define POPUP_INTERNAL_PADDING_BOTTOM 2
+
+#ifdef __WXMAC__
+#define POPUP_INTERNAL_PADDING_RIGHT 22
+#else
+#define POPUP_INTERNAL_PADDING_RIGHT 20
+#endif
+
RenderTheme* theme()
{
static RenderThemeWx rt;
@@ -93,21 +125,33 @@ RenderTheme* theme()
}
bool RenderThemeWx::isControlStyled(const RenderStyle* style, const BorderData& border,
- const BackgroundLayer& background, const Color& backgroundColor) const
+ const FillLayer& background, const Color& backgroundColor) const
{
- if (style->appearance() == TextFieldAppearance || style->appearance() == TextAreaAppearance)
+ if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart)
return style->border() != border;
return RenderTheme::isControlStyled(style, border, background, backgroundColor);
}
+void RenderThemeWx::adjustRepaintRect(const RenderObject* o, IntRect& r)
+{
+ switch (o->style()->appearance()) {
+ case MenulistPart: {
+ r.setWidth(r.width() + 100);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
bool RenderThemeWx::controlSupportsTints(const RenderObject* o) const
{
if (!isEnabled(o))
return false;
// Checkboxes only have tint when checked.
- if (o->style()->appearance() == CheckboxAppearance)
+ if (o->style()->appearance() == CheckboxPart)
return isChecked(o);
// For now assume other controls have tint if enabled.
@@ -169,12 +213,12 @@ void RenderThemeWx::setRadioSize(RenderStyle* style) const
setCheckboxSize(style);
}
-bool RenderThemeWx::supportsFocus(EAppearance appearance) const
+bool RenderThemeWx::supportsFocus(ControlPart part) const
{
- switch (appearance) {
- case PushButtonAppearance:
- case ButtonAppearance:
- case TextFieldAppearance:
+ switch (part) {
+ case PushButtonPart:
+ case ButtonPart:
+ case TextFieldPart:
return true;
default: // No for all others...
return false;
@@ -188,32 +232,32 @@ void RenderThemeWx::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* s
bool RenderThemeWx::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
- wxWindow* window = o->view()->frameView()->nativeWindow();
+ wxWindow* window = o->view()->frameView()->platformWidget();
wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
- wxASSERT(dc->IsOk());
-
int flags = 0;
if (!isEnabled(o))
flags |= wxCONTROL_DISABLED;
- EAppearance appearance = o->style()->appearance();
- if (supportsFocus(o->style()->appearance()) && isFocused(o))
+ ControlPart part = o->style()->appearance();
+ if (supportsFocus(part) && isFocused(o))
flags |= wxCONTROL_FOCUSED;
if (isPressed(o))
flags |= wxCONTROL_PRESSED;
- if (appearance == PushButtonAppearance || appearance == ButtonAppearance)
+ if (part == PushButtonPart || part == ButtonPart)
wxRendererNative::Get().DrawPushButton(window, *dc, r, flags);
- // TODO: add a radio button rendering API to wx
- //else if(appearance == RadioAppearance)
- else if(appearance == CheckboxAppearance) {
+ else if(part == RadioPart) {
+ if (isChecked(o))
+ flags |= wxCONTROL_CHECKED;
+ wxRenderer_DrawRadioButton(window, *dc, r, flags);
+ }
+ else if(part == CheckboxPart) {
if (isChecked(o))
flags |= wxCONTROL_CHECKED;
wxRendererNative::Get().DrawCheckBox(window, *dc, r, flags);
}
-
return false;
}
@@ -224,12 +268,67 @@ void RenderThemeWx::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style,
bool RenderThemeWx::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
- i.context->setStrokeThickness(1);
- i.context->setStrokeColor(Color(0, 0, 0));
- i.context->drawRect(r);
+ wxWindow* window = o->view()->frameView()->platformWidget();
+ wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
+ wxRenderer_DrawTextCtrl(window, *dc, r, 0);
+ return false;
+}
+
+int RenderThemeWx::minimumMenuListSize(RenderStyle*) const
+{
+ return MINIMUM_MENU_LIST_SIZE;
+}
+
+void RenderThemeWx::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+}
+
+bool RenderThemeWx::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ wxWindow* window = o->view()->frameView()->platformWidget();
+ wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
+
+ int flags = 0;
+ if (!isEnabled(o))
+ flags |= wxCONTROL_DISABLED;
+
+ if (supportsFocus(o->style()->appearance()) && isFocused(o))
+ flags |= wxCONTROL_FOCUSED;
+
+ if (isPressed(o))
+ flags |= wxCONTROL_PRESSED;
+
+ wxRenderer_DrawChoice(window, *dc, r, flags);
+
+ return false;
+}
+
+void RenderThemeWx::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const
+{
+ notImplemented();
+}
+
+bool RenderThemeWx::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ wxWindow* window = o->view()->frameView()->platformWidget();
+ wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
+
+ int flags = 0;
+ if (!isEnabled(o))
+ flags |= wxCONTROL_DISABLED;
+
+ if (supportsFocus(o->style()->appearance()) && isFocused(o))
+ flags |= wxCONTROL_FOCUSED;
+
+ if (isPressed(o))
+ flags |= wxCONTROL_PRESSED;
+
+ wxRendererNative::Get().DrawComboBoxDropButton(window, *dc, r, flags);
+
return false;
}
+
Color RenderThemeWx::platformActiveSelectionBackgroundColor() const
{
return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
@@ -259,5 +358,25 @@ Color RenderThemeWx::platformInactiveSelectionForegroundColor() const
#endif
}
+int RenderThemeWx::popupInternalPaddingLeft(RenderStyle*) const
+{
+ return POPUP_INTERNAL_PADDING_LEFT;
+}
+
+int RenderThemeWx::popupInternalPaddingRight(RenderStyle*) const
+{
+ return POPUP_INTERNAL_PADDING_RIGHT;
+}
+
+int RenderThemeWx::popupInternalPaddingTop(RenderStyle*) const
+{
+ return POPUP_INTERNAL_PADDING_TOP;
+}
+
+int RenderThemeWx::popupInternalPaddingBottom(RenderStyle*) const
+{
+ return POPUP_INTERNAL_PADDING_BOTTOM;
+}
+
}
diff --git a/WebCore/platform/wx/ScrollViewWx.cpp b/WebCore/platform/wx/ScrollViewWx.cpp
index b6c5ae4..3822cba 100644
--- a/WebCore/platform/wx/ScrollViewWx.cpp
+++ b/WebCore/platform/wx/ScrollViewWx.cpp
@@ -30,12 +30,13 @@
#include "IntRect.h"
#include "NotImplemented.h"
#include "PlatformWheelEvent.h"
-#include "ScrollBar.h"
+#include "Scrollbar.h"
#include <algorithm>
#include <stdio.h>
#include <wx/defs.h>
+#include <wx/scrolbar.h>
#include <wx/scrolwin.h>
#include <wx/event.h>
@@ -49,8 +50,6 @@ public:
ScrollViewPrivate(ScrollView* scrollView)
: wxEvtHandler()
, m_scrollView(scrollView)
- , hasStaticBackground(false)
- , suppressScrollbars(false)
, vScrollbarMode(ScrollbarAuto)
, hScrollbarMode(ScrollbarAuto)
, viewStart(0, 0)
@@ -68,7 +67,6 @@ public:
win->Connect(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this);
win->Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this);
win->Connect(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this);
- win->Connect(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this);
}
void OnScrollWinEvents(wxScrollWinEvent& e)
@@ -84,57 +82,66 @@ public:
else
pos.y = e.GetPosition();
}
- else if ( scrollType == wxEVT_SCROLLWIN_LINEDOWN ) {
+ else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) {
+ if (horiz)
+ pos.x += cScrollbarPixelsPerLineStep;
+ else
+ pos.y += cScrollbarPixelsPerLineStep;
+ }
+ else if (scrollType == wxEVT_SCROLLWIN_LINEUP) {
+ if (horiz)
+ pos.x -= cScrollbarPixelsPerLineStep;
+ else
+ pos.y -= cScrollbarPixelsPerLineStep;
+ }
+ else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) {
if (horiz)
- pos.x += LINE_STEP;
+ pos.x -= m_scrollView->visibleWidth() - cAmountToKeepWhenPaging;
else
- pos.y += LINE_STEP;
+ pos.y -= m_scrollView->visibleHeight() - cAmountToKeepWhenPaging;
}
- else if ( scrollType == wxEVT_SCROLLWIN_LINEUP ) {
+ else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) {
if (horiz)
- pos.x -= LINE_STEP;
+ pos.x += m_scrollView->visibleWidth() - cAmountToKeepWhenPaging;
else
- pos.y -= LINE_STEP;
+ pos.y += m_scrollView->visibleHeight() - cAmountToKeepWhenPaging;
}
else
return e.Skip();
- m_scrollView->setContentsPos(pos.x, pos.y);
- m_scrollView->update();
+ m_scrollView->setScrollPosition(IntPoint(pos.x, pos.y));
}
ScrollView* m_scrollView;
- HashSet<Widget*> m_children;
- bool hasStaticBackground;
- bool suppressScrollbars;
ScrollbarMode vScrollbarMode;
ScrollbarMode hScrollbarMode;
wxPoint viewStart;
};
-ScrollView::ScrollView()
+void ScrollView::platformInit()
{
m_data = new ScrollViewPrivate(this);
}
-void ScrollView::setNativeWindow(wxWindow* win)
+
+void ScrollView::platformDestroy()
{
- Widget::setNativeWindow(win);
- m_data->bindEvents(win);
+ delete m_data;
}
-ScrollView::~ScrollView()
+void ScrollView::setPlatformWidget(wxWindow* win)
{
- delete m_data;
+ Widget::setPlatformWidget(win);
+ m_data->bindEvents(win);
}
-void ScrollView::updateContents(const IntRect& updateRect, bool now)
+void ScrollView::platformRepaintContentRectangle(const IntRect& updateRect, bool now)
{
// we need to convert coordinates to scrolled position
wxRect contentsRect = updateRect;
- contentsRect.Offset(-contentsX(), -contentsY());
- wxWindow* win = nativeWindow();
+ contentsRect.Offset(-scrollX(), -scrollY());
+ wxWindow* win = platformWidget();
if (win) {
win->RefreshRect(contentsRect, true);
if (now)
@@ -142,56 +149,40 @@ void ScrollView::updateContents(const IntRect& updateRect, bool now)
}
}
-void ScrollView::update()
+IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const
{
- wxWindow* win = nativeWindow();
- if (win)
- win->Update();
-}
-
-int ScrollView::visibleWidth() const
-{
- int width = 0;
- wxWindow* win = nativeWindow();
- if (win)
- win->GetClientSize(&width, NULL);
-
- ASSERT(width >= 0);
- return width;
-}
+ wxWindow* win = platformWidget();
+ if (!win)
+ return IntRect();
-int ScrollView::visibleHeight() const
-{
- int height = 0;
- wxWindow* win = nativeWindow();
- if (win)
- win->GetClientSize(NULL, &height);
-
- ASSERT(height >= 0);
- return height;
-}
+ int width, height;
-FloatRect ScrollView::visibleContentRect() const
-{
- return FloatRect(contentsX(),contentsY(),visibleWidth(),visibleHeight());
+ if (includeScrollbars)
+ win->GetSize(&width, &height);
+ else
+ win->GetClientSize(&width, &height);
+
+ return IntRect(m_data->viewStart.x, m_data->viewStart.y, width, height);
}
-void ScrollView::setContentsPos(int newX, int newY)
+IntSize ScrollView::platformContentsSize() const
{
- int dx = newX - contentsX();
- int dy = newY - contentsY();
- scrollBy(dx, dy);
+ int width = 0;
+ int height = 0;
+ if (platformWidget()) {
+ platformWidget()->GetVirtualSize(&width, &height);
+ ASSERT(width >= 0 && height >= 0);
+ }
+ return IntSize(width, height);
}
-void ScrollView::scrollBy(int dx, int dy)
+void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint)
{
- wxWindow* win = nativeWindow();
- if (!win)
- return;
+ wxWindow* win = platformWidget();
wxPoint scrollOffset = m_data->viewStart;
wxPoint orig(scrollOffset);
- wxPoint newScrollOffset = scrollOffset + wxPoint(dx, dy);
+ wxPoint newScrollOffset(scrollPoint);
wxRect vRect(win->GetVirtualSize());
wxRect cRect(win->GetClientSize());
@@ -214,70 +205,33 @@ void ScrollView::scrollBy(int dx, int dy)
wxPoint delta(orig - newScrollOffset);
- if (m_data->hasStaticBackground)
- win->Refresh();
- else
+ if (canBlitOnScroll())
win->ScrollWindow(delta.x, delta.y);
+ else
+ win->Refresh();
adjustScrollbars();
}
-void ScrollView::resizeContents(int w,int h)
-{
- wxWindow* win = nativeWindow();
- if (win) {
- win->SetVirtualSize(w, h);
- adjustScrollbars();
- }
-}
-
-int ScrollView::contentsX() const
-{
- ASSERT(m_data->viewStart.x >= 0);
- return m_data->viewStart.x;
-}
-
-int ScrollView::contentsY() const
-{
- ASSERT(m_data->viewStart.y >= 0);
- return m_data->viewStart.y;
-}
-
-int ScrollView::contentsWidth() const
-{
- int width = 0;
- wxWindow* win = nativeWindow();
- if (win)
- win->GetVirtualSize(&width, NULL);
- ASSERT(width >= 0);
- return width;
-}
-
-int ScrollView::contentsHeight() const
+bool ScrollView::platformScroll(ScrollDirection, ScrollGranularity)
{
- int height = 0;
- wxWindow* win = nativeWindow();
- if (win)
- win->GetVirtualSize(NULL, &height);
- ASSERT(height >= 0);
- return height;
+ notImplemented();
+ return true;
}
-FloatRect ScrollView::visibleContentRectConsideringExternalScrollers() const
+void ScrollView::platformSetContentsSize()
{
- // FIXME: clip this rect if parent scroll views cut off the visible
- // area.
- return visibleContentRect();
-}
+ wxWindow* win = platformWidget();
+ if (!win)
+ return;
-IntSize ScrollView::scrollOffset() const
-{
- return IntSize(contentsX(), contentsY());
+ win->SetVirtualSize(m_contentsSize.width(), m_contentsSize.height());
+ adjustScrollbars();
}
void ScrollView::adjustScrollbars(int x, int y, bool refresh)
{
- wxWindow* win = nativeWindow();
+ wxWindow* win = platformWidget();
if (!win)
return;
@@ -328,28 +282,17 @@ void ScrollView::adjustScrollbars(int x, int y, bool refresh)
}
}
-WebCore::ScrollbarMode ScrollView::hScrollbarMode() const
-{
- return m_data->hScrollbarMode;
-}
-
-WebCore::ScrollbarMode ScrollView::vScrollbarMode() const
-{
- return m_data->vScrollbarMode;
-}
-
-void ScrollView::setScrollbarsMode(ScrollbarMode newMode)
+void ScrollView::platformSetScrollbarModes()
{
bool needsAdjust = false;
- if (m_data->hScrollbarMode != newMode) {
- m_data->hScrollbarMode = newMode;
+ if (m_data->hScrollbarMode != horizontalScrollbarMode() ) {
+ m_data->hScrollbarMode = horizontalScrollbarMode();
needsAdjust = true;
}
- if (m_data->vScrollbarMode != newMode) {
- m_data->vScrollbarMode = newMode;
- adjustScrollbars();
+ if (m_data->vScrollbarMode != horizontalScrollbarMode() ) {
+ m_data->vScrollbarMode = horizontalScrollbarMode();
needsAdjust = true;
}
@@ -357,110 +300,53 @@ void ScrollView::setScrollbarsMode(ScrollbarMode newMode)
adjustScrollbars();
}
-void ScrollView::setHScrollbarMode(ScrollbarMode newMode)
-{
- if (m_data->hScrollbarMode != newMode) {
- m_data->hScrollbarMode = newMode;
- adjustScrollbars();
- }
-}
-
-void ScrollView::setVScrollbarMode(ScrollbarMode newMode)
-{
- if (m_data->vScrollbarMode != newMode) {
- m_data->vScrollbarMode = newMode;
- adjustScrollbars();
- }
-}
-
-void ScrollView::setStaticBackground(bool flag)
-{
- m_data->hasStaticBackground = flag;
-}
-
-void ScrollView::suppressScrollbars(bool suppressed, bool repaintOnSuppress)
-{
- if ( m_data->suppressScrollbars != suppressed )
- m_data->suppressScrollbars = suppressed;
-}
-
-IntPoint ScrollView::contentsToWindow(const IntPoint& point) const
-{
- return point - scrollOffset();
-}
-
-IntPoint ScrollView::windowToContents(const IntPoint& point) const
-{
- return point + scrollOffset();
-}
-
-bool ScrollView::inWindow() const
-{
- // NB: This is called from RenderObject::willRenderImage
- // and really seems to be more of a "is the window in a valid state" test,
- // despite the API name.
- return nativeWindow() != NULL;
-}
-
-void ScrollView::wheelEvent(PlatformWheelEvent& e)
+void ScrollView::platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode& vertical) const
{
- // Determine how much we want to scroll. If we can move at all, we will accept the event.
- IntSize maxScrollDelta = maximumScroll();
- if ((e.deltaX() < 0 && maxScrollDelta.width() > 0) ||
- (e.deltaX() > 0 && scrollOffset().width() > 0) ||
- (e.deltaY() < 0 && maxScrollDelta.height() > 0) ||
- (e.deltaY() > 0 && scrollOffset().height() > 0)) {
- e.accept();
- scrollBy(-e.deltaX() * LINE_STEP, -e.deltaY() * LINE_STEP);
- }
+ horizontal = m_data->hScrollbarMode;
+ vertical = m_data->vScrollbarMode;
}
// used for subframes support
-void ScrollView::addChild(Widget* widget)
+void ScrollView::platformAddChild(Widget* widget)
{
- m_data->m_children.add(widget);
-
// NB: In all cases I'm aware of,
// by the time this is called the ScrollView is already a child
// of its parent Widget by wx port APIs, so I don't think
// we need to do anything here.
}
-void ScrollView::removeChild(Widget* widget)
+void ScrollView::platformRemoveChild(Widget* widget)
{
- m_data->m_children.remove(widget);
-
- if (nativeWindow() && widget->nativeWindow()) {
- nativeWindow()->RemoveChild(widget->nativeWindow());
+ if (platformWidget()) {
+ platformWidget()->RemoveChild(widget->platformWidget());
// FIXME: Is this the right place to do deletion? I see
// detachFromParent2/3/4, initiated by FrameLoader::detachFromParent,
// but I'm not sure if it's better to handle there or not.
- widget->nativeWindow()->Destroy();
+ widget->platformWidget()->Destroy();
}
}
-HashSet<Widget*>* ScrollView::children()
-{
- return &(m_data->m_children);
-}
-
-void ScrollView::scrollRectIntoViewRecursively(const IntRect& rect)
+IntRect ScrollView::platformContentsToScreen(const IntRect& rect) const
{
- setContentsPos(rect.x(), rect.y());
+ if (platformWidget()) {
+ wxRect wxrect = rect;
+ platformWidget()->ClientToScreen(&wxrect.x, &wxrect.y);
+ return wxrect;
+ }
+ return IntRect();
}
-PlatformScrollbar* ScrollView::scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent)
+IntPoint ScrollView::platformScreenToContents(const IntPoint& point) const
{
- // AFAICT this is only used for platforms that provide
- // feedback when mouse is hovered over.
- return 0;
+ if (platformWidget()) {
+ return platformWidget()->ScreenToClient(point);
+ }
+ return IntPoint();
}
-IntSize ScrollView::maximumScroll() const
+bool ScrollView::platformIsOffscreen() const
{
- IntSize delta = (IntSize(contentsWidth(), contentsHeight()) - IntSize(visibleWidth(), visibleHeight())) - scrollOffset();
- delta.clampNegativeToZero();
- return delta;
+ return !platformWidget() || !platformWidget()->IsShownOnScreen();
}
}
diff --git a/WebCore/platform/wx/TemporaryLinkStubs.cpp b/WebCore/platform/wx/TemporaryLinkStubs.cpp
index cd328c6..d8c6046 100755
--- a/WebCore/platform/wx/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/wx/TemporaryLinkStubs.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <float.h>
#include "AffineTransform.h"
#include "AXObjectCache.h"
@@ -37,6 +39,7 @@
#include "ContextMenuItem.h"
#include "CookieJar.h"
#include "Cursor.h"
+#include "DNS.h"
#include "DocumentFragment.h"
#include "DocumentLoader.h"
#include "DragController.h"
@@ -45,6 +48,7 @@
#include "EventHandler.h"
#include "FileChooser.h"
#include "Font.h"
+#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
#include "Icon.h"
@@ -62,16 +66,15 @@
#include "Path.h"
#include "PlatformMenuDescription.h"
#include "PlatformMouseEvent.h"
-#include "PlatformScrollBar.h"
-#include "PluginInfoStore.h"
#include "PopupMenu.h"
#include "RenderTheme.h"
#include "ResourceHandle.h"
#include "ResourceHandleInternal.h"
#include "ResourceLoader.h"
#include "Screen.h"
+#include "ScrollbarTheme.h"
#include "SearchPopupMenu.h"
-#include "ScrollBar.h"
+#include "Scrollbar.h"
#include "SharedBuffer.h"
#include "SharedTimer.h"
#include "TextBoundaries.h"
@@ -85,17 +88,11 @@ Vector<char> loadResourceIntoArray(const char* resourceName)
return resource;
}
-void Widget::removeFromParent() { notImplemented(); }
-
-
int findNextSentenceFromIndex(UChar const*,int,int,bool) { notImplemented(); return 0; }
void findSentenceBoundary(UChar const*,int,int,int*,int*) { notImplemented(); }
int WebCore::findNextWordFromIndex(UChar const*,int,int,bool) { notImplemented(); return 0; }
-void Frame::clearPlatformScriptObjects() { notImplemented(); }
-
-void Frame::dashboardRegionsChanged() { notImplemented(); }
DragImageRef Frame::dragImageForSelection() { notImplemented(); return 0; }
void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) { notImplemented(); }
@@ -111,22 +108,12 @@ bool WebCore::cookiesEnabled(const Document* document) { notImplemented(); retur
static WebCore::Cursor localCursor;
const WebCore::Cursor& WebCore::moveCursor() { return localCursor; }
-namespace WebCore {
- bool historyContains(const UChar*, unsigned) { return false; }
-}
-
void WebCore::findWordBoundary(UChar const* str,int len,int position,int* start, int* end) { notImplemented(); *start=position; *end=position; }
-PluginInfo*PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned) { notImplemented(); return 0;}
-unsigned PluginInfoStore::pluginCount() const { notImplemented(); return 0; }
-bool WebCore::PluginInfoStore::supportsMIMEType(const WebCore::String&) { notImplemented(); return false; }
-String PluginInfoStore::pluginNameForMIMEType(const String& mimeType) { notImplemented(); return String(); }
-void WebCore::refreshPlugins(bool) { notImplemented(); }
-
void Widget::setIsSelected(bool) { notImplemented(); }
-void GraphicsContext::setShadow(IntSize const&,int,Color const&) { notImplemented(); }
-void GraphicsContext::clearShadow() { notImplemented(); }
+void GraphicsContext::setPlatformShadow(IntSize const&,int,Color const&) { notImplemented(); }
+void GraphicsContext::clearPlatformShadow() { notImplemented(); }
void GraphicsContext::beginTransparencyLayer(float) { notImplemented(); }
void GraphicsContext::endTransparencyLayer() { notImplemented(); }
void GraphicsContext::clearRect(const FloatRect&) { notImplemented(); }
@@ -137,37 +124,16 @@ void GraphicsContext::setMiterLimit(float) { notImplemented(); }
void GraphicsContext::setAlpha(float) { notImplemented(); }
Color WebCore::focusRingColor() { return 0xFF0000FF; }
-void WebCore::setFocusRingColorChangeFunction(void (*)()) { }
void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect) { notImplemented(); }
-PlatformScrollbar::PlatformScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) : Scrollbar(client, orientation, controlSize) { notImplemented(); }
-PlatformScrollbar::~PlatformScrollbar() { notImplemented(); }
-int PlatformScrollbar::width() const { notImplemented(); return 0; }
-int PlatformScrollbar::height() const { notImplemented(); return 0; }
-void PlatformScrollbar::setEnabled(bool) { notImplemented(); }
-void PlatformScrollbar::paint(GraphicsContext*, const IntRect& damageRect) { notImplemented(); }
-void PlatformScrollbar::updateThumbPosition() { notImplemented(); }
-void PlatformScrollbar::updateThumbProportion() { notImplemented(); }
-void PlatformScrollbar::setRect(const IntRect&) { notImplemented(); }
-
-FileChooser::FileChooser(FileChooserClient*, const String& initialFilename) { notImplemented(); }
-//PassRefPtr<FileChooser> FileChooser::create(FileChooserClient*, const String& initialFilename) { notImplemented(); return PassRefPtr<FileChooser>(); }
-FileChooser::~FileChooser() { notImplemented(); }
-void FileChooser::openFileChooser(Document*) { notImplemented(); }
-String FileChooser::basenameForWidth(const Font&, int width) const { notImplemented(); return String(); }
-
-PopupMenu::PopupMenu(PopupMenuClient*) { notImplemented(); }
+ScrollbarTheme* ScrollbarTheme::nativeTheme() { notImplemented(); static ScrollbarTheme theme; return &theme; }
-PopupMenu::~PopupMenu() { notImplemented(); }
-void PopupMenu::show(const IntRect&, FrameView*, int index) { notImplemented(); }
-void PopupMenu::hide() { notImplemented(); }
-void PopupMenu::updateFromElement() { notImplemented(); }
-bool PopupMenu::itemWritingDirectionIsNatural() { notImplemented(); return false; }
+String FileChooser::basenameForWidth(const Font&, int width) const { notImplemented(); return String(); }
-Icon::Icon() { notImplemented(); }
-Icon::~Icon() { notImplemented(); }
-PassRefPtr<Icon> Icon::newIconForFile(const String& filename) { notImplemented(); return PassRefPtr<Icon>(new Icon()); }
+Icon::~Icon() { }
+PassRefPtr<Icon> Icon::createIconForFile(const String& filename) { notImplemented(); return 0; }
+PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames) { notImplemented(); return 0; }
void Icon::paint(GraphicsContext*, const IntRect&) { notImplemented(); }
ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) { notImplemented(); }
@@ -206,12 +172,15 @@ SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) : PopupMenu(client) {
bool SearchPopupMenu::enabled() { return true; }
namespace WebCore {
-float userIdleTime() { notImplemented(); return 0; }
-Vector<String> supportedKeySizes() { notImplemented(); return Vector<String>(); }
+float userIdleTime() { notImplemented(); return FLT_MAX; } // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed
+void getSupportedKeySizes(Vector<String>&) { notImplemented(); }
String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { return String(); }
const char* currentTextBreakLocaleID() { notImplemented(); return "en_us"; }
String KURL::fileSystemPath() const { notImplemented(); return String(); }
PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&) { notImplemented(); return 0; }
+
+void prefetchDNS(const String& hostname) { notImplemented(); }
+
}
diff --git a/WebCore/platform/wx/ThreadingWx.cpp b/WebCore/platform/wx/ThreadingWx.cpp
deleted file mode 100644
index 7cb90ff..0000000
--- a/WebCore/platform/wx/ThreadingWx.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007 Kevin Ollivier
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "NotImplemented.h"
-#include "Threading.h"
-
-namespace WebCore {
-
-void callOnMainThread(MainThreadFunction*, void*)
-{
- notImplemented();
-}
-
-}
diff --git a/WebCore/platform/wx/WidgetWx.cpp b/WebCore/platform/wx/WidgetWx.cpp
index 9626c7f..37097fe 100755
--- a/WebCore/platform/wx/WidgetWx.cpp
+++ b/WebCore/platform/wx/WidgetWx.cpp
@@ -28,128 +28,67 @@
#include "Cursor.h"
#include "GraphicsContext.h"
#include "IntRect.h"
-#include "Font.h"
#include <wx/defs.h>
#include <wx/scrolwin.h>
namespace WebCore {
-class WidgetPrivate
+Widget::Widget(PlatformWidget widget)
{
-public:
- wxWindow* nativeWindow;
- Font font;
- WidgetClient* client;
-};
-
-Widget::Widget()
- : data(new WidgetPrivate)
-{
- data->nativeWindow = 0;
- data->client = 0;
-}
-
-Widget::Widget(wxWindow* win)
- : data(new WidgetPrivate)
-{
- setNativeWindow(win);
+ init(widget);
}
Widget::~Widget()
{
- delete data;
-}
-
-wxWindow* Widget::nativeWindow() const
-{
- return data->nativeWindow;
-}
-
-void Widget::setNativeWindow(wxWindow* win)
-{
- data->nativeWindow = win;
-}
-
-void Widget::setClient(WidgetClient* c)
-{
- data->client = c;
-}
-
-WidgetClient* Widget::client() const
-{
- return data->client;
-}
-
-IntRect Widget::frameGeometry() const
-{
- if (data->nativeWindow)
- return IntRect(data->nativeWindow->GetRect());
-
- return IntRect();
}
void Widget::setFocus()
{
- if (data->nativeWindow)
- data->nativeWindow->SetFocus();
+ if (platformWidget())
+ platformWidget()->SetFocus();
}
void Widget::setCursor(const Cursor& cursor)
{
- if (data->nativeWindow && cursor.impl())
- data->nativeWindow->SetCursor(*cursor.impl());
+ if (platformWidget() && cursor.impl())
+ platformWidget()->SetCursor(*cursor.impl());
}
void Widget::show()
{
- if (data->nativeWindow)
- data->nativeWindow->Show();
+ if (platformWidget())
+ platformWidget()->Show();
}
void Widget::hide()
{
- if (data->nativeWindow)
- data->nativeWindow->Hide();
+ if (platformWidget())
+ platformWidget()->Hide();
}
-void Widget::setFrameGeometry(const IntRect &rect)
+IntRect Widget::frameRect() const
{
- if (data->nativeWindow)
- data->nativeWindow->SetSize(rect);
+ if (platformWidget())
+ return platformWidget()->GetRect();
+ return m_frame;
}
-void Widget::setEnabled(bool enabled)
+void Widget::setFrameRect(const IntRect& rect)
{
- if (data->nativeWindow)
- data->nativeWindow->Enable(enabled);
-}
-
-bool Widget::isEnabled() const
-{
- if (data->nativeWindow)
- return data->nativeWindow->IsEnabled();
-
- return false;
-}
-
-void Widget::invalidate()
-{
- if (data->nativeWindow)
- data->nativeWindow->Refresh();
+ if (platformWidget())
+ platformWidget()->SetSize(rect);
+ m_frame = rect;
}
void Widget::invalidateRect(const IntRect& r)
{
- if (data->nativeWindow)
- data->nativeWindow->RefreshRect(r);
+ if (platformWidget())
+ platformWidget()->RefreshRect(r);
}
void Widget::paint(GraphicsContext*,const IntRect& r)
{
- invalidateRect(r);
- if (data->nativeWindow)
- data->nativeWindow->Update();
}
-} \ No newline at end of file
+}
diff --git a/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp
new file mode 100644
index 0000000..b86a9bc
--- /dev/null
+++ b/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 "GlyphBuffer.h"
+#include "GraphicsContext.h"
+#include "SimpleFontData.h"
+
+#include <wx/defs.h>
+#include <wx/dcclient.h>
+#include <wx/gdicmn.h>
+#include <vector>
+
+namespace WebCore {
+
+void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point)
+{
+#if USE(WXGC)
+ wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext());
+#else
+ wxDC* dc = graphicsContext->platformContext();
+#endif
+
+ wxFont wxfont = font->getWxFont();
+ if (wxfont.IsOk())
+ dc->SetFont(wxfont);
+ dc->SetTextForeground(color);
+
+ // convert glyphs to wxString
+ GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from));
+ int offset = point.x();
+ wxString text = wxEmptyString;
+ for (unsigned i = 0; i < numGlyphs; i++) {
+ text = text.Append((wxChar)glyphs[i]);
+ offset += glyphBuffer.advanceAt(from + i);
+ }
+
+ // the y point is actually the bottom point of the text, turn it into the top
+ float height = font->ascent() - font->descent();
+ wxCoord ypoint = (wxCoord) (point.y() - height);
+
+ dc->DrawText(text, (wxCoord)point.x(), ypoint);
+}
+
+}
diff --git a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
index 57eafad..b649eb4 100644
--- a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
+++ b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp
@@ -23,9 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if __WXMAC__
#include <ApplicationServices/ApplicationServices.h>
-#endif
#include <wx/defs.h>
#include <wx/gdicmn.h>
@@ -39,23 +37,38 @@ wxFontProperties::wxFontProperties(wxFont* font):
m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0)
{
ATSFontRef fontRef;
+ CGFontRef cgFont;
fontRef = FMGetATSFontRefFromFont(font->MacGetATSUFontID());
- if (fontRef){
- ATSFontMetrics vMetrics;
- OSStatus err;
+
+ if (fontRef)
+ cgFont = CGFontCreateWithPlatformFont((void*)&fontRef);
- int height = font->GetPointSize(); //.GetHeight();
- err = ATSFontGetHorizontalMetrics(fontRef, 0, &vMetrics);
- if (err != noErr)
- fprintf(stderr, "Error number is %d\n", err);
- m_ascent = lroundf(vMetrics.ascent * height);
- m_descent = lroundf(vMetrics.descent * height);
- m_lineGap = lroundf(vMetrics.leading * height);
+ if (cgFont) {
+ int iAscent;
+ int iDescent;
+ int iLineGap;
+ float unitsPerEm;
+#ifdef BUILDING_ON_TIGER
+ wkGetFontMetrics(cgFont, &iAscent, &iDescent, &iLineGap, &unitsPerEm);
+#else
+ iAscent = CGFontGetAscent(cgFont);
+ iDescent = CGFontGetDescent(cgFont);
+ iLineGap = CGFontGetLeading(cgFont);
+ unitsPerEm = CGFontGetUnitsPerEm(cgFont);
+#endif
+ float pointSize = font->GetPointSize();
+ float fAscent = scaleEmToUnits(iAscent, unitsPerEm) * pointSize;
+ float fDescent = -scaleEmToUnits(iDescent, unitsPerEm) * pointSize;
+ float fLineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize;
+
+ m_ascent = lroundf(fAscent);
+ m_descent = lroundf(fDescent);
+ m_lineGap = lroundf(fLineGap);
wxCoord xHeight = 0;
GetTextExtent(*font, wxT("x"), NULL, &xHeight, NULL, NULL);
m_xHeight = lroundf(xHeight);
- m_lineSpacing = m_ascent - m_descent + m_lineGap;
+ m_lineSpacing = m_ascent + m_descent + m_lineGap;
}
@@ -152,5 +165,10 @@ void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxC
if ( width )
*width = FixedToInt(textAfter - textBefore) ;
+#if SIZEOF_WCHAR_T == 4
+ free( ubuf ) ;
+#endif
+
::ATSUDisposeTextLayout(atsuLayout);
+ ::ATSUDisposeStyle((ATSUStyle)ATSUIStyle);
}
diff --git a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp
new file mode 100644
index 0000000..126f7ec
--- /dev/null
+++ b/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 "GlyphBuffer.h"
+#include "GraphicsContext.h"
+#include "SimpleFontData.h"
+
+#include <wx/defs.h>
+#include <wx/dcclient.h>
+#include <wx/gdicmn.h>
+#include <vector>
+
+namespace WebCore {
+
+void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point)
+{
+#if USE(WXGC)
+ wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext());
+#else
+ wxDC* dc = graphicsContext->platformContext();
+#endif
+
+ wxFont wxfont = font->getWxFont();
+ if (wxfont.IsOk())
+ dc->SetFont(wxfont);
+ dc->SetTextForeground(color);
+
+ // convert glyphs to wxString
+ GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from));
+ int offset = point.x();
+ wxString text = wxEmptyString;
+ for (unsigned i = 0; i < numGlyphs; i++) {
+ text = text.Append((wxChar)glyphs[i]);
+ offset += glyphBuffer.advanceAt(from + i);
+ }
+
+ // NOTE: The wx API actually adds the ascent to the y value internally,
+ // so we have to subtract it from the y point here so that the ascent
+ // isn't added twice.
+ dc->DrawText(text, (wxCoord)point.x(), int(point.y() - font->ascent()));
+}
+
+}
diff --git a/WebCore/platform/wx/PlatformScrollBar.h b/WebCore/platform/wx/wxcode/non-kerned-drawing.h
index 3dbb11b..d005985 100644
--- a/WebCore/platform/wx/PlatformScrollBar.h
+++ b/WebCore/platform/wx/wxcode/non-kerned-drawing.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -20,39 +20,17 @@
* 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 PlatformScrollbar_h
-#define PlatformScrollbar_h
-
-#include "Widget.h"
-#include "ScrollBar.h"
-
-namespace WebCore {
-
-class PlatformScrollbar : public Widget, public Scrollbar {
-public:
- PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
- virtual ~PlatformScrollbar();
-
- virtual bool isWidget() const { return true; }
-
- virtual int width() const;
- virtual int height() const;
- virtual void setRect(const IntRect&);
- virtual void setEnabled(bool);
- virtual void paint(GraphicsContext*, const IntRect& damageRect);
-
- static int horizontalScrollbarHeight() { return 17; }
- static int verticalScrollbarWidth() { return 17; }
-
-protected:
- virtual void updateThumbPosition();
- virtual void updateThumbProportion();
-};
-
-}
-
-#endif // PlatformScrollbar_h
-
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Font.h"
+#include "GlyphBuffer.h"
+
+#include <wx/defs.h>
+#include <wx/dcclient.h>
+
+namespace WebCore {
+
+extern void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point);
+
+}
diff --git a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp
new file mode 100644
index 0000000..f05923a
--- /dev/null
+++ b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 "GlyphBuffer.h"
+#include "GraphicsContext.h"
+#include "SimpleFontData.h"
+
+#include <wx/defs.h>
+#include <wx/dcclient.h>
+#include <wx/gdicmn.h>
+#include <vector>
+
+using namespace std;
+
+//-----------------------------------------------------------------------------
+// constants
+//-----------------------------------------------------------------------------
+
+const double RAD2DEG = 180.0 / M_PI;
+
+//-----------------------------------------------------------------------------
+// Local functions
+//-----------------------------------------------------------------------------
+
+static inline double dmin(double a, double b) { return a < b ? a : b; }
+static inline double dmax(double a, double b) { return a > b ? a : b; }
+
+static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
+static inline double RadToDeg(double deg) { return (deg * 180.0) / M_PI; }
+
+#include "wx/msw/private.h"
+
+// TODO remove this dependency (gdiplus needs the macros)
+
+#ifndef max
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#include "gdiplus.h"
+
+
+namespace WebCore {
+
+void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point)
+{
+#if USE(WXGC)
+ wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext());
+#else
+ wxDC* dc = graphicsContext->platformContext();
+#endif
+
+ // get the native HDC handle to draw using native APIs
+ HDC hdc = 0;
+#if USE(WXGC)
+ wxGraphicsContext* gc = dc->GetGraphicsContext();
+ Gdiplus::Graphics* g;
+ if (gc) {
+ g = (Gdiplus::Graphics*)gc->GetNativeContext();
+ hdc = g->GetHDC();
+ }
+#else
+ hdc = static_cast<HDC>(dc->GetHDC());
+#endif
+
+ // ExtTextOut wants the offsets as an array of ints, so extract them
+ // from the glyph buffer
+ const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
+ const GlyphBufferAdvance* advances = glyphBuffer.advances(from);
+
+ float y = point.y() - font->ascent();
+ float x = point.x();
+
+ int* spacing = new int[numGlyphs - from];
+ for (unsigned i = 0; i < numGlyphs; ++i)
+ spacing[i] = advances[i].width();
+
+ ::SelectObject(hdc, GetHfontOf(font->getWxFont()));
+
+ if (color.Ok())
+ ::SetTextColor(hdc, color.GetPixel());
+
+ // do not draw background behind characters
+ ::SetBkMode(hdc, TRANSPARENT);
+
+ // draw text with optional character widths array
+ wxString string = wxString((wxChar*)(&glyphs[from]), numGlyphs);
+ ::ExtTextOut(hdc, x, y, 0, NULL, string.c_str(), string.length(), spacing);
+
+ ::SetBkMode(hdc, TRANSPARENT);
+
+ #if USE(WXGC)
+ g->ReleaseHDC(hdc);
+ #endif
+
+ delete [] spacing;
+}
+
+}