Cleanup BasicShape blending check
https://bugs.webkit.org/show_bug.cgi?id=102289

Reviewed by Daniel Bates.

CSSPropertyAnimation had the same code for varifying that two BasicShape objects can be blended
twice. Refactor the code and add a canBlend method in BasicShape that combines both checks. This
is a preparation for follow-up patches.

Pure refactoring without behavior change, no new tests.

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Call new canBlend method for blending verification.
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShape::canBlend): Check if two BasicShape objects can be blended.
(WebCore):
* rendering/style/BasicShapes.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Remove magic numbers in record comparator, handle missing case
https://bugs.webkit.org/show_bug.cgi?id=102255

Reviewed by Tony Chang.

Source/WebCore:

For some ranges of metadata entries, a simple type byte comparison is sufficient
for the backing store comparator. In two places those ranges used magic numbers,
one of which was incorrect - which could lead to failed reads/writes.

Test: webkit_unit_tests --gtest_filter='IDBLevelDBCodingTest.ComparisonTest'

* Modules/indexeddb/IDBLevelDBCoding.cpp:
(IDBLevelDBCoding):
(WebCore::IDBLevelDBCoding::compare):
* Modules/indexeddb/IDBLevelDBCoding.h:

Source/WebKit/chromium:

Add test keys for various metadata types.

* tests/IDBLevelDBCodingTest.cpp:
(IDBLevelDBCoding::TEST):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebKit2] Need API in UIProcess to enable loading of custom protocols
https://bugs.webkit.org/show_bug.cgi?id=101674

Reviewed by Brady Eidson.

Source/WebKit2:

Enable clients of WebKit2 to implement NSURLProtocol subclasses to
control the loading of resources with schemes that WebKit2 cannot
handle natively. Since loading happens in a different process, we
accomplish this by registering a global NSURLProtocol in the web
process and proxying NSURLProtocol and NSURLProtocolClient calls to
the client's NSURLProtocol in the UI process.

* DerivedSources.make: Addded new .messages.in files.
* Platform/CoreIPC/MessageID.h:
* Shared/WebProcessCreationParameters.cpp: Added the list of supported schemes.
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/mac/WKBrowsingContextController.h:
* UIProcess/API/mac/WKBrowsingContextController.mm:
(+[WKBrowsingContextController registerSchemeForCustomProtocol:]):
Added a class method where a client can register a scheme that it supports.
(+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]):
Added a class method where a client can unregister a scheme that it no longer supports.
(+[WKBrowsingContextController customSchemes]):
* UIProcess/API/mac/WKBrowsingContextControllerInternal.h:
* UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h: Added.
* UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.messages.in: Added.
* UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm: Added.

Implemented an NSURLConnectionDelegate that proxies messages to the
equivalent NSURLProtocolClient in the web process:
(-[WKCustomProtocolLoader initWithCustomProtocolManagerProxy:customProtocolID:request:connection:]):
(-[WKCustomProtocolLoader dealloc]):
(-[WKCustomProtocolLoader connection:didFailWithError:]):
(-[WKCustomProtocolLoader connection:willCacheResponse:]):
(-[WKCustomProtocolLoader connection:didReceiveResponse:]):
(-[WKCustomProtocolLoader connection:didReceiveData:]):
(-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
(-[WKCustomProtocolLoader connectionDidFinishLoading:]):

Implemented a proxy that recieves -startLoading and -stopLoading
messages from the NSURLProtocol in the web process and starts an
NSURLConnection in the UI process, which will instantiate the client's NSURLProtocol:
(WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy):
(WebKit::CustomProtocolManagerProxy::didReceiveMessage):
(WebKit::CustomProtocolManagerProxy::startLoading):
(WebKit::CustomProtocolManagerProxy::stopLoading):

* UIProcess/WebContext.h: Declared strings that store names of
NSNotifications used for scheme registration in the UI process.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::didReceiveMessage): Forwarded messages to the
CustomProtocolManagerProxy.
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess): Added the currently
registered schemes to the WebProcessCreationParameters and register
NSNotification observers for new scheme registration that forwards to
the context's web processes.
* WebKit2.xcodeproj/project.pbxproj:
* WebKit2Prefix.h: Enabled the CUSTOM_PROTOCOLS macro for the Mac.
* WebProcess/Network/CustomProtocols/CustomProtocolManager.h: Added.
* WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in: Added.
* WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm: Added.
(generateCustomProtocolID): Generate a per-WebProcess unique ID.

Implemented a global NSURLProtocol that claims to support all schemes
registered in the UI process. When NSURLConnection calls -startLoading
and -stopLoading, we forward these messages to the client's NSURLProtocol
in the UI process:
(+[WKCustomProtocol canInitWithRequest:]):
(+[WKCustomProtocol canonicalRequestForRequest:]):
(+[WKCustomProtocol requestIsCacheEquivalent:toRequest:]):
(-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
(-[WKCustomProtocol startLoading]):
(-[WKCustomProtocol stopLoading]):

Implemented a manager that receives NSURLConnectionDelegate messages
forwarded from the UI process and passes them to the global NSURLProtocol's NSURLProtocolClient:
(WebKit::CustomProtocolManager::shared):
(WebKit::CustomProtocolManager::registerCustomProtocolClass):
(WebKit::CustomProtocolManager::addCustomProtocol):
(WebKit::CustomProtocolManager::removeCustomProtocol):
(WebKit::CustomProtocolManager::registerScheme):
(WebKit::CustomProtocolManager::unregisterScheme):
(WebKit::CustomProtocolManager::supportsScheme):
(WebKit::CustomProtocolManager::didReceiveMessage):
(WebKit::CustomProtocolManager::didFailWithError):
(WebKit::CustomProtocolManager::didLoadData):
(WebKit::CustomProtocolManager::didReceiveResponse):
(WebKit::CustomProtocolManager::didFinishLoading):
(WebKit::CustomProtocolManager::protocolForID):

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessage): Forwarded messages to the
shared CustomProtocolManager.
(WebKit::WebProcess::registerSchemeForCustomProtocol): Register a
scheme received from the UI process.
(WebKit::WebProcess::unregisterSchemeForCustomProtocol): Unregister a
scheme received from the UI process.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in: Declared messages for passing
supported schemes from the UI process the web process.
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformInitializeWebProcess): Register the
schemes contained in the WebProcessCreationParameters.

Tools:

Add an API test that implements a custom protocol and attempts to load
a resource requiring that protocol in a WKView. The test passes only if
didFinishLoadForFrame: fires.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm: Added.
(+[TestProtocol canInitWithRequest:]):
(+[TestProtocol canonicalRequestForRequest:]):
(+[TestProtocol requestIsCacheEquivalent:toRequest:]):
(-[TestProtocol startLoading]):
(-[TestProtocol stopLoading]):
* TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm:
* TestWebKitAPI/mac/TestBrowsingContextLoadDelegate.h: Copied from Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h.
* TestWebKitAPI/mac/TestBrowsingContextLoadDelegate.mm: Copied from Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h.
(-[TestBrowsingContextLoadDelegate initWithBlockToRunOnLoad:]):
(-[TestBrowsingContextLoadDelegate browsingContextControllerDidFinishLoad:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134681 268f45cc-cd09-0410-ab3c-d52691b4dbfc