Replace uses of CrossThreadTask in DefaultSharedWorkerRepository, WorkerMessagingProxy with C++11 lambdas
https://bugs.webkit.org/show_bug.cgi?id=133375

Reviewed by Darin Adler.

Uses of CrossThreadTask in the two classes are replaced with C++11 lambdas.
The necessary cross-thread copies are created manually and passed into the
lambdas by value, removing the need for CrossThreadTask and its use of CrossThreadCopier.

Remove the explicit use of this pointer in some lambdas -- it is captured automatically when
capturing by value, so enforcing its capturing through explicit use is not necessary.

* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerProxy::postExceptionToWorkerObject):
(WebCore::SharedWorkerProxy::postConsoleMessageToWorkerObject):
(WebCore::postExceptionTask): Deleted.
(WebCore::postConsoleMessageTask): Deleted.
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::workerObjectDestroyed):
(WebCore::WorkerMessagingProxy::notifyNetworkStateChange):
(WebCore::WorkerMessagingProxy::connectToInspector):
(WebCore::WorkerMessagingProxy::disconnectFromInspector):
(WebCore::WorkerMessagingProxy::sendMessageToInspector):
(WebCore::WorkerMessagingProxy::postMessageToPageInspector):
(WebCore::WorkerMessagingProxy::confirmMessageFromWorkerObject):
(WebCore::WorkerMessagingProxy::reportPendingActivity):
(WebCore::postConsoleMessageTask): Deleted.
(WebCore::WorkerMessagingProxy::workerObjectDestroyedInternal): Deleted.
(WebCore::connectToWorkerGlobalScopeInspectorTask): Deleted.
(WebCore::disconnectFromWorkerGlobalScopeInspectorTask): Deleted.
(WebCore::dispatchOnInspectorBackendTask): Deleted.
* workers/WorkerMessagingProxy.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pass C++11 lambdas to callOnMainThread() calls in IconDatabase
https://bugs.webkit.org/show_bug.cgi?id=133374

Reviewed by Darin Adler.

Use C++11 lambads to inline the main thread tasks into the calling code,
modernizing the look of the code and removing a few static methods and
classes that were used as helpers.

* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::scheduleOrDeferSyncTimer):
(WebCore::IconDatabase::performURLImport):
(WebCore::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread):
(WebCore::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread):
(WebCore::IconDatabase::dispatchDidRemoveAllIconsOnMainThread):
(WebCore::IconDatabase::dispatchDidFinishURLImportOnMainThread):
(WebCore::IconDatabase::notifyPendingLoadDecisionsOnMainThread): Deleted.
(WebCore::IconDatabase::performScheduleOrDeferSyncTimer): Deleted.
(WebCore::IconDatabase::performScheduleOrDeferSyncTimerOnMainThread): Deleted.
(WebCore::ClientWorkItem::ClientWorkItem): Deleted.
(WebCore::ClientWorkItem::~ClientWorkItem): Deleted.
(WebCore::ImportedIconURLForPageURLWorkItem::ImportedIconURLForPageURLWorkItem): Deleted.
(WebCore::ImportedIconURLForPageURLWorkItem::~ImportedIconURLForPageURLWorkItem): Deleted.
(WebCore::ImportedIconURLForPageURLWorkItem::performWork): Deleted.
(WebCore::ImportedIconDataForPageURLWorkItem::ImportedIconDataForPageURLWorkItem): Deleted.
(WebCore::ImportedIconDataForPageURLWorkItem::~ImportedIconDataForPageURLWorkItem): Deleted.
(WebCore::ImportedIconDataForPageURLWorkItem::performWork): Deleted.
(WebCore::RemovedAllIconsWorkItem::RemovedAllIconsWorkItem): Deleted.
(WebCore::RemovedAllIconsWorkItem::performWork): Deleted.
(WebCore::FinishedURLImport::FinishedURLImport): Deleted.
(WebCore::FinishedURLImport::performWork): Deleted.
(WebCore::performWorkItem): Deleted.
* loader/icon/IconDatabase.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169674 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use C++11 lambdas to construct FileThread::Task objects
https://bugs.webkit.org/show_bug.cgi?id=133079

Reviewed by Darin Adler.

Have FileThread::Task constructor take in a std::function<void ()>-like object
as the second parameter. Much like with ScriptExecutionContext::Task, the idea here
is to use inlined C++11 lambdas in FileThread::postTask() calls. Because FileThread::Task
also requires an instance pointer, a brace-init list is passed to these calls, passing
in the instance pointer as the first parameter and the C++11 lambda as the second.

