Diff
Modified: trunk/Source/WebCore/ChangeLog (165907 => 165908)
--- trunk/Source/WebCore/ChangeLog 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebCore/ChangeLog 2014-03-19 19:24:30 UTC (rev 165908)
@@ -1,3 +1,21 @@
+2014-03-19 Yongjun Zhang <yongjun_zh...@apple.com>
+
+ [iOS] WebKit2 Quicklook.
+ https://bugs.webkit.org/show_bug.cgi?id=130360
+
+ Reviewed by Tim Horton.
+
+ Since ResourceLoaders using WebKit2 network process don't have ResourceHandle any more, we
+ need to make it possible to create QuickLookHandle from ResourceLoader.
+
+ * WebCore.exp.in: Make some QuickLookHandle methods visible from WebKit2.
+ * loader/ResourceLoader.h: Add m_quickLookHandle data member to ResourceLoader.
+ (WebCore::ResourceLoader::quickLookHandle):
+ (WebCore::ResourceLoader::setQuickLookHandle):
+ * platform/network/ios/QuickLook.h: Add a new method to create QuickLookHandle from ResourceLoader.
+ * platform/network/ios/QuickLook.mm:
+ (WebCore::QuickLookHandle::create):
+
2014-03-19 Brent Fulgham <bfulg...@apple.com>
Fix cue rendering test and include support for left/right alignment
Modified: trunk/Source/WebCore/WebCore.exp.in (165907 => 165908)
--- trunk/Source/WebCore/WebCore.exp.in 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-03-19 19:24:30 UTC (rev 165908)
@@ -2471,6 +2471,12 @@
__ZN7WebCore15GraphicsContext22setEmojiDrawingEnabledEb
__ZN7WebCore15GraphicsContext23setIsAcceleratedContextEb
__ZN7WebCore15GraphicsContextC1EP9CGContextb
+__ZN7WebCore15QuickLookHandle10nsResponseEv
+__ZN7WebCore15QuickLookHandle14didReceiveDataEPK8__CFData
+__ZN7WebCore15QuickLookHandle16didFinishLoadingEv
+__ZN7WebCore15QuickLookHandle6createEPNS_14ResourceLoaderEP13NSURLResponseP11objc_object
+__ZN7WebCore15QuickLookHandle7didFailEv
+__ZN7WebCore15QuickLookHandleD1Ev
__ZN7WebCore15ResourceRequest39updateFromDelegatePreservingOldHTTPBodyERKS0_
__ZN7WebCore15StringTruncator12leftTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbf
__ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbf
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (165907 => 165908)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2014-03-19 19:24:30 UTC (rev 165908)
@@ -38,6 +38,10 @@
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
+#if USE(QUICK_LOOK)
+#include "QuickLook.h"
+#endif
+
namespace WebCore {
class AuthenticationChallenge;
@@ -154,6 +158,11 @@
void setDataBufferingPolicy(DataBufferingPolicy);
+#if USE(QUICK_LOOK)
+ QuickLookHandle* quickLookHandle() const { return m_quickLookHandle.get(); }
+ void setQuickLookHandle(PassOwnPtr<QuickLookHandle> handle) { m_quickLookHandle = handle; }
+#endif
+
protected:
ResourceLoader(Frame*, ResourceLoaderOptions);
@@ -202,6 +211,9 @@
bool m_defersLoading;
ResourceRequest m_deferredRequest;
ResourceLoaderOptions m_options;
+#if USE(QUICK_LOOK)
+ OwnPtr<QuickLookHandle> m_quickLookHandle;
+#endif
};
inline const ResourceResponse& ResourceLoader::response() const
Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.h (165907 => 165908)
--- trunk/Source/WebCore/platform/network/ios/QuickLook.h 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.h 2014-03-19 19:24:30 UTC (rev 165908)
@@ -60,6 +60,7 @@
namespace WebCore {
class ResourceHandle;
+class ResourceLoader;
class SynchronousResourceHandleCFURLConnectionDelegate;
Class QLPreviewConverterClass();
@@ -91,6 +92,7 @@
#if USE(CFNETWORK)
static PassOwnPtr<QuickLookHandle> create(ResourceHandle*, SynchronousResourceHandleCFURLConnectionDelegate*, CFURLResponseRef);
#endif
+ static PassOwnPtr<QuickLookHandle> create(ResourceLoader*, NSURLResponse *, id delegate);
~QuickLookHandle();
bool didReceiveDataArray(CFArrayRef);
Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (165907 => 165908)
--- trunk/Source/WebCore/platform/network/ios/QuickLook.mm 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.mm 2014-03-19 19:24:30 UTC (rev 165908)
@@ -31,6 +31,7 @@
#import "FileSystemIOS.h"
#import "Logging.h"
#import "ResourceHandle.h"
+#import "ResourceLoader.h"
#import "RuntimeApplicationChecksIOS.h"
#import "SoftLinking.h"
#import "SynchronousResourceHandleCFURLConnectionDelegate.h"
@@ -392,6 +393,14 @@
}
#endif
+PassOwnPtr<QuickLookHandle> QuickLookHandle::create(ResourceLoader* loader, NSURLResponse *response, id delegate)
+{
+ if (loader->request().isMainResourceRequest() && [WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:[response MIMEType]])
+ return adoptPtr(new QuickLookHandle(NULL, nil, response, delegate));
+
+ return nullptr;
+}
+
NSURLResponse *QuickLookHandle::nsResponse()
{
return m_nsResponse;
Modified: trunk/Source/WebKit2/ChangeLog (165907 => 165908)
--- trunk/Source/WebKit2/ChangeLog 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebKit2/ChangeLog 2014-03-19 19:24:30 UTC (rev 165908)
@@ -1,3 +1,27 @@
+2014-03-19 Yongjun Zhang <yongjun_zh...@apple.com>
+
+ [iOS] WebKit2 Quicklook.
+ https://bugs.webkit.org/show_bug.cgi?id=130360
+
+ For WebKit2 resource loads, if we detect a quicklook content that QLConverter is able to
+ convert, handle the response data to QLConverter and use its delegate WKWebResourceQuickLookDelegate
+ to rounte the converted results (HTML) back into WebCore. Thie similiar logic has been in place
+ for WebKit1.
+
+ Reviewed by Tim Horton.
+
+ * WebKit2.xcodeproj/project.pbxproj: Add WebResourceLoaderIOS.mm to the project.
+ * WebProcess/Network/WebResourceLoadScheduler.cpp:
+ * WebProcess/ios/WebResourceLoaderIOS.mm: Added.
+ (-[WKWebResourceQuickLookDelegate initWithWebResourceLoader:WebKit::]): WKWebResourceQuickLookDelegate holds
+ the original WebResourceLoader so that we could send converted result to WebCore.
+ (-[WKWebResourceQuickLookDelegate connection:didReceiveDataArray:]):
+ (-[WKWebResourceQuickLookDelegate connection:didReceiveData:lengthReceived:]):
+ (-[WKWebResourceQuickLookDelegate connectionDidFinishLoading:]):
+ (-[WKWebResourceQuickLookDelegate connection:didFailWithError:]):
+ (-[WKWebResourceQuickLookDelegate clearHandle]):
+ (WebKit::WebResourceLoader::setUpQuickLookHandleIfNeeded):
+
2014-03-19 Tim Horton <timothy_hor...@apple.com>
WebKit2 View Gestures: Swipe gesture can track vertical movement instead of horizontal movement
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (165907 => 165908)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-03-19 19:24:30 UTC (rev 165908)
@@ -451,6 +451,7 @@
1F7506B61859165700EC0FF7 /* WKWebProcessPlugInNodeHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F0181711858DC1600F92884 /* WKWebProcessPlugInNodeHandleInternal.h */; };
1F7506B71859165A00EC0FF7 /* WKWebProcessPlugInHitTestResultInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F01816E1858DC1600F92884 /* WKWebProcessPlugInHitTestResultInternal.h */; };
1F7506B81859165D00EC0FF7 /* WKWebProcessPlugInFrameInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F01816B1858DC1500F92884 /* WKWebProcessPlugInFrameInternal.h */; };
+ 1F8724B718D7632B0076D4B4 /* WebResourceLoaderIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F8724B318D7631D0076D4B4 /* WebResourceLoaderIOS.mm */; };
1FB00AC7185F76460019142E /* WKWebProcessPlugInPageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FB00AC4185F76460019142E /* WKWebProcessPlugInPageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; };
1FB00AC8185F76460019142E /* WKWebProcessPlugInPageGroup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1FB00AC5185F76460019142E /* WKWebProcessPlugInPageGroup.mm */; };
1FB00AC9185F76460019142E /* WKWebProcessPlugInPageGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FB00AC6185F76460019142E /* WKWebProcessPlugInPageGroupInternal.h */; };
@@ -2210,6 +2211,7 @@
1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInLoadDelegate.h; sourceTree = "<group>"; };
1F604BA61889FA7400EE0395 /* WKRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRenderingProgressEvents.h; sourceTree = "<group>"; };
1F604BA71889FA7400EE0395 /* WKRenderingProgressEventsInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRenderingProgressEventsInternal.h; sourceTree = "<group>"; };
+ 1F8724B318D7631D0076D4B4 /* WebResourceLoaderIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebResourceLoaderIOS.mm; path = ios/WebResourceLoaderIOS.mm; sourceTree = "<group>"; };
1FB00AC4185F76460019142E /* WKWebProcessPlugInPageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInPageGroup.h; sourceTree = "<group>"; };
1FB00AC5185F76460019142E /* WKWebProcessPlugInPageGroup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInPageGroup.mm; sourceTree = "<group>"; };
1FB00AC6185F76460019142E /* WKWebProcessPlugInPageGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInPageGroupInternal.h; sourceTree = "<group>"; };
@@ -4290,6 +4292,14 @@
path = Cocoa;
sourceTree = "<group>";
};
+ 1F8724B218D763040076D4B4 /* ios */ = {
+ isa = PBXGroup;
+ children = (
+ 1F8724B318D7631D0076D4B4 /* WebResourceLoaderIOS.mm */,
+ );
+ name = ios;
+ sourceTree = "<group>";
+ };
2989A40E167D1813004F96D2 /* CustomProtocols */ = {
isa = PBXGroup;
children = (
@@ -4646,6 +4656,7 @@
5105B0D2162F7A5E00E27709 /* Network */ = {
isa = PBXGroup;
children = (
+ 1F8724B218D763040076D4B4 /* ios */,
5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */,
5105B0D5162F7A7A00E27709 /* NetworkProcessConnection.h */,
51FB0902163A3B1C00EC324A /* NetworkProcessConnection.messages.in */,
@@ -8410,6 +8421,7 @@
37948403150C350600E52CE9 /* WebRenderLayer.cpp in Sources */,
2D28F3E61885CCC1004B9EAE /* WebEditorClientIOS.mm in Sources */,
3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */,
+ 1F8724B718D7632B0076D4B4 /* WebResourceLoaderIOS.mm in Sources */,
51217464164C21370037A5C1 /* WebResourceBuffer.cpp in Sources */,
3336762F130C9998006C9DE2 /* WebResourceCacheManager.cpp in Sources */,
33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (165907 => 165908)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2014-03-19 19:24:30 UTC (rev 165908)
@@ -106,6 +106,13 @@
Ref<WebResourceLoader> protect(*this);
ResourceResponse responseCopy(response);
+
+#if USE(QUICK_LOOK)
+ setUpQuickLookHandleIfNeeded(response);
+ if (QuickLookHandle* quickLookHandle = m_coreLoader->quickLookHandle())
+ responseCopy = ResourceResponse(quickLookHandle->nsResponse());
+#endif
+
// FIXME: This should use CertificateInfo to avoid the platform ifdefs. See https://bugs.webkit.org/show_bug.cgi?id=124724.
#if PLATFORM(COCOA)
responseCopy.setCertificateChain(certificateInfo.certificateChain());
@@ -126,12 +133,26 @@
void WebResourceLoader::didReceiveData(const IPC::DataReference& data, int64_t encodedDataLength)
{
LOG(Network, "(WebProcess) WebResourceLoader::didReceiveData of size %i for '%s'", (int)data.size(), m_coreLoader->url().string().utf8().data());
+
+#if USE(QUICK_LOOK)
+ if (QuickLookHandle* quickLookHandle = m_coreLoader->quickLookHandle()) {
+ RetainPtr<CFDataRef> rawData = adoptCF(CFDataCreateWithBytesNoCopy(0, data.data(), data.size(), kCFAllocatorNull));
+ if (quickLookHandle->didReceiveData(rawData.get()))
+ return;
+ }
+#endif
m_coreLoader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, DataPayloadBytes);
}
void WebResourceLoader::didFinishResourceLoad(double finishTime)
{
LOG(Network, "(WebProcess) WebResourceLoader::didFinishResourceLoad for '%s'", m_coreLoader->url().string().utf8().data());
+
+#if USE(QUICK_LOOK)
+ QuickLookHandle* quickLookHandle = resourceLoader()->quickLookHandle();
+ if (quickLookHandle && quickLookHandle->didFinishLoading())
+ return;
+#endif
m_coreLoader->didFinishLoading(finishTime);
}
@@ -139,6 +160,10 @@
{
LOG(Network, "(WebProcess) WebResourceLoader::didFailResourceLoad for '%s'", m_coreLoader->url().string().utf8().data());
+#if USE(QUICK_LOOK)
+ if (QuickLookHandle *quickLookHandle = resourceLoader()->quickLookHandle())
+ quickLookHandle->didFail();
+#endif
m_coreLoader->didFail(error);
}
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h (165907 => 165908)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h 2014-03-19 19:21:03 UTC (rev 165907)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h 2014-03-19 19:24:30 UTC (rev 165908)
@@ -88,6 +88,10 @@
void canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace&);
#endif
+#if USE(QUICK_LOOK)
+ void setUpQuickLookHandleIfNeeded(const WebCore::ResourceResponse&);
+#endif
+
RefPtr<WebCore::ResourceLoader> m_coreLoader;
};
Added: trunk/Source/WebKit2/WebProcess/ios/WebResourceLoaderIOS.mm (0 => 165908)
--- trunk/Source/WebKit2/WebProcess/ios/WebResourceLoaderIOS.mm (rev 0)
+++ trunk/Source/WebKit2/WebProcess/ios/WebResourceLoaderIOS.mm 2014-03-19 19:24:30 UTC (rev 165908)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebResourceLoader.h"
+
+#if ENABLE(NETWORK_PROCESS)
+#include "DataReference.h"
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceLoader.h>
+
+using namespace WebCore;
+
+#if USE(QUICK_LOOK)
+
+@interface WKWebResourceQuickLookDelegate : NSObject <NSURLConnectionDelegate> {
+ RefPtr<WebKit::WebResourceLoader> _webResourceLoader;
+}
+@end
+
+@implementation WKWebResourceQuickLookDelegate
+
+- (id)initWithWebResourceLoader:(PassRefPtr<WebKit::WebResourceLoader>)loader
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _webResourceLoader = loader;
+ return self;
+}
+
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
+{
+ UNUSED_PARAM(connection);
+ if (!_webResourceLoader)
+ return;
+ _webResourceLoader->resourceLoader()->didReceiveDataArray(reinterpret_cast<CFArrayRef>(dataArray));
+}
+#endif
+
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+{
+ UNUSED_PARAM(connection);
+ if (!_webResourceLoader)
+ return;
+
+ // QuickLook code sends us a nil data at times. The check below is the same as the one in
+ // ResourceHandleMac.cpp added for a different bug.
+ if (![data length])
+ return;
+ _webResourceLoader->resourceLoader()->didReceiveData(reinterpret_cast<const char*>([data bytes]), [data length], lengthReceived, DataPayloadBytes);
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+{
+ UNUSED_PARAM(connection);
+ if (!_webResourceLoader)
+ return;
+
+ _webResourceLoader->resourceLoader()->didFinishLoading(0);
+}
+
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+{
+ UNUSED_PARAM(connection);
+
+ _webResourceLoader->resourceLoader()->didFail(ResourceError(error));
+}
+
+- (void)clearHandle
+{
+ _webResourceLoader = nullptr;
+}
+
+@end
+
+namespace WebKit {
+
+void WebResourceLoader::setUpQuickLookHandleIfNeeded(const ResourceResponse& response)
+{
+ ResourceLoader *coreLoader = resourceLoader();
+ RetainPtr<WKWebResourceQuickLookDelegate> delegate = adoptNS([[WKWebResourceQuickLookDelegate alloc] initWithWebResourceLoader:this]);
+ OwnPtr<QuickLookHandle> quickLookHandle = QuickLookHandle::create(coreLoader, response.nsURLResponse(), delegate.get());
+ if (quickLookHandle)
+ coreLoader->setQuickLookHandle(quickLookHandle.release());
+}
+
+} // namespace WebKit
+
+#endif
+
+#endif // ENABLE(NETWORK_PROCESS)