Stop using PLATFORM(MAC) in WebKit2/UIProcess except where it means “OS X but not iOS”
https://bugs.webkit.org/show_bug.cgi?id=128868

Reviewed by Anders Carlsoon.

* UIProcess/API/C/WKPage.cpp: Changed PLATFORM(MAC) to PLATFORM(COCOA).
* UIProcess/Databases/DatabaseProcessProxy.cpp:
(WebKit::DatabaseProcessProxy::didCreateDatabaseToWebProcessConnection): Changed
PLATFORM(MAC) to OS(DARWIN) around use of Mach-based IPC.
* UIProcess/DrawingAreaProxy.cpp: Changed PLATFORM(MAC) to PLATFORM(COCOA)
(WebKit::DrawingAreaProxy::DrawingAreaProxy):
* UIProcess/DrawingAreaProxy.h: Ditto.
* UIProcess/DrawingAreaProxy.messages.in: Ditto.
* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::didFinishLaunchingProcess): Changed PLATFORM(MAC) to OS(DARWIN)
around use of Mach API.
* UIProcess/Launcher/ProcessLauncher.h: Ditto.
* UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h: Changed PLATFORM(MAC) to
PLATFORM(COCOA)
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): Changed PLATFORM(MAC)
to OS(DARWIN).
(WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess): Ditto.
(WebKit::NetworkProcessProxy::didFinishLaunching): Changed PLATFORM(MAC) to PLATFORM(COCOA)
around process suppression call.
* UIProcess/Network/NetworkProcessProxy.h: Ditto.
* UIProcess/PageClient.h: Changed PLATFORM(MAC) to PLATFORM(COCOA).
* UIProcess/Plugins/PluginInfoStore.cpp: Ditto.
* UIProcess/Plugins/PluginProcessManager.h: Ditto.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::PluginProcessProxy): Ditto.
(WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch): Changed PLATFORM(MAC)
to OS(DARWIN).
(WebKit::PluginProcessProxy::didClose): Changed PLATFORM(MAC) to PLATFORM(COCOA).
(WebKit::PluginProcessProxy::didFinishLaunching): Changed PLATFORM(MAC) to OS(DARWIN) around
use of Mach-based IPC, and to PLATFORM(COCOA) around SetQOS.
(WebKit::PluginProcessProxy::didCreateWebProcessConnection): Changed PLATFORM(MAC) to
OS(DARWIN).
* UIProcess/Plugins/PluginProcessProxy.h: Changed PLATFORM(MAC) to PLATFORM(COCOA).
* UIProcess/Plugins/PluginProcessProxy.messages.in: Ditto.
* UIProcess/TextChecker.h: Ditto.
* UIProcess/WebContext.cpp: Ditto.
(WebKit::WebContext::ensureNetworkProcess):
(WebKit::WebContext::createNewWebProcess):
(WebKit::WebContext::setHTTPPipeliningEnabled):
(WebKit::WebContext::httpPipeliningEnabled):
(WebKit::WebContext::pluginInfoStoreDidLoadPlugins):
* UIProcess/WebContext.h: Ditto.
* UIProcess/WebContext.messages.in: Ditto.
* UIProcess/WebContextUserMessageCoders.h: Ditto.
(WebKit::WebContextUserMessageEncoder::encode):
(WebKit::WebContextUserMessageDecoder::decode):
* UIProcess/WebCookieManagerProxy.cpp: Ditto.
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
* UIProcess/WebCookieManagerProxy.h: Ditto.
* UIProcess/WebFormSubmissionListenerProxy.h: Ditto.
* UIProcess/WebFramePolicyListenerProxy.h: Ditto.
* UIProcess/WebInspectorProxy.h: Added !PLATFORM(IOS) around members reltated to managing
the inspector window and its view.
* UIProcess/WebPageProxy.cpp: Changed PLATFORM(MAC) to PLATFORM(COCOA).
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::recordNavigationSnapshot):
(WebKit::WebPageProxy::canShowMIMEType):
(WebKit::canCoalesce):
(WebKit::coalesce):
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::contextMenuItemSelected):
(WebKit::WebPageProxy::didReceiveEvent):
(WebKit::WebPageProxy::didBlockInsecurePluginVersion):
* UIProcess/WebPageProxy.h: Ditto.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/WebProcessProxy.cpp: Ditto.
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::createWebPage):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::removeWebPage):
(WebKit::WebProcessProxy::didFinishLaunching):
(WebKit::WebProcessProxy::pageSuppressibilityChanged):
(WebKit::WebProcessProxy::pagePreferencesChanged):
* UIProcess/WebProcessProxy.h: Ditto.
* UIProcess/cf/WebPreferencesCF.cpp: Removed this file which was not used in any
configuration.
* UIProcess/ios/WebInspectorProxyIOS.mm: Removed functions that no longer need to be
implemented for iOS.
* WebKit2.xcodeproj/project.pbxproj: Removed reference to WebPreferencesCF.cpp.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164172 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Form controls are always painted in the active state
https://bugs.webkit.org/show_bug.cgi?id=128872
<rdar://problem/9422677>

