Add a crypto algorithm abstraction
https://bugs.webkit.org/show_bug.cgi?id=123474

Reviewed by Sam Weinig.

This works slightly differently than WebCrypto implies. We have separate classes
for algorithm and its parameters, while WebCrypto puts them in the same dictionary.

* WebCore.xcodeproj/project.pbxproj: Added new files.

* crypto/CryptoAlgorithm.cpp: Added. As most algorithms don't implement most
operations, default implementations just raise an exception.
* crypto/CryptoAlgorithm.h: Added.

* crypto/CryptoAlgorithmParameters.h: Added. Base class for numerous future parameter
dictionaries, such as HmacParams or HmacKeyParams.

* crypto/CryptoAlgorithmRegistry.cpp: Added.
* crypto/CryptoAlgorithmRegistry.h: Added.
The registry decouples universal bindings code from algorithms that may or may not
be implemented on each platform.

* crypto/mac: Added.
* crypto/mac/CryptoAlgorithmRegistryMac.cpp: Added.
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Algorithms implemented
on Mac will be registered by this function.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158363 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Paint the input tag of range type on WinCE port.
https://bugs.webkit.org/show_bug.cgi?id=123199

Patch by Zhuang Zhigang <zhuangzg@cn.fujitsu.com> on 2013-10-31
Reviewed by Brent Fulgham.

* rendering/RenderThemeWinCE.cpp:
(WebCore::RenderThemeWinCE::paintSliderTrack):
(WebCore::RenderThemeWinCE::paintSliderThumb):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pass ScriptExecutionContext by reference to from the bindings constructors
https://bugs.webkit.org/show_bug.cgi?id=123575

Reviewed by Andreas Kling.

Since we null check the ScriptExecutionContext before creating the c++ class,
we should be passing by reference.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add bindings code for crypto algorithm dictionaries
https://bugs.webkit.org/show_bug.cgi?id=123476

Reviewed by Sam Weinig.

JSCryptoAlgorithmDictionary reads the Algorithm, much like JSDictionary does in
simpler cases. We should see about bringing them closer together (perhaps replacing
with autogenerated code).

* crypto/parameters: Added.
* crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added.
* crypto/parameters/CryptoAlgorithmHmacParams.h: Added.
Added a couple specific dictionaries as an example.

* WebCore.xcodeproj/project.pbxproj: Added JSCryptoAlgorithmDictionary.
* bindings/js/JSCryptoAlgorithmDictionary.cpp: Added.
(WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
(WebCore::getHashAlgorithm):
(WebCore::createHmacParams):
(WebCore::createHmacKeyParams):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
* bindings/js/JSCryptoAlgorithmDictionary.h: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix a mis-merge.

* WebCore.xcodeproj/project.pbxproj: Remove duplicate CryptoAlgorithmRegistryMac.cpp.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pass an Element by reference to the PseudoElement constructor
https://bugs.webkit.org/show_bug.cgi?id=123576

Reviewed by Andreas Kling.

* dom/Element.cpp:
(WebCore::Element::createPseudoElementIfNeeded):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::PseudoElement):
* dom/PseudoElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebPageCreationParameters should be consistent in Window.open
https://bugs.webkit.org/show_bug.cgi?id=123557

Reviewed by Sam Weinig.

When Window.open in called in WebKit2 the WebProcess sends a synchronous request to open
a page (WebPageProxy::createNewPage). The UIProcess creates a WebpageProxy, and responds
with instructions to the WebProcess to create the WebPage. The initial creation state of
the WebPage is communicated to the WebProcess via two routes (firstly an asynchronous
WebProcess::CreateWebPage message, and secondly in the synchronous response from
WebPageProxy::createNewPage). Unfortunately these responses are inconsistent with each
other. The creationParameters() for the page are calculated twice, and since the WKView
will be added to a window between the async message being sent and the synchronous reply
being returned the visibility state of the page can change.

To fix the inconsistency we can set the creation parameters at the point that the
WebPageProxy is instantiated. This will result in a functional change that is web
visible, since the page will initially be opened in a hidden/blurred state, and may
later become visible/focussed. This change is consistent with the direction we want to
evolve in. Whilst we will still probably require a synchronous message from the
WebProcess to the UIProcess on Window.open, we'll probably make this return much earlier
– having just created the WebPageProxy, but avoiding blocking the WebProcess over the
client delegate callback that opens the new window.

This fix results in a layout test result change, due to the change in behavior (page is
created blurred, and becomes focussed, resulting in a focus event being fired – rather
than the window opening directly into a focussed state). This is reported as a
progression (test is broken in WebKit1, fixed in WebKit2 after this change). In reality
the test is actually slightly broken in DRT/test-runner – the test runs differently than
in browser, since there is is no visible main window. In-browser this patch results in
no change in behavior on dom/Window/mozilla-focus-blur.html (the affected test).

Source/WebKit2: 

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
    - call initializeCreationParameters
(WebKit::WebPageProxy::initializeCreationParameters):
    - calculate m_creationParameters
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::creationParameters):
    - Added m_creationParameters, initializeCreationParameters,
      creationParameters returns m_creationParameters

LayoutTests: 

* platform/mac-wk2/fast/dom/Window: Added.
* platform/mac-wk2/fast/dom/Window/mozilla-focus-blur-expected.txt: Added.
    - This test now reports a pass on WebKit2



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WIN] Make WebHistory compile without USE(CF)
https://bugs.webkit.org/show_bug.cgi?id=122010

Reviewed by Brent Fulgham.

Add an alternative code path for !USE(CF) to be able to
compile WebHistory without the CoreFoundation library.