FileThread::postTask() now takes in a FileThread::Task rvalue and moves it onto the heap
and into the queue.

In AsyncFileStream.cpp, calls to FileThread::postTask() are updated to use C++11 lambdas.
Uses of MainThreadTask are also replaced by C++11 lambdas. This modernizes the code and
removes a lot of helper functions.

FileThread::Task doesn't use CrossThreadCopier anymore. Instead, we manually produce
thread-safe copies as necessary. At the moment this approach produces another copy when
passing the freshly-copied object into the lambda, but this will be avoidable once we
make C++14 and the lambda capture expression support mandatory.

* fileapi/AsyncFileStream.cpp:
(WebCore::AsyncFileStream::create):
(WebCore::AsyncFileStream::stop):
(WebCore::AsyncFileStream::getSize):
(WebCore::AsyncFileStream::openForRead):
(WebCore::AsyncFileStream::openForWrite):
(WebCore::AsyncFileStream::close):
(WebCore::AsyncFileStream::read):
(WebCore::AsyncFileStream::write):
(WebCore::AsyncFileStream::truncate):
(WebCore::didStart): Deleted.
(WebCore::AsyncFileStream::startOnFileThread): Deleted.
(WebCore::derefProxyOnMainThread): Deleted.
(WebCore::AsyncFileStream::stopOnFileThread): Deleted.
(WebCore::didGetSize): Deleted.
(WebCore::AsyncFileStream::getSizeOnFileThread): Deleted.
(WebCore::didOpen): Deleted.
(WebCore::AsyncFileStream::openForReadOnFileThread): Deleted.
(WebCore::AsyncFileStream::openForWriteOnFileThread): Deleted.
(WebCore::AsyncFileStream::closeOnFileThread): Deleted.
(WebCore::didRead): Deleted.
(WebCore::AsyncFileStream::readOnFileThread): Deleted.
(WebCore::didWrite): Deleted.
(WebCore::AsyncFileStream::writeOnFileThread): Deleted.
(WebCore::didTruncate): Deleted.
(WebCore::AsyncFileStream::truncateOnFileThread): Deleted.
* fileapi/AsyncFileStream.h:
* fileapi/FileThread.cpp:
(WebCore::FileThread::postTask):
* fileapi/FileThread.h:
(WebCore::FileThread::Task::Task):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTTPHeaderMap should not derive from HashMap
https://bugs.webkit.org/show_bug.cgi?id=133392

Reviewed by Darin Adler.

Source/WebCore:
Use a HashMap member variable instead.

* WebCore.exp.in:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::copyData):
(WebCore::HTTPHeaderMap::adopt):
(WebCore::HTTPHeaderMap::get):
(WebCore::HTTPHeaderMap::set):
(WebCore::HTTPHeaderMap::add):
(WebCore::HTTPHeaderMap::contains):
(WebCore::HTTPHeaderMap::find):
(WebCore::HTTPHeaderMap::remove):
(WebCore::HTTPHeaderMap::keys):
* platform/network/HTTPHeaderMap.h:
(WebCore::HTTPHeaderMap::isEmpty):
(WebCore::HTTPHeaderMap::size):
(WebCore::HTTPHeaderMap::clear):
(WebCore::HTTPHeaderMap::begin):
(WebCore::HTTPHeaderMap::end):
(WebCore::HTTPHeaderMap::operator==):
(WebCore::HTTPHeaderMap::operator!=):
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::adopt):
* platform/network/ResourceRequestBase.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::adopt):
* platform/network/ResourceResponseBase.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createRequest):