Reviewed by Dan Bernstein.

AppKit will always paint form controls in the active state if the view doesn't have a
window. Fix this by adding a fake window whose key appearance we'll update based on the
control state. Also, rename WebCoreFlippedView to WebCoreThemeView since it stopped being
just about the flippedness a long time ago.

* platform/mac/ThemeMac.h:
* platform/mac/ThemeMac.mm:
(-[WebCoreThemeWindow hasKeyAppearance]):
Return themeWindowHasKeyAppearance.

(-[WebCoreThemeView window]):
Create a WebCoreThemeWindow object lazily and return it.

(WebCore::paintCheckbox):
(WebCore::paintRadio):
(WebCore::paintButton):
Pass the control states to ThemeMac::ensuredView.

(WebCore::ThemeMac::ensuredView):
Set themeWindowHasKeyAppearance based on the control state.

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::documentViewFor):
Pass the control states to ThemeMac::ensuredView.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Setting currentTime on HTMLMediaElement with media controller should throw exception.
https://bugs.webkit.org/show_bug.cgi?id=128867.

Patch by Piotr Grad <p.grad@samsung.com> on 2014-02-15
Reviewed by Eric Carlson.

Source/WebCore:

Added implementation for setting currentTime in HTMLMediaElement. Old implementation
was left to be used internally.

Test: media/video-controller-currentTime.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:

LayoutTests:

* media/video-controller-currentTime-expected.txt: Added.
* media/video-controller-currentTime.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164174 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove 'static' specifier from free inline functions in StringImpl.h
https://bugs.webkit.org/show_bug.cgi?id=118554

Reviewed by Darin Adler.

At first 'static' does not bring any use here, secondly static free
inline functions in headers is a bad practice in general as each instance
of function defined as inline is treated as a separate function and each
instance has its own copy of static locals and string literals.

* wtf/text/StringImpl.h:
(WTF::codePointCompare):
(WTF::codePointCompare8):
(WTF::codePointCompare16):
(WTF::codePointCompare8To16):
(WTF::isSpaceOrNewline):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove double hashing from DatasetDOMStringMap::deleteItem
https://bugs.webkit.org/show_bug.cgi?id=128865

Reviewed by Benjamin Poulain.

* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::deleteItem): Removed call to hasAttribute, using the
result from removeAttribute instead.

* dom/Element.cpp:
(WebCore::Element::removeAttribute): Add a return value, false if nothing is removed,
and true if something is removed.
(WebCore::Element::removeAttributeNS): Ditto.
* dom/Element.h: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Avoid unnecessary asserts if "prepareToPlay" is called multiple times.
https://bugs.webkit.org/show_bug.cgi?id=128859

Reviewed by Eric Carlson.

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::createPlayer): Don't assert if player exists; just return the
existing copy.
(WebCore::AVFWrapper::createPlayerItem): Ditto (but with Player Items).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, roll out r164166.

This broke three unique tests:

** The following JSC stress test failures have been introduced:
    regress/script-tests/variadic-closure-call.js.default-ftl
    regress/script-tests/variadic-closure-call.js.ftl-no-cjit-validate
    regress/script-tests/variadic-closure-call.js.ftl-no-cjit-osr-validation
    regress/script-tests/variadic-closure-call.js.ftl-eager
    regress/script-tests/variadic-closure-call.js.ftl-eager-no-cjit
    regress/script-tests/variadic-closure-call.js.ftl-eager-no-cjit-osr-validation
    jsc-layout-tests.yaml/js/script-tests/unmatching-argument-count.js.layout-ftl-eager-no-cjit
    regress/script-tests/direct-arguments-getbyval.js.ftl-eager-no-cjit
    regress/script-tests/direct-arguments-getbyval.js.ftl-eager-no-cjit-osr-validation

* bytecode/PolymorphicAccessStructureList.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
* tests/stress/ftl-getbyval-arguments.js:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Stop calling mktemp(3).
https://bugs.webkit.org/show_bug.cgi?id=128826

Reviewed by Gyuyoung Kim.

mktemp(3) is an insecure function and should be avoided at all costs.
Replace its usage with mkdtemp(3): instead of just getting a file name
that is supposed to be random and unused, we now create a directory
with a random name and then put whatever files we need there with fixed
names.

* UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:
(TEST_F):
* UIProcess/API/efl/tests/test_ewk2_download_job.cpp:
(TEST_F):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
computeSelectionStart and computeSelectionEnd shouldn't trigger synchronous layout
https://bugs.webkit.org/show_bug.cgi?id=128806

Reviewed by Darin Adler.

Added indexForPosition to HTMLTextFormControlElement. Like r163825, this patch traverses the DOM tree
instead of the render tree to compute the index for a given position.

We traverse the DOM Tree backwards starting at the specified Position all the way back to the beginning
of the inner text element. The index is computed as the number of characters we encountered during
this backwards DOM traversal.

It's worth noting that passedPosition.computeNodeBeforePosition() returns and only returns 0 when the
position is before the first node of its parent or inside a text node. In such cases, we call
passedPosition.containerNode() to find the parent or the text node.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::indexForVisiblePosition): Use indexForPosition.
(WebCore::HTMLTextFormControlElement::computeSelectionStart): Ditto.
(WebCore::HTMLTextFormControlElement::computeSelectionEnd): Dotto.
(WebCore::finishText): Cleanup. Use newlineCharacter instead of hard-coding '\n'.
(WebCore::HTMLTextFormControlElement::indexForPosition): Added. See above for the description.
* html/HTMLTextFormControlElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] All WebKit clients should encrypt WebCrypto keys automatically
https://bugs.webkit.org/show_bug.cgi?id=128852

Reviewed by Oliver Hunt.

Source/WebCore: 

Install a persistent master key in Keychain on first use of WebCrypto key serialization.
The key is per application, protected with ACL.

* English.lproj/Localizable.strings:
* WebCore.exp.in:
* crypto/SerializedCryptoKeyWrap.h:
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::masterKeyAccountNameForCurrentApplication):
(WebCore::getDefaultWebCryptoMasterKey):
(WebCore::createAndStoreMasterKey):
(WebCore::findMasterKey):
* platform/LocalizedStrings.cpp:
(WebCore::webCryptoMasterKeyKeychainLabel):
(WebCore::webCryptoMasterKeyKeychainComment):
* platform/LocalizedStrings.h:

Source/WebKit/mac: 

* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::wrapCryptoKey):
(WebChromeClient::unwrapCryptoKey):
Call the default implementation if key is not provided by a client.

Source/WebKit2: 

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wrapCryptoKey):
(WebKit::WebPageProxy::unwrapCryptoKey):
Call the default implementation if key is not provided by a client.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164181 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add checked casts for ScriptExecutionContext.
<https://webkit.org/b/128874>

Generate casting helpers for casting from ScriptExecutionContext to
Document and WorkerGlobalScope. Apply heartily.

Reviewed by Antti Koivisto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTMLTextFormControlElement::subtreeHasChanged should be called before updating selection
https://bugs.webkit.org/show_bug.cgi?id=128870

Reviewed by Darin Adler.

Extracted HTMLTextFormControlElement::didEditInnerTextValue out of HTMLTextFormControlElement::defaultEventHandler
and called it in appliedEditing, unappliedEditing, and reappliedEditing before updating selection.

* editing/Editor.cpp:
(WebCore::notifyTextFromControls): Added.
(WebCore::Editor::appliedEditing): Update text form control's internal states before updating selection.
(WebCore::Editor::unappliedEditing): Ditto.
(WebCore::Editor::reappliedEditing): Ditto.
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::subtreeHasChanged): Removed a stale assertion from the time we used to do
everything in the render tree.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164183 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add checked casts for Event.
<https://webkit.org/b/128875>

Generate casting helpers for casting from Event to various subclasses
and go on static_cast replacement spree.

Reviewed by Sam Weinig.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Vector with inline capacity should work with non-PODs
https://bugs.webkit.org/show_bug.cgi?id=128864

Source/JavaScriptCore: 

Reviewed by Michael Saboff.
        
Deques no longer have inline capacity because it was broken, and we didn't need it
here anyway.

* dfg/DFGWorklist.h:

Source/WebCore: 

Reviewed by Michael Saboff.

No new tests because no change behavior.
        
Deques no longer have inline capacity because it was broken, and we didn't need it
here anyway.

* page/WheelEventDeltaTracker.h:

Source/WTF: 

Reviewed by Michael Saboff.
        
Previously, we would copy the inline storage of a vector as if it was a bag of bits.
This presumed that the element type was relocatable. In general this is only true for
PODs.
        
This patch changes this by introducing a swap operation over inline storage. This swap
operation requires being told about the size that is in use.
        