* COMVariantSetter.h: Add support for setting a Vector.
* WebHistory.cpp:
(createUserInfoFromArray):
(createUserInfoFromHistoryItem):
(WebHistory::removeAllItems):
(WebHistory::removeItem):
(WebHistory::addItem):
(WebHistory::visitedURL):
* WebHistory.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-31  Geoffrey Garen  <ggaren@apple.com>

        Added Mark Lam as a reviewer.

        Unreviewed.

        * Scripts/webkitpy/common/config/contributors.json:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change WebPage, WebPageProxy, WebPageCreationParameters to use ViewState
https://bugs.webkit.org/show_bug.cgi?id=123379

Reviewed by Darin Adler.

Visibility state of the Page should be stored and communicated consistently.

Remove individual visibility flags from WebPageProxy, WebPageCreationParameters,
and replace them with a ViewState, and add a ViewState member to WebPage.
Merge together all messages that convey and individual aspect of the ViewState.

Restructure WebPageProxy::viewStateDidChange to break the operation down into
three steps: 1) update m_viewState, 2) send the new ViewState to the WebProcess,
and 3) perform any further work necessary in the UIProcess.

This patch fixes a problem that if the web process crashes m_isVisible &
m_isInWindow in WebPageProxy were not updated, and could have held stale values
on reattach.

In WebPage, add a new message to update the entire ViewState - diff the prior
value against the new one to detect changes, call existing methods accordingly.

* Shared/ViewState.h:
    - Add constants 'Reset', 'AllFlags'
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
    - Removed boolean visibility flags, added viewState.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
    - Constructor calls updateViewState to initialize m_viewState.
(WebKit::WebPageProxy::reattachToWebProcess):
    - ViewStaet is not updated while detatched; recalculate.
(WebKit::WebPageProxy::initializeWebPage):
    - m_isVisible -> isViewVisible()
(WebKit::WebPageProxy::updateViewState):
    - Added, update m_viewState by querying the page client.
(WebKit::WebPageProxy::viewStateDidChange):
    - Restructured to use m_viewState, reordered to combine messages.
(WebKit::WebPageProxy::creationParameters):
    - Removed boolean visibility flags, added viewState.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isInWindow):
(WebKit::WebPageProxy::isViewVisible):
    - Removed boolean visibility flags, added viewState.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
    - initial state now passed as a ViewState.
(WebKit::WebPage::setIsInWindow):
    - Remove code to send reply (this is handled by setViewState).
(WebKit::WebPage::setViewState):
    - Set m_viewState - diff from prior & call methods to update.
* WebProcess/WebPage/WebPage.h:
    - Added setViewState, m_viewState.
* WebProcess/WebPage/WebPage.messages.in:
    - Add SetViewState, remove individual messages.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
    - initial state now passed as a ViewState.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158372 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Run tests as if they are expected to pass when --force is given.
https://bugs.webkit.org/show_bug.cgi?id=112890

Patch by Tamas Gergely <gertom@inf.u-szeged.hu> on 2013-10-31
Reviewed by Ryosuke Niwa.

The --force switch of new-run-webkit-tests is now forces all tests to
be run with 'PASS' as expected result.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.run):
* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectations.__init__):
(TestExpectations._add_expectations):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
(_set_up_derived_options):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, MediaStream build fix after r158365.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::clone):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158374 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Repro scrolling crash with scrollbars that use setPresentationValue on the 
scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=123549
-and corresponding-
<rdar://problem/15246606>

Reviewed by Darin Adler.

Speculative fix. I think if we retain the ScrollbarPainters, we should avoid this 
crash.

* page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, one more build fix after r158365.

* Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
(WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Remove last member variable uses of InspectorState from Agents
https://bugs.webkit.org/show_bug.cgi?id=123540

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-10-31
Reviewed by Timothy Hatcher.

* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent):
(WebCore::InspectorDOMDebuggerAgent::setBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::removeBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
(WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::removeXHRBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
DOMDebuggerAgentState::eventListenerBreakpoints -> m_eventListenerBreakpoints.
DOMDebuggerAgentState::xhrBreakpoints -> m_xhrBreakpoints.

* inspector/InspectorDebuggerAgent.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::disable):
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
(WebCore::InspectorDebuggerAgent::removeBreakpoint):
(WebCore::InspectorDebuggerAgent::didParseSource):
DebuggerAgentState::javaScriptBreakpoints -> m_javaScriptBreakpoints.

* inspector/InspectorPageAgent.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::addScriptToEvaluateOnLoad):
(WebCore::InspectorPageAgent::removeScriptToEvaluateOnLoad):
(WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
PageAgentState::pageAgentScriptsToEvaluateOnLoad -> m_scriptsToEvaluateOnLoad.
This is a lazily created InspectorObject member variable.

* inspector/InspectorResourceAgent.h:
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::willSendRequest):
(WebCore::InspectorResourceAgent::disable):
(WebCore::InspectorResourceAgent::setExtraHTTPHeaders):
ResourceAgentState::extraRequestHeaders -> m_extraRequestHeaders.
This is a lazily created InspectorObject member variable.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Decorated text sometimes does not draw its decorations
https://bugs.webkit.org/show_bug.cgi?id=123539

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-10-31
Reviewed by Antti Koivisto.

Decorated text should opt-out of the simple line layout, because
SimpleLineLayout::paintFlow doesn't draw decorations

Fixes fast/css3-text/css3-text-decoration/text-decoration-color.html

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Speculative buildfix after r158365.

* Modules/mediastream/VideoStreamTrack.cpp:
(WebCore::VideoStreamTrack::create):
(WebCore::VideoStreamTrack::VideoStreamTrack):
* Modules/mediastream/VideoStreamTrack.h:

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