diff options
Diffstat (limited to 'WebKit/chromium/public')
108 files changed, 4437 insertions, 338 deletions
diff --git a/WebKit/chromium/public/WebAccessibilityCache.h b/WebKit/chromium/public/WebAccessibilityCache.h index 94704a0..52e438c 100644 --- a/WebKit/chromium/public/WebAccessibilityCache.h +++ b/WebKit/chromium/public/WebAccessibilityCache.h @@ -43,8 +43,8 @@ public: WebAccessibilityCache() {} virtual ~WebAccessibilityCache() {} - static WebAccessibilityCache* create(); - static void enableAccessibility(); + WEBKIT_API static WebAccessibilityCache* create(); + WEBKIT_API static void enableAccessibility(); virtual void initialize(WebView* view) = 0; virtual bool isInitialized() const = 0; diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h index f46c0d8..ddb9bda 100644 --- a/WebKit/chromium/public/WebAccessibilityObject.h +++ b/WebKit/chromium/public/WebAccessibilityObject.h @@ -42,6 +42,8 @@ namespace WTF { template <typename T> class PassRefPtr; } namespace WebKit { class WebAccessibilityObjectPrivate; +class WebNode; +class WebDocument; class WebString; struct WebPoint; struct WebRect; @@ -64,42 +66,49 @@ public: bool isNull() const { return !m_private; } - WebString accessibilityDescription() const; - WebString actionVerb() const; - bool canSetFocusAttribute() const; - bool canSetValueAttribute() const; - - unsigned childCount() const; - - WebAccessibilityObject childAt(unsigned) const; - WebAccessibilityObject firstChild() const; - WebAccessibilityObject focusedChild() const; - WebAccessibilityObject lastChild() const; - WebAccessibilityObject nextSibling() const; - WebAccessibilityObject parentObject() const; - WebAccessibilityObject previousSibling() const; - - bool isAnchor() const; - bool isChecked() const; - bool isFocused() const; - bool isEnabled() const; - bool isHovered() const; - bool isIndeterminate() const; - bool isMultiSelectable() const; - bool isOffScreen() const; - bool isPasswordField() const; - bool isPressed() const; - bool isReadOnly() const; - bool isVisited() const; - - WebRect boundingBoxRect() const; - WebString helpText() const; - WebAccessibilityObject hitTest(const WebPoint&) const; - WebString keyboardShortcut() const; - bool performDefaultAction() const; - WebAccessibilityRole roleValue() const; - WebString stringValue() const; - WebString title() const; + WEBKIT_API WebString accessibilityDescription() const; + WEBKIT_API WebString actionVerb() const; + WEBKIT_API bool canSetFocusAttribute() const; + WEBKIT_API bool canSetValueAttribute() const; + + WEBKIT_API unsigned childCount() const; + + WEBKIT_API WebAccessibilityObject childAt(unsigned) const; + WEBKIT_API WebAccessibilityObject firstChild() const; + WEBKIT_API WebAccessibilityObject focusedChild() const; + WEBKIT_API WebAccessibilityObject lastChild() const; + WEBKIT_API WebAccessibilityObject nextSibling() const; + WEBKIT_API WebAccessibilityObject parentObject() const; + WEBKIT_API WebAccessibilityObject previousSibling() const; + + WEBKIT_API bool isAnchor() const; + WEBKIT_API bool isChecked() const; + WEBKIT_API bool isFocused() const; + WEBKIT_API bool isEnabled() const; + WEBKIT_API bool isHovered() const; + WEBKIT_API bool isIndeterminate() const; + WEBKIT_API bool isMultiSelectable() const; + WEBKIT_API bool isOffScreen() const; + WEBKIT_API bool isPasswordField() const; + WEBKIT_API bool isPressed() const; + WEBKIT_API bool isReadOnly() const; + WEBKIT_API bool isVisited() const; + + WEBKIT_API WebRect boundingBoxRect() const; + WEBKIT_API WebString helpText() const; + WEBKIT_API int headingLevel() const; + WEBKIT_API WebAccessibilityObject hitTest(const WebPoint&) const; + WEBKIT_API WebString keyboardShortcut() const; + WEBKIT_API bool performDefaultAction() const; + WEBKIT_API WebAccessibilityRole roleValue() const; + WEBKIT_API void setFocused(bool) const; + WEBKIT_API WebString stringValue() const; + WEBKIT_API WebString title() const; + + WEBKIT_API WebNode node() const; + WEBKIT_API WebDocument document() const; + WEBKIT_API bool hasComputedStyle() const; + WEBKIT_API WebString computedStyleDisplay() const; #if WEBKIT_IMPLEMENTATION WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); diff --git a/WebKit/chromium/public/WebAccessibilityRole.h b/WebKit/chromium/public/WebAccessibilityRole.h index ec041e0..b0748a7 100644 --- a/WebKit/chromium/public/WebAccessibilityRole.h +++ b/WebKit/chromium/public/WebAccessibilityRole.h @@ -102,6 +102,7 @@ enum WebAccessibilityRole { WebAccessibilityRoleAnnotation, WebAccessibilityRoleSliderThumb, WebAccessibilityRoleIgnored, + WebAccessibilityRolePresentational, WebAccessibilityRoleTab, WebAccessibilityRoleTabList, WebAccessibilityRoleTabPanel, diff --git a/WebKit/chromium/public/WebApplicationCacheHost.h b/WebKit/chromium/public/WebApplicationCacheHost.h index 7c5dafe..acbc106 100644 --- a/WebKit/chromium/public/WebApplicationCacheHost.h +++ b/WebKit/chromium/public/WebApplicationCacheHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,6 +32,8 @@ #define WebApplicationCacheHost_h #include "WebCommon.h" +#include "WebURL.h" +#include "WebVector.h" namespace WebKit { @@ -42,7 +44,7 @@ class WebURLResponse; struct WebURLError; // This interface is used by webkit to call out to the embedder. Webkit uses -// the WebKitClient::createApplicationCacheHost method to create instances, +// the WebFrameClient::createApplicationCacheHost method to create instances, // and calls delete when the instance is no longer needed. class WebApplicationCacheHost { public: @@ -71,24 +73,46 @@ public: virtual ~WebApplicationCacheHost() { } // Called for every request made within the context. - virtual void willStartMainResourceRequest(WebURLRequest&) = 0; - virtual void willStartSubResourceRequest(WebURLRequest&) = 0; + virtual void willStartMainResourceRequest(WebURLRequest&) { } + virtual void willStartSubResourceRequest(WebURLRequest&) { } // One or the other selectCache methods is called after having parsed the <html> tag. // The latter returns false if the current document has been identified as a "foreign" // entry, in which case the frame navigation will be restarted by webkit. - virtual void selectCacheWithoutManifest() = 0; - virtual bool selectCacheWithManifest(const WebURL& manifestURL) = 0; + virtual void selectCacheWithoutManifest() { } + virtual bool selectCacheWithManifest(const WebURL& manifestURL) { return true; } // Called as the main resource is retrieved. - virtual void didReceiveResponseForMainResource(const WebURLResponse&) = 0; - virtual void didReceiveDataForMainResource(const char* data, int len) = 0; - virtual void didFinishLoadingMainResource(bool success) = 0; + virtual void didReceiveResponseForMainResource(const WebURLResponse&) { } + virtual void didReceiveDataForMainResource(const char* data, int len) { } + virtual void didFinishLoadingMainResource(bool success) { } // Called on behalf of the scriptable interface. - virtual Status status() = 0; - virtual bool startUpdate() = 0; - virtual bool swapCache() = 0; + virtual Status status() { return Uncached; } + virtual bool startUpdate() { return false; } + virtual bool swapCache() { return false; } + + // Structures and methods to support inspecting Application Caches. + struct CacheInfo { + WebURL manifestURL; // Empty if there is no associated cache. + double creationTime; + double updateTime; + long long totalSize; + CacheInfo() : creationTime(0), updateTime(0), totalSize(0) { } + }; + struct ResourceInfo { + WebURL url; + long long size; + bool isMaster; + bool isManifest; + bool isExplicit; + bool isForeign; + bool isFallback; + ResourceInfo() : size(0), isMaster(false), isManifest(false), isExplicit(false), isForeign(false), isFallback(false) { } + }; + virtual void getAssociatedCacheInfo(CacheInfo*) { } + virtual void getResourceList(WebVector<ResourceInfo>*) { } + virtual void deleteAssociatedCacheGroup() { } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebApplicationCacheHostClient.h b/WebKit/chromium/public/WebApplicationCacheHostClient.h index 4e830e3..3f84c51 100644 --- a/WebKit/chromium/public/WebApplicationCacheHostClient.h +++ b/WebKit/chromium/public/WebApplicationCacheHostClient.h @@ -39,8 +39,12 @@ namespace WebKit { // This interface is used by the embedder to call into webkit. class WebApplicationCacheHostClient { public: - // Called to fire the event in the scriptable interface. + // Called when a different cache, including possibly no cache, is associated with the host. + virtual void didChangeCacheAssociation() = 0; + + // Called to fire events in the scriptable interface. virtual void notifyEventListener(WebApplicationCacheHost::EventID) = 0; + virtual void notifyProgressEventListener(const WebURL&, int num_total, int num_complete) = 0; protected: // Should not be deleted by the embedder. diff --git a/WebKit/chromium/public/WebAttribute.h b/WebKit/chromium/public/WebAttribute.h new file mode 100644 index 0000000..56e140b --- /dev/null +++ b/WebKit/chromium/public/WebAttribute.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebAttribute_h +#define WebAttribute_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class Attribute; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebString; + +// Provides readonly access to some properties of a DOM attribute. +class WebAttribute { +public: + ~WebAttribute() { reset(); } + + WebAttribute() { } + WebAttribute(const WebAttribute& n) { assign(n); } + WebAttribute& operator=(const WebAttribute& n) + { + assign(n); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebAttribute&); + + WEBKIT_API WebString localName() const; + WEBKIT_API WebString value() const; + +#if WEBKIT_IMPLEMENTATION + WebAttribute(const WTF::PassRefPtr<WebCore::Attribute>&); +#endif + +private: + WebPrivatePtr<WebCore::Attribute> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebBindings.h b/WebKit/chromium/public/WebBindings.h index 4e66a8f..0fa3bfd 100644 --- a/WebKit/chromium/public/WebBindings.h +++ b/WebKit/chromium/public/WebBindings.h @@ -117,7 +117,7 @@ public: // NPN_UTF8FromIdentifier WEBKIT_API static NPUTF8* utf8FromIdentifier(NPIdentifier); - // Miscellaneous utility functions ------------------------------------ + // Miscellaneous utility functions ---------------------------------------- // Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data // structure. If isString is true upon return, string will be set but number's value is @@ -138,6 +138,15 @@ public: // Return true (success) if the given npobj is a range object. // If so, return that range as a WebRange object. WEBKIT_API static bool getRange(NPObject* range, WebRange*); + + // Exceptions ------------------------------------------------------------- + + typedef void (ExceptionHandler)(void* data, const NPUTF8* message); + + // The exception handler will be notified of any exceptions thrown while + // operating on a NPObject. + WEBKIT_API static void pushExceptionHandler(ExceptionHandler, void* data); + WEBKIT_API static void popExceptionHandler(); }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebCString.h b/WebKit/chromium/public/WebCString.h index 434cb06..2c1e137 100644 --- a/WebKit/chromium/public/WebCString.h +++ b/WebKit/chromium/public/WebCString.h @@ -34,7 +34,7 @@ #include "WebCommon.h" #if WEBKIT_IMPLEMENTATION -namespace WebCore { class CString; } +namespace WTF { class CString; } #else #include <string> #endif @@ -68,6 +68,11 @@ public: return *this; } + // Returns 0 if both strings are equals, a value greater than zero if the + // first character that does not match has a greater value in this string + // than in |other|, or a value less than zero to indicate the opposite. + WEBKIT_API int compare(const WebCString& other) const; + WEBKIT_API void reset(); WEBKIT_API void assign(const WebCString&); WEBKIT_API void assign(const char* data, size_t len); @@ -84,9 +89,9 @@ public: WEBKIT_API static WebCString fromUTF16(const WebUChar* data); #if WEBKIT_IMPLEMENTATION - WebCString(const WebCore::CString&); - WebCString& operator=(const WebCore::CString&); - operator WebCore::CString() const; + WebCString(const WTF::CString&); + WebCString& operator=(const WTF::CString&); + operator WTF::CString() const; #else WebCString(const std::string& s) : m_private(0) { @@ -117,6 +122,11 @@ private: WebCStringPrivate* m_private; }; +inline bool operator<(const WebCString& a, const WebCString& b) +{ + return a.compare(b) < 0; +} + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebClipboard.h b/WebKit/chromium/public/WebClipboard.h index 68e22b5..6755d96 100644 --- a/WebKit/chromium/public/WebClipboard.h +++ b/WebKit/chromium/public/WebClipboard.h @@ -32,11 +32,13 @@ #define WebClipboard_h #include "WebCommon.h" +#include "WebString.h" +#include "WebVector.h" namespace WebKit { +class WebDragData; class WebImage; -class WebString; class WebURL; class WebClipboard { @@ -51,22 +53,35 @@ public: BufferStandard, // Used on platforms like the X Window System that treat selection // as a type of clipboard. - BufferSelection + BufferSelection, + // Read-only buffer corresponding to the current drag operation, if any. + BufferDrag, }; - virtual bool isFormatAvailable(Format, Buffer) = 0; + virtual bool isFormatAvailable(Format, Buffer) { return false; } - virtual WebString readPlainText(Buffer) = 0; - virtual WebString readHTML(Buffer, WebURL*) = 0; + virtual WebString readPlainText(Buffer) { return WebString(); } + virtual WebString readHTML(Buffer, WebURL*) { return WebString(); } - virtual void writePlainText(const WebString&) = 0; + virtual void writePlainText(const WebString&) { } virtual void writeHTML( const WebString& htmlText, const WebURL&, - const WebString& plainText, bool writeSmartPaste) = 0; + const WebString& plainText, bool writeSmartPaste) { } virtual void writeURL( - const WebURL&, const WebString& title) = 0; + const WebURL&, const WebString& title) { } virtual void writeImage( - const WebImage&, const WebURL&, const WebString& title) = 0; + const WebImage&, const WebURL&, const WebString& title) { } + virtual void writeData(const WebDragData&) { } + + // The following functions are used for reading platform data for copy and + // paste, drag and drop, and selection copy (on X). + virtual WebVector<WebString> readAvailableTypes( + Buffer, bool* containsFilenames) { return WebVector<WebString>(); } + // Returns true if the requested type was successfully read from the buffer. + virtual bool readData( + Buffer, const WebString& type, WebString* data, + WebString* metadata) { return false; } + virtual WebVector<WebString> readFilenames(Buffer) { return WebVector<WebString>(); } protected: ~WebClipboard() {} diff --git a/WebKit/chromium/public/WebCommon.h b/WebKit/chromium/public/WebCommon.h index d347ea6..2bfa17d 100644 --- a/WebKit/chromium/public/WebCommon.h +++ b/WebKit/chromium/public/WebCommon.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -66,7 +66,7 @@ // Exported symbols need to be annotated with WEBKIT_API #if defined(WIN32) && defined(WEBKIT_DLL) - #if defined(WEBKIT_IMPLEMENTATION) + #if WEBKIT_IMPLEMENTATION #define WEBKIT_API __declspec(dllexport) #else #define WEBKIT_API __declspec(dllimport) @@ -80,15 +80,40 @@ #include <stddef.h> // For size_t +#if defined(WIN32) +// Visual Studio doesn't have stdint.h. +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +#endif + namespace WebKit { - // UTF-16 character type +// UTF-16 character type #if defined(WIN32) typedef wchar_t WebUChar; #else typedef unsigned short WebUChar; #endif +// ----------------------------------------------------------------------------- +// Assertions + +WEBKIT_API void failedAssertion(const char* file, int line, const char* function, const char* assertion); + } // namespace WebKit +// Ideally, only use inside the public directory but outside of WEBKIT_IMPLEMENTATION blocks. (Otherwise use WTF's ASSERT.) +#if defined(NDEBUG) +#define WEBKIT_ASSERT(assertion) ((void)0) +#else +#define WEBKIT_ASSERT(assertion) do { \ + if (!(assertion)) \ + failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ +} while (0) +#endif + +#define WEBKIT_ASSERT_NOT_REACHED() WEBKIT_ASSERT(0) + #endif diff --git a/WebKit/chromium/public/WebCommonWorkerClient.h b/WebKit/chromium/public/WebCommonWorkerClient.h index 771ffff..cea6471 100644 --- a/WebKit/chromium/public/WebCommonWorkerClient.h +++ b/WebKit/chromium/public/WebCommonWorkerClient.h @@ -33,6 +33,9 @@ namespace WebKit { +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebFrame; class WebNotificationPresenter; class WebString; class WebWorker; @@ -49,14 +52,18 @@ public: const WebString& errorString, int lineNumber, const WebString& sourceURL) = 0; - virtual void postConsoleMessageToWorkerObject( - int destinationIdentifier, - int sourceIdentifier, - int messageType, - int messageLevel, - const WebString& message, - int lineNumber, - const WebString& sourceURL) = 0; + // FIXME: the below is for compatibility only and should be + // removed once Chromium is updated to remove message + // destination parameter <http://webkit.org/b/37155>. + virtual void postConsoleMessageToWorkerObject(int, int sourceIdentifier, int messageType, int messageLevel, + const WebString& message, int lineNumber, const WebString& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject(int sourceIdentifier, int messageType, int messageLevel, + const WebString& message, int lineNumber, const WebString& sourceURL) + { + postConsoleMessageToWorkerObject(0, sourceIdentifier, messageType, messageLevel, + message, lineNumber, sourceURL); + } virtual void workerContextClosed() = 0; virtual void workerContextDestroyed() = 0; @@ -70,6 +77,12 @@ public: // they are created via the WebSharedWorkerRepository. virtual WebWorker* createWorker(WebWorkerClient* client) = 0; + // Called on the main webkit thread in the worker process during initialization. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; + + // Called on the main webkit thread before opening a web database. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; + protected: ~WebCommonWorkerClient() { } }; diff --git a/WebKit/chromium/public/WebCompositionUnderline.h b/WebKit/chromium/public/WebCompositionUnderline.h new file mode 100644 index 0000000..d8b0d63 --- /dev/null +++ b/WebKit/chromium/public/WebCompositionUnderline.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCompositionUnderline_h +#define WebCompositionUnderline_h + +#include "WebColor.h" + +namespace WebKit { + +// Class WebCompositionUnderline is intended to be used with WebWidget's +// setComposition() method. +struct WebCompositionUnderline { + WebCompositionUnderline() + : startOffset(0) + , endOffset(0) + , color(0) + , thick(false) { } + + WebCompositionUnderline(unsigned s, unsigned e, WebColor c, bool t) + : startOffset(s) + , endOffset(e) + , color(c) + , thick(t) { } + + unsigned startOffset; + unsigned endOffset; + WebColor color; + bool thick; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebContextMenuData.h b/WebKit/chromium/public/WebContextMenuData.h index 5d67046..e3aee4e 100644 --- a/WebKit/chromium/public/WebContextMenuData.h +++ b/WebKit/chromium/public/WebContextMenuData.h @@ -63,6 +63,9 @@ struct WebContextMenuData { // The absolute URL of the image/video/audio that is in context. WebURL srcURL; + // Whether the image in context has been blocked. + bool isImageBlocked; + // The absolute URL of the page in context. WebURL pageURL; @@ -80,6 +83,8 @@ struct WebContextMenuData { MediaLoop = 0x8, MediaCanSave = 0x10, MediaHasAudio = 0x20, + MediaHasVideo = 0x40, + MediaControls = 0x80, }; // Extra attributes describing media elements. @@ -119,6 +124,7 @@ struct WebContextMenuData { CanPaste = 0x10, CanDelete = 0x20, CanSelectAll = 0x40, + CanTranslate = 0x80, }; // Which edit operations are available in the context. @@ -129,6 +135,17 @@ struct WebContextMenuData { // Custom context menu items provided by the WebCore internals. WebVector<WebMenuItemInfo> customItems; + + WebContextMenuData() + : mediaType(MediaTypeNone) + , isImageBlocked(false) + , mediaFlags(MediaNone) + , isSpellCheckingEnabled(false) + , isEditable(false) + , writingDirectionDefault(CheckableMenuItemDisabled) + , writingDirectionLeftToRight(CheckableMenuItemEnabled) + , writingDirectionRightToLeft(CheckableMenuItemEnabled) + , editFlags(0) { } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebCookieJar.h b/WebKit/chromium/public/WebCookieJar.h new file mode 100644 index 0000000..6daba6b --- /dev/null +++ b/WebKit/chromium/public/WebCookieJar.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCookieJar_h +#define WebCookieJar_h + +#include "WebString.h" + +namespace WebKit { +class WebURL; +struct WebCookie; +template <typename T> class WebVector; + +class WebCookieJar { +public: + virtual void setCookie(const WebURL&, const WebURL& firstPartyForCookies, const WebString& cookie) { } + virtual WebString cookies(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual WebString cookieRequestHeaderFieldValue(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual void rawCookies(const WebURL&, const WebURL& firstPartyForCookies, WebVector<WebCookie>&) { } + virtual void deleteCookie(const WebURL&, const WebString& cookieName) { } + virtual bool cookiesEnabled(const WebURL&, const WebURL& firstPartyForCookies) { return true; } + +protected: + ~WebCookieJar() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDOMStringList.h b/WebKit/chromium/public/WebDOMStringList.h new file mode 100644 index 0000000..d88fcee --- /dev/null +++ b/WebKit/chromium/public/WebDOMStringList.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDOMStringList_h +#define WebDOMStringList_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" +#include "WebString.h" + +namespace WebCore { class DOMStringList; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDOMStringList { +public: + ~WebDOMStringList() { reset(); } + + WebDOMStringList(); + WebDOMStringList(const WebDOMStringList& l) { assign(l); } + WebDOMStringList& operator=(const WebDOMStringList& l) + { + assign(l); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebDOMStringList&); + + WEBKIT_API void append(const WebString&); + WEBKIT_API unsigned length() const; + WEBKIT_API WebString item(unsigned) const; + +#if WEBKIT_IMPLEMENTATION + WebDOMStringList(const WTF::PassRefPtr<WebCore::DOMStringList>&); + WebDOMStringList& operator=(const WTF::PassRefPtr<WebCore::DOMStringList>&); + operator WTF::PassRefPtr<WebCore::DOMStringList>() const; +#endif + +private: + WebPrivatePtr<WebCore::DOMStringList> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDatabase.h b/WebKit/chromium/public/WebDatabase.h index 108201d..0a5d4f8 100644 --- a/WebKit/chromium/public/WebDatabase.h +++ b/WebKit/chromium/public/WebDatabase.h @@ -34,33 +34,15 @@ #include "WebCommon.h" #include "WebSecurityOrigin.h" -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class Database; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif +namespace WebCore { class AbstractDatabase; } namespace WebKit { class WebDatabaseObserver; -class WebDatabasePrivate; class WebString; class WebDatabase { public: - WebDatabase() : m_private(0) { } - WebDatabase(const WebDatabase& d) : m_private(0) { assign(d); } - ~WebDatabase() { reset(); } - - WebDatabase& operator=(const WebDatabase& d) - { - assign(d); - return *this; - } - - WEBKIT_API void reset(); - WEBKIT_API void assign(const WebDatabase&); - bool isNull() const { return !m_private; } - WEBKIT_API WebString name() const; WEBKIT_API WebString displayName() const; WEBKIT_API unsigned long estimatedSize() const; @@ -76,15 +58,12 @@ public: const WebString& originIdentifier, const WebString& databaseName); #if WEBKIT_IMPLEMENTATION - WebDatabase(const WTF::PassRefPtr<WebCore::Database>&); - WebDatabase& operator=(const WTF::PassRefPtr<WebCore::Database>&); - operator WTF::PassRefPtr<WebCore::Database>() const; + WebDatabase(const WebCore::AbstractDatabase*); #endif private: - void assign(WebDatabasePrivate*); - - WebDatabasePrivate* m_private; + WebDatabase() { } + const WebCore::AbstractDatabase* m_database; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebDevToolsAgent.h b/WebKit/chromium/public/WebDevToolsAgent.h index e3b5186..0e26cc9 100644 --- a/WebKit/chromium/public/WebDevToolsAgent.h +++ b/WebKit/chromium/public/WebDevToolsAgent.h @@ -35,6 +35,7 @@ namespace WebKit { class WebDevToolsAgentClient; +class WebDevToolsMessageTransport; class WebFrame; class WebString; class WebURLRequest; @@ -46,8 +47,6 @@ struct WebURLError; class WebDevToolsAgent { public: - WEBKIT_API static WebDevToolsAgent* create(WebView*, WebDevToolsAgentClient*); - virtual ~WebDevToolsAgent() {} virtual void attach() = 0; @@ -73,7 +72,7 @@ public: // Asynchronously request debugger to pause immediately. WEBKIT_API static void debuggerPauseScript(); - WEBKIT_API static bool dispatchMessageFromFrontendOnIOThread(const WebDevToolsMessageData&); + WEBKIT_API static bool dispatchMessageFromFrontendOnIOThread(WebDevToolsMessageTransport*, const WebDevToolsMessageData&); typedef void (*MessageLoopDispatchHandler)(); @@ -82,7 +81,7 @@ public: WEBKIT_API static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler); virtual void identifierForInitialRequest(unsigned long resourceId, WebFrame*, const WebURLRequest&) = 0; - virtual void willSendRequest(unsigned long resourceId, const WebURLRequest&) = 0; + virtual void willSendRequest(unsigned long resourceId, WebURLRequest&) = 0; virtual void didReceiveData(unsigned long resourceId, int length) = 0; virtual void didReceiveResponse(unsigned long resourceId, const WebURLResponse&) = 0; virtual void didFinishLoading(unsigned long resourceId) = 0; diff --git a/WebKit/chromium/public/WebDevToolsAgentClient.h b/WebKit/chromium/public/WebDevToolsAgentClient.h index d78a6f1..91fd3e8 100644 --- a/WebKit/chromium/public/WebDevToolsAgentClient.h +++ b/WebKit/chromium/public/WebDevToolsAgentClient.h @@ -51,10 +51,19 @@ public: // Notifies host upon runtime feature being enabled/disabled. virtual void runtimeFeatureStateChanged(const WebString& feature, bool enabled) { } - WEBKIT_API static void sendMessageToFrontendOnIOThread(const WebDevToolsMessageData&); - virtual WebCString injectedScriptSource() { return WebCString(); } virtual WebCString injectedScriptDispatcherSource() { return WebCString(); } + virtual WebCString debuggerScriptSource() { return WebCString(); } + + class WebKitClientMessageLoop { + public: + virtual ~WebKitClientMessageLoop() { } + virtual void run() = 0; + virtual void quitNow() = 0; + }; + virtual WebKitClientMessageLoop* createClientMessageLoop() { return 0; } + + virtual bool exposeV8DebuggerProtocol() { return false; } protected: ~WebDevToolsAgentClient() { } diff --git a/WebKit/chromium/public/WebDevToolsFrontendClient.h b/WebKit/chromium/public/WebDevToolsFrontendClient.h index 6200709..159a3cd 100644 --- a/WebKit/chromium/public/WebDevToolsFrontendClient.h +++ b/WebKit/chromium/public/WebDevToolsFrontendClient.h @@ -38,16 +38,18 @@ struct WebDevToolsMessageData; class WebDevToolsFrontendClient { public: - WebDevToolsFrontendClient() {} + WebDevToolsFrontendClient() { } - virtual void sendMessageToAgent(const WebDevToolsMessageData&) {}; - virtual void sendDebuggerCommandToAgent(const WebString& command) {}; - virtual void sendDebuggerPauseScript() {} + virtual void sendMessageToAgent(const WebDevToolsMessageData&) { } + virtual void sendDebuggerCommandToAgent(const WebString& command) { } + virtual void sendDebuggerPauseScript() { } - virtual void activateWindow() {}; - virtual void closeWindow() {}; - virtual void dockWindow() {}; - virtual void undockWindow() {}; + virtual void activateWindow() { } + virtual void closeWindow() { } + virtual void requestDockWindow() { } + virtual void requestUndockWindow() { } + + virtual bool shouldHideScriptsPanel() { return false; } protected: virtual ~WebDevToolsFrontendClient() {} diff --git a/WebKit/chromium/public/WebDevToolsMessageTransport.h b/WebKit/chromium/public/WebDevToolsMessageTransport.h new file mode 100644 index 0000000..54c07f1 --- /dev/null +++ b/WebKit/chromium/public/WebDevToolsMessageTransport.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDevToolsMessageTransport_h +#define WebDevToolsMessageTransport_h + +#include "WebCString.h" +#include "WebCommon.h" + +namespace WebKit { +struct WebDevToolsMessageData; + +class WebDevToolsMessageTransport { +public: + virtual ~WebDevToolsMessageTransport() { } + virtual void sendMessageToFrontendOnIOThread(const WebDevToolsMessageData&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDocument.h b/WebKit/chromium/public/WebDocument.h index e158c41..d9f7386 100644 --- a/WebKit/chromium/public/WebDocument.h +++ b/WebKit/chromium/public/WebDocument.h @@ -34,14 +34,19 @@ #include "WebNode.h" #if WEBKIT_IMPLEMENTATION -namespace WebCore { class Document; } +namespace WebCore { +class Document; +class DocumentType; +} namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { +class WebDocumentType; class WebElement; class WebFrame; class WebNodeCollection; +class WebNodeList; class WebString; class WebURL; @@ -61,14 +66,19 @@ public: // Returns the frame the document belongs to or 0 if the document is frameless. WEBKIT_API WebFrame* frame() const; WEBKIT_API bool isHTMLDocument() const; + WEBKIT_API bool isXHTMLDocument() const; + WEBKIT_API bool isPluginDocument() const; WEBKIT_API WebURL baseURL() const; + WEBKIT_API WebURL firstPartyForCookies() const; WEBKIT_API WebElement documentElement() const; WEBKIT_API WebElement body() const; WEBKIT_API WebElement head(); + WEBKIT_API WebString title() const; WEBKIT_API WebNodeCollection all(); WEBKIT_API WebURL completeURL(const WebString&) const; - WEBKIT_API WebElement getElementById(const WebString& id) const; - WEBKIT_API WebString applicationID() const; + WEBKIT_API WebElement getElementById(const WebString&) const; + WEBKIT_API WebNode focusedNode() const; + WEBKIT_API WebDocumentType doctype() const; #if WEBKIT_IMPLEMENTATION WebDocument(const WTF::PassRefPtr<WebCore::Document>&); diff --git a/WebKit/chromium/public/WebDocumentType.h b/WebKit/chromium/public/WebDocumentType.h new file mode 100644 index 0000000..b339320 --- /dev/null +++ b/WebKit/chromium/public/WebDocumentType.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDocumentType_h +#define WebDocumentType_h + +#include "WebNode.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class DocumentType; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebString; + +// Provides readonly access to some properties of a DOM document type. +class WebDocumentType : public WebNode { +public: + WebDocumentType() { } + WebDocumentType(const WebDocumentType& e) : WebNode(e) { } + + WebDocumentType& operator=(const WebDocumentType& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebDocumentType& e) { WebNode::assign(e); } + + WEBKIT_API WebString name() const; + +#if WEBKIT_IMPLEMENTATION + WebDocumentType(const WTF::PassRefPtr<WebCore::DocumentType>&); + WebDocumentType& operator=(const WTF::PassRefPtr<WebCore::DocumentType>&); + operator WTF::PassRefPtr<WebCore::DocumentType>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDragData.h b/WebKit/chromium/public/WebDragData.h index 0b861c8..2979519 100644 --- a/WebKit/chromium/public/WebDragData.h +++ b/WebKit/chromium/public/WebDragData.h @@ -72,8 +72,6 @@ public: WEBKIT_API WebString urlTitle() const; WEBKIT_API void setURLTitle(const WebString&); - WEBKIT_API WebURL downloadURL() const; - WEBKIT_API void setDownloadURL(const WebURL&); WEBKIT_API WebString downloadMetadata() const; WEBKIT_API void setDownloadMetadata(const WebString&); diff --git a/WebKit/chromium/public/WebElement.h b/WebKit/chromium/public/WebElement.h index 20f6c9a..16a82d8 100644 --- a/WebKit/chromium/public/WebElement.h +++ b/WebKit/chromium/public/WebElement.h @@ -35,10 +35,11 @@ #if WEBKIT_IMPLEMENTATION namespace WebCore { class Element; } -namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { +class WebNamedNodeMap; + // Provides access to some properties of a DOM element node. class WebElement : public WebNode { public: @@ -48,11 +49,13 @@ namespace WebKit { WebElement& operator=(const WebElement& e) { WebNode::assign(e); return *this; } void assign(const WebElement& e) { WebNode::assign(e); } + WEBKIT_API bool isFormControlElement() const; WEBKIT_API WebString tagName() const; WEBKIT_API bool hasTagName(const WebString&) const; WEBKIT_API bool hasAttribute(const WebString&) const; WEBKIT_API WebString getAttribute(const WebString&) const; WEBKIT_API bool setAttribute(const WebString& name, const WebString& value); + WEBKIT_API WebNamedNodeMap attributes() const; WEBKIT_API WebString innerText() const; #if WEBKIT_IMPLEMENTATION diff --git a/WebKit/chromium/public/WebEventListener.h b/WebKit/chromium/public/WebEventListener.h index 52de1cd..62ca0de 100644 --- a/WebKit/chromium/public/WebEventListener.h +++ b/WebKit/chromium/public/WebEventListener.h @@ -31,6 +31,8 @@ #ifndef WebEventListener_h #define WebEventListener_h +#include "WebCommon.h" + #if WEBKIT_IMPLEMENTATION namespace WebCore { class Node; } #endif @@ -45,8 +47,8 @@ class WebString; class WebEventListener { public: - WebEventListener(); - virtual ~WebEventListener(); + WEBKIT_API WebEventListener(); + WEBKIT_API virtual ~WebEventListener(); // Called when an event is received. virtual void handleEvent(const WebEvent&) = 0; diff --git a/WebKit/chromium/public/WebFileChooserParams.h b/WebKit/chromium/public/WebFileChooserParams.h index 6359f14..2a30944 100644 --- a/WebKit/chromium/public/WebFileChooserParams.h +++ b/WebKit/chromium/public/WebFileChooserParams.h @@ -40,6 +40,8 @@ namespace WebKit { struct WebFileChooserParams { // If |multiSelect| is true, the dialog allow to select multiple files. bool multiSelect; + // If |directory| is true, the dialog allows the user to select a directory. + bool directory; // |title| is a title of a file chooser dialog. It can be an empty string. WebString title; // |initialValue| is a filename which the dialog should select by default. diff --git a/WebKit/chromium/public/WebFileSystem.h b/WebKit/chromium/public/WebFileSystem.h new file mode 100644 index 0000000..fc6e6dd --- /dev/null +++ b/WebKit/chromium/public/WebFileSystem.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFileSystem_h +#define WebFileSystem_h + +#include "WebCommon.h" +#include "WebString.h" +#include "WebURL.h" + +namespace WebKit { + +class WebFileSystem { +public: +#ifdef WIN32 + typedef HANDLE FileHandle; +#else + typedef int FileHandle; +#endif + + virtual bool fileExists(const WebString& path) { return false; } + virtual bool deleteFile(const WebString& path) { return false; } + virtual bool deleteEmptyDirectory(const WebString& path) { return false; } + virtual bool getFileSize(const WebString& path, long long& result) { return false; } + virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } + virtual WebString directoryName(const WebString& path) { return WebString(); } + virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } + virtual bool makeAllDirectories(const WebString& path) { return false; } + virtual WebString getAbsolutePath(const WebString& path) { return WebString(); } + virtual bool isDirectory(const WebString& path) { return false; } + virtual WebURL filePathToURL(const WebString& path) { return WebURL(); } + virtual FileHandle openFile(const WebString& path, int mode) { return FileHandle(); } + // Should set the FileHandle to a invalid value if the file is closed successfully. + virtual void closeFile(FileHandle&) { } + virtual long long seekFile(FileHandle, long long offset, int origin) { return 0; } + virtual bool truncateFile(FileHandle, long long offset) { return false; } + virtual int readFromFile(FileHandle, char* data, int length) { return 0; } + virtual int writeToFile(FileHandle, const char* data, int length) { return 0; } + +protected: + ~WebFileSystem() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFloatPoint.h b/WebKit/chromium/public/WebFloatPoint.h new file mode 100644 index 0000000..c053ed6 --- /dev/null +++ b/WebKit/chromium/public/WebFloatPoint.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatPoint_h +#define WebFloatPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#endif + +namespace WebKit { + +struct WebFloatPoint { + float x; + float y; + + WebFloatPoint() + : x(0.0f) + , y(0.0f) + { + } + + WebFloatPoint(float x, float y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatPoint(const WebCore::FloatPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebFloatPoint& operator=(const WebCore::FloatPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::FloatPoint() const + { + return WebCore::FloatPoint(x, y); + } +#endif +}; + +inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFloatRect.h b/WebKit/chromium/public/WebFloatRect.h new file mode 100644 index 0000000..a883513 --- /dev/null +++ b/WebKit/chromium/public/WebFloatRect.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatRect_h +#define WebFloatRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif + +namespace WebKit { + +struct WebFloatRect { + float x; + float y; + float width; + float height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebFloatRect() + : x(0.0f) + , y(0.0f) + , width(0.0f) + , height(0.0f) + { + } + + WebFloatRect(float x, float y, float width, float height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatRect(const WebCore::FloatRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const WebCore::FloatRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::FloatRect() const + { + return WebCore::FloatRect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFont.h b/WebKit/chromium/public/WebFont.h new file mode 100644 index 0000000..a20d52f --- /dev/null +++ b/WebKit/chromium/public/WebFont.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFont_h +#define WebFont_h + +#include "WebCanvas.h" +#include "WebColor.h" +#include "WebCommon.h" + +namespace WebKit { + +struct WebFontDescription; +struct WebFloatPoint; +struct WebFloatRect; +struct WebPoint; +struct WebRect; +struct WebTextRun; + +class WebFont { +public: + virtual ~WebFont() { } + + WEBKIT_API static WebFont* create(const WebFontDescription&); + + virtual WebFontDescription fontDescription() const = 0; + + virtual int ascent() const = 0; + virtual int descent() const = 0; + virtual int height() const = 0; + virtual int lineSpacing() const = 0; + virtual float xHeight() const = 0; + + // Draws the text run to the given canvas. The text is positioned at the + // given left-hand point at the baseline. + // + // The text will be clipped to the given clip rect. |canvasIsOpaque| is + // used to control whether subpixel antialiasing is possible. If there is a + // possibility the area drawn could be semi-transparent, subpixel + // antialiasing will be disabled. + // + // |from| and |to| allow the caller to specify a subrange of the given text + // run to draw. If |to| is -1, the entire run will be drawn. + virtual void drawText(WebCanvas*, const WebTextRun&, const WebFloatPoint& leftBaseline, WebColor, + const WebRect& clip, bool canvasIsOpaque, + int from = 0, int to = -1) const = 0; + + // Measures the width in pixels of the given text run. + virtual int calculateWidth(const WebTextRun&) const = 0; + + // Returns the character offset corresponding to the given horizontal pixel + // position as measured from from the left of the run. + virtual int offsetForPosition(const WebTextRun&, float position) const = 0; + + // Returns the rectangle representing the selection rect for the subrange + // |from| -> |to| of the given text run. You can use -1 for |to| to specify + // the entire run (this will do something similar to calling width()). + // + // The rect will be positioned as if the text was drawn at the given + // |leftBaseline| position. |height| indicates the height of the selection + // rect you want, typically this will just be the height() of this font. + // + // To get the pixel offset of some character (the opposite of + // offsetForPosition()), pass in a |leftBaseline| = (0, 0), |from| = 0, and + // |to| = the character you want. The right edge of the resulting selection + // rect will tell you the right side of the character. + virtual WebFloatRect selectionRectForText(const WebTextRun&, const WebFloatPoint& leftBaseline, + int height, int from = 0, int to = -1) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFontDescription.h b/WebKit/chromium/public/WebFontDescription.h new file mode 100644 index 0000000..d4bb07e --- /dev/null +++ b/WebKit/chromium/public/WebFontDescription.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFontDescription_h +#define WebFontDescription_h + +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class FontDescription; } +#endif + +namespace WebKit { + +struct WebFontDescription { + enum GenericFamily { + GenericFamilyNone, + GenericFamilyStandard, + GenericFamilySerif, + GenericFamilySansSerif, + GenericFamilyMonospace, + GenericFamilyCursive, + GenericFamilyFantasy + }; + + enum Smoothing { + SmoothingAuto, + SmoothingNone, + SmoothingGrayscale, + SmoothingSubpixel + }; + + enum Weight { + Weight100, + Weight200, + Weight300, + Weight400, + Weight500, + Weight600, + Weight700, + Weight800, + Weight900, + WeightNormal = Weight400, + WeightBold = Weight700 + }; + + WebFontDescription() + : genericFamily(GenericFamilyNone) + , size(0) + , italic(false) + , smallCaps(false) + , weight(WeightNormal) + , smoothing(SmoothingAuto) + , letterSpacing(0) + , wordSpacing(0) + { + } + + WebString family; + GenericFamily genericFamily; + float size; + bool italic; + bool smallCaps; + Weight weight; + Smoothing smoothing; + + short letterSpacing; + short wordSpacing; + +#if WEBKIT_IMPLEMENTATION + WebFontDescription(const WebCore::FontDescription&, short fontLetterSpacing, short fontWordSpacing); + + operator WebCore::FontDescription() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFormControlElement.h b/WebKit/chromium/public/WebFormControlElement.h new file mode 100644 index 0000000..ee0783d --- /dev/null +++ b/WebKit/chromium/public/WebFormControlElement.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFormControlElement_h +#define WebFormControlElement_h + +#include "WebElement.h" +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLFormControlElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM form control element node. +class WebFormControlElement : public WebElement { +public: + WebFormControlElement() : WebElement() { } + WebFormControlElement(const WebFormControlElement& e) : WebElement(e) { } + + WebFormControlElement& operator=(const WebFormControlElement& e) + { + WebElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebFormControlElement& e) { WebElement::assign(e); } + + WEBKIT_API bool isEnabled() const; + WEBKIT_API WebString formControlName() const; + WEBKIT_API WebString formControlType() const; + + // Returns the name that should be used for the specified |element| when + // storing autofill data. This is either the field name or its id, an empty + // string if it has no name and no id. + WEBKIT_API WebString nameForAutofill() const; + +#if WEBKIT_IMPLEMENTATION + WebFormControlElement(const WTF::PassRefPtr<WebCore::HTMLFormControlElement>&); + WebFormControlElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormControlElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormControlElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFormElement.h b/WebKit/chromium/public/WebFormElement.h index b07bff9..2b4ee53 100644 --- a/WebKit/chromium/public/WebFormElement.h +++ b/WebKit/chromium/public/WebFormElement.h @@ -32,15 +32,17 @@ #define WebFormElement_h #include "WebElement.h" -#include "WebInputElement.h" #include "WebVector.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class HTMLFormElement; } -namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { + + class WebInputElement; + class WebFormControlElement; + // A container for passing around a reference to a form element. Provides // some information about the form. class WebFormElement : public WebElement { @@ -57,20 +59,21 @@ namespace WebKit { } WEBKIT_API void assign(const WebFormElement& e) { WebElement::assign(e); } -#if WEBKIT_IMPLEMENTATION - WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); - WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); - operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const; -#endif - WEBKIT_API bool autoComplete() const; WEBKIT_API WebString action() const; WEBKIT_API WebString name() const; WEBKIT_API WebString method() const; + WEBKIT_API bool wasUserSubmitted() const; WEBKIT_API void submit(); // FIXME: Deprecate and replace with WebVector<WebElement>. WEBKIT_API void getNamedElements(const WebString&, WebVector<WebNode>&); - WEBKIT_API void getInputElements(WebVector<WebInputElement>&) const; + WEBKIT_API void getFormControlElements(WebVector<WebFormControlElement>&) const; + +#if WEBKIT_IMPLEMENTATION + WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const; +#endif }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebFrame.h b/WebKit/chromium/public/WebFrame.h index a56e6cb..c4fa7ae 100644 --- a/WebKit/chromium/public/WebFrame.h +++ b/WebKit/chromium/public/WebFrame.h @@ -39,6 +39,8 @@ struct NPObject; #if WEBKIT_USING_V8 namespace v8 { class Context; +class Value; +template <class T> class Handle; template <class T> class Local; } #endif @@ -100,7 +102,11 @@ public: // The name of this frame. virtual WebString name() const = 0; - virtual void clearName() = 0; + + // Sets the name of this frame. For child frames (frames that are not a + // top-most frame) the actual name may have a suffix appended to make the + // frame name unique within the hierarchy. + virtual void setName(const WebString&) = 0; // The url of the document loaded in this frame. This is equivalent to // dataSource()->request().url(). @@ -123,6 +129,9 @@ public: // NOTE: These routines do not force page layout so their results may // not be accurate if the page layout is out-of-date. + // If set to false, do not draw scrollbars on this frame's view. + virtual void setCanHaveScrollbars(bool) = 0; + // The scroll offset from the top-left corner of the frame in pixels. virtual WebSize scrollOffset() const = 0; @@ -222,6 +231,11 @@ public: virtual void collectGarbage() = 0; #if WEBKIT_USING_V8 + // Executes script in the context of the current page and returns the value + // that the script evaluated to. + virtual v8::Handle<v8::Value> executeScriptAndReturnValue( + const WebScriptSource&) = 0; + // Returns the V8 context for this frame, or an empty handle if there // is none. virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0; @@ -241,7 +255,9 @@ public: // Navigation ---------------------------------------------------------- // Reload the current document. - virtual void reload() = 0; + // True |ignoreCache| explicitly bypasses caches. + // False |ignoreCache| revalidates any existing cache entries. + virtual void reload(bool ignoreCache = false) = 0; // Load the given URL. virtual void loadRequest(const WebURLRequest&) = 0; @@ -365,10 +381,14 @@ public: // Printing ------------------------------------------------------------ - // Reformats the WebFrame for printing. pageSize is the page size in - // pixels. Returns the number of pages that can be printed at the - // given page size. - virtual int printBegin(const WebSize& pageSize) = 0; + // Reformats the WebFrame for printing. pageSize is the page size in + // points (a point in 1/72 of an inch). printerDPI is the user selected, + // DPI for the printer. Returns the number of pages that + // can be printed at the given page size. The out param useBrowserOverlays + // specifies whether the browser process should use its overlays (header, + // footer, margins etc) or whether the renderer controls this. + virtual int printBegin(const WebSize& pageSize, int printerDPI = 72, + bool* useBrowserOverlays = 0) = 0; // Returns the page shrinking factor calculated by webkit (usually // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or @@ -383,6 +403,21 @@ public: // Reformats the WebFrame for screen display. virtual void printEnd() = 0; + // CSS3 Paged Media ---------------------------------------------------- + + // Returns true if page box (margin boxes and page borders) is visible. + virtual bool isPageBoxVisible(int pageIndex) = 0; + + // Returns the preferred page size and margins in pixels, assuming 96 + // pixels per inch. pageSize, marginTop, marginRight, marginBottom, + // marginLeft must be initialized to the default values that are used if + // auto is specified. + virtual void pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft) = 0; // Find-in-page -------------------------------------------------------- @@ -446,20 +481,20 @@ public: // Registers a listener for the specified user name input element. The // listener will receive notifications for blur and when autocomplete // should be triggered. - // The WebFrame becomes the owner of the passed listener. - virtual void registerPasswordListener( + // An element can have only one listener. If a listener already exists, + // this method returns false and does not add the new one. + // Either way, the WebFrame becomes the owner of the passed listener. + virtual bool registerPasswordListener( WebInputElement, WebPasswordAutocompleteListener*) = 0; + // Dispatches an Autocompletion notification to registered listener if one + // exists that is registered against the WebInputElement specified. + virtual void notifiyPasswordListenerOfAutocomplete( + const WebInputElement&) = 0; - // Utility ------------------------------------------------------------- - // Given a relative URL, returns an absolute URL by resolving the URL - // relative to the base URL of the frame's document. This uses the - // same algorithm that WebKit uses to resolve hyperlinks found in a - // HTML document. - // Deprecated. Use document().completeURL() instead. - virtual WebURL completeURL(const WebString&) const = 0; + // Utility ------------------------------------------------------------- // Returns the contents of this frame as a string. If the text is // longer than maxChars, it will be clipped to that length. WARNING: @@ -490,6 +525,12 @@ public: float pageWidthInPixels, float pageHeightInPixels) const = 0; + // Returns the bounds rect for current selection. If selection is performed + // on transformed text, the rect will still bound the selection but will + // not be transformed itself. If no selection is present, the rect will be + // empty ((0,0), (0,0)). + virtual WebRect selectionBoundsRect() const = 0; + protected: ~WebFrame() { } }; diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h index 4078151..2b7ee0d 100644 --- a/WebKit/chromium/public/WebFrameClient.h +++ b/WebKit/chromium/public/WebFrameClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,6 +38,9 @@ namespace WebKit { +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebCookieJar; class WebDataSource; class WebFormElement; class WebFrame; @@ -74,6 +77,16 @@ public: // May return null. virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) { return 0; } + // May return null. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*) { return 0; } + + + // Services ------------------------------------------------------------ + + // A frame specific cookie jar. May return null, in which case + // WebKitClient::cookieJar() will be called to access cookies. + virtual WebCookieJar* cookieJar() { return 0; } + // General notifications ----------------------------------------------- @@ -83,6 +96,9 @@ public: // Controls whether plugins are allowed for this frame. virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled. + virtual void didNotAllowPlugins(WebFrame*) { } + // Controls whether images are allowed for this frame. virtual bool allowImages(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } @@ -122,6 +138,10 @@ public: // Navigational notifications ------------------------------------------ + // A form submission has been requested, but the page's submit event handler + // hasn't yet had a chance to run (and possibly alter/interrupt the submit.) + virtual void willSendSubmitEvent(WebFrame*, const WebFormElement&) { } + // A form submission is about to occur. virtual void willSubmitForm(WebFrame*, const WebFormElement&) { } @@ -176,6 +196,9 @@ public: // The page title is available. virtual void didReceiveTitle(WebFrame*, const WebString& title) { } + // The icons for the page have changed. + virtual void didChangeIcons(WebFrame*) { } + // The frame's document finished loading. virtual void didFinishDocumentLoad(WebFrame*) { } @@ -188,9 +211,14 @@ public: // The frame's document and all of its subresources succeeded to load. virtual void didFinishLoad(WebFrame*) { } + // The navigation resulted in no change to the documents within the page. + // For example, the navigation may have just resulted in scrolling to a + // named anchor or a PopState event may have been dispatched. + virtual void didNavigateWithinPage(WebFrame*, bool isNewNavigation) { } + // The navigation resulted in scrolling the page to a named anchor instead // of downloading a new document. - virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) { } + virtual void didChangeLocationWithinPage(WebFrame*) { } // Called upon update to scroll position, document state, and other // non-navigational events related to the data held by WebHistoryItem. @@ -245,6 +273,12 @@ public: // Controls whether scripts are allowed to execute for this frame. virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + // Controls whether access to Web Databases is allowed for this frame. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) { return true; } + + // Notifies the client that the frame would have executed script if script were enabled. + virtual void didNotAllowScript(WebFrame*) { } + // Script in the page tried to allocate too much memory. virtual void didExhaustMemoryAvailableForScript(WebFrame*) { } @@ -263,6 +297,12 @@ public: // Geometry notifications ---------------------------------------------- + // The frame's document finished the initial layout of a page. + virtual void didFirstLayout(WebFrame*) { } + + // The frame's document finished the initial non-empty layout of a page. + virtual void didFirstVisuallyNonEmptyLayout(WebFrame*) { } + // The size of the content area changed. virtual void didChangeContentsSize(WebFrame*, const WebSize&) { } diff --git a/WebKit/chromium/public/WebGLES2Context.h b/WebKit/chromium/public/WebGLES2Context.h new file mode 100644 index 0000000..c67faf2 --- /dev/null +++ b/WebKit/chromium/public/WebGLES2Context.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLES2Context_h +#define WebGLES2Context_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" + +namespace WebKit { + +struct WebSize; +class WebView; + +// This interface abstracts the creation and management of an +// OpenGL ES 2.0 context. + +class WebGLES2Context : public WebNonCopyable { +public: + virtual ~WebGLES2Context() {} + + virtual bool initialize(WebView*, WebGLES2Context* parent) = 0; + virtual bool makeCurrent() = 0; + virtual bool destroy() = 0; + virtual bool swapBuffers() = 0; + + // The follow two functions are for managing a context that renders offscreen. + + // Resizes the backing store used for offscreen rendering. + virtual void resizeOffscreenContent(const WebSize&) = 0; + + // Returns the ID of the texture used for offscreen rendering in the context of the parent. + virtual unsigned getOffscreenContentParentTextureId() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebGeolocationService.h b/WebKit/chromium/public/WebGeolocationService.h new file mode 100644 index 0000000..ed8c4e8 --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationService.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010, Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGeolocationService_h +#define WebGeolocationService_h + +#include "WebGeolocationServiceBridge.h" + +namespace WebKit { + +class WebString; +class WebURL; + +// Provides an embedder API called by WebKit. +class WebGeolocationService { +public: + virtual void requestPermissionForFrame(int bridgeId, const WebURL& url) { } + virtual void cancelPermissionRequestForFrame(int bridgeId, const WebURL&) { } + virtual void startUpdating(int bridgeId, const WebURL& url, bool enableHighAccuracy) { } + virtual void stopUpdating(int bridgeId) { } + virtual void suspend(int bridgeId) { } + virtual void resume(int bridgeId) { } + + // Attaches the WebGeolocationServiceBridge to the embedder and returns its + // id, which should be used on subsequent calls for the methods above. + virtual int attachBridge(WebGeolocationServiceBridge*) { return 0; } + + // Detaches the WebGeolocationServiceBridge from the embedder. + virtual void detachBridge(int bridgeId) { } +}; + +} // namespace WebKit + +#endif // WebGeolocationService_h diff --git a/WebKit/chromium/public/WebGeolocationServiceBridge.h b/WebKit/chromium/public/WebGeolocationServiceBridge.h new file mode 100644 index 0000000..9f0ffd4 --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationServiceBridge.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010, Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGeolocationServiceBridge_h +#define WebGeolocationServiceBridge_h + +namespace WebCore { +class GeolocationServiceBridge; +class GeolocationServiceChromium; +} + +namespace WebKit { + +class WebString; +class WebURL; + +// Provides a WebKit API called by the embedder. +class WebGeolocationServiceBridge { +public: + virtual void setIsAllowed(bool allowed) = 0; + virtual void setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp) = 0; + virtual void setLastError(int errorCode, const WebString& message) = 0; +}; + +} // namespace WebKit + +#endif // WebGeolocationServiceBridge_h diff --git a/WebKit/chromium/public/WebGeolocationServiceMock.h b/WebKit/chromium/public/WebGeolocationServiceMock.h new file mode 100644 index 0000000..407fe9d --- /dev/null +++ b/WebKit/chromium/public/WebGeolocationServiceMock.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010, Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGeolocationServiceMock_h +#define WebGeolocationServiceMock_h + +#include "WebCommon.h" +#include "WebGeolocationService.h" + +namespace WebKit { + +class WebString; + +class WebGeolocationServiceMock : public WebGeolocationService { +public: + WEBKIT_API static WebGeolocationServiceMock* createWebGeolocationServiceMock(); + WEBKIT_API static void setMockGeolocationPermission(bool allowed); + WEBKIT_API static void setMockGeolocationPosition(double latitude, double longitude, double accuracy); + WEBKIT_API static void setMockGeolocationError(int errorCode, const WebString& message); + +protected: + static bool s_mockGeolocationPermission; +}; + +} // namespace WebKit + +#endif // WebGeolocationServiceMock_h diff --git a/WebKit/chromium/public/WebGraphicsContext3D.h b/WebKit/chromium/public/WebGraphicsContext3D.h new file mode 100644 index 0000000..4378afb --- /dev/null +++ b/WebKit/chromium/public/WebGraphicsContext3D.h @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGraphicsContext3D_h +#define WebGraphicsContext3D_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebString.h" + +namespace WebKit { + +// Typedef for server-side objects like OpenGL textures and program objects. +typedef unsigned int WebGLId; + +class WebView; + +// This interface abstracts the operations performed by the +// GraphicsContext3D in order to implement WebGL. Nearly all of the +// methods exposed on this interface map directly to entry points in +// the OpenGL ES 2.0 API. + +class WebGraphicsContext3D : public WebNonCopyable { +public: + // Return value from getActiveUniform and getActiveAttrib. + struct ActiveInfo { + WebString name; + unsigned type; + int size; + }; + + // Context creation attributes. + struct Attributes { + Attributes() + : alpha(true) + , depth(true) + , stencil(true) + , antialias(true) + , premultipliedAlpha(true) + { + } + + bool alpha; + bool depth; + bool stencil; + bool antialias; + bool premultipliedAlpha; + }; + + // This destructor needs to be public so that using classes can destroy instances if initialization fails. + virtual ~WebGraphicsContext3D() {} + + // Creates a "default" implementation of WebGraphicsContext3D which calls + // OpenGL directly. + WEBKIT_API static WebGraphicsContext3D* createDefault(); + + // Initializes the graphics context; should be the first operation performed + // on newly-constructed instances. Returns true on success. + virtual bool initialize(Attributes, WebView*) = 0; + + // Makes the OpenGL context current on the current thread. Returns true on + // success. + virtual bool makeContextCurrent() = 0; + + // The size of the region into which this WebGraphicsContext3D is rendering. + // Returns the last values passed to reshape(). + virtual int width() = 0; + virtual int height() = 0; + + // Helper to return the size in bytes of OpenGL data types + // like GL_FLOAT, GL_INT, etc. + virtual int sizeInBytes(int type) = 0; + + // Resizes the region into which this WebGraphicsContext3D is drawing. + virtual void reshape(int width, int height) = 0; + + // Query whether it is built on top of compliant GLES2 implementation. + virtual bool isGLES2Compliant() = 0; + + // Helper for software compositing path. Reads back the frame buffer into + // the memory region pointed to by "pixels" with size "bufferSize". It is + // expected that the storage for "pixels" covers (4 * width * height) bytes. + // Returns true on success. + virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize) = 0; + + // Returns the id of the texture which is used for storing the contents of + // the framebuffer associated with this context. This texture is accessible + // by the gpu-based page compositor. + virtual unsigned getPlatformTextureId() = 0; + + // Copies the contents of the off-screen render target used by the WebGL + // context to the corresponding texture used by the compositor. + virtual void prepareTexture() = 0; + + // Synthesizes an OpenGL error which will be returned from a + // later call to getError. This is used to emulate OpenGL ES + // 2.0 behavior on the desktop and to enforce additional error + // checking mandated by WebGL. + // + // Per the behavior of glGetError, this stores at most one + // instance of any given error, and returns them from calls to + // getError in the order they were added. + virtual void synthesizeGLError(unsigned long error) = 0; + + // The entry points below map directly to the OpenGL ES 2.0 API. + // See: http://www.khronos.org/registry/gles/ + // and: http://www.khronos.org/opengles/sdk/docs/man/ + virtual void activeTexture(unsigned long texture) = 0; + virtual void attachShader(WebGLId program, WebGLId shader) = 0; + virtual void bindAttribLocation(WebGLId program, unsigned long index, const char* name) = 0; + virtual void bindBuffer(unsigned long target, WebGLId buffer) = 0; + virtual void bindFramebuffer(unsigned long target, WebGLId framebuffer) = 0; + virtual void bindRenderbuffer(unsigned long target, WebGLId renderbuffer) = 0; + virtual void bindTexture(unsigned long target, WebGLId texture) = 0; + virtual void blendColor(double red, double green, double blue, double alpha) = 0; + virtual void blendEquation(unsigned long mode) = 0; + virtual void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha) = 0; + virtual void blendFunc(unsigned long sfactor, unsigned long dfactor) = 0; + virtual void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha) = 0; + + virtual void bufferData(unsigned long target, int size, const void* data, unsigned long usage) = 0; + virtual void bufferSubData(unsigned long target, long offset, int size, const void* data) = 0; + + virtual unsigned long checkFramebufferStatus(unsigned long target) = 0; + virtual void clear(unsigned long mask) = 0; + virtual void clearColor(double red, double green, double blue, double alpha) = 0; + virtual void clearDepth(double depth) = 0; + virtual void clearStencil(long s) = 0; + virtual void colorMask(bool red, bool green, bool blue, bool alpha) = 0; + virtual void compileShader(WebGLId shader) = 0; + + virtual void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) = 0; + virtual void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) = 0; + virtual void cullFace(unsigned long mode) = 0; + virtual void depthFunc(unsigned long func) = 0; + virtual void depthMask(bool flag) = 0; + virtual void depthRange(double zNear, double zFar) = 0; + virtual void detachShader(WebGLId program, WebGLId shader) = 0; + virtual void disable(unsigned long cap) = 0; + virtual void disableVertexAttribArray(unsigned long index) = 0; + virtual void drawArrays(unsigned long mode, long first, long count) = 0; + virtual void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) = 0; + + virtual void enable(unsigned long cap) = 0; + virtual void enableVertexAttribArray(unsigned long index) = 0; + virtual void finish() = 0; + virtual void flush() = 0; + virtual void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLId renderbuffer) = 0; + virtual void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLId texture, long level) = 0; + virtual void frontFace(unsigned long mode) = 0; + virtual void generateMipmap(unsigned long target) = 0; + + virtual bool getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo&) = 0; + virtual bool getActiveUniform(WebGLId program, unsigned long index, ActiveInfo&) = 0; + + virtual void getAttachedShaders(WebGLId program, int maxCount, int* count, unsigned int* shaders) = 0; + + virtual int getAttribLocation(WebGLId program, const char* name) = 0; + + virtual void getBooleanv(unsigned long pname, unsigned char* value) = 0; + + virtual void getBufferParameteriv(unsigned long target, unsigned long pname, int* value) = 0; + + virtual Attributes getContextAttributes() = 0; + + virtual unsigned long getError() = 0; + + virtual void getFloatv(unsigned long pname, float* value) = 0; + + virtual void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value) = 0; + + virtual void getIntegerv(unsigned long pname, int* value) = 0; + + virtual void getProgramiv(WebGLId program, unsigned long pname, int* value) = 0; + + virtual WebString getProgramInfoLog(WebGLId program) = 0; + + virtual void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value) = 0; + + virtual void getShaderiv(WebGLId shader, unsigned long pname, int* value) = 0; + + virtual WebString getShaderInfoLog(WebGLId shader) = 0; + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + virtual WebString getShaderSource(WebGLId shader) = 0; + virtual WebString getString(unsigned long name) = 0; + + virtual void getTexParameterfv(unsigned long target, unsigned long pname, float* value) = 0; + virtual void getTexParameteriv(unsigned long target, unsigned long pname, int* value) = 0; + + virtual void getUniformfv(WebGLId program, long location, float* value) = 0; + virtual void getUniformiv(WebGLId program, long location, int* value) = 0; + + virtual long getUniformLocation(WebGLId program, const char* name) = 0; + + virtual void getVertexAttribfv(unsigned long index, unsigned long pname, float* value) = 0; + virtual void getVertexAttribiv(unsigned long index, unsigned long pname, int* value) = 0; + + virtual long getVertexAttribOffset(unsigned long index, unsigned long pname) = 0; + + virtual void hint(unsigned long target, unsigned long mode) = 0; + virtual bool isBuffer(WebGLId buffer) = 0; + virtual bool isEnabled(unsigned long cap) = 0; + virtual bool isFramebuffer(WebGLId framebuffer) = 0; + virtual bool isProgram(WebGLId program) = 0; + virtual bool isRenderbuffer(WebGLId renderbuffer) = 0; + virtual bool isShader(WebGLId shader) = 0; + virtual bool isTexture(WebGLId texture) = 0; + virtual void lineWidth(double) = 0; + virtual void linkProgram(WebGLId program) = 0; + virtual void pixelStorei(unsigned long pname, long param) = 0; + virtual void polygonOffset(double factor, double units) = 0; + + virtual void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* pixels) = 0; + + virtual void releaseShaderCompiler() = 0; + virtual void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) = 0; + virtual void sampleCoverage(double value, bool invert) = 0; + virtual void scissor(long x, long y, unsigned long width, unsigned long height) = 0; + virtual void shaderSource(WebGLId shader, const char* string) = 0; + virtual void stencilFunc(unsigned long func, long ref, unsigned long mask) = 0; + virtual void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask) = 0; + virtual void stencilMask(unsigned long mask) = 0; + virtual void stencilMaskSeparate(unsigned long face, unsigned long mask) = 0; + virtual void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass) = 0; + virtual void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass) = 0; + + virtual void texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, const void* pixels) = 0; + + virtual void texParameterf(unsigned target, unsigned pname, float param) = 0; + virtual void texParameteri(unsigned target, unsigned pname, int param) = 0; + + virtual void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, const void* pixels) = 0; + + virtual void uniform1f(long location, float x) = 0; + virtual void uniform1fv(long location, int count, float* v) = 0; + virtual void uniform1i(long location, int x) = 0; + virtual void uniform1iv(long location, int count, int* v) = 0; + virtual void uniform2f(long location, float x, float y) = 0; + virtual void uniform2fv(long location, int count, float* v) = 0; + virtual void uniform2i(long location, int x, int y) = 0; + virtual void uniform2iv(long location, int count, int* v) = 0; + virtual void uniform3f(long location, float x, float y, float z) = 0; + virtual void uniform3fv(long location, int count, float* v) = 0; + virtual void uniform3i(long location, int x, int y, int z) = 0; + virtual void uniform3iv(long location, int count, int* v) = 0; + virtual void uniform4f(long location, float x, float y, float z, float w) = 0; + virtual void uniform4fv(long location, int count, float* v) = 0; + virtual void uniform4i(long location, int x, int y, int z, int w) = 0; + virtual void uniform4iv(long location, int count, int* v) = 0; + virtual void uniformMatrix2fv(long location, int count, bool transpose, const float* value) = 0; + virtual void uniformMatrix3fv(long location, int count, bool transpose, const float* value) = 0; + virtual void uniformMatrix4fv(long location, int count, bool transpose, const float* value) = 0; + + virtual void useProgram(WebGLId program) = 0; + virtual void validateProgram(WebGLId program) = 0; + + virtual void vertexAttrib1f(unsigned long indx, float x) = 0; + virtual void vertexAttrib1fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttrib2f(unsigned long indx, float x, float y) = 0; + virtual void vertexAttrib2fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttrib3f(unsigned long indx, float x, float y, float z) = 0; + virtual void vertexAttrib3fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w) = 0; + virtual void vertexAttrib4fv(unsigned long indx, const float* values) = 0; + virtual void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, + unsigned long stride, unsigned long offset) = 0; + + virtual void viewport(long x, long y, unsigned long width, unsigned long height) = 0; + + // Support for buffer creation and deletion. + virtual unsigned createBuffer() = 0; + virtual unsigned createFramebuffer() = 0; + virtual unsigned createProgram() = 0; + virtual unsigned createRenderbuffer() = 0; + virtual unsigned createShader(unsigned long) = 0; + virtual unsigned createTexture() = 0; + + virtual void deleteBuffer(unsigned) = 0; + virtual void deleteFramebuffer(unsigned) = 0; + virtual void deleteProgram(unsigned) = 0; + virtual void deleteRenderbuffer(unsigned) = 0; + virtual void deleteShader(unsigned) = 0; + virtual void deleteTexture(unsigned) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebHTTPBody.h b/WebKit/chromium/public/WebHTTPBody.h index fcc44ff..a7dc7c9 100644 --- a/WebKit/chromium/public/WebHTTPBody.h +++ b/WebKit/chromium/public/WebHTTPBody.h @@ -81,9 +81,9 @@ public: // Append to the list of elements. WEBKIT_API void appendData(const WebData&); - WEBKIT_API void appendFile(const WebString&); // FIXME: to be removed. + WEBKIT_API void appendFile(const WebString&); // Passing -1 to fileLength means to the end of the file. - WEBKIT_API void appendFile(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&); + WEBKIT_API void appendFileRange(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&); // Identifies a particular form submission instance. A value of 0 is // used to indicate an unspecified identifier. diff --git a/WebKit/chromium/public/WebHistoryItem.h b/WebKit/chromium/public/WebHistoryItem.h index e248a61..1b4863e 100644 --- a/WebKit/chromium/public/WebHistoryItem.h +++ b/WebKit/chromium/public/WebHistoryItem.h @@ -32,17 +32,17 @@ #define WebHistoryItem_h #include "WebCommon.h" +#include "WebPrivatePtr.h" + +// FIXME: Remove this once Chromium starts using itemSequenceNumber. +#define WEBKIT_BUG_40451_IS_FIXED -#if WEBKIT_IMPLEMENTATION namespace WebCore { class HistoryItem; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif namespace WebKit { - -class WebHistoryItemPrivate; class WebHTTPBody; class WebString; +class WebSerializedScriptValue; struct WebPoint; template <typename T> class WebVector; @@ -55,8 +55,8 @@ class WebHistoryItem { public: ~WebHistoryItem() { reset(); } - WebHistoryItem() : m_private(0) { } - WebHistoryItem(const WebHistoryItem& h) : m_private(0) { assign(h); } + WebHistoryItem() { } + WebHistoryItem(const WebHistoryItem& h) { assign(h); } WebHistoryItem& operator=(const WebHistoryItem& h) { assign(h); @@ -67,7 +67,7 @@ public: WEBKIT_API void reset(); WEBKIT_API void assign(const WebHistoryItem&); - bool isNull() const { return !m_private; } + bool isNull() const { return m_private.isNull(); } WEBKIT_API WebString urlString() const; WEBKIT_API void setURLString(const WebString&); @@ -105,9 +105,15 @@ public: WEBKIT_API WebVector<WebString> documentState() const; WEBKIT_API void setDocumentState(const WebVector<WebString>&); + WEBKIT_API long long itemSequenceNumber() const; + WEBKIT_API void setItemSequenceNumber(long long); + WEBKIT_API long long documentSequenceNumber() const; WEBKIT_API void setDocumentSequenceNumber(long long); + WEBKIT_API WebSerializedScriptValue stateObject() const; + WEBKIT_API void setStateObject(const WebSerializedScriptValue&); + WEBKIT_API WebString httpContentType() const; WEBKIT_API void setHTTPContentType(const WebString&); @@ -125,9 +131,8 @@ public: #endif private: - void assign(WebHistoryItemPrivate*); void ensureMutable(); - WebHistoryItemPrivate* m_private; + WebPrivatePtr<WebCore::HistoryItem> m_private; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebIDBCallbacks.h b/WebKit/chromium/public/WebIDBCallbacks.h new file mode 100644 index 0000000..cee8612 --- /dev/null +++ b/WebKit/chromium/public/WebIDBCallbacks.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBCallbacks_h +#define WebIDBCallbacks_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebIDBDatabase; +class WebIDBDatabaseError; +class WebIDBKey; +class WebIDBIndex; +class WebIDBObjectStore; +class WebSerializedScriptValue; + +class WebIDBCallbacks { +public: + virtual ~WebIDBCallbacks() { } + + // For classes that follow the PImpl pattern, pass a const reference. + // For the rest, pass ownership to the callee via a pointer. + virtual void onError(const WebIDBDatabaseError&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess() { WEBKIT_ASSERT_NOT_REACHED(); } // For "null". + virtual void onSuccess(WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebIDBKey&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBIndex*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBObjectStore*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBCallbacks_h diff --git a/WebKit/chromium/public/WebIDBDatabase.h b/WebKit/chromium/public/WebIDBDatabase.h new file mode 100644 index 0000000..b0d6086 --- /dev/null +++ b/WebKit/chromium/public/WebIDBDatabase.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBDatabase_h +#define WebIDBDatabase_h + +#include "WebCommon.h" +#include "WebDOMStringList.h" + +namespace WebKit { + +class WebFrame; +class WebIDBCallbacks; +class WebIDBObjectStore; + +// See comment in WebIndexedDatabase for a high level overview of these classes. +class WebIDBDatabase { +public: + virtual ~WebIDBDatabase() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString description() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString version() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList objectStores() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBObjectStore to the caller. + virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) + { + WEBKIT_ASSERT_NOT_REACHED(); + } +}; + +} // namespace WebKit + +#endif // WebIDBDatabase_h diff --git a/WebKit/chromium/public/WebIDBDatabaseError.h b/WebKit/chromium/public/WebIDBDatabaseError.h new file mode 100644 index 0000000..a237d5f --- /dev/null +++ b/WebKit/chromium/public/WebIDBDatabaseError.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBDatabaseError_h +#define WebIDBDatabaseError_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" +#include "WebString.h" + +namespace WebCore { class IDBDatabaseError; } + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBDatabaseError { +public: + ~WebIDBDatabaseError() { reset(); } + + WEBKIT_API WebIDBDatabaseError(unsigned short code, const WebString& message) { assign(code, message); } + WEBKIT_API WebIDBDatabaseError(const WebIDBDatabaseError& e) { assign(e); } + WEBKIT_API WebIDBDatabaseError& operator=(const WebIDBDatabaseError& e) + { + assign(e); + return *this; + } + + WEBKIT_API void assign(const WebIDBDatabaseError&); + WEBKIT_API void reset(); + + WEBKIT_API unsigned short code() const; + WEBKIT_API WebString message() const; + +#if WEBKIT_IMPLEMENTATION + WebIDBDatabaseError(const WTF::PassRefPtr<WebCore::IDBDatabaseError>&); + WebIDBDatabaseError& operator=(const WTF::PassRefPtr<WebCore::IDBDatabaseError>&); + operator WTF::PassRefPtr<WebCore::IDBDatabaseError>() const; +#endif + +private: + WEBKIT_API void assign(unsigned short code, const WebString& message); + + WebPrivatePtr<WebCore::IDBDatabaseError> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBDatabaseError_h diff --git a/WebKit/chromium/public/WebIDBIndex.h b/WebKit/chromium/public/WebIDBIndex.h new file mode 100644 index 0000000..dafea0e --- /dev/null +++ b/WebKit/chromium/public/WebIDBIndex.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBIndex_h +#define WebIDBIndex_h + +#include "WebString.h" + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview of these classes. +class WebIDBIndex { +public: + virtual ~WebIDBIndex() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual bool unique() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return false; + } +}; + +} // namespace WebKit + +#endif // WebIDBIndex_h diff --git a/WebKit/chromium/public/WebIDBKey.h b/WebKit/chromium/public/WebIDBKey.h new file mode 100644 index 0000000..1cf336d --- /dev/null +++ b/WebKit/chromium/public/WebIDBKey.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBKey_h +#define WebIDBKey_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" +#include "WebString.h" + +namespace WebCore { class IDBKey; } + +namespace WebKit { + +class WebIDBKey { +public: + ~WebIDBKey() { reset(); } + + WEBKIT_API static WebIDBKey createNull(); + WEBKIT_API static WebIDBKey createInvalid(); + + WebIDBKey(const WebString& string) { assign(string); } + WebIDBKey(int32_t number) { assign(number); } + WebIDBKey(const WebIDBKey& e) { assign(e); } + WebIDBKey& operator=(const WebIDBKey& e) + { + assign(e); + return *this; + } + + WEBKIT_API void assign(const WebIDBKey&); + WEBKIT_API void assignNull(); + WEBKIT_API void assign(const WebString&); + WEBKIT_API void assign(int32_t); + WEBKIT_API void assignInvalid(); + WEBKIT_API void reset(); + + enum Type { + NullType = 0, + StringType, + NumberType, + // Types not in WebCore::IDBKey: + InvalidType + }; + + WEBKIT_API Type type() const; + WEBKIT_API WebString string() const; // Only valid for StringType. + WEBKIT_API int32_t number() const; // Only valid for numberType. + +#if WEBKIT_IMPLEMENTATION + WebIDBKey(const WTF::PassRefPtr<WebCore::IDBKey>&); + WebIDBKey& operator=(const WTF::PassRefPtr<WebCore::IDBKey>&); + operator WTF::PassRefPtr<WebCore::IDBKey>() const; +#endif + +private: + WebIDBKey() { } + + WebPrivatePtr<WebCore::IDBKey> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBKey_h diff --git a/WebKit/chromium/public/WebIDBObjectStore.h b/WebKit/chromium/public/WebIDBObjectStore.h new file mode 100755 index 0000000..fb81fb9 --- /dev/null +++ b/WebKit/chromium/public/WebIDBObjectStore.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2010 Google 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIDBObjectStore_h +#define WebIDBObjectStore_h + +#include "WebCommon.h" +#include "WebDOMStringList.h" +#include "WebIDBCallbacks.h" +#include "WebString.h" + +namespace WebKit { + +// See comment in WebIndexedDatabase for a high level overview these classes. +class WebIDBObjectStore { +public: + virtual ~WebIDBObjectStore() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList indexNames() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + virtual void get(const WebIDBKey& key, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void remove(const WebIDBKey& key, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + virtual void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // Transfers ownership of the WebIDBIndex to the caller. + virtual WebIDBIndex* index(const WebString& name) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void removeIndex(const WebString& name, WebIDBCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + // FIXME: finish. +}; + +} // namespace WebKit + +#endif // WebIDBObjectStore_h diff --git a/WebKit/chromium/public/WebImageDecoder.h b/WebKit/chromium/public/WebImageDecoder.h new file mode 100644 index 0000000..22db709 --- /dev/null +++ b/WebKit/chromium/public/WebImageDecoder.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebImageDecoder_h +#define WebImageDecoder_h + +#include "WebCommon.h" +#include "WebImage.h" +#include "WebNonCopyable.h" + +namespace WebCore { class ImageDecoder; } + +namespace WebKit { + +typedef WebCore::ImageDecoder WebImageDecoderPrivate; +class WebData; + +class WebImageDecoder : public WebNonCopyable { +public: + enum Type { + TypeBMP, + TypeICO + }; + + ~WebImageDecoder() { reset(); } + + explicit WebImageDecoder(Type type) { init(type); } + + // Sets data contents for underlying decoder. All the API methods + // require that setData() is called prior to their use. + WEBKIT_API void setData(const WebData& data, bool allDataReceived); + + // Deletes owned decoder. + WEBKIT_API void reset(); + + // Returns true if image decoding failed. + WEBKIT_API bool isFailed() const; + + // Returns true if size information is available for the decoder. + WEBKIT_API bool isSizeAvailable() const; + + // Returns the size of the image. + WEBKIT_API WebSize size() const; + + // Gives frame count for the image. For multiple frames, decoder scans the image data for the count. + WEBKIT_API size_t frameCount() const; + + // Returns if the frame at given index is completely decoded. + WEBKIT_API bool isFrameCompleteAtIndex(int index) const; + + // Creates and returns WebImage from buffer at the index. + WEBKIT_API WebImage getFrameAtIndex(int index) const; + +private: + // Creates type-specific decoder. + WEBKIT_API void init(Type type); + + WebImageDecoderPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebIndexedDatabase.h b/WebKit/chromium/public/WebIndexedDatabase.h new file mode 100644 index 0000000..5517a0c --- /dev/null +++ b/WebKit/chromium/public/WebIndexedDatabase.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Google 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebIndexedDatabase_h +#define WebIndexedDatabase_h + +#include "WebCommon.h" +#include "WebIDBCallbacks.h" +#include "WebSecurityOrigin.h" +#include "WebString.h" + +namespace WebKit { + +class WebFrame; +class WebIDBDatabase; +class WebString; +class WebSecurityOrigin; + +// The entry point into the IndexedDatabase API. These classes match their _____Request and +// _____Sync counterparts in the spec, but operate only in an async manner. +// http://dev.w3.org/2006/webapi/WebSimpleDB/ +class WebIndexedDatabase { +public: + WEBKIT_API static WebIndexedDatabase* create(); + + virtual ~WebIndexedDatabase() { } + + // The WebKit implementation of open ignores the WebFrame* parameter. + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame) + { + int exceptionCode; + open(name, description, callbacks, origin, webFrame, exceptionCode); + } + // FIXME: Delete soon. Compatability hack. + virtual void open(const WebString& name, const WebString& description, + WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode) + { + open(name, description, callbacks, origin, webFrame); + } +}; + +} // namespace WebKit + +#endif // WebIndexedDatabase_h diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h index 59643d1..d8c8ce7 100644 --- a/WebKit/chromium/public/WebInputElement.h +++ b/WebKit/chromium/public/WebInputElement.h @@ -31,29 +31,26 @@ #ifndef WebInputElement_h #define WebInputElement_h -#include "WebElement.h" +#include "WebFormControlElement.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class HTMLInputElement; } -namespace WTF { template <typename T> class PassRefPtr; } #endif namespace WebKit { // Provides readonly access to some properties of a DOM input element node. - class WebInputElement : public WebElement { + class WebInputElement : public WebFormControlElement { public: - WebInputElement() : WebElement() { } - WebInputElement(const WebInputElement& n) : WebElement(n) { } + WebInputElement() : WebFormControlElement() { } + WebInputElement(const WebInputElement& e) : WebFormControlElement(e) { } - WebInputElement& operator=(const WebInputElement& n) { WebElement::assign(n); return *this; } - WEBKIT_API void assign(const WebInputElement& n) { WebElement::assign(n); } - -#if WEBKIT_IMPLEMENTATION - WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); - WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); - operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; -#endif + WebInputElement& operator=(const WebInputElement& e) + { + WebFormControlElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebInputElement& e) { WebFormControlElement::assign(e); } enum InputType { Text = 0, @@ -83,21 +80,31 @@ namespace WebKit { }; WEBKIT_API bool autoComplete() const; + WEBKIT_API bool isReadOnly() const; WEBKIT_API bool isEnabledFormControl() const; WEBKIT_API InputType inputType() const; - WEBKIT_API WebString formControlType() const; + WEBKIT_API int maxLength() const; WEBKIT_API bool isActivatedSubmit() const; WEBKIT_API void setActivatedSubmit(bool); - WEBKIT_API void setValue(const WebString& value); + WEBKIT_API int size() const; + WEBKIT_API void setValue(const WebString&); WEBKIT_API WebString value() const; + WEBKIT_API void setSuggestedValue(const WebString&); + WEBKIT_API WebString suggestedValue() const; + WEBKIT_API void setPlaceholder(const WebString&); + WEBKIT_API WebString placeholder() const; + WEBKIT_API bool isAutofilled() const; WEBKIT_API void setAutofilled(bool); WEBKIT_API void dispatchFormControlChangeEvent(); WEBKIT_API void setSelectionRange(int, int); - WEBKIT_API WebString name() const; - // Returns the name that should be used for the specified |element| when - // storing autofill data. This is either the field name or its id, an empty - // string if it has no name and no id. - WEBKIT_API WebString nameForAutofill() const; + WEBKIT_API int selectionStart(); + WEBKIT_API int selectionEnd(); + +#if WEBKIT_IMPLEMENTATION + WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; +#endif }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h index 983aa2a..f8b057b 100644 --- a/WebKit/chromium/public/WebInputEvent.h +++ b/WebKit/chromium/public/WebInputEvent.h @@ -32,6 +32,7 @@ #define WebInputEvent_h #include "WebCommon.h" +#include "WebTouchPoint.h" #include <string.h> @@ -88,6 +89,7 @@ public: MouseMove, MouseEnter, MouseLeave, + ContextMenu, // WebMouseWheelEvent MouseWheel, @@ -96,7 +98,13 @@ public: RawKeyDown, KeyDown, KeyUp, - Char + Char, + + // WebTouchEvent + TouchStart, + TouchMove, + TouchEnd, + TouchCancel, }; enum Modifiers { @@ -121,6 +129,17 @@ public: int modifiers; double timeStampSeconds; // Seconds since epoch. + // Returns true if the WebInputEvent |type| is a mouse event. + static bool isMouseEventType(int type) + { + return type == MouseDown + || type == MouseUp + || type == MouseMove + || type == MouseEnter + || type == MouseLeave + || type == ContextMenu; + } + // Returns true if the WebInputEvent |type| is a keyboard event. static bool isKeyboardEventType(int type) { @@ -129,6 +148,15 @@ public: || type == KeyUp || type == Char; } + + // Returns true if the WebInputEvent |type| is a touch event. + static bool isTouchEventType(int type) + { + return type == TouchStart + || type == TouchMove + || type == TouchEnd + || type == TouchCancel; + } }; // WebKeyboardEvent ----------------------------------------------------------- @@ -255,6 +283,22 @@ public: } }; +// WebTouchEvent -------------------------------------------------------------- + +class WebTouchEvent : public WebInputEvent { +public: + static const int touchPointsLengthCap = 4; + + int touchPointsLength; + WebTouchPoint touchPoints[touchPointsLengthCap]; + + WebTouchEvent(unsigned sizeParam = sizeof(WebTouchEvent)) + : WebInputEvent(sizeParam) + , touchPointsLength(0) + { + } +}; + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h index fbaa218..48765ac 100644 --- a/WebKit/chromium/public/WebKitClient.h +++ b/WebKit/chromium/public/WebKitClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,7 +36,6 @@ #include "WebLocalizedString.h" #include "WebString.h" #include "WebURL.h" -#include "WebVector.h" #include <time.h> @@ -49,6 +48,11 @@ namespace WebKit { class WebApplicationCacheHost; class WebApplicationCacheHostClient; class WebClipboard; +class WebCookieJar; +class WebFileSystem; +class WebGLES2Context; +class WebGraphicsContext3D; +class WebIndexedDatabase; class WebMessagePortChannel; class WebMimeRegistry; class WebPluginListBuilder; @@ -58,8 +62,6 @@ class WebSocketStreamHandle; class WebStorageNamespace; class WebThemeEngine; class WebURLLoader; -struct WebCookie; -template <typename T> class WebVector; class WebKitClient { public: @@ -69,51 +71,29 @@ public: // Must return non-null. virtual WebMimeRegistry* mimeRegistry() { return 0; } + // Must return non-null. + virtual WebFileSystem* fileSystem() { return 0; } + // May return null if sandbox support is not necessary virtual WebSandboxSupport* sandboxSupport() { return 0; } // May return null on some platforms. virtual WebThemeEngine* themeEngine() { return 0; } - - // Application Cache -------------------------------------------- - - // May return null if the process type doesn't involve appcaching. - virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; } - + // May return null. + virtual WebCookieJar* cookieJar() { return 0; } // DOM Storage -------------------------------------------------- // Return a LocalStorage namespace that corresponds to the following path. virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } - // Return a new SessionStorage namespace. - // THIS IS DEPRECATED. WebViewClient::getSessionStorageNamespace() is the new way to access this. - virtual WebStorageNamespace* createSessionStorageNamespace() { return 0; } - // Called when storage events fire. virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, const WebString& newValue, const WebString& origin, const WebURL& url, bool isLocalStorage) { } - // File ---------------------------------------------------------------- - - // Various file/directory related functions. These map 1:1 with - // functions in WebCore's FileSystem.h. - virtual bool fileExists(const WebString& path) { return false; } - virtual bool deleteFile(const WebString& path) { return false; } - virtual bool deleteEmptyDirectory(const WebString& path) { return false; } - virtual bool getFileSize(const WebString& path, long long& result) { return false; } - virtual bool getFileModificationTime(const WebString& path, time_t& result) { return false; } - virtual WebString directoryName(const WebString& path) { return WebString(); } - virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } - virtual bool makeAllDirectories(const WebString& path) { return false; } - virtual WebString getAbsolutePath(const WebString& path) { return WebString(); } - virtual bool isDirectory(const WebString& path) { return false; } - virtual WebURL filePathToURL(const WebString& path) { return WebURL(); } - - // History ------------------------------------------------------------- // Returns the hash for the given canonicalized URL for use in visited @@ -126,7 +106,7 @@ public: virtual bool isLinkVisited(unsigned long long linkHash) { return false; } - // Database ------------------------------------------------------------ + // HTML5 Database ------------------------------------------------------ #ifdef WIN32 typedef HANDLE FileHandle; @@ -137,7 +117,7 @@ public: // Opens a database file; dirHandle should be 0 if the caller does not need // a handle to the directory containing this file virtual FileHandle databaseOpenFile( - const WebString& vfsFileName, int desiredFlags, FileHandle* dirHandle) { return FileHandle(); } + const WebString& vfsFileName, int desiredFlags) { return FileHandle(); } // Deletes a database file and returns the error code virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; } @@ -149,6 +129,11 @@ public: virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; } + // Indexed Database ---------------------------------------------------- + + virtual WebIndexedDatabase* indexedDatabase() { return 0; } + + // Keygen -------------------------------------------------------------- // Handle the <keygen> tag for generating client certificates @@ -177,13 +162,6 @@ public: // Network ------------------------------------------------------------- - virtual void setCookies( - const WebURL& url, const WebURL& firstPartyForCookies, const WebString& cookies) { } - virtual WebString cookies(const WebURL& url, const WebURL& firstPartyForCookies) { return WebString(); } - virtual bool rawCookies(const WebURL& url, const WebURL& firstPartyForCookies, WebVector<WebCookie>*) { return false; } - virtual void deleteCookie(const WebURL& url, const WebString& cookieName) { } - virtual bool cookiesEnabled(const WebURL& url, const WebURL& firstPartyForCookies) { return true; } - // A suggestion to prefetch IP information for the given hostname. virtual void prefetchHostName(const WebString&) { } @@ -196,6 +174,9 @@ public: // Returns the User-Agent string that should be used for the given URL. virtual WebString userAgent(const WebURL&) { return WebString(); } + // A suggestion to cache this metadata in association with this URL. + virtual void cacheMetadata(const WebURL&, double responseTime, const char* data, size_t dataSize) { } + // Plugins ------------------------------------------------------------- @@ -267,7 +248,19 @@ public: virtual void stopSharedTimer() { } // Callable from a background WebKit thread. - virtual void callOnMainThread(void (*func)()) { } + virtual void callOnMainThread(void (*func)(void*), void* context) { } + + // WebGL -------------------------------------------------------------- + + // May return null if WebGL is not supported. + // Returns newly allocated WebGraphicsContext3D instance. + virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; } + + // GLES2 -------------------------------------------------------------- + + // Returns newly allocated WebGLES2Context instance. + // May return null if it fails to create the context. + virtual WebGLES2Context* createGLES2Context() { return 0; } protected: ~WebKitClient() { } diff --git a/WebKit/chromium/public/WebLabelElement.h b/WebKit/chromium/public/WebLabelElement.h new file mode 100644 index 0000000..3e97c39 --- /dev/null +++ b/WebKit/chromium/public/WebLabelElement.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebLabelElement_h +#define WebLabelElement_h + +#include "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLLabelElement; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM label element node. +class WebLabelElement : public WebElement { +public: + WebLabelElement() : WebElement() { } + WebLabelElement(const WebLabelElement& e) : WebElement(e) { } + + WebLabelElement& operator=(const WebLabelElement& e) + { + WebElement::assign(e); + return *this; + } + + WEBKIT_API void assign(const WebLabelElement& e) { WebElement::assign(e); } + + WEBKIT_API WebElement correspondingControl(); + +#if WEBKIT_IMPLEMENTATION + WebLabelElement(const WTF::PassRefPtr<WebCore::HTMLLabelElement>&); + WebLabelElement& operator=(const WTF::PassRefPtr<WebCore::HTMLLabelElement>&); + operator WTF::PassRefPtr<WebCore::HTMLLabelElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMediaElement.h b/WebKit/chromium/public/WebMediaElement.h new file mode 100644 index 0000000..94837a5 --- /dev/null +++ b/WebKit/chromium/public/WebMediaElement.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebMediaElement_h +#define WebMediaElement_h + +#include "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLMediaElement; } +#endif + +namespace WebKit { + +class WebMediaPlayer; + +class WebMediaElement : public WebElement { +public: + WEBKIT_API WebMediaPlayer* player() const; + +#if WEBKIT_IMPLEMENTATION + WebMediaElement(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&); + WebMediaElement& operator=(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&); + operator WTF::PassRefPtr<WebCore::HTMLMediaElement>() const; +#endif +}; +} // namespace WebKit + +#endif // WebMediaElement_h diff --git a/WebKit/chromium/public/WebMediaPlayer.h b/WebKit/chromium/public/WebMediaPlayer.h index 0b658f9..6f51345 100644 --- a/WebKit/chromium/public/WebMediaPlayer.h +++ b/WebKit/chromium/public/WebMediaPlayer.h @@ -95,7 +95,7 @@ public: virtual void setVisible(bool) = 0; virtual bool setAutoBuffer(bool) = 0; virtual bool totalBytesKnown() = 0; - virtual const WebTimeRanges& buffered() const = 0; + virtual const WebTimeRanges& buffered() = 0; virtual float maxTimeSeekable() const = 0; virtual void setSize(const WebSize&) = 0; diff --git a/WebKit/chromium/public/WebMediaPlayerAction.h b/WebKit/chromium/public/WebMediaPlayerAction.h index 3aede25..192704f 100644 --- a/WebKit/chromium/public/WebMediaPlayerAction.h +++ b/WebKit/chromium/public/WebMediaPlayerAction.h @@ -38,7 +38,8 @@ struct WebMediaPlayerAction { Unknown, Play, Mute, - Loop + Loop, + Controls }; Type type; diff --git a/WebKit/chromium/public/WebMediaPlayerClient.h b/WebKit/chromium/public/WebMediaPlayerClient.h index 47ce64e..7e5dd68 100644 --- a/WebKit/chromium/public/WebMediaPlayerClient.h +++ b/WebKit/chromium/public/WebMediaPlayerClient.h @@ -48,6 +48,7 @@ public: virtual void rateChanged() = 0; virtual void sizeChanged() = 0; virtual void sawUnsupportedTracks() = 0; + virtual float volume() const = 0; protected: ~WebMediaPlayerClient() { } diff --git a/WebKit/chromium/public/WebNamedNodeMap.h b/WebKit/chromium/public/WebNamedNodeMap.h new file mode 100644 index 0000000..0b7e296 --- /dev/null +++ b/WebKit/chromium/public/WebNamedNodeMap.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebNamedNodeMap_h +#define WebNamedNodeMap_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class NamedNodeMap; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebAttribute; + +// Provides readonly access to some properties of a DOM attribute map. +class WebNamedNodeMap { +public: + ~WebNamedNodeMap() { reset(); } + + WebNamedNodeMap() { } + WebNamedNodeMap(const WebNamedNodeMap& n) { assign(n); } + WebNamedNodeMap& operator=(const WebNamedNodeMap& n) + { + assign(n); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebNamedNodeMap&); + + WEBKIT_API unsigned length() const; + WEBKIT_API WebAttribute attributeItem(unsigned) const; + +#if WEBKIT_IMPLEMENTATION + WebNamedNodeMap(const WTF::PassRefPtr<WebCore::NamedNodeMap>&); +#endif + +private: + WebPrivatePtr<WebCore::NamedNodeMap> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebNode.h b/WebKit/chromium/public/WebNode.h index 4d2a0e9..fb0a99e 100644 --- a/WebKit/chromium/public/WebNode.h +++ b/WebKit/chromium/public/WebNode.h @@ -32,12 +32,10 @@ #define WebNode_h #include "WebCommon.h" +#include "WebPrivatePtr.h" #include "WebString.h" namespace WebCore { class Node; } -#if WEBKIT_IMPLEMENTATION -namespace WTF { template <typename T> class PassRefPtr; } -#endif namespace WebKit { class WebDocument; @@ -51,8 +49,8 @@ class WebNode { public: virtual ~WebNode() { reset(); } - WebNode() : m_private(0) { } - WebNode(const WebNode& n) : m_private(0) { assign(n); } + WebNode() { } + WebNode(const WebNode& n) { assign(n); } WebNode& operator=(const WebNode& n) { assign(n); @@ -62,13 +60,12 @@ public: WEBKIT_API void reset(); WEBKIT_API void assign(const WebNode&); - bool isNull() const { return !m_private; } - -#if WEBKIT_IMPLEMENTATION - WebNode(const WTF::PassRefPtr<WebCore::Node>&); - WebNode& operator=(const WTF::PassRefPtr<WebCore::Node>&); - operator WTF::PassRefPtr<WebCore::Node>() const; -#endif + WEBKIT_API bool equals(const WebNode&) const; + // Required for using WebNodes in std maps. Note the order used is + // arbitrary and should not be expected to have any specific meaning. + WEBKIT_API bool lessThan(const WebNode&) const; + + bool isNull() const { return m_private.isNull(); } enum NodeType { ElementNode = 1, @@ -90,8 +87,6 @@ public: WEBKIT_API WebString nodeName() const; WEBKIT_API WebString nodeValue() const; WEBKIT_API bool setNodeValue(const WebString&); - // Deprecated. Use document().frame() instead. - WEBKIT_API WebFrame* frame() const; WEBKIT_API WebDocument document() const; WEBKIT_API WebNode firstChild() const; WEBKIT_API WebNode lastChild() const; @@ -104,37 +99,65 @@ public: WEBKIT_API bool isElementNode() const; WEBKIT_API void addEventListener(const WebString& eventType, WebEventListener* listener, bool useCapture); WEBKIT_API void removeEventListener(const WebString& eventType, WebEventListener* listener, bool useCapture); + WEBKIT_API void simulateClick(); + WEBKIT_API WebNodeList getElementsByTagName(const WebString&) const; + + // Returns true if the node has a non-empty bounding box in layout. + // This does not 100% guarantee the user can see it, but is pretty close. + // Note: This method only works properly after layout has occurred. + WEBKIT_API bool hasNonEmptyBoundingBox() const; - template<typename T> T toElement() + template<typename T> T to() { T res; res.WebNode::assign(*this); return res; } - template<typename T> const T toConstElement() const + template<typename T> const T toConst() const { T res; res.WebNode::assign(*this); return res; } -protected: - typedef WebCore::Node WebNodePrivate; - void assign(WebNodePrivate*); - WebNodePrivate* m_private; - +#if WEBKIT_IMPLEMENTATION + WebNode(const WTF::PassRefPtr<WebCore::Node>&); + WebNode& operator=(const WTF::PassRefPtr<WebCore::Node>&); + operator WTF::PassRefPtr<WebCore::Node>() const; +#endif + +#if WEBKIT_IMPLEMENTATION template<typename T> T* unwrap() { - return static_cast<T*>(m_private); + return static_cast<T*>(m_private.get()); } template<typename T> const T* constUnwrap() const { - return static_cast<const T*>(m_private); + return static_cast<const T*>(m_private.get()); } +#endif + +protected: + WebPrivatePtr<WebCore::Node> m_private; }; +inline bool operator==(const WebNode& a, const WebNode& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebNode& a, const WebNode& b) +{ + return !(a == b); +} + +inline bool operator<(const WebNode& a, const WebNode& b) +{ + return a.lessThan(b); +} + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h index 1a41252..f872111 100644 --- a/WebKit/chromium/public/WebNotification.h +++ b/WebKit/chromium/public/WebNotification.h @@ -32,6 +32,7 @@ #define WebNotification_h #include "WebCommon.h" +#include "WebTextDirection.h" #if WEBKIT_IMPLEMENTATION namespace WebCore { class Notification; } @@ -63,7 +64,7 @@ public: // Operators required to put WebNotification in an ordered map. bool equals(const WebNotification& other) const { return m_private == other.m_private; } - bool lessThan(const WebNotification& other) const; + WEBKIT_API bool lessThan(const WebNotification& other) const; // Is the notification HTML vs. icon-title-text? WEBKIT_API bool isHTML() const; @@ -71,11 +72,17 @@ public: // If HTML, the URL which contains the contents of the notification. WEBKIT_API WebURL url() const; - // If not HTML, the parameters for the icon-title-text notification. - WEBKIT_API WebString icon() const; + WEBKIT_API WebURL iconURL() const; WEBKIT_API WebString title() const; WEBKIT_API WebString body() const; + // FIXME: Remove dir() when no longer referenced. + // dir() is deprecated; use direction(). + WEBKIT_API WebString dir() const; + WEBKIT_API WebTextDirection direction() const; + + WEBKIT_API WebString replaceId() const; + // Called to indicate the notification has been displayed. WEBKIT_API void dispatchDisplayEvent(); diff --git a/WebKit/chromium/public/WebNotificationPresenter.h b/WebKit/chromium/public/WebNotificationPresenter.h index a3764aa..9fb7e6e 100644 --- a/WebKit/chromium/public/WebNotificationPresenter.h +++ b/WebKit/chromium/public/WebNotificationPresenter.h @@ -31,13 +31,14 @@ #ifndef WebNotificationPresenter_h #define WebNotificationPresenter_h +#include "WebNotificationPermissionCallback.h" +#include "WebSecurityOrigin.h" #include "WebString.h" namespace WebKit { class WebDocument; class WebNotification; -class WebNotificationPermissionCallback; class WebURL; // Provides the services to show desktop notifications to the user. @@ -59,14 +60,13 @@ public: // being destroyed. Does _not_ remove the notification if being shown, but detaches it from receiving events. virtual void objectDestroyed(const WebNotification&) = 0; - // Checks the permission level for the given URL. If the URL is being displayed in a document - // (as opposed to a worker or other ScriptExecutionContext), |document| will also be provided. - virtual Permission checkPermission(const WebURL& url, WebDocument* document) = 0; + // Checks the permission level for the given origin. + virtual Permission checkPermission(const WebURL&) = 0; // Requests permission for a given origin. This operation is asynchronous and the callback provided // will be invoked when the permission decision is made. Callback pointer must remain // valid until called. - virtual void requestPermission(const WebString& origin, WebNotificationPermissionCallback* callback) = 0; + virtual void requestPermission(const WebSecurityOrigin&, WebNotificationPermissionCallback*) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebOptionElement.h b/WebKit/chromium/public/WebOptionElement.h new file mode 100644 index 0000000..1689a57 --- /dev/null +++ b/WebKit/chromium/public/WebOptionElement.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebOptionElement_h +#define WebOptionElement_h + +#include "WebFormControlElement.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLOptionElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM option element node. +class WebOptionElement : public WebFormControlElement { +public: + WebOptionElement() : WebFormControlElement() { } + WebOptionElement(const WebOptionElement& e) : WebFormControlElement(e) { } + + WebOptionElement& operator=(const WebOptionElement& e) + { + WebFormControlElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebOptionElement& e) { WebFormControlElement::assign(e); } + + WEBKIT_API void setValue(const WebString&); + WEBKIT_API WebString value() const; + + WEBKIT_API int index() const; + WEBKIT_API WebString text() const; + WEBKIT_API bool defaultSelected() const; + WEBKIT_API void setDefaultSelected(bool); + WEBKIT_API WebString label() const; + WEBKIT_API bool isEnabled() const; + +#if WEBKIT_IMPLEMENTATION + WebOptionElement(const WTF::PassRefPtr<WebCore::HTMLOptionElement>&); + WebOptionElement& operator=(const WTF::PassRefPtr<WebCore::HTMLOptionElement>&); + operator WTF::PassRefPtr<WebCore::HTMLOptionElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPasswordAutocompleteListener.h b/WebKit/chromium/public/WebPasswordAutocompleteListener.h index db6589d..fdc8476 100644 --- a/WebKit/chromium/public/WebPasswordAutocompleteListener.h +++ b/WebKit/chromium/public/WebPasswordAutocompleteListener.h @@ -49,5 +49,4 @@ public: } // namespace WebKit - #endif diff --git a/WebKit/chromium/public/WebPasswordFormData.h b/WebKit/chromium/public/WebPasswordFormData.h index e1804d1..30ce5ca 100644 --- a/WebKit/chromium/public/WebPasswordFormData.h +++ b/WebKit/chromium/public/WebPasswordFormData.h @@ -40,7 +40,7 @@ namespace WebKit { struct WebPasswordFormData { // If the provided form is suitable for password completion, isValid() will // return true; - WebPasswordFormData(const WebFormElement&); + WEBKIT_API WebPasswordFormData(const WebFormElement&); // If creation failed, return false. bool isValid() const { return action.isValid(); } diff --git a/WebKit/chromium/public/WebPlugin.h b/WebKit/chromium/public/WebPlugin.h index 5097265..816d38b 100644 --- a/WebKit/chromium/public/WebPlugin.h +++ b/WebKit/chromium/public/WebPlugin.h @@ -32,6 +32,7 @@ #define WebPlugin_h #include "WebCanvas.h" +#include "WebString.h" struct NPObject; @@ -80,6 +81,37 @@ public: virtual void didFailLoadingFrameRequest( const WebURL&, void* notifyData, const WebURLError&) = 0; + // Printing interface. + // Whether the plugin supports its own paginated print. The other print + // interface methods are called only if this method returns true. + virtual bool supportsPaginatedPrint() { return false; } + // Sets up printing at the given print rect and printer DPI. printableArea + // is in points (a point is 1/72 of an inch).Returns the number of pages to + // be printed at these settings. + virtual int printBegin(const WebRect& printableArea, int printerDPI) { return 0; } + // Prints the page specified by pageNumber (0-based index) into the supplied canvas. + virtual bool printPage(int pageNumber, WebCanvas* canvas) { return false; } + // Ends the print operation. + virtual void printEnd() { } + + virtual bool hasSelection() const { return false; } + virtual WebString selectionAsText() const { return WebString(); } + virtual WebString selectionAsMarkup() const { return WebString(); } + + // Used for zooming of full page plugins. + virtual void setZoomFactor(float scale, bool textOnly) { } + + // Find interface. + // Start a new search. The plugin should search for a little bit at a time so that it + // doesn't block the thread in case of a large document. The results, along with the + // find's identifier, should be sent asynchronously to WebFrameClient's reportFindInPage* methods. + // Returns true if the search started, or false if the plugin doesn't support search. + virtual bool startFind(const WebString& searchText, bool caseSensitive, int identifier) { return false; } + // Tells the plugin to jump forward or backward in the list of find results. + virtual void selectFindResult(bool forward) { } + // Tells the plugin that the user has stopped the find operation. + virtual void stopFind() { } + protected: ~WebPlugin() { } }; diff --git a/WebKit/chromium/public/WebPluginContainer.h b/WebKit/chromium/public/WebPluginContainer.h index 41e304e..66ef9ab 100644 --- a/WebKit/chromium/public/WebPluginContainer.h +++ b/WebKit/chromium/public/WebPluginContainer.h @@ -35,6 +35,8 @@ struct NPObject; namespace WebKit { +class WebElement; +class WebPlugin; class WebString; class WebURL; class WebURLRequest; @@ -42,6 +44,9 @@ struct WebRect; class WebPluginContainer { public: + // Returns the element containing this plugin. + virtual WebElement element() = 0; + virtual void invalidate() = 0; virtual void invalidateRect(const WebRect&) = 0; @@ -73,6 +78,9 @@ public: virtual void loadFrameRequest( const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) = 0; + virtual WebPlugin* plugin() = 0; + virtual void setPlugin(WebPlugin*) = 0; + protected: ~WebPluginContainer() { } }; diff --git a/WebKit/chromium/public/WebPluginDocument.h b/WebKit/chromium/public/WebPluginDocument.h new file mode 100644 index 0000000..b772cf7 --- /dev/null +++ b/WebKit/chromium/public/WebPluginDocument.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPluginDocument_h +#define WebPluginDocument_h + +#include "WebDocument.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class PluginDocument; } +#endif + +namespace WebKit { +class WebPlugin; + +// Wraps a WebDocument for full page plugins. +class WebPluginDocument : public WebDocument { +public: + WebPluginDocument() { } + WebPluginDocument(const WebPluginDocument& e) : WebDocument(e) { } + + WebPluginDocument& operator=(const WebPluginDocument& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebPluginDocument& d) { WebNode::assign(d); } + + WEBKIT_API WebPlugin* plugin(); + +#if WEBKIT_IMPLEMENTATION + WebPluginDocument(const WTF::PassRefPtr<WebCore::PluginDocument>&); + WebPluginDocument& operator=(const WTF::PassRefPtr<WebCore::PluginDocument>&); + operator WTF::PassRefPtr<WebCore::PluginDocument>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPoint.h b/WebKit/chromium/public/WebPoint.h index d1abe02..20c52c2 100644 --- a/WebKit/chromium/public/WebPoint.h +++ b/WebKit/chromium/public/WebPoint.h @@ -36,7 +36,7 @@ #if WEBKIT_IMPLEMENTATION #include "IntPoint.h" #else -#include <base/gfx/rect.h> +#include <gfx/point.h> #endif namespace WebKit { diff --git a/WebKit/chromium/public/WebPopupMenuInfo.h b/WebKit/chromium/public/WebPopupMenuInfo.h index 876842d..7cf1b63 100644 --- a/WebKit/chromium/public/WebPopupMenuInfo.h +++ b/WebKit/chromium/public/WebPopupMenuInfo.h @@ -41,8 +41,10 @@ struct WebPopupMenuInfo { // FIXME: migrate clients to WebMenuItemInfo and remove this temporary Item typedef. typedef WebMenuItemInfo Item; int itemHeight; + int itemFontSize; int selectedIndex; WebVector<WebMenuItemInfo> items; + bool rightAligned; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebCompositionCommand.h b/WebKit/chromium/public/WebPopupType.h index fa89529..8a546ba 100644 --- a/WebKit/chromium/public/WebCompositionCommand.h +++ b/WebKit/chromium/public/WebPopupType.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,15 +28,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebCompositionCommand_h -#define WebCompositionCommand_h +#ifndef WebPopupType_h +#define WebPopupType_h namespace WebKit { -enum WebCompositionCommand { - WebCompositionCommandDiscard, - WebCompositionCommandSet, - WebCompositionCommandConfirm, +enum WebPopupType { + WebPopupTypeNone, // Not a popup. + WebPopupTypeSelect, // A HTML select (combo-box) popup. + WebPopupTypeSuggestion, // An autofill/autocomplete popup. }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebPrivatePtr.h b/WebKit/chromium/public/WebPrivatePtr.h new file mode 100644 index 0000000..48ad7f2 --- /dev/null +++ b/WebKit/chromium/public/WebPrivatePtr.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPrivatePtr_h +#define WebPrivatePtr_h + +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassRefPtr.h> +#endif + +namespace WebKit { + +// This class is an implementation detail of the WebKit API. It exists +// to help simplify the implementation of WebKit interfaces that merely +// wrap a reference counted WebCore class. +template <typename T> +class WebPrivatePtr { +public: + WebPrivatePtr() : m_ptr(0) { } + ~WebPrivatePtr() { WEBKIT_ASSERT(!m_ptr); } + + bool isNull() const { return !m_ptr; } + +#if WEBKIT_IMPLEMENTATION + WebPrivatePtr(const PassRefPtr<T>& prp) + : m_ptr(prp.releaseRef()) + { + } + + void reset() + { + assign(0); + } + + WebPrivatePtr<T>& operator=(const WebPrivatePtr<T>& other) + { + T* p = other.m_ptr; + if (p) + p->ref(); + assign(p); + return *this; + } + + WebPrivatePtr<T>& operator=(const PassRefPtr<T>& prp) + { + assign(prp.releaseRef()); + return *this; + } + + T* get() const + { + return m_ptr; + } + + T* operator->() const + { + ASSERT(m_ptr); + return m_ptr; + } +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(T* p) + { + // p is already ref'd for us by the caller + if (m_ptr) + m_ptr->deref(); + m_ptr = p; + } +#endif + + T* m_ptr; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebRect.h b/WebKit/chromium/public/WebRect.h index ed5a7d1..30381d7 100644 --- a/WebKit/chromium/public/WebRect.h +++ b/WebKit/chromium/public/WebRect.h @@ -36,7 +36,7 @@ #if WEBKIT_IMPLEMENTATION #include "IntRect.h" #else -#include <base/gfx/rect.h> +#include <gfx/rect.h> #endif namespace WebKit { diff --git a/WebKit/chromium/public/WebRuntimeFeatures.h b/WebKit/chromium/public/WebRuntimeFeatures.h index 04f88c9..95307a2 100644 --- a/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/WebKit/chromium/public/WebRuntimeFeatures.h @@ -68,6 +68,18 @@ public: WEBKIT_API static void enableIndexedDatabase(bool); WEBKIT_API static bool isIndexedDatabaseEnabled(); + WEBKIT_API static void enableWebGL(bool); + WEBKIT_API static bool isWebGLEnabled(); + + WEBKIT_API static void enablePushState(bool); + WEBKIT_API static bool isPushStateEnabled(bool); + + WEBKIT_API static void enableTouch(bool); + WEBKIT_API static bool isTouchEnabled(); + + WEBKIT_API static void enableDeviceOrientation(bool); + WEBKIT_API static bool isDeviceOrientationEnabled(); + private: WebRuntimeFeatures(); }; diff --git a/WebKit/chromium/public/WebScrollbar.h b/WebKit/chromium/public/WebScrollbar.h new file mode 100644 index 0000000..6941f4d --- /dev/null +++ b/WebKit/chromium/public/WebScrollbar.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScrollbar_h +#define WebScrollbar_h + +#include "WebCanvas.h" +#include "WebCommon.h" + +namespace WebKit { + +class WebInputEvent; +class WebScrollbarClient; +struct WebRect; + +class WebScrollbar { +public: + enum Orientation { + Horizontal, + Vertical + }; + + enum ScrollDirection { + ScrollBackward, + ScrollForward + }; + + enum ScrollGranularity { + ScrollByLine, + ScrollByPage, + ScrollByDocument, + ScrollByPixel + }; + + // Creates a WebScrollbar. + WEBKIT_API static WebScrollbar* create(WebScrollbarClient*, Orientation); + + virtual ~WebScrollbar() {} + + // Gets the thickness of the scrollbar in pixels. + WEBKIT_API static int defaultThickness(); + + // Sets the rectangle of the scrollbar. + virtual void setLocation(const WebRect&) = 0; + + // Gets the current value (i.e. position inside the region). + virtual int value() const = 0; + + // Sets the current value. + virtual void setValue(int position) = 0; + + // Sets the size of the scrollable region in pixels. i.e. if a document is + // 800x10000 pixels and the viewport is 1000x1000 pixels, then setLocation + // for the vertical scrollbar would have passed in a rectangle like: + // (800 - defaultThickness(), 0) (defaultThickness() x 10000) + // and setDocumentSize(10000) + virtual void setDocumentSize(int size) = 0; + + // Scroll back or forward with the given granularity. + virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) = 0; + + // Paint the given rectangle. + virtual void paint(WebCanvas*, const WebRect&) = 0; + + // Returns true iff the given event was used. + virtual bool handleInputEvent(const WebInputEvent&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebScrollbarClient.h b/WebKit/chromium/public/WebScrollbarClient.h new file mode 100644 index 0000000..d1825c8 --- /dev/null +++ b/WebKit/chromium/public/WebScrollbarClient.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScrollbarClient_h +#define WebScrollbarClient_h + +namespace WebKit { + +class WebScrollbar; +struct WebRect; +template <typename T> class WebVector; + +class WebScrollbarClient { +public: + virtual void valueChanged(WebScrollbar*) = 0; + virtual void invalidateScrollbarRect(WebScrollbar*, const WebRect&) = 0; + virtual void getTickmarks(WebScrollbar*, WebVector<WebRect>*) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSearchableFormData.h b/WebKit/chromium/public/WebSearchableFormData.h index e453387..5cd1d9b 100644 --- a/WebKit/chromium/public/WebSearchableFormData.h +++ b/WebKit/chromium/public/WebSearchableFormData.h @@ -43,7 +43,7 @@ class WebSearchableFormData { public: // If the provided form is suitable for automated searching, isValid() // will return false. - WebSearchableFormData(const WebFormElement&); + WEBKIT_API WebSearchableFormData(const WebFormElement&); bool isValid() { return m_url.isValid(); } diff --git a/WebKit/chromium/public/WebSecurityOrigin.h b/WebKit/chromium/public/WebSecurityOrigin.h index 1285b10..efcb2e9 100644 --- a/WebKit/chromium/public/WebSecurityOrigin.h +++ b/WebKit/chromium/public/WebSecurityOrigin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -42,6 +42,7 @@ namespace WebKit { class WebSecurityOriginPrivate; class WebString; +class WebURL; class WebSecurityOrigin { public: @@ -55,9 +56,9 @@ public: return *this; } - // FIXME: This should return a WebSecurityOrigin, not a pointer to one. - WEBKIT_API static WebSecurityOrigin* createFromDatabaseIdentifier(const WebString& databaseIdentifier); + WEBKIT_API static WebSecurityOrigin createFromDatabaseIdentifier(const WebString& databaseIdentifier); WEBKIT_API static WebSecurityOrigin createFromString(const WebString&); + WEBKIT_API static WebSecurityOrigin create(const WebURL&); WEBKIT_API void reset(); WEBKIT_API void assign(const WebSecurityOrigin&); @@ -71,6 +72,17 @@ public: // The empty WebSecurityOrigin is the least privileged WebSecurityOrigin. WEBKIT_API bool isEmpty() const; + // Returns true if this WebSecurityOrigin can script objects in the given + // SecurityOrigin. For example, call this function before allowing + // script from one security origin to read or write objects from + // another SecurityOrigin. + WEBKIT_API bool canAccess(const WebSecurityOrigin&) const; + + // Returns true if this WebSecurityOrigin can read content retrieved from + // the given URL. For example, call this function before allowing script + // from a given security origin to receive contents from a given URL. + WEBKIT_API bool canRequest(const WebURL&) const; + // Returns a string representation of the WebSecurityOrigin. The empty // WebSecurityOrigin is represented by "null". The representation of a // non-empty WebSecurityOrigin resembles a standard URL. @@ -78,7 +90,11 @@ public: // Returns a string representation of this WebSecurityOrigin that can // be used as a file. Should be used in storage APIs only. - WEBKIT_API WebString databaseIdentifier(); + WEBKIT_API WebString databaseIdentifier() const; + + // Returns true if this WebSecurityOrigin can access usernames and + // passwords stored in password manager. + WEBKIT_API bool canAccessPasswordManager() const; #if WEBKIT_IMPLEMENTATION WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); diff --git a/WebKit/chromium/public/WebSecurityPolicy.h b/WebKit/chromium/public/WebSecurityPolicy.h index 8e1ee52..f15dd75 100644 --- a/WebKit/chromium/public/WebSecurityPolicy.h +++ b/WebKit/chromium/public/WebSecurityPolicy.h @@ -50,11 +50,18 @@ public: // any other URL scheme. WEBKIT_API static void registerURLSchemeAsNoAccess(const WebString&); + // Registers a URL scheme to not generate mixed content warnings when + // included by an HTTPS page. + WEBKIT_API static void registerURLSchemeAsSecure(const WebString&); + // Support for whitelisting access to origins beyond the same-origin policy. - WEBKIT_API static void whiteListAccessFromOrigin( + WEBKIT_API static void addOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, const WebString& destinationProtocol, + const WebString& destinationHost, bool allowDestinationSubdomains); + WEBKIT_API static void removeOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, bool allowDestinationSubdomains); - WEBKIT_API static void resetOriginAccessWhiteLists(); + WEBKIT_API static void resetOriginAccessWhitelists(); // Returns whether the url should be allowed to see the referrer // based on their respective protocols. diff --git a/WebKit/chromium/public/WebSelectElement.h b/WebKit/chromium/public/WebSelectElement.h new file mode 100644 index 0000000..3e7f5e2 --- /dev/null +++ b/WebKit/chromium/public/WebSelectElement.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSelectElement_h +#define WebSelectElement_h + +#include "WebFormControlElement.h" +#include "WebOptionElement.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLSelectElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM select element node. +class WebSelectElement : public WebFormControlElement { +public: + WebSelectElement() : WebFormControlElement() { } + WebSelectElement(const WebSelectElement& e) : WebFormControlElement(e) { } + + WebSelectElement& operator=(const WebSelectElement& e) + { + WebFormControlElement::assign(e); + return *this; + } + WEBKIT_API void assign(const WebSelectElement& e) { WebFormControlElement::assign(e); } + + WEBKIT_API void setValue(const WebString&); + WEBKIT_API WebString value(); + WEBKIT_API WebVector<WebElement> listItems(); + +#if WEBKIT_IMPLEMENTATION + WebSelectElement(const WTF::PassRefPtr<WebCore::HTMLSelectElement>&); + WebSelectElement& operator=(const WTF::PassRefPtr<WebCore::HTMLSelectElement>&); + operator WTF::PassRefPtr<WebCore::HTMLSelectElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSerializedScriptValue.h b/WebKit/chromium/public/WebSerializedScriptValue.h new file mode 100644 index 0000000..96e6d5b --- /dev/null +++ b/WebKit/chromium/public/WebSerializedScriptValue.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSerializedScriptValue_h +#define WebSerializedScriptValue_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class SerializedScriptValue; } + +namespace WebKit { +class WebString; + +class WebSerializedScriptValue { +public: + ~WebSerializedScriptValue() { reset(); } + + WebSerializedScriptValue() { } + WebSerializedScriptValue(const WebSerializedScriptValue& d) { assign(d); } + WebSerializedScriptValue& operator=(const WebSerializedScriptValue& d) + { + assign(d); + return *this; + } + + WEBKIT_API static WebSerializedScriptValue fromString(const WebString&); + + // Create a WebSerializedScriptValue that represents a serialization error. + WEBKIT_API static WebSerializedScriptValue createInvalid(); + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebSerializedScriptValue&); + + bool isNull() const { return m_private.isNull(); } + + // Returns a string representation of the WebSerializedScriptValue. + WEBKIT_API WebString toString() const; + +#if WEBKIT_IMPLEMENTATION + WebSerializedScriptValue(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + WebSerializedScriptValue& operator=(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + operator WTF::PassRefPtr<WebCore::SerializedScriptValue>() const; +#endif + +private: + WebPrivatePtr<WebCore::SerializedScriptValue> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h index d75ccde..90b8553 100644 --- a/WebKit/chromium/public/WebSettings.h +++ b/WebKit/chromium/public/WebSettings.h @@ -43,6 +43,11 @@ class WebURL; // these functions have a 1:1 mapping with the methods in WebCore/page/settings.h. class WebSettings { public: + enum EditingBehavior { + EditingBehaviorMac, + EditingBehaviorWin + }; + virtual void setStandardFontFamily(const WebString&) = 0; virtual void setFixedFontFamily(const WebString&) = 0; virtual void setSerifFontFamily(const WebString&) = 0; @@ -69,19 +74,26 @@ public: virtual void setJavaEnabled(bool) = 0; virtual void setAllowScriptsToCloseWindows(bool) = 0; virtual void setUserStyleSheetLocation(const WebURL&) = 0; + virtual void setAuthorAndUserStylesEnabled(bool) = 0; virtual void setUsesPageCache(bool) = 0; virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setJavaScriptCanAccessClipboard(bool) = 0; virtual void setXSSAuditorEnabled(bool) = 0; virtual void setLocalStorageEnabled(bool) = 0; virtual void setEditableLinkBehaviorNeverLive() = 0; virtual void setFontRenderingModeNormal() = 0; virtual void setShouldPaintCustomScrollbars(bool) = 0; - virtual void setDatabasesEnabled(bool) = 0; virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setAllowFileAccessFromFileURLs(bool) = 0; virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; virtual void setExperimentalWebGLEnabled(bool) = 0; - virtual void setGeolocationEnabled(bool) = 0; + virtual void setShowDebugBorders(bool) = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; + virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setHTML5ParserEnabled(bool) = 0; + virtual void setMemoryInfoEnabled(bool) = 0; protected: ~WebSettings() { } diff --git a/WebKit/chromium/public/WebSharedWorker.h b/WebKit/chromium/public/WebSharedWorker.h index 4ac7639..9492a4f 100644 --- a/WebKit/chromium/public/WebSharedWorker.h +++ b/WebKit/chromium/public/WebSharedWorker.h @@ -60,7 +60,9 @@ public: virtual void startWorkerContext(const WebURL& scriptURL, const WebString& name, const WebString& userAgent, - const WebString& sourceCode) = 0; + const WebString& sourceCode, + long long scriptResourceAppCacheID) = 0; + class ConnectListener { public: // Invoked once the connect event has been sent so the caller can free this object. diff --git a/WebKit/chromium/public/WebSize.h b/WebKit/chromium/public/WebSize.h index bb88633..a7159b2 100644 --- a/WebKit/chromium/public/WebSize.h +++ b/WebKit/chromium/public/WebSize.h @@ -36,7 +36,7 @@ #if WEBKIT_IMPLEMENTATION #include "IntSize.h" #else -#include <base/gfx/rect.h> +#include <gfx/size.h> #endif namespace WebKit { diff --git a/WebKit/chromium/public/WebSpeechInputController.h b/WebKit/chromium/public/WebSpeechInputController.h new file mode 100644 index 0000000..3dba5fb --- /dev/null +++ b/WebKit/chromium/public/WebSpeechInputController.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSpeechInputController_h +#define WebSpeechInputController_h + +#include "WebCommon.h" + +namespace WebKit { + +// Provides an embedder API called by WebKit. +class WebSpeechInputController { +public: + // Starts speech recognition. Speech will get recorded until the endpointer detects silence, + // runs to the limit or stopRecording is called. Progress indications and the recognized + // text are returned via the listener interface. + virtual bool startRecognition() + { + WEBKIT_ASSERT_NOT_REACHED(); + return false; + } + + // Cancels an ongoing recognition and discards any audio recorded so far. No partial + // recognition results are returned to the listener. + virtual void cancelRecognition() { WEBKIT_ASSERT_NOT_REACHED(); } + + // Stops audio recording and performs recognition with the audio recorded until now + // (does not discard audio). This is an optional call and is typically invoked if the user + // wants to stop recording audio as soon as they finished speaking. Otherwise, the speech + // recording 'endpointer' should detect silence in the input and stop recording automatically. + // Call startRecognition() to record audio and recognize speech again. + virtual void stopRecording() { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + virtual ~WebSpeechInputController() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputController_h diff --git a/WebKit/chromium/public/WebSpeechInputListener.h b/WebKit/chromium/public/WebSpeechInputListener.h new file mode 100644 index 0000000..f1756af --- /dev/null +++ b/WebKit/chromium/public/WebSpeechInputListener.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSpeechInputListener_h +#define WebSpeechInputListener_h + +namespace WebKit { + +class WebString; + +// Provides a WebKit API called by the embedder. +// A typical sequence of calls to the listener would be +// 1 call to didCompleteRecording +// 0 or more calls to setRecognitionResult +// 1 call to didCompleteRecognition +class WebSpeechInputListener { +public: + // Informs that audio recording has completed and recognition is underway. This gets invoked + // irrespective of whether recording was stopped automatically by the 'endpointer' or if + // WebSpeechInputController::stopRecording() was called. + // Typically after this call the listener would update the UI to reflect that recognition is + // in progress. + virtual void didCompleteRecording() = 0; + + // Gives results from speech recognition, either partial or the final results. + // This method can potentially get called multiple times if there are partial results + // available as the user keeps speaking. If the speech could not be recognized properly + // or if there was any other errors in the process, this method may never be called. + virtual void setRecognitionResult(const WebString&) = 0; + + // Informs that speech recognition has completed. This gets invoked irrespective of whether + // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The + // handler typically frees up any temporary resources allocated and waits for the next speech + // recognition request. + virtual void didCompleteRecognition() = 0; + +protected: + ~WebSpeechInputListener() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputListener_h diff --git a/WebKit/chromium/public/WebStorageArea.h b/WebKit/chromium/public/WebStorageArea.h index 5e2c11c..86f708c 100644 --- a/WebKit/chromium/public/WebStorageArea.h +++ b/WebKit/chromium/public/WebStorageArea.h @@ -36,6 +36,7 @@ namespace WebKit { +class WebFrame; class WebURL; // In WebCore, there's one distinct StorageArea per origin per StorageNamespace. This @@ -66,18 +67,14 @@ public: // Set the value that corresponds to a specific key. Result will either be ResultOK // or some particular error. The value is NOT set when there's an error. url is the // url that should be used if a storage event fires. - virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue) + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue, WebFrame*) { - bool quotaException = false; - setItem(key, newValue, url, quotaException, oldValue); - result = quotaException ? ResultBlockedByQuota : ResultOK; + setItem(key, newValue, url, result, oldValue); } // FIXME: Remove soon (once Chrome has rolled past this revision). - virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, bool& quotaException, WebString& oldValue) + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& url, Result& result, WebString& oldValue) { - Result result; - setItem(key, newValue, url, result, oldValue); - quotaException = result != ResultOK; + setItem(key, newValue, url, result, oldValue, 0); } // Remove the value associated with a particular key. url is the url that should be used diff --git a/WebKit/chromium/public/WebStorageEventDispatcher.h b/WebKit/chromium/public/WebStorageEventDispatcher.h index 57750e8..37ceb7c 100644 --- a/WebKit/chromium/public/WebStorageEventDispatcher.h +++ b/WebKit/chromium/public/WebStorageEventDispatcher.h @@ -41,7 +41,7 @@ class WebURL; // FIXME: Make this (or something) work for SessionStorage! class WebStorageEventDispatcher { public: - static WebStorageEventDispatcher* create(); + WEBKIT_API static WebStorageEventDispatcher* create(); virtual ~WebStorageEventDispatcher() { } diff --git a/WebKit/chromium/public/WebStorageNamespace.h b/WebKit/chromium/public/WebStorageNamespace.h index da92a77..51d4e0b 100644 --- a/WebKit/chromium/public/WebStorageNamespace.h +++ b/WebKit/chromium/public/WebStorageNamespace.h @@ -48,7 +48,15 @@ public: // If path is empty, data will not persist. You should call delete on the returned // object when you're finished. WEBKIT_API static WebStorageNamespace* createLocalStorageNamespace(const WebString& backingDirectoryPath, unsigned quota); - WEBKIT_API static WebStorageNamespace* createSessionStorageNamespace(); + WEBKIT_API static WebStorageNamespace* createSessionStorageNamespace(unsigned quota); + + // The quota for each storage area. Suggested by the spec. + static const unsigned m_localStorageQuota = 5 * 1024 * 1024; + + // Since SessionStorage memory is allocated in the browser process, we place a + // per-origin quota on it. Like LocalStorage there are known attacks against + // this, so it's more of a sanity check than a real security measure. + static const unsigned m_sessionStorageQuota = 5 * 1024 * 1024; static const unsigned noQuota = UINT_MAX; diff --git a/WebKit/chromium/public/WebString.h b/WebKit/chromium/public/WebString.h index d2cf9ea..2c9664e 100644 --- a/WebKit/chromium/public/WebString.h +++ b/WebKit/chromium/public/WebString.h @@ -131,7 +131,7 @@ public: WebString(const NullableString16& s) : m_private(0) { if (s.is_null()) - assign(0); + reset(); else assign(s.string().data(), s.string().length()); } @@ -139,7 +139,7 @@ public: WebString& operator=(const NullableString16& s) { if (s.is_null()) - assign(0); + reset(); else assign(s.string().data(), s.string().length()); return *this; diff --git a/WebKit/chromium/public/WebTextInputType.h b/WebKit/chromium/public/WebTextInputType.h new file mode 100644 index 0000000..2592f6f --- /dev/null +++ b/WebKit/chromium/public/WebTextInputType.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTextInputType_h +#define WebTextInputType_h + +namespace WebKit { + +enum WebTextInputType { + // Input caret is not in an editable node, no input method shall be used. + WebTextInputTypeNone, + + // Input caret is in a normal editable node, any input method can be used. + WebTextInputTypeText, + + // Input caret is in a password box, an input method may be used only if + // it's suitable for password input. + WebTextInputTypePassword, + + // FIXME: Add more text input types when necessary, eg. Number, + // Date, Email, URL, etc. +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebTextRun.h b/WebKit/chromium/public/WebTextRun.h new file mode 100644 index 0000000..cb1373a --- /dev/null +++ b/WebKit/chromium/public/WebTextRun.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTextRun_h +#define WebTextRun_h + +#include "WebString.h" + +#ifdef WEBKIT_IMPLEMENTATION +namespace WebCore { class TextRun; } +#endif + +namespace WebKit { + +struct WebTextRun { + WebTextRun(const WebString& t, bool isRTL, bool hasDirectionalOverride) + : text(t) + , rtl(isRTL) + , directionalOverride(hasDirectionalOverride) + { + } + WebTextRun() + : rtl(false) + , directionalOverride(false) + { + } + + WebString text; + bool rtl; + bool directionalOverride; + +#ifdef WEBKIT_IMPLEMENTATION + // The resulting WebCore::TextRun will refer to the text in this + // struct, so "this" must outlive the WebCore text run. + operator WebCore::TextRun() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/win/WebThemeEngine.h b/WebKit/chromium/public/WebThemeEngine.h index b563608..ab59fa2 100644 --- a/WebKit/chromium/public/win/WebThemeEngine.h +++ b/WebKit/chromium/public/WebThemeEngine.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,21 +31,23 @@ #ifndef WebThemeEngine_h #define WebThemeEngine_h -#include "../WebCanvas.h" -#include "../WebColor.h" +#include "WebCanvas.h" +#include "WebColor.h" namespace WebKit { struct WebRect; +struct WebSize; +class WebThemeEngine { +public: +#ifdef WIN32 // The part and state parameters correspond to values defined by the // Windows Theme API (see // http://msdn.microsoft.com/en-us/library/bb773187(VS.85).aspx ). // The classicState parameter corresponds to the uState // parameter of the Windows DrawFrameControl() function. // See the definitions in <vsstyle.h> and <winuser.h>. -class WebThemeEngine { -public: virtual void paintButton( WebCanvas*, int part, int state, int classicState, const WebRect&) = 0; @@ -66,6 +68,10 @@ public: WebCanvas*, int part, int state, int classicState, const WebRect&, const WebRect& alignRect) = 0; + virtual void paintSpinButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) {} + virtual void paintTextField( WebCanvas*, int part, int state, int classicState, const WebRect&, WebColor, bool fillContentArea, bool drawEdges) = 0; @@ -73,6 +79,12 @@ public: virtual void paintTrackbar( WebCanvas*, int part, int state, int classicState, const WebRect&) = 0; + + virtual void paintProgressBar( + WebCanvas*, const WebRect& barRect, const WebRect& valueRect, + bool determinate, double animatedSeconds) {} + +#endif }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebTouchPoint.h b/WebKit/chromium/public/WebTouchPoint.h new file mode 100644 index 0000000..ddfa26f --- /dev/null +++ b/WebKit/chromium/public/WebTouchPoint.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTouchPoint_h +#define WebTouchPoint_h + +#include "WebCommon.h" +#include "WebPoint.h" + +namespace WebKit { + +class WebTouchPoint { +public: + WebTouchPoint() + : id(0) + , state(StateUndefined) { } + + enum State { + StateUndefined, + StateReleased, + StatePressed, + StateMoved, + StateStationary, + StateCancelled, + }; + + int id; + State state; + WebPoint screenPosition; + WebPoint position; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURL.h b/WebKit/chromium/public/WebURL.h index 78a16a8..bb90e32 100644 --- a/WebKit/chromium/public/WebURL.h +++ b/WebKit/chromium/public/WebURL.h @@ -138,6 +138,11 @@ private: bool m_isValid; }; +inline bool operator<(const WebURL& a, const WebURL& b) +{ + return a.spec() < b.spec(); +} + } // namespace WebKit #endif diff --git a/WebKit/chromium/public/WebURLLoadTiming.h b/WebKit/chromium/public/WebURLLoadTiming.h new file mode 100644 index 0000000..9412d14 --- /dev/null +++ b/WebKit/chromium/public/WebURLLoadTiming.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLLoadTiming_h +#define WebURLLoadTiming_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class ResourceLoadTiming; } + +namespace WebKit { +class WebString; + +class WebURLLoadTiming { +public: + ~WebURLLoadTiming() { reset(); } + + WebURLLoadTiming() { } + WebURLLoadTiming(const WebURLLoadTiming& d) { assign(d); } + WebURLLoadTiming& operator=(const WebURLLoadTiming& d) + { + assign(d); + return *this; + } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebURLLoadTiming&); + + bool isNull() const { return m_private.isNull(); } + + WEBKIT_API double requestTime() const; + WEBKIT_API void setRequestTime(double time); + + WEBKIT_API int proxyStart() const; + WEBKIT_API void setProxyStart(int start); + + WEBKIT_API int proxyEnd() const; + WEBKIT_API void setProxyEnd(int end); + + WEBKIT_API int dnsStart() const; + WEBKIT_API void setDNSStart(int start); + + WEBKIT_API int dnsEnd() const; + WEBKIT_API void setDNSEnd(int end); + + WEBKIT_API int connectStart() const; + WEBKIT_API void setConnectStart(int start); + + WEBKIT_API int connectEnd() const; + WEBKIT_API void setConnectEnd(int end); + + WEBKIT_API int sendStart() const; + WEBKIT_API void setSendStart(int start); + + WEBKIT_API int sendEnd() const; + WEBKIT_API void setSendEnd(int end); + + WEBKIT_API int receiveHeadersEnd() const; + WEBKIT_API void setReceiveHeadersEnd(int end); + + WEBKIT_API int sslStart() const; + WEBKIT_API void setSSLStart(int start); + + WEBKIT_API int sslEnd() const; + WEBKIT_API void setSSLEnd(int end); + +#if WEBKIT_IMPLEMENTATION + WebURLLoadTiming(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + WebURLLoadTiming& operator=(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + operator WTF::PassRefPtr<WebCore::ResourceLoadTiming>() const; +#endif + +private: + WebPrivatePtr<WebCore::ResourceLoadTiming> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURLLoaderClient.h b/WebKit/chromium/public/WebURLLoaderClient.h index 03b2c54..c716e5d 100644 --- a/WebKit/chromium/public/WebURLLoaderClient.h +++ b/WebKit/chromium/public/WebURLLoaderClient.h @@ -43,24 +43,31 @@ public: // Called when following a redirect. |newRequest| contains the request // generated by the redirect. The client may modify |newRequest|. virtual void willSendRequest( - WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; + WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { } // Called to report upload progress. The bytes reported correspond to // the HTTP message body. virtual void didSendData( - WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; + WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { } // Called when response headers are received. - virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) = 0; + virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } + + // Called when a chunk of response data is downloaded. This is only called + // if WebURLRequest's downloadToFile flag was set to true. + virtual void didDownloadData(WebURLLoader*, int dataLength) { } // Called when a chunk of response data is received. - virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength) = 0; + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength) { } + + // Called when a chunk of renderer-generated metadata is received from the cache. + virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { } // Called when the load completes successfully. - virtual void didFinishLoading(WebURLLoader*) = 0; + virtual void didFinishLoading(WebURLLoader*) { } // Called when the load completes with an error. - virtual void didFail(WebURLLoader*, const WebURLError&) = 0; + virtual void didFail(WebURLLoader*, const WebURLError&) { } protected: ~WebURLLoaderClient() { } diff --git a/WebKit/chromium/public/WebURLRequest.h b/WebKit/chromium/public/WebURLRequest.h index 41443b4..36d6791 100644 --- a/WebKit/chromium/public/WebURLRequest.h +++ b/WebKit/chromium/public/WebURLRequest.h @@ -67,7 +67,10 @@ public: TargetIsFontResource = 5, TargetIsImage = 6, TargetIsObject = 7, - TargetIsMedia = 8 + TargetIsMedia = 8, + TargetIsWorker = 9, + TargetIsSharedWorker = 10, + TargetIsPrefetch = 11, }; ~WebURLRequest() { reset(); } @@ -127,6 +130,10 @@ public: WEBKIT_API bool reportUploadProgress() const; WEBKIT_API void setReportUploadProgress(bool); + // Controls whether load timing info is collected for the request. + WEBKIT_API bool reportLoadTiming() const; + WEBKIT_API void setReportLoadTiming(bool); + WEBKIT_API TargetType targetType() const; WEBKIT_API void setTargetType(TargetType); @@ -144,6 +151,11 @@ public: WEBKIT_API int appCacheHostID() const; WEBKIT_API void setAppCacheHostID(int id); + // If true, the response body will be downloaded to a file managed by the + // WebURLLoader. See WebURLResponse::downloadedFilePath. + WEBKIT_API bool downloadToFile() const; + WEBKIT_API void setDownloadToFile(bool); + #if defined(WEBKIT_IMPLEMENTATION) WebCore::ResourceRequest& toMutableResourceRequest(); const WebCore::ResourceRequest& toResourceRequest() const; diff --git a/WebKit/chromium/public/WebURLResponse.h b/WebKit/chromium/public/WebURLResponse.h index 1dac069..ac75d4c 100644 --- a/WebKit/chromium/public/WebURLResponse.h +++ b/WebKit/chromium/public/WebURLResponse.h @@ -43,6 +43,7 @@ class WebCString; class WebHTTPHeaderVisitor; class WebString; class WebURL; +class WebURLLoadTiming; class WebURLResponsePrivate; class WebURLResponse { @@ -72,6 +73,18 @@ public: WEBKIT_API WebURL url() const; WEBKIT_API void setURL(const WebURL&); + WEBKIT_API unsigned connectionID() const; + WEBKIT_API void setConnectionID(unsigned); + + WEBKIT_API bool connectionReused() const; + WEBKIT_API void setConnectionReused(bool); + + WEBKIT_API WebURLLoadTiming loadTiming(); + WEBKIT_API void setLoadTiming(const WebURLLoadTiming&); + + WEBKIT_API double responseTime() const; + WEBKIT_API void setResponseTime(double); + WEBKIT_API WebString mimeType() const; WEBKIT_API void setMIMEType(const WebString&); @@ -118,11 +131,39 @@ public: const WebCore::ResourceResponse& toResourceResponse() const; #endif + // Flag whether this request was served from the disk cache entry. + WEBKIT_API bool wasCached() const; + WEBKIT_API void setWasCached(bool); + // Flag whether this request was loaded via the SPDY protocol or not. // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy WEBKIT_API bool wasFetchedViaSPDY() const; WEBKIT_API void setWasFetchedViaSPDY(bool); + // Flag whether this request was loaded after the TLS/Next-Protocol-Negotiation was used. + // This is related to SPDY. + WEBKIT_API bool wasNpnNegotiated() const; + WEBKIT_API void setWasNpnNegotiated(bool); + + // Flag whether this request was made when "Alternate-Protocol: xxx" + // is present in server's response. + WEBKIT_API bool wasAlternateProtocolAvailable() const; + WEBKIT_API void setWasAlternateProtocolAvailable(bool); + + // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS, etc). + WEBKIT_API bool wasFetchedViaProxy() const; + WEBKIT_API void setWasFetchedViaProxy(bool); + + // Flag whether this request is part of a multipart response. + WEBKIT_API bool isMultipartPayload() const; + WEBKIT_API void setIsMultipartPayload(bool); + + // This indicates the location of a downloaded response if the + // WebURLRequest had the downloadToFile flag set to true. This file path + // remains valid for the lifetime of the WebURLLoader used to create it. + WEBKIT_API WebString downloadFilePath() const; + WEBKIT_API void setDownloadFilePath(const WebString&); + protected: void assign(WebURLResponsePrivate*); diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h index 99125d4..1b94da2 100644 --- a/WebKit/chromium/public/WebView.h +++ b/WebKit/chromium/public/WebView.h @@ -32,31 +32,46 @@ #define WebView_h #include "WebDragOperation.h" +#include "WebString.h" +#include "WebVector.h" #include "WebWidget.h" namespace WebKit { class WebAccessibilityObject; class WebDevToolsAgent; +class WebDevToolsAgentClient; class WebDragData; class WebFrame; class WebFrameClient; +class WebGLES2Context; class WebNode; class WebSettings; class WebString; class WebViewClient; struct WebMediaPlayerAction; struct WebPoint; -template <typename T> class WebVector; class WebView : public WebWidget { public: + // Controls the time that user scripts injected into the document run. + enum UserScriptInjectAt { + UserScriptInjectAtDocumentStart, + UserScriptInjectAtDocumentEnd + }; + + // Controls which frames user content is injected into. + enum UserContentInjectIn { + UserContentInjectInAllFrames, + UserContentInjectInTopFrameOnly + }; + // Initialization ------------------------------------------------------ // Creates a WebView that is NOT yet initialized. You will need to // call initializeMainFrame to finish the initialization. It is valid - // to pass a null WebViewClient pointer. - WEBKIT_API static WebView* create(WebViewClient*); + // to pass null WebViewClient and WebDevToolsAgentClient pointers. + WEBKIT_API static WebView* create(WebViewClient*, WebDevToolsAgentClient*); // After creating a WebView, you should immediately call this method. // You can optionally modify the settings before calling this method. @@ -169,6 +184,11 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation) = 0; + // Notifies the WebView that a drag is going on. + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperation operation) = 0; + // Notfies the WebView that the system drag and drop operation has ended. virtual void dragSourceSystemDragEnded() = 0; @@ -210,11 +230,14 @@ public: // Settings used by the inspector. virtual WebString inspectorSettings() const = 0; virtual void setInspectorSettings(const WebString&) = 0; + virtual bool inspectorSetting(const WebString& key, + WebString* value) const = 0; + virtual void setInspectorSetting(const WebString& key, + const WebString& value) = 0; // The embedder may optionally engage a WebDevToolsAgent. This may only // be set once per WebView. virtual WebDevToolsAgent* devToolsAgent() = 0; - virtual void setDevToolsAgent(WebDevToolsAgent*) = 0; // Accessibility ------------------------------------------------------- @@ -223,34 +246,37 @@ public: virtual WebAccessibilityObject accessibilityObject() = 0; - // AutoFill / Autocomplete --------------------------------------------- + // AutoFill ----------------------------------------------------------- - // DEPRECATED: WebView::applyAutocompleteSuggestions is the new way to - // access this. - virtual void applyAutofillSuggestions( + // DEPRECATED. + virtual void applyAutoFillSuggestions( const WebNode&, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex) = 0; + const WebVector<WebString>& names, + const WebVector<WebString>& labels, + const WebVector<int>& uniqueIDs, + int separatorIndex) = 0; // Notifies the WebView that AutoFill suggestions are available for a node. + // |uniqueIDs| is a vector of IDs that represent the unique ID of each + // AutoFill profile in the suggestions popup. virtual void applyAutoFillSuggestions( const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex) = 0; + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex) = 0; // Notifies the WebView that Autocomplete suggestions are available for a // node. + // DEPRECATED: merging with applyAutoFillSuggestions. virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, int defaultSuggestionIndex) = 0; - // DEPRECATED: WebView::hideSuggestionsPopup is the new way to access this. - virtual void hideAutofillPopup() = 0; - - // Hides the suggestions popup if any are showing. - virtual void hideSuggestionsPopup() = 0; + // Hides any popup (suggestions, selects...) that might be showing. + virtual void hidePopups() = 0; // Context menu -------------------------------------------------------- @@ -281,9 +307,26 @@ public: unsigned inactiveForegroundColor) = 0; // User scripts -------------------------------------------------------- - virtual void addUserScript(const WebString& sourceCode, - bool runAtStart) = 0; - virtual void removeAllUserContent() = 0; + // FIXME: These two methods are DEPRECATED. Remove once Chromium has been rolled. + virtual void addUserScript(const WebString& sourceCode, bool runAtStart) + { + addUserScript(sourceCode, WebVector<WebString>(), + runAtStart ? UserScriptInjectAtDocumentStart : UserScriptInjectAtDocumentEnd, + UserContentInjectInAllFrames); + } + virtual void addUserStyleSheet(const WebString& sourceCode) + { + addUserStyleSheet(sourceCode, WebVector<WebString>(), UserContentInjectInAllFrames); + } + + WEBKIT_API static void addUserScript(const WebString& sourceCode, + const WebVector<WebString>& patterns, + UserScriptInjectAt injectAt, + UserContentInjectIn injectIn); + WEBKIT_API static void addUserStyleSheet(const WebString& sourceCode, + const WebVector<WebString>& patterns, + UserContentInjectIn injectIn); + WEBKIT_API static void removeAllUserContent(); // Modal dialog support ------------------------------------------------ @@ -292,6 +335,12 @@ public: WEBKIT_API static void willEnterModalLoop(); WEBKIT_API static void didExitModalLoop(); + // GPU acceleration support -------------------------------------------- + + // Returns the GLES2Context associated with this WebView. One will be + // created if it doesn't already exist. + virtual WebGLES2Context* gles2Context() = 0; + protected: ~WebView() {} }; diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h index 4d272bb..4628c2f 100644 --- a/WebKit/chromium/public/WebViewClient.h +++ b/WebKit/chromium/public/WebViewClient.h @@ -35,6 +35,7 @@ #include "WebEditingAction.h" #include "WebFileChooserCompletion.h" #include "WebFileChooserParams.h" +#include "WebPopupType.h" #include "WebString.h" #include "WebTextAffinity.h" #include "WebTextDirection.h" @@ -44,11 +45,18 @@ namespace WebKit { class WebAccessibilityObject; class WebDragData; +class WebElement; class WebFileChooserCompletion; class WebFrame; +class WebGeolocationService; +class WebImage; +class WebInputElement; +class WebKeyboardEvent; class WebNode; class WebNotificationPresenter; class WebRange; +class WebSpeechInputController; +class WebSpeechInputListener; class WebStorageNamespace; class WebURL; class WebView; @@ -57,6 +65,7 @@ struct WebConsoleMessage; struct WebContextMenuData; struct WebPoint; struct WebPopupMenuInfo; +struct WebWindowFeatures; // Since a WebView is a WebWidget, a WebViewClient is a WebWidgetClient. // Virtual inheritance allows an implementation of WebWidgetClient to be @@ -68,15 +77,17 @@ public: // Create a new related WebView. This method must clone its session storage // so any subsequent calls to createSessionStorageNamespace conform to the // WebStorage specification. - virtual WebView* createView(WebFrame* creator) { return 0; } + virtual WebView* createView(WebFrame* creator, + const WebWindowFeatures& features, + const WebString& name) { return 0; } // Create a new WebPopupMenu. In the second form, the client is // responsible for rendering the contents of the popup menu. - virtual WebWidget* createPopupMenu(bool activatable) { return 0; } + virtual WebWidget* createPopupMenu(WebPopupType) { return 0; } virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) { return 0; } // Create a session storage namespace object associated with this WebView. - virtual WebStorageNamespace* createSessionStorageNamespace() { return 0; } + virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; } // Misc ---------------------------------------------------------------- @@ -119,7 +130,6 @@ public: virtual bool isSmartInsertDeleteEnabled() { return true; } virtual bool isSelectTrailingWhitespaceEnabled() { return true; } - virtual void setInputMethodEnabled(bool enabled) { } virtual void didBeginEditing() { } virtual void didChangeSelection(bool isSelectionEmpty) { } @@ -127,6 +137,12 @@ public: virtual void didExecuteCommand(const WebString& commandName) { } virtual void didEndEditing() { } + // These methods are called when the users edits a text-field. + virtual void textFieldDidBeginEditing(const WebInputElement&) { } + virtual void textFieldDidEndEditing(const WebInputElement&) { } + virtual void textFieldDidChange(const WebInputElement&) { } + virtual void textFieldDidReceiveKeyDown(const WebInputElement&, const WebKeyboardEvent&) { } + // This method is called in response to WebView's handleInputEvent() // when the default action for the current keyboard event is not // suppressed by the page, to give the embedder a chance to handle @@ -197,6 +213,9 @@ public: virtual bool runModalBeforeUnloadDialog( WebFrame*, const WebString& message) { return true; } + virtual bool supportsFullscreen() { return false; } + virtual void enterFullscreenForNode(const WebNode&) { } + virtual void exitFullscreenForNode(const WebNode&) { } // UI ------------------------------------------------------------------ @@ -218,7 +237,7 @@ public: // Called when a drag-n-drop operation should begin. virtual void startDragging( - const WebPoint& from, const WebDragData&, WebDragOperationsMask) { } + const WebDragData&, WebDragOperationsMask, const WebImage&, const WebPoint&) { } // Called to determine if drag-n-drop operations may initiate a page // navigation. @@ -229,6 +248,9 @@ public: virtual void focusNext() { } virtual void focusPrevious() { } + // Called when a new node gets focused. + virtual void focusedNodeChanged(const WebNode&) { } + // Session history ----------------------------------------------------- @@ -262,8 +284,10 @@ public: // changed and should be saved. See WebView::inspectorSettings. virtual void didUpdateInspectorSettings() { } + virtual void didUpdateInspectorSetting(const WebString& key, const WebString& value) { } - // Autofill ------------------------------------------------------------ + + // AutoFill ------------------------------------------------------------ // Queries the browser for suggestions to be shown for the form text // field named |name|. |value| is the text entered by the user so @@ -272,11 +296,51 @@ public: const WebString& name, const WebString& value) { } - // Instructs the browser to remove the autofill entry specified from + // Instructs the browser to remove the Autocomplete entry specified from // its DB. + // FIXME: This method should be named removeAutocompleteSugestion. virtual void removeAutofillSuggestions(const WebString& name, const WebString& value) { } + // Informs the browser that the user has accepted an AutoFill suggestion for + // a WebNode. |name| and |label| form a key into the set of AutoFill + // profiles. |index| is an index of the selected suggestion in the list of + // suggestions provided by the client + virtual void didAcceptAutoFillSuggestion(const WebNode&, + const WebString& name, + const WebString& label, + int uniqueID, + unsigned index) { } + + // Informs the browser that the user has selected an AutoFill suggestion for + // a WebNode. This happens when the user hovers over a suggestion or uses + // the arrow keys to navigate to a suggestion. + virtual void didSelectAutoFillSuggestion(const WebNode&, + const WebString& name, + const WebString& label, + int uniqueID) { } + + // Informs the browser that the user has cleared the selection from the + // AutoFill suggestions popup. This happens when a user uses the arrow + // keys to navigate outside the range of possible selections. + virtual void didClearAutoFillSelection(const WebNode&) { } + + // Informs the browser that the user has selected an autocomplete (password + // or field) suggestion from the drop-down. The input element text has + // already been set to the selected suggestion. + virtual void didAcceptAutocompleteSuggestion(const WebInputElement&) { } + + // Geolocation --------------------------------------------------------- + + // Access the embedder API for geolocation services. + virtual WebGeolocationService* geolocationService() { return 0; } + + // Speech -------------------------------------------------------------- + + // Access the embedder API for speech input services. + virtual WebSpeechInputController* speechInputController( + WebSpeechInputListener*) { return 0; } + protected: ~WebViewClient() { } }; diff --git a/WebKit/chromium/public/WebWidget.h b/WebKit/chromium/public/WebWidget.h index 9dfeefc..5c9f54e 100644 --- a/WebKit/chromium/public/WebWidget.h +++ b/WebKit/chromium/public/WebWidget.h @@ -33,7 +33,8 @@ #include "WebCanvas.h" #include "WebCommon.h" -#include "WebCompositionCommand.h" +#include "WebCompositionUnderline.h" +#include "WebTextInputType.h" #include "WebTextDirection.h" namespace WebKit { @@ -42,6 +43,7 @@ class WebInputEvent; class WebString; struct WebRect; struct WebSize; +template <typename T> class WebVector; class WebWidget { public: @@ -76,20 +78,35 @@ public: // Called to inform the WebWidget that it has gained or lost keyboard focus. virtual void setFocus(bool) = 0; - // Called to inform the WebWidget of a composition event. - virtual bool handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& text) = 0; + // Called to inform the WebWidget of a new composition text. + // If selectionStart and selectionEnd has the same value, then it indicates + // the input caret position. If the text is empty, then the existing + // composition text will be cancelled. + // Returns true if the composition text was set successfully. + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) = 0; - // Retrieve the status of this WebWidget required by IME APIs. Upon - // success enabled and caretBounds are set. - virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0; + // Called to inform the WebWidget to confirm an ongoing composition. + // Returns true if there is an ongoing composition. + virtual bool confirmComposition() = 0; + + // Returns the current text input type of this WebWidget. + virtual WebTextInputType textInputType() = 0; + + // Returns the current caret bounds of this WebWidget. The selection bounds + // will be returned if a selection range is available. + virtual WebRect caretOrSelectionBounds() = 0; // Changes the text direction of the selected input node. virtual void setTextDirection(WebTextDirection) = 0; + // Returns true if the WebWidget uses GPU accelerated compositing + // to render its contents. + virtual bool isAcceleratedCompositingActive() const = 0; + protected: ~WebWidget() { } }; diff --git a/WebKit/chromium/public/WebWidgetClient.h b/WebKit/chromium/public/WebWidgetClient.h index 06d9eba..bd7bd6a 100644 --- a/WebKit/chromium/public/WebWidgetClient.h +++ b/WebKit/chromium/public/WebWidgetClient.h @@ -83,6 +83,10 @@ public: // displayed. virtual WebScreenInfo screenInfo() { return WebScreenInfo(); } + // When this method gets called, WebWidgetClient implementation should + // reset the input method by cancelling any ongoing composition. + virtual void resetInputMethod() { } + protected: ~WebWidgetClient() { } }; diff --git a/WebKit/chromium/public/WebWindowFeatures.h b/WebKit/chromium/public/WebWindowFeatures.h new file mode 100644 index 0000000..2e7278a --- /dev/null +++ b/WebKit/chromium/public/WebWindowFeatures.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebWindowFeatures_h +#define WebWindowFeatures_h + +#include "WebCommon.h" +#include "WebString.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +#include "WindowFeatures.h" +#endif + +namespace WebKit { + +struct WebWindowFeatures { + float x; + bool xSet; + float y; + bool ySet; + float width; + bool widthSet; + float height; + bool heightSet; + + bool menuBarVisible; + bool statusBarVisible; + bool toolBarVisible; + bool locationBarVisible; + bool scrollbarsVisible; + bool resizable; + + bool fullscreen; + bool dialog; + WebVector<WebString> additionalFeatures; + + WebWindowFeatures() + : xSet(false) + , ySet(false) + , widthSet(false) + , heightSet(false) + , menuBarVisible(true) + , statusBarVisible(true) + , toolBarVisible(true) + , locationBarVisible(true) + , scrollbarsVisible(true) + , resizable(true) + , fullscreen(false) + , dialog(false) + { + } + + +#if WEBKIT_IMPLEMENTATION + WebWindowFeatures(const WebCore::WindowFeatures& f) + : xSet(f.xSet) + , ySet(f.ySet) + , widthSet(f.widthSet) + , heightSet(f.heightSet) + , menuBarVisible(f.menuBarVisible) + , statusBarVisible(f.statusBarVisible) + , toolBarVisible(f.toolBarVisible) + , locationBarVisible(f.locationBarVisible) + , scrollbarsVisible(f.scrollbarsVisible) + , resizable(f.resizable) + , fullscreen(f.fullscreen) + , dialog(f.dialog) + , additionalFeatures(f.additionalFeatures) + { + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/gtk/WebFontInfo.h b/WebKit/chromium/public/gtk/WebFontInfo.h index ad37680..fae792d 100644 --- a/WebKit/chromium/public/gtk/WebFontInfo.h +++ b/WebKit/chromium/public/gtk/WebFontInfo.h @@ -32,6 +32,7 @@ #define WebFontInfo_h #include "../WebCString.h" +#include "../linux/WebFontRenderStyle.h" #include <string.h> #include <unistd.h> @@ -48,6 +49,19 @@ public: // Returns: the font family or an empty string if the request could not be // satisfied. WEBKIT_API static WebCString familyForChars(const WebUChar* characters, size_t numCharacters); + + // Fill out the given WebFontRenderStyle with the user's preferences for + // rendering the given font at the given size. + // family: i.e. "Times New Roman" + // sizeAndStyle: + // 3322222222221111111111 + // 10987654321098765432109876543210 + // +--------------------------------+ + // |..............Size............IB| + // +--------------------------------+ + // I: italic flag + // B: bold flag + WEBKIT_API static void renderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* result); }; } // namespace WebKit diff --git a/WebKit/chromium/public/linux/WebFontRenderStyle.h b/WebKit/chromium/public/linux/WebFontRenderStyle.h new file mode 100644 index 0000000..a3b180f --- /dev/null +++ b/WebKit/chromium/public/linux/WebFontRenderStyle.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFontRenderStyle_h +#define WebFontRenderStyle_h + +#include "../WebCommon.h" + +namespace WebCore { struct FontRenderStyle; } + +namespace WebKit { + +struct WebFontRenderStyle { + // Each of the use* members below can take one of three values: + // 0: off + // 1: on + // 2: no preference expressed + char useBitmaps; // use embedded bitmap strike if possible + char useAutoHint; // use 'auto' hinting (FreeType specific) + char useHinting; // hint glyphs to the pixel grid + char hintStyle; // level of hinting, 0..3 + char useAntiAlias; // antialias glyph shapes + char useSubpixel; // use subpixel antialias + +#ifdef WEBKIT_IMPLEMENTATION + // Translates the members of this struct to a FontRenderStyle + void toFontRenderStyle(WebCore::FontRenderStyle*); +#endif + + void setDefaults(); +}; + +} // namespace WebKit + +#endif // WebFontRenderStyle_h diff --git a/WebKit/chromium/public/linux/WebSandboxSupport.h b/WebKit/chromium/public/linux/WebSandboxSupport.h index 5edceb2..6990abe 100644 --- a/WebKit/chromium/public/linux/WebSandboxSupport.h +++ b/WebKit/chromium/public/linux/WebSandboxSupport.h @@ -36,6 +36,8 @@ namespace WebKit { +struct WebFontRenderStyle; + // Put methods here that are required due to sandbox restrictions. class WebSandboxSupport { public: @@ -49,6 +51,7 @@ public: // Returns a string with the font family on an empty string if the // request cannot be satisfied. virtual WebString getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters) = 0; + virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* style) = 0; }; } // namespace WebKit diff --git a/WebKit/chromium/public/mac/WebSandboxSupport.h b/WebKit/chromium/public/mac/WebSandboxSupport.h new file mode 100644 index 0000000..57d48aa --- /dev/null +++ b/WebKit/chromium/public/mac/WebSandboxSupport.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef uintptr_t ATSFontContainerRef; + +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Given an input font - |srcFont| [which can't be loaded due to sandbox + // restrictions]. Return a font container belonging to an equivalent + // font file that can be used to access the font. + // + // Note that a font container may contain multiple fonts, the caller is + // responsible for retreiving the appropriate font from the container. + // + // If this function succeeds, the caller assumes ownership of the |out| + // parameter and must call ATSFontDeactivate() to unload it when done. + // + // Returns: true on success, false on error. + virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out) = 0; +}; + +} // namespace WebKit + +#endif |