Deques would have required some cleverness to make this work, because the swap
operation needs to know which subset of elements are in-use and assumes that a size is
sufficient for this. That's not true for deques. Instead of trying to do very clever
things, I just removed the inline capacity option from Deque. I believe that this is
fine since there are only two users of Deque with inline capacity, and both of them
appear to be allocated rarely enough that inline capacity probably doesn't help much.

* wtf/Deque.h:
(WTF::DequeIterator::DequeIterator):
(WTF::DequeConstIterator::DequeConstIterator):
(WTF::Deque<T>::checkValidity):
(WTF::Deque<T>::checkIndexValidity):
(WTF::Deque<T>::invalidateIterators):
(WTF::Deque<T>::Deque):
(WTF::=):
(WTF::Deque<T>::destroyAll):
(WTF::Deque<T>::~Deque):
(WTF::Deque<T>::swap):
(WTF::Deque<T>::clear):
(WTF::Deque<T>::expandCapacityIfNeeded):
(WTF::Deque<T>::expandCapacity):
(WTF::Deque<T>::append):
(WTF::Deque<T>::prepend):
(WTF::Deque<T>::removeFirst):
(WTF::Deque<T>::removeLast):
(WTF::Deque<T>::remove):
(WTF::DequeIteratorBase<T>::checkValidity):
(WTF::DequeIteratorBase<T>::addToIteratorsList):
(WTF::DequeIteratorBase<T>::removeFromIteratorsList):
(WTF::DequeIteratorBase<T>::DequeIteratorBase):
(WTF::DequeIteratorBase<T>::~DequeIteratorBase):
(WTF::DequeIteratorBase<T>::isEqual):
(WTF::DequeIteratorBase<T>::increment):
(WTF::DequeIteratorBase<T>::decrement):
(WTF::DequeIteratorBase<T>::after):
(WTF::DequeIteratorBase<T>::before):
* wtf/Vector.h:
(WTF::VectorBuffer::swap):
(WTF::VectorBuffer::swapInlineBuffer):
(WTF::VectorBuffer::swapInlineBuffers):
(WTF::Vector::swap):

Tools: 

Reviewed by Michael Saboff.
        
This test experiences really bizarre behavior on trunk without the rest of
this fix. On my machine, it usually times out because it gets itself into an
infinite loop of some kind. With the fix, it passes.

* TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::TEST):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unused arguments from moveTo(Range*)
https://bugs.webkit.org/show_bug.cgi?id=128878

Reviewed by Antti Koivisto.

Cleanup.

* bindings/objc/DOMUIKitExtensions.mm:
(-[DOMRange move:inDirection:]):
(-[DOMRange extend:inDirection:]):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveTo):
* editing/FrameSelection.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Remove WebSerializedJSValue SPI
https://bugs.webkit.org/show_bug.cgi?id=128720

Reviewed by Anders Carlsson.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj: Removed WebSerializedJSValue files from the project.

Source/WebKit/mac:

* WebKit.exp:
* WebView/WebSerializedJSValue.h: Removed.
* WebView/WebSerializedJSValue.mm: Removed.
* WebView/WebSerializedJSValuePrivate.h: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DOMSelection shouldn't instantiate VisibleSelection everywhere
https://bugs.webkit.org/show_bug.cgi?id=128879

Reviewed by Antti Koivisto.

Removed explicit instantiation of VisibleSelection from various member functions of VisibleSelection.

* page/DOMSelection.cpp:
(WebCore::DOMSelection::collapse):
(WebCore::DOMSelection::collapseToEnd):
(WebCore::DOMSelection::collapseToStart):
(WebCore::DOMSelection::setBaseAndExtent):
(WebCore::DOMSelection::setPosition):
(WebCore::DOMSelection::extend):
(WebCore::DOMSelection::getRangeAt):
(WebCore::DOMSelection::addRange):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build break when disabled ACCESSIBILITY since r162986
https://bugs.webkit.org/show_bug.cgi?id=128880

Unreviewed build fix.


* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
Added dummy implementations for newly added methods.
(WTR::AccessibilityUIElement::rowHeaders):
(WTR::AccessibilityUIElement::columnHeaders):
(WTR::AccessibilityUIElement::ariaControlsElementAtIndex):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164189 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reintroduce const qualifiers for return types of (Filter|Transform)Iterator::operator*()
https://bugs.webkit.org/show_bug.cgi?id=126875

The const qualifiers for the return types of FilterIterator::operator*() and TransformIterator::operator*()
were removed in r161797 and r161802 because of compilation failures when using GCC and having an Iterator
type that already had the const qualifier. std::remove_const is now used to appease GCC and enforce the const
qualifier on the return type, regardless of the Iterator type and its qualifiers.

* wtf/IteratorAdaptors.h:
(WTF::FilterIterator::operator*):
(WTF::TransformIterator::operator*):


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