diff options
Diffstat (limited to 'WebKit/win')
62 files changed, 2349 insertions, 361 deletions
diff --git a/WebKit/win/AccessibleBase.cpp b/WebKit/win/AccessibleBase.cpp index 55cbab3..47b8369 100644 --- a/WebKit/win/AccessibleBase.cpp +++ b/WebKit/win/AccessibleBase.cpp @@ -190,11 +190,9 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accDescription(VARIANT vChild, BST if (FAILED(hr)) return hr; - // TODO: Description, for SELECT subitems, should be a string describing - // the position of the item in its group and of the group in the list (see - // Firefox). - if (*description = BString(wrapper(childObj)->description()).release()) + if (*description = BString(childObj->descriptionForMSAA()).release()) return S_OK; + return S_FALSE; } @@ -211,6 +209,13 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accRole(VARIANT vChild, VARIANT* p if (FAILED(hr)) return hr; + String roleString = childObj->stringRoleForMSAA(); + if (!roleString.isEmpty()) { + V_VT(pvRole) = VT_BSTR; + V_BSTR(pvRole) = BString(roleString).release(); + return S_OK; + } + pvRole->vt = VT_I4; pvRole->lVal = wrapper(childObj)->role(); return S_OK; @@ -232,7 +237,7 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accState(VARIANT vChild, VARIANT* pvState->vt = VT_I4; pvState->lVal = 0; - if (childObj->isAnchor()) + if (childObj->isLinked()) pvState->lVal |= STATE_SYSTEM_LINKED; if (childObj->isHovered()) @@ -514,26 +519,12 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::accDoDefaultAction(VARIANT vChild) // AccessibleBase String AccessibleBase::name() const { - return m_object->title(); + return m_object->nameForMSAA(); } String AccessibleBase::value() const { - return m_object->stringValue(); -} - -String AccessibleBase::description() const -{ - String desc = m_object->accessibilityDescription(); - if (desc.isNull()) - return desc; - - // From the Mozilla MSAA implementation: - // "Signal to screen readers that this description is speakable and is not - // a formatted positional information description. Don't localize the - // 'Description: ' part of this string, it will be parsed out by assistive - // technologies." - return "Description: " + desc; + return m_object->stringValueForMSAA(); } static long MSAARole(AccessibilityRole role) diff --git a/WebKit/win/AccessibleBase.h b/WebKit/win/AccessibleBase.h index c69c57d..3b6bce8 100644 --- a/WebKit/win/AccessibleBase.h +++ b/WebKit/win/AccessibleBase.h @@ -95,7 +95,6 @@ protected: virtual WebCore::String name() const; virtual WebCore::String value() const; - virtual WebCore::String description() const; virtual long role() const; HRESULT getAccessibilityObjectForChild(VARIANT vChild, WebCore::AccessibilityObject*&) const; diff --git a/WebKit/win/CFDictionaryPropertyBag.cpp b/WebKit/win/CFDictionaryPropertyBag.cpp index 32457f1..f4fb5b3 100644 --- a/WebKit/win/CFDictionaryPropertyBag.cpp +++ b/WebKit/win/CFDictionaryPropertyBag.cpp @@ -33,7 +33,7 @@ // CFDictionaryPropertyBag ----------------------------------------------- CFDictionaryPropertyBag::CFDictionaryPropertyBag() -: m_refCount(1) +: m_refCount(0) { gClassCount++; gClassNameCount.add("CFDictionaryPropertyBag"); @@ -45,10 +45,9 @@ CFDictionaryPropertyBag::~CFDictionaryPropertyBag() gClassNameCount.remove("CFDictionaryPropertyBag"); } -CFDictionaryPropertyBag* CFDictionaryPropertyBag::createInstance() +COMPtr<CFDictionaryPropertyBag> CFDictionaryPropertyBag::createInstance() { - CFDictionaryPropertyBag* instance = new CFDictionaryPropertyBag(); - return instance; + return new CFDictionaryPropertyBag; } void CFDictionaryPropertyBag::setDictionary(CFMutableDictionaryRef dictionary) diff --git a/WebKit/win/CFDictionaryPropertyBag.h b/WebKit/win/CFDictionaryPropertyBag.h index 23763b3..3cac464 100644 --- a/WebKit/win/CFDictionaryPropertyBag.h +++ b/WebKit/win/CFDictionaryPropertyBag.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,42 +23,37 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CFDictionaryPropertyBag_H -#define CFDictionaryPropertyBag_H +#ifndef CFDictionaryPropertyBag_h +#define CFDictionaryPropertyBag_h -#include <CoreFoundation/CoreFoundation.h> +#include <WebCore/COMPtr.h> #include <wtf/RetainPtr.h> -class CFDictionaryPropertyBag : public IPropertyBag -{ -public: - static CFDictionaryPropertyBag* createInstance(); -protected: - CFDictionaryPropertyBag(); - ~CFDictionaryPropertyBag(); +typedef struct __CFDictionary* CFMutableDictionaryRef; +class CFDictionaryPropertyBag : public IPropertyBag { public: - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); + static COMPtr<CFDictionaryPropertyBag> createInstance(); - // IPropertyBag - virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read( - /* [in] */ LPCOLESTR pszPropName, - /* [out][in] */ VARIANT *pVar, - /* [in] */ IErrorLog *pErrorLog); - - virtual HRESULT STDMETHODCALLTYPE Write( - /* [in] */ LPCOLESTR pszPropName, - /* [in] */ VARIANT *pVar); + // IUnknown + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); void setDictionary(CFMutableDictionaryRef dictionary); CFMutableDictionaryRef dictionary() const; private: + CFDictionaryPropertyBag(); + ~CFDictionaryPropertyBag(); + + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject); + + // IPropertyBag + virtual HRESULT STDMETHODCALLTYPE Read(LPCOLESTR pszPropName, VARIANT*, IErrorLog*); + virtual HRESULT STDMETHODCALLTYPE Write(LPCOLESTR pszPropName, VARIANT*); + RetainPtr<CFMutableDictionaryRef> m_dictionary; ULONG m_refCount; }; -#endif
\ No newline at end of file +#endif // CFDictionaryPropertyBag_h diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 6253010..95705a9 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,997 @@ +2009-12-10 Jon Honeycutt <jhoneycutt@apple.com> + + Pass more information about a plug-in to the PluginHalterDelegate + + Reviewed by Adam Roben. + + * Interfaces/IWebPluginHalterDelegate.idl: + Add new parameters. + + * WebCoreSupport/WebPluginHalterClient.cpp: + (WebPluginHalterClient::shouldHaltPlugin): + Update for new parameters. Pass them when making the delegate call. + + * WebCoreSupport/WebPluginHalterClient.h: + Update for new parameters. + +2009-12-09 Brent Fulgham <bfulgham@webkit.org> + + Revert incorrect commit-box update r51911. + It mistakenly set the selectAll implementation in the + deslectAll method. + + * WebFrame.cpp: + (WebFrame::deselectAll): + +2009-12-09 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Darin Adler. + + Provide an implementation for 'selectAll' + https://bugs.webkit.org/show_bug.cgi?id=32296 + + * WebFrame.cpp: + (WebFrame::selectAll): Implement "SelectAll" command. + +2009-12-09 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Darin Adler. + + Provide an implementation for 'selectAll' + https://bugs.webkit.org/show_bug.cgi?id=32296 + + * WebFrame.cpp: + (WebFrame::selectAll): Implement "SelectAll" command. + +2009-12-08 Chris Marrin <cmarrin@apple.com> + + Reviewed by Adam Roben. + + Delay load DLLs for accelerated compositing + https://bugs.webkit.org/show_bug.cgi?id=31856 + + If the DLLs (d3d9 and QuartzCore). are not present it + turns off accelerated compositing and avoids calling + any of the functions in the DLLs. + + * WebView.cpp: + * WebView.h: + +2009-12-08 Adam Roben <aroben@apple.com> + + Windows build fix + + * Interfaces/WebKit.idl: Touched this to force Interfaces.vcproj to rebuild. + +2009-12-08 John Sullivan <sullivan@apple.com> + + Reviewed by Dan Bernstein + + Split two-clause assertions into two separate assertions. + + * DOMHTMLClasses.cpp: + (DOMHTMLInputElement::isTextField): + Split a two-clause assertion into two separate assertions. + (DOMHTMLInputElement::rectOnScreen): + Added the two assertions here that all other functions in this group shared. + (DOMHTMLInputElement::selectedRange): + Split a two-clause assertion into two separate assertions. + (DOMHTMLInputElement::setAutofilled): + Split a two-clause assertion into two separate assertions. + (DOMHTMLInputElement::isAutofilled): + Split a two-clause assertion into two separate assertions. + +2009-12-08 Nikolas Zimmermann <nzimmermann@rim.com> + + Rubber-stamped by Maciej Stachowiak. + + Turn on (SVG) Filters for Win. + https://bugs.webkit.org/show_bug.cgi?id=32224 + + * WebKit.vcproj/WebKit.vcproj: + +2009-12-08 John Sullivan <sullivan@apple.com> + + Add isAutofilled getter to match existing setter. + + Reviewed by Ada Chan. + + * DOMHTMLClasses.cpp: + (DOMHTMLInputElement::isAutofilled): + Implemented new cover function. + + * DOMHTMLClasses.h: + Declared new cover function. + + * Interfaces/DOMPrivate.idl: + Declared new interface. + +2009-12-07 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (Windows build fix part III). + + * WebView.cpp: + (WebView::stringByEvaluatingJavaScriptFromString): + +2009-12-07 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (Windows build fix part II). + + * WebView.cpp: + (WebView::stringByEvaluatingJavaScriptFromString): + +2009-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7214236> and http://webkit.org/b/32052 - Implement HTML5 state object history API + + * Interfaces/IWebFrameLoadDelegatePrivate2.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::dispatchDidPushStateWithinPage): + (WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): + (WebFrameLoaderClient::dispatchDidPopStateWithinPage): + * WebCoreSupport/WebFrameLoaderClient.h: + +2009-12-03 Pavel Feldman <pfeldman@dhcp-172-28-174-220.spb.corp.google.com> + + Reviewed by Timothy Hatcher. + + Web Inspector: Simplify the settings support in inspector controller. + + https://bugs.webkit.org/show_bug.cgi?id=32076 + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::attachWindow): + (WebInspectorClient::detachWindow): + (WebInspectorClient::showWindowWithoutNotifications): + * WebCoreSupport/WebInspectorClient.h: + +2009-12-03 Ben Murdoch <benm@google.com> + + Reviewed by Brady Eidson. + + [Android] The FrameLoaderClient is unaware of BackForwardList changes. + https://bugs.webkit.org/show_bug.cgi?id=31914 + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::dispatchDidAddBackForwardItem): Add an empty implementation. Method added to FrameLoaderClient by Android (see bug). + (WebFrameLoaderClient::dispatchDidRemoveBackForwardItem): ditto. + (WebFrameLoaderClient::dispatchDidChangeBackForwardIndex): ditto. + * WebCoreSupport/WebFrameLoaderClient.h: + +2009-12-02 Timothy Hatcher <timothy@apple.com> + + Move setValueForUser to the end of the DOMHTMLInputElement interface + so it is fine for binary compatibility. + + Directed by Steve Falkenburg. + + * Interfaces/DOMHTML.idl: + +2009-12-02 Timothy Hatcher <timothy@apple.com> + + Expose setValueForUser for the COM DOMHTMLInputElement. + + <rdar://problem/6760590> Would like a way to detect a login form AutoFill from JavaScript + + Reviewed by Dan Bernstein. + + * DOMHTMLClasses.cpp: + (DOMHTMLInputElement::setValueForUser): + * Interfaces/DOMHTML.idl: + +2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Try to fix windows build. + + * WebFrame.cpp: + +2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Simon Fraser. + + Add SVG animation test framework with 'snapshot' functionality + https://bugs.webkit.org/show_bug.cgi?id=31897 + + Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method, + forwarding the call to SVGDocumentExtensions, if SVG is enabled. + + Implemented just like the existing pauseAnimation* methods for CSS animations. + + * Interfaces/IWebFramePrivate.idl: + * WebFrame.cpp: + (WebFrame::pauseSVGAnimation): + * WebFrame.h: + +2009-11-30 Adam Roben <aroben@apple.com> + + Fix double-free of BSTRs passed to WebNavigationData::createInstance + + WebFrameLoaderClient::updateGlobalHistory was converting + WebCore::Strings to WebCore::BStrings, then passing them to + WebNavigationData::createInstance. But the latter function takes BSTR + parameters and adopts them into WebCore::BStrings. So the end result + was that two WebCore::BStrings would end up freeing each underlying + BSTR. + + The fix is to only convert to WebCore::BString inside + WebNavigationData. + + Fixes <http://webkit.org/b/31998> <rdar://problem/7383452> REGRESSION + (r49564): Crash in updateGlobalHistory when running Javascript iBench + test + + I couldn't find a way to reproduce this in DumpRenderTree. + + Reviewed by Steve Falkenburg. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): Pass WebCore::Strings to + WebNavigationData::createInstance. + + * WebNavigationData.cpp: + (WebNavigationData::WebNavigationData): + (WebNavigationData::createInstance): + * WebNavigationData.h: + Changed to take const WebCore::String&s instead of BSTRs and to + convert the Strings to BStrings at this level. + +2009-11-30 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + WebKit clients that don't implement didClearWindowObjectForFrameInScriptWorld should fall back to didClearWindowObject + https://bugs.webkit.org/show_bug.cgi?id=31986 + + * WebFrame.cpp: + (WebFrame::dispatchDidClearWindowObjectInWorld): Fall back if E_NOTIMPL returned. + +2009-11-24 Chris Marrin <cmarrin@apple.com> + + Another Windows build fix + + Got rid of d3d.lib and d3dx9.lib dependency. Not needed until + we turn on ACCELERATED_COMPOSITING + + * WebKit.vcproj/WebKit.vcproj: + +2009-11-24 Chris Marrin <cmarrin@apple.com> + + Fixed Windows build + + Got rid of QuartzCore.lib dependency. Not needed until + we turn on ACCELERATED_COMPOSITING + + * WebKit.vcproj/WebKit.vcproj: + +2009-11-24 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Implement accelerated compositing + https://bugs.webkit.org/show_bug.cgi?id=27314 + + This is the WebKit side of the implementation. It plumbs the root layer + from WebCore. It also makes changes to WebView which places the + backing store of the page into the root compositing layer so it is + properly composited with all the other layers. This deals with resizing, + scrolling, and incremental repaint of the page. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::attachRootGraphicsLayer): + (WebChromeClient::scheduleCompositingLayerSync): + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient::setNeedsOneShotDrawingSynchronization): + * WebKit.vcproj/WebKit.vcproj: + * WebView.cpp: + (WebView::WebView): + (WebView::close): + (WebView::repaint): + (WebView::scrollBackingStore): + (WebView::paint): + (WebViewWndProc): + (WebView::setRootChildLayer): + (WebView::setAcceleratedCompositing): + (WebView::setRootLayerContents): + * WebView.h: + (WebView::isAcceleratedCompositing): + (WebView::resizeLayerWindow): + (WebView::layerWindowBecameVisible): + (WebView::setRootLayerNeedsDisplay): + +2009-11-23 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Include "config.h" to meet Coding Style Guidelines + https://bugs.webkit.org/show_bug.cgi?id=31792 + + * GEN_DOMObject.cpp: + * WebScriptObject.cpp: + +2009-11-21 Jon Honeycutt <jhoneycutt@apple.com> + + Windows build fix. Unreviewed. + + * Interfaces/IWebSerializedJSValue.idl: + +2009-11-20 Jon Honeycutt <jhoneycutt@apple.com> + + DOMElement::tagName() is unimplemented + + https://bugs.webkit.org/show_bug.cgi?id=31746 + + Reviewed by Darin Adler. + + * DOMCoreClasses.cpp: + (DOMElement::tagName): + Create a BString from the element's tag name, and release its BSTR + into result. + +2009-11-20 Jon Honeycutt <jhoneycutt@apple.com> + + DOMNode::childNodes() is unimplemented + + https://bugs.webkit.org/show_bug.cgi?id=31745 + + Reviewed by Darin Adler. + + * DOMCoreClasses.cpp: + (DOMNode::childNodes): + Create a DOMNodeList from the node's child nodes. + +2009-11-20 Dave Hyatt <hyatt@apple.com> + + Reviewed by Jon Honeycutt. + + Change WebSerializedJSValue on Windows to have a zero-argument createInstance call. Move the + serialization into a separate serialize() function that can be called after the object has been + created. + + Fix a typo in serialize() caused when fixing build bustage (put a ! back in). + + * Interfaces/IWebSerializedJSValue.idl: + * WebSerializedJSValue.cpp: + (WebSerializedJSValue::WebSerializedJSValue): + (WebSerializedJSValue::createInstance): + (WebSerializedJSValue::serialize): + (WebSerializedJSValue::deserialize): + * WebSerializedJSValue.h: + +2009-11-20 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Dave Hyatt. + + Another go at the Windows Build Fix - this is a couple steps of it, + so a little more involved than most build fixes. + + * Interfaces/IWebSerializedJSValue.idl: + * Interfaces/JavaScriptCoreAPITypes.idl: + * WebKit.vcproj/Interfaces.vcproj: + * WebSerializedJSValue.cpp: + (WebSerializedJSValue::deserialize): + * WebSerializedJSValue.h: + +2009-11-20 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Dave Hyatt. + + Build fix for Windows - only declare JSContextRef once, instead + of in two different idl files. Create a new file to hold the + definition of JSContextRef. + + * Interfaces/IWebFrameLoadDelegate.idl: + * Interfaces/IWebSerializedJSValue.idl: + * Interfaces/JavaScriptCoreAPITypes.idl: Added. + * Interfaces/WebKit.idl: + * WebKit.vcproj/Interfaces.vcproj: + +2009-11-20 Dave Hyatt <hyatt@apple.com> + + Reviewed by Oliver Hunt and Jon Honeycutt. + + Add support for WebSerializedJSValue to WebKit. This object wraps the SerializedScriptValue functionality in WebCore + and exposes the ability to do JS value serialization/deserialization to WebKit clients. + + * Interfaces/IWebSerializedJSValue.idl: Added. + * Interfaces/WebKit.idl: + * WebKit.vcproj/WebKit.vcproj: + * WebSerializedJSValue.cpp: Added. + (WebSerializedJSValue::WebSerializedJSValue): + (WebSerializedJSValue::~WebSerializedJSValue): + (WebSerializedJSValue::createInstance): + (WebSerializedJSValue::AddRef): + (WebSerializedJSValue::Release): + (WebSerializedJSValue::QueryInterface): + (WebSerializedJSValue::deserialize): + * WebSerializedJSValue.h: Added. + +2009-11-19 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=31690 + Make SocketStreamHandleCFNet work on Windows + + * WebDownloadCFNet.cpp: + (WebDownload::init): + (WebDownload::initWithRequest): + (WebDownload::initToResumeWithBundle): + Update for loaderRunLoop() now being in its own header. + +2009-11-19 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/7035231> + Support closed caption in <video> element + + * WebCoreLocalizedStrings.cpp: + (WebCore::localizedMediaControlElementString): + (WebCore::localizedMediaControlElementHelpText): + Add accessibility help strings for media controller closed caption button. + +2009-11-18 Michelangelo De Simone <micdesim@gmail.com> + + Reviewed by Darin Adler. + + Fix for <https://bugs.webkit.org/show_bug.cgi?id=27959>. + Support for validationMessage attribute, as per HTML5 specs. + + * WebCoreLocalizedStrings.cpp: + (WebCore::validationMessageValueMissingText): + (WebCore::validationMessageTypeMismatchText): + (WebCore::validationMessagePatternMismatchText): + (WebCore::validationMessageTooLongText): + (WebCore::validationMessageRangeUnderflowText): + (WebCore::validationMessageRangeOverflowText): + (WebCore::validationMessageStepMismatchText): + +2009-11-18 Daniel Bates <dbates@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=31186 + + Changes associated with renaming RenderTextControl::isUserEdited. + + * DOMHTMLClasses.cpp: + (DOMHTMLInputElement::isUserEdited): Formerly named isUserEdited. + (DOMHTMLTextAreaElement::isUserEdited): Ditto. + +2009-11-12 Jon Honeycutt <jhoneycutt@apple.com> + + Implement DOMHTMLInputElement::replaceCharactersInRange(). + + https://bugs.webkit.org/show_bug.cgi?id=31492 + + Reviewed by Dan Bernstein. + + * DOMHTMLClasses.cpp: + (DOMHTMLInputElement::replaceCharactersInRange): + Get the text of the input field. Replace the given range with the + replacement text, and set this new string as the input element's value. + Select from index to the end of the field. This matches the + implementation in the Obj-C bindings. + +2009-11-12 Jon Honeycutt <jhoneycutt@apple.com> + + DOMHTMLOptionElement is missing some functionality. + + https://bugs.webkit.org/show_bug.cgi?id=31491 + + Reviewed by Dan Bernstein. + + * DOMHTMLClasses.cpp: + (DOMHTMLOptionElement::text): + Cast m_element to an HTMLOptionElement, and call its text() function. + (DOMHTMLOptionElement::label): + Ditto, for label(). + +2009-11-12 Jon Honeycutt <jhoneycutt@apple.com> + + DOMHTMLSelectElement is missing some implementation. + + https://bugs.webkit.org/show_bug.cgi?id=31489 + + Reviewed by Dan Bernstein. + + * DOMHTMLClasses.cpp: + (DOMHTMLSelectElement::options): + Cast m_element to an HTMLSelectElement. If it has no options, return + E_FAIL. Otherwise, create a DOMHTMLOptionsCollection to wrap the + options, and return it. + (DOMHTMLSelectElement::activateItemAtIndex): + If the index is out of bounds, return E_FAIL. Otherwise, select the + item. + +2009-11-12 Jon Honeycutt <jhoneycutt@apple.com> + + DOMHTMLOptionsCollection is missing some implementation. + + https://bugs.webkit.org/show_bug.cgi?id=31488 + + Reviewed by Dan Bernstein. + + * DOMHTMLClasses.cpp: + (DOMHTMLOptionsCollection::DOMHTMLOptionsCollection): + Initialize m_collection. + (DOMHTMLOptionsCollection::createInstance): + Create a DOMHTMLOptionsCollection. If we fail to query for + IDOMHTMLOptionsCollection, delete it, and return 0. Otherwise, return + the result. + (DOMHTMLOptionsCollection::length): + (DOMHTMLOptionsCollection::item): + Create a DOMNode for the WebCore Node. If this is 0, return E_FAIL. + (DOMHTMLOptionsCollection::namedItem): + Correct the signature of this function. + + * DOMHTMLClasses.h: + Declare DOMHTMLOptionsCollection::createInstance(). Correct the + signature of namedItem() to match IDOMHTMLOptionsCollection. Add a + member to DOMHTMLOptionsCollection to hold the WebCore object. + +2009-11-12 Jon Honeycutt <jhoneycutt@apple.com> + + DOMHTMLInputElement::rectOnScreen() returns the wrong rect + + https://bugs.webkit.org/show_bug.cgi?id=31487 + + Reviewed by Darin Adler. + + * DOMHTMLClasses.cpp: + (DOMHTMLInputElement::rectOnScreen): + Return the rect on screen, not the rect in the window. + +2009-11-17 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by NOBODY - Build Fix. + + Correct build error in Debug_Cairo target after @49705. + + * WebKit.vcproj/WebKit.vcproj: Revise JavaScriptCore.lib + dependency to have proper "_debug" suffix needed by + the Debug_Cairo target. + +2009-11-17 Brian Weinstein <bweinstein@apple.com> + + Reviewed by NOBODY - Build Fix. + + Touch files to try to fix the build. + + * Interfaces/IWebInspector.idl: + * Interfaces/WebKit.idl: + * WebKit.vcproj/Interfaces.vcproj: + +2009-11-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Make DRT show web inspector for tests in inspector/ folder. + - Updated DRT to show/close inspector for all tests under /inspector + - Introduced LayoutTestController::setTimelineProfilingEnabled and + WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled + - Removed reload on each inspector test + - Renamed fast/inspector to fast/inspector-support in order not to trigger + inspector for those. + - Reimplemented timeline tests in order to get rid of reload there. + - Moved tests that don't require harness into the fast group. + + https://bugs.webkit.org/show_bug.cgi?id=31472 + + * Interfaces/IWebInspector.idl: + * WebInspector.cpp: + (WebInspector::isTimelineProfilingEnabled): + (WebInspector::setTimelineProfilingEnabled): + * WebInspector.h: + +2009-11-13 Adam Roben <aroben@apple.com> + + Build fix + + * Interfaces/WebKit.idl: Touch this to force interfaces to rebuild. + +2009-11-13 Adam Roben <aroben@apple.com> + + Tell the WebFrameLoadDelegate when window objects in isolated worlds + are cleared + + Fixes <http://webkit.org/b/31124>. + + Reviewed by Dave Hyatt. + + * Interfaces/IWebFrameLoadDelegatePrivate2.idl: Added + didClearWindowObjectForFrameInScriptWorld. + + * WebFrame.cpp: + (WebFrame::dispatchDidClearWindowObjectInWorld): + * WebFrame.h: + Replaced windowObjectCleared with this function. If the delegate + implements IWebFrameLoadDelegatePrivate2, call + didClearWindowObjectForFrameInScriptWorld. Otherwise, if the passed-in + world is the mainThreadNormalWorld(), call + didClearWindowObjectForFrame. + + * WebScriptWorld.cpp: + (allWorlds): Added. Returns a HashMap of all the WebScriptWorlds in + existence. + (WebScriptWorld::WebScriptWorld): Add ourselves to allWorlds(). + (WebScriptWorld::~WebScriptWorld): Remove ourselves from allWorlds(). + (WebScriptWorld::standardWorld): Added this non-COM getter for the + standard world, which the COM getter now calls through to. + (WebScriptWorld::findOrCreateWorld): Added. Returns the existing + WebScriptWorld for this DOMWrapperWorld, or a new one if one doesn't + already exist. + + * WebScriptWorld.h: Added new standardWorld overload, made one + overload of createInstance private, and added findOrCreateWorld. + +2009-11-13 Adam Roben <aroben@apple.com> + + Build fix + + * Interfaces/WebKit.idl: Un-sort the #includes again. Apparently they + are order-dependent! + +2009-11-13 Adam Roben <aroben@apple.com> + + Touch WebKit.idl to fix the Windows build + + * Interfaces/WebKit.idl: Sorted #includes. + +2009-11-13 Adam Roben <aroben@apple.com> + + Finish replacing worldIDs with world objects + + The only remaining use of worldIDs was in a method only used by DRT + for the isolated worlds tests. + + Fixes <http://webkit.org/b/31414> Replace worldIDs with world objects + + Reviewed by Mark Rowe. + + * Interfaces/IWebFramePrivate.idl: + * WebFrame.cpp: + (WebFrame::stringByEvaluatingJavaScriptInScriptWorld): + * WebFrame.h: + Renamed from stringByEvaluatingJavaScriptInIsolatedWorld. Now takes an + IWebScriptWorld instead of a worldID, so we don't need to maintain a + map of worldID -> world anymore. + +2009-11-12 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + externalRepresentation should take Frame as the argument + https://bugs.webkit.org/show_bug.cgi?id=31393 + + No new tests as this is just a refactoring. + + * WebFrame.cpp: + (WebFrame::renderTreeAsExternalRepresentation): + +2009-11-12 Adam Roben <aroben@apple.com> + + Replace worldIDs with world objects + + WebScriptWorld is the new object that represents a world. The only + place worldID is still used is in + IWebFramePrivate::stringByEvaluatingJavaScriptInIsolatedWorld, but + that will change soon. + + Part of <http://webkit.org/b/31414> Implement new SPI for dealing with + user scripts/stylesheets and isolated worlds + + Reviewed by Sam Weinig. + + * ForEachCoClass.h: Added WebScriptWorld. + + * Interfaces/IWebFramePrivate.idl: Replaced contextForWorldID with + contextForWorld. + + * Interfaces/IWebScriptWorld.idl: Added. + + * Interfaces/IWebViewPrivate.idl: Changed the user script/stylesheet + functions to take an IWebScriptWorld instead of a worldID. + + * Interfaces/WebKit.idl: Added WebScriptWorld. + + * WebFrame.cpp: + (WebFrame::contextForWorld): Renamed from contextForWorldID. Now takes + an IWebScriptWorld. + (WebFrame::stringByEvaluatingJavaScriptInIsolatedWorld): Moved the + bizarre world caching/creation logic that DRT depends on here from the + findWorld function in ScriptController.cpp. Updated to use + ScriptController::executeScriptInWorld instead of + ScriptController::executeScriptInIsolatedWorld. + + * WebFrame.h: Replaced contextForWorldID with contextForWorld. + + * WebScriptWorld.cpp: Added. + (WebScriptWorld::WebScriptWorld): + (WebScriptWorld::~WebScriptWorld): + (WebScriptWorld::createInstance): + (WebScriptWorld::AddRef): + (WebScriptWorld::Release): + (WebScriptWorld::QueryInterface): + Standard COM class implementations. + + (WebScriptWorld::standardWorld): Returns a shared instance that represents + WebCore's mainThreadNormalWorld(). + + * WebScriptWorld.h: Added. + (WebScriptWorld::world): Simple getter. + + * WebKit.vcproj/Interfaces.vcproj: Added IWebScriptWorld.idl. + + * WebKit.vcproj/WebKit.vcproj: Added WebScriptWorld. + + * WebKitClassFactory.cpp: Added WebScriptWorld. + + * WebView.cpp: + (WebView::addUserScriptToGroup): + (WebView::addUserStyleSheetToGroup): + (WebView::removeUserScriptFromGroup): + (WebView::removeUserStyleSheetFromGroup): + (WebView::removeUserScriptsFromGroup): + (WebView::removeUserStyleSheetsFromGroup): + * WebView.h: + Changed these functions to take an IWebScriptWorld instead of a worldID. + +2009-11-12 Adam Roben <aroben@apple.com> + + Small clean-up in WebView's user content functions + + Preparation for <http://webkit.org/b/31414> Implement new SPI for + dealing with user scripts/stylesheets and isolated worlds + + Reviewed by Dave Hyatt. + + * WebView.cpp: + (toString): + (toKURL): + Added these helper functions to convert BSTRs to WebCore types. + + (toStringVector): + (WebView::addUserScriptToGroup): + (WebView::addUserStyleSheetToGroup): + (WebView::removeUserScriptFromGroup): + (WebView::removeUserStyleSheetFromGroup): + (WebView::removeUserScriptsFromGroup): + (WebView::removeUserStyleSheetsFromGroup): + (WebView::removeAllUserContentFromGroup): + Use the new helper functions. + +2009-11-11 Beth Dakin <bdakin@apple.com> + + Build fix. No review needed. + + * WebKitGraphics.cpp: + (WebDrawText): + +2009-11-10 Daniel Bates <dbates@webkit.org> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=30754 + + Modified WebDropSource::QueryContinueDrag so as to not call EventHandler::dragSourceMovedTo. + + * WebDropSource.cpp: + (WebDropSource::QueryContinueDrag): Removed call to EventHandler::dragSourceMovedTo. + +2009-11-10 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=31312 + Decouple authentication panel callbacks from ResourceHandle + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): + * WebURLAuthenticationChallenge.cpp: + (WebURLAuthenticationChallenge::initWithAuthenticationChallenge): + (WebURLAuthenticationChallenge::sender): + * WebURLAuthenticationChallengeSender.cpp: + (WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender): + (WebURLAuthenticationChallengeSender::createInstance): + (WebURLAuthenticationChallengeSender::authenticationClient): + * WebURLAuthenticationChallengeSender.h: + * WebURLAuthenticationChallengeSenderCFNet.cpp: + (WebURLAuthenticationChallengeSender::cancelAuthenticationChallenge): + (WebURLAuthenticationChallengeSender::continueWithoutCredentialForAuthenticationChallenge): + (WebURLAuthenticationChallengeSender::useCredential): + Adjusted for WebCore changes. + +2009-11-10 Brian Weinstein <bweinstein@apple.com> + + Reviewed by NOBODY - Build Fix. + + Updated fillRoundedRect to take a ColorSpace argument. + + * WebCoreSupport/WebDragClient.cpp: + (WebDragClient::createDragImageForLink): + +2009-11-08 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Holger Freyther. + + ResourceRequest to be class instead of struct + https://bugs.webkit.org/show_bug.cgi?id=30670 + + Started as a compilation fix for Symbian where the compiler makes a distinction between + class and struct in function argument signatures. + Changed forward declaration of ResourceRequest to have class in the forward + declaration instead of struct. + + * WebDownload.h: + +2009-11-05 Adam Roben <aroben@apple.com> + + Make CFDictionaryPropertyBag::createInstance return a COMPtr + + I also cleaned up CFDictionaryPropertyBag's class declaration a little + while I was at it. + + Part of <http://webkit.org/b/25294> <rdar://problem/6803127> All + WebKit/win classes should return COMPtrs from their static constructor + members + + Reviewed by Steve Falkenburg. + + * CFDictionaryPropertyBag.cpp: + (CFDictionaryPropertyBag::CFDictionaryPropertyBag): Changed to + initialize m_refCount to 0. m_refCount gets increased to 1 by + createInstance. + (CFDictionaryPropertyBag::createInstance): Changed to return a COMPtr. + + * CFDictionaryPropertyBag.h: + - Updated copyright years + - Fixed header guard to match current style + - Replaced #include of CoreFoundation.h with forward-declaration of + CFMutableDictionaryRef + - Added #include of COMPtr.h + - Fixed opening brace placement in class declaration + - Made createInstance return a COMPtr + - Made constructor/destructor private + - Made QueryInterface and IPropertyBag functions private + - Removed unnecessary parameter names and MIDL comments + + * WebCache.cpp: + (WebCache::statistics): Updated for change to + CFDictionaryPropertyBag::createInstance. Now uses releaseRef to place + the IPropertyBag pointers into the s array. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::dispatchDidFailToStartPlugin): + * WebDatabaseManager.cpp: + (WebDatabaseManager::dispatchDidModifyDatabase): + * WebFrame.cpp: + (WebFrame::createJavaAppletWidget): + Updated for change to CFDictionaryPropertyBag::createInstance. + + * WebHistory.cpp: Removed releaseUserInfo, which is no longer needed. + That function was also doing an unnecessary call to setDictionary(0). + (createUserInfoFromArray): + (createUserInfoFromHistoryItem): + Changed to return COMPtr. + + (WebHistory::loadFromURL): Updated for change to + CFDictionaryPropertyBag::createInstance. + + (WebHistory::removeAllItems): Updated for change to + CFDictionaryPropertyBag::createInstance, which fixed a leak! We had + forgotten to call releaseUserInfo here. + + (WebHistory::removeItem): + (WebHistory::addItem): + (WebHistory::visitedURL): + * WebIconDatabase.cpp: + (postDidAddIconNotification): + Updated for change to CFDictionaryPropertyBag::createInstance. + + * WebKitClassFactory.cpp: + (releaseRefFromCreateInstance): Added this overloaded function + template to abstract away the difference between createInstance + functions that return a ref'd pointer and createInstance functions + that return a COMPtr. + (WebKitClassFactory::CreateInstance): Changed to use + releaseRefFromCreateInstance. + +2009-11-03 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Steve Falkenburg. + + WebActionModifierFlagsKey should return an unsigned, because + flags imply a bitmask, and that is what other classes expect from + it. + + * WebActionPropertyBag.cpp: + (WebActionPropertyBag::Read): + +2009-11-02 Eric Carlson <eric.carlson@apple.com> + + Reviewed by John Sullivan and Mark Rowe. + + <rdar://problem/7356733> Voiceover does not read correct media controller time values + + * WebCoreLocalizedStrings.cpp: + (WebCore::localizedMediaTimeDescription): + +2009-10-29 Jon Honeycutt <jhoneycutt@apple.com> + + MSAA: Accessibility of headings is not correct + + https://bugs.webkit.org/show_bug.cgi?id=30937 + + Reviewed by Alice Liu. + + * AccessibleBase.cpp: + (AccessibleBase::get_accDescription): + Call the object's descriptionForMSAA(). Moved the comment to the + WebCore file. + (AccessibleBase::get_accRole): + If the object has a string role, return that. Otherwise, return the + integer role. + + * AccessibleBase.h: + Removed description(), as this was moved to WebCore. + +2009-10-29 Jon Honeycutt <jhoneycutt@apple.com> + + MSAA: Accessibility of links is wrong + + https://bugs.webkit.org/show_bug.cgi?id=30928 + + Reviewed by Darin Adler. + + * AccessibleBase.cpp: + (AccessibleBase::get_accState): + Check whether the element is linked, instead of whether the node is an + anchor, so the child "linkable" elements of anchor elements will also + be "linked". + (AccessibleBase::name): + Return the name for MSAA. + (AccessibleBase::value): + Return the string value for MSAA. + +2009-10-30 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + Notify the chrome when the focused node has changed. + https://bugs.webkit.org/show_bug.cgi?id=30832 + + Added stub implementation for new ChromeClient function. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::focusedNodeChanged): + * WebCoreSupport/WebChromeClient.h: + +2009-10-30 Roland Steiner <rolandsteiner@chromium.org> + + Reviewed by Eric Seidel. + + Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak. + + Bug 28420 - Implement HTML5 <ruby> rendering + (https://bugs.webkit.org/show_bug.cgi?id=28420) + + No new tests (no functional change). + + * WebKit.vcproj/WebKit.vcproj: + +2009-10-29 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Dan Bernstein. + + <http://webkit.org/b/30938> REGRESSION(r50233): Windows nightlies crash on launch due to changes + to IWebFramePrivate vtable ordering + + * Interfaces/IWebFramePrivate.idl: Move the newly-added method to the end of the interface so that + it doesn't affect the ordering of the vtable. + 2009-10-28 Steve Falkenburg <sfalken@apple.com> Reviewed by Sam "Horatio" Weinig. diff --git a/WebKit/win/DOMCoreClasses.cpp b/WebKit/win/DOMCoreClasses.cpp index f4018c6..8ea7c84 100644 --- a/WebKit/win/DOMCoreClasses.cpp +++ b/WebKit/win/DOMCoreClasses.cpp @@ -150,10 +150,16 @@ HRESULT STDMETHODCALLTYPE DOMNode::parentNode( } HRESULT STDMETHODCALLTYPE DOMNode::childNodes( - /* [retval][out] */ IDOMNodeList** /*result*/) + /* [retval][out] */ IDOMNodeList** result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!m_node) + return E_FAIL; + + if (!result) + return E_POINTER; + + *result = DOMNodeList::createInstance(m_node->childNodes().get()); + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMNode::firstChild( @@ -828,10 +834,16 @@ HRESULT STDMETHODCALLTYPE DOMElement::lineBoxRects( // IDOMElement ---------------------------------------------------------------- HRESULT STDMETHODCALLTYPE DOMElement::tagName( - /* [retval][out] */ BSTR* /*result*/) + /* [retval][out] */ BSTR* result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!m_element) + return E_FAIL; + + if (!result) + return E_POINTER; + + *result = BString(m_element->tagName()).release(); + return S_OK; } HRESULT STDMETHODCALLTYPE DOMElement::getAttribute( diff --git a/WebKit/win/DOMHTMLClasses.cpp b/WebKit/win/DOMHTMLClasses.cpp index 9ce6004..4889ba9 100644 --- a/WebKit/win/DOMHTMLClasses.cpp +++ b/WebKit/win/DOMHTMLClasses.cpp @@ -39,6 +39,7 @@ #include <WebCore/HTMLInputElement.h> #include <WebCore/HTMLNames.h> #include <WebCore/HTMLOptionElement.h> +#include <WebCore/HTMLOptionsCollection.h> #include <WebCore/HTMLSelectElement.h> #include <WebCore/HTMLTextAreaElement.h> #include <WebCore/IntRect.h> @@ -134,11 +135,34 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::QueryInterface(REFIID riid, // DOMHTMLOptionsCollection --------------------------------------------------- +DOMHTMLOptionsCollection::DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection* collection) + : m_collection(collection) +{ +} + +IDOMHTMLOptionsCollection* DOMHTMLOptionsCollection::createInstance(WebCore::HTMLOptionsCollection* collection) +{ + if (!collection) + return 0; + + IDOMHTMLOptionsCollection* optionsCollection = 0; + DOMHTMLOptionsCollection* newCollection = new DOMHTMLOptionsCollection(collection); + if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLOptionsCollection, (void**)&optionsCollection))) { + delete newCollection; + return 0; + } + + return optionsCollection; +} + HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::length( - /* [retval][out] */ unsigned int* /*result*/) + /* [retval][out] */ unsigned int* result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!result) + return E_POINTER; + + *result = m_collection->length(); + return S_OK; } HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength( @@ -149,16 +173,20 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength( } HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::item( - /* [in] */ unsigned int /*index*/, - /* [retval][out] */ IDOMNode** /*result*/) + /* [in] */ unsigned int index, + /* [retval][out] */ IDOMNode** result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!result) + return E_POINTER; + + *result = DOMNode::createInstance(m_collection->item(index)); + + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::namedItem( /* [in] */ BSTR /*name*/, - /* [retval][out] */ IDOMNode* /*result*/) + /* [retval][out] */ IDOMNode** /*result*/) { ASSERT_NOT_REACHED(); return E_NOTIMPL; @@ -667,10 +695,22 @@ HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::form( } HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options( - /* [retval][out] */ IDOMHTMLOptionsCollection** /*result*/) + /* [retval][out] */ IDOMHTMLOptionsCollection** result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!result) + return E_POINTER; + + *result = 0; + + ASSERT(m_element); + ASSERT(m_element->hasTagName(selectTag)); + HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element); + + if (!selectElement->options()) + return E_FAIL; + + *result = DOMHTMLOptionsCollection::createInstance(selectElement->options().get()); + return S_OK; } HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::disabled( @@ -761,10 +801,17 @@ HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::remove( // DOMHTMLSelectElement - IFormsAutoFillTransitionSelect ---------------------- HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::activateItemAtIndex( - /* [in] */ int /*index*/) + /* [in] */ int index) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + ASSERT(m_element); + ASSERT(m_element->hasTagName(selectTag)); + HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element); + + if (index >= selectElement->length()) + return E_FAIL; + + selectElement->setSelectedIndex(index); + return S_OK; } // DOMHTMLOptionElement - IUnknown -------------------------------------------- @@ -805,10 +852,19 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDefaultSelected( } HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::text( - /* [retval][out] */ BSTR* /*result*/) + /* [retval][out] */ BSTR* result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!result) + return E_POINTER; + + *result = 0; + + ASSERT(m_element); + ASSERT(m_element->hasTagName(optionTag)); + HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(m_element); + + *result = BString(optionElement->text()).release(); + return S_OK; } HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::index( @@ -833,10 +889,19 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDisabled( } HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::label( - /* [retval][out] */ BSTR* /*result*/) + /* [retval][out] */ BSTR* result) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!result) + return E_POINTER; + + *result = 0; + + ASSERT(m_element); + ASSERT(m_element->hasTagName(optionTag)); + HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(m_element); + + *result = BString(optionElement->label()).release(); + return S_OK; } HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setLabel( @@ -1160,7 +1225,17 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValue( inputElement->setValue(String((UChar*) value, SysStringLen(value))); return S_OK; } - + +HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValueForUser( + /* [in] */ BSTR value) +{ + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element); + inputElement->setValueForUser(String(static_cast<UChar*>(value), SysStringLen(value))); + return S_OK; +} + HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::select( void) { ASSERT(m_element && m_element->hasTagName(inputTag)); @@ -1216,7 +1291,8 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionEnd( HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isTextField( /* [retval][out] */ BOOL* result) { - ASSERT(m_element && m_element->hasTagName(inputTag)); + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element); *result = inputElement->isTextField() ? TRUE : FALSE; return S_OK; @@ -1225,36 +1301,51 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isTextField( HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::rectOnScreen( /* [retval][out] */ LPRECT rect) { + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); rect->left = rect->top = rect->right = rect->bottom = 0; RenderObject* renderer = m_element->renderer(); FrameView* view = m_element->document()->view(); if (!renderer || !view) return E_FAIL; - IntRect coreRect = renderer->absoluteBoundingBoxRect(); - coreRect.setLocation(view->contentsToWindow(coreRect.location())); + IntRect coreRect = view->contentsToScreen(renderer->absoluteBoundingBoxRect()); rect->left = coreRect.x(); rect->top = coreRect.y(); rect->right = coreRect.right(); rect->bottom = coreRect.bottom(); + return S_OK; } HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::replaceCharactersInRange( - /* [in] */ int /*startTarget*/, - /* [in] */ int /*endTarget*/, - /* [in] */ BSTR /*replacementString*/, - /* [in] */ int /*index*/) + /* [in] */ int startTarget, + /* [in] */ int endTarget, + /* [in] */ BSTR replacementString, + /* [in] */ int index) { - ASSERT_NOT_REACHED(); - return E_NOTIMPL; + if (!replacementString) + return E_POINTER; + + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element); + + String newValue = inputElement->value(); + String webCoreReplacementString(static_cast<UChar*>(replacementString), SysStringLen(replacementString)); + newValue.replace(startTarget, endTarget - startTarget, webCoreReplacementString); + inputElement->setValue(newValue); + inputElement->setSelectionRange(index, newValue.length()); + + return S_OK; } HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange( /* [out] */ int* start, /* [out] */ int* end) { - ASSERT(m_element && m_element->hasTagName(inputTag)); + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element); *start = inputElement->selectionStart(); *end = inputElement->selectionEnd(); @@ -1264,12 +1355,23 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange( HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAutofilled( /* [in] */ BOOL filled) { - ASSERT(m_element && m_element->hasTagName(inputTag)); + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element); inputElement->setAutofilled(!!filled); return S_OK; } +HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isAutofilled( + /* [retval][out] */ BOOL* result) +{ + ASSERT(m_element); + ASSERT(m_element->hasTagName(inputTag)); + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element); + *result = inputElement->isAutofilled() ? TRUE : FALSE; + return S_OK; +} + // DOMHTMLInputElement -- IFormPromptAdditions ------------------------------------ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited( @@ -1284,7 +1386,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited( if (FAILED(isTextField(&textField)) || !textField) return S_OK; RenderObject* renderer = m_element->renderer(); - if (renderer && toRenderTextControl(renderer)->isUserEdited()) + if (renderer && toRenderTextControl(renderer)->lastChangeWasUserEdit()) *result = TRUE; return S_OK; } @@ -1481,7 +1583,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited( *result = FALSE; ASSERT(m_element); RenderObject* renderer = m_element->renderer(); - if (renderer && toRenderTextControl(renderer)->isUserEdited()) + if (renderer && toRenderTextControl(renderer)->lastChangeWasUserEdit()) *result = TRUE; return S_OK; } diff --git a/WebKit/win/DOMHTMLClasses.h b/WebKit/win/DOMHTMLClasses.h index ddc3dd1..f520c3c 100644 --- a/WebKit/win/DOMHTMLClasses.h +++ b/WebKit/win/DOMHTMLClasses.h @@ -34,6 +34,7 @@ namespace WebCore { class HTMLCollection; + class HTMLOptionsCollection; } class DOMHTMLCollection : public DOMObject, public IDOMHTMLCollection @@ -99,6 +100,9 @@ protected: class DOMHTMLOptionsCollection : public DOMObject, public IDOMHTMLOptionsCollection { +public: + static IDOMHTMLOptionsCollection* createInstance(WebCore::HTMLOptionsCollection*); + // IUnknown virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); } @@ -149,7 +153,12 @@ class DOMHTMLOptionsCollection : public DOMObject, public IDOMHTMLOptionsCollect virtual HRESULT STDMETHODCALLTYPE namedItem( /* [in] */ BSTR name, - /* [retval][out] */ IDOMNode *result); + /* [retval][out] */ IDOMNode **result); + +private: + DOMHTMLOptionsCollection(WebCore::HTMLOptionsCollection*); + + RefPtr<WebCore::HTMLOptionsCollection> m_collection; }; class DOMHTMLDocument : public DOMDocument, public IDOMHTMLDocument @@ -2011,9 +2020,15 @@ public: virtual HRESULT STDMETHODCALLTYPE setAutofilled( /* [in] */ BOOL filled); + virtual HRESULT STDMETHODCALLTYPE isAutofilled( + /* [retval][out] */ BOOL *result); + // IFormPromptAdditions virtual HRESULT STDMETHODCALLTYPE isUserEdited( /* [retval][out] */ BOOL *result); + + virtual HRESULT STDMETHODCALLTYPE setValueForUser( + /* [in] */ BSTR value); }; class DOMHTMLTextAreaElement : public DOMHTMLElement, public IDOMHTMLTextAreaElement, public IFormPromptAdditions diff --git a/WebKit/win/ForEachCoClass.h b/WebKit/win/ForEachCoClass.h index 26f4a6c..39f8e32 100644 --- a/WebKit/win/ForEachCoClass.h +++ b/WebKit/win/ForEachCoClass.h @@ -63,6 +63,7 @@ macro(WebCoreStatistics) \ macro(WebCookieManager) \ macro(WebWorkersPrivate) \ + macro(WebScriptWorld) \ // end of macro // Everything below this point is deprecated. Please do not use. diff --git a/WebKit/win/GEN_DOMObject.cpp b/WebKit/win/GEN_DOMObject.cpp index bb108a4..c8d0e3c 100644 --- a/WebKit/win/GEN_DOMObject.cpp +++ b/WebKit/win/GEN_DOMObject.cpp @@ -26,10 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebKitDLL.h" - +#include "config.h" #include "GEN_DOMObject.h" +#include "WebKitDLL.h" + #include <wtf/Assertions.h> // DOMObject ------------------------------------------------------------ diff --git a/WebKit/win/Interfaces/DOMHTML.idl b/WebKit/win/Interfaces/DOMHTML.idl index 6c276aa..7ccb682 100644 --- a/WebKit/win/Interfaces/DOMHTML.idl +++ b/WebKit/win/Interfaces/DOMHTML.idl @@ -800,6 +800,11 @@ interface IDOMHTMLInputElement : IDOMElement // attribute long selectionEnd; HRESULT setSelectionEnd([in] long end); HRESULT selectionEnd([out, retval] long* end); + + /* + - (void)setValueForUser:(NSString *)value; + */ + HRESULT setValueForUser([in] BSTR value); } /* diff --git a/WebKit/win/Interfaces/DOMPrivate.idl b/WebKit/win/Interfaces/DOMPrivate.idl index 7210943..3365565 100644 --- a/WebKit/win/Interfaces/DOMPrivate.idl +++ b/WebKit/win/Interfaces/DOMPrivate.idl @@ -51,9 +51,8 @@ interface IDOMElementPrivate : IUnknown /* All the methods in this category are used by Safari forms autofill and should not be used for any other purpose. - They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become - replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API, - and these will be deleted. + Each one should eventually be replaced by public DOM API, and when that happens Safari will switch to implementations + using that public API, and these will be deleted. @interface DOMHTMLInputElement(FormsAutoFillTransition) */ @@ -89,6 +88,11 @@ interface IFormsAutoFillTransition : IUnknown - (void)_setAutofilled:(BOOL)filled; */ HRESULT setAutofilled([in] BOOL filled); + + /* + - (BOOL)_isAutofilled; + */ + HRESULT isAutofilled([out, retval] BOOL* result); } /* diff --git a/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl b/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl index 66ac241..9847151 100644 --- a/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl +++ b/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl @@ -29,18 +29,9 @@ import "ocidl.idl"; import "IWebScriptObject.idl"; import "IWebView.idl"; import "IWebFrame.idl"; +import "JavaScriptCoreAPITypes.idl"; #endif -cpp_quote("// this is done to get midl to treat the JavaScriptCore API types as pointer types") -cpp_quote("#if 0") -typedef void* JSContextRef; -typedef void* JSObjectRef; -cpp_quote("#else") -cpp_quote("typedef struct OpaqueJSValue* JSObjectRef;") -cpp_quote("typedef const struct OpaqueJSContext* JSContextRef;") -cpp_quote("#endif") - - interface IWebError; interface IWebFrame; interface IWebScriptObject; diff --git a/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl index d646528..7e07c55 100644 --- a/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl +++ b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl @@ -31,8 +31,9 @@ import "IWebView.idl"; #endif interface IWebFrame; -interface IWebView; +interface IWebScriptWorld; interface IWebSecurityOrigin; +interface IWebView; [ object, @@ -45,4 +46,10 @@ interface IWebFrameLoadDelegatePrivate2 : IWebFrameLoadDelegatePrivate HRESULT didDisplayInsecureContent([in] IWebView* sender); HRESULT didRunInsecureContent([in] IWebView* sender, [in] IWebSecurityOrigin* origin); + + HRESULT didClearWindowObjectForFrameInScriptWorld([in] IWebView* webView, [in] IWebFrame* frame, [in] IWebScriptWorld*); + + HRESULT didPushStateWithinPageForFrame([in] IWebView* webView, [in] IWebFrame* frame); + HRESULT didReplaceStateWithinPageForFrame([in] IWebView* webView, [in] IWebFrame* frame); + HRESULT didPopStateWithinPageForFrame([in] IWebView* webView, [in] IWebFrame* frame); } diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl index d56239b..3ba71c8 100755 --- a/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -32,6 +32,7 @@ import "IWebFrame.idl"; interface IWebFrame; interface IWebIconFetcher; interface IWebIconFetcherDelegate; +interface IWebScriptWorld; typedef enum { WebFrameLoadTypeStandard, @@ -57,7 +58,6 @@ typedef enum { interface IWebFramePrivate : IUnknown { HRESULT renderTreeAsExternalRepresentation([out, retval] BSTR* result); - HRESULT counterValueForElementById([in] BSTR id, [out, retval] BSTR* result); HRESULT scrollOffset([out, retval] SIZE* offset); // FIXME: This shouldn't be needed once IWebDocumentView is implemented. @@ -89,13 +89,16 @@ interface IWebFramePrivate : IUnknown HRESULT pauseAnimation([in] BSTR animationName, [in] IDOMNode* node, [in] double secondsFromNow, [out, retval] BOOL* animationWasRunning); HRESULT pauseTransition([in] BSTR propertyName, [in] IDOMNode* node, [in] double secondsFromNow, [out, retval] BOOL* transitionWasRunning); + HRESULT pauseSVGAnimation([in] BSTR elementId, [in] IDOMNode* node, [in] double secondsFromNow, [out, retval] BOOL* animationWasRunning); HRESULT numberOfActiveAnimations([out, retval] UINT* number); HRESULT isDisplayingStandaloneImage([out, retval] BOOL* result); HRESULT allowsFollowingLink([in] BSTR url, [out, retval] BOOL* result); - HRESULT stringByEvaluatingJavaScriptInIsolatedWorld([in] unsigned worldID, [in] OLE_HANDLE jsGlobalObject, [in] BSTR script, [out, retval] BSTR* result); + [local] HRESULT stringByEvaluatingJavaScriptInScriptWorld([in] IWebScriptWorld*, [in] JSObjectRef globalObject, [in] BSTR script, [out, retval] BSTR* result); + + [local] JSGlobalContextRef globalContextForScriptWorld([in] IWebScriptWorld*); - [local] JSGlobalContextRef contextForWorldID([in] unsigned worldID); + HRESULT counterValueForElementById([in] BSTR id, [out, retval] BSTR* result); } diff --git a/WebKit/win/Interfaces/IWebInspector.idl b/WebKit/win/Interfaces/IWebInspector.idl index e31376c..4523205 100644 --- a/WebKit/win/Interfaces/IWebInspector.idl +++ b/WebKit/win/Interfaces/IWebInspector.idl @@ -54,4 +54,7 @@ interface IWebInspector : IUnknown HRESULT isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled); HRESULT setJavaScriptProfilingEnabled(BOOL enabled); + + HRESULT isTimelineProfilingEnabled(BOOL* isEnabled); + HRESULT setTimelineProfilingEnabled(BOOL enabled); } diff --git a/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl b/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl index f79e304..e113da8 100644 --- a/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl +++ b/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl @@ -39,5 +39,5 @@ interface IWebView; ] interface IWebPluginHalterDelegate : IUnknown { - HRESULT shouldHaltPlugin([in] IWebView* webView, [in] IDOMNode*, [out, retval] BOOL* result); + HRESULT shouldHaltPlugin([in] IWebView* webView, [in] IDOMNode*, [in] BOOL isWindowed, [in] BSTR pluginName, [out, retval] BOOL* result); } diff --git a/WebKit/win/Interfaces/IWebScriptWorld.idl b/WebKit/win/Interfaces/IWebScriptWorld.idl new file mode 100644 index 0000000..255255c --- /dev/null +++ b/WebKit/win/Interfaces/IWebScriptWorld.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 Apple 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 INC. 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 INC. 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 DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +#endif + +[ + object, + oleautomation, + uuid(EBD45575-8184-4f22-B849-A5FE88336055), + pointer_default(unique) +] +interface IWebScriptWorld : IUnknown { + HRESULT standardWorld([out, retval] IWebScriptWorld**); +} diff --git a/WebKit/win/Interfaces/IWebSerializedJSValue.idl b/WebKit/win/Interfaces/IWebSerializedJSValue.idl new file mode 100644 index 0000000..eddef62 --- /dev/null +++ b/WebKit/win/Interfaces/IWebSerializedJSValue.idl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2009 Apple 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 INC. 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 INC. 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 DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +import "JavaScriptCoreAPITypes.idl"; +#endif + +[ + object, + oleautomation, + uuid(13B3F50A-C996-61A7-2247-3DCC88FB0B84), + pointer_default(unique) +] +interface IWebSerializedJSValue : IUnknown { + [local] HRESULT serialize([in] JSContextRef context, [in] JSValueRef value, [out, retval] JSValueRef* exception); + [local] HRESULT deserialize([in] JSContextRef context, [out, retval] JSValueRef* value); +} diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl index d95f92b..1c8cea2 100644 --- a/WebKit/win/Interfaces/IWebViewPrivate.idl +++ b/WebKit/win/Interfaces/IWebViewPrivate.idl @@ -184,18 +184,17 @@ interface IWebViewPrivate : IUnknown */ HRESULT MIMETypeForExtension([in] BSTR extension, [out, retval] BSTR* mimeType); - // For the following functions, 0 < worldID < UINT_MAX. - HRESULT addUserScriptToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url, + HRESULT addUserScriptToGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR source, [in] BSTR url, [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist, [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist, [in] WebUserScriptInjectionTime injectionTime); - HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url, + HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR source, [in] BSTR url, [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist, [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist); - HRESULT removeUserScriptFromGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR url); - HRESULT removeUserStyleSheetFromGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR url); - HRESULT removeUserScriptsFromGroup([in] BSTR groupName, [in] unsigned worldID); - HRESULT removeUserStyleSheetsFromGroup([in] BSTR groupName, [in] unsigned worldID); + HRESULT removeUserScriptFromGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR url); + HRESULT removeUserStyleSheetFromGroup([in] BSTR groupName, [in] IWebScriptWorld*, [in] BSTR url); + HRESULT removeUserScriptsFromGroup([in] BSTR groupName, [in] IWebScriptWorld*); + HRESULT removeUserStyleSheetsFromGroup([in] BSTR groupName, [in] IWebScriptWorld*); HRESULT removeAllUserContentFromGroup([in] BSTR groupName); HRESULT setPluginHalterDelegate([in] IWebPluginHalterDelegate* d); diff --git a/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl b/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl new file mode 100755 index 0000000..f2ef1f1 --- /dev/null +++ b/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl @@ -0,0 +1,40 @@ +/*
+ * Copyright (C) 2009 Apple 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 INC. 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 INC. 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+cpp_quote("// this is done to get midl to treat the JavaScriptCore API types as pointer types")
+cpp_quote("#if 0")
+typedef void* JSContextRef;
+typedef void* JSObjectRef;
+typedef void* JSValueRef;
+cpp_quote("#else")
+cpp_quote("typedef const struct OpaqueJSValue* JSValueRef;")
+cpp_quote("typedef struct OpaqueJSValue* JSObjectRef;")
+cpp_quote("typedef const struct OpaqueJSContext* JSContextRef;")
+cpp_quote("#endif")
+
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl index cdd24b3..7b308db 100644 --- a/WebKit/win/Interfaces/WebKit.idl +++ b/WebKit/win/Interfaces/WebKit.idl @@ -24,7 +24,7 @@ */ cpp_quote("/*") -cpp_quote(" * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.") +cpp_quote(" * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.") cpp_quote(" *") cpp_quote(" * Redistribution and use in source and binary forms, with or without") cpp_quote(" * modification, are permitted provided that the following conditions") @@ -56,6 +56,7 @@ import "oaidl.idl"; import "ocidl.idl"; #include "WebScrollbarTypes.idl" +#include "JavaScriptCoreAPITypes.idl" #include "IWebScriptObject.idl" #include "DOMCSS.idl" #include "DOMCore.idl" @@ -113,9 +114,11 @@ import "ocidl.idl"; #include "IWebResource.idl" #include "IWebResourceLoadDelegate.idl" #include "IWebResourceLoadDelegatePrivate.idl" +#include "IWebScriptWorld.idl" #include "IWebScrollBarDelegatePrivate.idl" #include "IWebScrollBarPrivate.idl" #include "IWebSecurityOrigin.idl" +#include "IWebSerializedJSValue.idl" #include "IWebTextRenderer.idl" #include "IWebUIDelegate.idl" #include "IWebUIDelegate2.idl" @@ -271,4 +274,14 @@ library WebKit coclass WebWorkersPrivate{ [default] interface IWebWorkersPrivate; } + + [uuid(D3C301EE-D59A-49c0-A43A-9EA01CDB1590)] + coclass WebScriptWorld { + [default] interface IWebScriptWorld; + } + + [uuid(13C45703-A3B3-8797-276B-75632F6165C3)] + coclass WebSerializedJSValue { + [default] interface IWebSerializedJSValue; + } } diff --git a/WebKit/win/WebActionPropertyBag.cpp b/WebKit/win/WebActionPropertyBag.cpp index 31252a5..c2b9e10 100644 --- a/WebKit/win/WebActionPropertyBag.cpp +++ b/WebKit/win/WebActionPropertyBag.cpp @@ -142,7 +142,7 @@ HRESULT STDMETHODCALLTYPE WebActionPropertyBag::Read(LPCOLESTR pszPropName, VARI } if (isEqual(pszPropName, WebActionModifierFlagsKey)) { if (const UIEventWithKeyState* keyEvent = findEventWithKeyState(const_cast<Event*>(m_action.event()))) { - int modifiers = 0; + unsigned modifiers = 0; if (keyEvent->ctrlKey()) modifiers |= MK_CONTROL; @@ -151,8 +151,8 @@ HRESULT STDMETHODCALLTYPE WebActionPropertyBag::Read(LPCOLESTR pszPropName, VARI if (keyEvent->altKey()) modifiers |= MK_ALT; - V_VT(pVar) = VT_I4; - V_I4(pVar) = modifiers; + V_VT(pVar) = VT_UI4; + V_UI4(pVar) = modifiers; return S_OK; } } diff --git a/WebKit/win/WebCache.cpp b/WebKit/win/WebCache.cpp index c7351b0..d82fc43 100644 --- a/WebKit/win/WebCache.cpp +++ b/WebKit/win/WebCache.cpp @@ -129,9 +129,9 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics( value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.count)); CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get()); - CFDictionaryPropertyBag* propBag = CFDictionaryPropertyBag::createInstance(); + COMPtr<CFDictionaryPropertyBag> propBag = CFDictionaryPropertyBag::createInstance(); propBag->setDictionary(dictionary.get()); - s[0] = propBag; + s[0] = propBag.releaseRef(); dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); @@ -153,7 +153,7 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics( propBag = CFDictionaryPropertyBag::createInstance(); propBag->setDictionary(dictionary.get()); - s[1] = propBag; + s[1] = propBag.releaseRef(); dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); @@ -175,7 +175,7 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics( propBag = CFDictionaryPropertyBag::createInstance(); propBag->setDictionary(dictionary.get()); - s[2] = propBag; + s[2] = propBag.releaseRef(); dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); @@ -197,7 +197,7 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics( propBag = CFDictionaryPropertyBag::createInstance(); propBag->setDictionary(dictionary.get()); - s[3] = propBag; + s[3] = propBag.releaseRef(); return S_OK; } diff --git a/WebKit/win/WebCoreLocalizedStrings.cpp b/WebKit/win/WebCoreLocalizedStrings.cpp index 03d03e7..9ee22db 100644 --- a/WebKit/win/WebCoreLocalizedStrings.cpp +++ b/WebKit/win/WebCoreLocalizedStrings.cpp @@ -151,6 +151,10 @@ String WebCore::localizedMediaControlElementString(const String& name) return String(LPCTSTR_UI_STRING("fast forward", "accessibility role description for fast forward button")); if (name == "SeekBackButton") return String(LPCTSTR_UI_STRING("fast reverse", "accessibility role description for fast reverse button")); + if (name == "ShowClosedCaptionsButton") + return String(LPCTSTR_UI_STRING("show closed captions", "accessibility role description for show closed captions button")); + if (name == "HideClosedCaptionsButton") + return String(LPCTSTR_UI_STRING("hide closed captions", "accessibility role description for hide closed captions button")); ASSERT_NOT_REACHED(); return String(); @@ -190,6 +194,10 @@ String WebCore::localizedMediaControlElementHelpText(const String& name) return String(LPCTSTR_UI_STRING("seek quickly forward", "accessibility help text for fast forward button")); if (name == "FullscreenButton") return String(LPCTSTR_UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button")); + if (name == "ShowClosedCaptionsButton") + return String(LPCTSTR_UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button")); + if (name == "HideClosedCaptionsButton") + return String(LPCTSTR_UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button")); ASSERT_NOT_REACHED(); return String(); @@ -198,7 +206,7 @@ String WebCore::localizedMediaControlElementHelpText(const String& name) String WebCore::localizedMediaTimeDescription(float time) { if (!isfinite(time)) - return String(LPCTSTR_UI_STRING("indefinite time", "string for an indefinite movie time")); + return String(LPCTSTR_UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value")); int seconds = (int)fabsf(time); int days = seconds / (60 * 60 * 24); @@ -207,27 +215,34 @@ String WebCore::localizedMediaTimeDescription(float time) seconds %= 60; if (days) { - static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds")); + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day")); RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), days, hours, minutes, seconds)); return result.get(); } if (hours) { - static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.hours", "string for hours, minutes & seconds")); + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes")); RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), hours, minutes, seconds)); return result.get(); } if (minutes) { - static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.minutes", "string for minutes & seconds")); + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds")); RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), minutes, seconds)); return result.get(); } - static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.seconds", "string for seconds")); + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds")); RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), seconds)); return result.get(); } #endif // ENABLE(VIDEO) +String WebCore::validationMessageValueMissingText() { return String(LPCTSTR_UI_STRING("value missing", "Validation message for required form control elements that have no value")); } +String WebCore::validationMessageTypeMismatchText() { return String(LPCTSTR_UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type")); } +String WebCore::validationMessagePatternMismatchText() { return String(LPCTSTR_UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern")); } +String WebCore::validationMessageTooLongText() { return String(LPCTSTR_UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length")); } +String WebCore::validationMessageRangeUnderflowText() { return String(LPCTSTR_UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum")); } +String WebCore::validationMessageRangeOverflowText() { return String(LPCTSTR_UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum")); } +String WebCore::validationMessageStepMismatchText() { return String(LPCTSTR_UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute")); } diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index 0bae1ae..6e82caf 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -156,6 +156,10 @@ void WebChromeClient::takeFocus(FocusDirection direction) } } +void WebChromeClient::focusedNodeChanged(Node*) +{ +} + static COMPtr<IPropertyBag> createWindowFeaturesPropertyBag(const WindowFeatures& features) { HashMap<String, COMVariant> map; @@ -750,6 +754,19 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame*, Geolocation*) notImplemented(); } +#if USE(ACCELERATED_COMPOSITING) +void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) +{ + m_webView->setRootChildLayer(graphicsLayer ? graphicsLayer->platformLayer() : 0); +} + +void WebChromeClient::scheduleCompositingLayerSync() +{ + m_webView->setRootLayerNeedsDisplay(); +} + +#endif + COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate() { COMPtr<IWebUIDelegate> delegate; diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h index d01e47d..e0c59ae 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -55,6 +55,8 @@ public: virtual bool canTakeFocus(WebCore::FocusDirection); virtual void takeFocus(WebCore::FocusDirection); + virtual void focusedNodeChanged(WebCore::Node*); + virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&); virtual void show(); @@ -130,6 +132,17 @@ public: virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; } +#if USE(ACCELERATED_COMPOSITING) + // Pass 0 as the GraphicsLayer to detatch the root layer. + virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*); + // Sets a flag to specify that the next time content is drawn to the window, + // the changes appear on the screen in synchrony with updates to GraphicsLayers. + virtual void setNeedsOneShotDrawingSynchronization() { } + // Sets a flag to specify that the view needs to be updated, so we need + // to do an eager layout before the drawing. + virtual void scheduleCompositingLayerSync(); +#endif + virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const {} virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp index 8451bd6..773e392 100644 --- a/WebKit/win/WebCoreSupport/WebDragClient.cpp +++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp @@ -295,7 +295,7 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa static const Color backgroundColor(140, 140, 140); static const IntSize radii(DRAG_LABEL_RADIUS, DRAG_LABEL_RADIUS); IntRect rect(0, 0, imageSize.width(), imageSize.height()); - context.fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor); + context.fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor, DeviceColorSpace); // Draw the text static const Color topColor(0, 0, 0, 255); //original alpha = 0.75 diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index cb3aed0..b927c72 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -143,7 +143,7 @@ bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader* loader, un void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge) { #if USE(CFNETWORK) - ASSERT(challenge.sourceHandle()); + ASSERT(challenge.authenticationClient()); WebView* webView = m_webFrame->webView(); COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate; @@ -155,7 +155,7 @@ void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoa // If the ResourceLoadDelegate doesn't exist or fails to handle the call, we tell the ResourceHandle // to continue without credential - this is the best approximation of Mac behavior - challenge.sourceHandle()->receivedRequestToContinueWithoutCredential(challenge); + challenge.authenticationClient()->receivedRequestToContinueWithoutCredential(challenge); #else notImplemented(); #endif @@ -306,6 +306,47 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() frameLoadDelegate->didChangeLocationWithinPageForFrame(webView, m_webFrame); } +void WebFrameLoaderClient::dispatchDidPushStateWithinPage() +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv; + if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv) + return; + + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv); + if (!frameLoadDelegatePriv2) + return; + + frameLoadDelegatePriv2->didPushStateWithinPageForFrame(webView, m_webFrame); +} + +void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage() +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv; + if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv) + return; + + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv); + if (!frameLoadDelegatePriv2) + return; + + frameLoadDelegatePriv2->didReplaceStateWithinPageForFrame(webView, m_webFrame); +} + +void WebFrameLoaderClient::dispatchDidPopStateWithinPage() +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv; + if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv) + return; + + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv); + if (!frameLoadDelegatePriv2) + return; + + frameLoadDelegatePriv2->didPopStateWithinPageForFrame(webView, m_webFrame); +} void WebFrameLoaderClient::dispatchWillClose() { WebView* webView = m_webFrame->webView(); @@ -500,14 +541,11 @@ void WebFrameLoaderClient::updateGlobalHistory() webView->historyDelegate(&historyDelegate); if (historyDelegate) { - BString url(loader->urlForHistory()); - BString title(loader->title()); - BString redirectSource(loader->clientRedirectSourceForHistory()); COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(loader->response())); COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(loader->originalRequestCopy())); COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance( - url, title, urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), redirectSource)); + loader->urlForHistory(), loader->title(), urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory())); historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame); return; @@ -759,7 +797,7 @@ void WebFrameLoaderClient::dispatchDidFailToStartPlugin(const PluginView* plugin } } - COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance()); + COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance(); userInfoBag->setDictionary(userInfo.get()); int errorCode = 0; diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index 21599bc..f1fb5f7 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -65,6 +65,9 @@ public: virtual void dispatchDidCancelClientRedirect(); virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate); virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp index 75a76f2..0dd6e58 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp @@ -233,7 +233,7 @@ void WebInspectorClient::attachWindow() if (m_attached) return; - m_inspectedWebView->page()->inspectorController()->setSetting(inspectorStartsAttachedName, InspectorController::Setting(true)); + m_inspectedWebView->page()->inspectorController()->setSetting(inspectorStartsAttachedName, "true"); closeWindowWithoutNotifications(); showWindowWithoutNotifications(); @@ -244,7 +244,7 @@ void WebInspectorClient::detachWindow() if (!m_attached) return; - m_inspectedWebView->page()->inspectorController()->setSetting(inspectorStartsAttachedName, InspectorController::Setting(false)); + m_inspectedWebView->page()->inspectorController()->setSetting(inspectorStartsAttachedName, "false"); closeWindowWithoutNotifications(); showWindowWithoutNotifications(); @@ -350,8 +350,8 @@ void WebInspectorClient::showWindowWithoutNotifications() ASSERT(m_inspectedWebViewHwnd); // If no preference is set - default to an attached window. This is important for inspector LayoutTests. - InspectorController::Setting shouldAttach = m_inspectedWebView->page()->inspectorController()->setting(inspectorStartsAttachedName); - m_shouldAttachWhenShown = shouldAttach.type() == InspectorController::Setting::BooleanType ? shouldAttach.booleanValue() : true; + String shouldAttach = m_inspectedWebView->page()->inspectorController()->setting(inspectorStartsAttachedName); + m_shouldAttachWhenShown = shouldAttach != "false"; if (!m_shouldAttachWhenShown) { // Put the Inspector's WebView inside our window and show it. diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.h b/WebKit/win/WebCoreSupport/WebInspectorClient.h index 8965e87..3f65b0a 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.h @@ -66,9 +66,8 @@ public: virtual void inspectedURLChanged(const WebCore::String& newURL); - virtual void populateSetting(const WebCore::String& key, WebCore::InspectorController::Setting&); - virtual void storeSetting(const WebCore::String& key, const WebCore::InspectorController::Setting&); - virtual void removeSetting(const WebCore::String& key); + virtual void populateSetting(const WebCore::String& key, WebCore::String* value); + virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); virtual void inspectorWindowObjectCleared(); diff --git a/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp b/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp index 78daf8d..995b05d 100644 --- a/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp +++ b/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp @@ -32,7 +32,7 @@ #include <WebCore/Node.h> #include <wtf/Assertions.h> -using WebCore::Node; +using namespace WebCore; WebPluginHalterClient::WebPluginHalterClient(WebView* webView) : m_webView(webView) @@ -40,7 +40,7 @@ WebPluginHalterClient::WebPluginHalterClient(WebView* webView) ASSERT_ARG(webView, webView); } -bool WebPluginHalterClient::shouldHaltPlugin(WebCore::Node* n) const +bool WebPluginHalterClient::shouldHaltPlugin(Node* n, bool isWindowed, const String& pluginName) const { ASSERT_ARG(n, n); @@ -51,7 +51,7 @@ bool WebPluginHalterClient::shouldHaltPlugin(WebCore::Node* n) const COMPtr<IDOMNode> domNode(AdoptCOM, DOMNode::createInstance(n)); BOOL shouldHalt; - if (FAILED(d->shouldHaltPlugin(m_webView, domNode.get(), &shouldHalt))) + if (FAILED(d->shouldHaltPlugin(m_webView, domNode.get(), isWindowed, BString(pluginName), &shouldHalt))) return false; return shouldHalt; diff --git a/WebKit/win/WebCoreSupport/WebPluginHalterClient.h b/WebKit/win/WebCoreSupport/WebPluginHalterClient.h index 7d05fe9..da3d28a 100644 --- a/WebKit/win/WebCoreSupport/WebPluginHalterClient.h +++ b/WebKit/win/WebCoreSupport/WebPluginHalterClient.h @@ -30,6 +30,7 @@ namespace WebCore { class Node; + class String; } class WebView; @@ -38,7 +39,7 @@ class WebPluginHalterClient : public WebCore::PluginHalterClient { public: WebPluginHalterClient(WebView* webView); - virtual bool shouldHaltPlugin(WebCore::Node* n) const; + virtual bool shouldHaltPlugin(WebCore::Node* n, bool isWindowed, const WebCore::String& pluginName) const; virtual bool enabled() const; private: diff --git a/WebKit/win/WebDatabaseManager.cpp b/WebKit/win/WebDatabaseManager.cpp index a531997..989f33c 100644 --- a/WebKit/win/WebDatabaseManager.cpp +++ b/WebKit/win/WebDatabaseManager.cpp @@ -364,7 +364,7 @@ void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const RetainPtr<CFStringRef> str(AdoptCF, databaseName.createCFString()); CFDictionarySetValue(userInfo.get(), databaseNameKey, str.get()); - COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance()); + COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance(); userInfoBag->setDictionary(userInfo.get()); notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get()); diff --git a/WebKit/win/WebDownload.h b/WebKit/win/WebDownload.h index 58c13e9..71aebfe 100644 --- a/WebKit/win/WebDownload.h +++ b/WebKit/win/WebDownload.h @@ -38,7 +38,7 @@ namespace WebCore { class KURL; class ResourceHandle; - struct ResourceRequest; + class ResourceRequest; class ResourceResponse; } diff --git a/WebKit/win/WebDownloadCFNet.cpp b/WebKit/win/WebDownloadCFNet.cpp index 144a6a5..d1ff23d 100644 --- a/WebKit/win/WebDownloadCFNet.cpp +++ b/WebKit/win/WebDownloadCFNet.cpp @@ -48,6 +48,7 @@ #include <WebCore/AuthenticationCF.h> #include <WebCore/BString.h> #include <WebCore/CredentialStorage.h> +#include <WebCore/LoaderRunLoopCF.h> #include <WebCore/ResourceError.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceRequest.h> @@ -116,7 +117,7 @@ void WebDownload::init(const KURL& url, IWebDownloadDelegate* delegate) m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client)); CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); - CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode); LOG(Download, "WebDownload - Initialized download of url %s in WebDownload %p", url.string().utf8().data(), this); } @@ -154,7 +155,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::initWithRequest( } CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); - CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode); LOG(Download, "WebDownload - initWithRequest complete, started download of url %s", webRequest->resourceRequest().url().string().utf8().data()); return S_OK; @@ -200,7 +201,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle( m_destination = String(); CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); - CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode); LOG(Download, "WebDownload - initWithRequest complete, resumed download of bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data()); return S_OK; diff --git a/WebKit/win/WebDropSource.cpp b/WebKit/win/WebDropSource.cpp index 5c26b37..294c337 100644 --- a/WebKit/win/WebDropSource.cpp +++ b/WebKit/win/WebDropSource.cpp @@ -107,9 +107,7 @@ STDMETHODIMP WebDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyS if (fEscapePressed || !(grfKeyState & (MK_LBUTTON|MK_RBUTTON))) { m_dropped = !fEscapePressed; return fEscapePressed? DRAGDROP_S_CANCEL : DRAGDROP_S_DROP; - } else if (Page* page = m_webView->page()) - if (Frame* frame = page->mainFrame()) - frame->eventHandler()->dragSourceMovedTo(generateMouseEvent(m_webView.get(), true)); + } return S_OK; } diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 0a1f6d0..9063fde 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -29,29 +29,30 @@ #include "WebFrame.h" #include "CFDictionaryPropertyBag.h" -#include "COMPtr.h" #include "COMPropertyBag.h" -#include "DefaultPolicyDelegate.h" +#include "COMPtr.h" #include "DOMCoreClasses.h" +#include "DefaultPolicyDelegate.h" #include "HTMLFrameOwnerElement.h" #include "MarshallingHelpers.h" #include "WebActionPropertyBag.h" #include "WebChromeClient.h" +#include "WebDataSource.h" #include "WebDocumentLoader.h" #include "WebDownload.h" -#include "WebError.h" -#include "WebMutableURLRequest.h" #include "WebEditorClient.h" +#include "WebError.h" #include "WebFramePolicyListener.h" #include "WebHistory.h" +#include "WebHistoryItem.h" #include "WebIconFetcher.h" #include "WebKit.h" #include "WebKitStatisticsPrivate.h" +#include "WebMutableURLRequest.h" #include "WebNotificationCenter.h" -#include "WebView.h" -#include "WebDataSource.h" -#include "WebHistoryItem.h" +#include "WebScriptWorld.h" #include "WebURLResponse.h" +#include "WebView.h" #pragma warning( push, 0 ) #include <WebCore/BString.h> #include <WebCore/Cache.h> @@ -91,6 +92,7 @@ #include <WebCore/RenderView.h> #include <WebCore/RenderTreeAsText.h> #include <WebCore/Settings.h> +#include <WebCore/SVGSMILElement.h> #include <WebCore/TextIterator.h> #include <WebCore/JSDOMBinding.h> #include <WebCore/ScriptController.h> @@ -118,6 +120,7 @@ extern "C" { using namespace WebCore; using namespace HTMLNames; +using namespace std; using JSC::JSGlobalObject; using JSC::JSLock; @@ -490,14 +493,17 @@ JSGlobalContextRef STDMETHODCALLTYPE WebFrame::globalContext() return toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()); } -JSGlobalContextRef STDMETHODCALLTYPE WebFrame::contextForWorldID( - /* [in] */ unsigned worldID) +JSGlobalContextRef WebFrame::globalContextForScriptWorld(IWebScriptWorld* iWorld) { Frame* coreFrame = core(this); if (!coreFrame) return 0; - return toGlobalRef(coreFrame->script()->globalObject(worldID)->globalExec()); + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return 0; + + return toGlobalRef(coreFrame->script()->globalObject(world->world())->globalExec()); } HRESULT STDMETHODCALLTYPE WebFrame::loadRequest( @@ -820,7 +826,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::renderTreeAsExternalRepresentation( if (!coreFrame) return E_FAIL; - *result = BString(externalRepresentation(coreFrame->contentRenderer())).release(); + *result = BString(externalRepresentation(coreFrame)).release(); return S_OK; } @@ -980,7 +986,14 @@ HRESULT STDMETHODCALLTYPE WebFrame::selectedString( HRESULT STDMETHODCALLTYPE WebFrame::selectAll() { - return E_NOTIMPL; + Frame* coreFrame = core(this); + if (!coreFrame) + return E_FAIL; + + if (!coreFrame->editor()->command("SelectAll").execute()) + return E_FAIL; + + return S_OK; } HRESULT STDMETHODCALLTYPE WebFrame::deselectAll() @@ -1151,6 +1164,34 @@ HRESULT WebFrame::pauseTransition(BSTR propertyName, IDOMNode* node, double seco return S_OK; } +HRESULT WebFrame::pauseSVGAnimation(BSTR elementId, IDOMNode* node, double secondsFromNow, BOOL* animationWasRunning) +{ + if (!node || !animationWasRunning) + return E_POINTER; + + *animationWasRunning = FALSE; + + Frame* frame = core(this); + if (!frame) + return E_FAIL; + + Document* document = frame->document(); + if (!document || !document->svgExtensions()) + return E_FAIL; + + COMPtr<DOMNode> domNode(Query, node); + if (!domNode || !SVGSMILElement::isSMILElement(domNode->node())) + return E_FAIL; + +#if ENABLE(SVG) + *animationWasRunning = document->accessSVGExtensions()->sampleAnimationAtTime(String(elementId, SysStringLen(elementId)), static_cast<SVGSMILElement*>(domNode->node()), secondsFromNow); +#else + *animationWasRunning = FALSE; +#endif + + return S_OK; +} + HRESULT WebFrame::numberOfActiveAnimations(UINT* number) { if (!number) @@ -1691,7 +1732,7 @@ PassRefPtr<Widget> WebFrame::createJavaAppletWidget(const IntSize& pluginSize, H if (FAILED(d->webView->resourceLoadDelegate(&resourceLoadDelegate))) return pluginView; - COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance()); + COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance(); ResourceError resourceError(String(WebKitErrorDomain), WebKitErrorJavaUnavailable, String(), String()); COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get())); @@ -1712,7 +1753,7 @@ String WebFrame::overrideMediaType() const return String(); } -void WebFrame::windowObjectCleared() +void WebFrame::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { Frame* coreFrame = core(this); ASSERT(coreFrame); @@ -1722,14 +1763,22 @@ void WebFrame::windowObjectCleared() return; COMPtr<IWebFrameLoadDelegate> frameLoadDelegate; - if (SUCCEEDED(d->webView->frameLoadDelegate(&frameLoadDelegate))) { - JSContextRef context = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()); - JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld())); - ASSERT(windowObject); + if (FAILED(d->webView->frameLoadDelegate(&frameLoadDelegate))) + return; - if (FAILED(frameLoadDelegate->didClearWindowObject(d->webView, context, windowObject, this))) - frameLoadDelegate->windowScriptObjectAvailable(d->webView, context, windowObject); - } + COMPtr<IWebFrameLoadDelegatePrivate2> delegatePrivate(Query, frameLoadDelegate); + if (delegatePrivate && delegatePrivate->didClearWindowObjectForFrameInScriptWorld(d->webView, this, WebScriptWorld::findOrCreateWorld(world).get()) != E_NOTIMPL) + return; + + if (world != mainThreadNormalWorld()) + return; + + JSContextRef context = toRef(coreFrame->script()->globalObject(world)->globalExec()); + JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(world)); + ASSERT(windowObject); + + if (FAILED(frameLoadDelegate->didClearWindowObject(d->webView, context, windowObject, this))) + frameLoadDelegate->windowScriptObjectAvailable(d->webView, context, windowObject); } void WebFrame::documentElementAvailable() @@ -2169,18 +2218,20 @@ HRESULT STDMETHODCALLTYPE WebFrame::isDescendantOfFrame( return S_OK; } -HRESULT STDMETHODCALLTYPE WebFrame::stringByEvaluatingJavaScriptInIsolatedWorld( - /* [in] */ unsigned int worldID, - /* [in] */ OLE_HANDLE jsGlobalObject, - /* [in] */ BSTR script, - /* [retval][out] */ BSTR* evaluationResult) +HRESULT WebFrame::stringByEvaluatingJavaScriptInScriptWorld(IWebScriptWorld* iWorld, JSObjectRef globalObjectRef, BSTR script, BSTR* evaluationResult) { if (!evaluationResult) return E_POINTER; *evaluationResult = 0; + if (!iWorld) + return E_POINTER; + + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_INVALIDARG; + Frame* coreFrame = core(this); - JSObjectRef globalObjectRef = reinterpret_cast<JSObjectRef>(jsGlobalObject); String string = String(script, SysStringLen(script)); // Start off with some guess at a frame and a global object, we'll try to do better...! @@ -2194,7 +2245,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::stringByEvaluatingJavaScriptInIsolatedWorld( // Get the frame frome the global object we've settled on. Frame* frame = anyWorldGlobalObject->impl()->frame(); ASSERT(frame->document()); - JSValue result = frame->script()->executeScriptInIsolatedWorld(worldID, string, true).jsValue(); + JSValue result = frame->script()->executeScriptInWorld(world->world(), string, true).jsValue(); if (!frame) // In case the script removed our frame from the page. return S_OK; diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h index d0f6adf..91b8e14 100644 --- a/WebKit/win/WebFrame.h +++ b/WebKit/win/WebFrame.h @@ -240,6 +240,7 @@ public: virtual HRESULT STDMETHODCALLTYPE pauseAnimation(BSTR animationName, IDOMNode*, double secondsFromNow, BOOL* animationWasRunning); virtual HRESULT STDMETHODCALLTYPE pauseTransition(BSTR propertyName, IDOMNode*, double secondsFromNow, BOOL* transitionWasRunning); + virtual HRESULT STDMETHODCALLTYPE pauseSVGAnimation(BSTR elementId, IDOMNode*, double secondsFromNow, BOOL* animationWasRunning); virtual HRESULT STDMETHODCALLTYPE numberOfActiveAnimations(UINT*); virtual HRESULT STDMETHODCALLTYPE isDisplayingStandaloneImage(BOOL*); @@ -248,14 +249,8 @@ public: /* [in] */ BSTR url, /* [retval][out] */ BOOL* result); - virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptInIsolatedWorld( - /* [in] */ unsigned int worldID, - /* [in] */ OLE_HANDLE jsGlobalObject, - /* [in] */ BSTR script, - /* [retval][out] */ BSTR* evaluationResult); - - virtual /* [local] */ JSGlobalContextRef STDMETHODCALLTYPE contextForWorldID( - /* [in] */ unsigned worldID); + virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptInScriptWorld(IWebScriptWorld*, JSObjectRef globalObjectRef, BSTR script, BSTR* evaluationResult); + virtual JSGlobalContextRef STDMETHODCALLTYPE globalContextForScriptWorld(IWebScriptWorld*); // IWebDocumentText virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding( @@ -318,7 +313,7 @@ public: virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType); virtual WebCore::String overrideMediaType() const; - virtual void windowObjectCleared(); + virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; diff --git a/WebKit/win/WebHistory.cpp b/WebKit/win/WebHistory.cpp index deb75e5..5383a0c 100644 --- a/WebKit/win/WebHistory.cpp +++ b/WebKit/win/WebHistory.cpp @@ -96,7 +96,7 @@ static bool areEqualOrClose(double d1, double d2) return (diff < .000001 && diff > -.000001); } -static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem) +static COMPtr<CFDictionaryPropertyBag> createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem) { RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); @@ -104,28 +104,19 @@ static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CF RetainPtr<CFStringRef> key(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(notificationStr)); CFDictionaryAddValue(dictionary.get(), key.get(), arrayItem); - CFDictionaryPropertyBag* result = CFDictionaryPropertyBag::createInstance(); + COMPtr<CFDictionaryPropertyBag> result = CFDictionaryPropertyBag::createInstance(); result->setDictionary(dictionary.get()); return result; } -static CFDictionaryPropertyBag* createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item) +static COMPtr<CFDictionaryPropertyBag> createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item) { // reference counting of item added to the array is managed by the CFArray value callbacks RetainPtr<CFArrayRef> itemList(AdoptCF, CFArrayCreate(0, (const void**) &item, 1, &MarshallingHelpers::kIUnknownArrayCallBacks)); - CFDictionaryPropertyBag* info = createUserInfoFromArray(notificationStr, itemList.get()); + COMPtr<CFDictionaryPropertyBag> info = createUserInfoFromArray(notificationStr, itemList.get()); return info; } -static void releaseUserInfo(CFDictionaryPropertyBag* userInfo) -{ - // free the dictionary - userInfo->setDictionary(0); - int result = userInfo->Release(); - (void)result; - ASSERT(result == 0); // make sure no one else holds a reference to the userInfo. -} - // WebHistory ----------------------------------------------------------------- WebHistory::WebHistory() @@ -264,9 +255,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::loadFromURL( goto exit; if (CFArrayGetCount(discardedItems.get()) > 0) { - CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get()); - hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo); - releaseUserInfo(userInfo); + COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get()); + hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo.get()); if (FAILED(hr)) goto exit; } @@ -465,8 +455,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::removeAllItems( void) PageGroup::removeAllVisitedLinks(); - CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get()); - return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo); + COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get()); + return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo.get()); } HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays( @@ -644,10 +634,9 @@ HRESULT WebHistory::removeItem(IWebHistoryItem* entry) if (FAILED(hr)) return hr; - CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem( + COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem( getNotificationString(kWebHistoryItemsRemovedNotification), entry); - hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo); - releaseUserInfo(userInfo); + hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo.get()); return hr; } @@ -695,10 +684,9 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry, bool discardDuplicate, bool* CFDictionarySetValue(m_entriesByURL.get(), urlString.get(), entry); - CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem( + COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem( getNotificationString(kWebHistoryItemsAddedNotification), entry); - hr = postNotification(kWebHistoryItemsAddedNotification, userInfo); - releaseUserInfo(userInfo); + hr = postNotification(kWebHistoryItemsAddedNotification, userInfo.get()); if (added) *added = true; @@ -754,10 +742,9 @@ void WebHistory::visitedURL(const KURL& url, const String& title, const String& COMPtr<WebHistoryItem> item(Query, entry); item->historyItem()->setRedirectURLs(0); - CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem( + COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem( getNotificationString(kWebHistoryItemsAddedNotification), entry); - postNotification(kWebHistoryItemsAddedNotification, userInfo); - releaseUserInfo(userInfo); + postNotification(kWebHistoryItemsAddedNotification, userInfo.get()); } HRESULT WebHistory::itemForURLString( diff --git a/WebKit/win/WebIconDatabase.cpp b/WebKit/win/WebIconDatabase.cpp index 315db9e..9b87c2b 100644 --- a/WebKit/win/WebIconDatabase.cpp +++ b/WebKit/win/WebIconDatabase.cpp @@ -358,7 +358,7 @@ static void postDidAddIconNotification(const String& pageURL, WebIconDatabase* i RetainPtr<CFStringRef> url(AdoptCF, pageURL.createCFString()); CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), url.get()); - COMPtr<CFDictionaryPropertyBag> userInfo(AdoptCOM, CFDictionaryPropertyBag::createInstance()); + COMPtr<CFDictionaryPropertyBag> userInfo = CFDictionaryPropertyBag::createInstance(); userInfo->setDictionary(dictionary.get()); IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal(); diff --git a/WebKit/win/WebInspector.cpp b/WebKit/win/WebInspector.cpp index 97587f9..e4ac32b 100644 --- a/WebKit/win/WebInspector.cpp +++ b/WebKit/win/WebInspector.cpp @@ -272,3 +272,38 @@ HRESULT STDMETHODCALLTYPE WebInspector::evaluateInFrontend(ULONG callId, BSTR b page->inspectorController()->evaluateForTestInFrontend(callId, script); return S_OK; } + +HRESULT STDMETHODCALLTYPE WebInspector::isTimelineProfilingEnabled(BOOL* isEnabled) +{ + if (!isEnabled) + return E_POINTER; + + *isEnabled = FALSE; + + if (!m_webView) + return S_OK; + + Page* page = m_webView->page(); + if (!page) + return S_OK; + + *isEnabled = page->inspectorController()->timelineAgent() != 0; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebInspector::setTimelineProfilingEnabled(BOOL enabled) +{ + if (!m_webView) + return S_OK; + + Page* page = m_webView->page(); + if (!page) + return S_OK; + + if (enabled) + page->inspectorController()->startTimelineProfiler(); + else + page->inspectorController()->stopTimelineProfiler(); + + return S_OK; +} diff --git a/WebKit/win/WebInspector.h b/WebKit/win/WebInspector.h index 4f9bedb..053a593 100644 --- a/WebKit/win/WebInspector.h +++ b/WebKit/win/WebInspector.h @@ -59,9 +59,12 @@ public: virtual HRESULT STDMETHODCALLTYPE isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled); virtual HRESULT STDMETHODCALLTYPE setJavaScriptProfilingEnabled(BOOL); - + virtual HRESULT STDMETHODCALLTYPE evaluateInFrontend(ULONG callId, BSTR script); + virtual HRESULT STDMETHODCALLTYPE isTimelineProfilingEnabled(BOOL* isEnabled); + virtual HRESULT STDMETHODCALLTYPE setTimelineProfilingEnabled(BOOL); + private: WebInspector(WebView*); ~WebInspector(); diff --git a/WebKit/win/WebKit.vcproj/Interfaces.vcproj b/WebKit/win/WebKit.vcproj/Interfaces.vcproj index 75c7c11..ca9b2a4 100644 --- a/WebKit/win/WebKit.vcproj/Interfaces.vcproj +++ b/WebKit/win/WebKit.vcproj/Interfaces.vcproj @@ -1324,6 +1324,26 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebScriptWorld.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\IWebScrollBarDelegatePrivate.idl"
>
<FileConfiguration
@@ -1663,6 +1683,26 @@ />
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\Interfaces\JavaScriptCoreAPITypes.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj index 121f773..5846813 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.vcproj +++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj @@ -40,7 +40,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_FILTERS;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
DisableSpecificWarnings="4819"
@@ -117,7 +117,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_FILTERS;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
DisableSpecificWarnings="4819"
@@ -193,7 +193,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_FILTERS;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
Detect64BitPortabilityProblems="false"
@@ -215,7 +215,7 @@ Name="VCLinkerTool"
AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
- AdditionalLibraryDirectories=""
+ AdditionalLibraryDirectories="$(DXSDK_DIR)\Lib\x86"
ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;QTMovieWin$(WebKitConfigSuffix).dll;iphlpapi.dll;rpcrt4.dll"
/>
@@ -270,7 +270,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_FILTERS;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
DisableSpecificWarnings="4819"
@@ -289,7 +289,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite_Debug.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite_Debug.lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
ModuleDefinitionFile="WebKit_Cairo$(WebKitDLLConfigSuffix).def"
@@ -350,7 +350,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_FILTERS;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
DisableSpecificWarnings="4819"
@@ -426,7 +426,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_FILTERS;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
Detect64BitPortabilityProblems="false"
@@ -722,6 +722,14 @@ >
</File>
<File
+ RelativePath="..\WebScriptWorld.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebSerializedJSValue.h"
+ >
+ </File>
+ <File
RelativePath="..\WebKitStatistics.h"
>
</File>
@@ -790,6 +798,10 @@ >
</File>
<File
+ RelativePath="..\WebScriptWorld.h"
+ >
+ </File>
+ <File
RelativePath="..\WebScrollBar.h"
>
</File>
@@ -1090,6 +1102,14 @@ >
</File>
<File
+ RelativePath="..\WebScriptWorld.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebSerializedJSValue.cpp"
+ >
+ </File>
+ <File
RelativePath="..\WebKitStatistics.cpp"
>
</File>
@@ -1122,6 +1142,10 @@ >
</File>
<File
+ RelativePath="..\WebScriptWorld.cpp"
+ >
+ </File>
+ <File
RelativePath="..\WebScrollBar.cpp"
>
</File>
diff --git a/WebKit/win/WebKitClassFactory.cpp b/WebKit/win/WebKitClassFactory.cpp index c2143b5..b233a5c 100644 --- a/WebKit/win/WebKitClassFactory.cpp +++ b/WebKit/win/WebKitClassFactory.cpp @@ -27,8 +27,8 @@ #include "WebKitDLL.h" #include "WebKitClassFactory.h" -#include "ForEachCoClass.h" #include "CFDictionaryPropertyBag.h" +#include "ForEachCoClass.h" #include "WebArchive.h" #include "WebCache.h" #include "WebCookieManager.h" @@ -42,11 +42,12 @@ #include "WebIconDatabase.h" #include "WebJavaScriptCollector.h" #include "WebKit.h" -#include "WebScrollBar.h" #include "WebKitStatistics.h" #include "WebMutableURLRequest.h" #include "WebNotificationCenter.h" #include "WebPreferences.h" +#include "WebScriptWorld.h" +#include "WebScrollBar.h" #include "WebTextRenderer.h" #include "WebURLCredential.h" #include "WebURLProtectionSpace.h" @@ -126,6 +127,19 @@ ULONG STDMETHODCALLTYPE WebKitClassFactory::Release(void) return newRef; } +// FIXME: Remove these functions once all createInstance() functions return COMPtr. +template <typename T> +static T* releaseRefFromCreateInstance(T* object) +{ + return object; +} + +template <typename T> +static T* releaseRefFromCreateInstance(COMPtr<T> object) +{ + return object.releaseRef(); +} + // IClassFactory -------------------------------------------------------------- HRESULT STDMETHODCALLTYPE WebKitClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject) @@ -138,7 +152,7 @@ HRESULT STDMETHODCALLTYPE WebKitClassFactory::CreateInstance(IUnknown* pUnkOuter #define INITIALIZE_IF_CLASS(cls) \ if (IsEqualGUID(m_targetClass, CLSID_##cls)) \ - unknown = static_cast<I##cls*>(cls::createInstance()); \ + unknown = static_cast<I##cls*>(releaseRefFromCreateInstance(cls::createInstance())); \ else \ // end of macro diff --git a/WebKit/win/WebKitGraphics.cpp b/WebKit/win/WebKitGraphics.cpp index 9727ee6..03fe903 100644 --- a/WebKit/win/WebKitGraphics.cpp +++ b/WebKit/win/WebKitGraphics.cpp @@ -114,7 +114,7 @@ void WebDrawText(WebTextRenderInfo* info) // Set shadow setting if (info->structSize == sizeof(WebTextRenderInfo) && (info->shadowOffset.cx || info->shadowOffset.cy || info->shadowBlur || info->shadowColor)) - context.setShadow(info->shadowOffset, info->shadowBlur, info->shadowColor); + context.setShadow(info->shadowOffset, info->shadowBlur, info->shadowColor, DeviceColorSpace); WebCoreDrawTextAtPoint(context, drawString, info->pt, makeFont(*(info->description)), info->color, info->underlinedIndex); context.restore(); diff --git a/WebKit/win/WebKitPrefix.cpp b/WebKit/win/WebKitPrefix.cpp index 193e9f6..e82b88d 100644 --- a/WebKit/win/WebKitPrefix.cpp +++ b/WebKit/win/WebKitPrefix.cpp @@ -27,4 +27,3 @@ */ #include "WebKitPrefix.h" - diff --git a/WebKit/win/WebNavigationData.cpp b/WebKit/win/WebNavigationData.cpp index 1ae3fe5..1ea028c 100644 --- a/WebKit/win/WebNavigationData.cpp +++ b/WebKit/win/WebNavigationData.cpp @@ -27,8 +27,7 @@ #include "WebKitDLL.h" #include "WebNavigationData.h" -#include <WebCore/BString.h> -using WebCore::BString; +using namespace WebCore; // IUnknown ------------------------------------------------------------------- @@ -62,19 +61,18 @@ ULONG STDMETHODCALLTYPE WebNavigationData::Release(void) // WebNavigationData ------------------------------------------------------------------- -WebNavigationData::WebNavigationData(BSTR url, BSTR title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, BSTR clientRedirectSource) +WebNavigationData::WebNavigationData(const String& url, const String& title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, const String& clientRedirectSource) : m_refCount(0) + , m_url(url) + , m_title(title) , m_request(request) , m_response(response) , m_hasSubstituteData(hasSubstituteData) + , m_clientRedirectSource(clientRedirectSource) { gClassCount++; gClassNameCount.add("WebNavigationData"); - - m_url.adoptBSTR(url); - m_title.adoptBSTR(title); - m_clientRedirectSource.adoptBSTR(clientRedirectSource); } WebNavigationData::~WebNavigationData() @@ -83,7 +81,7 @@ WebNavigationData::~WebNavigationData() gClassNameCount.remove("WebNavigationData"); } -WebNavigationData* WebNavigationData::createInstance(BSTR url, BSTR title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, BSTR clientRedirectSource) +WebNavigationData* WebNavigationData::createInstance(const String& url, const String& title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, const String& clientRedirectSource) { WebNavigationData* instance = new WebNavigationData(url, title, request, response, hasSubstituteData, clientRedirectSource); instance->AddRef(); diff --git a/WebKit/win/WebNavigationData.h b/WebKit/win/WebNavigationData.h index 0443fd7..d00912c 100644 --- a/WebKit/win/WebNavigationData.h +++ b/WebKit/win/WebNavigationData.h @@ -33,9 +33,9 @@ class WebNavigationData : public IWebNavigationData { public: - static WebNavigationData* createInstance(BSTR, BSTR, IWebURLRequest*, IWebURLResponse*, bool, BSTR); + static WebNavigationData* createInstance(const WebCore::String& url, const WebCore::String& title, IWebURLRequest*, IWebURLResponse*, bool hasSubstituteData, const WebCore::String& clientRedirectSource); private: - WebNavigationData(BSTR url, BSTR title, IWebURLRequest*, IWebURLResponse*, bool hasSubstituteData, BSTR clientRedirectSource); + WebNavigationData(const WebCore::String& url, const WebCore::String& title, IWebURLRequest*, IWebURLResponse*, bool hasSubstituteData, const WebCore::String& clientRedirectSource); ~WebNavigationData(); public: diff --git a/WebKit/win/WebScriptObject.cpp b/WebKit/win/WebScriptObject.cpp index 55d92e7..9306eb1 100644 --- a/WebKit/win/WebScriptObject.cpp +++ b/WebKit/win/WebScriptObject.cpp @@ -23,10 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebKitDLL.h" - +#include "config.h" #include "WebScriptObject.h" +#include "WebKitDLL.h" + #include <wtf/Assertions.h> // WebScriptObject ------------------------------------------------------------ diff --git a/WebKit/win/WebScriptWorld.cpp b/WebKit/win/WebScriptWorld.cpp new file mode 100644 index 0000000..03eede7 --- /dev/null +++ b/WebKit/win/WebScriptWorld.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2009 Apple 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 INC. 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 INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitDLL.h" +#include "WebScriptWorld.h" + +#include <WebCore/JSDOMBinding.h> +#include <WebCore/ScriptController.h> + +using namespace WebCore; + +typedef HashMap<DOMWrapperWorld*, WebScriptWorld*> WorldMap; +static WorldMap& allWorlds() +{ + static WorldMap& map = *new WorldMap; + return map; +} + +inline WebScriptWorld::WebScriptWorld(PassRefPtr<DOMWrapperWorld> world) + : m_refCount(0) + , m_world(world) +{ + ASSERT_ARG(world, m_world); + + ASSERT_ARG(world, !allWorlds().contains(m_world.get())); + allWorlds().add(m_world.get(), this); + + ++gClassCount; + gClassNameCount.add("WebScriptWorld"); +} + +WebScriptWorld::~WebScriptWorld() +{ + ASSERT(allWorlds().contains(m_world.get())); + allWorlds().remove(m_world.get()); + + --gClassCount; + gClassNameCount.remove("WebScriptWorld"); +} + +WebScriptWorld* WebScriptWorld::standardWorld() +{ + static WebScriptWorld* standardWorld = createInstance(mainThreadNormalWorld()).releaseRef(); + return standardWorld; +} + +COMPtr<WebScriptWorld> WebScriptWorld::createInstance() +{ + return createInstance(ScriptController::createWorld()); +} + +COMPtr<WebScriptWorld> WebScriptWorld::createInstance(PassRefPtr<DOMWrapperWorld> world) +{ + return new WebScriptWorld(world); +} + +COMPtr<WebScriptWorld> WebScriptWorld::findOrCreateWorld(DOMWrapperWorld* world) +{ + if (world == mainThreadNormalWorld()) + return standardWorld(); + + if (WebScriptWorld* existingWorld = allWorlds().get(world)) + return existingWorld; + + return createInstance(world); +} + +ULONG WebScriptWorld::AddRef() +{ + return ++m_refCount; +} + +ULONG WebScriptWorld::Release() +{ + ULONG newRefCount = --m_refCount; + if (!newRefCount) + delete this; + return newRefCount; +} + +HRESULT WebScriptWorld::QueryInterface(REFIID riid, void** ppvObject) +{ + if (!ppvObject) + return E_POINTER; + *ppvObject = 0; + + if (IsEqualIID(riid, __uuidof(WebScriptWorld))) + *ppvObject = this; + else if (IsEqualIID(riid, __uuidof(IWebScriptWorld))) + *ppvObject = static_cast<IWebScriptWorld*>(this); + else if (IsEqualIID(riid, IID_IUnknown)) + *ppvObject = static_cast<IUnknown*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +HRESULT WebScriptWorld::standardWorld(IWebScriptWorld** outWorld) +{ + if (!outWorld) + return E_POINTER; + + *outWorld = standardWorld(); + (*outWorld)->AddRef(); + return S_OK; +} diff --git a/WebKit/win/WebScriptWorld.h b/WebKit/win/WebScriptWorld.h new file mode 100644 index 0000000..b800225 --- /dev/null +++ b/WebKit/win/WebScriptWorld.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 Apple 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 INC. 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 INC. 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 WebScriptWorld_h +#define WebScriptWorld_h + +#include <WebCore/COMPtr.h> + +namespace WebCore { + class DOMWrapperWorld; +} + +class WebScriptWorld : public Noncopyable, public IWebScriptWorld { +public: + static WebScriptWorld* standardWorld(); + static COMPtr<WebScriptWorld> createInstance(); + + static COMPtr<WebScriptWorld> findOrCreateWorld(WebCore::DOMWrapperWorld*); + + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + + WebCore::DOMWrapperWorld* world() const { return m_world.get(); } + +private: + static COMPtr<WebScriptWorld> createInstance(PassRefPtr<WebCore::DOMWrapperWorld>); + + WebScriptWorld(PassRefPtr<WebCore::DOMWrapperWorld>); + ~WebScriptWorld(); + + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject); + virtual HRESULT STDMETHODCALLTYPE standardWorld(IWebScriptWorld**); + + ULONG m_refCount; + RefPtr<WebCore::DOMWrapperWorld> m_world; +}; + +#endif // WebScriptWorld_h diff --git a/WebKit/win/WebSerializedJSValue.cpp b/WebKit/win/WebSerializedJSValue.cpp new file mode 100644 index 0000000..307df90 --- /dev/null +++ b/WebKit/win/WebSerializedJSValue.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2009 Apple 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 INC. 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 INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitDLL.h" +#include "WebSerializedJSValue.h" + +#include <WebCore/SerializedScriptValue.h> + +using namespace WebCore; + +WebSerializedJSValue::WebSerializedJSValue() + : m_refCount(0) +{ + ++gClassCount; + gClassNameCount.add("WebSerializedJSValue"); +} + +WebSerializedJSValue::~WebSerializedJSValue() +{ + --gClassCount; + gClassNameCount.remove("WebSerializedJSValue"); +} + +COMPtr<WebSerializedJSValue> WebSerializedJSValue::createInstance() +{ + return new WebSerializedJSValue(); +} + +ULONG WebSerializedJSValue::AddRef() +{ + return ++m_refCount; +} + +ULONG WebSerializedJSValue::Release() +{ + ULONG newRefCount = --m_refCount; + if (!newRefCount) + delete this; + return newRefCount; +} + +HRESULT WebSerializedJSValue::QueryInterface(REFIID riid, void** ppvObject) +{ + if (!ppvObject) + return E_POINTER; + *ppvObject = 0; + + if (IsEqualIID(riid, __uuidof(WebSerializedJSValue))) + *ppvObject = this; + else if (IsEqualIID(riid, __uuidof(IWebSerializedJSValue))) + *ppvObject = static_cast<IWebSerializedJSValue*>(this); + else if (IsEqualIID(riid, IID_IUnknown)) + *ppvObject = static_cast<IUnknown*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +HRESULT WebSerializedJSValue::serialize(JSContextRef sourceContext, JSValueRef value, JSValueRef* exception) +{ + ASSERT_ARG(value, value); + ASSERT_ARG(sourceContext, sourceContext); + + if (!value || !sourceContext) + return E_POINTER; + + m_value = SerializedScriptValue::create(sourceContext, value, exception); + + return S_OK; +} + +HRESULT WebSerializedJSValue::deserialize(JSContextRef destinationContext, JSValueRef* outValue) +{ + if (!outValue) + return E_POINTER; + + if (!m_value) + *outValue = 0; + else + *outValue = m_value->deserialize(destinationContext, 0); + + return S_OK; +} diff --git a/WebKit/win/WebSerializedJSValue.h b/WebKit/win/WebSerializedJSValue.h new file mode 100644 index 0000000..d39323c --- /dev/null +++ b/WebKit/win/WebSerializedJSValue.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Apple 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 INC. 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 INC. 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 WebSerializedJSValue_h +#define WebSerializedJSValue_h + +#include <WebCore/COMPtr.h> + +typedef const struct OpaqueJSContext* JSContextRef; +typedef const struct OpaqueJSValue* JSValueRef; + +namespace WebCore { + class SerializedScriptValue; +} + +class WebSerializedJSValue : public Noncopyable, public IWebSerializedJSValue { +public: + static COMPtr<WebSerializedJSValue> createInstance(); + + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + + virtual HRESULT STDMETHODCALLTYPE serialize(JSContextRef, JSValueRef value, JSValueRef* exception); + virtual HRESULT STDMETHODCALLTYPE deserialize(JSContextRef, JSValueRef* result); + +private: + WebSerializedJSValue(); + ~WebSerializedJSValue(); + + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject); + + ULONG m_refCount; + RefPtr<WebCore::SerializedScriptValue> m_value; +}; + +#endif // WebSerializedJSValue_h diff --git a/WebKit/win/WebURLAuthenticationChallenge.cpp b/WebKit/win/WebURLAuthenticationChallenge.cpp index 7c37501..c711450 100644 --- a/WebKit/win/WebURLAuthenticationChallenge.cpp +++ b/WebKit/win/WebURLAuthenticationChallenge.cpp @@ -172,7 +172,7 @@ HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::initWithAuthenticationC return E_NOINTERFACE; #if USE(CFNETWORK) - m_authenticationChallenge = AuthenticationChallenge(webChallenge->authenticationChallenge().cfURLAuthChallengeRef(), webSender->resourceHandle()); + m_authenticationChallenge = AuthenticationChallenge(webChallenge->authenticationChallenge().cfURLAuthChallengeRef(), webSender->authenticationClient()); return S_OK; #else @@ -220,8 +220,8 @@ HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::sender( /* [out, retval] */ IWebURLAuthenticationChallengeSender** sender) { if (!m_sender) { - ResourceHandle* handle = m_authenticationChallenge.sourceHandle(); - m_sender.adoptRef(WebURLAuthenticationChallengeSender::createInstance(handle)); + AuthenticationClient* client = m_authenticationChallenge.authenticationClient(); + m_sender.adoptRef(WebURLAuthenticationChallengeSender::createInstance(client)); } return m_sender.copyRefTo(sender); diff --git a/WebKit/win/WebURLAuthenticationChallengeSender.cpp b/WebKit/win/WebURLAuthenticationChallengeSender.cpp index 4d4d4cd..1257d41 100644 --- a/WebKit/win/WebURLAuthenticationChallengeSender.cpp +++ b/WebKit/win/WebURLAuthenticationChallengeSender.cpp @@ -34,18 +34,18 @@ #include "WebURLCredential.h" #pragma warning(push, 0) -#include <WebCore/ResourceHandle.h> +#include <WebCore/AuthenticationClient.h> #pragma warning(pop) using namespace WebCore; // WebURLAuthenticationChallengeSender ---------------------------------------------------------------- -WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender(PassRefPtr<ResourceHandle> handle) +WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender(PassRefPtr<AuthenticationClient> client) : m_refCount(0) - , m_handle(handle) + , m_client(client) { - ASSERT(m_handle); + ASSERT(m_client); gClassCount++; gClassNameCount.add("WebURLAuthenticationChallengeSender"); } @@ -56,9 +56,9 @@ WebURLAuthenticationChallengeSender::~WebURLAuthenticationChallengeSender() gClassNameCount.remove("WebURLAuthenticationChallengeSender"); } -WebURLAuthenticationChallengeSender* WebURLAuthenticationChallengeSender::createInstance(PassRefPtr<WebCore::ResourceHandle> handle) +WebURLAuthenticationChallengeSender* WebURLAuthenticationChallengeSender::createInstance(PassRefPtr<WebCore::AuthenticationClient> client) { - WebURLAuthenticationChallengeSender* instance = new WebURLAuthenticationChallengeSender(handle); + WebURLAuthenticationChallengeSender* instance = new WebURLAuthenticationChallengeSender(client); instance->AddRef(); return instance; } @@ -97,8 +97,8 @@ ULONG STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::Release(void) // WebURLAuthenticationChallengeSender ---------------------------------------------------------------- -ResourceHandle* WebURLAuthenticationChallengeSender::resourceHandle() const +AuthenticationClient* WebURLAuthenticationChallengeSender::authenticationClient() const { - return m_handle.get(); + return m_client.get(); } diff --git a/WebKit/win/WebURLAuthenticationChallengeSender.h b/WebKit/win/WebURLAuthenticationChallengeSender.h index cfb8cc3..5ccd0c5 100644 --- a/WebKit/win/WebURLAuthenticationChallengeSender.h +++ b/WebKit/win/WebURLAuthenticationChallengeSender.h @@ -32,16 +32,16 @@ #include <wtf/RefPtr.h> namespace WebCore { - class ResourceHandle; + class AuthenticationClient; } class DECLSPEC_UUID("5CACD637-F82F-491F-947A-5DCA38AA0FEA") WebURLAuthenticationChallengeSender : public IWebURLAuthenticationChallengeSender { public: - static WebURLAuthenticationChallengeSender* createInstance(PassRefPtr<WebCore::ResourceHandle>); + static WebURLAuthenticationChallengeSender* createInstance(PassRefPtr<WebCore::AuthenticationClient>); private: - WebURLAuthenticationChallengeSender(PassRefPtr<WebCore::ResourceHandle>); + WebURLAuthenticationChallengeSender(PassRefPtr<WebCore::AuthenticationClient>); ~WebURLAuthenticationChallengeSender(); public: // IUnknown @@ -60,12 +60,12 @@ public: /* [in] */ IWebURLCredential* credential, /* [in] */ IWebURLAuthenticationChallenge* challenge); - WebCore::ResourceHandle* resourceHandle() const; + WebCore::AuthenticationClient* authenticationClient() const; private: ULONG m_refCount; - RefPtr<WebCore::ResourceHandle> m_handle; + RefPtr<WebCore::AuthenticationClient> m_client; }; #endif diff --git a/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp b/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp index 21f79e0..f756391 100644 --- a/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp +++ b/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp @@ -34,7 +34,7 @@ #include "WebURLCredential.h" #pragma warning(push, 0) -#include <WebCore/ResourceHandle.h> +#include <WebCore/AuthenticationClient.h> #pragma warning(pop) using namespace WebCore; @@ -48,7 +48,7 @@ HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::cancelAuthenticat if (!webChallenge) return E_FAIL; - m_handle->receivedCancellation(webChallenge->authenticationChallenge()); + m_client->receivedCancellation(webChallenge->authenticationChallenge()); return S_OK; } @@ -59,7 +59,7 @@ HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::continueWithoutCr if (!webChallenge) return E_FAIL; - m_handle->receivedRequestToContinueWithoutCredential(webChallenge->authenticationChallenge()); + m_client->receivedRequestToContinueWithoutCredential(webChallenge->authenticationChallenge()); return S_OK; } @@ -75,6 +75,6 @@ HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::useCredential( if (!credential || FAILED(credential->QueryInterface(__uuidof(WebURLCredential), (void**)&webCredential))) return E_FAIL; - m_handle->receivedCredential(webChallenge->authenticationChallenge(), webCredential->credential()); + m_client->receivedCredential(webChallenge->authenticationChallenge(), webCredential->credential()); return S_OK; } diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index e2f3fae..d98d390 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -31,17 +31,17 @@ #include "DOMCoreClasses.h" #include "MarshallingHelpers.h" #include "SoftLinking.h" +#include "WebBackForwardList.h" +#include "WebChromeClient.h" +#include "WebContextMenuClient.h" +#include "WebCoreTextRenderer.h" #include "WebDatabaseManager.h" #include "WebDocumentLoader.h" #include "WebDownload.h" +#include "WebDragClient.h" #include "WebEditorClient.h" #include "WebElementPropertyBag.h" #include "WebFrame.h" -#include "WebBackForwardList.h" -#include "WebChromeClient.h" -#include "WebContextMenuClient.h" -#include "WebCoreTextRenderer.h" -#include "WebDragClient.h" #include "WebIconDatabase.h" #include "WebInspector.h" #include "WebInspectorClient.h" @@ -52,6 +52,7 @@ #include "WebNotificationCenter.h" #include "WebPluginHalterClient.h" #include "WebPreferences.h" +#include "WebScriptWorld.h" #include "WindowsTouch.h" #pragma warning( push, 0 ) #include <WebCore/ApplicationCacheStorage.h> @@ -270,7 +271,6 @@ static const int maxToolTipWidth = 250; static const int delayBeforeDeletingBackingStoreMsec = 5000; static ATOM registerWebView(); -static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static void initializeStaticObservers(); @@ -294,34 +294,37 @@ enum { bool WebView::s_allowSiteSpecificHacks = false; WebView::WebView() -: m_refCount(0) -, m_hostWindow(0) -, m_viewWindow(0) -, m_mainFrame(0) -, m_page(0) -, m_hasCustomDropTarget(false) -, m_useBackForwardList(true) -, m_userAgentOverridden(false) -, m_zoomMultiplier(1.0f) -, m_mouseActivated(false) -, m_dragData(0) -, m_currentCharacterCode(0) -, m_isBeingDestroyed(false) -, m_paintCount(0) -, m_hasSpellCheckerDocumentTag(false) -, m_smartInsertDeleteEnabled(false) -, m_didClose(false) -, m_inIMEComposition(0) -, m_toolTipHwnd(0) -, m_closeWindowTimer(this, &WebView::closeWindowTimerFired) -, m_topLevelParent(0) -, m_deleteBackingStoreTimerActive(false) -, m_transparent(false) -, m_selectTrailingWhitespaceEnabled(false) -, m_lastPanX(0) -, m_lastPanY(0) -, m_xOverpan(0) -, m_yOverpan(0) + : m_refCount(0) + , m_hostWindow(0) + , m_viewWindow(0) + , m_mainFrame(0) + , m_page(0) + , m_hasCustomDropTarget(false) + , m_useBackForwardList(true) + , m_userAgentOverridden(false) + , m_zoomMultiplier(1.0f) + , m_mouseActivated(false) + , m_dragData(0) + , m_currentCharacterCode(0) + , m_isBeingDestroyed(false) + , m_paintCount(0) + , m_hasSpellCheckerDocumentTag(false) + , m_smartInsertDeleteEnabled(false) + , m_didClose(false) + , m_inIMEComposition(0) + , m_toolTipHwnd(0) + , m_closeWindowTimer(this, &WebView::closeWindowTimerFired) + , m_topLevelParent(0) + , m_deleteBackingStoreTimerActive(false) + , m_transparent(false) + , m_selectTrailingWhitespaceEnabled(false) + , m_lastPanX(0) + , m_lastPanY(0) + , m_xOverpan(0) + , m_yOverpan(0) +#if USE(ACCELERATED_COMPOSITING) + , m_isAcceleratedCompositing(false) +#endif { JSC::initializeThreading(); @@ -617,6 +620,10 @@ HRESULT STDMETHODCALLTYPE WebView::close() m_didClose = true; +#if USE(ACCELERATED_COMPOSITING) + setAcceleratedCompositing(false); +#endif + WebNotificationCenter::defaultCenterInternal()->postNotificationName(_bstr_t(WebViewWillCloseNotification).GetBSTR(), static_cast<IWebView*>(this), 0); if (m_uiDelegatePrivate) @@ -676,6 +683,11 @@ HRESULT STDMETHODCALLTYPE WebView::close() void WebView::repaint(const WebCore::IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly) { +#if USE(ACCELERATED_COMPOSITING) + if (isAcceleratedCompositing()) + setRootLayerNeedsDisplay(); +#endif + if (!repaintContentOnly) { RECT rect = windowRect; ::InvalidateRect(m_viewWindow, &rect, false); @@ -794,7 +806,6 @@ void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const Int // Clean up. ::DeleteDC(bitmapDC); ::ReleaseDC(m_viewWindow, windowDC); - } // This emulates the Mac smarts for painting rects intelligently. This is very @@ -927,18 +938,25 @@ void WebView::paint(HDC dc, LPARAM options) // Update our backing store if needed. updateBackingStore(frameView, bitmapDC, backingStoreCompletelyDirty, windowsToPaint); - // Now we blit the updated backing store - IntRect windowDirtyRect = rcPaint; - - // Apply the same heuristic for this update region too. - Vector<IntRect> blitRects; - if (region && regionType == COMPLEXREGION) - getUpdateRects(region.get(), windowDirtyRect, blitRects); - else - blitRects.append(windowDirtyRect); +#if USE(ACCELERATED_COMPOSITING) + if (!isAcceleratedCompositing()) { +#endif + // Now we blit the updated backing store + IntRect windowDirtyRect = rcPaint; + + // Apply the same heuristic for this update region too. + Vector<IntRect> blitRects; + if (region && regionType == COMPLEXREGION) + getUpdateRects(region.get(), windowDirtyRect, blitRects); + else + blitRects.append(windowDirtyRect); - for (unsigned i = 0; i < blitRects.size(); ++i) - paintIntoWindow(bitmapDC, hdc, blitRects[i]); + for (unsigned i = 0; i < blitRects.size(); ++i) + paintIntoWindow(bitmapDC, hdc, blitRects[i]); +#if USE(ACCELERATED_COMPOSITING) + } else + updateRootLayerContents(); +#endif ::DeleteDC(bitmapDC); @@ -1805,7 +1823,7 @@ bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown) return frame->eventHandler()->keyEvent(keyEvent); } -static bool registerWebViewWindowClass() +bool WebView::registerWebViewWindowClass() { static bool haveRegisteredWindowClass = false; if (haveRegisteredWindowClass) @@ -1849,7 +1867,7 @@ static HWND findTopLevelParent(HWND window) return 0; } -static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lResult = 0; LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0); @@ -1941,22 +1959,31 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L if (lParam != 0) { webView->deleteBackingStore(); +#if USE(ACCELERATED_COMPOSITING) + if (webView->isAcceleratedCompositing()) + webView->resizeLayerRenderer(); +#endif if (Frame* coreFrame = core(mainFrameImpl)) coreFrame->view()->resize(LOWORD(lParam), HIWORD(lParam)); } break; case WM_SHOWWINDOW: lResult = DefWindowProc(hWnd, message, wParam, lParam); - if (wParam == 0) + if (wParam == 0) { // The window is being hidden (e.g., because we switched tabs). // Null out our backing store. webView->deleteBackingStore(); + } +#if USE(ACCELERATED_COMPOSITING) + else if (webView->isAcceleratedCompositing()) + webView->layerRendererBecameVisible(); +#endif break; case WM_SETFOCUS: { COMPtr<IWebUIDelegate> uiDelegate; COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate; - if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate && - SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate) + if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate + && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate) uiDelegatePrivate->webViewReceivedFocus(webView); FocusController* focusController = webView->page()->focusController(); @@ -1975,8 +2002,8 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L COMPtr<IWebUIDelegate> uiDelegate; COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate; HWND newFocusWnd = reinterpret_cast<HWND>(wParam); - if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate && - SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate) + if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate + && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate) uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)newFocusWnd); FocusController* focusController = webView->page()->focusController(); @@ -2040,7 +2067,11 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L RECT windowRect; ::GetClientRect(hWnd, &windowRect); ::InvalidateRect(hWnd, &windowRect, false); - } +#if USE(ACCELERATED_COMPOSITING) + if (webView->isAcceleratedCompositing()) + webView->setRootLayerNeedsDisplay(); +#endif + } break; case WM_MOUSEACTIVATE: webView->setMouseActivated(true); @@ -2055,9 +2086,9 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L if (lpMsg->message == WM_KEYDOWN) keyCode = (UINT) lpMsg->wParam; } - if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate && - SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate && - SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView, keyCode, &dlgCode))) + if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate + && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate + && SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView, keyCode, &dlgCode))) return dlgCode; handled = false; break; @@ -2876,7 +2907,8 @@ HRESULT STDMETHODCALLTYPE WebView::stringByEvaluatingJavaScriptFromString( return E_FAIL; else if (scriptExecutionResult.isString()) { JSLock lock(JSC::SilenceAssertionsOnly); - *result = BString(String(scriptExecutionResult.getString())); + JSC::ExecState* exec = coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec(); + *result = BString(String(scriptExecutionResult.getString(exec))); } return S_OK; @@ -5469,6 +5501,16 @@ HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins) return S_OK; } +static String toString(BSTR bstr) +{ + return String(bstr, SysStringLen(bstr)); +} + +static KURL toKURL(BSTR bstr) +{ + return KURL(KURL(), toString(bstr)); +} + static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR* patterns) { // Convert the patterns into a Vector. @@ -5476,17 +5518,21 @@ static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR* return 0; Vector<String>* patternsVector = new Vector<String>; for (unsigned i = 0; i < patternsCount; ++i) - patternsVector->append(String(patterns[i], SysStringLen(patterns[i]))); + patternsVector->append(toString(patterns[i])); return patternsVector; } -HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, +HRESULT WebView::addUserScriptToGroup(BSTR groupName, IWebScriptWorld* iWorld, BSTR source, BSTR url, unsigned whitelistCount, BSTR* whitelist, unsigned blacklistCount, BSTR* blacklist, WebUserScriptInjectionTime injectionTime) { - String group(groupName, SysStringLen(groupName)); - if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_POINTER; + + String group = toString(groupName); + if (group.isEmpty()) return E_INVALIDARG; PageGroup* pageGroup = PageGroup::pageGroup(group); @@ -5494,19 +5540,23 @@ HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR sou if (!pageGroup) return E_FAIL; - pageGroup->addUserScriptToWorld(worldID, String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))), + pageGroup->addUserScriptToWorld(world->world(), toString(source), toKURL(url), toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist), injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd); return S_OK; } -HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, +HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, IWebScriptWorld* iWorld, BSTR source, BSTR url, unsigned whitelistCount, BSTR* whitelist, unsigned blacklistCount, BSTR* blacklist) { - String group(groupName, SysStringLen(groupName)); - if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_POINTER; + + String group = toString(groupName); + if (group.isEmpty()) return E_INVALIDARG; PageGroup* pageGroup = PageGroup::pageGroup(group); @@ -5514,16 +5564,20 @@ HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR if (!pageGroup) return E_FAIL; - pageGroup->addUserStyleSheetToWorld(worldID, String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))), + pageGroup->addUserStyleSheetToWorld(world->world(), toString(source), toKURL(url), toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist)); return S_OK; } -HRESULT WebView::removeUserScriptFromGroup(BSTR groupName, unsigned worldID, BSTR url) +HRESULT WebView::removeUserScriptFromGroup(BSTR groupName, IWebScriptWorld* iWorld, BSTR url) { - String group(groupName, SysStringLen(groupName)); - if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_POINTER; + + String group = toString(groupName); + if (group.isEmpty()) return E_INVALIDARG; PageGroup* pageGroup = PageGroup::pageGroup(group); @@ -5531,15 +5585,19 @@ HRESULT WebView::removeUserScriptFromGroup(BSTR groupName, unsigned worldID, BST if (!pageGroup) return E_FAIL; - pageGroup->removeUserScriptFromWorld(worldID, KURL(KURL(), String(url, SysStringLen(url)))); + pageGroup->removeUserScriptFromWorld(world->world(), toKURL(url)); return S_OK; } -HRESULT WebView::removeUserStyleSheetFromGroup(BSTR groupName, unsigned worldID, BSTR url) +HRESULT WebView::removeUserStyleSheetFromGroup(BSTR groupName, IWebScriptWorld* iWorld, BSTR url) { - String group(groupName, SysStringLen(groupName)); - if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_POINTER; + + String group = toString(groupName); + if (group.isEmpty()) return E_INVALIDARG; PageGroup* pageGroup = PageGroup::pageGroup(group); @@ -5547,15 +5605,19 @@ HRESULT WebView::removeUserStyleSheetFromGroup(BSTR groupName, unsigned worldID, if (!pageGroup) return E_FAIL; - pageGroup->removeUserStyleSheetFromWorld(worldID, KURL(KURL(), String(url, SysStringLen(url)))); + pageGroup->removeUserStyleSheetFromWorld(world->world(), toKURL(url)); return S_OK; } -HRESULT WebView::removeUserScriptsFromGroup(BSTR groupName, unsigned worldID) +HRESULT WebView::removeUserScriptsFromGroup(BSTR groupName, IWebScriptWorld* iWorld) { - String group(groupName, SysStringLen(groupName)); - if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_POINTER; + + String group = toString(groupName); + if (group.isEmpty()) return E_INVALIDARG; PageGroup* pageGroup = PageGroup::pageGroup(group); @@ -5563,14 +5625,18 @@ HRESULT WebView::removeUserScriptsFromGroup(BSTR groupName, unsigned worldID) if (!pageGroup) return E_FAIL; - pageGroup->removeUserScriptsFromWorld(worldID); + pageGroup->removeUserScriptsFromWorld(world->world()); return S_OK; } -HRESULT WebView::removeUserStyleSheetsFromGroup(BSTR groupName, unsigned worldID) +HRESULT WebView::removeUserStyleSheetsFromGroup(BSTR groupName, IWebScriptWorld* iWorld) { - String group(groupName, SysStringLen(groupName)); - if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + COMPtr<WebScriptWorld> world(Query, iWorld); + if (!world) + return E_POINTER; + + String group = toString(groupName); + if (group.isEmpty()) return E_INVALIDARG; PageGroup* pageGroup = PageGroup::pageGroup(group); @@ -5578,13 +5644,13 @@ HRESULT WebView::removeUserStyleSheetsFromGroup(BSTR groupName, unsigned worldID if (!pageGroup) return E_FAIL; - pageGroup->removeUserStyleSheetsFromWorld(worldID); + pageGroup->removeUserStyleSheetsFromWorld(world->world()); return S_OK; } HRESULT WebView::removeAllUserContentFromGroup(BSTR groupName) { - String group(groupName, SysStringLen(groupName)); + String group = toString(groupName); if (group.isEmpty()) return E_INVALIDARG; @@ -5663,6 +5729,70 @@ void WebView::downloadURL(const KURL& url) download->start(); } +#if USE(ACCELERATED_COMPOSITING) +void WebView::setRootChildLayer(WebCore::PlatformLayer* layer) +{ + setAcceleratedCompositing(layer ? true : false); + if (m_layerRenderer) + m_layerRenderer->setRootChildLayer(layer); +} + +void WebView::setAcceleratedCompositing(bool accelerated) +{ + if (m_isAcceleratedCompositing == accelerated || !WKCACFLayerRenderer::acceleratedCompositingAvailable()) + return; + + if (accelerated) { + m_layerRenderer = WKCACFLayerRenderer::create(); + if (m_layerRenderer) { + m_isAcceleratedCompositing = true; + + // Create the root layer + ASSERT(m_viewWindow); + m_layerRenderer->setHostWindow(m_viewWindow); + updateRootLayerContents(); + } + } else { + m_layerRenderer = 0; + m_isAcceleratedCompositing = false; + } +} + +void WebView::updateRootLayerContents() +{ + if (!m_backingStoreBitmap || !m_layerRenderer) + return; + + // Get the backing store into a CGImage + BITMAP bitmap; + GetObject(m_backingStoreBitmap.get(), sizeof(bitmap), &bitmap); + int bmSize = bitmap.bmWidthBytes * bitmap.bmHeight; + RetainPtr<CFDataRef> data(AdoptCF, + CFDataCreateWithBytesNoCopy( + 0, static_cast<UInt8*>(bitmap.bmBits), + bmSize, kCFAllocatorNull)); + RetainPtr<CGDataProviderRef> cgData(AdoptCF, CGDataProviderCreateWithCFData(data.get())); + RetainPtr<CGColorSpaceRef> space(AdoptCF, CGColorSpaceCreateDeviceRGB()); + RetainPtr<CGImageRef> backingStoreImage(AdoptCF, CGImageCreate(bitmap.bmWidth, bitmap.bmHeight, + 8, bitmap.bmBitsPixel, + bitmap.bmWidthBytes, space.get(), + kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, + cgData.get(), 0, false, + kCGRenderingIntentDefault)); + + // Hand the CGImage to CACF for compositing + m_layerRenderer->setRootContents(backingStoreImage.get()); + + // Set the frame and scroll position + Frame* coreFrame = core(m_mainFrame); + if (!coreFrame) + return; + FrameView* frameView = coreFrame->view(); + + m_layerRenderer->setScrollFrame(frameView->layoutWidth(), frameView->layoutHeight(), + frameView->scrollX(), frameView->scrollY()); +} +#endif HRESULT STDMETHODCALLTYPE WebView::setPluginHalterDelegate(IWebPluginHalterDelegate* d) { diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h index b4c1239..4bdc98f 100644 --- a/WebKit/win/WebView.h +++ b/WebKit/win/WebView.h @@ -34,6 +34,8 @@ #include <WebCore/IntRect.h> #include <WebCore/Timer.h> #include <WebCore/WindowMessageListener.h> +#include <WebCore/WKCACFLayer.h> +#include <WebCore/WKCACFLayerRenderer.h> #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> @@ -740,17 +742,17 @@ public: virtual HRESULT STDMETHODCALLTYPE setCanStartPlugins( /* [in] */ BOOL canStartPlugins); - virtual HRESULT STDMETHODCALLTYPE addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, + virtual HRESULT STDMETHODCALLTYPE addUserScriptToGroup(BSTR groupName, IWebScriptWorld*, BSTR source, BSTR url, unsigned whitelistCount, BSTR* whitelist, unsigned blacklistCount, BSTR* blacklist, WebUserScriptInjectionTime); - virtual HRESULT STDMETHODCALLTYPE addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, + virtual HRESULT STDMETHODCALLTYPE addUserStyleSheetToGroup(BSTR groupName, IWebScriptWorld*, BSTR source, BSTR url, unsigned whitelistCount, BSTR* whitelist, unsigned blacklistCount, BSTR* blacklist); - virtual HRESULT STDMETHODCALLTYPE removeUserScriptFromGroup(BSTR groupName, unsigned worldID, BSTR url); - virtual HRESULT STDMETHODCALLTYPE removeUserStyleSheetFromGroup(BSTR groupName, unsigned worldID, BSTR url); - virtual HRESULT STDMETHODCALLTYPE removeUserScriptsFromGroup(BSTR groupName, unsigned worldID); - virtual HRESULT STDMETHODCALLTYPE removeUserStyleSheetsFromGroup(BSTR groupName, unsigned worldID); + virtual HRESULT STDMETHODCALLTYPE removeUserScriptFromGroup(BSTR groupName, IWebScriptWorld*, BSTR url); + virtual HRESULT STDMETHODCALLTYPE removeUserStyleSheetFromGroup(BSTR groupName, IWebScriptWorld*, BSTR url); + virtual HRESULT STDMETHODCALLTYPE removeUserScriptsFromGroup(BSTR groupName, IWebScriptWorld*); + virtual HRESULT STDMETHODCALLTYPE removeUserStyleSheetsFromGroup(BSTR groupName, IWebScriptWorld*); virtual HRESULT STDMETHODCALLTYPE removeAllUserContentFromGroup(BSTR groupName); virtual HRESULT STDMETHODCALLTYPE setPluginHalterDelegate(IWebPluginHalterDelegate*); @@ -861,6 +863,11 @@ public: void downloadURL(const WebCore::KURL&); +#if USE(ACCELERATED_COMPOSITING) + void setRootLayerNeedsDisplay() { if (m_layerRenderer) m_layerRenderer->setNeedsDisplay(); } + void setRootChildLayer(WebCore::PlatformLayer* layer); +#endif + private: void setZoomMultiplier(float multiplier, bool isTextOnly); float zoomMultiplier(bool isTextOnly); @@ -885,6 +892,9 @@ private: DWORD m_lastDropEffect; protected: + static bool registerWebViewWindowClass(); + static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + HIMC getIMMContext(); void releaseIMMContext(HIMC); static bool allowSiteSpecificHacks() { return s_allowSiteSpecificHacks; } @@ -970,6 +980,17 @@ protected: long m_lastPanY; long m_xOverpan; long m_yOverpan; + +#if USE(ACCELERATED_COMPOSITING) + bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; } + void setAcceleratedCompositing(bool); + void updateRootLayerContents(); + void resizeLayerRenderer() { m_layerRenderer->resize(); } + void layerRendererBecameVisible() { m_layerRenderer->createRenderer(); } + + OwnPtr<WebCore::WKCACFLayerRenderer> m_layerRenderer; + bool m_isAcceleratedCompositing; +#endif }; #endif |