WebKit-https.git
2 years agoAdd a way to get the UI-side scrolling tree as text via UIScriptController
simon.fraser@apple.com [Sun, 13 Nov 2016 07:19:07 +0000 (07:19 +0000)]
Add a way to get the UI-side scrolling tree as text via UIScriptController
https://bugs.webkit.org/show_bug.cgi?id=164697

Reviewed by Zalan Bujtas.

Source/WebCore:

Add dumping to ScrollingTreeNode and subclasses (previously, we could only dump
the scrolling state tree). This re-uses the flags used for state tree dumping.

NodeIDs are not dumped by default because they can depend on earlier tests.

Test: scrollingcoordinator/ios/ui-scrolling-tree.html

* page/scrolling/ScrollingStateNode.h:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::scrollingTreeAsText):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::dumpProperties):
* page/scrolling/ScrollingTreeFrameScrollingNode.h:
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::dumpProperties):
(WebCore::ScrollingTreeNode::dump):
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::dumpProperties):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::dumpProperties):
* page/scrolling/mac/ScrollingTreeStickyNode.h:
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::dumpProperties):

Source/WebKit2:

Add a property to WKWebView to retrieve the scrolling tree as text, for testing.
Expose it via the RemoteScrollingCoordinatorProxy.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _scrollingTreeAsText]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeAsText):
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:

Tools:

Add UIScriptController::scrollingTreeAsText(), which gets the state of the scrolling
tree in the UI process, including the current positions of CALayers. This will be used
to test UI-side scrolling and visual viewports.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::scrollingTreeAsText):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::scrollingTreeAsText):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::scrollingTreeAsText):

LayoutTests:

Add a test that dumps the scrolling state tree with a fixed element.

* scrollingcoordinator/ios/ui-scrolling-tree-expected.txt: Added.
* scrollingcoordinator/ios/ui-scrolling-tree.html: Added.

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

2 years agoIncorrect release log message emitted when waiting/not waiting for the WebProcess...
commit-queue@webkit.org [Sun, 13 Nov 2016 05:50:32 +0000 (05:50 +0000)]
Incorrect release log message emitted when waiting/not waiting for the WebProcess continue a load
https://bugs.webkit.org/show_bug.cgi?id=164605

Patch by Daniel Bates <dabates@apple.com> on 2016-11-12
Reviewed by Darin Adler.

Currently we emit a release log message of the form "didReceiveResponse: Should wait for
message from WebContent process ..." when we are not waiting for the WebProcess and emit
a message of the form "didReceiveResponse: Should not wait for message from WebContent
process" when we are waiting on the WebProcess. Invert these messages to reflect whether
we are waiting for the WebProcess to send message NetworkResourceLoader::ContinueDidReceiveResponsewhether.

For the main resource NetworkResourceLoader::didReceiveResponse() returns ShouldContinueDidReceiveResponse::No
because we are waiting for the WebProcess to send message NetworkResourceLoader::ContinueDidReceiveResponse
to continue the load. For a subresource we do not need to wait for the WebProcess to allow the load to continue
and hence NetworkResourceLoader::didReceiveResponse() returns ShouldContinueDidReceiveResponse::Yes.

* NetworkProcess/NetworkResourceLoader.cpp:

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

2 years agoWeb Inspector: Type Profiler and Code Coverage Profiler should work in Workers
commit-queue@webkit.org [Sun, 13 Nov 2016 05:38:58 +0000 (05:38 +0000)]
Web Inspector: Type Profiler and Code Coverage Profiler should work in Workers
https://bugs.webkit.org/show_bug.cgi?id=164682

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-11-12
Reviewed by Darin Adler.

* UserInterface/Controllers/BasicBlockAnnotator.js:
* UserInterface/Models/ScriptSyntaxTree.js:
(WebInspector.ScriptSyntaxTree.prototype.updateTypes):
Use the target associated with the Script.

* UserInterface/Protocol/Target.js:
(WebInspector.WorkerTarget.prototype.initialize):
When initializing a Worker Target, match the existing state
of the Page for these profilers.

* UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptTypeInformation):
(WebInspector.SourceCodeTextEditor.prototype.willDismissPopover):
Use the correct target for this Script / Resource.

(WebInspector.SourceCodeTextEditor.prototype._setTypeTokenAnnotatorEnabledState):
(WebInspector.SourceCodeTextEditor.prototype.set _basicBlockAnnotatorEnabled):
Enable / disable for all targets when toggling profilers.

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

2 years agoRemove some use of ExceptionCode in MediaStream
darin@apple.com [Sun, 13 Nov 2016 04:52:31 +0000 (04:52 +0000)]
Remove some use of ExceptionCode in MediaStream
https://bugs.webkit.org/show_bug.cgi?id=164690

Reviewed by Sam Weinig.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::MediaDevices): Take a Document&.
(WebCore::MediaDevices::create): Ditto.
(WebCore::MediaDevices::~MediaDevices): Deleted.
(WebCore::MediaDevices::getUserMedia): Check document for null and
pass a reference to UserMediaRequest::start. Removed unused ExceptionCode
argument to UserMediaRequest::start, since the only exception was for
a null document.
(WebCore::MediaDevices::enumerateDevices): Check document for null and
pass a reference to MediaDevicesRequest::create. Removed exception
handling entirely because MediaDevicesRequest::create was not ever
raising an exception before.
* Modules/mediastream/MediaDevices.h: Updated for above changes.
* Modules/mediastream/MediaDevices.idl: Removed MayThrowException from
enumerateDevices, because it never throws an exception.

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::MediaDevicesRequest): Take a Document&.
Removed unused ExceptionCode& argument.
(WebCore::MediaDevicesRequest::create): Ditto.
* Modules/mediastream/MediaDevicesRequest.h: Updated for above changes.

* Modules/mediastream/NavigatorMediaDevices.cpp:
(WebCore::NavigatorMediaDevices::mediaDevices): Pass a reference.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::start): Use ExceptionOr.
(WebCore::UserMediaRequest::UserMediaRequest): Take a Document& and
a UserMediaController&.
* Modules/mediastream/UserMediaRequest.h: Updated for above changes.

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

2 years ago[iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
simon.fraser@apple.com [Sun, 13 Nov 2016 03:24:27 +0000 (03:24 +0000)]
[iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
https://bugs.webkit.org/show_bug.cgi?id=164694

Reviewed by Zalan Bujtas.

Source/WebCore:

When an async scroll notifications get back to the main thread in
AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(), we call
syncViewportConstrainedLayerPositions() to poke the new layer positions on the
GraphicsLayers to match the changes made on the scrolling thread.

However, this was not done on iOS, which will be problematic for a future patch
where we require GraphicsLayer positions and the current fixedPositionViewport rect
to have been computed when in a consistent state.

Fix by factoring some code into reconcileScrollingState(), which is called on iOS/WK2
from WebPage::updateVisibleContentRects() rather than setting the FrameView's scroll offset
directly.

Test: scrollingcoordinator/ios/sync-layer-positions-after-scroll.html

* page/WheelEventDeltaFilter.cpp:
(WebCore::WheelEventDeltaFilter::filteredDelta):
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
(WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions):
(WebCore::AsyncScrollingCoordinator::syncChildPositions): Deleted.
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::reconcileScrollingState):
(WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions):
(WebCore::ScrollingCoordinator::syncChildPositions): Deleted.
* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
* platform/Logging.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::setScrollOffset):
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::adjustTileCoverageRect):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll):

Source/WebKit2:

Rather than calling FrameView directly, call reconcileScrollingState() on the scrolling
coordinator.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

LayoutTests:

Test that pans the page, and dumps GraphicsLayers before letting go.

* TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt: Added.
* scrollingcoordinator/ios/sync-layer-positions-after-scroll.html: Added.

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

2 years agoRenderObject::flowThreadState should follow containing block instead of parent.
zalan@apple.com [Sun, 13 Nov 2016 03:08:52 +0000 (03:08 +0000)]
RenderObject::flowThreadState should follow containing block instead of parent.
https://bugs.webkit.org/show_bug.cgi?id=164629

Reviewed by Simon Fraser.

Currently every descendant of a region/multicolumn container is considered to be part of the
flowthread including out-of-flow renderers. They all have the InsideFlowThread flag set.
However since out-of-flow renderers are not really part of the flowthread layout context,
whenever the layout code actually checks for their flowthread containers, we return nullptr and
try to handle this seemingly defective state gracefully (that is, flag indicates "inside the flow thread" state,
but there's no flow tread container).

This patch fixes this confused state by setting the RenderObject::flowThreadState flag based on
the containing block's state instead of the parent's.

Not testable, since we seem to manage out-of-flow elements just fine even
when they have the InsideFlowThread flag set.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::styleDidChange):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::setStyle):
(WebCore::RenderElement::adjustFlowThreadStateIncludingDescendants): This is an iterative DFS pre-order traversal so
we set the flow state first on containers.
* rendering/RenderElement.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::computedFlowThreadState):
(WebCore::RenderObject::initializeFlowThreadStateOnInsertion):
* rendering/RenderObject.h:

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

2 years agodocument.currentScript should be null when running a script inside a shadow tree
rniwa@webkit.org [Sun, 13 Nov 2016 02:43:37 +0000 (02:43 +0000)]
document.currentScript should be null when running a script inside a shadow tree
https://bugs.webkit.org/show_bug.cgi?id=164693

Reviewed by Yusuke Suzuki.

LayoutTests/imported/w3c:

Rebaselined the imported test now that there are no errors.

* web-platform-tests/shadow-dom/Document-prototype-currentScript-expected.txt:

Source/WebCore:

Fixed the bug that we were returning the old or outer script element in document.currentScript
while executing a script element inside a shadow tree. Return null instead.

New behavior matches the latest HTML5 specification:
https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
where it says for the classic script type, "if the script element's root is not a shadow root, then set
the script element's node document's currentScript attribute to the script element. Otherwise, set it to null."

No new tests. imported/w3c/web-platform-tests/shadow-dom/Document-prototype-currentScript.html covers it.

* dom/CurrentScriptIncrementer.h:
(WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer): Push nullptr when the script element
is inside a shadow tree.
(WebCore::CurrentScriptIncrementer::~CurrentScriptIncrementer): Changed to use an early exit.
* dom/Document.cpp:
(WebCore::Document::pushCurrentScript): Removed the assertion since the argument can now be nullptr.

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

2 years agoRemove a few assorted uses of ExceptionCode
darin@apple.com [Sat, 12 Nov 2016 22:31:17 +0000 (22:31 +0000)]
Remove a few assorted uses of ExceptionCode
https://bugs.webkit.org/show_bug.cgi?id=164683

Reviewed by Chris Dumez.

Source/WebCore:

* Modules/applepay/PaymentContact.h: Removed include of ExceptionCode.h.
Also tidied up the constructor and destructor.

* Modules/indexeddb/IDBFactory.h: Removed typedef of ExceptionCode.
* Modules/indexeddb/IDBKeyRange.h: Ditto.

* bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
(WebCore::getObjectParameter): Removed local ExceptionCode variable that
was always 0.
(WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Ditto.
(WebCore::dataFunctionf): Ditto.
(WebCore::dataFunctioni): Ditto.
(WebCore::dataFunctionMatrix): Ditto.
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::cloneChildNodes): Ditto.

* dom/Document.h: Removed typedef of ExceptionCode.
* dom/TreeWalker.h: Ditto.
* editing/markup.h: Ditto.
* html/ImageData.h: Ditto.
* html/InputType.h: Ditto.
* html/canvas/CanvasRenderingContext2D.h: Ditto.
* html/canvas/WebGLDebugShaders.h: Ditto.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::setTimeout): Fixed typo where this was using
ExceptionCode instead of Exception. The code would return an integer
instead of an exception in this case. I could not produce a test that
exercises this code path; I suspect it is an unreachable error condition.
(WebCore::DOMWindow::setInterval): Ditto.

* replay/MemoizedDOMResult.h: Changed typedef of ExceptionCode into
a using statement. Not sure what the longer term fix is.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::PendingCallbacks::appendStartElementNSCallback): Renamed to use
WebKit-style "numXXX" rather than "nb_xxx".
(WebCore::PendingCallbacks::PendingStartElementNSCallback::~PendingStartElementNSCallback):
Ditto.
(WebCore::handleNamespaceAttributes): Ditto. Replaced ExceptionCode out
argument with a boolean return value.
(WebCore::handleElementAttributes): Ditto.
(WebCore::XMLDocumentParser::startElementNs): Ditto. Updated for changes
to the handle functions above.
(WebCore::startElementNsHandler): More of the same.
(WebCore::attributesStartElementNsHandler): Ditto.

Source/WebKit/mac:

* DOM/DOMDOMImplementation.mm:
(-[DOMImplementation createDocumentType:publicId:systemId:]):
Use raiseOnDOMError instead of much longer hand written equivalent.
(-[DOMImplementation createDocument:qualifiedName:doctype:]): Ditto.

* DOM/DOMDocument.mm:
(-[DOMDocument createEntityReference:]): Use raiseNotSupportedErrorException
so we are not using a specific exception code.

* DOM/DOMHTMLOptionsCollection.mm:
(-[DOMHTMLOptionsCollection add:index:]): Use raiseOnDOMError instead of
much longer hand written equivalent.
* DOM/DOMHTMLSelectElement.mm:
(-[DOMHTMLSelectElement add:before:]): Ditto. Also removed unneeded return
statement after calling a "no return" function.

* DOM/ExceptionHandlers.h: Removed overloads of raiseDOMException and
raiseOnDOMError functions that take ExceptionCode; keep the ones that take
Exception and ExceptionOr. Renamed the other overload of raiseDOMException
to raiseDOMErrorException; it is only used as the non-inline implementation
part of the inline raiseOnDOMError function.
* DOM/ExceptionHandlers.mm:
(raiseDOMErrorException): Renamed. Made the ExceptionCode overload be local
to this source file instead of in the header.
(raiseTypeErrorException): Updated for name change.
(raiseNotSupportedErrorException): Added.

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

2 years agoRemove LegacyException support from bindings script
darin@apple.com [Sat, 12 Nov 2016 22:30:22 +0000 (22:30 +0000)]
Remove LegacyException support from bindings script
https://bugs.webkit.org/show_bug.cgi?id=164516

Reviewed by Youenn Fablet.

Besides removing LegacyException support from the bindings script, this patch
also removes most uses of ExceptionCodePlaceholder.h. Also, some call sites of
createElement were using ASSERT_NO_EXCEPTION on an argument that was not even an
ExceptionCode&, so to fix that, this changes most call sites to use specific create
functions for specific element classes, rather than using Document::createElement.

* Modules/mediasource/SourceBuffer.cpp: Removed include of
ExceptionCodePlaceholder.h.
* Modules/mediastream/MediaStreamTrack.cpp: Ditto.
* Modules/websockets/WebSocketChannel.cpp: Ditto.
* bindings/js/JSBlobCustom.cpp: Ditto.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Removed support for GetterMayThrowLegacyException,
SetterMayThrowLegacyException, and MayThrowLegacyException.
(GenerateParametersCheck): Ditto.
(GenerateImplementationFunctionCall): Ditto.
(GenerateConstructorDefinition): Ditto.

* bindings/scripts/IDLAttributes.txt: Removed ConstructorMayThrowLegacyException,
GetterMayThrowLegacyException, MayThrowLegacyException, and SetterMayThrowLegacyException.

* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
Updated exepected results.

* bindings/scripts/test/TestImplements.idl: Use non-legacy exceptions.
* bindings/scripts/test/TestInterface.idl: Ditto.
* bindings/scripts/test/TestNamedConstructor.idl: Ditto.
* bindings/scripts/test/TestObj.idl: Ditto.
* bindings/scripts/test/TestSupplemental.idl: Ditto.
* bindings/scripts/test/TestTypedefs.idl: Ditto.

* dom/ContainerNode.h: Removed include of ExceptionCodePlaceholder.h.
* editing/AlternativeTextController.cpp: Ditto.
* editing/AppendNodeCommand.cpp: Ditto.

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphs): Use specific create function
instead of Document::createElement.

* editing/DeleteFromTextNodeCommand.cpp: Removed include of
ExceptionCodePlaceholder.h.
* editing/Editor.cpp: Ditto.
* editing/EditorCommand.cpp: Ditto.
* editing/FormatBlockCommand.cpp: Ditto.

* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::tryIndentingAsListItem): Use specific create
function instead of Document::createElement.

* editing/InsertListCommand.cpp: Removed include of ExceptionCodePlaceholder.h.
* editing/InsertNodeBeforeCommand.cpp: Ditto.
* editing/RemoveNodeCommand.cpp: Ditto.
* editing/ReplaceSelectionCommand.cpp: Ditto.
* editing/TextIterator.cpp: Ditto.
* editing/WrapContentsInDummySpanCommand.cpp: Ditto.

* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::styleForSelectionStart): Use specific create function instead
of Document::createElement.
* editing/htmlediting.cpp:
(WebCore::createTabSpanElement): Ditto.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::WebContentReader::readURL): Ditto.
* editing/mac/EditorMac.mm:
(WebCore::Editor::WebContentReader::readURL): Ditto.

* editing/markup.cpp: Removed include of ExceptionCodePlaceholder.h.

* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry): Use specific create function
instead of Document::createElement.
(WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
(WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.

* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::create): Added overload that just takes a Document.
* html/HTMLEmbedElement.h: Updated for above.

* html/HTMLMediaElement.cpp: Removed include of ExceptionCodePlaceholder.h.

* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::create): Added overload that just takes a Document.
* html/HTMLMetaElement.h: Updated for above.

* html/HTMLOutputElement.cpp: Removed include of ExceptionCodePlaceholder.h.

* html/HTMLSelectElement.cpp: Ditto.
(WebCore::HTMLSelectElement::setLength): Use specific create function
instead of Document::createElement.

* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::create): Added overload that just takes a Document.
* html/HTMLSourceElement.h: Updated for above.

* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::HTMLStyleElement): Moved data member initialization
to class definition.
(WebCore::HTMLStyleElement::create): Added overload that just takes a Document.
* html/HTMLStyleElement.h: Updated for above. Also made finishParsingChildren public.

