summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-05 14:27:46 +0000
committerSteve Block <steveblock@google.com>2010-02-15 10:49:50 +0000
commit5e2bc6953fe6923165b8a5d7679939693a1d58d6 (patch)
tree6ccb8c24bc2bf5e8f413e6cfae250b729b426631 /WebCore/platform
parent4a00f4fccc3cb7e9996749a05631f5d7b9de756e (diff)
downloadexternal_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.zip
external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.tar.gz
external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.tar.bz2
Merge webkit.org at r54340 : Initial merge by git
Change-Id: Ib489d2ff91186ea3652522e1d586e54416a2cf44
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/KURL.cpp10
-rw-r--r--WebCore/platform/brew/FileChooserBrew.cpp53
-rw-r--r--WebCore/platform/brew/LocalizedStringsBrew.cpp397
-rw-r--r--WebCore/platform/brew/LoggingBrew.cpp45
-rw-r--r--WebCore/platform/brew/MIMETypeRegistryBrew.cpp80
-rw-r--r--WebCore/platform/brew/ScreenBrew.cpp96
-rw-r--r--WebCore/platform/brew/SharedTimerBrew.cpp80
-rw-r--r--WebCore/platform/brew/SoundBrew.cpp44
-rw-r--r--WebCore/platform/chromium/ThemeChromiumMac.mm93
-rw-r--r--WebCore/platform/graphics/GraphicsContext.h3
-rw-r--r--WebCore/platform/graphics/IntPoint.h9
-rw-r--r--WebCore/platform/graphics/IntSize.h9
-rw-r--r--WebCore/platform/graphics/MediaPlayer.cpp30
-rw-r--r--WebCore/platform/graphics/MediaPlayer.h13
-rw-r--r--WebCore/platform/graphics/MediaPlayerPrivate.h3
-rw-r--r--WebCore/platform/graphics/Path.h2
-rw-r--r--WebCore/platform/graphics/Pattern.cpp20
-rw-r--r--WebCore/platform/graphics/Pattern.h10
-rw-r--r--WebCore/platform/graphics/brew/IntPointBrew.cpp48
-rw-r--r--WebCore/platform/graphics/brew/IntSizeBrew.cpp48
-rw-r--r--WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp20
-rw-r--r--WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h2
-rw-r--r--WebCore/platform/graphics/cairo/PathCairo.cpp9
-rw-r--r--WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp15
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContextCG.cpp16
-rw-r--r--WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h2
-rw-r--r--WebCore/platform/graphics/cg/PathCG.cpp10
-rw-r--r--WebCore/platform/graphics/cg/TransformationMatrixCG.cpp11
-rw-r--r--WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp152
-rw-r--r--WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h8
-rw-r--r--WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp15
-rw-r--r--WebCore/platform/graphics/haiku/PathHaiku.cpp6
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp26
-rw-r--r--WebCore/platform/graphics/qt/PathQt.cpp10
-rw-r--r--WebCore/platform/graphics/qt/TransformationMatrixQt.cpp6
-rw-r--r--WebCore/platform/graphics/skia/GraphicsContextSkia.cpp27
-rw-r--r--WebCore/platform/graphics/skia/PathSkia.cpp6
-rw-r--r--WebCore/platform/graphics/skia/PatternSkia.cpp66
-rw-r--r--WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp21
-rw-r--r--WebCore/platform/graphics/transforms/AffineTransform.cpp325
-rw-r--r--WebCore/platform/graphics/transforms/AffineTransform.h170
-rw-r--r--WebCore/platform/graphics/win/GraphicsContextWin.cpp11
-rw-r--r--WebCore/platform/graphics/win/WKCACFLayer.cpp3
-rw-r--r--WebCore/platform/graphics/wince/GraphicsContextWince.cpp11
-rw-r--r--WebCore/platform/graphics/wx/GraphicsContextWx.cpp16
-rw-r--r--WebCore/platform/graphics/wx/PathWx.cpp9
-rw-r--r--WebCore/platform/graphics/wx/TransformationMatrixWx.cpp10
-rw-r--r--WebCore/platform/gtk/GOwnPtrGtk.cpp40
-rw-r--r--WebCore/platform/gtk/GOwnPtrGtk.h35
-rw-r--r--WebCore/platform/mac/ThemeMac.mm11
-rw-r--r--WebCore/platform/network/qt/SocketStreamHandlePrivate.h2
-rw-r--r--WebCore/platform/network/qt/SocketStreamHandleQt.cpp22
-rw-r--r--WebCore/platform/qt/RenderThemeQt.cpp22
-rw-r--r--WebCore/platform/qt/RenderThemeQt.h2
-rw-r--r--WebCore/platform/sql/SQLiteTransaction.cpp11
-rw-r--r--WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp41
-rw-r--r--WebCore/platform/wx/KeyEventWin.cpp157
57 files changed, 2130 insertions, 289 deletions
diff --git a/WebCore/platform/KURL.cpp b/WebCore/platform/KURL.cpp
index 9783bd8..79bb6e2 100644
--- a/WebCore/platform/KURL.cpp
+++ b/WebCore/platform/KURL.cpp
@@ -422,9 +422,9 @@ void KURL::init(const KURL& base, const String& relative, const TextEncoding& en
switch (str[0]) {
case '\0':
- // the reference must be empty - the RFC says this is a
- // reference to the same document
+ // The reference is empty, so this is a reference to the same document with any fragment identifier removed.
*this = base;
+ removeFragmentIdentifier();
break;
case '#': {
// must be fragment-only reference
@@ -1752,6 +1752,12 @@ bool portAllowed(const KURL& url)
3659, // apple-sasl / PasswordServer [Apple addition]
4045, // lockd
6000, // X11
+ 6665, // Alternate IRC [Apple addition]
+ 6666, // Alternate IRC [Apple addition]
+ 6667, // Standard IRC [Apple addition]
+ 6668, // Alternate IRC [Apple addition]
+ 6669, // Alternate IRC [Apple addition]
+
};
const unsigned short* const blockedPortListEnd = blockedPortList + sizeof(blockedPortList) / sizeof(blockedPortList[0]);
diff --git a/WebCore/platform/brew/FileChooserBrew.cpp b/WebCore/platform/brew/FileChooserBrew.cpp
new file mode 100644
index 0000000..79755bb
--- /dev/null
+++ b/WebCore/platform/brew/FileChooserBrew.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2009 Company 100 Inc.
+ *
+ * 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 "FileChooser.h"
+
+#include "FileSystem.h"
+#include "LocalizedStrings.h"
+#include "StringTruncator.h"
+
+namespace WebCore {
+
+String FileChooser::basenameForWidth(const Font& font, int width) const
+{
+ if (width <= 0)
+ return String();
+
+ String string;
+ if (m_filenames.isEmpty())
+ string = fileButtonNoFileSelectedLabel();
+ else if (m_filenames.size() == 1)
+ string = pathGetFileName(m_filenames[0]);
+ else
+ return StringTruncator::rightTruncate(String::number(m_filenames.size()) + " files", width, font, false);
+
+ return StringTruncator::centerTruncate(string, width, font, false);
+}
+
+}
diff --git a/WebCore/platform/brew/LocalizedStringsBrew.cpp b/WebCore/platform/brew/LocalizedStringsBrew.cpp
new file mode 100644
index 0000000..4588f0f
--- /dev/null
+++ b/WebCore/platform/brew/LocalizedStringsBrew.cpp
@@ -0,0 +1,397 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc. 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 "LocalizedStrings.h"
+
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+String submitButtonDefaultLabel()
+{
+ return "Submit";
+}
+
+String inputElementAltText()
+{
+ return String();
+}
+
+String resetButtonDefaultLabel()
+{
+ return "Reset";
+}
+
+String defaultLanguage()
+{
+ return "en";
+}
+
+String searchableIndexIntroduction()
+{
+ return "Searchable Index";
+}
+
+String fileButtonChooseFileLabel()
+{
+ return "Choose File";
+}
+
+String fileButtonNoFileSelectedLabel()
+{
+ return "No file selected";
+}
+
+String contextMenuItemTagOpenLinkInNewWindow()
+{
+ return "Open in new tab";
+}
+
+String contextMenuItemTagDownloadLinkToDisk()
+{
+ return "Download link to disk";
+}
+
+String contextMenuItemTagCopyLinkToClipboard()
+{
+ return "Copy link to clipboard";
+}
+
+String contextMenuItemTagOpenImageInNewWindow()
+{
+ return "Open image in new window";
+}
+
+String contextMenuItemTagDownloadImageToDisk()
+{
+ return "Download image to disk";
+}
+
+String contextMenuItemTagCopyImageToClipboard()
+{
+ return "Copy image to clipboard";
+}
+
+String contextMenuItemTagOpenFrameInNewWindow()
+{
+ return "Open frame in new window";
+}
+
+String contextMenuItemTagCopy()
+{
+ return "Copy";
+}
+
+String contextMenuItemTagGoBack()
+{
+ return "Go back";
+}
+
+String contextMenuItemTagGoForward()
+{
+ return "Go forward";
+}
+
+String contextMenuItemTagStop()
+{
+ return "Stop";
+}
+
+String contextMenuItemTagReload()
+{
+ return "Reload";
+}
+
+String contextMenuItemTagCut()
+{
+ return "Cut";
+}
+
+String contextMenuItemTagPaste()
+{
+ return "Paste";
+}
+
+String contextMenuItemTagNoGuessesFound()
+{
+ return "No guesses found";
+}
+
+String contextMenuItemTagIgnoreSpelling()
+{
+ return "Ignore spelling";
+}
+
+String contextMenuItemTagLearnSpelling()
+{
+ return "Learn spelling";
+}
+
+String contextMenuItemTagSearchWeb()
+{
+ return "Search web";
+}
+
+String contextMenuItemTagLookUpInDictionary()
+{
+ return "Lookup in dictionary";
+}
+
+String contextMenuItemTagOpenLink()
+{
+ return "Open link";
+}
+
+String contextMenuItemTagIgnoreGrammar()
+{
+ return "Ignore grammar";
+}
+
+String contextMenuItemTagSpellingMenu()
+{
+ return "Spelling menu";
+}
+
+String contextMenuItemTagShowSpellingPanel(bool show)
+{
+ return "Show spelling panel";
+}
+
+String contextMenuItemTagCheckSpelling()
+{
+ return "Check spelling";
+}
+
+String contextMenuItemTagCheckSpellingWhileTyping()
+{
+ return "Check spelling while typing";
+}
+
+String contextMenuItemTagCheckGrammarWithSpelling()
+{
+ return "Check for grammar with spelling";
+}
+
+String contextMenuItemTagFontMenu()
+{
+ return "Font menu";
+}
+
+String contextMenuItemTagBold()
+{
+ return "Bold";
+}
+
+String contextMenuItemTagItalic()
+{
+ return "Italic";
+}
+
+String contextMenuItemTagUnderline()
+{
+ return "Underline";
+}
+
+String contextMenuItemTagOutline()
+{
+ return "Outline";
+}
+
+String contextMenuItemTagWritingDirectionMenu()
+{
+ return "Writing direction menu";
+}
+
+String contextMenuItemTagDefaultDirection()
+{
+ return "Default direction";
+}
+
+String contextMenuItemTagLeftToRight()
+{
+ return "Left to right";
+}
+
+String contextMenuItemTagRightToLeft()
+{
+ return "Right to left";
+}
+
+String contextMenuItemTagInspectElement()
+{
+ return "Inspect";
+}
+
+String searchMenuNoRecentSearchesText()
+{
+ return "No recent text searches";
+}
+
+String searchMenuRecentSearchesText()
+{
+ return "Recent text searches";
+}
+
+String searchMenuClearRecentSearchesText()
+{
+ return "Clear recent text searches";
+}
+
+String unknownFileSizeText()
+{
+ return "Unknown";
+}
+
+String AXWebAreaText()
+{
+ return String();
+}
+
+String AXLinkText()
+{
+ return String();
+}
+
+String AXListMarkerText()
+{
+ return String();
+}
+
+String AXImageMapText()
+{
+ return String();
+}
+
+String AXHeadingText()
+{
+ return String();
+}
+
+String imageTitle(const String& filename, const IntSize& size)
+{
+ return String(filename);
+}
+
+String contextMenuItemTagTextDirectionMenu()
+{
+ return String();
+}
+
+String AXButtonActionVerb()
+{
+ return String();
+}
+
+String AXTextFieldActionVerb()
+{
+ return String();
+}
+
+String AXRadioButtonActionVerb()
+{
+ return String();
+}
+
+String AXCheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXUncheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXLinkActionVerb()
+{
+ return String();
+}
+
+String AXMenuListPopupActionVerb()
+{
+ return String();
+}
+
+String AXMenuListActionVerb()
+{
+ return String();
+}
+
+String AXDefinitionListTermText()
+{
+ return String();
+}
+
+String AXDefinitionListDefinitionText()
+{
+ return String();
+}
+
+String validationMessageValueMissingText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageTypeMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessagePatternMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageTooLongText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageRangeUnderflowText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageRangeOverflowText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageStepMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/brew/LoggingBrew.cpp b/WebCore/platform/brew/LoggingBrew.cpp
new file mode 100644
index 0000000..e8f79f7
--- /dev/null
+++ b/WebCore/platform/brew/LoggingBrew.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc.
+ *
+ * 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 "Logging.h"
+
+namespace WebCore {
+
+void InitializeLoggingChannelsIfNecessary()
+{
+ // FIXME: Should read the logging channels from a file.
+ static bool haveInitializedLoggingChannels = false;
+ if (haveInitializedLoggingChannels)
+ return;
+
+ haveInitializedLoggingChannels = true;
+
+ // By default we log calls to notImplemented().
+ LogNotYetImplemented.state = WTFLogChannelOn;
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/brew/MIMETypeRegistryBrew.cpp b/WebCore/platform/brew/MIMETypeRegistryBrew.cpp
new file mode 100644
index 0000000..d194116
--- /dev/null
+++ b/WebCore/platform/brew/MIMETypeRegistryBrew.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2009 Company 100, Inc.
+ *
+ * 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 "MIMETypeRegistry.h"
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+struct ExtensionMap {
+ const char* extension;
+ const char* mimeType;
+};
+
+static const ExtensionMap extensionMap[] = {
+ { "bmp", "image/bmp" },
+ { "css", "text/css" },
+ { "gif", "image/gif" },
+ { "html", "text/html" },
+ { "htm", "text/html" },
+ { "ico", "image/x-icon" },
+ { "jpeg", "image/jpeg" },
+ { "jpg", "image/jpeg" },
+ { "js", "application/x-javascript" },
+ { "pdf", "application/pdf" },
+ { "png", "image/png" },
+ { "rss", "application/rss+xml" },
+ { "svg", "image/svg+xml" },
+ { "text", "text/plain" },
+ { "txt", "text/plain" },
+ { "xbm", "image/x-xbitmap" },
+ { "xml", "text/xml" },
+ { "xsl", "text/xsl" },
+ { "xhtml", "application/xhtml+xml" },
+ { 0, 0 }
+};
+
+String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
+{
+ String str = ext.lower();
+
+ const ExtensionMap* e = extensionMap;
+ while (e->extension) {
+ if (str == e->extension)
+ return e->mimeType;
+ ++e;
+ }
+
+ // unknown, let's just assume plain text
+ return "text/plain";
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/brew/ScreenBrew.cpp b/WebCore/platform/brew/ScreenBrew.cpp
new file mode 100644
index 0000000..b141b34
--- /dev/null
+++ b/WebCore/platform/brew/ScreenBrew.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc. 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 "Screen.h"
+
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+#include "Page.h"
+#include "Widget.h"
+
+#include <AEEAppGen.h>
+#include <AEEStdLib.h>
+
+namespace WebCore {
+
+struct DisplayInfo {
+ int width;
+ int height;
+ int depth;
+};
+
+static void getDisplayInfo(DisplayInfo& info)
+{
+ IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay;
+ IBitmap* bitmap = IDisplay_GetDestination(display);
+ ASSERT(bitmap);
+
+ AEEBitmapInfo bitmapInfo;
+ IBitmap_GetInfo(bitmap, &bitmapInfo, sizeof(AEEBitmapInfo));
+
+ info.width = bitmapInfo.cx;
+ info.height = bitmapInfo.cy;
+ info.depth = bitmapInfo.nDepth;
+
+ IBitmap_Release(bitmap);
+}
+
+FloatRect screenRect(Widget*)
+{
+ DisplayInfo info;
+ getDisplayInfo(info);
+
+ return FloatRect(0, 0, info.width, info.height);
+}
+
+FloatRect screenAvailableRect(Widget* widget)
+{
+ return screenRect(widget);
+}
+
+int screenDepth(Widget*)
+{
+ DisplayInfo info;
+ getDisplayInfo(info);
+
+ return info.depth;
+}
+
+int screenDepthPerComponent(Widget* widget)
+{
+ return screenDepth(widget);
+}
+
+bool screenIsMonochrome(Widget*)
+{
+ return false;
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/brew/SharedTimerBrew.cpp b/WebCore/platform/brew/SharedTimerBrew.cpp
new file mode 100644
index 0000000..d20fe48
--- /dev/null
+++ b/WebCore/platform/brew/SharedTimerBrew.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2009 Company 100, Inc.
+ *
+ * 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 "SharedTimer.h"
+
+#include <AEEAppGen.h>
+#include <AEEStdLib.h>
+
+#include <wtf/CurrentTime.h>
+
+namespace WebCore {
+
+static void (*sharedTimerFiredFunction)();
+
+static AEECallback sharedTimerCallback;
+
+static void invokeCallback(void*)
+{
+ sharedTimerFiredFunction();
+}
+
+void setSharedTimerFiredFunction(void (*f)())
+{
+ sharedTimerFiredFunction = f;
+}
+
+void setSharedTimerFireTime(double fireTime)
+{
+ ASSERT(sharedTimerFiredFunction);
+
+ CALLBACK_Cancel(&sharedTimerCallback);
+
+ double interval = fireTime - currentTime();
+ int intervalInMS;
+
+ if (interval < 0)
+ intervalInMS = 0;
+ else {
+ interval *= 1000;
+ intervalInMS = static_cast<int>(interval);
+ }
+
+ sharedTimerCallback.pfnCancel = 0;
+ sharedTimerCallback.pfnNotify = invokeCallback;
+ sharedTimerCallback.pNotifyData = 0;
+
+ IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell;
+ ISHELL_SetTimerEx(shell, intervalInMS, &sharedTimerCallback);
+}
+
+void stopSharedTimer()
+{
+ CALLBACK_Cancel(&sharedTimerCallback);
+}
+
+}
diff --git a/WebCore/platform/brew/SoundBrew.cpp b/WebCore/platform/brew/SoundBrew.cpp
new file mode 100644
index 0000000..a616943
--- /dev/null
+++ b/WebCore/platform/brew/SoundBrew.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc. 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 "Sound.h"
+
+#include <AEEAppGen.h>
+#include <AEEStdLib.h>
+
+namespace WebCore {
+
+void systemBeep()
+{
+ // systemBeep is used by Editor to notify errors when a user cuts or pastes
+ // where these operations are not permitted.
+ // Use BEEP_ERROR with loud volume.
+ IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell;
+ ISHELL_Beep(shell, BEEP_ERROR, TRUE);
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/chromium/ThemeChromiumMac.mm b/WebCore/platform/chromium/ThemeChromiumMac.mm
index 3c97428..1c14207 100644
--- a/WebCore/platform/chromium/ThemeChromiumMac.mm
+++ b/WebCore/platform/chromium/ThemeChromiumMac.mm
@@ -21,7 +21,7 @@
* 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.
*/
#import "config.h"
@@ -115,19 +115,19 @@ static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& mi
static void updateStates(NSCell* cell, ControlStates states)
{
// Hover state is not supported by Aqua.
-
+
// Pressed state
bool oldPressed = [cell isHighlighted];
bool pressed = states & PressedState;
if (pressed != oldPressed)
[cell setHighlighted:pressed];
-
+
// Enabled state
bool oldEnabled = [cell isEnabled];
bool enabled = states & EnabledState;
if (enabled != oldEnabled)
[cell setEnabled:enabled];
-
+
// Focused state
bool oldFocused = [cell showsFirstResponder];
bool focused = states & FocusState;
@@ -141,7 +141,7 @@ static void updateStates(NSCell* cell, ControlStates states)
bool oldChecked = [cell state] == NSOnState;
if (oldIndeterminate != indeterminate || checked != oldChecked)
[cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSOffState)];
-
+
// Window Inactive state
NSControlTint oldTint = [cell controlTint];
bool windowInactive = (states & WindowInactiveState);
@@ -197,9 +197,9 @@ static LengthSize checkboxSize(const Font& font, const LengthSize& zoomedSize, f
return sizeFromFont(font, zoomedSize, zoomFactor, checkboxSizes());
}
-static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- static NSButtonCell* checkboxCell;
+ static NSButtonCell *checkboxCell;
if (!checkboxCell) {
checkboxCell = [[NSButtonCell alloc] init];
[checkboxCell setButtonType:NSSwitchButton];
@@ -207,13 +207,13 @@ static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, f
[checkboxCell setAllowsMixedState:YES];
[checkboxCell setFocusRingType:NSFocusRingTypeExterior];
}
-
+
// Set the control size based off the rectangle we're painting into.
setControlSize(checkboxCell, checkboxSizes(), zoomedRect.size(), zoomFactor);
// Update the various states we respond to.
updateStates(checkboxCell, states);
-
+
return checkboxCell;
}
@@ -223,7 +223,7 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const
BEGIN_BLOCK_OBJC_EXCEPTIONS
// Determine the width and height needed for the control and prepare the cell for painting.
- NSButtonCell* checkboxCell = checkbox(states, zoomedRect, zoomFactor);
+ NSButtonCell *checkboxCell = checkbox(states, zoomedRect, zoomFactor);
context->save();
@@ -232,7 +232,7 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor);
-
+
if (zoomFactor != 1.0f) {
inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
@@ -240,12 +240,12 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const
context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
-
+
[checkboxCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
[checkboxCell setControlView:nil];
context->restore();
-
+
END_BLOCK_OBJC_EXCEPTIONS
}
@@ -278,29 +278,29 @@ static LengthSize radioSize(const Font& font, const LengthSize& zoomedSize, floa
return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes());
}
-static NSButtonCell* radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+static NSButtonCell *radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- static NSButtonCell* radioCell;
+ static NSButtonCell *radioCell;
if (!radioCell) {
radioCell = [[NSButtonCell alloc] init];
[radioCell setButtonType:NSRadioButton];
[radioCell setTitle:nil];
[radioCell setFocusRingType:NSFocusRingTypeExterior];
}
-
+
// Set the control size based off the rectangle we're painting into.
setControlSize(radioCell, radioSizes(), zoomedRect.size(), zoomFactor);
// Update the various states we respond to.
updateStates(radioCell, states);
-
+
return radioCell;
}
static void paintRadio(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
{
// Determine the width and height needed for the control and prepare the cell for painting.
- NSButtonCell* radioCell = radio(states, zoomedRect, zoomFactor);
+ NSButtonCell *radioCell = radio(states, zoomedRect, zoomFactor);
context->save();
@@ -309,7 +309,7 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor);
-
+
if (zoomFactor != 1.0f) {
inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
@@ -317,7 +317,7 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int
context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
-
+
BEGIN_BLOCK_OBJC_EXCEPTIONS
[radioCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
[radioCell setControlView:nil];
@@ -335,6 +335,14 @@ static const IntSize* buttonSizes()
return sizes;
}
+#if ENABLE(DATALIST)
+static const IntSize* listButtonSizes()
+{
+ static const IntSize sizes[3] = { IntSize(21, 21), IntSize(19, 18), IntSize(17, 16) };
+ return sizes;
+}
+#endif
+
static const int* buttonMargins(NSControlSize controlSize)
{
static const int margins[3][4] =
@@ -346,17 +354,24 @@ static const int* buttonMargins(NSControlSize controlSize)
return margins[controlSize];
}
-static NSButtonCell* button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+static void setupButtonCell(NSButtonCell *&buttonCell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
- static NSButtonCell *buttonCell;
- static bool defaultButton;
if (!buttonCell) {
buttonCell = [[NSButtonCell alloc] init];
[buttonCell setTitle:nil];
[buttonCell setButtonType:NSMomentaryPushInButton];
+ if (states & DefaultState)
+ [buttonCell setKeyEquivalent:@"\r"];
}
// Set the control size based off the rectangle we're painting into.
+ const IntSize* sizes = buttonSizes();
+#if ENABLE(DATALIST)
+ if (part == ListButtonPart) {
+ [buttonCell setBezelStyle:NSRoundedDisclosureBezelStyle];
+ sizes = listButtonSizes();
+ } else
+#endif
if (part == SquareButtonPart || zoomedRect.height() > buttonSizes()[NSRegularControlSize].height() * zoomFactor) {
// Use the square button
if ([buttonCell bezelStyle] != NSShadowlessSquareBezelStyle)
@@ -364,29 +379,34 @@ static NSButtonCell* button(ControlPart part, ControlStates states, const IntRec
} else if ([buttonCell bezelStyle] != NSRoundedBezelStyle)
[buttonCell setBezelStyle:NSRoundedBezelStyle];
- setControlSize(buttonCell, buttonSizes(), zoomedRect.size(), zoomFactor);
-
- if (defaultButton != (states & DefaultState)) {
- defaultButton = !defaultButton;
- [buttonCell setKeyEquivalent:(defaultButton ? @"\r" : @"")];
- }
+ setControlSize(buttonCell, sizes, zoomedRect.size(), zoomFactor);
// Update the various states we respond to.
updateStates(buttonCell, states);
-
- return buttonCell;
+}
+
+static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
+{
+ bool isDefault = states & DefaultState;
+ static NSButtonCell *cells[2];
+ setupButtonCell(cells[isDefault], part, states, zoomedRect, zoomFactor);
+ return cells[isDefault];
}
static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
-
+
// Determine the width and height needed for the control and prepare the cell for painting.
NSButtonCell *buttonCell = button(part, states, zoomedRect, zoomFactor);
LocalCurrentGraphicsContext localContext(context);
NSControlSize controlSize = [buttonCell controlSize];
+#if ENABLE(DATALIST)
+ IntSize zoomedSize = (part == ListButtonPart ? listButtonSizes() : buttonSizes())[controlSize];
+#else
IntSize zoomedSize = buttonSizes()[controlSize];
+#endif
zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored.
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
IntRect inflatedRect = zoomedRect;
@@ -407,7 +427,7 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
- }
+ }
[buttonCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()];
[buttonCell setControlView:nil];
@@ -453,6 +473,10 @@ LengthSize ThemeChromiumMac::controlSize(ControlPart part, const Font& font, con
case PushButtonPart:
// Height is reset to auto so that specified heights can be ignored.
return sizeFromFont(font, LengthSize(zoomedSize.width(), Length()), zoomFactor, buttonSizes());
+#if ENABLE(DATALIST)
+ case ListButtonPart:
+ return sizeFromFont(font, LengthSize(zoomedSize.width(), Length()), zoomFactor, listButtonSizes());
+#endif
default:
return zoomedSize;
}
@@ -464,6 +488,7 @@ LengthSize ThemeChromiumMac::minimumControlSize(ControlPart part, const Font& fo
case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart:
+ case ListButtonPart:
return LengthSize(Length(0, Fixed), Length(static_cast<int>(15 * zoomFactor), Fixed));
default:
return Theme::minimumControlSize(part, font, zoomFactor);
@@ -476,6 +501,7 @@ LengthBox ThemeChromiumMac::controlBorder(ControlPart part, const Font& font, co
case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart:
+ case ListButtonPart:
return LengthBox(0, zoomedBox.right().value(), 0, zoomedBox.left().value());
default:
return Theme::controlBorder(part, font, zoomedBox, zoomFactor);
@@ -559,6 +585,7 @@ void ThemeChromiumMac::paint(ControlPart part, ControlStates states, GraphicsCon
case DefaultButtonPart:
case ButtonPart:
case SquareButtonPart:
+ case ListButtonPart:
paintButton(part, states, context, zoomedRect, zoomFactor, scrollView);
break;
default:
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 063c490..5199d93 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -119,6 +119,7 @@ namespace WebCore {
const int cMisspellingLinePatternWidth = 4;
const int cMisspellingLinePatternGapWidth = 1;
+ class AffineTransform;
class Font;
class Generator;
class Gradient;
@@ -339,7 +340,9 @@ namespace WebCore {
void setURLForRect(const KURL&, const IntRect&);
void concatCTM(const TransformationMatrix&);
+ void concatCTM(const AffineTransform&);
TransformationMatrix getCTM() const;
+ AffineTransform getAffineCTM() const;
#if OS(WINCE) && !PLATFORM(QT)
void setBitmap(PassRefPtr<SharedBitmap>);
diff --git a/WebCore/platform/graphics/IntPoint.h b/WebCore/platform/graphics/IntPoint.h
index ab5f3ec..5137485 100644
--- a/WebCore/platform/graphics/IntPoint.h
+++ b/WebCore/platform/graphics/IntPoint.h
@@ -63,6 +63,10 @@ class BPoint;
class wxPoint;
#endif
+#if PLATFORM(BREWMP)
+typedef struct _point AEEPoint;
+#endif
+
#if PLATFORM(SKIA)
struct SkPoint;
struct SkIPoint;
@@ -133,6 +137,11 @@ public:
operator wxPoint() const;
#endif
+#if PLATFORM(BREWMP)
+ IntPoint(const AEEPoint&);
+ operator AEEPoint() const;
+#endif
+
#if PLATFORM(SKIA)
IntPoint(const SkIPoint&);
operator SkIPoint() const;
diff --git a/WebCore/platform/graphics/IntSize.h b/WebCore/platform/graphics/IntSize.h
index 13d9e22..6938afd 100644
--- a/WebCore/platform/graphics/IntSize.h
+++ b/WebCore/platform/graphics/IntSize.h
@@ -55,6 +55,10 @@ class BSize;
class wxSize;
#endif
+#if PLATFORM(BREWMP)
+typedef struct AEESize AEESize;
+#endif
+
namespace WebCore {
class IntSize {
@@ -130,6 +134,11 @@ public:
operator wxSize() const;
#endif
+#if PLATFORM(BREWMP)
+ IntSize(const AEESize&);
+ operator AEESize() const;
+#endif
+
private:
int m_width, m_height;
};
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index aed9c95..2b09885 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -89,6 +89,9 @@ public:
virtual void setVolume(float) { }
+ virtual bool supportsMuting() const { return false; }
+ virtual void setMuted(bool) { }
+
virtual bool hasClosedCaptions() const { return false; }
virtual void setClosedCaptionsVisible(bool) { };
@@ -195,6 +198,7 @@ MediaPlayer::MediaPlayer(MediaPlayerClient* client)
, m_visible(false)
, m_rate(1.0f)
, m_volume(1.0f)
+ , m_muted(false)
, m_preservesPitch(true)
, m_autobuffer(false)
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
@@ -381,6 +385,22 @@ void MediaPlayer::setVolume(float volume)
m_private->setVolume(volume);
}
+bool MediaPlayer::muted() const
+{
+ return m_muted;
+}
+
+bool MediaPlayer::supportsMuting() const
+{
+ return m_private->supportsMuting();
+}
+
+void MediaPlayer::setMuted(bool muted)
+{
+ m_muted = muted;
+ m_private->setMuted(muted);
+}
+
bool MediaPlayer::hasClosedCaptions() const
{
return m_private->hasClosedCaptions();
@@ -544,12 +564,20 @@ void MediaPlayer::readyStateChanged()
m_mediaPlayerClient->mediaPlayerReadyStateChanged(this);
}
-void MediaPlayer::volumeChanged()
+void MediaPlayer::volumeChanged(float newVolume)
{
+ m_volume = newVolume;
if (m_mediaPlayerClient)
m_mediaPlayerClient->mediaPlayerVolumeChanged(this);
}
+void MediaPlayer::muteChanged(bool newMuted)
+{
+ m_muted = newMuted;
+ if (m_mediaPlayerClient)
+ m_mediaPlayerClient->mediaPlayerMuteChanged(this);
+}
+
void MediaPlayer::timeChanged()
{
if (m_mediaPlayerClient)
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index fa85cfd..40ed8ae 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -81,9 +81,12 @@ public:
// the ready state has changed
virtual void mediaPlayerReadyStateChanged(MediaPlayer*) { }
- // the volume or muted state has changed
+ // the volume state has changed
virtual void mediaPlayerVolumeChanged(MediaPlayer*) { }
+ // the mute state has changed
+ virtual void mediaPlayerMuteChanged(MediaPlayer*) { }
+
// time has jumped, eg. not as a result of normal playback
virtual void mediaPlayerTimeChanged(MediaPlayer*) { }
@@ -177,6 +180,10 @@ public:
float volume() const;
void setVolume(float);
+ bool supportsMuting() const;
+ bool muted() const;
+ void setMuted(bool);
+
bool hasClosedCaptions() const;
void setClosedCaptionsVisible(bool closedCaptionsVisible);
@@ -197,7 +204,8 @@ public:
void networkStateChanged();
void readyStateChanged();
- void volumeChanged();
+ void volumeChanged(float);
+ void muteChanged(bool);
void timeChanged();
void sizeChanged();
void rateChanged();
@@ -239,6 +247,7 @@ private:
bool m_visible;
float m_rate;
float m_volume;
+ bool m_muted;
bool m_preservesPitch;
bool m_autobuffer;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h
index 6cf12ba..3b7c4d4 100644
--- a/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -74,6 +74,9 @@ public:
virtual void setVolume(float) = 0;
+ virtual bool supportsMuting() const { return false; }
+ virtual void setMuted(bool) { }
+
virtual bool hasClosedCaptions() const { return false; }
virtual void setClosedCaptionsVisible(bool) { }
diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h
index 79d6cc4..aad6f3e 100644
--- a/WebCore/platform/graphics/Path.h
+++ b/WebCore/platform/graphics/Path.h
@@ -67,6 +67,7 @@ typedef PlatformPath* PlatformPathPtr;
namespace WebCore {
+ class AffineTransform;
class FloatPoint;
class FloatRect;
class FloatSize;
@@ -145,6 +146,7 @@ namespace WebCore {
static Path createLine(const FloatPoint&, const FloatPoint&);
void apply(void* info, PathApplierFunction) const;
+ void transform(const AffineTransform&);
void transform(const TransformationMatrix&);
private:
diff --git a/WebCore/platform/graphics/Pattern.cpp b/WebCore/platform/graphics/Pattern.cpp
index d388bd7..3409d16 100644
--- a/WebCore/platform/graphics/Pattern.cpp
+++ b/WebCore/platform/graphics/Pattern.cpp
@@ -35,12 +35,32 @@ Pattern::Pattern(Image* image, bool repeatX, bool repeatY)
: m_tileImage(image)
, m_repeatX(repeatX)
, m_repeatY(repeatY)
+#if PLATFORM(SKIA)
+ , m_pattern(0)
+#endif
{
ASSERT(image);
}
Pattern::~Pattern()
{
+ platformDestroy();
}
+void Pattern::setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation)
+{
+ m_patternSpaceTransformation = patternSpaceTransformation;
+ setPlatformPatternSpaceTransform();
+}
+
+#if !PLATFORM(SKIA)
+void Pattern::platformDestroy()
+{
+}
+
+void Pattern::setPlatformPatternSpaceTransform()
+{
+}
+#endif
+
}
diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h
index f7f612a..b0188b9 100644
--- a/WebCore/platform/graphics/Pattern.h
+++ b/WebCore/platform/graphics/Pattern.h
@@ -74,9 +74,16 @@ namespace WebCore {
Image* tileImage() const { return m_tileImage.get(); }
+ void platformDestroy();
+
// Pattern space is an abstract space that maps to the default user space by the transformation 'userSpaceTransformation'
+#if PLATFORM(SKIA)
+ PlatformPatternPtr platformPattern(const TransformationMatrix& userSpaceTransformation);
+#else
PlatformPatternPtr createPlatformPattern(const TransformationMatrix& userSpaceTransformation) const;
- void setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation) { m_patternSpaceTransformation = patternSpaceTransformation; }
+#endif
+ void setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation);
+ void setPlatformPatternSpaceTransform();
private:
Pattern(Image*, bool repeatX, bool repeatY);
@@ -85,6 +92,7 @@ namespace WebCore {
bool m_repeatX;
bool m_repeatY;
TransformationMatrix m_patternSpaceTransformation;
+ PlatformPatternPtr m_pattern;
};
} //namespace
diff --git a/WebCore/platform/graphics/brew/IntPointBrew.cpp b/WebCore/platform/graphics/brew/IntPointBrew.cpp
new file mode 100644
index 0000000..8792b1d
--- /dev/null
+++ b/WebCore/platform/graphics/brew/IntPointBrew.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc. 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 "IntPoint.h"
+
+#include <AEEPoint.h>
+
+namespace WebCore {
+
+IntPoint::IntPoint(const AEEPoint& point)
+ : m_x(point.x)
+ , m_y(point.y)
+{
+}
+
+IntPoint::operator AEEPoint() const
+{
+ AEEPoint point;
+ point.x = static_cast<int16>(m_x);
+ point.y = static_cast<int16>(m_y);
+ return point;
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/graphics/brew/IntSizeBrew.cpp b/WebCore/platform/graphics/brew/IntSizeBrew.cpp
new file mode 100644
index 0000000..01c3365
--- /dev/null
+++ b/WebCore/platform/graphics/brew/IntSizeBrew.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc. 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 "IntSize.h"
+
+#include <AEE.h>
+
+namespace WebCore {
+
+IntSize::IntSize(const AEESize& size)
+ : m_width(size.cx)
+ , m_height(size.cy)
+{
+}
+
+IntSize::operator AEESize() const
+{
+ AEESize size;
+ size.cx = width();
+ size.cy = height();
+ return size;
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index d866b6c..ccbbf3b 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -32,6 +32,7 @@
#if PLATFORM(CAIRO)
+#include "AffineTransform.h"
#include "CairoPath.h"
#include "FEGaussianBlur.h"
#include "FloatRect.h"
@@ -216,6 +217,14 @@ TransformationMatrix GraphicsContext::getCTM() const
return TransformationMatrix(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0);
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ cairo_t* cr = platformContext();
+ cairo_matrix_t m;
+ cairo_get_matrix(cr, &m);
+ return AffineTransform(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0);
+}
+
cairo_t* GraphicsContext::platformContext() const
{
return m_data->cr;
@@ -802,6 +811,17 @@ void GraphicsContext::concatCTM(const TransformationMatrix& transform)
m_data->concatCTM(transform);
}
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+
+ cairo_t* cr = m_data->cr;
+ const cairo_matrix_t matrix = cairo_matrix_t(transform);
+ cairo_transform(cr, &matrix);
+ m_data->concatCTM(transform);
+}
+
void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
index cedc684..5e38832 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
+++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
@@ -71,6 +71,7 @@ public:
void scale(const FloatSize&);
void rotate(float);
void translate(float, float);
+ void concatCTM(const AffineTransform&);
void concatCTM(const TransformationMatrix&);
void beginTransparencyLayer() { m_transparencyCount++; }
void endTransparencyLayer() { m_transparencyCount--; }
@@ -85,6 +86,7 @@ public:
void scale(const FloatSize&) {}
void rotate(float) {}
void translate(float, float) {}
+ void concatCTM(const AffineTransform&) {}
void concatCTM(const TransformationMatrix&) {}
void beginTransparencyLayer() {}
void endTransparencyLayer() {}
diff --git a/WebCore/platform/graphics/cairo/PathCairo.cpp b/WebCore/platform/graphics/cairo/PathCairo.cpp
index 8bde57e..a265937 100644
--- a/WebCore/platform/graphics/cairo/PathCairo.cpp
+++ b/WebCore/platform/graphics/cairo/PathCairo.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "Path.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "CairoPath.h"
#include "FloatRect.h"
@@ -326,6 +327,14 @@ void Path::apply(void* info, PathApplierFunction function) const
cairo_path_destroy(path);
}
+void Path::transform(const AffineTransform& trans)
+{
+ cairo_t* m_cr = platformPath()->m_cr;
+ cairo_matrix_t c_matrix = cairo_matrix_t(trans);
+ cairo_matrix_invert(&c_matrix);
+ cairo_transform(m_cr, &c_matrix);
+}
+
void Path::transform(const TransformationMatrix& trans)
{
cairo_t* m_cr = platformPath()->m_cr;
diff --git a/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp b/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp
index 1b83a29..c73dd02 100644
--- a/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp
+++ b/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp
@@ -23,6 +23,7 @@
*/
#include "config.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "IntRect.h"
@@ -46,6 +47,20 @@ TransformationMatrix::operator cairo_matrix_t() const
return m;
}
+AffineTransform::operator cairo_matrix_t() const
+{
+ cairo_matrix_t m;
+
+ cairo_matrix_init (&m,
+ a(),
+ b(),
+ c(),
+ d(),
+ e(),
+ f());
+ return m;
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index b11ba66..a339982 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "GraphicsContext.h"
+#include "AffineTransform.h"
#include "FloatConversion.h"
#include "GraphicsContextPlatformPrivateCG.h"
#include "GraphicsContextPrivate.h"
@@ -958,6 +959,15 @@ void GraphicsContext::translate(float x, float y)
m_data->m_userToDeviceTransformKnownToBeIdentity = false;
}
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+ CGContextConcatCTM(platformContext(), transform);
+ m_data->concatCTM(transform);
+ m_data->m_userToDeviceTransformKnownToBeIdentity = false;
+}
+
void GraphicsContext::concatCTM(const TransformationMatrix& transform)
{
if (paintingDisabled())
@@ -967,6 +977,12 @@ void GraphicsContext::concatCTM(const TransformationMatrix& transform)
m_data->m_userToDeviceTransformKnownToBeIdentity = false;
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ CGAffineTransform t = CGContextGetCTM(platformContext());
+ return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty);
+}
+
TransformationMatrix GraphicsContext::getCTM() const
{
CGAffineTransform t = CGContextGetCTM(platformContext());
diff --git a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
index ff1816f..7b80d5b 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
+++ b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
@@ -73,6 +73,7 @@ public:
void scale(const FloatSize&) {}
void rotate(float) {}
void translate(float, float) {}
+ void concatCTM(const AffineTransform&) {}
void concatCTM(const TransformationMatrix&) {}
void beginTransparencyLayer() {}
void endTransparencyLayer() {}
@@ -88,6 +89,7 @@ public:
void scale(const FloatSize&);
void rotate(float);
void translate(float, float);
+ void concatCTM(const AffineTransform&);
void concatCTM(const TransformationMatrix&);
void beginTransparencyLayer() { m_transparencyCount++; }
void endTransparencyLayer() { m_transparencyCount--; }
diff --git a/WebCore/platform/graphics/cg/PathCG.cpp b/WebCore/platform/graphics/cg/PathCG.cpp
index 3b05641..01680df 100644
--- a/WebCore/platform/graphics/cg/PathCG.cpp
+++ b/WebCore/platform/graphics/cg/PathCG.cpp
@@ -29,6 +29,7 @@
#if PLATFORM(CG)
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include <ApplicationServices/ApplicationServices.h>
#include "FloatRect.h"
@@ -346,6 +347,15 @@ void Path::apply(void* info, PathApplierFunction function) const
CGPathApply(m_path, &pinfo, CGPathApplierToPathApplier);
}
+void Path::transform(const AffineTransform& transform)
+{
+ CGMutablePathRef path = CGPathCreateMutable();
+ CGAffineTransform transformCG = transform;
+ CGPathAddPath(path, &transformCG, m_path);
+ CGPathRelease(m_path);
+ m_path = path;
+}
+
void Path::transform(const TransformationMatrix& transform)
{
CGMutablePathRef path = CGPathCreateMutable();
diff --git a/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp b/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp
index 568a6b3..5fe2122 100644
--- a/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp
+++ b/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp
@@ -24,6 +24,7 @@
*/
#include "config.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#if PLATFORM(CG)
@@ -43,6 +44,16 @@ TransformationMatrix::operator CGAffineTransform() const
narrowPrecisionToCGFloat(f()));
}
+AffineTransform::operator CGAffineTransform() const
+{
+ return CGAffineTransformMake(narrowPrecisionToCGFloat(a()),
+ narrowPrecisionToCGFloat(b()),
+ narrowPrecisionToCGFloat(c()),
+ narrowPrecisionToCGFloat(d()),
+ narrowPrecisionToCGFloat(e()),
+ narrowPrecisionToCGFloat(f()));
+}
+
}
#endif // PLATFORM(CG)
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
index 41f90f0..0372021 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
@@ -32,6 +32,7 @@
#include "Document.h"
#include "Frame.h"
#include "FrameView.h"
+#include "GOwnPtrGtk.h"
#include "GraphicsContext.h"
#include "IntRect.h"
#include "KURL.h"
@@ -131,63 +132,87 @@ gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpo
void mediaPlayerPrivateSourceChangedCallback(GObject *object, GParamSpec *pspec, gpointer data)
{
MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
- GstElement* element;
+ GOwnPtr<GstElement> element;
- g_object_get(mp->m_playBin, "source", &element, NULL);
- gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element);
+ g_object_get(mp->m_playBin, "source", &element.outPtr(), NULL);
+ gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element.get());
- if (element) {
- GParamSpec* pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(element), "cookies");
+ if (!element)
+ return;
- // First check if the source element has a cookies property
- // of the format we expect
- if (!pspec || pspec->value_type != G_TYPE_STRV)
- return;
+ GOwnPtr<char> location;
+ g_object_get(element.get(), "location", &location.outPtr(), NULL);
- // Then get the cookies for the URI and set them
- SoupSession* session = webkit_get_default_session();
- SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
+ // Do injection only for elements dealing with uris.
+ if (!gst_uri_is_valid(location.get()))
+ return;
- char* location;
- g_object_get(element, "location", &location, NULL);
+ GOwnPtr<SoupURI> uri(soup_uri_new(location.get()));
- SoupURI* uri = soup_uri_new(location);
- g_free(location);
+ // Do injection only for http(s) uris.
+ if (!SOUP_URI_VALID_FOR_HTTP(uri))
+ return;
- // Let Apple web servers know we want to access their nice movie trailers.
- if (g_str_equal(uri->host, "movies.apple.com"))
- g_object_set(element, "user-agent", "Quicktime/7.2.0", NULL);
+ // Let Apple web servers know we want to access their nice movie trailers.
+ if (g_str_equal(uri->host, "movies.apple.com"))
+ g_object_set(element.get(), "user-agent", "Quicktime/7.2.0", NULL);
+
+ // Set the HTTP referer.
+ Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0;
+ Document* document = frame ? frame->document() : 0;
+ if (document) {
+ GstStructure* extraHeaders = gst_structure_new("extra-headers",
+ "Referer", G_TYPE_STRING,
+ document->documentURI().utf8().data(), 0);
+ g_object_set(element.get(), "extra-headers", extraHeaders, NULL);
+ gst_structure_free(extraHeaders);
+ }
- char* cookies = soup_cookie_jar_get_cookies(cookieJar, uri, FALSE);
- soup_uri_free(uri);
+ // Deal with the cookies from now on.
+ GParamSpec* cookiesParamSpec = g_object_class_find_property(G_OBJECT_GET_CLASS(element.get()), "cookies");
- char* cookiesStrv[] = {cookies, NULL};
- g_object_set(element, "cookies", cookiesStrv, NULL);
- g_free(cookies);
+ // First check if the source element has a cookies property
+ // of the format we expect
+ if (!cookiesParamSpec || cookiesParamSpec->value_type != G_TYPE_STRV)
+ return;
- Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0;
- Document* document = frame ? frame->document() : 0;
- if (document) {
- GstStructure* extraHeaders = gst_structure_new("extra-headers",
- "Referer", G_TYPE_STRING,
- document->documentURI().utf8().data(), 0);
- g_object_set(element, "extra-headers", extraHeaders, NULL);
- gst_structure_free(extraHeaders);
- }
- }
+ // Then get the cookies for the URI and set them
+ SoupSession* session = webkit_get_default_session();
+ SoupSessionFeature* cookieJarFeature = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR);
+ if (!cookieJarFeature)
+ return;
- gst_object_unref(element);
+ SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(cookieJarFeature);
+ GOwnPtr<char> cookies(soup_cookie_jar_get_cookies(cookieJar, uri.get(), FALSE));
+ char* cookiesStrv[] = {cookies.get(), 0};
+ g_object_set(element.get(), "cookies", cookiesStrv, NULL);
}
void mediaPlayerPrivateVolumeChangedCallback(GObject *element, GParamSpec *pspec, gpointer data)
{
+ // This is called when playbin receives the notify::volume signal.
MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
mp->volumeChanged();
}
-gboolean notifyVolumeIdleCallback(MediaPlayer* mp)
+gboolean notifyVolumeIdleCallback(gpointer data)
{
- mp->volumeChanged();
+ MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
+ mp->volumeChangedCallback();
+ return FALSE;
+}
+
+void mediaPlayerPrivateMuteChangedCallback(GObject *element, GParamSpec *pspec, gpointer data)
+{
+ // This is called when playbin receives the notify::mute signal.
+ MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
+ mp->muteChanged();
+}
+
+gboolean notifyMuteIdleCallback(gpointer data)
+{
+ MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
+ mp->muteChangedCallback();
return FALSE;
}
@@ -291,8 +316,9 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
, m_seeking(false)
, m_playbackRate(1)
, m_errorOccured(false)
- , m_volumeIdleId(-1)
+ , m_volumeIdleId(0)
, m_mediaDuration(0.0)
+ , m_muteIdleId(0)
{
doGstInit();
}
@@ -301,7 +327,12 @@ MediaPlayerPrivate::~MediaPlayerPrivate()
{
if (m_volumeIdleId) {
g_source_remove(m_volumeIdleId);
- m_volumeIdleId = -1;
+ m_volumeIdleId = 0;
+ }
+
+ if (m_muteIdleId) {
+ g_source_remove(m_muteIdleId);
+ m_muteIdleId = 0;
}
if (m_buffer)
@@ -532,16 +563,20 @@ void MediaPlayerPrivate::setVolume(float volume)
g_object_set(m_playBin, "volume", static_cast<double>(volume), NULL);
}
+void MediaPlayerPrivate::volumeChangedCallback()
+{
+ double volume;
+ g_object_get(m_playBin, "volume", &volume, NULL);
+ m_player->volumeChanged(static_cast<float>(volume));
+}
+
void MediaPlayerPrivate::volumeChanged()
{
- if (m_volumeIdleId) {
+ if (m_volumeIdleId)
g_source_remove(m_volumeIdleId);
- m_volumeIdleId = -1;
- }
- m_volumeIdleId = g_idle_add((GSourceFunc) notifyVolumeIdleCallback, m_player);
+ m_volumeIdleId = g_idle_add((GSourceFunc) notifyVolumeIdleCallback, this);
}
-
void MediaPlayerPrivate::setRate(float rate)
{
// Avoid useless playback rate update.
@@ -922,6 +957,34 @@ void MediaPlayerPrivate::durationChanged()
m_player->durationChanged();
}
+bool MediaPlayerPrivate::supportsMuting() const
+{
+ return true;
+}
+
+void MediaPlayerPrivate::setMuted(bool muted)
+{
+ if (!m_playBin)
+ return;
+
+ g_object_set(m_playBin, "mute", muted, NULL);
+}
+
+void MediaPlayerPrivate::muteChangedCallback()
+{
+ gboolean muted;
+ g_object_get(m_playBin, "mute", &muted, NULL);
+ m_player->muteChanged(static_cast<bool>(muted));
+}
+
+void MediaPlayerPrivate::muteChanged()
+{
+ if (m_muteIdleId)
+ g_source_remove(m_muteIdleId);
+
+ m_muteIdleId = g_idle_add((GSourceFunc) notifyMuteIdleCallback, this);
+}
+
void MediaPlayerPrivate::loadingFailed(MediaPlayer::NetworkState error)
{
m_errorOccured = true;
@@ -1140,6 +1203,7 @@ void MediaPlayerPrivate::createGSTPlayBin(String url)
g_signal_connect(m_playBin, "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
g_signal_connect(m_playBin, "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this);
+ g_signal_connect(m_playBin, "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this);
m_videoSink = webkit_video_sink_new();
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h
index ec55b29..34257ca 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h
@@ -76,8 +76,15 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
void seek(float);
void setRate(float);
+
void setVolume(float);
void volumeChanged();
+ void volumeChangedCallback();
+
+ bool supportsMuting() const;
+ void setMuted(bool);
+ void muteChanged();
+ void muteChangedCallback();
MediaPlayer::NetworkState networkState() const;
MediaPlayer::ReadyState readyState() const;
@@ -149,6 +156,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
bool m_errorOccured;
guint m_volumeIdleId;
gfloat m_mediaDuration;
+ guint m_muteIdleId;
};
}
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 6038c6a..3970ebc 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "GraphicsContext.h"
+#include "AffineTransform.h"
#include "CString.h"
#include "Color.h"
#include "Font.h"
@@ -391,6 +392,12 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
notImplemented();
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ notImplemented();
+ return AffineTransform();
+}
+
TransformationMatrix GraphicsContext::getCTM() const
{
notImplemented();
@@ -451,6 +458,14 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
notImplemented();
}
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+
+ notImplemented();
+}
+
void GraphicsContext::concatCTM(const TransformationMatrix& transform)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/haiku/PathHaiku.cpp b/WebCore/platform/graphics/haiku/PathHaiku.cpp
index d0da025..70dad29 100644
--- a/WebCore/platform/graphics/haiku/PathHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/PathHaiku.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "Path.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "NotImplemented.h"
#include "PlatformString.h"
@@ -146,6 +147,11 @@ void Path::apply(void* info, PathApplierFunction function) const
notImplemented();
}
+void Path::transform(const AffineTransform& transform)
+{
+ notImplemented();
+}
+
void Path::transform(const TransformationMatrix& transform)
{
notImplemented();
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index b78a6e8..9046449 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -40,6 +40,7 @@
#include <windows.h>
#endif
+#include "AffineTransform.h"
#include "Color.h"
#include "FloatConversion.h"
#include "Font.h"
@@ -275,6 +276,13 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const
return m_data->p();
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ QTransform matrix(platformContext()->combinedTransform());
+ return AffineTransform(matrix.m11(), matrix.m12(), matrix.m21(),
+ matrix.m22(), matrix.dx(), matrix.dy());
+}
+
TransformationMatrix GraphicsContext::getCTM() const
{
QTransform matrix(platformContext()->combinedTransform());
@@ -1188,6 +1196,24 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect,
p->setRenderHint(QPainter::Antialiasing, antiAlias);
}
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+
+ m_data->p()->setWorldTransform(transform, true);
+
+ // Transformations to the context shouldn't transform the currentPath.
+ // We have to undo every change made to the context from the currentPath
+ // to avoid wrong drawings.
+ if (!m_data->currentPath.isEmpty() && transform.isInvertible()) {
+ QTransform matrix = transform.inverse();
+ m_data->currentPath = m_data->currentPath * matrix;
+ m_common->state.pathTransform.multiply(transform.toTransformationMatrix());
+ }
+}
+
+
void GraphicsContext::concatCTM(const TransformationMatrix& transform)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp
index 4716d32..2721984 100644
--- a/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/WebCore/platform/graphics/qt/PathQt.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* 2006 Rob Buis <buis@kde.org>
- * 2009 Dirk Schulze <krit@webkit.org>
+ * 2009, 2010 Dirk Schulze <krit@webkit.org>
*
* All rights reserved.
*
@@ -30,12 +30,13 @@
#include "config.h"
#include "Path.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "PlatformString.h"
#include "StrokeStyleApplier.h"
+#include "TransformationMatrix.h"
#include <QPainterPath>
#include <QTransform>
#include <QString>
@@ -379,6 +380,11 @@ void Path::apply(void* info, PathApplierFunction function) const
}
}
+void Path::transform(const AffineTransform& transform)
+{
+ m_path = QTransform(transform).map(m_path);
+}
+
void Path::transform(const TransformationMatrix& transform)
{
m_path = QTransform(transform).map(m_path);
diff --git a/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp b/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
index 37b86f3..a5bc3c3 100644
--- a/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
+++ b/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
@@ -24,6 +24,7 @@
*/
#include "config.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "IntRect.h"
@@ -36,6 +37,11 @@ TransformationMatrix::operator QTransform() const
return QTransform(m11(), m12(), m14(), m21(), m22(), m24(), m41(), m42(), m44());
}
+AffineTransform::operator QTransform() const
+{
+ return QTransform(a(), b(), c(), d(), e(), f());
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 985442c..bd97ca2 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#include "GraphicsContext.h"
+#include "AffineTransform.h"
#include "Color.h"
#include "FloatRect.h"
#include "Gradient.h"
@@ -439,6 +440,13 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect,
#endif
}
+void GraphicsContext::concatCTM(const AffineTransform& affine)
+{
+ if (paintingDisabled())
+ return;
+ platformContext()->canvas()->concat(affine);
+}
+
void GraphicsContext::concatCTM(const TransformationMatrix& xform)
{
if (paintingDisabled())
@@ -805,6 +813,17 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect,
platformContext()->canvas()->drawPath(path, paint);
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ const SkMatrix& m = platformContext()->canvas()->getTotalMatrix();
+ return AffineTransform(SkScalarToDouble(m.getScaleX()), // a
+ SkScalarToDouble(m.getSkewY()), // b
+ SkScalarToDouble(m.getSkewX()), // c
+ SkScalarToDouble(m.getScaleY()), // d
+ SkScalarToDouble(m.getTranslateX()), // e
+ SkScalarToDouble(m.getTranslateY())); // f
+}
+
TransformationMatrix GraphicsContext::getCTM() const
{
const SkMatrix& m = platformContext()->canvas()->getTotalMatrix();
@@ -978,9 +997,7 @@ void GraphicsContext::setPlatformFillPattern(Pattern* pattern)
if (paintingDisabled())
return;
- SkShader* pat = pattern->createPlatformPattern(getCTM());
- platformContext()->setFillShader(pat);
- pat->safeUnref();
+ platformContext()->setFillShader(pattern->platformPattern(getCTM()));
}
void GraphicsContext::setPlatformShadow(const IntSize& size,
@@ -1065,9 +1082,7 @@ void GraphicsContext::setPlatformStrokePattern(Pattern* pattern)
if (paintingDisabled())
return;
- SkShader* pat = pattern->createPlatformPattern(getCTM());
- platformContext()->setStrokeShader(pat);
- pat->safeUnref();
+ platformContext()->setStrokeShader(pattern->platformPattern(getCTM()));
}
void GraphicsContext::setPlatformTextDrawingMode(int mode)
diff --git a/WebCore/platform/graphics/skia/PathSkia.cpp b/WebCore/platform/graphics/skia/PathSkia.cpp
index 2cbb759..fe4c3d0 100644
--- a/WebCore/platform/graphics/skia/PathSkia.cpp
+++ b/WebCore/platform/graphics/skia/PathSkia.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "Path.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "ImageBuffer.h"
#include "StrokeStyleApplier.h"
@@ -214,6 +215,11 @@ void Path::apply(void* info, PathApplierFunction function) const
}
}
+void Path::transform(const AffineTransform& xform)
+{
+ m_path->transform(xform);
+}
+
void Path::transform(const TransformationMatrix& xform)
{
m_path->transform(xform);
diff --git a/WebCore/platform/graphics/skia/PatternSkia.cpp b/WebCore/platform/graphics/skia/PatternSkia.cpp
index 11b5cf1..b98825b 100644
--- a/WebCore/platform/graphics/skia/PatternSkia.cpp
+++ b/WebCore/platform/graphics/skia/PatternSkia.cpp
@@ -40,8 +40,17 @@
namespace WebCore {
-PlatformPatternPtr Pattern::createPlatformPattern(const TransformationMatrix& patternTransform) const
+void Pattern::platformDestroy()
{
+ m_pattern->safeUnref();
+ m_pattern = 0;
+}
+
+PlatformPatternPtr Pattern::platformPattern(const TransformationMatrix& patternTransform)
+{
+ if (m_pattern)
+ return m_pattern;
+
// Note: patternTransform is ignored since it seems to be applied elsewhere
// (when the pattern is used?). Applying it to the pattern (i.e.
// shader->setLocalMatrix) results in a double transformation. This can be
@@ -53,31 +62,42 @@ PlatformPatternPtr Pattern::createPlatformPattern(const TransformationMatrix& pa
SkBitmap* bm = m_tileImage->nativeImageForCurrentFrame();
// If we don't have a bitmap, return a transparent shader.
if (!bm)
- return new SkColorShader(SkColorSetARGB(0, 0, 0, 0));
+ m_pattern = new SkColorShader(SkColorSetARGB(0, 0, 0, 0));
- if (m_repeatX && m_repeatY)
- return SkShader::CreateBitmapShader(*bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);
+ else if (m_repeatX && m_repeatY)
+ m_pattern = SkShader::CreateBitmapShader(*bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);
- // Skia does not have a "draw the tile only once" option. Clamp_TileMode
- // repeats the last line of the image after drawing one tile. To avoid
- // filling the space with arbitrary pixels, this workaround forces the
- // image to have a line of transparent pixels on the "repeated" edge(s),
- // thus causing extra space to be transparent filled.
- SkShader::TileMode tileModeX = m_repeatX ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode;
- SkShader::TileMode tileModeY = m_repeatY ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode;
- int expandW = m_repeatX ? 0 : 1;
- int expandH = m_repeatY ? 0 : 1;
+ else {
- // Create a transparent bitmap 1 pixel wider and/or taller than the
- // original, then copy the orignal into it.
- // FIXME: Is there a better way to pad (not scale) an image in skia?
- SkBitmap bm2;
- bm2.setConfig(bm->config(), bm->width() + expandW, bm->height() + expandH);
- bm2.allocPixels();
- bm2.eraseARGB(0x00, 0x00, 0x00, 0x00);
- SkCanvas canvas(bm2);
- canvas.drawBitmap(*bm, 0, 0);
- return SkShader::CreateBitmapShader(bm2, tileModeX, tileModeY);
+ // Skia does not have a "draw the tile only once" option. Clamp_TileMode
+ // repeats the last line of the image after drawing one tile. To avoid
+ // filling the space with arbitrary pixels, this workaround forces the
+ // image to have a line of transparent pixels on the "repeated" edge(s),
+ // thus causing extra space to be transparent filled.
+ SkShader::TileMode tileModeX = m_repeatX ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode;
+ SkShader::TileMode tileModeY = m_repeatY ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode;
+ int expandW = m_repeatX ? 0 : 1;
+ int expandH = m_repeatY ? 0 : 1;
+
+ // Create a transparent bitmap 1 pixel wider and/or taller than the
+ // original, then copy the orignal into it.
+ // FIXME: Is there a better way to pad (not scale) an image in skia?
+ SkBitmap bm2;
+ bm2.setConfig(bm->config(), bm->width() + expandW, bm->height() + expandH);
+ bm2.allocPixels();
+ bm2.eraseARGB(0x00, 0x00, 0x00, 0x00);
+ SkCanvas canvas(bm2);
+ canvas.drawBitmap(*bm, 0, 0);
+ m_pattern = SkShader::CreateBitmapShader(bm2, tileModeX, tileModeY);
+ }
+ m_pattern->setLocalMatrix(m_patternSpaceTransformation);
+ return m_pattern;
+}
+
+void Pattern::setPlatformPatternSpaceTransform()
+{
+ if (m_pattern)
+ m_pattern->setLocalMatrix(m_patternSpaceTransformation);
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp b/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp
index 2d0f9f8..dc610d7 100644
--- a/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp
+++ b/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp
@@ -28,6 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "config.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "SkiaUtils.h"
@@ -54,4 +55,24 @@ TransformationMatrix::operator SkMatrix() const
return result;
}
+AffineTransform::operator SkMatrix() const
+{
+ SkMatrix result;
+
+ result.setScaleX(WebCoreDoubleToSkScalar(a()));
+ result.setSkewX(WebCoreDoubleToSkScalar(c()));
+ result.setTranslateX(WebCoreDoubleToSkScalar(e()));
+
+ result.setScaleY(WebCoreDoubleToSkScalar(d()));
+ result.setSkewY(WebCoreDoubleToSkScalar(b()));
+ result.setTranslateY(WebCoreDoubleToSkScalar(f()));
+
+ // FIXME: Set perspective properly.
+ result.setPerspX(0);
+ result.setPerspY(0);
+ result.set(SkMatrix::kMPersp2, SK_Scalar1);
+
+ return result;
+}
+
} // namespace WebCore
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.cpp b/WebCore/platform/graphics/transforms/AffineTransform.cpp
new file mode 100644
index 0000000..f26bcb7
--- /dev/null
+++ b/WebCore/platform/graphics/transforms/AffineTransform.cpp
@@ -0,0 +1,325 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * 2010 Dirk Schulze <krit@webkit.org>
+ *
+ * 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 "AffineTransform.h"
+
+#include "FloatConversion.h"
+#include "FloatQuad.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+static void affineTransformDecompose(const AffineTransform& matrix, double sr[9])
+{
+ AffineTransform m(matrix);
+
+ // Compute scaling factors
+ double sx = sqrt(m.a() * m.a() + m.b() * m.b());
+ double sy = sqrt(m.c() * m.c() + m.d() * m.d());
+
+ // Compute cross product of transformed unit vectors. If negative,
+ // one axis was flipped.
+ if (m.a() * m.d() - m.c() * m.b() < 0.0) {
+ // Flip axis with minimum unit vector dot product
+ if (m.a() < m.d())
+ sx = -sx;
+ else
+ sy = -sy;
+ }
+
+ // Remove scale from matrix
+ m.scale(1.0 / sx, 1.0 / sy);
+
+ // Compute rotation
+ double angle = atan2(m.b(), m.a());
+
+ // Remove rotation from matrix
+ m.rotate(rad2deg(-angle));
+
+ // Return results
+ sr[0] = sx;
+ sr[1] = sy;
+ sr[2] = angle;
+ sr[3] = m.a();
+ sr[4] = m.b();
+ sr[5] = m.c();
+ sr[6] = m.d();
+ sr[7] = m.e();
+ sr[8] = m.f();
+}
+
+static void affineTransformCompose(AffineTransform& m, const double sr[9])
+{
+ m.setA(sr[3]);
+ m.setB(sr[4]);
+ m.setC(sr[5]);
+ m.setD(sr[6]);
+ m.setE(sr[7]);
+ m.setF(sr[8]);
+ m.rotate(rad2deg(sr[2]));
+ m.scale(sr[0], sr[1]);
+}
+
+AffineTransform::AffineTransform()
+{
+ setMatrix(1, 0, 0, 1, 0, 0);
+}
+
+AffineTransform::AffineTransform(double a, double b, double c, double d, double e, double f)
+{
+ setMatrix(a, b, c, d, e, f);
+}
+
+void AffineTransform::reset()
+{
+ setMatrix(1, 0, 0, 1, 0, 0);
+}
+
+void AffineTransform::setMatrix(double a, double b, double c, double d, double e, double f)
+{
+ m_transform[0] = a;
+ m_transform[1] = b;
+ m_transform[2] = c;
+ m_transform[3] = d;
+ m_transform[4] = e;
+ m_transform[5] = f;
+}
+
+bool AffineTransform::isIdentity() const
+{
+ return (m_transform[0] == 1 && m_transform[1] == 0
+ && m_transform[2] == 0 && m_transform[3] == 1
+ && m_transform[4] == 0 && m_transform[5] == 0);
+}
+
+double AffineTransform::det() const
+{
+ return m_transform[0] * m_transform[3] - m_transform[1] * m_transform[2];
+}
+
+bool AffineTransform::isInvertible() const
+{
+ return det() != 0.0;
+}
+
+AffineTransform AffineTransform::inverse() const
+{
+ double determinant = det();
+ if (determinant == 0.0)
+ return AffineTransform();
+
+ AffineTransform result;
+ result.m_transform[0] = m_transform[3] / determinant;
+ result.m_transform[1] = -m_transform[1] / determinant;
+ result.m_transform[2] = -m_transform[2] / determinant;
+ result.m_transform[3] = m_transform[0] / determinant;
+ result.m_transform[4] = (m_transform[2] * m_transform[5]
+ - m_transform[3] * m_transform[4]) / determinant;
+ result.m_transform[5] = (m_transform[1] * m_transform[4]
+ - m_transform[0] * m_transform[5]) / determinant;
+
+ return result;
+}
+
+AffineTransform& AffineTransform::multiply(const AffineTransform& other)
+{
+ return (*this) *= other;
+}
+
+AffineTransform& AffineTransform::multLeft(const AffineTransform& other)
+{
+ AffineTransform trans;
+
+ trans.m_transform[0] = other.m_transform[0] * m_transform[0] + other.m_transform[1] * m_transform[2];
+ trans.m_transform[1] = other.m_transform[0] * m_transform[1] + other.m_transform[1] * m_transform[3];
+ trans.m_transform[2] = other.m_transform[2] * m_transform[0] + other.m_transform[3] * m_transform[2];
+ trans.m_transform[3] = other.m_transform[2] * m_transform[1] + other.m_transform[3] * m_transform[3];
+ trans.m_transform[4] = other.m_transform[4] * m_transform[0] + other.m_transform[5] * m_transform[2] + m_transform[4];
+ trans.m_transform[5] = other.m_transform[4] * m_transform[1] + other.m_transform[5] * m_transform[3] + m_transform[5];
+
+ setMatrix(trans.m_transform);
+ return *this;
+}
+
+AffineTransform& AffineTransform::rotate(double a)
+{
+ // angle is in degree. Switch to radian
+ a = deg2rad(a);
+ double cosAngle = cos(a);
+ double sinAngle = sin(a);
+ AffineTransform rot(cosAngle, sinAngle, -sinAngle, cosAngle, 0, 0);
+
+ multLeft(rot);
+ return *this;
+}
+
+AffineTransform& AffineTransform::scale(double s)
+{
+ return scale(s, s);
+}
+
+AffineTransform& AffineTransform::scale(double sx, double sy)
+{
+ m_transform[0] *= sx;
+ m_transform[3] *= sy;
+ return *this;
+}
+
+AffineTransform& AffineTransform::translate(double tx, double ty)
+{
+ m_transform[4] += tx;
+ m_transform[5] += ty;
+ return *this;
+}
+
+AffineTransform& AffineTransform::scaleNonUniform(double sx, double sy)
+{
+ return scale(sx, sy);
+}
+
+AffineTransform& AffineTransform::rotateFromVector(double x, double y)
+{
+ return rotate(rad2deg(atan2(y, x)));
+}
+
+AffineTransform& AffineTransform::flipX()
+{
+ return scale(-1, 1);
+}
+
+AffineTransform& AffineTransform::flipY()
+{
+ return scale(1, -1);
+}
+
+AffineTransform& AffineTransform::shear(double sx, double sy)
+{
+ AffineTransform shear(1, sy, sx, 1, 0, 0);
+
+ multLeft(shear);
+ return *this;
+}
+
+AffineTransform& AffineTransform::skew(double angleX, double angleY)
+{
+ return shear(tan(deg2rad(angleX)), tan(deg2rad(angleY)));
+}
+
+AffineTransform& AffineTransform::skewX(double angle)
+{
+ return shear(tan(deg2rad(angle)), 0);
+}
+
+AffineTransform& AffineTransform::skewY(double angle)
+{
+ return shear(0, tan(deg2rad(angle)));
+}
+
+AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& dest)
+{
+ AffineTransform transform;
+ transform.translate(dest.x() - source.x(), dest.y() - source.y());
+ transform.scale(dest.width() / source.width(), dest.height() / source.height());
+ return transform;
+}
+
+void AffineTransform::map(double x, double y, double* x2, double* y2) const
+{
+ *x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]);
+ *y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]);
+}
+
+IntPoint AffineTransform::mapPoint(const IntPoint& point) const
+{
+ double x2, y2;
+ map(point.x(), point.y(), &x2, &y2);
+
+ // Round the point.
+ return IntPoint(lround(x2), lround(y2));
+}
+
+FloatPoint AffineTransform::mapPoint(const FloatPoint& point) const
+{
+ double x2, y2;
+ map(point.x(), point.y(), &x2, &y2);
+
+ return FloatPoint(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2));
+}
+
+FloatRect AffineTransform::mapRect(const FloatRect& rect) const
+{
+ FloatQuad q(rect);
+
+ FloatQuad result;
+ result.setP1(mapPoint(q.p1()));
+ result.setP2(mapPoint(q.p2()));
+ result.setP3(mapPoint(q.p3()));
+ result.setP4(mapPoint(q.p4()));
+ return result.boundingBox();
+}
+
+void AffineTransform::blend(const AffineTransform& from, double progress)
+{
+ double srA[9], srB[9];
+
+ affineTransformDecompose(from, srA);
+ affineTransformDecompose(*this, srB);
+
+ // If x-axis of one is flipped, and y-axis of the other, convert to an unflipped rotation.
+ if ((srA[0] < 0 && srB[1] < 0) || (srA[1] < 0 && srB[0] < 0)) {
+ srA[0] = -srA[0];
+ srA[1] = -srA[1];
+ srA[2] += srA[2] < 0 ? piDouble : -piDouble;
+ }
+
+ // Don't rotate the long way around.
+ srA[2] = fmod(srA[2], 2.0 * piDouble);
+ srB[2] = fmod(srB[2], 2.0 * piDouble);
+
+ if (fabs(srA[2] - srB[2]) > piDouble) {
+ if (srA[2] > srB[2])
+ srA[2] -= piDouble * 2.0;
+ else
+ srB[2] -= piDouble * 2.0;
+ }
+
+ for (int i = 0; i < 9; i++)
+ srA[i] = srA[i] + progress * (srB[i] - srA[i]);
+
+ affineTransformCompose(*this, srA);
+}
+
+TransformationMatrix AffineTransform::toTransformationMatrix() const
+{
+ return TransformationMatrix(m_transform[0], m_transform[1], m_transform[2],
+ m_transform[3], m_transform[4], m_transform[5]);
+}
+
+}
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.h b/WebCore/platform/graphics/transforms/AffineTransform.h
new file mode 100644
index 0000000..49add18
--- /dev/null
+++ b/WebCore/platform/graphics/transforms/AffineTransform.h
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * 2010 Dirk Schulze <krit@webkit.org>
+ *
+ * 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.
+ */
+
+#ifndef AffineTransform_h
+#define AffineTransform_h
+
+#include "TransformationMatrix.h"
+
+#include <string.h> // for memcpy
+#include <wtf/FastAllocBase.h>
+
+#if PLATFORM(CG)
+#include <CoreGraphics/CGAffineTransform.h>
+#elif PLATFORM(CAIRO)
+#include <cairo.h>
+#elif PLATFORM(QT)
+#include <QTransform>
+#elif PLATFORM(SKIA)
+#include <SkMatrix.h>
+#elif PLATFORM(WX) && USE(WXGC)
+#include <wx/graphics.h>
+#endif
+
+namespace WebCore {
+
+class FloatPoint;
+class FloatQuad;
+class FloatRect;
+class IntPoint;
+class IntRect;
+
+class AffineTransform : public FastAllocBase {
+public:
+ typedef double Transform[6];
+
+ AffineTransform();
+ AffineTransform(double a, double b, double c, double d, double e, double f);
+
+ void setMatrix(double a, double b, double c, double d, double e, double f);
+
+ void map(double x, double y, double* x2, double* y2) const;
+
+ // Rounds the mapped point to the nearest integer value.
+ IntPoint mapPoint(const IntPoint&) const;
+
+ FloatPoint mapPoint(const FloatPoint&) const;
+
+ // Rounds the resulting mapped rectangle out. This is helpful for bounding
+ // box computations but may not be what is wanted in other contexts.
+ IntRect mapRect(const IntRect&) const;
+
+ FloatRect mapRect(const FloatRect&) const;
+
+ bool isIdentity() const;
+
+ double a() const { return m_transform[0]; }
+ void setA(double a) { m_transform[0] = a; }
+ double b() const { return m_transform[1]; }
+ void setB(double b) { m_transform[1] = b; }
+ double c() const { return m_transform[2]; }
+ void setC(double c) { m_transform[2] = c; }
+ double d() const { return m_transform[3]; }
+ void setD(double d) { m_transform[3] = d; }
+ double e() const { return m_transform[4]; }
+ void setE(double e) { m_transform[4] = e; }
+ double f() const { return m_transform[5]; }
+ void setF(double f) { m_transform[5] = f; }
+
+ void reset();
+
+ AffineTransform& multiply(const AffineTransform&);
+ AffineTransform& multLeft(const AffineTransform&);
+ AffineTransform& scale(double);
+ AffineTransform& scale(double sx, double sy);
+ AffineTransform& scaleNonUniform(double sx, double sy);
+ AffineTransform& rotate(double d);
+ AffineTransform& rotateFromVector(double x, double y);
+ AffineTransform& translate(double tx, double ty);
+ AffineTransform& shear(double sx, double sy);
+ AffineTransform& flipX();
+ AffineTransform& flipY();
+ AffineTransform& skew(double angleX, double angleY);
+ AffineTransform& skewX(double angle);
+ AffineTransform& skewY(double angle);
+
+ double det() const;
+ bool isInvertible() const;
+ AffineTransform inverse() const;
+
+ void blend(const AffineTransform& from, double progress);
+
+ TransformationMatrix toTransformationMatrix() const;
+
+ bool operator== (const AffineTransform& m2) const
+ {
+ return (m_transform[0] == m2.m_transform[0]
+ && m_transform[1] == m2.m_transform[1]
+ && m_transform[2] == m2.m_transform[2]
+ && m_transform[3] == m2.m_transform[3]
+ && m_transform[4] == m2.m_transform[4]
+ && m_transform[5] == m2.m_transform[5]);
+ }
+
+ bool operator!=(const AffineTransform& other) const { return !(*this == other); }
+
+ // *this = *this * t (i.e., a multRight)
+ AffineTransform& operator*=(const AffineTransform& t)
+ {
+ *this = *this * t;
+ return *this;
+ }
+
+ // result = *this * t (i.e., a multRight)
+ AffineTransform operator*(const AffineTransform& t) const
+ {
+ AffineTransform result = t;
+ result.multLeft(*this);
+ return result;
+ }
+
+#if PLATFORM(CG)
+ operator CGAffineTransform() const;
+#elif PLATFORM(CAIRO)
+ operator cairo_matrix_t() const;
+#elif PLATFORM(QT)
+ operator QTransform() const;
+#elif PLATFORM(SKIA)
+ operator SkMatrix() const;
+#elif PLATFORM(WX) && USE(WXGC)
+ operator wxGraphicsMatrix() const;
+#endif
+
+private:
+ void setMatrix(const Transform m)
+ {
+ if (m && m != m_transform)
+ memcpy(m_transform, m, sizeof(Transform));
+ }
+
+ Transform m_transform;
+};
+
+AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& dest);
+
+}
+
+#endif
diff --git a/WebCore/platform/graphics/win/GraphicsContextWin.cpp b/WebCore/platform/graphics/win/GraphicsContextWin.cpp
index 54b0cb2..68c12d1 100644
--- a/WebCore/platform/graphics/win/GraphicsContextWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextWin.cpp
@@ -32,6 +32,7 @@
#include "GraphicsContextPlatformPrivateCairo.h"
#endif
+#include "AffineTransform.h"
#include "BitmapInfo.h"
#include "TransformationMatrix.h"
#include "NotImplemented.h"
@@ -189,6 +190,16 @@ void GraphicsContextPlatformPrivate::translate(float x , float y)
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
}
+void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform)
+{
+ if (!m_hdc)
+ return;
+
+ XFORM xform = TransformationMatrix(transform.a(), transform.b(), transform.c(),
+ transform.d(), transform.e(), transform.f());
+ ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
+}
+
void GraphicsContextPlatformPrivate::concatCTM(const TransformationMatrix& transform)
{
if (!m_hdc)
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp
index ad1fc85..e97fac9 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp
@@ -39,10 +39,11 @@
#ifdef DEBUG_ALL
#pragma comment(lib, "QuartzCore_debug")
+#pragma comment(lib, "QuartzCoreInterface_debug")
#else
#pragma comment(lib, "QuartzCore")
-#endif
#pragma comment(lib, "QuartzCoreInterface")
+#endif
namespace WebCore {
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
index 0e387f5..410aeb1 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "GraphicsContext.h"
+#include "AffineTransform.h"
#include "CharacterNames.h"
#include "GlyphBuffer.h"
#include "Gradient.h"
@@ -1143,6 +1144,11 @@ void GraphicsContext::endTransparencyLayer()
m_data->restore();
}
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ m_data->concatCTM(transform);
+}
+
void GraphicsContext::concatCTM(const TransformationMatrix& transform)
{
m_data->concatCTM(transform);
@@ -1531,6 +1537,11 @@ void GraphicsContext::fillRect(const FloatRect& r, const Gradient* gradient)
GradientFill(dc, tv.data(), tv.size(), mesh.data(), mesh.size(), vertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H);
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ return m_data->m_transform;
+}
+
TransformationMatrix GraphicsContext::getCTM() const
{
return m_data->m_transform;
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 839bc59..e35334e 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "GraphicsContext.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "FloatRect.h"
#include "Font.h"
@@ -359,6 +360,12 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*)
notImplemented();
}
+AffineTransform GraphicsContext::getAffineCTM() const
+{
+ notImplemented();
+ return AffineTransform();
+}
+
TransformationMatrix GraphicsContext::getCTM() const
{
notImplemented();
@@ -471,6 +478,15 @@ void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorS
m_data->context->SetBrush(wxBrush(color));
}
+void GraphicsContext::concatCTM(const AffineTransform& transform)
+{
+ if (paintingDisabled())
+ return;
+
+ notImplemented();
+ return;
+}
+
void GraphicsContext::concatCTM(const TransformationMatrix& transform)
{
if (paintingDisabled())
diff --git a/WebCore/platform/graphics/wx/PathWx.cpp b/WebCore/platform/graphics/wx/PathWx.cpp
index cebc05a..21693c9 100644
--- a/WebCore/platform/graphics/wx/PathWx.cpp
+++ b/WebCore/platform/graphics/wx/PathWx.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "Path.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "FloatPoint.h"
#include "FloatRect.h"
@@ -202,6 +203,14 @@ void Path::addEllipse(const FloatRect& rect)
#endif
}
+void Path::transform(const AffineTransform& transform)
+{
+#if USE(WXGC)
+ if (m_path)
+ m_path->Transform(transform);
+#endif
+}
+
void Path::transform(const TransformationMatrix& transform)
{
#if USE(WXGC)
diff --git a/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp b/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp
index 9684a3c..1937986 100644
--- a/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp
+++ b/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp
@@ -24,6 +24,7 @@
*/
#include "config.h"
+#include "AffineTransform.h"
#include "TransformationMatrix.h"
#include "Assertions.h"
@@ -45,6 +46,15 @@ TransformationMatrix::operator wxGraphicsMatrix() const
wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f());
return matrix;
}
+
+AffineTransform::operator wxGraphicsMatrix() const
+{
+ wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer();
+ ASSERT(renderer);
+
+ wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f());
+ return matrix;
+}
#endif
}
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
new file mode 100644
index 0000000..3bb1335
--- /dev/null
+++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "config.h"
+#include "GOwnPtrGtk.h"
+
+#include <gst/gstelement.h>
+#include <libsoup/soup-uri.h>
+
+namespace WTF {
+
+template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr)
+{
+ if (ptr)
+ soup_uri_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GstElement>(GstElement* ptr)
+{
+ if (ptr)
+ gst_object_unref(ptr);
+}
+
+}
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h
new file mode 100644
index 0000000..c585002
--- /dev/null
+++ b/WebCore/platform/gtk/GOwnPtrGtk.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GOwnPtrGtk_h
+#define GOwnPtrGtk_h
+
+#include "GOwnPtr.h"
+
+typedef struct _SoupURI SoupURI;
+typedef struct _GstElement GstElement;
+
+namespace WTF {
+
+template<> void freeOwnedGPtr<SoupURI>(SoupURI* ptr);
+template<> void freeOwnedGPtr<GstElement>(GstElement* ptr);
+
+}
+
+#endif
diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm
index 2812607..b71a651 100644
--- a/WebCore/platform/mac/ThemeMac.mm
+++ b/WebCore/platform/mac/ThemeMac.mm
@@ -415,9 +415,20 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*
} else if ([previousDefaultButtonCell isEqual:buttonCell])
[window setDefaultButtonCell:nil];
+ if (!view) {
+ context->save();
+ context->translate(inflatedRect.x(), inflatedRect.y());
+ context->scale(FloatSize(1, -1));
+ context->translate(0, -inflatedRect.height());
+ inflatedRect.setLocation(IntPoint());
+ }
+
[buttonCell drawWithFrame:NSRect(inflatedRect) inView:view];
[buttonCell setControlView:nil];
+ if (!view)
+ context->restore();
+
if (![previousDefaultButtonCell isEqual:buttonCell])
[window setDefaultButtonCell:previousDefaultButtonCell];
diff --git a/WebCore/platform/network/qt/SocketStreamHandlePrivate.h b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
index 9433d3f..235f1b1 100644
--- a/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
+++ b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
@@ -59,7 +59,9 @@ public slots:
void socketError(QAbstractSocket::SocketError);
void socketClosedCallback();
void socketErrorCallback(int);
+#ifndef QT_NO_OPENSSL
void socketSslErrors(const QList<QSslError>&);
+#endif
public:
QTcpSocket* m_socket;
SocketStreamHandle* m_streamHandle;
diff --git a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
index d61d901..e666ff7 100644
--- a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
+++ b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
@@ -45,10 +45,17 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH
m_streamHandle = streamHandle;
m_socket = 0;
bool isSecure = url.protocolIs("wss");
- if (isSecure)
+
+ if (isSecure) {
+#ifndef QT_NO_OPENSSL
m_socket = new QSslSocket(this);
- else
+#endif
+ } else
m_socket = new QTcpSocket(this);
+
+ if (!m_socket)
+ return;
+
connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected()));
connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketClosed()));
@@ -59,9 +66,11 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH
unsigned int port = url.hasPort() ? url.port() : (isSecure ? 443 : 80);
QString host = url.host();
- if (isSecure)
+ if (isSecure) {
+#ifndef QT_NO_OPENSSL
static_cast<QSslSocket*>(m_socket)->connectToHostEncrypted(host, port);
- else
+#endif
+ } else
m_socket->connectToHost(host, port);
}
@@ -88,7 +97,7 @@ void SocketStreamHandlePrivate::socketReadyRead()
int SocketStreamHandlePrivate::send(const char* data, int len)
{
- if (m_socket->state() != QAbstractSocket::ConnectedState)
+ if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
return 0;
quint64 sentSize = m_socket->write(data, len);
QMetaObject::invokeMethod(this, "socketSentData", Qt::QueuedConnection);
@@ -138,6 +147,7 @@ void SocketStreamHandlePrivate::socketErrorCallback(int error)
}
}
+#ifndef QT_NO_OPENSSL
void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>&)
{
// FIXME: based on http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-68#page-15
@@ -145,6 +155,8 @@ void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>&)
// We don't abort while this is still work in progress.
static_cast<QSslSocket*>(m_socket)->ignoreSslErrors();
}
+#endif
+
SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
: SocketStreamHandleBase(url, client)
{
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 83e3746..271c11a 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -129,7 +129,6 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
RenderThemeQt::RenderThemeQt(Page* page)
: RenderTheme()
, m_page(page)
- , m_fallbackStyle(0)
{
QPushButton button;
button.setAttribute(Qt::WA_MacSmallSize);
@@ -139,6 +138,8 @@ RenderThemeQt::RenderThemeQt(Page* page)
#ifdef Q_WS_MAC
m_buttonFontPixelSize = fontInfo.pixelSize();
#endif
+
+ m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
}
RenderThemeQt::~RenderThemeQt()
@@ -147,19 +148,17 @@ RenderThemeQt::~RenderThemeQt()
}
// for some widget painting, we need to fallback to Windows style
-QStyle* RenderThemeQt::fallbackStyle()
+QStyle* RenderThemeQt::fallbackStyle() const
{
- if (!m_fallbackStyle)
- m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
-
- if (!m_fallbackStyle)
- m_fallbackStyle = QApplication::style();
-
- return m_fallbackStyle;
+ return (m_fallbackStyle) ? m_fallbackStyle : QApplication::style();
}
QStyle* RenderThemeQt::qStyle() const
{
+#ifdef Q_WS_MAEMO_5
+ return fallbackStyle();
+#endif
+
if (m_page) {
QWebPageClient* pageClient = m_page->chrome()->client()->platformPageClient();
@@ -773,6 +772,11 @@ bool RenderThemeQt::supportsFocus(ControlPart appearance) const
void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const
{
+#ifdef Q_WS_MAEMO_5
+ static QPalette lightGrayPalette(Qt::lightGray);
+ palette = lightGrayPalette;
+ return;
+#endif
// If the webview has a custom palette, use it
if (!m_page)
return;
diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h
index e6bab7e..5385881 100644
--- a/WebCore/platform/qt/RenderThemeQt.h
+++ b/WebCore/platform/qt/RenderThemeQt.h
@@ -145,7 +145,7 @@ private:
void setPaletteFromPageClientIfExists(QPalette&) const;
- QStyle* fallbackStyle();
+ QStyle* fallbackStyle() const;
Page* m_page;
diff --git a/WebCore/platform/sql/SQLiteTransaction.cpp b/WebCore/platform/sql/SQLiteTransaction.cpp
index a4b2ac8..a34613f 100644
--- a/WebCore/platform/sql/SQLiteTransaction.cpp
+++ b/WebCore/platform/sql/SQLiteTransaction.cpp
@@ -64,6 +64,11 @@ void SQLiteTransaction::begin()
void SQLiteTransaction::commit()
{
+ // FIXME: this code is buggy; it assumes that COMMIT always succeeds which is not the case:
+ // the transaction could've been silently rolled back before getting to the COMMIT statement
+ // (https://bugs.webkit.org/show_bug.cgi?id=34280). However, the rest of the code does not
+ // know how to deal with a premature rollback and a failed COMMIT at this moment, so until
+ // we figure out what to do with bug 34280, it's better to leave this code as it is.
if (m_inProgress) {
ASSERT(m_db.m_transactionInProgress);
m_db.executeCommand("COMMIT;");
@@ -84,8 +89,10 @@ void SQLiteTransaction::rollback()
void SQLiteTransaction::stop()
{
- m_inProgress = false;
- m_db.m_transactionInProgress = false;
+ if (m_inProgress) {
+ m_inProgress = false;
+ m_db.m_transactionInProgress = false;
+ }
}
} // namespace WebCore
diff --git a/WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp b/WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp
new file mode 100644
index 0000000..4384411
--- /dev/null
+++ b/WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Company 100, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "TextBreakIteratorInternalICU.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+const char* currentSearchLocaleID()
+{
+ notImplemented();
+ return "";
+}
+
+const char* currentTextBreakLocaleID()
+{
+ notImplemented();
+ return "en_us";
+}
+
+} // namespace WebCore
+
diff --git a/WebCore/platform/wx/KeyEventWin.cpp b/WebCore/platform/wx/KeyEventWin.cpp
index f8f0155..e69de29 100644
--- a/WebCore/platform/wx/KeyEventWin.cpp
+++ b/WebCore/platform/wx/KeyEventWin.cpp
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc. 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 "PlatformKeyboardEvent.h"
-#include <windows.h>
-
-#define REPEAT_COUNT_MASK 0x0000FFFF
-#define NEW_RELEASE_STATE_MASK 0x80000000
-#define PREVIOUS_DOWN_STATE_MASK 0x40000000
-#define ALT_KEY_DOWN_MASK 0x20000000
-
-#define HIGH_BIT_MASK_SHORT 0x8000
-
-namespace WebCore {
-
-// FIXME: This is incomplete. We should change this to mirror
-// more like what Firefox does, and generate these switch statements
-// at build time.
-static String keyIdentifierForWindowsKeyCode(short keyCode)
-{
- switch (keyCode) {
- case VK_MENU:
- return "Alt";
- case VK_CLEAR:
- return "Clear";
- case VK_DOWN:
- return "Down";
- // "End"
- case VK_END:
- return "End";
- // "Enter"
- case VK_RETURN:
- return "Enter";
- case VK_EXECUTE:
- return "Execute";
- case VK_F1:
- return "F1";
- case VK_F2:
- return "F2";
- case VK_F3:
- return "F3";
- case VK_F4:
- return "F4";
- case VK_F5:
- return "F5";
- case VK_F6:
- return "F6";
- case VK_F7:
- return "F7";
- case VK_F8:
- return "F8";
- case VK_F9:
- return "F9";
- case VK_F10:
- return "F11";
- case VK_F12:
- return "F12";
- case VK_F13:
- return "F13";
- case VK_F14:
- return "F14";
- case VK_F15:
- return "F15";
- case VK_F16:
- return "F16";
- case VK_F17:
- return "F17";
- case VK_F18:
- return "F18";
- case VK_F19:
- return "F19";
- case VK_F20:
- return "F20";
- case VK_F21:
- return "F21";
- case VK_F22:
- return "F22";
- case VK_F23:
- return "F23";
- case VK_F24:
- return "F24";
- case VK_HELP:
- return "Help";
- case VK_HOME:
- return "Home";
- case VK_INSERT:
- return "Insert";
- case VK_LEFT:
- return "Left";
- case VK_NEXT:
- return "PageDown";
- case VK_PRIOR:
- return "PageUp";
- case VK_PAUSE:
- return "Pause";
- case VK_SNAPSHOT:
- return "PrintScreen";
- case VK_RIGHT:
- return "Right";
- case VK_SCROLL:
- return "Scroll";
- case VK_SELECT:
- return "Select";
- case VK_UP:
- return "Up";
- // Standard says that DEL becomes U+007F.
- case VK_DELETE:
- return "U+007F";
- default:
- return String::sprintf("U+%04X", toupper(keyCode));
- }
-}
-
-static String singleCharacterString(UChar c) { return String(&c, 1); }
-
-PlatformKeyboardEvent::PlatformKeyboardEvent(HWND hWnd, WPARAM wParam, LPARAM lParam)
- : m_text(singleCharacterString(wParam))
- , m_unmodifiedText(singleCharacterString(wParam))
- , m_keyIdentifier(keyIdentifierForWindowsKeyCode(wParam))
- , m_isKeyUp((lParam & NEW_RELEASE_STATE_MASK))
- , m_autoRepeat(lParam & REPEAT_COUNT_MASK)
- , m_WindowsKeyCode(wParam)
- , m_isKeypad(false) // FIXME
- , m_shiftKey(GetAsyncKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT)
- , m_ctrlKey(GetAsyncKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT)
- , m_altKey(lParam & ALT_KEY_DOWN_MASK)
- , m_metaKey(lParam & ALT_KEY_DOWN_MASK) // FIXME: Is this right?
- , m_isModifierKeyPress(false)
-{
- if (!m_shiftKey)
- m_text = String(singleCharacterString(tolower(wParam)));
-}
-
-}