summaryrefslogtreecommitdiffstats
path: root/WebKit/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac')
-rw-r--r--WebKit/mac/ChangeLog188
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h2
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm2
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm12
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h39
-rw-r--r--WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm21
-rw-r--r--WebKit/mac/WebCoreSupport/WebInspectorClient.mm8
-rw-r--r--WebKit/mac/WebInspector/WebInspector.h2
-rw-r--r--WebKit/mac/WebInspector/WebInspector.mm15
-rw-r--r--WebKit/mac/WebInspector/WebInspectorFrontend.h35
-rw-r--r--WebKit/mac/WebInspector/WebInspectorFrontend.mm51
-rw-r--r--WebKit/mac/WebInspector/WebInspectorPrivate.h3
-rw-r--r--WebKit/mac/WebView/WebFrame.mm26
-rw-r--r--WebKit/mac/WebView/WebFramePrivate.h4
-rw-r--r--WebKit/mac/WebView/WebHTMLView.mm95
-rw-r--r--WebKit/mac/WebView/WebHTMLViewPrivate.h4
-rw-r--r--WebKit/mac/WebView/WebScriptDebugger.mm2
-rw-r--r--WebKit/mac/WebView/WebView.mm4
18 files changed, 472 insertions, 41 deletions
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 269110f..1381fee 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,191 @@
+2010-08-17 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ Preparation: Just add the files to the build system.
+
+ * WebCoreSupport/WebFrameNetworkingContext.h: Added.
+ Placeholder with tentative code that might be changed when landing
+ the rest of it.
+ * WebCoreSupport/WebFrameNetworkingContext.mm: Added.
+ Empty placeholder for now.
+
+2010-08-17 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Navigating back/forward during a modal dialog causes a crash when the modal dialog is dismissed.
+ <rdar://problem/8313579> and https://bugs.webkit.org/show_bug.cgi?id=44131
+
+ * WebView/WebView.mm:
+ (-[WebView canGoBack]): Return false if loads are deferred.
+ (-[WebView canGoForward]): Ditto.
+
+2010-08-14 Joseph Pecoraro <joepeck@webkit.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: -[WebInspector attach] and detach should work
+ https://bugs.webkit.org/show_bug.cgi?id=43924
+
+ For actions that relate only to the Web Inspector's Frontend
+ window (actions on the InspectorFrontendClient) the new Obj-C
+ wrapper class WebInspectorFrontend can be used. For now, this
+ is just attach and detach.
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::openInspectorFrontend): setup and attach the WebInspectorFrontend to the WebInspector.
+ * WebInspector/WebInspector.h:
+ * WebInspector/WebInspector.mm:
+ (-[WebInspector dealloc]):
+ (-[WebInspector attach:]): delegate to the frontend.
+ (-[WebInspector detach:]): delegate to the frontend.
+ (-[WebInspector setFrontend:]):
+ * WebInspector/WebInspectorFrontend.h: Added.
+ * WebInspector/WebInspectorFrontend.mm: Added.
+ (-[WebInspectorFrontend initWithFrontendClient:]):
+ (-[WebInspectorFrontend attach]):
+ (-[WebInspectorFrontend detach]):
+ * WebInspector/WebInspectorPrivate.h:
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+ Switch String::/UString::ascii() to return a CString.
+
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::methodsNamed):
+ (WebKit::ProxyInstance::fieldNamed):
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+
+2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r65295.
+ http://trac.webkit.org/changeset/65295
+ https://bugs.webkit.org/show_bug.cgi?id=43950
+
+ It broke 4 sputnik tests (Requested by Ossy on #webkit).
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+
+2010-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+
+2010-08-12 Jeremy Orlow <jorlow@chromium.org>
+
+ Revert for now
+ https://bugs.webkit.org/show_bug.cgi?id=43794
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ (-[WebView _preferencesChangedNotification:]):
+
+2010-08-10 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Some settings are linked to the PageGroup not the Page. Create a new class for those.
+ https://bugs.webkit.org/show_bug.cgi?id=43794
+
+ Change WebView to use the new GroupSettings class rather than Settings for the
+ settings that moved. This is sub-optimal since the settings aren't really
+ per-view, but we can't really change the API at this point.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+ (-[WebView _preferencesChangedNotification:]):
+
+2010-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamps by Darin Adler & Sam Weinig.
+
+ Bug 43867 - Some UString cleanup
+
+ Change JSC::UString data(), size(), and from(), to characters(), length(), and number() to match WTF::String.
+ Move string concatenation methods to a new header to simplify down UString.h. Remove is8Bit().
+
+ * WebView/WebScriptDebugger.mm:
+ (toNSString):
+
+2010-08-10 David Hyatt <hyatt@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43806, add ability to paginate screen content.
+
+ Add SPI for entering and exiting screen pagination mode. This is similar to printing mode but it can be done for on-screen
+ content.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _web_setPrintingModeRecursive]):
+ (-[WebHTMLView _web_clearPrintingModeRecursive]):
+ (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]):
+ (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]):
+ (-[WebHTMLView _endPrintMode]):
+ (-[WebHTMLView _isInScreenPaginationMode]):
+ (-[WebHTMLView _beginScreenPaginationModeWithPageSize:shrinkToFit:]):
+ (-[WebHTMLView _endScreenPaginationMode]):
+ (-[WebHTMLView reapplyStyles]):
+ (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:paginateScreenContent:]):
+ (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]):
+ (-[WebHTMLView setPageWidthForPrinting:]):
+ * WebView/WebHTMLViewPrivate.h:
+
+2010-08-10 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix (update more includes)
+
+ * Plugins/Hosted/NetscapePluginHostManager.h:
+
+2010-08-10 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add suspendAnimations/resumeAnimation API to DRT
+ https://bugs.webkit.org/show_bug.cgi?id=43733
+
+ Mac specific API. Plumbs suspendAnimations/resumeAnimations down to WebCore.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _suspendAnimations]):
+ (-[WebFrame _resumeAnimations]):
+ * WebView/WebFramePrivate.h:
+
+2010-08-10 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig
+
+ Bug 43817 - Remove UString::Rep
+ UString::Rep has for a long time been replaced by UStringImpl (Rep
+ remaining as a typedef). UStringImpl has since been removed too
+ (unified with StringImpl). Remove Rep, rename rep() to impl() and
+ m_rep to m_impl. Also add impl() method to Identifier, and rename
+ its UString member from _ustring to m_string.
+
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::methodsNamed):
+ (WebKit::ProxyInstance::fieldNamed):
+
2010-08-06 Gavin Barraclough <barraclough@apple.com>
Rubber stamped by Sam Weinig
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
index b88f1a4..2645c55 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
@@ -29,9 +29,9 @@
#define NetscapePluginHostManager_h
#import <WebCore/PlatformString.h>
-#import <WebCore/StringHash.h>
#import <wtf/HashMap.h>
#import <wtf/PassRefPtr.h>
+#import <wtf/text/StringHash.h>
@class WebHostedNetscapePluginView;
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 8354c06..cb1d958 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -1238,7 +1238,7 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
for (unsigned i = 0; i < propertyNames.size(); i++) {
- uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().data()));
+ uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().utf8().data()));
[array.get() addObject:[NSNumber numberWithLongLong:methodName]];
}
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index b3799ca..306d2e5 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -329,7 +329,7 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
return MethodList();
// If we already have an entry in the map, use it.
- MethodMap::iterator existingMapEntry = m_methods.find(identifier.ustring().rep());
+ MethodMap::iterator existingMapEntry = m_methods.find(identifier.impl());
if (existingMapEntry != m_methods.end()) {
MethodList methodList;
if (existingMapEntry->second)
@@ -337,7 +337,7 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
return methodList;
}
- uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii()));
+ uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii().data()));
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectHasMethod(m_instanceProxy->hostProxy()->port(),
@@ -353,7 +353,7 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
return MethodList();
// Add a new entry to the map unless an entry was added while we were in waitForReply.
- pair<MethodMap::iterator, bool> mapAddResult = m_methods.add(identifier.ustring().rep(), 0);
+ pair<MethodMap::iterator, bool> mapAddResult = m_methods.add(identifier.impl(), 0);
if (mapAddResult.second && reply->m_result)
mapAddResult.first->second = new ProxyMethod(methodName);
@@ -369,11 +369,11 @@ Field* ProxyInstance::fieldNamed(const Identifier& identifier)
return 0;
// If we already have an entry in the map, use it.
- FieldMap::iterator existingMapEntry = m_fields.find(identifier.ustring().rep());
+ FieldMap::iterator existingMapEntry = m_fields.find(identifier.impl());
if (existingMapEntry != m_fields.end())
return existingMapEntry->second;
- uint64_t propertyName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii()));
+ uint64_t propertyName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii().data()));
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectHasProperty(m_instanceProxy->hostProxy()->port(),
@@ -389,7 +389,7 @@ Field* ProxyInstance::fieldNamed(const Identifier& identifier)
return 0;
// Add a new entry to the map unless an entry was added while we were in waitForReply.
- pair<FieldMap::iterator, bool> mapAddResult = m_fields.add(identifier.ustring().rep(), 0);
+ pair<FieldMap::iterator, bool> mapAddResult = m_fields.add(identifier.impl(), 0);
if (mapAddResult.second && reply->m_result)
mapAddResult.first->second = new ProxyField(propertyName);
return mapAddResult.first->second;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h
new file mode 100644
index 0000000..de89024
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#import <WebCore/FrameNetworkingContext.h>
+
+class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext {
+public:
+ static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame* frame)
+ {
+ return adoptRef(new WebFrameNetworkingContext(frame));
+ }
+
+private:
+ WebFrameNetworkingContext(WebCore::Frame* frame)
+ : WebCore::FrameNetworkingContext(frame)
+ {
+ }
+
+ virtual bool needsSiteSpecificQuirks() const;
+ virtual bool localFileContentSniffingEnabled() const;
+ virtual WebCore::SchedulePairHashSet* scheduledRunLoopPairs() const;
+ virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
+};
diff --git a/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm
new file mode 100644
index 0000000..941cfaa
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm
@@ -0,0 +1,21 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+// Checking this file in empty to get the build system work out of the way.
+// Will put the code in here later.
diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index d59109e..7cae8fc 100644
--- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -33,6 +33,8 @@
#import "WebFrameInternal.h"
#import "WebFrameView.h"
#import "WebInspector.h"
+#import "WebInspectorPrivate.h"
+#import "WebInspectorFrontend.h"
#import "WebLocalizableStrings.h"
#import "WebNodeHighlight.h"
#import "WebUIDelegate.h"
@@ -98,8 +100,12 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon
{
RetainPtr<WebInspectorWindowController> windowController(AdoptNS, [[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
[windowController.get() setInspectorClient:this];
+
m_frontendPage = core([windowController.get() webView]);
- m_frontendPage->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage));
+ WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage);
+ m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient);
+
+ [[m_webView inspector] setFrontend:[[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient]];
}
void WebInspectorClient::highlight(Node* node)
diff --git a/WebKit/mac/WebInspector/WebInspector.h b/WebKit/mac/WebInspector/WebInspector.h
index fa13c8d..ed78ed7 100644
--- a/WebKit/mac/WebInspector/WebInspector.h
+++ b/WebKit/mac/WebInspector/WebInspector.h
@@ -29,10 +29,12 @@
#import <Foundation/NSObject.h>
@class WebView;
+@class WebInspectorFrontend;
@interface WebInspector : NSObject
{
WebView *_webView;
+ WebInspectorFrontend *_frontend;
}
- (id)initWithWebView:(WebView *)webView;
- (void)webViewClosed;
diff --git a/WebKit/mac/WebInspector/WebInspector.mm b/WebKit/mac/WebInspector/WebInspector.mm
index 9b17459..f109e15 100644
--- a/WebKit/mac/WebInspector/WebInspector.mm
+++ b/WebKit/mac/WebInspector/WebInspector.mm
@@ -30,6 +30,7 @@
#import "WebFrameInternal.h"
#import "WebInspectorPrivate.h"
+#import "WebInspectorFrontend.h"
#include <WebCore/Document.h>
#include <WebCore/Frame.h>
@@ -47,6 +48,12 @@ using namespace WebCore;
return self;
}
+- (void)dealloc
+{
+ [_frontend release];
+ [super dealloc];
+}
+
- (void)webViewClosed
{
_webView = nil;
@@ -175,10 +182,12 @@ using namespace WebCore;
- (void)attach:(id)sender
{
+ [_frontend attach];
}
- (void)detach:(id)sender
{
+ [_frontend detach];
}
- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script
@@ -186,6 +195,12 @@ using namespace WebCore;
if (Page* page = core(_webView))
page->inspectorController()->evaluateForTestInFrontend(callId, script);
}
+
+- (void)setFrontend:(WebInspectorFrontend *)frontend
+{
+ [_frontend release];
+ _frontend = [frontend retain];
+}
@end
@implementation WebInspector (Obsolete)
diff --git a/WebKit/mac/WebInspector/WebInspectorFrontend.h b/WebKit/mac/WebInspector/WebInspectorFrontend.h
new file mode 100644
index 0000000..93bed84
--- /dev/null
+++ b/WebKit/mac/WebInspector/WebInspectorFrontend.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2010 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. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class WebInspectorFrontendClient;
+
+@interface WebInspectorFrontend : NSObject {
+@private
+ WebInspectorFrontendClient *m_frontendClient;
+}
+- (id)initWithFrontendClient:(WebInspectorFrontendClient *)frontendClient;
+- (void)attach;
+- (void)detach;
+@end
diff --git a/WebKit/mac/WebInspector/WebInspectorFrontend.mm b/WebKit/mac/WebInspector/WebInspectorFrontend.mm
new file mode 100644
index 0000000..91caa64
--- /dev/null
+++ b/WebKit/mac/WebInspector/WebInspectorFrontend.mm
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 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. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebInspectorFrontend.h"
+
+#import "WebInspectorClient.h"
+
+@implementation WebInspectorFrontend
+
+- (id)initWithFrontendClient:(WebInspectorFrontendClient *)frontendClient;
+{
+ if (!(self = [super init]))
+ return nil;
+
+ m_frontendClient = frontendClient;
+ return self;
+}
+
+- (void)attach
+{
+ m_frontendClient->attachWindow();
+}
+
+- (void)detach
+{
+ m_frontendClient->detachWindow();
+}
+
+@end
diff --git a/WebKit/mac/WebInspector/WebInspectorPrivate.h b/WebKit/mac/WebInspector/WebInspectorPrivate.h
index d18f804..df1e286 100644
--- a/WebKit/mac/WebInspector/WebInspectorPrivate.h
+++ b/WebKit/mac/WebInspector/WebInspectorPrivate.h
@@ -30,6 +30,9 @@
#import <WebKit/WebInspector.h>
+@class WebInspectorFrontend;
+
@interface WebInspector (WebPrivate)
- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script;
+- (void)setFrontend:(WebInspectorFrontend *)frontend;
@end
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index b71d501..82df7bc 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -1193,6 +1193,32 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return controller->numberOfActiveAnimations();
}
+- (void) _suspendAnimations
+{
+ Frame* frame = core(self);
+ if (!frame)
+ return;
+
+ AnimationController* controller = frame->animation();
+ if (!controller)
+ return;
+
+ controller->suspendAnimations(frame->document());
+}
+
+- (void) _resumeAnimations
+{
+ Frame* frame = core(self);
+ if (!frame)
+ return;
+
+ AnimationController* controller = frame->animation();
+ if (!controller)
+ return;
+
+ controller->resumeAnimations(frame->document());
+}
+
- (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle
{
if (_private->coreFrame->selection()->isNone() || !fragment)
diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h
index 0bda966..3556ad8 100644
--- a/WebKit/mac/WebView/WebFramePrivate.h
+++ b/WebKit/mac/WebView/WebFramePrivate.h
@@ -113,6 +113,10 @@ typedef enum {
// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
- (unsigned) _numberOfActiveAnimations;
+// Suspend and resume animations (includes both CSS transitions and CSS animations).
+- (void) _suspendAnimations;
+- (void) _resumeAnimations;
+
- (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
- (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
- (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 0e559b4..77df9d1 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -399,7 +399,7 @@ static CachedResourceClient* promisedDataClient()
#endif
@interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick.
-- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize;
+- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize paginateScreenContent:(BOOL)paginateScreenContent;
@end
@class NSTextInputContext;
@@ -445,6 +445,7 @@ struct WebHTMLViewInterpretKeyEventsParameters {
BOOL ignoringMouseDraggedEvents;
BOOL printing;
BOOL avoidingPrintOrphan;
+ BOOL paginateScreenContent;
BOOL observingMouseMovedNotifications;
BOOL observingSuperviewNotifications;
BOOL observingWindowNotifications;
@@ -1041,7 +1042,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
- (void)_web_setPrintingModeRecursive
{
- [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
+ [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
#ifndef NDEBUG
_private->enumeratingSubviews = YES;
@@ -1053,7 +1054,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
unsigned count = [descendantWebHTMLViews count];
for (unsigned i = 0; i < count; ++i)
- [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
+ [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
[descendantWebHTMLViews release];
@@ -1064,7 +1065,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
- (void)_web_clearPrintingModeRecursive
{
- [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
+ [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
#ifndef NDEBUG
_private->enumeratingSubviews = YES;
@@ -1076,7 +1077,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
unsigned count = [descendantWebHTMLViews count];
for (unsigned i = 0; i < count; ++i)
- [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
+ [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
[descendantWebHTMLViews release];
@@ -1087,7 +1088,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
- (void)_web_setPrintingModeRecursiveAndAdjustViewSize
{
- [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES];
+ [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES paginateScreenContent:[self _isInScreenPaginationMode]];
#ifndef NDEBUG
_private->enumeratingSubviews = YES;
@@ -1099,7 +1100,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
unsigned count = [descendantWebHTMLViews count];
for (unsigned i = 0; i < count; ++i)
- [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES];
+ [[descendantWebHTMLViews objectAtIndex:i] _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES paginateScreenContent:[self _isInScreenPaginationMode]];
[descendantWebHTMLViews release];
@@ -2248,14 +2249,46 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
minLayoutHeight = shrinkToFit ? pageHeight * _WebHTMLViewPrintingMinimumShrinkFactor : pageHeight;
maxLayoutWidth = shrinkToFit ? pageWidth * _WebHTMLViewPrintingMaximumShrinkFactor : pageWidth;
}
- [self _setPrinting:YES minimumPageWidth:minLayoutWidth height:minLayoutHeight maximumPageWidth:maxLayoutWidth adjustViewSize:YES];
+ [self _setPrinting:YES minimumPageWidth:minLayoutWidth height:minLayoutHeight maximumPageWidth:maxLayoutWidth adjustViewSize:YES paginateScreenContent:[self _isInScreenPaginationMode]];
return YES;
}
- (void)_endPrintMode
{
- [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES];
+ [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES paginateScreenContent:[self _isInScreenPaginationMode]];
+}
+
+- (BOOL)_isInScreenPaginationMode
+{
+ return _private->paginateScreenContent;
+}
+
+- (BOOL)_beginScreenPaginationModeWithPageSize:(CGSize)pageSize shrinkToFit:(BOOL)shrinkToFit
+{
+ Frame* frame = core([self _frame]);
+ if (!frame)
+ return NO;
+
+ CGFloat minLayoutWidth = 0;
+ CGFloat minLayoutHeight = 0;
+ CGFloat maxLayoutWidth = 0;
+
+ // If we are a frameset just print with the layout we have on the screen. Otherwise do a relayout
+ // according to the page width.
+ if (!frame->document() || !frame->document()->isFrameSet()) {
+ minLayoutWidth = shrinkToFit ? pageSize.width * _WebHTMLViewPrintingMinimumShrinkFactor : pageSize.width;
+ minLayoutHeight = shrinkToFit ? pageSize.height * _WebHTMLViewPrintingMinimumShrinkFactor : pageSize.height;
+ maxLayoutWidth = shrinkToFit ? pageSize.width * _WebHTMLViewPrintingMaximumShrinkFactor : pageSize.width;
+ }
+ [self _setPrinting:[self _isInPrintMode] minimumPageWidth:minLayoutWidth height:minLayoutHeight maximumPageWidth:maxLayoutWidth adjustViewSize:YES paginateScreenContent:YES];
+
+ return YES;
+}
+
+- (void)_endScreenPaginationMode
+{
+ [self _setPrinting:[self _isInPrintMode] minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:YES paginateScreenContent:NO];
}
- (CGFloat)_adjustedBottomOfPageWithTop:(CGFloat)top bottom:(CGFloat)bottom limit:(CGFloat)bottomLimit
@@ -3092,8 +3125,10 @@ WEBCORE_COMMAND(yankAndSelect)
if (Frame* coreFrame = core([self _frame])) {
if (FrameView* coreView = coreFrame->view())
coreView->setMediaType(_private->printing ? "print" : "screen");
- if (Document* document = coreFrame->document())
+ if (Document* document = coreFrame->document()) {
+ document->setPaginatedForScreen(_private->paginateScreenContent);
document->setPrinting(_private->printing);
+ }
coreFrame->reapplyStyles();
}
@@ -3823,8 +3858,11 @@ static BOOL isInPasswordField(Frame* coreFrame)
// Does setNeedsDisplay:NO as a side effect when printing is ending.
// pageWidth != 0 implies we will relayout to a new width
-- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize
+- (void)_setPrinting:(BOOL)printing minimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustViewSize:(BOOL)adjustViewSize paginateScreenContent:(BOOL)paginateScreenContent
{
+ if (printing == _private->printing && paginateScreenContent == _private->paginateScreenContent)
+ return;
+
WebFrame *frame = [self _frame];
NSArray *subframes = [frame childFrames];
unsigned n = [subframes count];
@@ -3833,23 +3871,22 @@ static BOOL isInPasswordField(Frame* coreFrame)
WebFrame *subframe = [subframes objectAtIndex:i];
WebFrameView *frameView = [subframe frameView];
if ([[subframe _dataSource] _isDocumentHTML]) {
- [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:adjustViewSize];
+ [(WebHTMLView *)[frameView documentView] _setPrinting:printing minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:adjustViewSize paginateScreenContent:paginateScreenContent];
}
}
- if (printing || _private->printing) {
- [_private->pageRects release];
- _private->pageRects = nil;
- _private->printing = printing;
- if (!printing)
- _private->avoidingPrintOrphan = NO;
- [self setNeedsToApplyStyles:YES];
- [self setNeedsLayout:YES];
- [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize];
- if (!printing) {
- // Can't do this when starting printing or nested printing won't work, see 3491427.
- [self setNeedsDisplay:NO];
- }
+ [_private->pageRects release];
+ _private->pageRects = nil;
+ _private->printing = printing;
+ _private->paginateScreenContent = paginateScreenContent;
+ if (!printing && !paginateScreenContent)
+ _private->avoidingPrintOrphan = NO;
+ [self setNeedsToApplyStyles:YES];
+ [self setNeedsLayout:YES];
+ [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize];
+ if (!printing) {
+ // Can't do this when starting printing or nested printing won't work, see 3491427.
+ [self setNeedsDisplay:NO];
}
}
@@ -3866,7 +3903,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
// If the WebHTMLView itself is what we're printing, then we will never have to do this.
BOOL wasInPrintingMode = _private->printing;
if (!wasInPrintingMode)
- [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
+ [self _setPrinting:YES minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
*newBottom = [self _adjustedBottomOfPageWithTop:oldTop bottom:oldBottom limit:bottomLimit];
@@ -3877,7 +3914,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
[self performSelector:@selector(_delayedEndPrintMode:) withObject:currenPrintOperation afterDelay:0];
else
// not sure if this is actually ever invoked, it probably shouldn't be
- [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
+ [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
}
}
@@ -3907,8 +3944,8 @@ static BOOL isInPasswordField(Frame* coreFrame)
// This is used for Carbon printing. At some point we might want to make this public API.
- (void)setPageWidthForPrinting:(float)pageWidth
{
- [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO];
- [self _setPrinting:YES minimumPageWidth:pageWidth height:0 maximumPageWidth:pageWidth adjustViewSize:YES];
+ [self _setPrinting:NO minimumPageWidth:0 height:0 maximumPageWidth:0 adjustViewSize:NO paginateScreenContent:[self _isInScreenPaginationMode]];
+ [self _setPrinting:YES minimumPageWidth:pageWidth height:0 maximumPageWidth:pageWidth adjustViewSize:YES paginateScreenContent:[self _isInScreenPaginationMode]];
}
- (void)_endPrintModeAndRestoreWindowAutodisplay
diff --git a/WebKit/mac/WebView/WebHTMLViewPrivate.h b/WebKit/mac/WebView/WebHTMLViewPrivate.h
index c2ca3fe..e1d15dc 100644
--- a/WebKit/mac/WebView/WebHTMLViewPrivate.h
+++ b/WebKit/mac/WebView/WebHTMLViewPrivate.h
@@ -138,6 +138,10 @@ extern const float _WebHTMLViewPrintingMaximumShrinkFactor;
- (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit;
- (void)_endPrintMode;
+- (BOOL)_isInScreenPaginationMode;
+- (BOOL)_beginScreenPaginationModeWithPageSize:(CGSize)pageSize shrinkToFit:(BOOL)shrinkToFit;
+- (void)_endScreenPaginationMode;
+
- (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard;
@end
diff --git a/WebKit/mac/WebView/WebScriptDebugger.mm b/WebKit/mac/WebView/WebScriptDebugger.mm
index c5e0ac8..f67b46f 100644
--- a/WebKit/mac/WebView/WebScriptDebugger.mm
+++ b/WebKit/mac/WebView/WebScriptDebugger.mm
@@ -54,7 +54,7 @@ NSString *toNSString(const UString& s)
{
if (s.isEmpty())
return nil;
- return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s.data()) length:s.size()];
+ return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s.characters()) length:s.length()];
}
static NSString *toNSString(const SourceCode& s)
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index aefd56b..d6faeca 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -3908,7 +3908,7 @@ static WebFrame *incrementFrame(WebFrame *frame, BOOL forward, BOOL wrapFlag)
- (BOOL)canGoBack
{
- if (!_private->page)
+ if (!_private->page || _private->page->defersLoading())
return NO;
return !!_private->page->backForwardList()->backItem();
@@ -3916,7 +3916,7 @@ static WebFrame *incrementFrame(WebFrame *frame, BOOL forward, BOOL wrapFlag)
- (BOOL)canGoForward
{
- if (!_private->page)
+ if (!_private->page || _private->page->defersLoading())
return NO;
return !!_private->page->backForwardList()->forwardItem();