* html/HTMLTableElement.cpp: Removed include of ExceptionCodePlaceholder.h.
* html/HTMLTextAreaElement.cpp: Ditto.

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::create): Added overload that just takes a Document.
* html/HTMLVideoElement.h: Updated for above.

* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure): Use specific create function
instead of Document::createElement.

* html/InputType.cpp: Removed include of ExceptionCodePlaceholder.h.

* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure): Use specific create
function instead of Document::createElement.
(WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure): Ditto.

* html/RangeInputType.cpp: Removed include of ExceptionCodePlaceholder.h.

* html/RubyElement.cpp:
(WebCore::RubyElement::create): Added overload that just takes a Document.
* html/RubyElement.h: Updated for above.

* html/RubyTextElement.cpp:
(WebCore::RubyTextElement::create): Added overload that just takes a Document.
* html/RubyTextElement.h: Updated for above.

* html/ValidationMessage.cpp: Removed include of ExceptionCodePlaceholder.h.
* html/canvas/CanvasRenderingContext2D.cpp: Ditto.
* html/shadow/MediaControlElementTypes.cpp: Ditto.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
Use specific create function instead of Document::createElement.

* html/shadow/MediaControls.cpp: Removed include of ExceptionCodePlaceholder.h.
* html/shadow/MediaControlsApple.cpp: Ditto.
* html/track/InbandDataTextTrack.cpp: Ditto.
* html/track/InbandGenericTextTrack.cpp: Ditto.
* html/track/InbandTextTrack.cpp: Ditto.
* html/track/VTTRegion.cpp: Ditto.

* html/track/WebVTTElement.cpp:
(WebCore::WebVTTElement::createEquivalentHTMLElement): Use specific create
function instead of Document::createElement.
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.

* page/ContextMenuController.cpp: Removed include of ExceptionCodePlaceholder.h.
* page/DOMWindow.cpp: Ditto.
* page/DragController.cpp: Ditto.
* page/EventHandler.cpp: Ditto.
* page/Page.cpp: Ditto.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: Ditto.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Ditto.
* platform/mac/PasteboardMac.mm: Ditto.
* platform/mac/WebVideoFullscreenHUDWindowController.mm: Ditto.
* platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: Ditto.
* platform/mock/mediasource/MockMediaSourcePrivate.cpp: Ditto.
* rendering/RenderNamedFlowThread.cpp: Ditto.
* rendering/RenderThemeEfl.cpp: Ditto.
* rendering/RenderThemeMac.mm: Ditto.
* rendering/style/SVGRenderStyle.h: Ditto.
* svg/SVGTRefElement.cpp: Ditto.

* xml/XMLErrors.cpp:
(WebCore::XMLErrors::XMLErrors): Take a reference and initialize data member
in class definition.
(WebCore::createXHTMLParserErrorHeader): Take a reference, and mostly use
specific create functions instead of createElement.
(WebCore::XMLErrors::insertErrorMessageBlock): Ditto.
* xml/XMLErrors.h: Updated for above.

* xml/XMLTreeViewer.cpp: Removed include of ExceptionCodePlaceholder.h.

* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::handleError): Pass a reference.

* xml/parser/XMLDocumentParserLibxml2.cpp: Removed include of
ExceptionCodePlaceholder.h.

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

2 years agoWeb Automation: terminate the automation session if the web process crashes
bburg@apple.com [Sat, 12 Nov 2016 22:24:33 +0000 (22:24 +0000)]
Web Automation: terminate the automation session if the web process crashes
https://bugs.webkit.org/show_bug.cgi?id=164671
<rdar://problem/29028964>

Reviewed by Joseph Pecoraro.

* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::disconnect):
(WebKit::WebAutomationSession::terminate):
Factor out code that disconnects the remote, unpairs, and notifies the client.
Then, expose terminate() which can be called without a FrontendChannel.
Calling this causes the _WKAutomationDelegate to clear the local-side session in the
browser, and disconnecting from the remote will hang up the remote-side session.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidCrash):
Terminate the session.

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

2 years agoClean up a couple of macOS *SPI headers
mitz@apple.com [Sat, 12 Nov 2016 21:34:42 +0000 (21:34 +0000)]
Clean up a couple of macOS *SPI headers
https://bugs.webkit.org/show_bug.cgi?id=164687

Reviewed by Sam Weinig.

* platform/spi/cocoa/NSTouchBarSPI.h: Replaced hardcoded strings with global declarations.
* platform/spi/mac/NSSpellCheckerSPI.h: Addressed FIXME by importing private header, and removed declarations
  that already appear in the SDK.

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

2 years agoThe main content heuristic should be robust when handling large media elements
wenson_hsieh@apple.com [Sat, 12 Nov 2016 20:50:26 +0000 (20:50 +0000)]
The main content heuristic should be robust when handling large media elements
https://bugs.webkit.org/show_bug.cgi?id=164676
<rdar://problem/29211503>

Reviewed by Eric Carlson.

Source/WebCore:

Handles integer overflow gracefully when performing the main content check for very large media elements. If the
heuristic comes across such an element, it will now bail early and reject the video as main content. Also adds a
new API test: VideoControlsManager.VideoControlsManagerPageWithEnormousVideo.

* html/MediaElementSession.cpp:
(WebCore::isElementRectMostlyInMainFrame):

Tools:

Added a new test verifying that enormous video elements are handled gracefully when put through the main
content heuristic.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html: Added.

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

2 years agoUnreviewed, rolling out r207872.
mcatanzaro@igalia.com [Sat, 12 Nov 2016 19:30:44 +0000 (19:30 +0000)]
Unreviewed, rolling out r207872.
https://bugs.webkit.org/show_bug.cgi?id=162623

Did not disable anything, just made them public

Reverted changeset:

"[GTK][GStreamer] Disable MEDIA_SOURCE and ENCRYPTED_MEDIA_V2 by default"
https://bugs.webkit.org/show_bug.cgi?id=162623
http://trac.webkit.org/changeset/207872

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

2 years agoSpeed up setting attributes of input elements of type 'text'
cdumez@apple.com [Sat, 12 Nov 2016 17:54:42 +0000 (17:54 +0000)]
Speed up setting attributes of input elements of type 'text'
https://bugs.webkit.org/show_bug.cgi?id=164674

Reviewed by Ryosuke Niwa.

Speed up setting attributes of input elements of type 'text' by calling
updateInnerTextValue() only when needed. It was previously called
whenever an attribute was set, no matter it could impact its text value
or not.

No new tests, no Web-exposed behavior change.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
* html/InputType.cpp:
(WebCore::InputType::attributeChanged):
* html/InputType.h:
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::attributeChanged):
* html/TextFieldInputType.h:

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

2 years agoTried to fix the 32-bit build.
mitz@apple.com [Sat, 12 Nov 2016 17:43:40 +0000 (17:43 +0000)]
Tried to fix the 32-bit build.

* platform/mac/WebPlaybackControlsManager.mm:

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

2 years agoTried to fix the 32-bit build.
mitz@apple.com [Sat, 12 Nov 2016 17:40:45 +0000 (17:40 +0000)]
Tried to fix the 32-bit build.

* platform/mac/WebPlaybackControlsManager.h:

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

2 years agoTried to fix the build
mitz@apple.com [Sat, 12 Nov 2016 17:33:19 +0000 (17:33 +0000)]
Tried to fix the build

* platform/mac/WebPlaybackControlsManager.h: Declared conformance to
  AVFunctionBarPlaybackControlsControlling, which is expected in WebKit::WebViewImpl.
  Added ivar.
* platform/mac/WebPlaybackControlsManager.mm:
  Synthesize seekToTime property needed for AVFunctionBarPlaybackControlsControlling
  conformance.
(-[WebPlaybackControlsManager isSeeking]): Implement this
  AVFunctionBarPlaybackControlsControlling method.
(-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]): Ditto.

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

2 years agoTried to fix the build
mitz@apple.com [Sat, 12 Nov 2016 17:13:39 +0000 (17:13 +0000)]
Tried to fix the build

* platform/spi/cocoa/NSTouchBarSPI.h: Removed duplicate @interface declarations.

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

2 years agoEnsure MathML render tree are clean by the end of FrameView::layout().
commit-queue@webkit.org [Sat, 12 Nov 2016 14:50:50 +0000 (14:50 +0000)]
Ensure MathML render tree are clean by the end of FrameView::layout().
https://bugs.webkit.org/show_bug.cgi?id=162824

Patch by Frederic Wang <fwang@igalia.com> on 2016-11-12
Reviewed by Darin Adler.

Source/WebCore:

clearNeedsLayout is not called during the layout of invalid MathML markup. We introduce a new
helper function to perform proper layout of such markup and we now call it from the various
MathML layoutBlock functions. Additionally, we ensure that the preferred width is dirty after
computation in RenderMathMLScripts::computePreferredLogicalWidths.

Test: mathml/invalid-markup.html

* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::layoutInvalidMarkup): Helper function to layout invalid markup.
* rendering/mathml/RenderMathMLBlock.h: Declare layoutInvalidMarkup.
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::layoutBlock): Call layoutInvalidMarkup.
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::layoutBlock): Ditto.
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Set the preferred width dirty
after computation to avoid that it is computed again and again.
(WebCore::RenderMathMLScripts::layoutBlock): Call layoutInvalidMarkup.
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.

LayoutTests:

* mathml/invalid-markup-expected.txt: Added.
* mathml/invalid-markup.html: Added.
* mathml/mn-as-list-item-assert-expected.txt: Update text expectation now that invalid
subtree appears in the output.
* mathml/msubsup-fuzz-expected.txt: Ditto.
* accessibility/mac/mathml-multiscript.txt: Ditto.

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

2 years agoRemove RenderMathMLOperator::shouldAllowStretching
commit-queue@webkit.org [Sat, 12 Nov 2016 12:41:35 +0000 (12:41 +0000)]
Remove RenderMathMLOperator::shouldAllowStretching
https://bugs.webkit.org/show_bug.cgi?id=164313

Patch by Frederic Wang <fwang@igalia.com> on 2016-11-12
Reviewed by Darin Adler.

RenderMathMLOperator::shouldAllowStretching is an old function from early implementations of
MathML. Its name is now confusing since it also includes non-stretchy large operators.
Moreover, it is not really useful and is actually only used by two functions: useMathOperator
and updateMathOperator. The former is almost equivalent and is used as a replacement of
shouldAllowStretching everywhere else. We rewrite the two remaining calls with the finer
test functions isStretchy() and isLargeOperatorInDisplayStyle().

No new tests, behavior unchanged.

* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::updateMathOperator): Reorder the conditionals to avoid the
use of RenderMathMLOperator::shouldAllowStretching and match useMathOperator.
(WebCore::RenderMathMLOperator::useMathOperator): Rewrite shouldAllowStretching() using
isStretchy() and isLargeOperatorInDisplayStyle().
(WebCore::RenderMathMLOperator::shouldAllowStretching): Deleted.
* rendering/mathml/RenderMathMLOperator.h: Remove declaration of shouldAllowStretching.

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

2 years agoUse #pragma once in WebCore
commit-queue@webkit.org [Sat, 12 Nov 2016 08:57:21 +0000 (08:57 +0000)]
Use #pragma once in WebCore
https://bugs.webkit.org/show_bug.cgi?id=164373

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-11-12
Reviewed by Darin Adler.

