summaryrefslogtreecommitdiffstats
path: root/WebKit/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac')
-rw-r--r--WebKit/mac/ChangeLog294
-rw-r--r--WebKit/mac/Misc/WebKitStatistics.h3
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm5
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h39
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm180
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm16
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm4
-rw-r--r--WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs2
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.h3
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm22
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.h3
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm13
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.h1
-rw-r--r--WebKit/mac/WebCoreSupport/WebChromeClient.mm5
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h1
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm8
-rw-r--r--WebKit/mac/WebView/WebDataSource.mm20
-rw-r--r--WebKit/mac/WebView/WebFrame.mm39
-rw-r--r--WebKit/mac/WebView/WebFrameInternal.h3
-rw-r--r--WebKit/mac/WebView/WebFrameView.mm24
-rw-r--r--WebKit/mac/WebView/WebHTMLRepresentation.mm19
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm22
-rw-r--r--WebKit/mac/WebView/WebPreferenceKeysPrivate.h1
-rw-r--r--WebKit/mac/WebView/WebPreferences.mm11
-rw-r--r--WebKit/mac/WebView/WebPreferencesPrivate.h3
-rw-r--r--WebKit/mac/WebView/WebView.mm57
-rw-r--r--WebKit/mac/WebView/WebViewData.h2
-rw-r--r--WebKit/mac/WebView/WebViewInternal.h2
-rw-r--r--WebKit/mac/WebView/WebViewPrivate.h7
29 files changed, 679 insertions, 130 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index b545a40..e1d0cc3 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,297 @@
+2010-02-19 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
+
+ Followup to avoid capturing compositing layers twice in snapshots. Add private
+ methods to WebView to specify whether drawing the WebView into an image will
+ include flattened compositing layers (the default behavior) or not.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _drawRect:contentsOnly:]): Consult the WebView flag to see if we
+ want flattening.
+
+ * WebView/WebViewPrivate.h: New methods.
+ * WebView/WebView.mm: Ditto.
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ (-[WebView _setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:]):
+ (-[WebView _includesFlattenedCompositingLayersWhenDrawingToBitmap]):
+
+ * WebView/WebViewData.h: New member variable.
+
+2010-02-19 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35165
+ plugins/set-status.html fails on Windows bot
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::status):
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView status:]):
+ Match Windows port behavior (and also Firefox one, in a way) - pass null status messages as
+ empty ones to chrome.
+
+2010-02-18 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
+
+ Add logic to determine when painting via the software rendering path will give an equivalent
+ result to the accelerated compositing presentation. This tests for the presence of 3D transforms.
+
+ Also have -[WebFrame _drawRect:contentsOnly:] set the PaintBehaviorFlattenCompositingLayers
+ paint behavior when painting into a bitmap context, so that snapshots contain composited layers.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _drawRect:contentsOnly:]): Set the PaintBehaviorFlattenCompositingLayers flag
+ when painting into a bitmap context.
+ * WebView/WebView.mm:
+ (-[WebView _isSoftwareRenderable]): Returns YES if all frames can be software-rendered.
+ * WebView/WebViewPrivate.h: New _isSoftwareRenderable method.
+
+2010-02-18 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35134
+ <rdar://problem/7246280> Crash when a plugin calls NPN_SetStatus(0)
+
+ Test: plugins/set-status.html
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::status):
+ (WebKit::NetscapePluginInstanceProxy::loadURL):
+ Added null checks for CFStringCreateWithCString arguments.
+
+2010-02-17 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by David Levin, Darin Fisher, Simon Hausmann.
+
+ When a live iframe element is moved between pages, it still depends on the old page.
+ https://bugs.webkit.org/show_bug.cgi?id=34382
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ Added empty implementation of a new virtual method.
+
+ (WebFrameLoaderClient::didTransferChildFrameToNewDocument):
+
+2010-02-17 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Introduces new Icon loading interface in order to support
+ asynchronous loading.
+ https://bugs.webkit.org/show_bug.cgi?id=32054
+
+ Add an empty implementation of ChromeClient::iconForFiles().
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::iconForFiles):
+
+2010-02-17 Timothy Hatcher <timothy@apple.com>
+
+ Add a way for WebView and its dependancies to be selectively included
+ in WebKitStatistics leak tracking. By default WebView is not included and
+ you need to subclass WebView and implement +isIncludedInWebKitStatistics
+ to be included.
+
+ rdar://problem/7567677&7572900
+ https://webkit.org/b/35045
+
+ Reviewed by Adam Roben.
+
+ * WebView/WebDataSource.mm:
+ (-[WebDataSource _initWithDocumentLoader:]): Increment WebDataSourceCount if the WebFrame is included in statistics.
+ (-[WebDataSource dealloc]): Only --WebDataSourceCount if _private->includedInWebKitStatistics is YES.
+ (-[WebDataSource finalize]): Ditto.
+ * WebView/WebFrame.mm:
+ (-[WebFrame _isIncludedInWebKitStatistics]): Return _private->includedInWebKitStatistics.
+ (-[WebFrame _initWithWebFrameView:webView:]): Increment WebFrameCount if the WebView's class is included in statistics.
+ (-[WebFrame dealloc]): Only --WebFrameCount if _private->includedInWebKitStatistics is YES.
+ (-[WebFrame finalize]): Ditto.
+ * WebView/WebFrameInternal.h:
+ * WebView/WebFrameView.mm:
+ (-[WebFrameView _setWebFrame:]): Increment WebFrameViewCount if the WebFrame is included in statistics.
+ (-[WebFrameView initWithFrame:]): Move ++WebFrameViewCount from here since we don't
+ know what WebFrame we belong to yet.
+ (-[WebFrameView dealloc]): Only --WebFrameViewCount if _private->includedInWebKitStatistics is YES.
+ (-[WebFrameView finalize]): Ditto.
+ * WebView/WebHTMLRepresentation.mm:
+ (-[WebHTMLRepresentation init]): Move ++WebHTMLRepresentationCount from here since we don't
+ know what WebFrame we belong to yet.
+ (-[WebHTMLRepresentation dealloc]): Only --WebHTMLRepresentationCount if _private->includedInWebKitStatistics is YES.
+ (-[WebHTMLRepresentation finalize]): Ditto.
+ (-[WebHTMLRepresentation setDataSource:]): Increment WebHTMLRepresentationCount if the WebFrame of the dataSource is
+ included in statistics.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ (-[WebView dealloc]):
+ (+[WebView shouldIncludeInWebKitStatistics]): Return NO, so any WebView wont be included.
+ Subclasses that care can return YES to be included.
+ * WebView/WebViewInternal.h:
+
+2010-02-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Generalize delayed plug-in start for background tabs for use for other media
+ https://bugs.webkit.org/show_bug.cgi?id=34981
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView viewWillMoveToWindow:]): Added comment.
+ (-[WebHTMLView viewDidMoveToWindow]): Ditto.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ Call setCanStartMedia right away so that if this view is not in a window, it
+ will not start any media.
+ (-[WebView viewWillMoveToWindow:]): Call setCanStartMedia(false) when moving
+ to a window of nil.
+ (-[WebView viewDidMoveToWindow]): Call setCanStartMedia(true) when moved to
+ a window that is non-nil.
+
+2010-02-16 Eric Carlson <eric.carlson@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34988
+ WebHTMLView.mm has two -willRemoveSubview: methods
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView willRemoveSubview:]): Consolidate the two copies of this method.
+
+2010-02-16 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Geoffrey Garen and Kevin Decker.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34989
+ <rdar://problem/7417965> Cursor disappears on scroll bars that are over plugin content
+
+ This fixes event dispatch for both Cocoa and Carbon event models (mouseEntered/mouseExited
+ in the former case, and adjustCursor in the latter).
+
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView handleMouseEntered:]):
+ (-[WebHostedNetscapePluginView handleMouseExited:]):
+ * Plugins/WebBaseNetscapePluginView.h:
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView handleMouseEntered:]):
+ (-[WebBaseNetscapePluginView handleMouseExited:]):
+ * Plugins/WebNetscapePluginView.h:
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView handleMouseEntered:]):
+ (-[WebNetscapePluginView handleMouseExited:]):
+ AppKit cannot reliably dispatch events for overlapping views. We are now asking WebCore to
+ notify plug-in views of mouse entered/exited as part of DOM event dispatch.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm: (NetscapePluginWidget::handleEvent): Besides
+ mouse moved, dispatch plugin mouse entered/exit events in HTMLPlugInElement default event
+ handler. Other mouse events are passed down by EventHandler.
+
+2010-02-15 Alexey Proskuryakov <ap@apple.com>
+
+ More build fixing (for what is actually a 64-bit failure, as 32-bit apparently includes
+ headers that aren't included in 64-bit).
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::contains):
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::get):
+ Move inline functions to .cpp; also made the class Noncopyable.
+
+2010-02-15 Alexey Proskuryakov <ap@apple.com>
+
+ Mac release build fix attempt.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::~LocalObjectMap):
+ Implement destructor in .cpp file, where necessary headers are already included.
+
+2010-02-12 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ <rdar://problem/7130641> Browser objects identity is not preserved by Safari
+
+ Out of process part.
+
+ To avoid excessive IPC, plugin process doesn't send each NPObject release/retain call to
+ Safari. It only sends one when the last one is removed, and it can destroy the proxy
+ NPObject.
+
+ However, the browser may be sending the same object out to plug-in as a function call
+ argument at the same time - neither side can know what the other one is up to. The solution
+ is to make the "destroying object" call return a boolean result, making it possible for
+ the browser to make plugin host keep the proxy with zero refcount for a little longer.
+
+ * Plugins/Hosted/NetscapePluginHostProxy.mm:
+ (WKPCForgetBrowserObject): This function (that used to be named ReleaseObject) is only
+ called when plug-in releases all of its references, so renamed it. Its boolean result
+ is returned as call success or failure.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap): Made the numeric ID to JSObject map
+ two-way.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::idForObject): This method is tricky
+ in that it creates objects with refcount of 1, but doesn't increase refcount when returning
+ found objects. This extra count accounts for the "reference" kept by plugin process.
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::retain): Only retaining for the
+ duration of calls out to plug-in, which means that refcount is almost always equal to 1.
+ Note that we can't use "++" here, due to how std::pair works!
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::release): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::clear): Clear all references when
+ stopping plug-in.
+ (WebKit::NetscapePluginInstanceProxy::LocalObjectMap::forget): Like release(), but only
+ functional when recount is 1 (meaning that the object is not being sent out to plug-in at
+ the moment).
+ (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy): Updated for other changes.
+ (WebKit::NetscapePluginInstanceProxy::cleanup): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::getWindowNPObject): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::getPluginElementNPObject): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::forgetBrowserObjectID): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::evaluate): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::invoke): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::invokeDefault): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::construct): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::getProperty): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::setProperty): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::removeProperty): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::hasProperty): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::hasMethod): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::enumerate): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::addValueToArray): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray): Ditto.
+ (WebKit::NetscapePluginInstanceProxy::retainLocalObject): Helper for calling retain when
+ making calls out to plug-in. No-op for objects that aren't wrapped to be sent (i.e. for
+ objects wrapping ProxyInstance wrappers for plug-in objects being sent bak).
+ (WebKit::NetscapePluginInstanceProxy::releaseLocalObject): Ditto.
+
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::invoke): Retain/release arguments during call.
+ (WebKit::ProxyInstance::setFieldValue): Ditto.
+
+ * Plugins/Hosted/WebKitPluginClient.defs: Renamed PCReleaseObject to PCForgetBrowserObject.
+
+2010-02-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed unneeded custom implementation of isDescendantOf.
+
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView shouldClipOutPlugin]): Use the
+ -[NSView isDescendantOf:] method instead of our own method
+ named superviewsHaveSuperviews.
+
2010-02-12 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
diff --git a/WebKit/mac/Misc/WebKitStatistics.h b/WebKit/mac/Misc/WebKitStatistics.h
index 32241b5..040a40b 100644
--- a/WebKit/mac/Misc/WebKitStatistics.h
+++ b/WebKit/mac/Misc/WebKitStatistics.h
@@ -28,6 +28,9 @@
#import <Foundation/Foundation.h>
+// These values are only incremented and decremented if the WebView is subclassed and
+// +[WebView shouldIncludeInWebKitStatistics] returns YES. By default WebView returns NO.
+
@interface WebKitStatistics : NSObject
+ (int)webViewCount;
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
index c5beb07..836277c 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
@@ -546,7 +546,7 @@ kern_return_t WKPCGetPluginElementNPObject(mach_port_t clientPort, uint32_t plug
return KERN_SUCCESS;
}
-kern_return_t WKPCReleaseObject(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID)
+kern_return_t WKPCForgetBrowserObject(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID)
{
NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
if (!hostProxy)
@@ -556,8 +556,7 @@ kern_return_t WKPCReleaseObject(mach_port_t clientPort, uint32_t pluginID, uint3
if (!instanceProxy)
return KERN_FAILURE;
- instanceProxy->releaseObject(objectID);
- return KERN_SUCCESS;
+ return instanceProxy->forgetBrowserObjectID(objectID) ? KERN_SUCCESS : KERN_FAILURE;
}
kern_return_t WKPCEvaluate(mach_port_t clientPort, uint32_t pluginID, uint32_t requestID, uint32_t objectID, data_t scriptData, mach_msg_type_number_t scriptLength, boolean_t allowPopups)
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 76981a4..29a5a2d 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -111,8 +111,8 @@ public:
// NPRuntime
bool getWindowNPObject(uint32_t& objectID);
bool getPluginElementNPObject(uint32_t& objectID);
- void releaseObject(uint32_t objectID);
-
+ bool forgetBrowserObjectID(uint32_t objectID); // Will fail if the ID is being sent to plug-in right now (i.e., retain/release calls aren't balanced).
+
bool evaluate(uint32_t objectID, const WebCore::String& script, data_t& resultData, mach_msg_type_number_t& resultLength, bool allowPopups);
bool invoke(uint32_t objectID, const JSC::Identifier& methodName, data_t argumentsData, mach_msg_type_number_t argumentsLength, data_t& resultData, mach_msg_type_number_t& resultLength);
bool invokeDefault(uint32_t objectID, data_t argumentsData, mach_msg_type_number_t argumentsLength, data_t& resultData, mach_msg_type_number_t& resultLength);
@@ -143,9 +143,13 @@ public:
PassRefPtr<JSC::Bindings::Instance> createBindingsInstance(PassRefPtr<JSC::Bindings::RootObject>);
RetainPtr<NSData *> marshalValues(JSC::ExecState*, const JSC::ArgList& args);
- void marshalValue(JSC::ExecState*, JSC::JSValue value, data_t& resultData, mach_msg_type_number_t& resultLength);
+ void marshalValue(JSC::ExecState*, JSC::JSValue, data_t& resultData, mach_msg_type_number_t& resultLength);
JSC::JSValue demarshalValue(JSC::ExecState*, const char* valueData, mach_msg_type_number_t valueLength);
+ // No-op if the value does not contain a local object.
+ void retainLocalObject(JSC::JSValue);
+ void releaseLocalObject(JSC::JSValue);
+
void addInstance(ProxyInstance*);
void removeInstance(ProxyInstance*);
@@ -300,17 +304,34 @@ private:
HashMap<uint32_t, Reply*> m_replies;
// NPRuntime
- uint32_t idForObject(JSC::JSObject*);
-
+
void addValueToArray(NSMutableArray *, JSC::ExecState* exec, JSC::JSValue value);
bool demarshalValueFromArray(JSC::ExecState*, NSArray *array, NSUInteger& index, JSC::JSValue& result);
void demarshalValues(JSC::ExecState*, data_t valuesData, mach_msg_type_number_t valuesLength, JSC::MarkedArgumentBuffer& result);
- uint32_t m_objectIDCounter;
- typedef HashMap<uint32_t, JSC::ProtectedPtr<JSC::JSObject> > ObjectMap;
- ObjectMap m_objects;
-
+ class LocalObjectMap : Noncopyable {
+ public:
+ LocalObjectMap();
+ ~LocalObjectMap();
+ uint32_t idForObject(JSC::JSObject*);
+ void retain(JSC::JSObject*);
+ void release(JSC::JSObject*);
+ void clear();
+ bool forget(uint32_t);
+ bool contains(uint32_t) const;
+ JSC::JSObject* get(uint32_t) const;
+
+ private:
+ HashMap<uint32_t, JSC::ProtectedPtr<JSC::JSObject> > m_idToJSObjectMap;
+ // The pair consists of object ID and a reference count. One reference belongs to remote plug-in,
+ // and the proxy will add transient references for arguments that are being sent out.
+ HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> > m_jsObjectToIDMap;
+ uint32_t m_objectIDCounter;
+ };
+
+ LocalObjectMap m_localObjects;
+
typedef HashSet<ProxyInstance*> ProxyInstanceSet;
ProxyInstanceSet m_instances;
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index c09e3ea..515f9f7 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -100,6 +100,98 @@ private:
bool m_allowPopups;
};
+NetscapePluginInstanceProxy::LocalObjectMap::LocalObjectMap()
+ : m_objectIDCounter(0)
+{
+}
+
+NetscapePluginInstanceProxy::LocalObjectMap::~LocalObjectMap()
+{
+}
+
+inline bool NetscapePluginInstanceProxy::LocalObjectMap::contains(uint32_t objectID) const
+{
+ return m_idToJSObjectMap.contains(objectID);
+}
+
+inline JSC::JSObject* NetscapePluginInstanceProxy::LocalObjectMap::get(uint32_t objectID) const
+{
+ return m_idToJSObjectMap.get(objectID);
+}
+
+uint32_t NetscapePluginInstanceProxy::LocalObjectMap::idForObject(JSObject* object)
+{
+ // This method creates objects with refcount of 1, but doesn't increase refcount when returning
+ // found objects. This extra count accounts for the main "reference" kept by plugin process.
+
+ // To avoid excessive IPC, plugin process doesn't send each NPObject release/retain call to
+ // Safari. It only sends one when the last reference is removed, and it can destroy the proxy
+ // NPObject.
+
+ // However, the browser may be sending the same object out to plug-in as a function call
+ // argument at the same time - neither side can know what the other one is doing. So,
+ // is to make PCForgetBrowserObject call return a boolean result, making it possible for
+ // the browser to make plugin host keep the proxy with zero refcount for a little longer.
+
+ uint32_t objectID = 0;
+
+ HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> >::iterator iter = m_jsObjectToIDMap.find(object);
+ if (iter != m_jsObjectToIDMap.end())
+ return iter->second.first;
+
+ do {
+ objectID = ++m_objectIDCounter;
+ } while (!m_objectIDCounter || m_objectIDCounter == static_cast<uint32_t>(-1) || m_idToJSObjectMap.contains(objectID));
+
+ m_idToJSObjectMap.set(objectID, object);
+ m_jsObjectToIDMap.set(object, make_pair<uint32_t, uint32_t>(objectID, 1));
+
+ return objectID;
+}
+
+void NetscapePluginInstanceProxy::LocalObjectMap::retain(JSC::JSObject* object)
+{
+ HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> >::iterator iter = m_jsObjectToIDMap.find(object);
+ ASSERT(iter != m_jsObjectToIDMap.end());
+
+ iter->second.second = iter->second.second + 1;
+}
+
+void NetscapePluginInstanceProxy::LocalObjectMap::release(JSC::JSObject* object)
+{
+ HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> >::iterator iter = m_jsObjectToIDMap.find(object);
+ ASSERT(iter != m_jsObjectToIDMap.end());
+
+ ASSERT(iter->second.second > 0);
+ iter->second.second = iter->second.second - 1;
+ if (!iter->second.second) {
+ m_idToJSObjectMap.remove(iter->second.first);
+ m_jsObjectToIDMap.remove(iter);
+ }
+}
+
+void NetscapePluginInstanceProxy::LocalObjectMap::clear()
+{
+ m_idToJSObjectMap.clear();
+ m_jsObjectToIDMap.clear();
+}
+
+bool NetscapePluginInstanceProxy::LocalObjectMap::forget(uint32_t objectID)
+{
+ HashMap<uint32_t, JSC::ProtectedPtr<JSC::JSObject> >::iterator iter = m_idToJSObjectMap.find(objectID);
+ ASSERT(iter != m_idToJSObjectMap.end());
+
+ HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> >::iterator rIter = m_jsObjectToIDMap.find(iter->second.get());
+
+ // If the object is being sent to plug-in right now, then it's not the time to forget.
+ if (rIter->second.second != 1)
+ return false;
+
+ m_jsObjectToIDMap.remove(rIter);
+ m_idToJSObjectMap.remove(iter);
+ return true;
+}
+
static uint32_t pluginIDCounter;
#ifndef NDEBUG
@@ -114,7 +206,6 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
, m_renderContextID(0)
, m_useSoftwareRenderer(false)
, m_waitingForReply(false)
- , m_objectIDCounter(0)
, m_urlCheckCounter(0)
, m_pluginFunctionCallDepth(0)
, m_shouldStopSoon(false)
@@ -185,7 +276,7 @@ void NetscapePluginInstanceProxy::cleanup()
// Clear the object map, this will cause any outstanding JS objects that the plug-in had a reference to
// to go away when the next garbage collection takes place.
- m_objects.clear();
+ m_localObjects.clear();
if (Frame* frame = core([m_pluginView webFrame]))
frame->script()->cleanupScriptObjectsForPlugin(m_pluginView);
@@ -413,11 +504,10 @@ void NetscapePluginInstanceProxy::stopTimers()
void NetscapePluginInstanceProxy::status(const char* message)
{
- RetainPtr<CFStringRef> status(AdoptCF, CFStringCreateWithCString(NULL, message, kCFStringEncodingUTF8));
-
+ RetainPtr<CFStringRef> status(AdoptCF, CFStringCreateWithCString(0, message ? message : "", kCFStringEncodingUTF8));
if (!status)
return;
-
+
WebView *wv = [m_pluginView webView];
[[wv _UIDelegateForwarder] webView:wv setStatusText:(NSString *)status.get()];
}
@@ -434,6 +524,8 @@ NPError NetscapePluginInstanceProxy::loadURL(const char* url, const char* target
if (flags & PostDataIsFile) {
// If we're posting a file, buf is either a file URL or a path to the file.
+ if (!postData)
+ return NPERR_INVALID_PARAM;
RetainPtr<CFStringRef> bufString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, postData, kCFStringEncodingWindowsLatin1));
if (!bufString)
return NPERR_INVALID_PARAM;
@@ -683,20 +775,6 @@ NetscapePluginInstanceProxy::Reply* NetscapePluginInstanceProxy::processRequests
return reply;
}
-uint32_t NetscapePluginInstanceProxy::idForObject(JSObject* object)
-{
- uint32_t objectID = 0;
-
- // Assign an object ID.
- do {
- objectID = ++m_objectIDCounter;
- } while (!m_objectIDCounter || m_objectIDCounter == static_cast<uint32_t>(-1) || m_objects.contains(objectID));
-
- m_objects.set(objectID, object);
-
- return objectID;
-}
-
// NPRuntime support
bool NetscapePluginInstanceProxy::getWindowNPObject(uint32_t& objectID)
{
@@ -707,7 +785,7 @@ bool NetscapePluginInstanceProxy::getWindowNPObject(uint32_t& objectID)
if (!frame->script()->canExecuteScripts())
objectID = 0;
else
- objectID = idForObject(frame->script()->windowShell(pluginWorld())->window());
+ objectID = m_localObjects.idForObject(frame->script()->windowShell(pluginWorld())->window());
return true;
}
@@ -719,16 +797,16 @@ bool NetscapePluginInstanceProxy::getPluginElementNPObject(uint32_t& objectID)
return false;
if (JSObject* object = frame->script()->jsObjectForPluginElement([m_pluginView element]))
- objectID = idForObject(object);
+ objectID = m_localObjects.idForObject(object);
else
objectID = 0;
return true;
}
-void NetscapePluginInstanceProxy::releaseObject(uint32_t objectID)
+bool NetscapePluginInstanceProxy::forgetBrowserObjectID(uint32_t objectID)
{
- m_objects.remove(objectID);
+ return m_localObjects.forget(objectID);
}
bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& script, data_t& resultData, mach_msg_type_number_t& resultLength, bool allowPopups)
@@ -736,7 +814,7 @@ bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& scri
resultData = 0;
resultLength = 0;
- if (!m_objects.contains(objectID))
+ if (!m_localObjects.contains(objectID))
return false;
Frame* frame = core([m_pluginView webFrame]);
@@ -778,7 +856,7 @@ bool NetscapePluginInstanceProxy::invoke(uint32_t objectID, const Identifier& me
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -812,7 +890,7 @@ bool NetscapePluginInstanceProxy::invokeDefault(uint32_t objectID, data_t argume
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -845,7 +923,7 @@ bool NetscapePluginInstanceProxy::construct(uint32_t objectID, data_t argumentsD
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -879,7 +957,7 @@ bool NetscapePluginInstanceProxy::getProperty(uint32_t objectID, const Identifie
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -898,7 +976,7 @@ bool NetscapePluginInstanceProxy::getProperty(uint32_t objectID, const Identifie
bool NetscapePluginInstanceProxy::getProperty(uint32_t objectID, unsigned propertyName, data_t& resultData, mach_msg_type_number_t& resultLength)
{
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -920,7 +998,7 @@ bool NetscapePluginInstanceProxy::setProperty(uint32_t objectID, const Identifie
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -944,7 +1022,7 @@ bool NetscapePluginInstanceProxy::setProperty(uint32_t objectID, unsigned proper
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -967,7 +1045,7 @@ bool NetscapePluginInstanceProxy::removeProperty(uint32_t objectID, const Identi
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -992,7 +1070,7 @@ bool NetscapePluginInstanceProxy::removeProperty(uint32_t objectID, unsigned pro
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -1017,7 +1095,7 @@ bool NetscapePluginInstanceProxy::hasProperty(uint32_t objectID, const Identifie
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -1037,7 +1115,7 @@ bool NetscapePluginInstanceProxy::hasProperty(uint32_t objectID, unsigned proper
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -1057,7 +1135,7 @@ bool NetscapePluginInstanceProxy::hasMethod(uint32_t objectID, const Identifier&
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -1077,7 +1155,7 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
if (m_inDestroy)
return false;
- JSObject* object = m_objects.get(objectID);
+ JSObject* object = m_localObjects.get(objectID);
if (!object)
return false;
@@ -1136,7 +1214,7 @@ void NetscapePluginInstanceProxy::addValueToArray(NSMutableArray *array, ExecSta
}
} else {
[array addObject:[NSNumber numberWithInt:JSObjectValueType]];
- [array addObject:[NSNumber numberWithInt:idForObject(object)]];
+ [array addObject:[NSNumber numberWithInt:m_localObjects.idForObject(object)]];
}
} else
[array addObject:[NSNumber numberWithInt:VoidValueType]];
@@ -1198,7 +1276,7 @@ bool NetscapePluginInstanceProxy::demarshalValueFromArray(ExecState* exec, NSArr
case JSObjectValueType: {
uint32_t objectID = [[array objectAtIndex:index++] intValue];
- result = m_objects.get(objectID);
+ result = m_localObjects.get(objectID);
ASSERT(result);
return true;
}
@@ -1255,6 +1333,30 @@ void NetscapePluginInstanceProxy::demarshalValues(ExecState* exec, data_t values
result.append(value);
}
+void NetscapePluginInstanceProxy::retainLocalObject(JSC::JSValue value)
+{
+ if (!value.isObject())
+ return;
+
+ JSObject* object = asObject(value);
+ if (object->classInfo() == &RuntimeObjectImp::s_info)
+ return;
+
+ m_localObjects.retain(object);
+}
+
+void NetscapePluginInstanceProxy::releaseLocalObject(JSC::JSValue value)
+{
+ if (!value.isObject())
+ return;
+
+ JSObject* object = asObject(value);
+ if (object->classInfo() == &RuntimeObjectImp::s_info)
+ return;
+
+ m_localObjects.release(object);
+}
+
PassRefPtr<Instance> NetscapePluginInstanceProxy::createBindingsInstance(PassRefPtr<RootObject> rootObject)
{
uint32_t requestID = nextRequestID();
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 1587ad0..c7a0ebe 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -137,17 +137,27 @@ JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t id
{
if (!m_instanceProxy)
return jsUndefined();
-
+
RetainPtr<NSData*> arguments(m_instanceProxy->marshalValues(exec, args));
uint32_t requestID = m_instanceProxy->nextRequestID();
+ for (unsigned i = 0; i < args.size(); i++)
+ m_instanceProxy->retainLocalObject(args.at(i));
+
if (_WKPHNPObjectInvoke(m_instanceProxy->hostProxy()->port(), m_instanceProxy->pluginID(), requestID, m_objectID,
- type, identifier, (char*)[arguments.get() bytes], [arguments.get() length]) != KERN_SUCCESS)
+ type, identifier, (char*)[arguments.get() bytes], [arguments.get() length]) != KERN_SUCCESS) {
+ for (unsigned i = 0; i < args.size(); i++)
+ m_instanceProxy->releaseLocalObject(args.at(i));
return jsUndefined();
+ }
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
+
+ for (unsigned i = 0; i < args.size(); i++)
+ m_instanceProxy->releaseLocalObject(args.at(i));
+
if (!reply.get() || !reply->m_returnValue)
return jsUndefined();
@@ -381,10 +391,12 @@ void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue v
mach_msg_type_number_t valueLength;
m_instanceProxy->marshalValue(exec, value, valueData, valueLength);
+ m_instanceProxy->retainLocalObject(value);
kern_return_t kr = _WKPHNPObjectSetProperty(m_instanceProxy->hostProxy()->port(),
m_instanceProxy->pluginID(), requestID,
m_objectID, serverIdentifier, valueData, valueLength);
mig_deallocate(reinterpret_cast<vm_address_t>(valueData), valueLength);
+ m_instanceProxy->releaseLocalObject(value);
if (kr != KERN_SUCCESS)
return;
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 42f0877..0ad76f0 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -285,13 +285,13 @@ extern "C" {
_proxy->mouseEvent(self, event, NPCocoaEventMouseDragged);
}
-- (void)mouseEntered:(NSEvent *)event
+- (void)handleMouseEntered:(NSEvent *)event
{
if (_isStarted && _proxy)
_proxy->mouseEvent(self, event, NPCocoaEventMouseEntered);
}
-- (void)mouseExited:(NSEvent *)event
+- (void)handleMouseExited:(NSEvent *)event
{
if (_isStarted && _proxy)
_proxy->mouseEvent(self, event, NPCocoaEventMouseExited);
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
index 58a7996..6522bf7 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
@@ -112,7 +112,7 @@ routine PCGetPluginElementNPObject(clientPort :mach_port_t;
pluginID :uint32_t;
out objectID :uint32_t);
-routine PCReleaseObject(clientPort :mach_port_t;
+routine PCForgetBrowserObject(clientPort :mach_port_t;
pluginID :uint32_t;
objectID :uint32_t);
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index 029a058..18dc004 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -92,7 +92,10 @@ class WebHaltablePlugin;
- (NSMutableURLRequest *)requestWithURLCString:(const char *)URLCString;
// Subclasses must override these.
+// The "handle" prefix is needed to avoid overriding NSView methods.
- (void)handleMouseMoved:(NSEvent *)event;
+- (void)handleMouseEntered:(NSEvent *)event;
+- (void)handleMouseExited:(NSEvent *)event;
- (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
- (void)focusChanged;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index e93509a..04a42ea 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -232,6 +232,16 @@ String WebHaltablePlugin::pluginName() const
ASSERT_NOT_REACHED();
}
+- (void)handleMouseEntered:(NSEvent *)event
+{
+ ASSERT_NOT_REACHED();
+}
+
+- (void)handleMouseExited:(NSEvent *)event
+{
+ ASSERT_NOT_REACHED();
+}
+
- (void)focusChanged
{
ASSERT_NOT_REACHED();
@@ -545,20 +555,10 @@ String WebHaltablePlugin::pluginName() const
return _isHalted;
}
-- (BOOL)superviewsHaveSuperviews
-{
- NSView *contentView = [[self window] contentView];
- for (NSView *view = self; view; view = [view superview]) {
- if (view == contentView)
- return YES;
- }
- return NO;
-}
-
- (BOOL)shouldClipOutPlugin
{
NSWindow *window = [self window];
- return !window || [window isMiniaturized] || [NSApp isHidden] || ![self superviewsHaveSuperviews] || [self isHiddenOrHasHiddenAncestor];
+ return !window || [window isMiniaturized] || [NSApp isHidden] || ![self isDescendantOf:[[self window] contentView]] || [self isHiddenOrHasHiddenAncestor];
}
- (BOOL)hasBeenHalted
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.h b/WebKit/mac/Plugins/WebNetscapePluginView.h
index 2ee566e..5bc4467 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.h
@@ -143,6 +143,9 @@ typedef union PluginPort {
- (void)didCallPlugInFunction;
- (void)handleMouseMoved:(NSEvent *)event;
+- (void)handleMouseEntered:(NSEvent *)event;
+- (void)handleMouseExited:(NSEvent *)event;
+
- (uint32)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context;
- (void)cancelCheckIfAllowedToLoadURL:(uint32)checkID;
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index e96abe8..8fb1503 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -749,7 +749,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
_eventHandler->mouseUp(theEvent);
}
-- (void)mouseEntered:(NSEvent *)theEvent
+- (void)handleMouseEntered:(NSEvent *)theEvent
{
if (!_isStarted)
return;
@@ -757,7 +757,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
_eventHandler->mouseEntered(theEvent);
}
-- (void)mouseExited:(NSEvent *)theEvent
+- (void)handleMouseExited:(NSEvent *)theEvent
{
if (!_isStarted)
return;
@@ -769,8 +769,6 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
[[NSCursor arrowCursor] set];
}
-// We can't name this method mouseMoved because we don't want to override
-// the NSView mouseMoved implementation.
- (void)handleMouseMoved:(NSEvent *)theEvent
{
if (!_isStarted)
@@ -1906,12 +1904,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
-(void)status:(const char *)message
{
- if (!message) {
- LOG_ERROR("NPN_Status passed a NULL status message");
- return;
- }
-
- CFStringRef status = CFStringCreateWithCString(NULL, message, kCFStringEncodingUTF8);
+ CFStringRef status = CFStringCreateWithCString(NULL, message ? message : "", kCFStringEncodingUTF8);
if (!status) {
LOG_ERROR("NPN_Status: the message was not valid UTF-8");
return;
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 8e8b51a..c8da53b 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -120,6 +120,7 @@ public:
#endif
virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
+ virtual void iconForFiles(const Vector<WebCore::String>&, PassRefPtr<WebCore::FileChooser>);
virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; }
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index c4e9671..b2240d9 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -631,6 +631,11 @@ void WebChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
END_BLOCK_OBJC_EXCEPTIONS;
}
+void WebChromeClient::iconForFiles(const Vector<String>&, PassRefPtr<FileChooser>)
+{
+ // FIXME: Move the code of Icon::createIconForFiles() here.
+}
+
KeyboardUIMode WebChromeClient::keyboardUIMode()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index 2774783..988b8a6 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -188,6 +188,7 @@ private:
virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WebCore::String& name, WebCore::HTMLFrameOwnerElement*,
const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
+ virtual void didTransferChildFrameToNewDocument();
virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WebCore::String>&,
const Vector<WebCore::String>&, const WebCore::String&, bool);
virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index eaec807..52a24b4 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1352,6 +1352,10 @@ PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& url, const Strin
return 0;
}
+void WebFrameLoaderClient::didTransferChildFrameToNewDocument()
+{
+}
+
ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -1493,6 +1497,10 @@ public:
NSEvent* currentNSEvent = frame->eventHandler()->currentNSEvent();
if (event->type() == eventNames().mousemoveEvent)
[(WebBaseNetscapePluginView *)platformWidget() handleMouseMoved:currentNSEvent];
+ else if (event->type() == eventNames().mouseoverEvent)
+ [(WebBaseNetscapePluginView *)platformWidget() handleMouseEntered:currentNSEvent];
+ else if (event->type() == eventNames().mouseoutEvent)
+ [(WebBaseNetscapePluginView *)platformWidget() handleMouseExited:currentNSEvent];
}
};
diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm
index 8a3842e..d9622b3 100644
--- a/WebKit/mac/WebView/WebDataSource.mm
+++ b/WebKit/mac/WebView/WebDataSource.mm
@@ -70,6 +70,7 @@ using namespace WebCore;
id <WebDocumentRepresentation> representation;
BOOL representationFinishedLoading;
+ BOOL includedInWebKitStatistics;
}
@end
@@ -372,10 +373,11 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
_private->loader = loader.releaseRef();
LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(_private->loader->request().url()));
-
- ++WebDataSourceCount;
-
- return self;
+
+ if ((_private->includedInWebKitStatistics = [[self webFrame] _isIncludedInWebKitStatistics]))
+ ++WebDataSourceCount;
+
+ return self;
}
@end
@@ -389,16 +391,18 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
- (void)dealloc
{
- --WebDataSourceCount;
-
+ if (_private && _private->includedInWebKitStatistics)
+ --WebDataSourceCount;
+
[_private release];
-
+
[super dealloc];
}
- (void)finalize
{
- --WebDataSourceCount;
+ if (_private && _private->includedInWebKitStatistics)
+ --WebDataSourceCount;
[super finalize];
}
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 41d7e01..267d319 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -87,6 +87,7 @@
#import <WebCore/htmlediting.h>
#import <WebCore/markup.h>
#import <WebCore/visible_units.h>
+#import <WebKitSystemInterface.h>
#import <runtime/JSLock.h>
#import <runtime/JSObject.h>
#import <runtime/JSValue.h>
@@ -269,6 +270,11 @@ WebView *getWebView(WebFrame *webFrame)
return [self _createFrameWithPage:ownerElement->document()->frame()->page() frameName:name frameView:frameView ownerElement:ownerElement];
}
+- (BOOL)_isIncludedInWebKitStatistics
+{
+ return _private && _private->includedInWebKitStatistics;
+}
+
- (void)_attachScriptDebugger
{
ScriptController* scriptController = _private->coreFrame->script();
@@ -308,6 +314,11 @@ WebView *getWebView(WebFrame *webFrame)
_private = [[WebFramePrivate alloc] init];
+ // Set includedInWebKitStatistics before calling WebFrameView _setWebFrame, since
+ // it calls WebFrame _isIncludedInWebKitStatistics.
+ if ((_private->includedInWebKitStatistics = [[v class] shouldIncludeInWebKitStatistics]))
+ ++WebFrameCount;
+
if (fv) {
[_private setWebFrameView:fv];
[fv _setWebFrame:self];
@@ -315,8 +326,6 @@ WebView *getWebView(WebFrame *webFrame)
_private->shouldCreateRenderers = YES;
- ++WebFrameCount;
-
return self;
}
@@ -523,14 +532,27 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
- (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly
{
- PlatformGraphicsContext* platformContext = static_cast<PlatformGraphicsContext*>([[NSGraphicsContext currentContext] graphicsPort]);
ASSERT([[NSGraphicsContext currentContext] isFlipped]);
- GraphicsContext context(platformContext);
+
+ CGContextRef ctx = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+ GraphicsContext context(ctx);
+
+ FrameView* view = _private->coreFrame->view();
+
+ bool shouldFlatten = WKCGContextIsBitmapContext(ctx) && [getWebView(self) _includesFlattenedCompositingLayersWhenDrawingToBitmap];
+ PaintBehavior oldBehavior = PaintBehaviorNormal;
+ if (shouldFlatten) {
+ oldBehavior = view->paintBehavior();
+ view->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
+ }
if (contentsOnly)
_private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect));
else
_private->coreFrame->view()->paint(&context, enclosingIntRect(rect));
+
+ if (shouldFlatten)
+ view->setPaintBehavior(oldBehavior);
}
// Used by pagination code called from AppKit when a standalone web page is printed.
@@ -1276,14 +1298,19 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
- (void)dealloc
{
+ if (_private && _private->includedInWebKitStatistics)
+ --WebFrameCount;
+
[_private release];
- --WebFrameCount;
+
[super dealloc];
}
- (void)finalize
{
- --WebFrameCount;
+ if (_private && _private->includedInWebKitStatistics)
+ --WebFrameCount;
+
[super finalize];
}
diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h
index 0dcf19b..4c1ee40 100644
--- a/WebKit/mac/WebView/WebFrameInternal.h
+++ b/WebKit/mac/WebView/WebFrameInternal.h
@@ -81,6 +81,7 @@ WebView *getWebView(WebFrame *webFrame);
WebScriptDebugger* scriptDebugger;
id internalLoadDelegate;
BOOL shouldCreateRenderers;
+ BOOL includedInWebKitStatistics;
}
@end
@@ -96,6 +97,8 @@ WebView *getWebView(WebFrame *webFrame);
- (void)_clearCoreFrame;
+- (BOOL)_isIncludedInWebKitStatistics;
+
- (void)_updateBackgroundAndUpdatesWhileOffscreen;
- (void)_setInternalLoadDelegate:(id)internalLoadDelegate;
- (id)_internalLoadDelegate;
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index b6b1941..422b605 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -92,6 +92,7 @@ enum {
@public
WebFrame *webFrame;
WebDynamicScrollBarsView *frameScrollView;
+ BOOL includedInWebKitStatistics;
}
@end
@@ -187,6 +188,11 @@ enum {
// Not retained because the WebView owns the WebFrame, which owns the WebFrameView.
_private->webFrame = webFrame;
+
+ if (!_private->includedInWebKitStatistics && [webFrame _isIncludedInWebKitStatistics]) {
+ _private->includedInWebKitStatistics = YES;
+ ++WebFrameViewCount;
+ }
}
- (WebDynamicScrollBarsView *)_scrollView
@@ -286,15 +292,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
@implementation WebFrameView
-- initWithCoder:(NSCoder *)decoder
-{
- // Older nibs containing WebViews will also contain WebFrameViews. We need to keep track of
- // their count also to match the decrement in -dealloc.
- ++WebFrameViewCount;
- return [super initWithCoder:decoder];
-}
-
-- initWithFrame:(NSRect)frame
+- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (!self)
@@ -350,14 +348,13 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
// This works together with our becomeFirstResponder and setNextKeyView overrides.
[super setNextKeyView:scrollView];
- ++WebFrameViewCount;
-
return self;
}
- (void)dealloc
{
- --WebFrameViewCount;
+ if (_private && _private->includedInWebKitStatistics)
+ --WebFrameViewCount;
[_private release];
_private = nil;
@@ -367,7 +364,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
- (void)finalize
{
- --WebFrameViewCount;
+ if (_private && _private->includedInWebKitStatistics)
+ --WebFrameViewCount;
[super finalize];
}
diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm
index 41ce9f9..3aaa914 100644
--- a/WebKit/mac/WebView/WebHTMLRepresentation.mm
+++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm
@@ -66,6 +66,8 @@ using namespace HTMLNames;
WebDataSource *dataSource;
BOOL hasSentResponseToPlugin;
+ BOOL includedInWebKitStatistics;
+
id <WebPluginManualLoader> manualLoader;
NSView *pluginView;
}
@@ -117,16 +119,15 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second)
return nil;
_private = [[WebHTMLRepresentationPrivate alloc] init];
-
- ++WebHTMLRepresentationCount;
-
+
return self;
}
- (void)dealloc
{
- --WebHTMLRepresentationCount;
-
+ if (_private && _private->includedInWebKitStatistics)
+ --WebHTMLRepresentationCount;
+
[_private release];
[super dealloc];
@@ -134,7 +135,8 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second)
- (void)finalize
{
- --WebHTMLRepresentationCount;
+ if (_private && _private->includedInWebKitStatistics)
+ --WebHTMLRepresentationCount;
[super finalize];
}
@@ -148,6 +150,11 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second)
- (void)setDataSource:(WebDataSource *)dataSource
{
_private->dataSource = dataSource;
+
+ if (!_private->includedInWebKitStatistics && [[dataSource webFrame] _isIncludedInWebKitStatistics]) {
+ _private->includedInWebKitStatistics = YES;
+ ++WebHTMLRepresentationCount;
+ }
}
- (BOOL)_isDisplayingWebArchive
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 54a177e..aa65920 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -1239,15 +1239,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
if (_private->enumeratingSubviews)
LOG(View, "A view of class %s was added during subview enumeration for layout or printing mode change. This view might paint without first receiving layout.", object_getClassName([subview class]));
}
-
-- (void)willRemoveSubview:(NSView *)subview
-{
- // Have to null-check _private, since this can be called via -dealloc when
- // cleaning up the the layerHostingView.
- if (_private && _private->enumeratingSubviews)
- LOG(View, "A view of class %s was removed during subview enumeration for layout or printing mode change. We will still do layout or the printing mode change even though this view is no longer in the view hierarchy.", object_getClassName([subview class]));
-}
-
#endif
#ifdef BUILDING_ON_TIGER
@@ -2924,7 +2915,9 @@ WEBCORE_COMMAND(yankAndSelect)
[self _removeWindowObservers];
[self _removeSuperviewObservers];
[self _cancelUpdateMouseoverTimer];
-
+
+ // FIXME: This accomplishes the same thing as the call to setCanStartMedia(false) in
+ // WebView. It would be nice to have a single mechanism instead of two.
[[self _pluginController] stopAllPlugins];
}
@@ -2944,6 +2937,8 @@ WEBCORE_COMMAND(yankAndSelect)
[self addSuperviewObservers];
[self addMouseMovedObserver];
+ // FIXME: This accomplishes the same thing as the call to setCanStartMedia(true) in
+ // WebView. It would be nice to have a single mechanism instead of two.
[[self _pluginController] startAllPlugins];
_private->lastScrollPosition = NSZeroPoint;
@@ -2971,6 +2966,13 @@ WEBCORE_COMMAND(yankAndSelect)
- (void)willRemoveSubview:(NSView *)subview
{
+#ifndef NDEBUG
+ // Have to null-check _private, since this can be called via -dealloc when
+ // cleaning up the the layerHostingView.
+ if (_private && _private->enumeratingSubviews)
+ LOG(View, "A view of class %s was removed during subview enumeration for layout or printing mode change. We will still do layout or the printing mode change even though this view is no longer in the view hierarchy.", object_getClassName([subview class]));
+#endif
+
if ([WebPluginController isPlugInView:subview])
[[self _pluginController] destroyPlugin:subview];
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index b8e912e..150a020 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -51,6 +51,7 @@
#define WebKitJavaScriptEnabledPreferenceKey @"WebKitJavaScriptEnabled"
#define WebKitWebSecurityEnabledPreferenceKey @"WebKitWebSecurityEnabled"
#define WebKitAllowUniversalAccessFromFileURLsPreferenceKey @"WebKitAllowUniversalAccessFromFileURLs"
+#define WebKitAllowFileAccessFromFileURLsPreferenceKey @"WebKitAllowFileAccessFromFileURLs"
#define WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey @"WebKitJavaScriptCanOpenWindowsAutomatically"
#define WebKitPluginsEnabledPreferenceKey @"WebKitPluginsEnabled"
#define WebKitDatabasesEnabledPreferenceKey @"WebKitDatabasesEnabledPreferenceKey"
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index a1176a9..bd3c2a7 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -316,6 +316,7 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:YES], WebKitJavaScriptEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitWebSecurityEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
+ [NSNumber numberWithBool:YES], WebKitAllowFileAccessFromFileURLsPreferenceKey,
[NSNumber numberWithBool:YES], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
[NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey,
@@ -920,6 +921,16 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
}
+- (BOOL)allowFileAccessFromFileURLs
+{
+ return [self _boolValueForKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
+}
+
+- (void)setAllowFileAccessFromFileURLs:(BOOL)flag
+{
+ [self _setBoolValue: flag forKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
+}
+
- (NSTimeInterval)_backForwardCacheExpirationInterval
{
// FIXME: There's probably no good reason to read from the standard user defaults instead of self.
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 7c84d8d..b516640 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -101,6 +101,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)allowUniversalAccessFromFileURLs;
- (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag;
+- (BOOL)allowFileAccessFromFileURLs;
+- (void)setAllowFileAccessFromFileURLs:(BOOL)flag;
+
- (BOOL)zoomsTextOnly;
- (void)setZoomsTextOnly:(BOOL)zoomsTextOnly;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 4b449de..44d4b58 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 David Smith (catfish.man@gmail.com)
*
* Redistribution and use in source and binary forms, with or without
@@ -600,6 +600,7 @@ static bool shouldEnableLoadDeferring()
_private->drawsBackground = YES;
_private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain];
_private->usesDocumentViews = usesDocumentViews;
+ _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = YES;
WebFrameView *frameView = nil;
if (_private->usesDocumentViews) {
@@ -630,6 +631,7 @@ static bool shouldEnableLoadDeferring()
#endif
_private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient);
+ _private->page->setCanStartMedia([self window]);
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
[WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView];
@@ -657,7 +659,8 @@ static bool shouldEnableLoadDeferring()
[frameView setNextKeyView:nextKeyView];
[super setNextKeyView:frameView];
- ++WebViewCount;
+ if ([[self class] shouldIncludeInWebKitStatistics])
+ ++WebViewCount;
[self _registerDraggedTypes];
@@ -1286,6 +1289,7 @@ static bool fastDocumentTeardownEnabled()
settings->setJavaScriptEnabled([preferences isJavaScriptEnabled]);
settings->setWebSecurityEnabled([preferences isWebSecurityEnabled]);
settings->setAllowUniversalAccessFromFileURLs([preferences allowUniversalAccessFromFileURLs]);
+ settings->setAllowFileAccessFromFileURLs([preferences allowFileAccessFromFileURLs]);
settings->setJavaScriptCanOpenWindowsAutomatically([preferences javaScriptCanOpenWindowsAutomatically]);
settings->setMinimumFontSize([preferences minimumFontSize]);
settings->setMinimumLogicalFontSize([preferences minimumLogicalFontSize]);
@@ -2141,19 +2145,42 @@ static inline IMP getMethod(id o, SEL s)
- (BOOL)_isUsingAcceleratedCompositing
{
#if USE(ACCELERATED_COMPOSITING)
- Frame* coreFrame = [self _mainCoreFrame];
if (_private->usesDocumentViews) {
+ Frame* coreFrame = [self _mainCoreFrame];
for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
NSView *documentView = [[kit(frame) frameView] documentView];
if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isUsingAcceleratedCompositing])
return YES;
}
}
-
- return NO;
-#else
+#endif
return NO;
+}
+
+- (BOOL)_isSoftwareRenderable
+{
+#if USE(ACCELERATED_COMPOSITING)
+ if (_private->usesDocumentViews) {
+ Frame* coreFrame = [self _mainCoreFrame];
+ for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
+ if (FrameView* view = frame->view()) {
+ if (!view->isSoftwareRenderable())
+ return NO;
+ }
+ }
+ }
#endif
+ return YES;
+}
+
+- (void)_setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:(BOOL)flag
+{
+ _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = flag;
+}
+
+- (BOOL)_includesFlattenedCompositingLayersWhenDrawingToBitmap
+{
+ return _private->includesFlattenedCompositingLayersWhenDrawingToBitmap;
}
static WebBaseNetscapePluginView *_pluginViewForNode(DOMNode *node)
@@ -2743,8 +2770,9 @@ static bool needsWebViewInitThreadWorkaround()
// this maintains our old behavior for existing applications
[self close];
- --WebViewCount;
-
+ if ([[self class] shouldIncludeInWebKitStatistics])
+ --WebViewCount;
+
if ([self _needsFrameLoadDelegateRetainQuirk])
[_private->frameLoadDelegate release];
@@ -2824,8 +2852,10 @@ static bool needsWebViewInitThreadWorkaround()
// and over, so do them when we move into a window.
[window setAcceptsMouseMovedEvents:YES];
WKSetNSWindowShouldPostEventNotifications(window, YES);
- } else
+ } else {
+ _private->page->setCanStartMedia(false);
_private->page->willMoveOffscreen();
+ }
if (window != [self window]) {
[self removeWindowObservers];
@@ -2842,8 +2872,10 @@ static bool needsWebViewInitThreadWorkaround()
if (!_private || _private->closed)
return;
- if ([self window])
+ if ([self window]) {
+ _private->page->setCanStartMedia(true);
_private->page->didMoveOnscreen();
+ }
[self _updateActiveState];
}
@@ -5335,6 +5367,11 @@ static WebFrameView *containingFrameView(NSView *view)
@implementation WebView (WebViewInternal)
++ (BOOL)shouldIncludeInWebKitStatistics
+{
+ return NO;
+}
+
- (BOOL)_becomingFirstResponderFromOutside
{
return _private->becomingFirstResponderFromOutside;
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index b0569a2..2b51f3c 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -137,6 +137,8 @@ extern int pluginDatabaseClientCount;
// When this flag is set, we will not make any subviews underneath this WebView. This means no WebFrameViews and no WebHTMLViews.
BOOL usesDocumentViews;
+
+ BOOL includesFlattenedCompositingLayersWhenDrawingToBitmap;
#if USE(ACCELERATED_COMPOSITING)
// When this flag is set, next time a WebHTMLView draws, it needs to temporarily disable screen updates
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index 6c2ae50..3f38d58 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -64,6 +64,8 @@ namespace WebCore {
@interface WebView (WebViewInternal)
++ (BOOL)shouldIncludeInWebKitStatistics;
+
- (WebCore::Frame*)_mainCoreFrame;
- (WebFrame *)_selectedOrMainFrame;
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 4d1145e..b0a7039 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -470,6 +470,13 @@ Could be worth adding to the API.
- (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
- (BOOL)_isUsingAcceleratedCompositing;
+// Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content.
+- (BOOL)_isSoftwareRenderable;
+// When drawing into a bitmap context, we normally flatten compositing layers (and distort 3D transforms).
+// Clients who are able to capture their own copy of the compositing layers need to be able to disable this.
+- (void)_setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:(BOOL)flag;
+- (BOOL)_includesFlattenedCompositingLayersWhenDrawingToBitmap;
+
// SPI for PluginHalter
+ (BOOL)_isNodeHaltedPlugin:(DOMNode *)node;
+ (BOOL)_hasPluginForNodeBeenHalted:(DOMNode *)node;