Source/WebKit2:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<HTTPHeaderMap>::encode):
(IPC::ArgumentCoder<HTTPHeaderMap>::decode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get rid of _WKScriptWorld
https://bugs.webkit.org/show_bug.cgi?id=133610

Reviewed by Dan Bernstein.

* Shared/API/Cocoa/WebKitPrivate.h:
* UIProcess/API/Cocoa/_WKScriptWorld.h: Removed.
* UIProcess/API/Cocoa/_WKScriptWorld.mm: Removed.
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Regression r168397 - Form layout is incorrect on OS X Yosemite
https://bugs.webkit.org/show_bug.cgi?id=133612
<rdar://problem/16850492>
<rdar://problem/17016914>

Reviewed by Anders Carlson.

Revision 168397 introduced a new animated style of form controls. Part of
it included extending the margins for the controls to take into account the
focus ring that animates in from a large radius to a small radius. This
caused two problems:

- the incorrect margins broke many layouts
- despite increased margins, there were still some areas
  that did not repaint correctly.

Restore the old margins and (temporarily) turn off focus ring animation.
Bad layout is much worse than a missing animation. Another benefit
of this is that we will use less memory.

* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::drawFocusRingToContextAtTime): Pass in a time far far far in the future to
get the static rendering.
* platform/mac/ThemeMac.mm:
(WebCore::checkboxMargins): Restore correct margins.
(WebCore::radioMargins): Ditto.
(WebCore::drawCellFocusRing): New method that calls WKSI with a future time.
(WebCore::paintToggleButton): Call the new wrapper.
(WebCore::buttonMargins): Restore correct margins.
(WebCore::paintButton): Call the new wrapper.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuList): Use a future time.
(WebCore::RenderThemeMac::platformFocusRingMaxWidth): Deleted. Use old outline value.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/17208234> [Mac] Client-certificate authentication isn’t working when using the modern API
https://bugs.webkit.org/show_bug.cgi?id=133617

Reviewed by Sam Weinig.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Credential>::encode): Encode certificate credentials on Mac as well.
(IPC::ArgumentCoder<Credential>::decode): Decode certificate credentials on Mac as well.

* Shared/cf/ArgumentCodersCF.cpp:
(IPC::encode): Use OS X API for getting a persistent reference to a key.
(IPC::decode): Use OS X API for getting a key from a persistent reference.

* Shared/cf/ArgumentCodersCF.h: Make identity coding available on Mac as well.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cococa] WKWindowFeatures.h is missing from WebKit.framework
https://bugs.webkit.org/show_bug.cgi?id=133622

Reviewed by Sam Weinig.

* WebKit2.xcodeproj/project.pbxproj: Promoted WKWindowFeatures.h to Public.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] WKScriptMessage should include the frame the message is from
<rdar://problem/17210226>
https://bugs.webkit.org/show_bug.cgi?id=133623

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKScriptMessage.h:
Add WKFrameInfo property.

* UIProcess/API/Cocoa/WKScriptMessage.mm:
(-[WKScriptMessage _initWithBody:webView:frameInfo:name:]):
Add WKFrameInfo to the initializer.

(-[WKScriptMessage frameInfo]):
Implement frameInfo accessor.

* UIProcess/API/Cocoa/WKScriptMessageInternal.h:
Add WKFrameInfo to the initializer.

* UIProcess/API/Cocoa/WKUserContentController.mm:
Pass the WKFrameInfo to the WKScriptMessage initializer.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] checkboxes and radio buttons animate incorrectly
https://bugs.webkit.org/show_bug.cgi?id=133619
<rdar://problem/16478676>

Reviewed by Sam Weinig.

As many people have noticed, the new checkboxes and radio
buttons jump around during their animation. To fix this
I've added yet another magic set of numbers to our
native form positioning - this time the placement
of the controls when rendering on the animated path.
This is quite annoying, since there doesn't appear
to be any pattern to the offsets (or margins) given
a control size, and this case also needed a sub-pixel
offset to display correctly on retina machines.

* platform/mac/ThemeMac.mm:
(WebCore::checkboxMargins): Add comment so I know what the values mean.
(WebCore::checkboxOffsets): Add the magic translation values for animated states.
(WebCore::radioMargins): Ditto.
(WebCore::radioOffsets):
(WebCore::paintToggleButton): Paint with these new offsets.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169685 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening. Skip a test which generates "No bad fd found." error.

* platform/efl-wk1/TestExpectations:
* platform/efl/http/tests/misc/slow-loading-mask-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Share mac/editing/spelling/editing-word-with-marker-2.html with other platforms
https://bugs.webkit.org/show_bug.cgi?id=133544

Reviewed by Darin Adler.

Move mac/editing/spelling/editing-word-with-marker-2.html into
common editing/spelling to be available for other platforms.

Additionally, verify spelling markers asynchronously as the sync
path it's likely to be removed.

Add test case which tests spelling markers without any
selection change.

* editing/spelling/editing-word-with-marker-2-expected.txt:
Renamed from platform/mac/editing/spelling/editing-word-with-marker-2-expected.txt.

* editing/spelling/editing-word-with-marker-2.html:
Renamed from platform/mac/editing/spelling/editing-word-with-marker-2.html.

* platform/gtk/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/win/TestExpectations:
Mark editing/spelling/editing-word-with-marker-2.html as failing since those
platforms didn't turn on asynchronous spellchecking.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Merge remote-tracking branch 'upstream/master'