* Modules/*.h:
* crypto/*.h:
* cssjit/*.h:
* editing/*.h:
* fileapi/*.h:
* history/*.h:
* loader/*.h:
* mathml/*.h:
* page/*.h:
* replay/*.h:
* storage/*.h:
* xml/*.h:

* editing/FrameSelection.cpp:
* loader/ResourceLoadStatisticsStore.cpp:
Remove unused LOG and DEBUG defines.

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

2 years agoFollow-up: fix the OpenSource build on Mac after r208642
wenson_hsieh@apple.com [Sat, 12 Nov 2016 08:43:59 +0000 (08:43 +0000)]
Follow-up: fix the OpenSource build on Mac after r208642
https://bugs.webkit.org/show_bug.cgi?id=164677

Reviewed by Ryosuke Niwa.

The playbackControlsController property should also be `assign`.

* platform/spi/cocoa/AVKitSPI.h:

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

2 years agorun-safari does not work for open source contributors
mitz@apple.com [Sat, 12 Nov 2016 08:23:55 +0000 (08:23 +0000)]
run-safari does not work for open source contributors
https://bugs.webkit.org/show_bug.cgi?id=164667
<rdar://problem/29229894>

Reviewed by Joseph Pecoraro.

* Scripts/run-api-tests:
(archCommandLineArgumentsForRestrictedEnvironmentVariables): Moved from here…
* Scripts/webkitdirs.pm:
(archCommandLineArgumentsForRestrictedEnvironmentVariables): …to here
(runMacWebKitApp): Have arch(1) carry the DYLD_* variables we set in our environmet over
  to the environment of the app being run.

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

2 years agoFollow-up fix to r208639.
joepeck@webkit.org [Sat, 12 Nov 2016 08:16:44 +0000 (08:16 +0000)]
Follow-up fix to r208639.

Unreviewed fix. This is a straightfoward change where I forgot to
switch from uncheckedArgument() to argument() in once case after
dropping an argumentCount check. All other cases do this properly.
This addresses an ASSERT seen on the bots running tests.

* runtime/JSDataViewPrototype.cpp:
(JSC::setData):

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

2 years agoSPI imports in AVKitSPI.h should be guarded by USE(APPLE_INTERNAL_SDK)
wenson_hsieh@apple.com [Sat, 12 Nov 2016 06:31:21 +0000 (06:31 +0000)]
SPI imports in AVKitSPI.h should be guarded by USE(APPLE_INTERNAL_SDK)
https://bugs.webkit.org/show_bug.cgi?id=164672

Reviewed by Dan Bernstein.

Fixes the OpenSource build when ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER) is on.

* platform/spi/cocoa/AVKitSPI.h: Add USE(APPLE_INTERNAL_SDK) guards around AVKit function bar SPI headers.
Additionally, define AVFunctionBarPlaybackControlsProvider in the case where AVKit SPI is unavailable.

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

2 years agoevent.composedPath() does not include window
rniwa@webkit.org [Sat, 12 Nov 2016 05:03:27 +0000 (05:03 +0000)]
event.composedPath() does not include window
https://bugs.webkit.org/show_bug.cgi?id=164609
<rdar://problem/29210383>

Reviewed by Antti Koivisto.

Source/WebCore:

Fixed the bug by including WindowContext be a part of the regular EventPath. This also simplifies
dispatchEventInDOM which used to had a special logic for dispatching an event on the window.

Also fixed a bug in EventDispatcher::dispatchEvent that event.target would be nullptr when an event was
dispatched inside a disconnected shadow tree or prevented from propagating to the document tree.
Preserve the final target by simply saving event.target() prior to invoking the default event handler instead.

Test: fast/shadow-dom/event-path-with-window.html

* dom/EventDispatcher.cpp:
(WebCore::WindowEventContext): Deleted. Moved to EventPath.cpp.
(WebCore::dispatchEventInDOM): Removed the code for WindowContext. The generic event dispatching logic
will do the same work now.
(WebCore::EventDispatcher::dispatchEvent): Restore the original target instead of using that of WindowContext.
* dom/EventPath.cpp:
(WebCore::WindowEventContext): Moved from EventDispatcher.cpp. Also made it a subclass of EventContext.
(WebCore::WindowEventContext::handleLocalEvents): Added.
(WebCore::EventPath::EventPath): When the parent's nullptr, check if the current node is Document. If it is,
follow https://dom.spec.whatwg.org/#interface-document where it says:
"A document’s get the parent algorithm, given an event, returns null if event’s type attribute value is 'load'
 or document does not have a browsing context, and the document’s associated Window object otherwise."
(WebCore::EventPath::setRelatedTarget): Skip over WindowContext.
(WebCore::EventPath::retargetTouch): Ditto.
(WebCore::EventPath::computePathUnclosedToTarget): When the target is DOMWindow, use its document as the target.
Also, include any event target that is not a node in the event path.

LayoutTests:

Added a W3C style testharness.js test for dispatching an inside a shadow tree connected to a document.

* fast/shadow-dom/event-path-with-window-expected.txt: Added.
* fast/shadow-dom/event-path-with-window.html: Added.
* fast/shadow-dom/resources/event-path-test-helpers.js:
(dispatchEventWithLog): Traverse from document to window. Also include the event object in the log.

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

2 years agotest262: DataView with explicit undefined byteLength should be the same as it not...
joepeck@webkit.org [Sat, 12 Nov 2016 04:00:55 +0000 (04:00 +0000)]
test262: DataView with explicit undefined byteLength should be the same as it not being present
https://bugs.webkit.org/show_bug.cgi?id=164453

Reviewed by Darin Adler.

JSTests:

* stress/dataview-construct.js: Added.
(assert):
(shouldThrow):
* test262.yaml:

Source/JavaScriptCore:

* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayView):
Handle the special case of DataView construction with an undefined byteLength value.

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

2 years agotest262: DataView get methods should allow for missing offset, set methods should...
joepeck@webkit.org [Sat, 12 Nov 2016 03:10:31 +0000 (03:10 +0000)]
test262: DataView get methods should allow for missing offset, set methods should allow for missing value
https://bugs.webkit.org/show_bug.cgi?id=164451

Reviewed by Darin Adler.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

* runtime/JSDataViewPrototype.cpp:
(JSC::getData):
Missing offset is still valid and will be coerced to 0.

(JSC::setData):
Missing value is still valid and will be coerced to 0.

LayoutTests:

* fast/canvas/webgl/data-view-test-expected.txt:
* fast/canvas/webgl/data-view-test.html:
Create a DataView large enough so that the get/set operations don't fail
due to out of bounds access, and assert that they do not throw, because
the undefined offset and value parameters get converted to 0.

* webgl/1.0.2/conformance/typedarrays/data-view-test-expected.txt:
This test is wrong. Leave the test alone but update our copy.

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

2 years agoWe should have a more concise way of determining when we're varargs calling a functio...
sbarati@apple.com [Sat, 12 Nov 2016 02:58:11 +0000 (02:58 +0000)]
We should have a more concise way of determining when we're varargs calling a function using rest parameters
https://bugs.webkit.org/show_bug.cgi?id=164258

Reviewed by Yusuke Suzuki.

JSTests:

* microbenchmarks/call-using-spread.js: Added.
(bar):
(foo):
* microbenchmarks/spread-large-array.js: Added.
(foo):
(arrays.push):
* microbenchmarks/spread-small-array.js: Added.
(foo):
* stress/spread-array-iterator-watchpoint-2.js: Added.
(foo):
(arrayIterator.next):
* stress/spread-array-iterator-watchpoint.js: Added.
(foo):
(Array.prototype.Symbol.iterator):
* stress/spread-non-array.js: Added.
(assert):
(foo):
(let.customIterator.Symbol.iterator):
(bar):

Source/JavaScriptCore:

This patch adds two new bytecodes and DFG nodes for the following code patterns:

```
foo(a, b, ...c)
let x = [a, b, ...c];
```

To do this, I've introduced two new bytecode operations (and their
corresponding DFG nodes):

op_spread and op_new_array_with_spread.

op_spread takes a single input and performs the ES6 iteration protocol on it.
It returns the result of doing the spread inside a new class I've
made called JSFixedArray. JSFixedArray is a cell with a single 'size'
field and a buffer of values allocated inline in the cell. Abstracting
the protocol into a single node is good because it will make IR analysis
in the future much simpler. For now, it's also good because it allows
us to create fast paths for array iteration (which is quite common).
This fast path allows us to emit really good code for array iteration
inside the DFG/FTL.

op_new_array_with_spread is a variable argument bytecode that also
has a bit vector associated with it. The bit vector indicates if
any particular argument is to be spread or not. Arguments that
are spread are known to be JSFixedArray because we must emit an
op_spread before op_new_array_with_spread consumes the value.
For example, for this array:
[a, b, ...c, d, ...e]
we will have this bit vector:
[0, 0, 1, 0, 1]

The reason I've chosen this IR is that it will make eliminating
a rest allocation for this type of code much easier:

```
function foo(...args) {
    return bar(a, b, ...args);
}
```

It will be easier to analyze the IR now that the operations
will be described at a high level.

This patch is an ~8% speedup on ES6SampleBench on my MBP.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/IteratorHelpers.js: Added.
(performIteration):
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
* bytecode/ObjectPropertyConditionSet.cpp:
(JSC::generateConditionForSelfEquivalence):
* bytecode/ObjectPropertyConditionSet.h:
* bytecode/TrackedReferences.cpp:
(JSC::TrackedReferences::check):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::bitVectors):
(JSC::UnlinkedCodeBlock::bitVector):
(JSC::UnlinkedCodeBlock::addBitVector):
(JSC::UnlinkedCodeBlock::shrinkToFit):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewArrayWithSpread):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ArrayNode::emitBytecode):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::addToGraph):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::watchHavingABadTime):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isWatchingArrayIteratorProtocolWatchpoint):
* dfg/DFGNode.h:
(JSC::DFG::Node::bitVector):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileNewArrayWithSpread):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGStructureRegistrationPhase.cpp:
(JSC::DFG::StructureRegistrationPhase::run):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
(JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedCell):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitAllocateVariableSizedCell):
(JSC::AssemblyHelpers::emitAllocateVariableSizedJSObject):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_array_with_spread):
(JSC::JIT::emit_op_spread):
* jit/JITOperations.h:
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntSlowPaths.cpp:
* llint/LowLevelInterpreter.asm:
* runtime/ArrayIteratorAdaptiveWatchpoint.cpp: Added.
(JSC::ArrayIteratorAdaptiveWatchpoint::ArrayIteratorAdaptiveWatchpoint):
(JSC::ArrayIteratorAdaptiveWatchpoint::handleFire):
* runtime/ArrayIteratorAdaptiveWatchpoint.h: Added.
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:
* runtime/IteratorOperations.h:
(JSC::forEachInIterable):
* runtime/JSCInlines.h:
* runtime/JSFixedArray.cpp: Added.
(JSC::JSFixedArray::visitChildren):
* runtime/JSFixedArray.h: Added.
(JSC::JSFixedArray::createStructure):
(JSC::JSFixedArray::createFromArray):
(JSC::JSFixedArray::get):
(JSC::JSFixedArray::buffer):
(JSC::JSFixedArray::size):
(JSC::JSFixedArray::offsetOfSize):
(JSC::JSFixedArray::offsetOfData):
(JSC::JSFixedArray::create):
(JSC::JSFixedArray::JSFixedArray):
(JSC::JSFixedArray::allocationSize):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
(JSC::JSGlobalObject::objectPrototypeIsSane): Deleted.
(JSC::JSGlobalObject::arrayPrototypeChainIsSane): Deleted.
(JSC::JSGlobalObject::stringPrototypeChainIsSane): Deleted.
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::arrayIteratorProtocolWatchpoint):
(JSC::JSGlobalObject::iteratorProtocolFunction):
* runtime/JSGlobalObjectInlines.h: Added.
(JSC::JSGlobalObject::objectPrototypeIsSane):
(JSC::JSGlobalObject::arrayPrototypeChainIsSane):
(JSC::JSGlobalObject::stringPrototypeChainIsSane):
(JSC::JSGlobalObject::isArrayIteratorProtocolFastAndNonObservable):
* runtime/JSType.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

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

2 years ago[CSS Parser] Support all the correct blend modes
hyatt@apple.com [Sat, 12 Nov 2016 02:33:49 +0000 (02:33 +0000)]
[CSS Parser] Support all the correct blend modes
https://bugs.webkit.org/show_bug.cgi?id=164669

Reviewed by Dean Jackson.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):

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

2 years agoRemoved unused INCLUDE_OPTIONS_FOR_DEBUGGING
commit-queue@webkit.org [Sat, 12 Nov 2016 02:31:31 +0000 (02:31 +0000)]
Removed unused INCLUDE_OPTIONS_FOR_DEBUGGING
https://bugs.webkit.org/show_bug.cgi?id=164664

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-11-11
Reviewed by Dan Bernstein.

* Scripts/debug-minibrowser:
* Scripts/debug-safari:
* Scripts/debug-test-runner:
* Scripts/webkitdirs.pm:
(printHelpAndExitForRunAndDebugWebKitAppIfNeeded):
There are no debug specific options anymore.

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

2 years agoRelocate wasm tests and actually add them to the test runner
keith_miller@apple.com [Sat, 12 Nov 2016 02:25:48 +0000 (02:25 +0000)]
Relocate wasm tests and actually add them to the test runner
https://bugs.webkit.org/show_bug.cgi?id=164668

Reviewed by Yusuke Suzuki.

This moves the Wasm tests from their current location down a level.
Without relocating, the tests cannot properly be run by the wasm test runner.

* wasm.yaml:
* wasm/Builder.js: Fix typos, yay lazy synatx checking!
* wasm/LowLevelBinary.js: Fix typos, yay lazy synatx checking!
(export.default.LowLevelBinary.prototype.get return):
* wasm/function-tests/add-12.js: Renamed from JSTests/wasm/js-api/function-tests/add-12.js.
* wasm/function-tests/br-if-loop-less-than.js: Renamed from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js.
* wasm/function-tests/brTableAsIf.js: Renamed from JSTests/wasm/js-api/function-tests/brTableAsIf.js.
* wasm/function-tests/brTableManyValues.js: Renamed from JSTests/wasm/js-api/function-tests/brTableManyValues.js.
* wasm/function-tests/brTableWithLoop.js: Renamed from JSTests/wasm/js-api/function-tests/brTableWithLoop.js.
* wasm/function-tests/dumb-eq-if-then-else.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js.
* wasm/function-tests/dumb-less-than-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js.
* wasm/function-tests/dumb-less-than-ite.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js.
* wasm/function-tests/factorial.js: Renamed from JSTests/wasm/js-api/function-tests/factorial.js.
* wasm/function-tests/float-sub.js: Renamed from JSTests/wasm/js-api/function-tests/float-sub.js.
* wasm/function-tests/i32-load.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load.js.
* wasm/function-tests/i32-load8-s.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load8-s.js.
* wasm/function-tests/if-then-else-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js.
* wasm/function-tests/if-then-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js.
* wasm/function-tests/loop-mult.js: Renamed from JSTests/wasm/js-api/function-tests/loop-mult.js.
* wasm/function-tests/loop-sum.js: Renamed from JSTests/wasm/js-api/function-tests/loop-sum.js.
* wasm/function-tests/ret5.js: Renamed from JSTests/wasm/js-api/function-tests/ret5.js.
* wasm/self-test/test_BuilderJSON.js: Rebasline

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

2 years agoUse SecurityOriginData as keys in StorageManager
commit-queue@webkit.org [Sat, 12 Nov 2016 01:18:22 +0000 (01:18 +0000)]
Use SecurityOriginData as keys in StorageManager
https://bugs.webkit.org/show_bug.cgi?id=159834
<rdar://problem/27346948>

Patch by Alex Christensen <achristensen@webkit.org> on 2016-11-11
Reviewed by Brady Eidson.

Source/WebCore:

No change in behavior.

* page/SecurityOriginData.h:
(WebCore::SecurityOriginData::SecurityOriginData):
(WebCore::SecurityOriginData::isEmpty):
(WebCore::SecurityOriginData::isHashTableDeletedValue):
(WebCore::SecurityOriginDataHashTraits::isEmptyValue):
(WebCore::SecurityOriginDataHash::hash):
(WebCore::SecurityOriginDataHash::equal):
Add some hash functions so a SecurityOriginData can be used as a key in a HashMap.

Source/WebKit2:

* Platform/IPC/HandleMessage.h:
(IPC::callMemberFunctionImpl):
Add a missing std::forward so we can use this callMemberFunctionImpl with rvalues.
* UIProcess/API/C/WKApplicationCacheManager.cpp:
(WKApplicationCacheManagerGetApplicationCacheOrigins):
(WKApplicationCacheManagerDeleteEntriesForOrigin):
* UIProcess/API/C/WKKeyValueStorageManager.cpp:
(WKKeyValueStorageManagerGetKeyValueStorageOrigins):
(WKKeyValueStorageManagerDeleteEntriesForOrigin):
* UIProcess/API/C/WKResourceCacheManager.cpp:
(WKResourceCacheManagerGetCacheOrigins):
(WKResourceCacheManagerClearCacheForOrigin):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
* UIProcess/Databases/DatabaseProcessProxy.cpp:
(WebKit::DatabaseProcessProxy::deleteWebsiteDataForOrigins):
* UIProcess/Databases/DatabaseProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
(WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Storage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase):
(WebKit::LocalStorageDatabase::openDatabase):
(WebKit::LocalStorageDatabase::close):
* UIProcess/Storage/LocalStorageDatabase.h:
* UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::databasePath):
(WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
(WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
(WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
(WebKit::LocalStorageDatabaseTracker::origins):
* UIProcess/Storage/LocalStorageDatabaseTracker.h:
* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::StorageArea::securityOrigin):
(WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::TransientLocalStorageNamespace::origins):
(WebKit::StorageManager::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
(WebKit::StorageManager::StorageArea::StorageArea):
(WebKit::StorageManager::StorageArea::clone):
(WebKit::StorageManager::StorageArea::items):
(WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
(WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea):
(WebKit::StorageManager::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
(WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
(WebKit::StorageManager::SessionStorageNamespace::origins):
(WebKit::StorageManager::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
(WebKit::StorageManager::SessionStorageNamespace::cloneTo):
(WebKit::StorageManager::getSessionStorageOrigins):
(WebKit::StorageManager::deleteSessionStorageOrigins):
(WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
(WebKit::StorageManager::getLocalStorageOrigins):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
(WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
(WebKit::StorageManager::createLocalStorageMap):
(WebKit::StorageManager::createTransientLocalStorageMap):
(WebKit::StorageManager::createSessionStorageMap):
(WebKit::StorageManager::getOrCreateLocalStorageNamespace):
(WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
(WebKit::StorageManager::StorageArea::create): Deleted.
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea): Deleted.
(WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea): Deleted.
* UIProcess/Storage/StorageManager.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataRecord.cpp:
(WebKit::WebsiteDataRecord::displayNameForOrigin):
(WebKit::WebsiteDataRecord::add):
* UIProcess/WebsiteData/WebsiteDataRecord.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchData):
(WebKit::WebsiteDataStore::removeData):
(WebKit::WebsiteDataStore::mediaKeyOrigins):
(WebKit::WebsiteDataStore::removeMediaKeys):
* UIProcess/WebsiteData/WebsiteDataStore.h:
Fewer SecurityOrigin uses in the UIProcess!  Hooray!

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

2 years agoSkip editing/input/focus-change-with-marked-text.html everywhere except ios-simulator...
ryanhaddad@apple.com [Sat, 12 Nov 2016 01:13:31 +0000 (01:13 +0000)]
Skip editing/input/focus-change-with-marked-text.html everywhere except ios-simulator-wk1.
https://bugs.webkit.org/show_bug.cgi?id=164666

Unreviewed test gardening.

* TestExpectations:
* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac/TestExpectations:

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

2 years agoHovering over a slotted Text node clears hover state
rniwa@webkit.org [Sat, 12 Nov 2016 00:48:46 +0000 (00:48 +0000)]
Hovering over a slotted Text node clears hover state
https://bugs.webkit.org/show_bug.cgi?id=164002
<rdar://problem/29040471>

Reviewed by Simon Fraser.

Source/WebCore:

The bug was caused by HitTestResult::innerElement returning the parent element of a Text node without
taking the shadow root or slots into account. For hit testing, we always want to use the "flat tree"
or "composed tree" (imprecisely but close enough in this case).

Fixed the bug by making HitTestResult::innerElement use parentNodeInComposedTree. Also renamed it to
HitTestResult::targetElement to be consistent with HitTestResult::targetNode.

Tests: fast/shadow-dom/activate-over-slotted-content.html
       fast/shadow-dom/hover-over-slotted-content.html

* dom/Document.cpp:
(WebCore::Document::prepareMouseEvent):
* html/MediaElementSession.cpp:
(WebCore::isMainContentForPurposesOfAutoplay):
* page/EventHandler.cpp:
(WebCore::EventHandler::eventMayStartDrag):
(WebCore::EventHandler::hitTestResultAtPoint):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::hoverTimerFired):
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::handleTouchEvent):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::targetElement): Renamed from innerElement.
Now finds the parent element in the composed tree.
* rendering/HitTestResult.h:
(WebCore::HitTestResult::innerNode):

Source/WebKit/mac:

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController performHitTestAtPoint:]):

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::determinePrimarySnapshottedPlugIn):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):

LayoutTests:

Added two reference tests for activating and hovering over a Text node.
The text node should activate :hover and :activate rules in the shadow tree respectively.

* fast/shadow-dom/activate-over-slotted-content-expected.html: Added.
* fast/shadow-dom/activate-over-slotted-content.html: Added.
* fast/shadow-dom/hover-over-slotted-content-expected.html: Added.
* fast/shadow-dom/hover-over-slotted-content.html: Added.
* platform/ios-simulator/TestExpectations: Skip the newly added tests since iOS doesn't
support :hover or :activate via mouse down.

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

2 years agoUnreviewed build fix after r208628
bfulgham@apple.com [Sat, 12 Nov 2016 00:40:52 +0000 (00:40 +0000)]
Unreviewed build fix after r208628

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal): Cast pointer arithmetic to
uint32_t to avoid warning.

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

2 years agoNeutered ArrayBuffers are not properly serialized
bfulgham@apple.com [Sat, 12 Nov 2016 00:32:59 +0000 (00:32 +0000)]
Neutered ArrayBuffers are not properly serialized
https://bugs.webkit.org/show_bug.cgi?id=164647
<rdar://problem/29213490>

Reviewed by David Kilzer.

Source/WebCore:

Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers.

Test: fast/canvas/neutered-imagedata.html

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):

LayoutTests:

* fast/canvas/neutered-imagedata-expected.txt: Added.
* fast/canvas/neutered-imagedata.html: Added.

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

2 years agoMove Wasm tests to JS
keith_miller@apple.com [Sat, 12 Nov 2016 00:29:36 +0000 (00:29 +0000)]
Move Wasm tests to JS
https://bugs.webkit.org/show_bug.cgi?id=164611

Reviewed by Geoffrey Garen.

This patch translates most of the tests from testWasm.cpp to the JS testing api. Most of the
ommited tests were earliest tests, which tested trivial things, like adding two
constants. Some tests are ommited for other reasons, however. These are:

1) Tests using I64 since the testing api does not yet know how to handle 64-bit numbers.  2)
Tests that would validate the memory of the module once wasm was done with it since that's
not really possible in JS.

In order to make such a translation easier this patch also adds some features to the JS
testing api:

1) Blocks can now be done lexically by adding a lambda as the last argument of the block
opcode. For example one can do:
    ...
    .Block("i32", b => b.I32Const(1) )

and the nested lambda will automatically have an end attached.

2) The JS testing api can now handle inline signature types.

3) Relocate some code to make it easier to follow and prevent 44 space indentation.

4) Rename varuint/varint to varuint32/varint32, this lets them be directly called from the
wasm.json without being remapped.

5) Add support for Memory and Function sections to the Builder.

6) Add support for local variables.

On the JSC side, we needed to expose a new function to validate the compiled wasm code
behaves the way we expect. At least until the JS Wasm API is finished. The new validation
function, testWasmModuleFunctions, takes an array buffer containing the wasm binary, the
number of functions in the blob and tests for each of those functions.

JSTests:

* wasm/Builder.js:
(const._maybeRegisterType):
(const): Deleted.
(switch.typeof): Deleted.
* wasm/Builder_WebAssemblyBinary.js:
(const.emitters.Type):
(const.emitters.Import):
(const.emitters.Function):
(const.emitters.Memory):
(const.emitters.Code):
(export.const.Binary):
* wasm/LowLevelBinary.js:
(export.default.LowLevelBinary.prototype.get return):
(export.default.LowLevelBinary.prototype.varuint32):
(export.default.LowLevelBinary.prototype.varint32):
(export.default.LowLevelBinary.prototype.varuint1):
(export.default.LowLevelBinary.prototype.varint7):
(export.default.LowLevelBinary.prototype.varuint7):
(export.default.LowLevelBinary.prototype.inline_signature_type):
(export.default.LowLevelBinary.prototype.string):
(export.default.LowLevelBinary.prototype.getVaruint32):
(export.default.LowLevelBinary.prototype.getVarint32):
(export.default.LowLevelBinary.prototype.getVaruint7):
(export.default.LowLevelBinary.prototype.getString):
(export.default.LowLevelBinary):
(export.default.LowLevelBinary.prototype.varuint): Deleted.
(export.default.LowLevelBinary.prototype.varint): Deleted.
(export.default.LowLevelBinary.prototype.getVaruint): Deleted.
(export.default.LowLevelBinary.prototype.getVarint): Deleted.
* wasm/js-api/test_old_tests.js: Added.
(ret5):
(brTableWithLoop):
(brTableManyValues):
(run.brTableManyValues.brTableAsIf):
(ifThenFallthrough):
(ifThenElseFallthrough):
(dumbLessThanFallthrough):
(run.dumbLessThanFallthrough.floatSub):
(run.floatSub.add12):
(run.add12.factorial):
(i32load):
(run.i32load.i32load8s):
(run.i32load8s.dumbEqIfThenElse):
(run.dumbEqIfThenElse.dumbEqIfThenElse):
(run.dumbEqIfThenElse.dumbLessThanIfThenElse):
(run.dumbLessThanIfThenElse.loopSum):
(run.loopSum.loopMult):
(brIfLoopLessThan):
(run.brIfLoopLessThan.run):
* wasm/self-test/test_LowLevelBinary_varint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varint.js.
* wasm/self-test/test_LowLevelBinary_varuint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varuint.js.

* wasm/Builder.js:
(const._maybeRegisterType):
(const): Deleted.
(switch.typeof): Deleted.
* wasm/Builder_WebAssemblyBinary.js:
(const.emitters.Type):
(const.emitters.Import):
(const.emitters.Function):
(const.emitters.Memory):
(const.emitters.Code):
(export.const.Binary):
* wasm/LowLevelBinary.js:
(export.default.LowLevelBinary.prototype.get return):
(export.default.LowLevelBinary.prototype.varuint32):
(export.default.LowLevelBinary.prototype.varint32):
(export.default.LowLevelBinary.prototype.varuint1):
(export.default.LowLevelBinary.prototype.varint7):
(export.default.LowLevelBinary.prototype.varuint7):
(export.default.LowLevelBinary.prototype.inline_signature_type):
(export.default.LowLevelBinary.prototype.string):
(export.default.LowLevelBinary.prototype.getVaruint32):
(export.default.LowLevelBinary.prototype.getVarint32):
(export.default.LowLevelBinary.prototype.getVaruint7):
(export.default.LowLevelBinary.prototype.getString):
(export.default.LowLevelBinary):
(export.default.LowLevelBinary.prototype.varuint): Deleted.
(export.default.LowLevelBinary.prototype.varint): Deleted.
(export.default.LowLevelBinary.prototype.getVaruint): Deleted.
(export.default.LowLevelBinary.prototype.getVarint): Deleted.
* wasm/js-api/function-tests/add-12.js: Added.
* wasm/js-api/function-tests/br-if-loop-less-than.js: Added.
* wasm/js-api/function-tests/brTableAsIf.js: Added.
* wasm/js-api/function-tests/brTableManyValues.js: Added.
* wasm/js-api/function-tests/brTableWithLoop.js: Added.
* wasm/js-api/function-tests/dumb-eq-if-then-else.js: Added.
* wasm/js-api/function-tests/dumb-less-than-fallthrough.js: Added.
* wasm/js-api/function-tests/dumb-less-than-ite.js: Added.
* wasm/js-api/function-tests/factorial.js: Added.
* wasm/js-api/function-tests/float-sub.js: Added.
* wasm/js-api/function-tests/i32-load.js: Added.
* wasm/js-api/function-tests/i32-load8-s.js: Added.
* wasm/js-api/function-tests/if-then-else-fallthrough.js: Added.
* wasm/js-api/function-tests/if-then-fallthrough.js: Added.
* wasm/js-api/function-tests/loop-mult.js: Added.
* wasm/js-api/function-tests/loop-sum.js: Added.
* wasm/js-api/function-tests/ret5.js: Added.
* wasm/self-test/test_LowLevelBinary_varint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varint.js.
* wasm/self-test/test_LowLevelBinary_varuint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varuint.js.

Source/JavaScriptCore:

* jsc.cpp:
(GlobalObject::finishCreation):
(box):
(callWasmFunction):
(functionTestWasmModuleFunctions):
* testWasm.cpp:
(checkPlan):
(runWasmTests):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::parseAndCompile):
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parse):
(JSC::Wasm::FunctionParser<Context>::parseBody):
(JSC::Wasm::FunctionParser<Context>::parseBlock): Deleted.
* wasm/WasmModuleParser.cpp:
(JSC::Wasm::ModuleParser::parseMemory):
(JSC::Wasm::ModuleParser::parseExport):
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::Plan):
(JSC::Wasm::Plan::run):
* wasm/WasmPlan.h:
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::constructJSWebAssemblyModule):

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

2 years agoWeb Inspector: Whitespace in Editor should be less visible than regular content
rik@webkit.org [Sat, 12 Nov 2016 00:28:29 +0000 (00:28 +0000)]
Web Inspector: Whitespace in Editor should be less visible than regular content
https://bugs.webkit.org/show_bug.cgi?id=164660

Reviewed by Matt Baker.

* UserInterface/Views/CodeMirrorOverrides.css:
(.show-whitespace-characters .CodeMirror .cm-whitespace::before):

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

2 years ago[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
wenson_hsieh@apple.com [Sat, 12 Nov 2016 00:20:00 +0000 (00:20 +0000)]
[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
https://bugs.webkit.org/show_bug.cgi?id=164538
<rdar://problem/8418711>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Adds autocorrect and autocapitalize getters and setters to HTMLElements. These check the `autocorrect` and
`autocapitalize` attributes and return whether or not the element supports autocorrect, and the
autocapitalization type, respectively. By default, autocorrection is enabled and autocapitalization is enabled
on the sentence level for elements. Also refactors/renames WebAutocapitalizeType so that in WebCore, we deal
solely with AutocapitalizeTypes and WebKit1 converts from AutocapitalizeType to WebAutocapitalizeType as needed
for UIKit.

Tests: fast/events/ios/contenteditable-autocapitalize.html
       fast/events/ios/contenteditable-autocorrect.html

* WebCore.xcodeproj/project.pbxproj:
* html/Autocapitalize.cpp:
(WebCore::autocapitalizeTypeForAttributeValue):
(WebCore::stringForAutocapitalizeType):
* html/Autocapitalize.h:
* html/AutocapitalizeTypes.h: Renamed from Source/WebCore/html/WebAutocapitalize.h.

Move WebAutocapitalizeType into AutocapitalizeTypes.h as simply AutocapitalizeType.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::autocapitalize):
(WebCore::HTMLElement::autocapitalizeType):
(WebCore::HTMLElement::setAutocapitalize):
(WebCore::HTMLElement::shouldAutocorrect):
(WebCore::HTMLElement::setAutocorrect):
* html/HTMLElement.h:
(WebCore::HTMLElement::autocorrect):
* html/HTMLElement.idl:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::shouldAutocorrect):
(WebCore::HTMLFormControlElement::autocapitalizeType):
(WebCore::HTMLFormControlElement::autocorrect): Deleted.
(WebCore::HTMLFormControlElement::setAutocorrect): Deleted.
(WebCore::HTMLFormControlElement::autocapitalize): Deleted.
(WebCore::HTMLFormControlElement::setAutocapitalize): Deleted.

Fold autocorrect/autocapitalize member functions into HTMLElement and remove element-specific code in
HTML(FormControl|Form)Element.cpp.

* html/HTMLFormControlElement.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::shouldAutocorrect):
(WebCore::HTMLFormElement::autocorrect): Deleted.
(WebCore::HTMLFormElement::setAutocorrect): Deleted.
(WebCore::HTMLFormElement::autocapitalizeType): Deleted.
(WebCore::HTMLFormElement::autocapitalize): Deleted.
(WebCore::HTMLFormElement::setAutocapitalize): Deleted.
* html/HTMLFormElement.h:
* html/HTMLFormElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLTextAreaElement.idl:

Source/WebKit:

Introduce WebAutocapitalizeTypes.h to WebKit.

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/mac:

Account for renaming HTMLElement::autocorrect to HTMLElement::shouldAutocorrect, as well as moving
WebAutocapitalizeType to WebKit from WebCore. Additionally, moves the -autocorrect and -autocapitalize SPIs out
of HTML(Input|Form|TextArea)ElementPrivate.h and into HTMLElementPrivate.h. This also means removing redundant
code for interfacing with the unwrapped HTMLElement's autocorrect and autocapitalize attributes.

* DOM/DOMHTML.mm:
(webAutocapitalizeType):
(-[DOMHTMLInputElement _autocapitalizeType]):
(-[DOMHTMLTextAreaElement _autocapitalizeType]):
* DOM/DOMHTMLElement.mm:
(-[DOMHTMLElement autocorrect]):
(-[DOMHTMLElement setAutocorrect:]):
(-[DOMHTMLElement autocapitalize]):
(-[DOMHTMLElement setAutocapitalize:]):
* DOM/DOMHTMLElementPrivate.h: Copied from Source/WebCore/html/Autocapitalize.h.
* DOM/DOMHTMLFormElement.mm:
(-[DOMHTMLFormElement autocorrect]): Deleted.
(-[DOMHTMLFormElement setAutocorrect:]): Deleted.
(-[DOMHTMLFormElement autocapitalize]): Deleted.
(-[DOMHTMLFormElement setAutocapitalize:]): Deleted.
* DOM/DOMHTMLInputElement.mm:
(-[DOMHTMLInputElement autocorrect]): Deleted.
(-[DOMHTMLInputElement setAutocorrect:]): Deleted.
(-[DOMHTMLInputElement autocapitalize]): Deleted.
(-[DOMHTMLInputElement setAutocapitalize:]): Deleted.
* DOM/DOMHTMLInputElementPrivate.h:
* DOM/DOMHTMLTextAreaElement.mm:
(-[DOMHTMLTextAreaElement autocorrect]): Deleted.
(-[DOMHTMLTextAreaElement setAutocorrect:]): Deleted.
(-[DOMHTMLTextAreaElement autocapitalize]): Deleted.
(-[DOMHTMLTextAreaElement setAutocapitalize:]): Deleted.
* DOM/DOMHTMLTextAreaElementPrivate.h:

We need to import DOMHTMLElementPrivate.h here to avoid breaking UIKit. We should follow this up with a UIKit
change to import DOMHTMLElementPrivate.h directly.

* DOM/DOMPrivate.h:
* DOM/WebAutocapitalizeTypes.h: Copied from Tools/WebKitTestRunner/ios/UIKitSPI.h.
* MigrateHeaders.make:

Source/WebKit2:

Consult HTMLElement::autocorrect() and HTMLElement::autocapitalizeType() when assembling the assisted node
information for the currently assisted node.

* Shared/AssistedNodeInformation.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(toUITextAutocapitalize):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

Tools:

Adds support for being able to test autocorrect and autocapitalize attributes in contenteditable areas. To do
this, we add removeAllDynamicDictionaries to UIScriptController in order to ensure that autocorrect suggestions
are reset to their defaults prior to running contenteditable-autocorrect-off.html.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::removeAllDynamicDictionaries):
* Scripts/webkitpy/port/ios.py:
(IOSSimulatorPort._createSimulatorApp):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::removeAllDynamicDictionaries):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView _keyboardDidShow:]):
(-[TestRunnerWKWebView _keyboardDidHide:]):

Work around an issue where consecutive UIKeyboardDidShowNotification would cause keyboard appearance callbacks
to be fired multiple times. This was causing a single key press to cause two characters to be typed. While this
does not affect the correctness of existing tests, the new autocorrection test requires this workaround.

* WebKitTestRunner/ios/UIKitSPI.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::waitForTextPredictionsViewAndSelectCandidateAtIndex):
(WTR::UIScriptController::removeAllDynamicDictionaries):

LayoutTests:

Adds new layout tests verifying that `autocorrect` and `autocapitalize` attributes can be used to opt out of
autocapitalization and autocorrection in a contenteditable area in WK2. Additionally, tests that autocorrection
and autocapitalization attributes may be changed by setting `element.autocorrect` and `element.autocapitalize`,
respectively.

* fast/events/ios/contenteditable-autocapitalize-none-expected.txt: Added.
* fast/events/ios/contenteditable-autocapitalize-none.html: Added.
* fast/events/ios/contenteditable-autocorrect-off-expected.txt: Added.
* fast/events/ios/contenteditable-autocorrect-off.html: Added.

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

2 years agoMove to modern TouchBar methods
bdakin@apple.com [Sat, 12 Nov 2016 00:06:40 +0000 (00:06 +0000)]
Move to modern TouchBar methods
https://bugs.webkit.org/show_bug.cgi?id=164655
-and corresponding-
rdar://problem/29226911

Reviewed by Wenson Hsieh.

customizationDefaultItemIdentifiers -> defaultItemIdentifiers
itemIdentifiers -> defaultItemIdentifiers
defaultItems -> templateItems

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _plainTextTouchBarDefaultItemIdentifiers]):
(-[WebView _richTextTouchBarDefaultItemIdentifiers]):
(-[WebView setUpTextTouchBar:]):
(-[WebView updateTextTouchBar]):
(-[WebView _plainTextTouchBarCustomizationDefaultItemIdentifiers]): Deleted.
(-[WebView _richTextTouchBarCustomizationDefaultItemIdentifiers]): Deleted.

Source/WebKit2:

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::plainTextTouchBarDefaultItemIdentifiers):
(WebKit::richTextTouchBarDefaultItemIdentifiers):
(WebKit::WebViewImpl::setUpTextTouchBar):
(WebKit::WebViewImpl::updateTextTouchBar):
(WebKit::plainTextTouchBarCustomizationDefaultItemIdentifiers): Deleted.
(WebKit::richTextTouchBarCustomizationDefaultItemIdentifiers): Deleted.

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

2 years ago[CSS Parser] Add support for paths as basic shapes.
hyatt@apple.com [Fri, 11 Nov 2016 23:43:29 +0000 (23:43 +0000)]
[CSS Parser] Add support for paths as basic shapes.
https://bugs.webkit.org/show_bug.cgi?id=164661

Reviewed by Dean Jackson.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeBasicShapePath):
(WebCore::consumeBasicShape):

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

2 years agoUnreviewed try to fix windows build after https://bugs.webkit.org/show_bug.cgi?id...
sbarati@apple.com [Fri, 11 Nov 2016 23:42:47 +0000 (23:42 +0000)]
Unreviewed try to fix windows build after https://bugs.webkit.org/show_bug.cgi?id=164650

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):

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

2 years ago[CSS Parser] Support margin-box in shape parsing.
hyatt@apple.com [Fri, 11 Nov 2016 23:28:10 +0000 (23:28 +0000)]
[CSS Parser] Support margin-box in shape parsing.
https://bugs.webkit.org/show_bug.cgi?id=164658

Reviewed by Sam Weinig.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeBasicShapeOrBox):

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

2 years ago[CSS Parser] Add support for -webkit-mask-source-type
hyatt@apple.com [Fri, 11 Nov 2016 23:18:36 +0000 (23:18 +0000)]
[CSS Parser] Add support for -webkit-mask-source-type
https://bugs.webkit.org/show_bug.cgi?id=164657

Reviewed by Dean Jackson.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeWebkitMaskSourceType):
(WebCore::consumeBackgroundComponent):
(WebCore::CSSPropertyParser::parseSingleValue):

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

2 years agoUpdating class name doesn't update the slotted content's style
antti@apple.com [Fri, 11 Nov 2016 23:08:34 +0000 (23:08 +0000)]
Updating class name doesn't update the slotted content's style
https://bugs.webkit.org/show_bug.cgi?id=164577
<rdar://problem/29205873>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: fast/shadow-dom/css-scoping-slotted-invalidation.html

Teach style invalidation code for attribute/class/id mutations about slotted rules.

* dom/ShadowRoot.cpp:
(WebCore::assignedShadowRootsIfSlotted):

    Helper to find all assigned shadow roots (there may be more than one if slots are assigned to slots).

* dom/ShadowRoot.h:
* style/AttributeChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByAttributeChange):
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
(WebCore::Style::mayBeAffectedByHostStyle): Deleted.
* style/ClassChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::ClassChangeInvalidation::invalidateStyle):
(WebCore::Style::mayBeAffectedByHostStyle): Deleted.
* style/ClassChangeInvalidation.h:
* style/IdChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostRules):
(WebCore::Style::mayBeAffectedBySlottedRules):
(WebCore::Style::IdChangeInvalidation::invalidateStyle):
(WebCore::Style::mayBeAffectedByHostStyle): Deleted.
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement):

    Fix a bug in style sharing where we were checking wrong element for host rules.
    Tested by the included test too (the last empty div).

LayoutTests:

* fast/shadow-dom/css-scoping-slotted-invalidation-expected.html: Added.
* fast/shadow-dom/css-scoping-slotted-invalidation.html: Added.

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

2 years ago[CSS Parser] Support the spring animation timing function
hyatt@apple.com [Fri, 11 Nov 2016 23:04:55 +0000 (23:04 +0000)]
[CSS Parser] Support the spring animation timing function
https://bugs.webkit.org/show_bug.cgi?id=164654

Reviewed by Dean Jackson.

* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeSpringFunction):
(WebCore::consumeAnimationTimingFunction):
(WebCore::consumeAnimationValue):

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

2 years agoWe recursively grab a lock in the DFGBytecodeParser causing us to deadlock
sbarati@apple.com [Fri, 11 Nov 2016 23:03:41 +0000 (23:03 +0000)]
We recursively grab a lock in the DFGBytecodeParser causing us to deadlock
https://bugs.webkit.org/show_bug.cgi?id=164650

Reviewed by Geoffrey Garen.

JSTests:

* stress/dont-dead-lock-put-by-val-as-put-by-id.js: Added.
(ident):
(let.o.set foo):
(foo):

Source/JavaScriptCore:

Some code was incorrectly holding a lock when recursively calling
back into the bytecode parser's via inlining a put_by_val as a put_by_id.
This can cause a deadlock if the inlinee CodeBlock is something we're
already holding a lock for. I've changed the range of the lock holder
to be as narrow as possible.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):

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

2 years agoWorkerGlobalScope's indexedDB property should be on the prototype, not the instance
cdumez@apple.com [Fri, 11 Nov 2016 22:53:24 +0000 (22:53 +0000)]
WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
https://bugs.webkit.org/show_bug.cgi?id=164644

Reviewed by Brady Eidson.

Source/WebCore:

WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
as per:
- https://heycam.github.io/webidl/#es-attributes

This is because WorkerGlobalScope is not marked as [Global] or [PrimaryGlobal] in
the IDL:
- https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface

DedicatedWorkerGlobalScope is the one that is marked as [Global] and that should
have its attributes on the instance:
- https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface

We were getting this mostly right, except for runtime-enabled attributes / operations
which would end up on the instance instead of the prototype. This patch adds support
for [PrimaryGlobal] / [Global] IDL extended attributes which determine the location
of properties. It also improves support for runtime-enabled properties so that they
can now be on either the instance or the prototype, exactly as if they were not
runtimed-enabled.

This gives us 100% pass rate on:
- http://w3c-test.org/IndexedDB/interfaces.worker.html

No new tests, updated existing test.

* bindings/scripts/CodeGeneratorJS.pm:
(IsGlobalOrPrimaryGlobalInterface):
(InterfaceRequiresAttributesOnInstance):
(AttributeShouldBeOnInstance):
(OperationShouldBeOnInstance):
(GenerateHeader):
(GeneratePropertiesHashTable):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/JS/JSInterfaceName.cpp:
(WebCore::JSInterfaceName::finishCreation):
* bindings/scripts/test/JS/JSInterfaceName.h:
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::JSTestActiveDOMObject::finishCreation):
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
(WebCore::JSTestCEReactions::finishCreation):
* bindings/scripts/test/JS/JSTestCEReactions.h:
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
(WebCore::JSTestCEReactionsStringifier::finishCreation):
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::JSTestCustomNamedGetter::finishCreation):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
(WebCore::JSTestDOMJIT::finishCreation):
* bindings/scripts/test/JS/JSTestDOMJIT.h:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::JSTestEventConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestEventConstructor.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTarget::finishCreation):
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::JSTestException::finishCreation):
* bindings/scripts/test/JS/JSTestException.h:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::JSTestGenerateIsReachable::finishCreation):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSTestGlobalObject::finishCreation):
* bindings/scripts/test/JS/JSTestGlobalObject.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterface::finishCreation):
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
(WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
* bindings/scripts/test/JS/JSTestIterable.cpp:
(WebCore::JSTestIterable::finishCreation):
* bindings/scripts/test/JS/JSTestIterable.h:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::JSTestJSBuiltinConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::JSTestMediaQueryListListener::finishCreation):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestNamedConstructor.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNode::finishCreation):
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
(WebCore::JSTestNondeterministic::finishCreation):
* bindings/scripts/test/JS/JSTestNondeterministic.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::finishCreation):
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::JSTestOverloadedConstructors::finishCreation):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::JSTestOverrideBuiltins::finishCreation):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
(WebCore::JSTestSerialization::finishCreation):
* bindings/scripts/test/JS/JSTestSerialization.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterface::finishCreation):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSTestTypedefs::finishCreation):
* bindings/scripts/test/JS/JSTestTypedefs.h:
* bindings/scripts/test/TestGlobalObject.idl:
* page/DOMWindow.idl:
* workers/DedicatedWorkerGlobalScope.idl:

LayoutTests:

Extend layout test coverage to check that:
- WorkerGlobalScope.indexedDB is on the prototype.
- WorkerGlobalScope.IDBDatabase constructor is on the instance

Both are enabled at runtime properties.

* fast/workers/WorkerGlobalScope-properties-prototype-expected.txt:
* fast/workers/WorkerGlobalScope-properties-prototype.html:
* fast/workers/self-hasOwnProperty-expected.txt:
* fast/workers/self-hasOwnProperty.html:

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

2 years ago[MediaStream] defer resolution of getUserMedia promise made in a background tab
eric.carlson@apple.com [Fri, 11 Nov 2016 22:52:40 +0000 (22:52 +0000)]
[MediaStream] defer resolution of getUserMedia promise made in a background tab
https://bugs.webkit.org/show_bug.cgi?id=164643
<rdar://problem/29048317>

Unreviewed build fix after r208606.

* Plugins/PluginView.cpp:
(WebCore::PluginView::mediaCanStart):
* Plugins/PluginView.h:

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

2 years agoGet rid of old sandbox rules for OS's we no longer support
bfulgham@apple.com [Fri, 11 Nov 2016 22:16:40 +0000 (22:16 +0000)]
Get rid of old sandbox rules for OS's we no longer support
https://bugs.webkit.org/show_bug.cgi?id=164638

Reviewed by Simon Fraser.

Clean up the various sandbox profiles to get rid of rules that applied to operating system
versions we no longer support, or were added in support of bugs that have long since been
fixed.

This should introduce no change in behavior.

* DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* Resources/PlugInSandboxProfiles/com.oracle.java.JavaAppletPlugin.sb:
* WebProcess/com.apple.WebProcess.sb.in:

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

2 years agoShadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
antti@apple.com [Fri, 11 Nov 2016 21:59:33 +0000 (21:59 +0000)]
Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
https://bugs.webkit.org/show_bug.cgi?id=160864

Reviewed by Ryosuke Niwa.

Source/WebCore:

Also fix similar issue with ::host

Test: fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html

* css/StyleInvalidationAnalysis.cpp:
(WebCore::StyleInvalidationAnalysis::invalidateIfNeeded):

    If we have ::slotted rules and encounter a <slot>, invalidate the slotted host children.

(WebCore::StyleInvalidationAnalysis::invalidateStyle):

    Invalidate the shadow host if we have ::host rules.

* css/StyleInvalidationAnalysis.h:
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet):

    Fix a bug where it was possible to mutate stylesheets in the inline stylesheet cache.
    The included test covers this.

* style/StyleScope.cpp:
(WebCore::Style::Scope::updateActiveStyleSheets):

    Handle the full invalidation case.

LayoutTests:

* fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation-expected.html: Added.
* fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html: Added.

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

2 years agoIndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
beidson@apple.com [Fri, 11 Nov 2016 21:57:42 +0000 (21:57 +0000)]
IndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
https://bugs.webkit.org/show_bug.cgi?id=164641

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt:

Source/WebCore:

No new tests (Covered by at least 3 existing tests).

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::close):
(WebCore::IDBDatabase::maybeCloseInServer):

* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::databaseConnectionPendingClose):
* Modules/indexeddb/client/IDBConnectionProxy.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::databaseConnectionPendingClose):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/ServerOpenDBRequest.cpp:
(WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
(WebCore::IDBServer::ServerOpenDBRequest::notifyRequestBlocked): Deleted.
* Modules/indexeddb/server/ServerOpenDBRequest.h:
(WebCore::IDBServer::ServerOpenDBRequest::hasNotifiedBlocked): Deleted.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::allConnectionsAreClosedOrClosing):
(WebCore::IDBServer::UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange):
(WebCore::IDBServer::UniqueIDBDatabase::notifyCurrentRequestConnectionClosedOrFiredVersionChangeEvent):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionPendingCloseFromClient):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionIsClosing):
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::databaseConnectionPendingClose):
* Modules/indexeddb/shared/InProcessIDBServer.h:

Source/WebKit2:

* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:

* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::databaseConnectionPendingClose):
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:

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

2 years ago[CSS Parser] Fix time unit parsing
hyatt@apple.com [Fri, 11 Nov 2016 21:55:44 +0000 (21:55 +0000)]
[CSS Parser] Fix time unit parsing
https://bugs.webkit.org/show_bug.cgi?id=164649

Reviewed by Dean Jackson.

Make sure that a unitless value gets changed to milliseconds properly.

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeTime):

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

2 years agoReduce number of platformMemoryUsage calls
krollin@apple.com [Fri, 11 Nov 2016 21:50:11 +0000 (21:50 +0000)]
Reduce number of platformMemoryUsage calls
https://bugs.webkit.org/show_bug.cgi?id=164375

Reviewed by Andreas Kling.

platformMemoryUsage was being called all the time while logging the
results of various memory-purging operations. This logging is
subordinate to the needs of performance and so can be removed.
Behavior is now as follows:

- If memory-pressure relief logging is enabled, logging includes
memory usage information. On Cocoa, this logging is disabled by
default but can be enabled by setting LogMemoryJetsamDetails in
`defaults`.
- Otherwise, if release-logging is enabled (as it is on Cocoa),
abbreviated memory pressure relief logging is performed: the logging
lines are printed but without any memory usage information.
- Otherwise, no logging is performed.

No new tests -- no tests for logging.

* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
* platform/MemoryPressureHandler.h:
(WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger):
(WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger):

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

2 years ago[MediaStream] defer resolution of getUserMedia promise made in a background tab
eric.carlson@apple.com [Fri, 11 Nov 2016 21:45:21 +0000 (21:45 +0000)]
[MediaStream] defer resolution of getUserMedia promise made in a background tab
https://bugs.webkit.org/show_bug.cgi?id=164643
<rdar://problem/29048317>

Reviewed by Brady Eidson.

Source/WebCore:

Test: fast/mediastream/get-user-media-background-tab.html

Do not start producing data when the document does not allow media
to start playing. Instead, register with the document for a callback
when playback is allowed and start then.
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::~MediaStream):
(WebCore::MediaStream::mediaCanStart):
(WebCore::MediaStream::startProducingData):
(WebCore::MediaStream::stopProducingData):
(WebCore::MediaStream::pageMutedStateDidChange):
* Modules/mediastream/MediaStream.h:

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::mediaCanStart): Deal with API change.
* Modules/webaudio/AudioContext.h:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaCanStart): Ditto.
* html/HTMLMediaElement.h:
* page/MediaCanStartListener.h:

* page/Page.cpp:
(WebCore::Page::takeAnyMediaCanStartListener): Return the listener and document.
(WebCore::Page::setCanStartMedia): Pass the document to the listener.
* page/Page.h:

Source/WebKit2:

Do not ask for user for access to capture devices when the document does not
allow media to play, wait until playback is allowed.

* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::startUserMediaRequest):
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
(WebKit::UserMediaPermissionRequestManager::mediaCanStart):
(WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::mediaCanStart):
* WebProcess/Plugins/PluginView.h:

LayoutTests:

* fast/mediastream/get-user-media-background-tab-expected.txt: Added.
* fast/mediastream/get-user-media-background-tab.html: Added.

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

2 years agoRenderFlowThread's containing block cache should be invalidated before calling styleD...
zalan@apple.com [Fri, 11 Nov 2016 21:20:01 +0000 (21:20 +0000)]
RenderFlowThread's containing block cache should be invalidated before calling styleDidChange.
https://bugs.webkit.org/show_bug.cgi?id=164646

Reviewed by Simon Fraser.

We have to invalidate the containing block cache for RenderFlowThreads soon after the containing block context
changes. Invalidating it in RenderBlock::styleDidChange is too late since we might run some code in some
of the subclasses that use this stale containing block cache.

No known behaviour change.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::styleDidChange): This change could trigger double invalidation.
However running this code twice shouldn't impact performance greatly.
(WebCore::RenderBlock::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
(WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
* rendering/RenderBlock.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::setStyle): We don't need to call the invalidation from initializeStyle(), since
we don't yet have cache at that point.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::splitInlines):

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

2 years agoWeb Inspector: Call RuntimeAgent.disableControlFlowProfiler when Code Coverage Profil...
nvasilyev@apple.com [Fri, 11 Nov 2016 20:38:57 +0000 (20:38 +0000)]
Web Inspector: Call RuntimeAgent.disableControlFlowProfiler when Code Coverage Profiler is turned off
https://bugs.webkit.org/show_bug.cgi?id=163407
<rdar://problem/28764230>

Reviewed by Timothy Hatcher.

Turning Type Profiler off by clicking [T] icon now disables its backend by calling RuntimeAgent.disableTypeProfiler().

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._setTypeTokenAnnotatorEnabledState):

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

2 years agoMove Node from ExceptionCode to ExceptionOr
darin@apple.com [Fri, 11 Nov 2016 20:16:03 +0000 (20:16 +0000)]
Move Node from ExceptionCode to ExceptionOr
https://bugs.webkit.org/show_bug.cgi?id=164515

Reviewed by Sam Weinig.

Source/WebCore:

* bindings/js/JSHTMLSelectElementCustom.cpp:
(WebCore::selectElementIndexSetter): Call remove instead of removeByIndex.
Was renamed now that there is no conflict.

* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNode::insertBefore): Use ExceptionOr.
(WebCore::JSNode::replaceChild): Ditto.
(WebCore::JSNode::removeChild): Ditto.
(WebCore::JSNode::appendChild): Ditto.

* dom/Attr.cpp:
(WebCore::Attr::Attr): Take a reference.
(WebCore::Attr::create): Ditto.
(WebCore::Attr::createTextChild): Use a Ref.
(WebCore::Attr::setPrefix): Use ExceptionOr.
(WebCore::Attr::setNodeValue): Ditto.
(WebCore::Attr::attachToElement): Take a reference.
* dom/Attr.h: Updated for above. Also made setPrefix private.

* dom/CharacterData.cpp:
(WebCore::CharacterData::setNodeValue): Use ExceptionOr.
* dom/CharacterData.h: Updated for the above.

* dom/ContainerNode.cpp:
(WebCore::collectChildrenAndRemoveFromOldParent): Use ExceptionOr.
(WebCore::checkAcceptChild): Ditto.
(WebCore::checkAcceptChildGuaranteedNodeTypes): Ditto.
(WebCore::ContainerNode::ensurePreInsertionValidity): Ditto.
(WebCore::checkPreReplacementValidity): Ditto.
(WebCore::ContainerNode::insertBefore): Ditto.
(WebCore::ContainerNode::replaceChild): Ditto.
(WebCore::ContainerNode::removeChild): Ditto.
(WebCore::ContainerNode::appendChild): Ditto.
(WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
(WebCore::ContainerNode::cloneChildNodes): Ditto.
(WebCore::ContainerNode::append): Ditto.
(WebCore::ContainerNode::prepend): Ditto.
* dom/ContainerNode.h: Updated for above changes.

* dom/Document.cpp:
(WebCore::Document::setTitle): Removed unneeded ASSERT_NO_EXCEPTION.
(WebCore::Document::setBodyOrFrameset): Removed unneeded ignored
exception code.

* dom/Element.cpp:
(WebCore::Element::setPrefix): Use ExceptionOr.
(WebCore::Element::setAttributeNode): Updated for changes to Attr.
(WebCore::Element::setAttributeNodeNS): Ditto.
(WebCore::Element::setOuterHTML): Use ExceptionOr.
(WebCore::Element::ensureAttr): Updated for changes to Attr.
(WebCore::Element::insertAdjacent): Use ExceptionOr.
* dom/Element.h: Updated for above.

* dom/Node.cpp:
(WebCore::Node::setNodeValue): Use ExceptionOr.
(WebCore::Node::insertBefore): Ditto.
(WebCore::Node::replaceChild): Ditto.
(WebCore::Node::removeChild): Ditto.
(WebCore::Node::appendChild): Ditto.
(WebCore::Node::convertNodesOrStringsIntoNode): Ditto.
(WebCore::Node::before): Ditto.
(WebCore::Node::after): Ditto.
(WebCore::Node::replaceWith): Ditto.
(WebCore::Node::remove): Ditto.
(WebCore::Node::cloneNodeForBindings): Ditto.
(WebCore::Node::setPrefix): Ditto.
(WebCore::Node::checkSetPrefix): Ditto.
(WebCore::Node::setTextContent): Ditto.
* dom/Node.h: Updated for above.
* dom/Node.idl: Use non-legacy exceptions.

* dom/Range.cpp:
(WebCore::Range::processContents): Use ExceptionOr.
(WebCore::processContentsBetweenOffsets): Ditto.
(WebCore::processNodes): Ditto.
(WebCore::processAncestorsAndTheirSiblings): Ditto.
(WebCore::Range::insertNode): Ditto.
(WebCore::Range::surroundContents): Ditto.

* dom/Text.cpp:
(WebCore::Text::splitText): Use ExceptionOr.
(WebCore::Text::replaceWholeText): Removed unneeded IGNORE_EXCEPTION.

* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.

* editing/EditorCommand.cpp:
(WebCore::executeInsertNode): Use ExceptionOr.

* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
* editing/MergeIdenticalElementsCommand.cpp:
(WebCore::MergeIdenticalElementsCommand::doApply): Ditto.
(WebCore::MergeIdenticalElementsCommand::doUnapply): Use ExceptionOr.

* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::swapInNodePreservingAttributesAndChildren): Removed unneeded
ASSERT_NO_EXCEPTION.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::removeNode): Ditto.
(WebCore::ReplacementFragment::insertNodeBefore): Ditto.
(WebCore::ReplacementFragment::insertFragmentForTestRendering): Ditto.
(WebCore::ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment): Ditto.
(WebCore::ReplaceSelectionCommand::insertAsListItems): Ditto.

* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::executeApply): Use ExceptionOr.
(WebCore::SplitElementCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.

* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::insertText1AndTrimText2): Use ExceptionOr.

* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::executeApply): Removed unneeded
IGNORE_EXCEPTION.
(WebCore::WrapContentsInDummySpanCommand::doUnapply): Ditto.

* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::styleForSelectionStart): Removed unneeded ASSERT_NO_EXCEPTION
and IGNORE_EXCEPTION.
* editing/htmlediting.cpp:
(WebCore::createTabSpanElement): Ditto.
* editing/markup.cpp:
(WebCore::fillContainerFromString): Ditto.
(WebCore::createFragmentFromText): Ditto.
(WebCore::removeElementFromFragmentPreservingChildren): Ditto.
(WebCore::replaceChildrenWithFragment): Use ExceptionOr.
(WebCore::replaceChildrenWithText): Ditto.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::WebContentReader::addFragment): Removed unneeded exception
ignoring code.
(WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
(WebCore::Editor::setTextAsChildOfElement): Ditto.

* html/ColorInputType.cpp:
(WebCore::ColorInputType::createShadowSubtree): Removed unneeded
ASSERT_NO_EXCEPTION.

* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry): Removed unneeded
IGNORE_EXCEPTION.
(WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
(WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
* html/FileInputType.cpp:
(WebCore::FileInputType::createShadowSubtree): Ditto.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::setText): Removed unneeded ASSERT_NO_EXCEPTION.
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot): Ditto.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::textToFragment): Use ExceptionOr.
(WebCore::HTMLElement::setOuterText): Ditto.

* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::HTMLKeygenElement): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaControls): Ditto.
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didAddUserAgentShadowRoot): Ditto.
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::createForJSConstructor): Use ExceptionOr.
(WebCore::HTMLOptionElement::setText): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.

* html/HTMLOptionsCollection.cpp:
(WebCore::HTMLOptionsCollection::remove): Call remove, not removeByIndex,
since we were able to change the name.

* html/HTMLOutputElement.cpp:
(WebCore::HTMLOutputElement::setTextContentInternal): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::didAddUserAgentShadowRoot): Ditto.
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::setText): Ditto.

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::add): Use ExceptionOr.
(WebCore::HTMLSelectElement::remove): Renamed from removeByIndex since
there is no conflict with remove any more.
(WebCore::HTMLSelectElement::setOption): Call remove.
* html/HTMLSelectElement.h: Updated for above.
* html/HTMLSelectElement.idl: Got rid of ImplementedAs=removeByIndex.

* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::HTMLTableElement): Initialize data members in
class definition instead of here.
(WebCore::HTMLTableElement::caption): Simplified using childrenOfType.
(WebCore::HTMLTableElement::setCaption): Use ExceptionOr.
(WebCore::HTMLTableElement::setTHead): Ditto.
(WebCore::HTMLTableElement::setTFoot): Ditto.
(WebCore::HTMLTableElement::deleteTFoot): Removed unneeded ASSERT_NO_EXCEPTION
and IGNORE_EXCEPTION.
(WebCore::HTMLTableElement::createTBody): Ditto.
(WebCore::HTMLTableElement::deleteCaption): Ditto.
(WebCore::HTMLTableElement::insertRow): Use ExceptionOr.
* html/HTMLTableElement.h: Updated for above.

* html/HTMLTableRowElement.cpp:
(WebCore::HTMLTableRowElement::insertCell): Use ExceptionOr.
(WebCore::HTMLTableRowElement::deleteCell): Ditto.
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::insertRow): Ditto.
(WebCore::HTMLTableSectionElement::deleteRow): Ditto.

* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
(WebCore::HTMLTextAreaElement::setDefaultValue): Ditto.
(WebCore::HTMLTextAreaElement::updatePlaceholderText): Ditto.
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue): Ditto.
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::setText): Ditto.
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure): Ditto.
(WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::createShadowSubtree): Ditto.
* html/SearchInputType.cpp:
(WebCore::SearchInputType::createShadowSubtree): Ditto.
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtree): Ditto.
(WebCore::TextFieldInputType::updatePlaceholderText): Ditto.
(WebCore::TextFieldInputType::createContainer): Ditto.
(WebCore::TextFieldInputType::createAutoFillButton): Ditto.
* html/ValidationMessage.cpp:
(WebCore::ValidationMessage::setMessageDOMAndStartTimer): Ditto.
(WebCore::ValidationMessage::buildBubbleTree): Ditto.
(WebCore::ValidationMessage::deleteBubbleTree): Ditto.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::createTextTrackDisplay): Ditto.

* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::MediaControlsApple): Initialize data members
in class definition instead of here.
(WebCore::MediaControlsApple::tryCreateControls): Use ExceptionOr.
* html/shadow/MediaControlsApple.h: Updated for above.

* html/track/VTTCue.cpp:
(WebCore::VTTCue::copyWebVTTNodeToDOMTree): Removed unneeded ASSERT_NO_EXCEPTION
and IGNORE_EXCEPTION.
(WebCore::VTTCue::getDisplayTree): Ditto.
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::appendTextTrackCueBox): Ditto.

* inspector/DOMEditor.cpp: Use ExceptionOr in action classes.
(WebCore::DOMEditor::DOMEditor): Take a reference.
(WebCore::DOMEditor::insertBefore): Use ExceptionOr.
(WebCore::DOMEditor::removeChild): Ditto.
(WebCore::DOMEditor::setAttribute): Ditto.
(WebCore::DOMEditor::removeAttribute): Ditto.
(WebCore::DOMEditor::setOuterHTML): Ditto.
(WebCore::DOMEditor::replaceWholeText): Ditto.
(WebCore::DOMEditor::replaceChild): Ditto.
(WebCore::DOMEditor::setNodeValue): Ditto.
(WebCore::populateErrorString): Ditto.
* inspector/DOMEditor.h: Updated for above changes.

* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument): Updated to use references,
to use ExceptionOr, and to use a struct without a constructor for Digest.
(WebCore::DOMPatchSupport::DOMPatchSupport): Ditto.
(WebCore::DOMPatchSupport::patchNode): Ditto.
(WebCore::DOMPatchSupport::innerPatchNode): Ditto.
(WebCore::DOMPatchSupport::diff): Ditto.
(WebCore::DOMPatchSupport::innerPatchChildren): Ditto.
(WebCore::DOMPatchSupport::createDigest): Ditto.
(WebCore::DOMPatchSupport::insertBeforeAndMarkAsUsed): Ditto.
(WebCore::DOMPatchSupport::removeChildAndMoveToNew): Ditto.
(WebCore::DOMPatchSupport::markNodeAsUsed): Ditto.
* inspector/DOMPatchSupport.h: Updated for above.

* inspector/InspectorCSSAgent.cpp: Use ExceptionOr in the action classes.
(WebCore::InspectorCSSAgent::getStyleSheetText): Use ExceptionOr.
(WebCore::InspectorCSSAgent::setStyleSheetText): Ditto.
(WebCore::InspectorCSSAgent::setStyleText): Ditto.
(WebCore::InspectorCSSAgent::setRuleSelector): Ditto.
(WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
(WebCore::InspectorCSSAgent::addRule): Ditto.
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::didCreateFrontendAndBackend): Ditto.
(WebCore::InspectorDOMAgent::setAttributeValue): Ditto.
(WebCore::InspectorDOMAgent::setAttributesAsText): Ditto.
(WebCore::InspectorDOMAgent::removeAttribute): Ditto.
(WebCore::InspectorDOMAgent::setOuterHTML): Ditto.
(WebCore::InspectorDOMAgent::setNodeValue): Ditto.
(WebCore::InspectorDOMAgent::undo): Ditto.
(WebCore::InspectorDOMAgent::redo): Ditto.

* inspector/InspectorHistory.cpp:
(WebCore::InspectorHistory::Action::Action): Moved to header.
(WebCore::InspectorHistory::Action::~Action): Ditto.
(WebCore::InspectorHistory::Action::toString): Ditto.
(WebCore::InspectorHistory::Action::isUndoableStateMark): Ditto.
(WebCore::InspectorHistory::Action::mergeId): Ditto.
(WebCore::InspectorHistory::Action::merge): Ditto.
(WebCore::InspectorHistory::InspectorHistory): Deleted.
(WebCore::InspectorHistory::~InspectorHistory): Deleted.
(WebCore::InspectorHistory::perform): Updated exception handling.
(WebCore::InspectorHistory::markUndoableState): Ditto.
(WebCore::InspectorHistory::undo): Ditto.
(WebCore::InspectorHistory::redo): Ditto.
* inspector/InspectorHistory.h: Updated for above.

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setDocumentContent): Use reference.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::text): Use ExceptionOr and renamed from
getText since this now has a return value.
(WebCore::InspectorStyle::populateAllProperties): Updated for above.
(WebCore::InspectorStyle::setText): Use ExceptionOr.
(WebCore::InspectorStyleSheet::setText): Ditto.
(WebCore::InspectorStyleSheet::ruleSelector): Ditto.
(WebCore::InspectorStyleSheet::setRuleSelector): Ditto.
(WebCore::InspectorStyleSheet::addRule): Ditto.
(WebCore::InspectorStyleSheet::deleteRule): Ditto.
(WebCore::InspectorStyleSheet::buildObjectForStyleSheet): Ditto.
(WebCore::InspectorStyleSheet::buildObjectForStyle): Ditto.
(WebCore::InspectorStyleSheet::setStyleText): Ditto.
(WebCore::InspectorStyleSheet::text): Use ExceptionOr and renamed.
(WebCore::InspectorStyleSheet::checkPageStyleSheet): Deleted.
Just wrote this code inline in each place this was called since it's
just a single null check.
(WebCore::InspectorStyleSheetForInlineStyle::text): Use ExceptionOr
and renamed.
(WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
(WebCore::InspectorStyle::getText): Deleted.
* inspector/InspectorStyleSheet.h: Updated for above changes.

* page/DragController.cpp:
(WebCore::documentFragmentFromDragData): Removed unneeded
ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
* page/ios/FrameIOS.mm:
(WebCore::Frame::initWithSimpleHTMLDocument): Ditto.
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::updateReferencedText): Ditto.
(WebCore::SVGTRefElement::detachTarget): Ditto.
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView): Ditto.

Source/WebKit/mac:

* DOM/DOMHTMLSelectElement.mm:
(-[DOMHTMLSelectElement remove:]): Call remove instead of removeByIndex
now that it was renamed.
* DOM/DOMNode.mm:
(-[DOMNode setNodeValue:]): Updated exception handling.
(-[DOMNode setPrefix:]): Ditto.
(-[DOMNode setTextContent:]): Ditto.
(-[DOMNode insertBefore:refChild:]): Ditto.
(-[DOMNode replaceChild:oldChild:]): Ditto.
(-[DOMNode removeChild:]): Ditto.
(-[DOMNode appendChild:]): Ditto.
(-[DOMNode cloneNode:]): Ditto.

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMNode::insertBefore): Update exception handling.
(DOMNode::removeChild): Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
(webkit_dom_html_select_element_remove): Updated exception handling.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
(webkit_dom_node_insert_before): Ditto.
(webkit_dom_node_replace_child): Ditto.
(webkit_dom_node_remove_child): Ditto.
(webkit_dom_node_append_child): Ditto.
(webkit_dom_node_clone_node_with_error): Ditto.
(webkit_dom_node_set_node_value): Ditto.
(webkit_dom_node_set_text_content): Ditto.
* WebProcess/InjectedBundle/API/mac/WKDOMNode.mm:
(-[WKDOMNode insertNode:before:]): Ditto.
(-[WKDOMNode appendChild:]): Ditto.
(-[WKDOMNode removeChild:]): Ditto.

* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin): Removed unneeded ASSERT_NO_EXCEPTION.
* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): Ditto.

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

2 years agoRename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
jiewen_tan@apple.com [Fri, 11 Nov 2016 20:12:00 +0000 (20:12 +0000)]
Rename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
https://bugs.webkit.org/show_bug.cgi?id=164624
<rdar://problem/29210140>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch allows IDLType CryptoKeyUsage to be shared among different IDLs, i.e. CryptoKey.idl,
SubtleCrypto.idl and JsonWebKey.idl such that it can simplify the customized binding codes.

Covered by existing tests.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoKeySerializationJWK.cpp:
* bindings/js/JSCryptoKeySerializationJWK.h:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::toCryptoKeyUsageBitmap):
(WebCore::cryptoKeyUsageBitmapFromJSValue):
(WebCore::toKeyData):
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
(WebCore::jsSubtleCryptoFunctionImportKeyPromise):
(WebCore::cryptoKeyUsageFromString): Deleted.
(WebCore::cryptoKeyUsagesFromJSValue): Deleted.
* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
* bindings/js/SerializedScriptValue.cpp:
* crypto/CryptoAlgorithm.cpp:
* crypto/CryptoAlgorithm.h:
* crypto/CryptoKey.cpp:
* crypto/CryptoKey.h:
* crypto/CryptoKey.idl:
* crypto/CryptoKeySerialization.h:
* crypto/CryptoKeyUsage.h:
* crypto/CryptoKeyUsage.idl: Added.
* crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
* crypto/JsonWebKey.h:
* crypto/JsonWebKey.idl:
* crypto/SubtleCrypto.idl:
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
* crypto/algorithms/CryptoAlgorithmAES_CBC.h:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
* crypto/keys/CryptoKeyAES.cpp:
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyHMAC.cpp:
* crypto/keys/CryptoKeyHMAC.h:
* crypto/keys/CryptoKeyRSA.cpp:
* crypto/keys/CryptoKeyRSA.h:
* crypto/keys/CryptoKeySerializationRaw.cpp:
* crypto/keys/CryptoKeySerializationRaw.h:
* crypto/mac/CryptoKeyRSAMac.cpp:

LayoutTests:

* crypto/subtle/generate-key-malformed-parameters-expected.txt:
* crypto/subtle/import-key-malformed-parameters-expected.txt:

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

2 years agoBuild all Mac API tests
commit-queue@webkit.org [Fri, 11 Nov 2016 19:46:04 +0000 (19:46 +0000)]
Build all Mac API tests
https://bugs.webkit.org/show_bug.cgi?id=164633

Patch by Alex Christensen <achristensen@webkit.org> on 2016-11-11
Reviewed by Gyuyoung Kim.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/NavigatorLanguage.mm:

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

2 years agoAllow mutable lambdas in HashMap::ensure
achristensen@apple.com [Fri, 11 Nov 2016 19:11:28 +0000 (19:11 +0000)]
Allow mutable lambdas in HashMap::ensure
https://bugs.webkit.org/show_bug.cgi?id=164642

Reviewed by Sam Weinig.

Source/WTF:

* wtf/HashMap.h:
(WTF::HashMapEnsureTranslator::translate):
(WTF::X>::removeIf):

Tools:

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

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

2 years ago[CSS Parser] Fix basic shape parsing
hyatt@apple.com [Fri, 11 Nov 2016 19:09:01 +0000 (19:09 +0000)]
[CSS Parser] Fix basic shape parsing
https://bugs.webkit.org/show_bug.cgi?id=164645

Reviewed by Dean Jackson.

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeBasicShape):

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

2 years agoAdd ios-simulator baseline for compositing/tiling/visiblerect-accumulated-offset...
ryanhaddad@apple.com [Fri, 11 Nov 2016 19:02:10 +0000 (19:02 +0000)]
Add ios-simulator baseline for compositing/tiling/visiblerect-accumulated-offset.html.

Unreviewed test gardening.

* platform/ios-simulator/compositing/tiling/visiblerect-accumulated-offset-expected.txt: Added.

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

2 years agoRenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMa...
zalan@apple.com [Fri, 11 Nov 2016 18:56:54 +0000 (18:56 +0000)]
RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMap::remove
https://bugs.webkit.org/show_bug.cgi?id=164639

Reviewed by Simon Fraser.

Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
(WebCore::canComputeRegionRangeForBox):
(WebCore::RenderBlock::computeRegionRangeForBoxChild):
(WebCore::RenderBlock::estimateRegionRangeForBoxChild):
(WebCore::RenderBlock::updateRegionRangeForBoxChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasRegionRangeInFlowThread):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::removeFlowChildInfo):
(WebCore::RenderFlowThread::validateRegions):
(WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
(WebCore::RenderFlowThread::removeLineRegionInfo):
(WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
(WebCore::RenderFlowThread::setRegionRangeForBox):
(WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
(WebCore::RenderFlowThread::computedRegionRangeForBox):
(WebCore::RenderFlowThread::checkLinesConsistency):
* rendering/RenderFlowThread.h:
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
* rendering/RenderNamedFlowFragment.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
(WebCore::RenderNamedFlowThread::removeFlowChildInfo):
* rendering/RenderNamedFlowThread.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::removeRenderBoxRegionInfo):
* rendering/RenderRegion.h:

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

2 years ago[Cocoa] Support wide gamut for Drag Image UI
commit-queue@webkit.org [Fri, 11 Nov 2016 18:54:21 +0000 (18:54 +0000)]
[Cocoa] Support wide gamut for Drag Image UI
https://bugs.webkit.org/show_bug.cgi?id=164490

Patch by Megan Gardner <megan_gardner@apple.com> on 2016-11-11
Reviewed by Tim Horton.

Source/WebCore:

Fixed an error in the support define for wide gamut on Mac.

The testing infrastructure to test this does not exist, and will be landing in another patch.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::extendedSRGBColorSpaceRef):

Source/WebKit2:

Fixed an error in the gating for the new wide gamut support in ShareableBitmap.
We should always respect the flags straight out, and not make decisions later, it can lead to mismatched data and data storage.
Added support for wide gamut in createCGImage.

* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::bitmapInfo):
(WebKit::colorSpace):
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::createCGImage):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):
(WebKit::WebDragClient::startDrag):

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

2 years agoGet touch bar code building for open source builds
bdakin@apple.com [Fri, 11 Nov 2016 18:54:08 +0000 (18:54 +0000)]
Get touch bar code building for open source builds
https://bugs.webkit.org/show_bug.cgi?id=164610

Reviewed by Wenson Hsieh.

Source/WebCore:

* config.h:

Source/WebKit/mac:

* WebKitPrefix.h:

Source/WebKit2:

* config.h:

Source/WTF:

* wtf/Platform.h:

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

2 years ago[CSS Parser] Fix SVG markers and colors
hyatt@apple.com [Fri, 11 Nov 2016 18:52:34 +0000 (18:52 +0000)]
[CSS Parser] Fix SVG markers and colors
https://bugs.webkit.org/show_bug.cgi?id=164640

Reviewed by Dean Jackson.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertSVGColor):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseShorthand):

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

2 years agoComposition state should be cleared when changing focus to a non-editable element
wenson_hsieh@apple.com [Fri, 11 Nov 2016 18:38:01 +0000 (18:38 +0000)]
Composition state should be cleared when changing focus to a non-editable element
https://bugs.webkit.org/show_bug.cgi?id=164595
<rdar://problem/26412551>

Reviewed by Enrica Casucci.

Source/WebCore:

When canceling or confirming a composition, always ensure that the composition node and composition underlines
being tracked are reset, even when there is no current selection. This prevents us from getting into a bad state
where focus has already changed from an element with a pending composition to a different element and the
composition is canceled, but the Editor still maintains its composition node.

Test: editing/input/focus-change-with-marked-text.html

* editing/Editor.cpp:
(WebCore::Editor::setComposition):

Tools:

Adds support for window.textInputController in DumpRenderTree on iOS. So far, only the methods needed for the
new layout test (editing/focus-change-with-marked-text.html) are supported. These are insertText, setMarkedText,
and markedRange.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TextInputController.h: Renamed from Tools/DumpRenderTree/mac/TextInputController.h.

Remove the PLATFORM(MAC) guard for defining the TextInputController. Also, move the TextInputController header
out of the /mac platform directory.

* DumpRenderTree/ios/TextInputControllerIOS.m: Added.
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController initWithWebView:]):
(-[TextInputController markedRange]):
(-[TextInputController insertText:]):
(-[TextInputController setMarkedText:selectedFrom:length:]):

Introduces TextInputControllerIOS.m, which contains an iOS implementation of TextInputController. Only a subset
of the methods available on the Mac version will be available on iOS for now (see above).

* DumpRenderTree/mac/FrameLoadDelegate.mm:

Remove the PLATFORM(MAC) guard for initializing the TextInputController and binding it to the window object.

(-[FrameLoadDelegate didClearWindowObjectInStandardWorldForFrame:]):
* DumpRenderTree/mac/TextInputControllerMac.m: Renamed from Tools/DumpRenderTree/mac/TextInputController.m.
(-[WebHTMLView interpretKeyEvents:]):
(-[WebNSRange initWithNSRange:]):
(-[WebNSRange location]):
(-[WebNSRange length]):
(+[WebNSRange isSelectorExcludedFromWebScript:]):
(+[NSMutableAttributedString isSelectorExcludedFromWebScript:]):
(+[NSMutableAttributedString webScriptNameForSelector:]):
(-[NSMutableAttributedString getLength]):
(-[NSMutableAttributedString ranges]):
(-[NSMutableAttributedString attributeNamesAtIndex:]):
(-[NSMutableAttributedString valueOfAttribute:atIndex:]):
(-[NSMutableAttributedString addAttribute:value:]):
(-[NSMutableAttributedString addAttribute:value:from:length:]):
(-[NSMutableAttributedString addColorAttribute:red:green:blue:alpha:]):
(-[NSMutableAttributedString addColorAttribute:red:green:blue:alpha:from:length:]):
(-[NSMutableAttributedString addFontAttribute:fontName:size:]):
(-[NSMutableAttributedString addFontAttribute:fontName:size:from:length:]):
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController initWithWebView:]):
(-[TextInputController dealloc]):
(-[TextInputController textInput]):
(-[TextInputController insertText:]):
(-[TextInputController doCommand:]):
(-[TextInputController setMarkedText:selectedFrom:length:]):
(-[TextInputController unmarkText]):
(-[TextInputController hasMarkedText]):
(-[TextInputController conversationIdentifier]):
(-[TextInputController substringFrom:length:]):
(-[TextInputController attributedSubstringFrom:length:]):
(-[TextInputController legacyAttributedString:]):
(-[TextInputController markedRange]):
(-[TextInputController selectedRange]):
(-[TextInputController firstRectForCharactersFrom:length:]):
(-[TextInputController characterIndexForPointX:Y:]):
(-[TextInputController validAttributesForMarkedText]):
(-[TextInputController attributedStringWithString:]):
(-[TextInputController stringWithUndoGroupingInsertion:]):
(-[TextInputController dictatedStringWithPrimaryString:alternative:alternativeOffset:alternativeLength:]):
(-[TextInputController setInputMethodHandler:]):
(-[TextInputController interpretKeyEvents:withSender:]):

Fixes miscellaneous style issues.

LayoutTests:

Adds a new layout test to ensure that when changing focus from an element with pending composition text to
another element, the composition is committed and there should not still be a pending composition.

* editing/input/focus-change-with-marked-text-expected.txt: Added.
* editing/input/focus-change-with-marked-text.html: Added.
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac/TestExpectations:

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

2 years agoUnreviewed, rolling out r208584.
cdumez@apple.com [Fri, 11 Nov 2016 18:21:20 +0000 (18:21 +0000)]
Unreviewed, rolling out r208584.

Seems to have regressed Speedometer by 1% on Mac

Reverted changeset:

"We should have a more concise way of determining when we're
varargs calling a function using rest parameters"
https://bugs.webkit.org/show_bug.cgi?id=164258
http://trac.webkit.org/changeset/208584

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

2 years agoWeb Inspector: Settings tab: make the header smaller to fit more content
nvasilyev@apple.com [Fri, 11 Nov 2016 18:20:02 +0000 (18:20 +0000)]
Web Inspector: Settings tab: make the header smaller to fit more content
https://bugs.webkit.org/show_bug.cgi?id=164613
<rdar://problem/29206007>

Reviewed by Timothy Hatcher.

* UserInterface/Views/SettingsTabContentView.css:
(.content-view.settings > .header):
Use hv units for margin. 1vh = 1% of viewport height. When Web Inspector window is taller, the margin is larger.

(.content-view.settings > .setting-container):
Convert padding to margin to make spacing between the header and the first section better.

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

2 years ago[CSS Parser] Support -webkit-svg-shadow
hyatt@apple.com [Fri, 11 Nov 2016 17:31:07 +0000 (17:31 +0000)]
[CSS Parser] Support -webkit-svg-shadow
https://bugs.webkit.org/show_bug.cgi?id=164637

Reviewed by Zalan Bujtas.

* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):

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

2 years agoRemove unused FontService from sandbox profile
bfulgham@apple.com [Fri, 11 Nov 2016 17:18:53 +0000 (17:18 +0000)]
Remove unused FontService from sandbox profile
https://bugs.webkit.org/show_bug.cgi?id=164625
<rdar://problem/26899976>

Reviewed by Alex Christensen.

Part of some general sandbox profile gardening.

Convert the Plugin process sandbox into

* Configurations/WebKit.xcconfig: Add exclude for com.apple.WebKit.plugin-common.sb.in.
* DerivedSources.make: Update to generate com.apple.WebKit.plugin-common.sb from .in file
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Copied from Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb.
* Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb: Removed.
* WebKit2.xcodeproj/project.pbxproj: Update for new .in file.
* WebProcess/com.apple.WebProcess.sb.in: Remove com.apple.FontServer
from macOS Sierra and newer.

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

2 years agoUnreviewed, rolling out r208117 and r208160.
cdumez@apple.com [Fri, 11 Nov 2016 16:50:57 +0000 (16:50 +0000)]
Unreviewed, rolling out r208117 and r208160.

Regressed Speedometer by >1.5%

Reverted changesets:

"We should have a way of profiling when a get_by_id is pure
and to emit a PureGetById in the DFG/FTL"
https://bugs.webkit.org/show_bug.cgi?id=163305
http://trac.webkit.org/changeset/208117

"Debug JSC test microbenchmarks/pure-get-by-id-cse-2.js timing
out"
https://bugs.webkit.org/show_bug.cgi?id=164227
http://trac.webkit.org/changeset/208160

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

2 years ago[WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend...
commit-queue@webkit.org [Fri, 11 Nov 2016 13:09:33 +0000 (13:09 +0000)]
[WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process
https://bugs.webkit.org/show_bug.cgi?id=164010

Patch by Alejandro G. Castro <alex@igalia.com> on 2016-11-11
Reviewed by Philippe Normand.

Move the capture of the sources for the OWR backend to the
WebProcess. In the UI we continue checking if the user allows
access to the audio and video capture. When device handling is
added in the future we will need some persistent ID and API to
pass from the UI process to the Web process.

* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
(WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
Add the proper audio and video sources to allow the UI message to
be properly rendered. We are adding the specific devices, even
though the dialog just asks for general audio and video. There was
already a FIXME about improving this.
(WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): We are
capturing the devices here when the allowed message arrived from
the UI process. We store the completion handler to use it later
when the aync owr API finishes capture devices process.
(WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): We
now call the completion handler in this callback called when the
owr library finishes the capture of the devices. Now this happens
in the WebProcess for OWR port.
* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
Add an attribute to store the completion handler.

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

2 years ago[css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
rego@igalia.com [Fri, 11 Nov 2016 11:08:39 +0000 (11:08 +0000)]
[css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
https://bugs.webkit.org/show_bug.cgi?id=163450

Reviewed by Darin Adler.

Source/WebCore:

The issue is that in the test case a simplifiedLayout() is performed.
So in RenderGrid::layoutBlock() we early return and the grid is not populated,
so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
in RenderGrid::layoutPositionedObject().

We should avoid to do a simplified layout if we have to layout
some positioned grid items and the grid is dirty.

The problem was not only the ASSERT, but the current behavior was wrong too.
As we didn't do a proper layout of the grid container, the positioned item
won't be placed on the expected position. Added tests verifying this.

Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html
       fast/css-grid-layout/grid-simplified-layout-positioned.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
a simplified layout.
(WebCore::RenderBlock::simplifiedLayout): Extract initial check
into canPerformSimplifiedLayout().
* rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
* rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()
to verify that the grid is not dirty if we have to layout some positioned items.
(WebCore::RenderGrid::canPerformSimplifiedLayout):
* rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.

LayoutTests:

The tests shouldn't crash in debug to verify that the bug is fixed.
On top of that the positioned grid items should appear in the right position too.

* fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html: Added.
* fast/css-grid-layout/grid-positioned-item-dynamic-change.html: Added.
* fast/css-grid-layout/grid-simplified-layout-positioned-expected.html: Added.
* fast/css-grid-layout/grid-simplified-layout-positioned.html: Added.

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

2 years ago[Modern Media Controls] Media Controller: media tracks control support
graouts@webkit.org [Fri, 11 Nov 2016 09:48:37 +0000 (09:48 +0000)]
[Modern Media Controls] Media Controller: media tracks control support
https://bugs.webkit.org/show_bug.cgi?id=164618
<rdar://problem/27989483>

Reviewed by Dean Jackson.

We introduce the TracksSupport class to only enable the media tracks button
in the media controls when text tracks and/or multiple audio tracks are available.

Tests: media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html
       media/modern-media-controls/tracks-support/tracks-support-no-tracks.html
       media/modern-media-controls/tracks-support/tracks-support-text-tracks.html

* Modules/modern-media-controls/js-files:
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype._updateControlsIfNeeded):
* Modules/modern-media-controls/media/tracks-support.js: Added.
(TracksSupport):
(TracksSupport.prototype.destroy):
(TracksSupport.prototype.get control):
(TracksSupport.prototype.get mediaEvents):
(TracksSupport.prototype.buttonWasClicked):
(TracksSupport.prototype.syncControl):
* WebCore.xcodeproj/project.pbxproj:

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

2 years agoWe should have a more concise way of determining when we're varargs calling a functio...
sbarati@apple.com [Fri, 11 Nov 2016 08:33:34 +0000 (08:33 +0000)]
We should have a more concise way of determining when we're varargs calling a function using rest parameters
https://bugs.webkit.org/show_bug.cgi?id=164258

Reviewed by Yusuke Suzuki.

JSTests:

* microbenchmarks/call-using-spread.js: Added.
(bar):
(foo):
* microbenchmarks/spread-large-array.js: Added.
(foo):
(arrays.push):
* microbenchmarks/spread-small-array.js: Added.
(foo):
* stress/spread-array-iterator-watchpoint-2.js: Added.
(foo):
(arrayIterator.next):
* stress/spread-array-iterator-watchpoint.js: Added.
(foo):
(Array.prototype.Symbol.iterator):
* stress/spread-non-array.js: Added.
(assert):
(foo):
(let.customIterator.Symbol.iterator):
(bar):

Source/JavaScriptCore:

This patch adds two new bytecodes and DFG nodes for the following code patterns:

```
foo(a, b, ...c)
let x = [a, b, ...c];
```

To do this, I've introduced two new bytecode operations (and their
corresponding DFG nodes):

op_spread and op_new_array_with_spread.

op_spread takes a single input and performs the ES6 iteration protocol on it.
It returns the result of doing the spread inside a new class I've
made called JSFixedArray. JSFixedArray is a cell with a single 'size'
field and a buffer of values allocated inline in the cell. Abstracting
the protocol into a single node is good because it will make IR analysis
in the future much simpler. For now, it's also good because it allows
us to create fast paths for array iteration (which is quite common).
This fast path allows us to emit really good code for array iteration
inside the DFG/FTL.

op_new_array_with_spread is a variable argument bytecode that also
has a bit vector associated with it. The bit vector indicates if
any particular argument is to be spread or not. Arguments that
are spread are known to be JSFixedArray because we must emit an
op_spread before op_new_array_with_spread consumes the value.
For example, for this array:
[a, b, ...c, d, ...e]
we will have this bit vector:
[0, 0, 1, 0, 1]

The reason I've chosen this IR is that it will make eliminating
a rest allocation for this type of code much easier:

```
function foo(...args) {
    return bar(a, b, ...args);
}
```

It will be easier to analyze the IR now that the operations
will be described at a high level.

This patch is an ~8% speedup on ES6SampleBench on my MBP.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/IteratorHelpers.js: Added.
(performIteration):
* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
* bytecode/ObjectPropertyConditionSet.cpp:
(JSC::generateConditionForSelfEquivalence):
* bytecode/ObjectPropertyConditionSet.h:
* bytecode/TrackedReferences.cpp:
(JSC::TrackedReferences::check):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::bitVectors):
(JSC::UnlinkedCodeBlock::bitVector):
(JSC::UnlinkedCodeBlock::addBitVector):
(JSC::UnlinkedCodeBlock::shrinkToFit):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewArrayWithSpread):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ArrayNode::emitBytecode):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::addToGraph):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::watchHavingABadTime):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isWatchingArrayIteratorProtocolWatchpoint):
* dfg/DFGNode.h:
(JSC::DFG::Node::bitVector):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileNewArrayWithSpread):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGStructureRegistrationPhase.cpp:
(JSC::DFG::StructureRegistrationPhase::run):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
(JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedCell):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitAllocateVariableSizedCell):
(JSC::AssemblyHelpers::emitAllocateVariableSizedJSObject):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_array_with_spread):
(JSC::JIT::emit_op_spread):
* jit/JITOperations.h:
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntSlowPaths.cpp:
* llint/LowLevelInterpreter.asm:
* runtime/ArrayIteratorAdaptiveWatchpoint.cpp: Added.
(JSC::ArrayIteratorAdaptiveWatchpoint::ArrayIteratorAdaptiveWatchpoint):
(JSC::ArrayIteratorAdaptiveWatchpoint::handleFire):
* runtime/ArrayIteratorAdaptiveWatchpoint.h: Added.
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:
* runtime/IteratorOperations.h:
(JSC::forEachInIterable):
* runtime/JSCInlines.h:
* runtime/JSFixedArray.cpp: Added.
(JSC::JSFixedArray::visitChildren):
* runtime/JSFixedArray.h: Added.
(JSC::JSFixedArray::createStructure):
(JSC::JSFixedArray::createFromArray):
(JSC::JSFixedArray::get):
(JSC::JSFixedArray::buffer):
(JSC::JSFixedArray::size):
(JSC::JSFixedArray::offsetOfSize):
(JSC::JSFixedArray::offsetOfData):
(JSC::JSFixedArray::create):
(JSC::JSFixedArray::JSFixedArray):
(JSC::JSFixedArray::allocationSize):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
(JSC::JSGlobalObject::objectPrototypeIsSane): Deleted.
(JSC::JSGlobalObject::arrayPrototypeChainIsSane): Deleted.
(JSC::JSGlobalObject::stringPrototypeChainIsSane): Deleted.
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::arrayIteratorProtocolWatchpoint):
(JSC::JSGlobalObject::iteratorProtocolFunction):
* runtime/JSGlobalObjectInlines.h: Added.
(JSC::JSGlobalObject::objectPrototypeIsSane):
(JSC::JSGlobalObject::arrayPrototypeChainIsSane):
(JSC::JSGlobalObject::stringPrototypeChainIsSane):
(JSC::JSGlobalObject::isArrayIteratorProtocolFastAndNonObservable):
* runtime/JSType.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

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

2 years ago[GTK][JHbuild] bump libnice version in openwebrtc.modules
philn@webkit.org [Fri, 11 Nov 2016 08:08:15 +0000 (08:08 +0000)]
[GTK][JHbuild] bump libnice version in openwebrtc.modules
https://bugs.webkit.org/show_bug.cgi?id=164586

Reviewed by Michael Catanzaro.

Update to a recent libnice git snapshot and remove patches already
upstream or not applying anymore. The patches not upstream yet
will be reported in Phabricator.

* gtk/openwebrtc.modules:
* gtk/patches/libnice-0001-agent-Remove-unnecessary-NULL-check.patch: Removed.
* gtk/patches/libnice-0002-Do-not-update-a-remote-candidate-s-type.patch: Removed.
* gtk/patches/libnice-0002-TURN-handle-437-Allocation-Mismatch-responses.patch: Removed.
* gtk/patches/libnice-0003-Do-not-compare-scope-for-IPv6-address-when-scope-is-.patch: Removed.
* gtk/patches/libnice-0004-Removing-no-op-assignment.patch: Removed.

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

2 years ago[DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
utatane.tea@gmail.com [Fri, 11 Nov 2016 07:42:05 +0000 (07:42 +0000)]
[DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
https://bugs.webkit.org/show_bug.cgi?id=164632

Reviewed by Sam Weinig.

Currently, DOMJIT patchpoint is only allowed for getter in attributes.
To make it explicit, we use IDL attribute DOMJIT=Getter instead of
DOMJIT.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/test/TestDOMJIT.idl:
* dom/Document.idl:
* dom/Node.idl:

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

2 years ago[SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
commit-queue@webkit.org [Fri, 11 Nov 2016 06:29:44 +0000 (06:29 +0000)]
[SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
https://bugs.webkit.org/show_bug.cgi?id=164622

Patch by Sam Weinig <sam@webkit.org> on 2016-11-10
Reviewed by Darin Adler.

Part 2 of moving special casing of SVG out of the bindings.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* bindings/scripts/CodeGenerator.pm:
(GenerateCompileTimeCheckForEnumsIfNeeded):
* bindings/scripts/IDLAttributes.txt:
Allow specifying a different scope for the constants to be declared in.
This allows us to have only one copy of the constants in the implementation
of SVGAngle/SVGAngleValue and SVGPreserveAspectRatio/SVGPreserveAspectRatioValue.

* loader/FrameLoader.cpp:
* rendering/svg/RenderSVGImage.h:
Remove unnecessary #include.

* svg/SVGAngle.h:
Remove redundant enum declaration.

* svg/SVGAngle.idl:
Specify a ConstantsScope of SVGAngleValue.

* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::updateImageViewport):
* svg/PatternAttributes.h:
(WebCore::PatternAttributes::preserveAspectRatio):
(WebCore::PatternAttributes::setPreserveAspectRatio):
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
* svg/SVGAnimatedPreserveAspectRatio.h:
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::createPreserveAspectRatio):
* svg/SVGAnimatedType.h:
(WebCore::SVGAnimatedType::preserveAspectRatio):
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::parseAttribute):
* svg/SVGFitToViewBox.cpp:
(WebCore::SVGFitToViewBox::viewBoxToViewTransform):
* svg/SVGFitToViewBox.h:
(WebCore::SVGFitToViewBox::parseAttribute):
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::parseAttribute):
* svg/SVGViewSpec.cpp:
(WebCore::SVGViewSpec::preserveAspectRatioString):
(WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
(WebCore::SVGViewSpec::reset):
(WebCore::SVGViewSpec::parseViewSpec):
* svg/SVGViewSpec.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::computeIntrinsicDimensions):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::FEImage):
(WebCore::FEImage::createWithImage):
(WebCore::FEImage::createWithIRIReference):
* svg/graphics/filters/SVGFEImage.h:
Replace SVGPreserveAspectRatio usage with SVGPreserveAspectRatioValue.

* svg/SVGPreserveAspectRatio.cpp: Removed.
* svg/SVGPreserveAspectRatio.h: Replaced.
* svg/SVGPreserveAspectRatio.idl:
* svg/SVGPreserveAspectRatioValue.cpp: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.cpp.
* svg/SVGPreserveAspectRatioValue.h: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.h.
Rename SVGPreserveAspectRatio to SVGPreserveAspectRatioValue and add a new SVGPreserveAspectRatio
that acts as the binding object.

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

2 years agoFix assertion after r208534.
achristensen@apple.com [Fri, 11 Nov 2016 06:16:08 +0000 (06:16 +0000)]
Fix assertion after r208534.
https://bugs.webkit.org/show_bug.cgi?id=160497

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(WebInstallMemoryPressureHandler):
WebInstallMemoryPressureHandler can be called before [WebView initWithFrame:frameName:groupName:]
When this happens, we should use the same std::once_flag to make sure we install the MemoryPressureHandler::singleton
only once, otherwise we get an assertion !m_installed in MemoryPressureHandler::setLowMemoryHandler.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm: Added.
(TestWebKitAPI::TEST):
Add a regression test.

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

2 years ago[DOMJIT] Document#body should have DOMJIT patchpoint
utatane.tea@gmail.com [Fri, 11 Nov 2016 06:08:18 +0000 (06:08 +0000)]
[DOMJIT] Document#body should have DOMJIT patchpoint
https://bugs.webkit.org/show_bug.cgi?id=164627

Reviewed by Darin Adler.

Source/WebCore:

This patch implements document.body accessor. To implement it, we need,

1. DOM traversing ability from ASM.
2. Checking HTMLElement.
3. Checking HTMLElement's localName.

The above features are already implemented in CSSJIT.
We extract some of utilities from CSSJIT to share them with DOMJIT.

Test: js/dom/domjit-accessor-document-body.html

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToNextAdjacentElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToPreviousAdjacentElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
(WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
(WebCore::SelectorCompiler::testIsElementFlagOnNode): Deleted.
(WebCore::SelectorCompiler::testIsHTMLFlagOnNode): Deleted.
* dom/Document.idl:
* dom/Element.h:
* dom/QualifiedName.h:
* domjit/DOMJITAbstractHeapRepository.yaml:
* domjit/DOMJITHelpers.h:
(WebCore::DOMJIT::branchTestIsElementFlagOnNode):
(WebCore::DOMJIT::branchTestIsHTMLFlagOnNode):
* domjit/JSDocumentDOMJIT.cpp:
(WebCore::DocumentBodyDOMJIT::checkDOM):
(WebCore::loadLocalName):
(WebCore::DocumentBodyDOMJIT::callDOMGetter):

LayoutTests:

* js/dom/domjit-accessor-document-body-expected.txt: Added.
* js/dom/domjit-accessor-document-body.html: Added.

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

2 years agoRemove unused parameter name to fix build error on iOS
wilander@apple.com [Fri, 11 Nov 2016 04:37:06 +0000 (04:37 +0000)]
Remove unused parameter name to fix build error on iOS
https://bugs.webkit.org/show_bug.cgi?id=163468

No review.

No new tests.

* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Removed parameter name 'pasteboardURL' in unimplemented function.

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

2 years agoSpeed up HTMLInputElement validation
cdumez@apple.com [Fri, 11 Nov 2016 04:32:41 +0000 (04:32 +0000)]
Speed up HTMLInputElement validation
https://bugs.webkit.org/show_bug.cgi?id=164603

Reviewed by Ryosuke Niwa.

Speed up HTMLInputElement validation by doing 1 virtual function call
instead of 9 and calling HTMLInputElement::value() only once per
validation instead of 9 times. Calling value() is expensive because
of sanitization.

No new tests, no Web-exposed behavior change.

* html/BaseCheckableInputType.cpp:
(WebCore::BaseCheckableInputType::fallbackValue):
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::isValid):
* html/FormAssociatedElement.h:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isValidFormControlElement):
(WebCore::HTMLFormControlElement::updateValidity):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isValid):
(WebCore::HTMLInputElement::value):
* html/HTMLInputElement.h:
* html/TextFieldInputType.cpp:
(WebCore::limitLength):
* html/ValidityState.idl:

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

2 years agoAdd link information to data transfer pasteboard for drag and drop links
wilander@apple.com [Fri, 11 Nov 2016 04:15:41 +0000 (04:15 +0000)]
Add link information to data transfer pasteboard for drag and drop links
https://bugs.webkit.org/show_bug.cgi?id=163468
<rdar://problem/20634630>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
This test ensures data transfers still work for types 'text' and 'url', i.e. that we don't
regress in-page use of the drag pasteboard.

* page/DragController.cpp:
(WebCore::DragController::startDrag):
    Now adds trustworthy link information to the drag pasteboard.
* platform/Pasteboard.h:
    New function declaration Pasteboard::writeTrustworthyWebURLsPboardType.
* platform/efl/PasteboardEfl.cpp:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Empty, i.e. not implemented.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Empty, i.e. not implemented.
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Calls ASSERT_NOT_REACHED() to make sure we don't use this function before we have
    decided on a trustrworthy URL pasteboard type on iOS. Currently not used since we
    don't support drag & drop on iOS.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Writes the given URL to the WebURLsWithTitlesPboardType. This pasteboard type
    serves as a trusted drop source.
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
    Empty, i.e. not implemented.

LayoutTests:

* editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard-expected.txt: Added.
* editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html: Added.
    This test ensures data transfer is not deleted or overwritten for the types 'text' and 'url'.
* platform/ios-simulator/TestExpectations:
    Drag & drop is not supported on iOS.

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

2 years agoREGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when...
commit-queue@webkit.org [Fri, 11 Nov 2016 02:20:48 +0000 (02:20 +0000)]
REGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when decoding a sub-sampled large image
https://bugs.webkit.org/show_bug.cgi?id=164617

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-11-10
Reviewed by Tim Horton.

This covered by the test fast/images/image-subsampling.html but it should
run with --guard-malloc --repeat-each=10 to show the bug or to verify the
fix.

imageSourceOptions() returns a non static RetainPtr<CFDictionaryRef> if
the subsamplingLevel is not zero. Because we are assigning the raw pointer
to a local variable in ImageDecoder::createFrameImageAtIndex(), CFRelease()
is called for the CFDictionaryRef immediately after this assignment. This
causes its memory to be freed in this case even before calling CG.

This bug does not happen if the subsamplingLevel is zero because we cache
the returned value in a static NeverDestroyed<RetainPtr<CFDictionaryRef> in
imageSourceOptions(). This cache prevents the CFDictionaryRef from being
freed in ImageDecoder::createFrameImageAtIndex() no matter where CFRelease()
is called.

The fix is hold the returned value in a RetainPtr<CFDictionaryRef>. This
will ensure the CFDictionaryRef raw pointer is valid till the end of
ImageDecoder::createFrameImageAtIndex().

* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex): Ensure the pointer is retained.

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

2 years agoFix broken have-a-bad-time-with-arguments.js test.
mark.lam@apple.com [Fri, 11 Nov 2016 01:27:02 +0000 (01:27 +0000)]
Fix broken have-a-bad-time-with-arguments.js test.
https://bugs.webkit.org/show_bug.cgi?id=164626

Reviewed by Filip Pizlo.

But also saved a copy of the broken one as broken-have-a-bad-time-with-arguments-for-gc-testing.js
because coincidentally, it stresses the GC in ways that help reveal bugs.

* stress/broken-have-a-bad-time-with-arguments-for-gc-testing.js: Added.
(testFunction):
(warmupFunction):
(let.argsDeclIndex.in.argumentsDecls.let.indexToReturnIndex.in.indicesToReturn.let.insertElementActionIndex.in.insertElementActions.let.tierWarmupCountIndex.in.tierWarmupCounts.let.testArgsIndex.in.testArgsList.catch):
* stress/have-a-bad-time-with-arguments.js:

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

2 years ago[Win][Direct2D] Add transparency layer support
bfulgham@apple.com [Fri, 11 Nov 2016 00:59:53 +0000 (00:59 +0000)]
[Win][Direct2D] Add transparency layer support
https://bugs.webkit.org/show_bug.cgi?id=164614

Reviewed by Dean Jackson.

Provide a stackable implementation of transparency layers so that
multiple layers with opacity draw propery.

Tested by fast/layers/opacity-stacking.html and others.

* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::platformContext): Remove unneeded assertion.
(WebCore::GraphicsContextPlatformPrivate::renderTarget): Return current context taking
into account the presence of transparency layers.
(WebCore::GraphicsContextPlatformPrivate::setAlpha): Added.
(WebCore::GraphicsContextPlatformPrivate::currentGlobalAlpha): Get current global
alpha for current layer.
(WebCore::GraphicsContext::colorWithGlobalAlpha): Compute proper color taking into
account the current layer.
(WebCore::drawWithShadowHelper): Helper function to share code.
(WebCore::GraphicsContext::drawWithShadow): Use new helper function.
(WebCore::GraphicsContextPlatformPrivate::beginTransparencyLayer): Added.
(WebCore::GraphicsContext::beginPlatformTransparencyLayer): Call new implementation.
(WebCore::GraphicsContextPlatformPrivate::endTransparencyLayer): Added.
(WebCore::GraphicsContext::endPlatformTransparencyLayer): Call new implementation.
(WebCore::GraphicsContext::clearRect): Clear to transparent color.
(WebCore::GraphicsContext::setPlatformAlpha): Pass new alpha on to any active
transparency layer.
* platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
(WebCore::GraphicsContextPlatformPrivate::renderTarget): Deleted.

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

2 years agoAdd CSS Color Level 4 to features.
dino@apple.com [Fri, 11 Nov 2016 00:49:06 +0000 (00:49 +0000)]
Add CSS Color Level 4 to features.

* features.json:

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

2 years agoMove update image calls to RenderElement::styleDidChange.
zalan@apple.com [Fri, 11 Nov 2016 00:26:53 +0000 (00:26 +0000)]
Move update image calls to RenderElement::styleDidChange.
https://bugs.webkit.org/show_bug.cgi?id=164623

Reviewed by Simon Fraser.

There should be no dependency on the image update between ::styleWillChange and ::styleDidChange.

Covered by existing tests.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::initializeStyle):
(WebCore::RenderElement::setStyle):
(WebCore::RenderElement::styleDidChange):

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

2 years agoAfter r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
commit-queue@webkit.org [Fri, 11 Nov 2016 00:01:14 +0000 (00:01 +0000)]
After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
https://bugs.webkit.org/show_bug.cgi?id=164621

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-11-10
Reviewed by Youenn Fablet.

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResource):
CachedResourceLoader expects a sanitized URL.

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

2 years agoREGRESSION (r208522): LayoutTest fast/loader/reload-zero-byte-plugin.html is a flaky...
cdumez@apple.com [Thu, 10 Nov 2016 23:59:42 +0000 (23:59 +0000)]
REGRESSION (r208522): LayoutTest fast/loader/reload-zero-byte-plugin.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=164570

Reviewed by Simon Fraser.

Tools:

Properly reset TestController::m_shouldDownloadUndisplayableMIMETypes between tests to
avoid flakiness.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

LayoutTests:

Unskip test which should no longer be flaky.

* platform/mac/TestExpectations:

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

2 years agoIndexedDB 2.0 Support the IDBDatabase.onclose event.
beidson@apple.com [Thu, 10 Nov 2016 23:27:37 +0000 (23:27 +0000)]
IndexedDB 2.0 Support the IDBDatabase.onclose event.
https://bugs.webkit.org/show_bug.cgi?id=164602

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/interfaces-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror"
* Modules/indexeddb/IDBDatabase.idl:

LayoutTests:

* TestExpectations:
* storage/indexeddb/modern/handle-user-delete-expected.txt:
* storage/indexeddb/modern/resources/handle-user-delete.js:

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

2 years agoASSERTION FAILED: length > offset encountered with wasm.yaml/wasm/js-api/test_Module...
jfbastien@apple.com [Thu, 10 Nov 2016 23:07:15 +0000 (23:07 +0000)]
ASSERTION FAILED: length > offset encountered with wasm.yaml/wasm/js-api/test_Module.js.default-wasm
https://bugs.webkit.org/show_bug.cgi?id=164597

Reviewed by Keith Miller.

JSTests:

Trim the array buffer before returning it: it's optimistically
over-allocated to avoid growing all the time, but when parsed it
can't have extra content.

* wasm/Builder_WebAssemblyBinary.js:
(export.const.Binary):
* wasm/LowLevelBinary.js:
(export.default.LowLevelBinary.prototype.get return):

Source/JavaScriptCore:

* wasm/WasmParser.h:
(JSC::Wasm::Parser::parseVarUInt32): move closer to other parsers
(JSC::Wasm::Parser::parseVarUInt64): move closer to other parsers

Source/WTF:

Decoding at end of file should fail, not assert.

* wtf/LEBDecoder.h:
(WTF::LEBDecoder::decodeUInt):
(WTF::LEBDecoder::decodeInt32):

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

2 years agoMarking swipe/pushState-cached-back-swipe.html and swipe/main-frame-pinning-requireme...
ryanhaddad@apple.com [Thu, 10 Nov 2016 23:03:28 +0000 (23:03 +0000)]
Marking swipe/pushState-cached-back-swipe.html and swipe/main-frame-pinning-requirement.html as failing.
https://bugs.webkit.org/show_bug.cgi?id=164572

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoCopied text would contain text inside CDATA sections and comments
rniwa@webkit.org [Thu, 10 Nov 2016 22:21:35 +0000 (22:21 +0000)]
Copied text would contain text inside CDATA sections and comments
https://bugs.webkit.org/show_bug.cgi?id=164578
Source/WebCore:

<rdar://problem/19834542>

Reviewed by Darin Adler.

The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.

In the long term, we should check the visibility of the text as done in MarkupAccumulator.

Test: editing/mac/attributed-string/comment-cdata-section.html

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_traverseNode):

LayoutTests:

Reviewed by Darin Adler.

Added a regression test for creating an attributed string from different kinds of Text nodes.
Comment and CDataSection should not be included in the attributed string.

* editing/mac/attributed-string/comment-cdata-section-expected.txt: Added.
* editing/mac/attributed-string/comment-cdata-section.html: Added.
* platform/mac-yosemite/editing/mac/attributed-string/comment-cdata-section-expected.txt: Added.

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

2 years agotest262: DataView / TypedArray methods should throw RangeErrors for negative numbers...
commit-queue@webkit.org [Thu, 10 Nov 2016 22:03:24 +0000 (22:03 +0000)]
test262: DataView / TypedArray methods should throw RangeErrors for negative numbers (ToIndex)
https://bugs.webkit.org/show_bug.cgi?id=164450

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-11-10
Reviewed by Darin Adler.

JSTests:

* stress/dataview-typedarray-toindex.js: Added.
Tests for all cases where ToIndex should be used.

* test262.yaml:
New passing tests.

Source/JavaScriptCore:

* runtime/JSCJSValue.h:
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::toIndex):
Introduce a method for toIndex, which is used by DataView and TypedArrays
to convert an argument to a number with the possibility of throwing
RangeErrors for negative values. We also throw RangeErrors for large
values, because wherever this is used we expect an unsigned.

* runtime/JSArrayBufferConstructor.cpp:
(JSC::constructArrayBuffer):
* runtime/JSDataViewPrototype.cpp:
(JSC::getData):
(JSC::setData):
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayViewWithArguments):
(JSC::constructGenericTypedArrayView):
Use toIndex instead of toUint32 where required.

LayoutTests:

* fast/canvas/webgl/data-view-crash-expected.txt:
* fast/canvas/webgl/data-view-test-expected.txt:
Better error message.

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

2 years agoA few bits of minor code clean up.
mark.lam@apple.com [Thu, 10 Nov 2016 21:42:33 +0000 (21:42 +0000)]
A few bits of minor code clean up.
https://bugs.webkit.org/show_bug.cgi?id=164523

Reviewed by Yusuke Suzuki.

* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::dump):
- Insert a space to make the dump more legible.

* runtime/Options.h:
- Fixed some typos.

* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplaceUsingRegExp):
(JSC::stringProtoFuncReplaceUsingStringSearch):
- Use the VM& that is already available.

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

2 years agobmalloc threads should have a non-default QoS
ggaren@apple.com [Thu, 10 Nov 2016 21:40:56 +0000 (21:40 +0000)]
bmalloc threads should have a non-default QoS
https://bugs.webkit.org/show_bug.cgi?id=164612

Reviewed by Filip Pizlo.

* bmalloc/AsyncTask.h:
(bmalloc::Function>::threadEntryPoint): Request user-interactive quality
of service because user-interactive tasks use malloc.

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