2017-06-18 Babak Shafiei <bshafiei@apple.com> Roll out r210226. 2017-06-18 Babak Shafiei <bshafiei@apple.com> Roll out r211501. 2017-06-18 Babak Shafiei <bshafiei@apple.com> Roll out r212173. 2017-06-18 Babak Shafiei <bshafiei@apple.com> Roll out r212174. 2017-06-15 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r218300. rdar://problem/31971362 2017-06-14 Dean Jackson <dino@apple.com> Restrict filtered painting across cross-origin boundaries with transforms https://bugs.webkit.org/show_bug.cgi?id=173388 <rdar://problem/27362159> Reviewed by Simon Fraser. Make sure all cases of LayerPaintingInfo maintain the security flag. In this case there was only one new place, and since everything is scalar, there was no need for a real copy constructor. Test: http/tests/css/filters-on-iframes-transform.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerByApplyingTransform): Make sure the cross origin flag is used in the call to paint the layer children. * rendering/RenderLayer.h: Fix some typos. 2017-06-01 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r212174. rdar://problem/32080671 2017-02-10 Daniel Bates <dabates@apple.com> Attempt to fix the build following <https://trac.webkit.org/changeset/212173> (https://bugs.webkit.org/show_bug.cgi?id=166774) * dom/Document.cpp: (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since the parameter cachedFrame is unused in non-debug build. 2017-06-01 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r212173. rdar://problem/32080671 2017-02-10 Daniel Bates <dabates@apple.com> Detach frame from document when entering page cache https://bugs.webkit.org/show_bug.cgi?id=166774 <rdar://problem/29904368> Reviewed by Chris Dumez. When a page enters the page cache it is unnecessary for it to hold a reference to its associated frame because subsequent interactions with the page do not need to make use of it. Once a page exits the page cache we associate it with its frame. * dom/Document.cpp: (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame(). (WebCore::Document::attachToCachedFrame): Added. (WebCore::Document::detachFromCachedFrame): Added. (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to the former. (WebCore::Document::hasEverCalledWindowOpen): Deleted. (WebCore::Document::markHasCalledWindowOpen): Deleted. (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame. * dom/Document.h: (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed visibility from public to private and made this function inline. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were removed from the page when it was in the page cache as there is no need to restore such frames. (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the frame tree. (WebCore::CachedFrame::CachedFrame): Detach from the frame. (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame. (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to detach the animation controller from the document as it is being destroyed. We have to do this here because the document does not have a frame. And Document::prepareForDestruction() only calls CSSAnimationController::detachFromDocument() if the document has a frame. * history/CachedFrame.h: * history/PageCache.cpp: (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open() or has an opener as it is feasible to keep such pages in the page cache. * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit. * loader/FrameLoader.cpp: (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the page is not in- or about to enter- the page cache. A page in the page cache has finished loading and its active DOM objects are suspended. Also fix style nit in comment. (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain that we protect the frame because stopAllLoaders() can cause the frame to be deallocated. * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this function will be removed. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted. (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted. * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::openedByWindowOpen): Deleted. * page/Page.h: * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener. 2017-06-01 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r211501. rdar://problem/32080671 2017-02-01 Antoine Quint <graouts@apple.com> [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=165319 <rdar://problem/30284104> Reviewed by Dean Jackson. Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks- support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue is that animations are suspended by media/controls/track-menu.html with a call to internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations(). Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because the selection animation for the tracks panel menu item that is clicked never completes and the delegate to notify that an item in the tracks panel was selected is never fired, which leads to the test failure. We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current document, rather than calling into AnimationController::suspendAnimations() which would do just that, but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent document load. * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer associated with an AnimationController. * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case the document its renderer is associated with is suspended. This is required since previously CompositeAnimations would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no document to use as a basis to query its suspended state in that constructor. (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument): (WebCore::AnimationControllerPrivate::detachFromDocument): (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument): (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument): (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended): (WebCore::AnimationController::animationsAreSuspendedForDocument): (WebCore::AnimationController::detachFromDocument): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * testing/Internals.cpp: (WebCore::Internals::animationsAreSuspended): (WebCore::Internals::suspendAnimations): (WebCore::Internals::resumeAnimations): 2017-06-01 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r210226. rdar://problem/32080671 2017-01-02 Andreas Kling <akling@apple.com> Drop the render tree for documents in the page cache. <https://webkit.org/b/121798> Reviewed by Antti Koivisto. To save memory and reduce complexity, have documents tear down their render tree when entering the page cache. I've wanted to do this for a long time and it seems like we can actually do it now. This patch will enable a number of clean-ups since it's no longer valid for renderers to exist while the document is in page cache. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache since we will now be tearing down render trees right as they enter the page cache. * dom/PageCache.cpp: (WebCore::destroyRenderTree): (WebCore::PageCache::addIfCacheable): Tear down the render tree right before setting the in-cache flag. The render tree is destroyed in bottom-up order to ensure that the main frame renderers die last. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): * page/FrameView.h: * page/FrameView.cpp: (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring a frame from the page cache. This dirties the scrolling tree, which was covered by tests. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::setNeedsStyleRecalc): * page/animation/AnimationController.cpp: (WebCore::AnimationController::cancelAnimations): Make these no-ops if called while the render tree is being torn down. This fixes some assertion failures on layout tests and avoids pointless style invalidation. 2017-05-25 Jason Marcell <jmarcell@apple.com> Cherry-pick r217439. rdar://problem/32089229 2017-05-24 Jiewen Tan <jiewen_tan@apple.com> Crash on WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance + 1195 https://bugs.webkit.org/show_bug.cgi?id=172555 <rdar://problem/32004724> Reviewed by Ryosuke Niwa. setSelectionWithoutUpdatingAppearance could dispatch a synchronous focusin event, which could invoke an event handler that deteles the frame. Therefore, add a protector before the call. Test: editing/selection/select-iframe-focusin-document-crash.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelection): 2017-05-25 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r217392. rdar://problem/32391206 2017-05-24 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION (r206481): Don't assume frameCount() is larger than or equal to the size of the image frame cache https://bugs.webkit.org/show_bug.cgi?id=172552 Reviewed by Geoffrey Garen. If an image with many cached ImageFrames is cached but its encoded data is freed, then the same image is reused, the encoded data will be fetched. But the initial frameCount() might be less than the current size of the ImageFrames cache. This was causing an assertion in the debug build and crash in the release build. Vector::grow() does not handle the case where the new size is smaller than the current size safely. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::growFrames): 2017-05-24 Jason Marcell <jmarcell@apple.com> Cherry-pick r217172. rdar://problem/32380123 2017-05-19 Chris Dumez <cdumez@apple.com> Do not fire load event for SVGElements that are detached or in frameless documents https://bugs.webkit.org/show_bug.cgi?id=172289 <rdar://problem/32275689> Reviewed by Ryosuke Niwa. We should not fire load event for SVGElements that are detached or in frameless documents. Test: svg/load-event-detached.html * svg/SVGElement.cpp: (WebCore::SVGElement::sendSVGLoadEventIfPossible): 2017-05-23 Jason Marcell <jmarcell@apple.com> Cherry-pick r217197. rdar://problem/32355285 2017-05-21 Antti Koivisto <antti@apple.com> matchMedia('print').addListener() fires in WK1 but never in WK2 when printing (breaks printing Google maps, QuickLooks) https://bugs.webkit.org/show_bug.cgi?id=172361 <rdar://problem/28777408> Reviewed by Sam Weinig. Test: fast/media/matchMedia-print.html * page/FrameView.cpp: (WebCore::FrameView::layout): Evaluate matchMedia queries unconditionally. No idea why it wasn't like that. * testing/Internals.cpp: (WebCore::Internals::setPrinting): Add testing support. The existing ways to do printing testing were unable to hit this bug as they had too much additional gunk. * testing/Internals.h: * testing/Internals.idl: 2017-05-22 Jason Marcell <jmarcell@apple.com> Cherry-pick r216992. rdar://problem/32258716 2017-05-22 Jiewen Tan <jiewen_tan@apple.com> Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto https://bugs.webkit.org/show_bug.cgi?id=172146 <rdar://problem/32122256> Reviewed by Brent Fulgham. In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in the custom binding codes. Test: crypto/webkitSubtle/import-export-raw-key-leak.html * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::encrypt): (WebCore::JSWebKitSubtleCrypto::decrypt): (WebCore::JSWebKitSubtleCrypto::sign): (WebCore::JSWebKitSubtleCrypto::verify): (WebCore::JSWebKitSubtleCrypto::digest): (WebCore::JSWebKitSubtleCrypto::importKey): (WebCore::JSWebKitSubtleCrypto::unwrapKey): * crypto/WebKitSubtleCrypto.idl: 2017-05-18 Dean Jackson <dino@apple.com> Restrict SVG filters to accessible security origins https://bugs.webkit.org/show_bug.cgi?id=118689 <rdar://problem/27362159> Reviewed by Brent Fulgham. Certain SVG filters should only be allowed to operate on content that is has SecurityOrigin access to. Implement this by including a flag in PaintInfo and LayerPaintingInfo, and have RenderWidget make sure the documents have acceptable SecurityOrigins as it goes to paint. This could be used as the first step in a "safe painting" strategy, allowing some content to be rendered into a canvas or via the element() CSS function... but it is only a small first step. Test: http/tests/css/filters-on-iframes.html * page/FrameView.cpp: (WebCore::FrameView::paintContents): * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::paint): * platform/ScrollView.h: * platform/Scrollbar.cpp: (WebCore::Scrollbar::paint): * platform/Scrollbar.h: * platform/Widget.h: * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::hasFilterThatShouldBeRestrictedBySecurityOrigin): * platform/graphics/filters/FilterOperations.h: * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::build): * rendering/FilterEffectRenderer.h: * rendering/PaintInfo.h: (WebCore::PaintInfo::PaintInfo): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paint): (WebCore::RenderLayer::setupFilters): (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): * rendering/RenderLayer.h: * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::paint): * rendering/RenderScrollbar.h: * rendering/RenderWidget.cpp: (WebCore::RenderWidget::paintContents): 2017-05-19 Jason Marcell <jmarcell@apple.com> Cherry-pick r215091. rdar://problem/32279160 2017-04-07 Miguel Gomez <magomez@igalia.com> [GTK+] Animations not played properly when using synchronous decoding https://bugs.webkit.org/show_bug.cgi?id=170591 Reviewed by Carlos Garcia Campos. Fix an index error when destroying decoded frames that was sometimes deleting the frame we wanted to keep. Covered by exitent tests. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::destroyDecodedData): 2017-05-19 Youenn Fablet <youenn@apple.com> Disabling WritableStream and ReadableByteStream. * Modules/streams/ReadableStream.js: (initializeReadableStream): Throwing in case the source type is bytes. * Modules/streams/WritableStream.idl: Making it dependent on writable stream API flag. 2017-05-17 Jason Marcell <jmarcell@apple.com> Cherry-pick r216726. rdar://problem/31971324 2017-05-11 Zalan Bujtas <zalan@apple.com> AX: Defer text changes until after the tree is clean if needed. https://bugs.webkit.org/show_bug.cgi?id=171546 <rdar://problem/31934942> Reviewed by Simon Fraser. While updating an accessibility object state, we might trigger unintentional style updates. This style update could end up destroying renderes that are still referenced by functions on the callstack. To avoid that, defer such changes and let AXObjectCache operate on a clean tree. Test: accessibility/crash-when-render-tree-is-not-clean.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::handleAttributeChanged): (WebCore::AXObjectCache::labelChanged): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::deferRecomputeIsIgnored): (WebCore::AXObjectCache::deferTextChangedIfNeeded): (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted. (WebCore::AXObjectCache::deferTextChanged): Deleted. * accessibility/AXObjectCache.h: Decouple different type of changes. (WebCore::AXObjectCache::deferRecomputeIsIgnored): (WebCore::AXObjectCache::deferTextChangedIfNeeded): (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted. (WebCore::AXObjectCache::deferTextChanged): Deleted. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::deleteLines): * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::createAndAppendRootInlineBox): * rendering/RenderText.cpp: (WebCore::RenderText::setText): 2017-05-17 Jason Marcell <jmarcell@apple.com> Cherry-pick r216978. rdar://problem/31971195 2017-05-17 Ryosuke Niwa <rniwa@webkit.org> getElementById can return a wrong elemnt when a matching element is removed during beforeload event https://bugs.webkit.org/show_bug.cgi?id=171374 Reviewed by Brent Fulgham. The bug was caused by HTMLLinkElement firing beforeload event inside insertedInto before the tree state is updated. Delay the event dispatch to the post insertion callback. Test: fast/html/link-element-removal-during-beforeload.html * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::insertedInto): (WebCore::HTMLLinkElement::finishedInsertingSubtree): * html/HTMLLinkElement.h: 2017-05-17 Jason Marcell <jmarcell@apple.com> Cherry-pick r216813. rdar://problem/31971160 2017-05-12 Jiewen Tan <jiewen_tan@apple.com> Elements should be inserted into a template element as its content's last child https://bugs.webkit.org/show_bug.cgi?id=171373 <rdar://problem/31862949> Reviewed by Ryosuke Niwa. Before this change, our HTML parser obeys the following premises: 1) A fostering child whose parent is a table should be inserted before its parent and under its grandparent. 2) When inserting into a template element, an element should be inserted into its content. Let's walk through the example: a) Before eventhandler takes place template table svg <- parser b) After eventhandler takes place template table svg <- parser c) after parsing svg template content svg (table) table Finally, in the example, the svg element will be inserted into the content of the template element while having its next sibling point to the table element. However, the table element is actually under the template element not its content. This messy tree is constructed because the second premise is incompleted. It should be: When inserting into a template element, an element should be inserted into its content as its last child. Quoted from Step 3 of https://html.spec.whatwg.org/multipage/syntax.html#appropriate-place-for-inserting-a-node A correct tree will then looks like: template content svg table Tests: fast/dom/HTMLTemplateElement/insert-fostering-child-crash.html fast/dom/HTMLTemplateElement/insert-fostering-child.html * html/parser/HTMLConstructionSite.cpp: (WebCore::insert): By nullifying task.nextChild, it will force the parser to append the element as task.parent's last child. 2017-05-17 Jason Marcell <jmarcell@apple.com> Cherry-pick r216631. rdar://problem/32200771 2017-05-10 Antti Koivisto <antti@apple.com> REGRESSION (r207372) Visibility property is not inherited when used in an animation https://bugs.webkit.org/show_bug.cgi?id=171883 <rdar://problem/32086550> Reviewed by Simon Fraser. The problem here is that our animation code is tied to renderers. We don't have renderers during the initial style resolution so animations are not applied yet. When constructing renderers we set their style to the initial animated style but this step can't implement inheritance. Normally this is invisible as the first animation frame will immediately inherit the style correctly. However in this case the animation is discrete and the first frame is the same as the initial state. With r207372 we optimize the descendant style change away. This patch fixes the problem by tracking that the renderer has initial animated style and inheriting it to descendants during next style resolution even if it doesn't change. Test: animations/animation-initial-inheritance.html * rendering/RenderElement.cpp: (WebCore::RenderElement::RenderElement): * rendering/RenderElement.h: (WebCore::RenderElement::hasInitialAnimatedStyle): (WebCore::RenderElement::setHasInitialAnimatedStyle): * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::createRenderer): Set a bit on renderer indicating it has initial animated style. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Return at least 'Inherit' for style change when updating renderer with initial animated style. 2017-05-12 Jason Marcell <jmarcell@apple.com> Cherry-pick r216599. rdar://problem/32081484 2017-05-10 Andy Estes <aestes@apple.com> Keyboard input suppression should extend to subframes https://bugs.webkit.org/show_bug.cgi?id=171880 <rdar://problem/31201793> Reviewed by Ryosuke Niwa. Test: http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html * dom/EventDispatcher.cpp: (WebCore::shouldSuppressEventDispatchInDOM): Changed to call shouldSuppressKeyboardInput() on the main frame's loader. * editing/Editor.cpp: (WebCore::Editor::shouldInsertText): Ditto. 2017-05-12 Jason Marcell <jmarcell@apple.com> Cherry-pick r216307. rdar://problem/32119568 2017-05-05 Zalan Bujtas <zalan@apple.com> Renderers being destroyed should not be added to AX's deferred list. https://bugs.webkit.org/show_bug.cgi?id=171768 <rdar://problem/31955660> Reviewed by Simon Fraser. In certain cases, when custom scrollbars are present, while destroying the scrollbars' block parent, we - first remove the block from the AX's deferred list (AXObjectCache::remove) - destroy the render layer that owns the custom scrollbars (RenderLayer::destroyLayer) - detach the scrollbars from the parent (block) (RenderObject::removeFromParent) - clean up the block's lines (RenderBlock::deleteLines) - push the block back to the AX's deferred list (AXObjectCache::recomputeDeferredIsIgnored) At this point no one will remove the current block from AX's deferred list. Test: accessibility/crash-when-renderers-are-added-back-to-deferred-list.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::recomputeDeferredIsIgnored): (WebCore::AXObjectCache::deferTextChanged): 2017-05-10 Matthew Hanson <matthew_hanson@apple.com> Fix order of merge from r212528. rdar://problem/31153819 2017-05-01 Jeremy Jones <jeremyj@apple.com> Fix order of merge from r212528 Two changes got merged in the wrong order. rdar://problem/31153819 Reviewed by Jer Noble. Fixes test failure media/media-fullscreen-loop-inline.html * html/MediaElementSession.cpp: (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): 2017-05-10 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r215429. rdar://problem/32057106 2017-04-17 Youenn Fablet <youenn@apple.com> Disable outdated WritableStream API https://bugs.webkit.org/show_bug.cgi?id=170749 <rdar://problem/31446233> Reviewed by Alex Christensen. No change of behavior. Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by: - A STREAMS_API compilation flag. - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT. * Configurations/FeatureDefines.xcconfig: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::isDisturbedOrLocked): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::blobChunk): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): (WebCore::FetchResponse::BodyLoader::didReceiveData): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * Modules/fetch/FetchResponseSource.cpp: * Modules/fetch/FetchResponseSource.h: * Modules/streams/ByteLengthQueuingStrategy.idl: * Modules/streams/ByteLengthQueuingStrategy.js: * Modules/streams/CountQueuingStrategy.idl: * Modules/streams/CountQueuingStrategy.js: * Modules/streams/ReadableByteStreamController.idl: * Modules/streams/ReadableByteStreamController.js: * Modules/streams/ReadableByteStreamInternals.js: * Modules/streams/ReadableStream.idl: * Modules/streams/ReadableStream.js: (initializeReadableStream): Using readableByteStreamAPI runtime flag directly. * Modules/streams/ReadableStreamBYOBRequest.idl: * Modules/streams/ReadableStreamBYOBRequest.js: * Modules/streams/ReadableStreamDefaultController.idl: * Modules/streams/ReadableStreamDefaultController.js: * Modules/streams/ReadableStreamDefaultReader.idl: * Modules/streams/ReadableStreamDefaultReader.js: * Modules/streams/ReadableStreamInternals.js: * Modules/streams/ReadableStreamSource.h: * Modules/streams/ReadableStreamSource.idl: * Modules/streams/StreamInternals.js: * Modules/streams/WritableStream.idl: * Modules/streams/WritableStream.js: * Modules/streams/WritableStreamInternals.js: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::isReadableByteStreamAPIEnabled): (WebCore::JSDOMGlobalObject::addBuiltinGlobals): * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::constructJSReadableStreamBYOBRequest): (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable): (WebCore::createReadableStreamBYOBRequestPrivateConstructor): * bindings/js/JSReadableStreamPrivateConstructors.h: * bindings/js/JSReadableStreamSourceCustom.cpp: * bindings/js/ReadableStreamDefaultController.cpp: * bindings/js/ReadableStreamDefaultController.h: * bindings/js/WebCoreBuiltinNames.h: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setReadableByteStreamAPIEnabled): (WebCore::RuntimeEnabledFeatures::readableByteStreamAPIEnabled): (WebCore::RuntimeEnabledFeatures::setWritableStreamAPIEnabled): (WebCore::RuntimeEnabledFeatures::writableStreamAPIEnabled): * testing/Internals.cpp: * testing/Internals.h: * testing/Internals.idl: 2017-05-10 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r215250. rdar://problem/32057106 2017-04-11 Dean Jackson <dino@apple.com> Disable outdated WritableStream API https://bugs.webkit.org/show_bug.cgi?id=170749 <rdar://problem/31446233> Reviewed by Tim Horton. The API we implement is no longer accurate. Disable it until we are compatible with the new specification * Configurations/FeatureDefines.xcconfig: 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r216352. rdar://problem/32057098 2017-05-07 Simon Fraser <simon.fraser@apple.com> [iOS] REGRESSION (r209409): getBoundingClientRect is wrong for fixed-position elements in resize/orientationchange https://bugs.webkit.org/show_bug.cgi?id=171140 Reviewed by Sam Weinig. WebPage::dynamicViewportSizeUpdate() is called during rotation, and does a layout which needs to have an up-to-date layout viewport, since the layout viewport state is detectable in orientationchange and resize events via fetching the client rect of fixed elements. Normally we send in the layout viewport from the UI process, but in this case we need to compute one in the web process. So factor code into FrameView to do the computation, called from both places. Tests: fast/events/ios/rotation/layout-viewport-during-rotation.html fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html * page/FrameView.cpp: (WebCore::FrameView::computeUpdatedLayoutViewportRect): * page/FrameView.h: 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r211379. rdar://problem/32057099 2017-01-30 Simon Fraser <simon.fraser@apple.com> Fixed elements should not rubber-band in WK2, nor remain at negative offsets https://bugs.webkit.org/show_bug.cgi?id=167484 rdar://problem/29453068 Reviewed by Dean Jackson. There were various problems with the layout rect computation: 1. It ignored the scrollBehaviorForFixedElements() which we use to avoid rubber-banding fixed elements in WK2, but allow in WK1, so make use of that. 2. Sometimes layouts/paints of fixed elements would be triggered when coalesced calls to AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll() failed to copy the layoutViewportOrigin to the scheduled update. 3. The layout viewport could be left with a negative top/left after rubber-banding. Also add a way to do unconstrained scrollTo(), so that a test can call window.scrollTo(-10, -10) to simulate rubberbanding. Tests: fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html fast/visual-viewport/rubberbanding-viewport-rects.html * page/FrameView.cpp: (WebCore::FrameView::computeLayoutViewportOrigin): Handle ScrollBehaviorForFixedElements, incorporating it into logic that clamps layoutViewportOrigin between min/max when rubberbanding is not allowed, or not in progress. (WebCore::FrameView::updateLayoutViewport): Pass in scrollBehaviorForFixedElements(). (WebCore::FrameView::visibleDocumentRect): The clamping here was preventing the visible rect from escaping the document bounds, which caused fixed elements to bounce with rubber-banding, so remove the clamping, and fix the logic to allow rubber-banding while taking headers and footers into account. * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): layoutViewportOrigin has to be pushed onto the scheduled update, just like scroll position. * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): Pass in m_behaviorForFixed. * platform/ScrollView.cpp: (WebCore::ScrollView::ScrollView): (WebCore::ScrollView::adjustScrollPositionWithinRange): (WebCore::ScrollView::setScrollOffset): * platform/ScrollView.h: (WebCore::ScrollView::setAllowsUnclampedScrollPositionForTesting): (WebCore::ScrollView::allowsUnclampedScrollPosition): * testing/InternalSettings.cpp: (WebCore::InternalSettings::setAllowUnclampedScrollPosition): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2017-05-10 Jason Marcell <jmarcell@apple.com> Cherry-pick r215102. rdar://problem/32057110 2017-04-07 Alex Christensen <achristensen@webkit.org> REGRESSION(r204512): WebSocket errors with "Failed to send WebSocket frame." if too much data is sent https://bugs.webkit.org/show_bug.cgi?id=170463 Reviewed by Michael Catanzaro. This only reproduces when using WebSockets to communicate with an external server. When communicating with a local server, CFWriteStreamWrite succeeds too reliably, so CFWriteStreamCanAcceptBytes returns true, when sometimes it doesn't when communicating across the real internet. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): Returning std::nullopt means there was an error, which is not true when the socket stream is in a state where it cannot be written to because it is actively communicating. Returning 0 means 0 new bytes were sent, so we will try again later. 2017-05-10 Matthew Hanson <matthew_hanson@apple.com> Remove inadvertant change to ScrollView.h that was included in r216589. Unreviewed build fix. * platform/ScrollView.h: (WebCore::ScrollView::children): 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r216131. rdar://problem/31967895 2017-05-03 Zalan Bujtas <zalan@apple.com> RenderSearchField should not use isTextField() in SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT https://bugs.webkit.org/show_bug.cgi?id=171608 Reviewed by Simon Fraser. isTextField() is true for any generic single line text control. * rendering/RenderObject.h: (WebCore::RenderObject::isSearchField): * rendering/RenderSearchField.h: 2017-05-09 Jason Marcell <jmarcell@apple.com> Cherry-pick r216443. rdar://problem/31971375 2017-05-04 Jiewen Tan <jiewen_tan@apple.com> Search events should not fire synchronously for search type input elements with incremental attribute set https://bugs.webkit.org/show_bug.cgi?id=171376 <rdar://problem/31863296> Reviewed by Chris Dumez. For some reasons, we fire search events immediately for search type input elements with incremental attribute set only when the length of the input equals to zero. This behaviour should be prevented as event listeners in the middle might perform unexpectedly. Test: fast/forms/search/search-incremental-crash.html * html/SearchInputType.cpp: (WebCore::SearchInputType::startSearchEventTimer): 2017-05-09 Jason Marcell <jmarcell@apple.com> Cherry-pick r216159. rdar://problem/31971329 2017-05-03 Zalan Bujtas <zalan@apple.com> SearchInputType could end up with a mismatched renderer. https://bugs.webkit.org/show_bug.cgi?id=171547 <rdar://problem/31935047> Reviewed by Antti Koivisto. Normally we've got the correct renderer by the time we call into SearchInputType. However, since HTMLInputElement::updateType() eagerly updates the type while the associated renderers are done lazily (so we don't get them updated until after the next tree update), we could actually end up with a mismatched renderer (e.g. through form submission). Test: fast/forms/change-input-type-and-submit-form-crash.html * html/SearchInputType.cpp: (WebCore::SearchInputType::addSearchResult): (WebCore::SearchInputType::didSetValueByUserEdit): 2017-05-09 Jason Marcell <jmarcell@apple.com> Cherry-pick r214375. rdar://problem/32057082 2017-03-24 Brady Eidson <beidson@apple.com> A null compound index value crashes the Databases process. <rdar://problem/30499831> and https://bugs.webkit.org/show_bug.cgi?id=170000 Reviewed by Alex Christensen. Test: storage/indexeddb/modern/single-entry-index-invalid-key-crash.html * bindings/js/IDBBindingUtilities.cpp: (WebCore::createKeyPathArray): Fix the bug by rejecting arrays with any invalid keys in them. Add some logging: * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::loggingString): * Modules/indexeddb/IDBKeyPath.h: * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): * Modules/indexeddb/shared/IDBIndexInfo.cpp: (WebCore::IDBIndexInfo::loggingString): 2017-05-09 Jason Marcell <jmarcell@apple.com> Cherry-pick r213727. rdar://problem/32086123 2017-03-10 Per Arne Vollan <pvollan@apple.com> [Win] Scrollbars buttons have incorrect size in HiDPI. https://bugs.webkit.org/show_bug.cgi?id=169463 Reviewed by Alex Christensen. There seems to be a bug in DrawThemeBackground when the device context is scaled. We can work around this by scaling the drawing rectangle instead. * platform/win/ScrollbarThemeWin.cpp: (WebCore::ScrollbarThemeWin::paintButton): 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r216431. rdar://problem/31971208 2017-05-08 Antti Koivisto <antti@apple.com> ComposedTreeIterator does not traverse all slotted children if the traversal root is a slot element. https://bugs.webkit.org/show_bug.cgi?id=171375 <rdar://problem/31863184> Reviewed by Zalan Bujtas. We were hitting an assert when using details element with a flow thread. The root cause for this turned out to be that we only traversed the first slotted child if the traversal root was a slot element. Test: fast/html/details-flow-thread.html * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::traverseNextLeavingContext): Try to traverse to the next slotted child before testing if we at the end of the current context. 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r216120. rdar://problem/31970955 2017-05-03 Daniel Bates <dabates@apple.com> Abandon the current load once the provisional loader detaches from the frame https://bugs.webkit.org/show_bug.cgi?id=171577 <rdar://problem/31581227> Reviewed by Brent Fulgham and Brady Eidson. We detach all child frames as part of setting our document loader to the provisional document loader when committing a load for a frame. Detaching child frames invokes the unload event handler on the child frames that can run arbitrary JavaScript script. Among other things, such script can initiate a new load in the frame whose current load is being committed. We should stop processing the current load as soon as we detect that updating our document loader has started a new provisional load. Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::transitionToCommitted): 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r216096. rdar://problem/31971264 2017-05-02 Zalan Bujtas <zalan@apple.com> Defer AX cache update when text content changes until after layout is finished. https://bugs.webkit.org/show_bug.cgi?id=171429 <rdar://problem/31885984> Reviewed by Simon Fraser. When the content of the RenderText changes (even as the result of a text-transform change) instead of updating the AX cache eagerly (and trigger layout on a half-backed render tree) we should just defer it until after the subsequent layout is done. Test: accessibility/crash-while-adding-text-child-with-transform.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::recomputeDeferredIsIgnored): (WebCore::AXObjectCache::deferTextChanged): (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted. * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::deferTextChanged): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted. * page/FrameView.cpp: (WebCore::FrameView::performPostLayoutTasks): * rendering/RenderText.cpp: (WebCore::RenderText::setText): 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r216023. rdar://problem/31971371 2017-05-01 Chris Dumez <cdumez@apple.com> Do not dispatch SVG load event in frameless documents https://bugs.webkit.org/show_bug.cgi?id=171505 <rdar://problem/31799776> Reviewed by Andreas Kling. We should not dispatch SVG load events in frameless documents. <https://trac.webkit.org/changeset/173028/webkit> took care of most load events but forgot the SVG load event. Test: fast/dom/domparser-parsefromstring-svg-load-event.html * dom/Document.cpp: (WebCore::Document::implicitClose): 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r215971. rdar://problem/31971140 2017-04-28 Per Arne Vollan <pvollan@apple.com> Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged(). https://bugs.webkit.org/show_bug.cgi?id=171427 rdar://problem/31863417 Reviewed by Brent Fulgham. The AccessibilityRenderObject object might delete itself in handleAriaExpandedChanged() under the call to the parentObject() method. This will cause a crash when accessing the object later in this method. Protect the current object while executing arbitrary event code. Test: accessibility/accessibility-crash-setattribute.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged): 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r215528. rdar://problem/31971331 2017-04-19 Joseph Pecoraro <pecoraro@apple.com> ASAN Crash running LayoutTests/inspector/worker tests https://bugs.webkit.org/show_bug.cgi?id=170967 <rdar://problem/31256437> Reviewed by Alex Christensen. * workers/WorkerMessagingProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): Make the MessagingProxy thread safe ref counted. Since it used to delete itself, turn this into a ref (implicit on construction) and deref (replacing delete this). (WebCore::WorkerMessagingProxy::postMessageToPageInspector): When dispatching have the lambda implicitly ref/deref with the lambda to keep the proxy alive while a lambda is queued. 2017-05-09 Matthew Hanson <matthew_hanson@apple.com> Cherry-pick r214554. rdar://problem/31971164 2017-03-29 Jeremy Jones <jeremyj@apple.com> WebVideoFullscreenInterfaceAVKit needs a strong self ref before dispatching to the main thread. https://bugs.webkit.org/show_bug.cgi?id=170129 Reviewed by David Kilzer. No new tests becuase no new behavior. Hold a strong reference to WebVideoFullscreenInterfaceAVKit when dispatching to the main thread. Make WebVideoFullscreenInterfaceAVKit safe to retain from non-main thread. * platform/ios/WebVideoFullscreenInterfaceAVKit.h: * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: (WebVideoFullscreenInterfaceAVKit::exitFullscreen): 2017-04-16 Jason Marcell <jmarcell@apple.com> Roll out r211294 vi 215335. rdar://problem/31512298 2017-04-12 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Prepare ComplexTextController for unit testing https://bugs.webkit.org/show_bug.cgi?id=167493 Reviewed by Dean Jackson. ComplexTextController has three phases: 1. Interrogate Core Text about some text 2. Compute layout advances and paint advances from the information retrieved from Core Text 3. Iterate through the layout advances or paint advances. This patch tests phases 2 and 3 by chopping ComplexTextController between phases 1 and 2, and injecting foreign metrics from a unit test. These metrics have been gathered from real-world uses; however, a layout test is not appropriate because the fonts which produced these metrics are not licensed appropriately. The tests can enforce the correct behavior by using ComplexTextController's public API. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=166013. However, the fix for that bug is quite large, so I've split out this smaller piece to ease the reviewing burden. The tests I've added are disabled for now (because they fail), but will be enabled by the fix to that bug. No new tests because there is no behavior change. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/FontCascade.h: * platform/graphics/FontDescription.h: * platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::ComplexTextController): (WebCore::ComplexTextController::finishConstruction): * platform/graphics/mac/ComplexTextController.h: (WebCore::ComplexTextController::ComplexTextRun::createForTesting): * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): 2017-04-12 Myles C. Maxfield <mmaxfield@apple.com> REGRESSION(r211382): Complex text with justification erroneously overflows containers https://bugs.webkit.org/show_bug.cgi?id=170399 <rdar://problem/31442008> When we perform justification, we adjust glyphs' advances to add extra space between words. ComplexTextController maintains an invariant where m_totalWidth is equal to the sum of these advances. However, in RTL text, inserting extra justification space to the left of a glyph would break that invariant, and would increase the advances of two glyphs instead of just one. Then, when we go to draw the text, the sum of the advances is wider than m_totalWidth, which means the glyphs would be drawn outside of their container. This regressed in r211382 simply because of an oversight and because there were no tests for this codepath. Test: ComplexTextControllerTest.TotalWidthWithJustification * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): * rendering/InlineBox.h: (WebCore::InlineBox::InlineBox): 2017-04-11 Jason Marcell <jmarcell@apple.com> Cherry-pick 214358. rdar://problem/31502340 2017-03-24 Alex Christensen <achristensen@webkit.org> REGRESSION: Content Blocker: Blocking "a[href*=randomString]" doesn't work https://bugs.webkit.org/show_bug.cgi?id=169167 Reviewed by Simon Fraser. When testing content extensions, we have always called an API function that internally has called AtomicString::init somewhere before we start compiling the content extension. On iOS, though, we call [_WKUserContentExtensionStore compileContentExtensionForIdentifier:...] without having already called anything that calls AtomicString::init. The new CSS parser is now failing to parse some selectors because CSSSelectorParser::defaultNamespace is returning starAtom, which is a null atomic string before AtomicString::init is called. Covered by a new API test. * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): (WebCore::ContentExtensions::loadAction): (WebCore::ContentExtensions::isValidSelector): Deleted. * contentextensions/ContentExtensionParser.h: Call AtomicString::init before checking if a css selector is valid. 2017-04-03 Jason Marcell <jmarcell@apple.com> Cherry-pick r214819. rdar://problem/31407633 2017-04-01 Simon Fraser <simon.fraser@apple.com> Clean up touch event handler registration when moving nodes between documents https://bugs.webkit.org/show_bug.cgi?id=170384 rdar://problem/30816694 Reviewed by Chris Dumez. Make sure that Node::didMoveToNewDocument() does the correct unregistration on the old document, and registration on the new document for nodes with touch event listeners, and gesture event listeners. Touch "handler" nodes (those for overflow and sliders) are already correctly moved via renderer-related teardown. Add assertions that fire when removal was not complete. Use references in more places. Tests: fast/events/touch/ios/gesture-node-move-between-documents.html fast/events/touch/ios/overflow-node-move-between-documents.html fast/events/touch/ios/slider-node-move-between-documents.html fast/events/touch/ios/touch-node-move-between-documents.html * dom/EventNames.h: (WebCore::EventNames::gestureEventNames): * dom/Node.cpp: (WebCore::Node::willBeDeletedFrom): (WebCore::Node::didMoveToNewDocument): (WebCore::tryAddEventListener): (WebCore::tryRemoveEventListener): * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::registerForTouchEvents): (WebCore::SliderThumbElement::unregisterForTouchEvents): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::registerAsTouchEventListenerForScrolling): (WebCore::RenderLayer::unregisterAsTouchEventListenerForScrolling): 2017-04-03 Jason Marcell <jmarcell@apple.com> Cherry-pick r214703. rdar://problem/31407633 2017-03-31 Simon Fraser <simon.fraser@apple.com> Rename DOMWindow's m_touchEventListenerCount to m_touchAndGestureEventListenerCount https://bugs.webkit.org/show_bug.cgi?id=170371 Reviewed by Tim Horton. This count tracks touch and gesture event listeners, so name it appropriately. * page/DOMWindow.cpp: (WebCore::DOMWindow::addEventListener): (WebCore::DOMWindow::removeEventListener): (WebCore::DOMWindow::removeAllEventListeners): * page/DOMWindow.h: 2017-04-03 Jason Marcell <jmarcell@apple.com> Cherry-pick r214702. rdar://problem/31407633 2017-03-31 Simon Fraser <simon.fraser@apple.com> When destroying a Node, assert that it's been removed from all the touch handler maps https://bugs.webkit.org/show_bug.cgi?id=170363 rdar://problem/31377469 Reviewed by Tim Horton. Assert that the Node has been removed from the touch handler maps in all documents on destruction. * dom/Document.h: (WebCore::Document::hasTouchEventHandlers): (WebCore::Document::touchEventTargetsContain): * dom/Node.cpp: (WebCore::Node::~Node): 2017-04-03 Jason Marcell <jmarcell@apple.com> Cherry-pick r214649. rdar://problem/31407626 2017-03-30 Simon Fraser <simon.fraser@apple.com> Ensure that Node::willBeDeletedFrom() always removes touch event handlers from the document https://bugs.webkit.org/show_bug.cgi?id=170323 rdar://problem/23647630 Reviewed by Chris Dumez. There are two instances where nodes are registered as touch event handlers without having normal touch event listeners: slider thumb elements, and elements with overflow scrolling, on iOS. For such nodes, hasEventTargetData() will be false, but we want to ensure that they are removed from the Document's touchEventHandler set, so move the call to document.removeTouchEventHandler() outside of the conditional block. This should be cheap in most cases when the touchEventHandler is empty. * dom/Node.cpp: (WebCore::Node::willBeDeletedFrom): 2017-04-03 Jason Marcell <jmarcell@apple.com> Cherry-pick r214648. rdar://problem/31408453 2017-03-30 Simon Fraser <simon.fraser@apple.com> Minor cleanup checking for gesture event names https://bugs.webkit.org/show_bug.cgi?id=170319 Reviewed by Tim Horton. Just use isGestureEventType() in a couple of places. * dom/Node.cpp: (WebCore::tryAddEventListener): (WebCore::tryRemoveEventListener): 2017-04-03 Jason Marcell <jmarcell@apple.com> Cherry-pick r214640. rdar://problem/31408453 2017-03-30 Simon Fraser <simon.fraser@apple.com> Rename a touch event function, and new touch region test results https://bugs.webkit.org/show_bug.cgi?id=170309 rdar://problem/31329520 Reviewed by Chris Dumez. Adapt to a naming change in WebKitAdditions. * dom/Document.cpp: (WebCore::Document::removeAllEventListeners): * page/FrameView.cpp: (WebCore::FrameView::layout): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): (WebCore::RenderLayer::calculateClipRects): 2017-03-31 Brent Fulgham <bfulgham@apple.com> Merge r214378. rdar://problem/31177657 2017-03-24 Brent Fulgham <bfulgham@apple.com> Handle recursive calls to ProcessingInstruction::checkStyleSheet https://bugs.webkit.org/show_bug.cgi?id=169982 <rdar://problem/31083051> Reviewed by Antti Koivisto. See if we triggered a recursive load of the stylesheet during the 'beforeload' event handler. If so, reset to a valid state before completing the load. We should also check after 'beforeload' that we were not disconnected from (or moved to a new) document. I also looked for other cases of this pattern and fixed them, too. Tests: fast/dom/beforeload/image-removed-during-before-load.html fast/dom/beforeload/recursive-css-pi-before-load.html fast/dom/beforeload/recursive-link-before-load.html fast/dom/beforeload/recursive-xsl-pi-before-load.html * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): Prevent recursive calls into this function during 'beforeload' handling. Also, safely handle the case where the element was disconnected in the 'beforeload' handler (similar to what we do in HTMLLinkElement). (WebCore::ProcessingInstruction::setCSSStyleSheet): Drive-by Fix: Protect the current document to match what we do in setXSLStyleSheet. * dom/ProcessingInstruction.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): Prevent recursive calls into this function during 'beforeload' handling. * html/HTMLLinkElement.h: * loader/ImageLoader.cpp: (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): safely handle the case where the element was disconnected in the 'beforeload' handler (similar to what we do in HTMLLinkElement). 2017-03-30 Jason Marcell <jmarcell@apple.com> Merge r214392. rdar://problem/31356105 2017-03-24 Daniel Bates <dabates@apple.com> media/restore-from-page-cache.html causes NoEventDispatchAssertion::isEventAllowedInMainThread() assertion failure https://bugs.webkit.org/show_bug.cgi?id=170087 <rdar://problem/31254822> Reviewed by Simon Fraser. Reduce the scope of code that should never dispatch DOM events so as to allow updating contents size after restoring a page from the page cache. In r214014 we instantiate a NoEventDispatchAssertion in FrameLoader::commitProvisionalLoad() around the call to CachedPage::restore() to assert when a DOM event is dispatched during page restoration as such events can cause re-entrancy into the page cache. As it turns out it is sufficient to ensure that no DOM events are dispatched after restoring all cached frames as opposed to after CachedPage::restore() returns. Also rename Document::enqueue{Pageshow, Popstate}Event() to dispatch{Pageshow, Popstate}Event(), respectively, since they synchronously dispatch events :(. We hope in the future to make them asynchronously dispatch events. * dom/Document.cpp: (WebCore::Document::implicitClose): Update for renaming. (WebCore::Document::statePopped): Ditto. (WebCore::Document::dispatchPageshowEvent): Renamed; formerly named enqueuePageshowEvent(). (WebCore::Document::dispatchPopstateEvent): Renamed; formerly named enqueuePopstateEvent(). (WebCore::Document::enqueuePageshowEvent): Deleted. (WebCore::Document::enqueuePopstateEvent): Deleted. * dom/Document.h: * history/CachedPage.cpp: (WebCore::firePageShowAndPopStateEvents): Moved logic from FrameLoader::didRestoreFromCachedPage() to here. (WebCore::CachedPage::restore): Modified to call firePageShowAndPopStateEvents(). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Removed use of NoEventDispatchAssertion RAII object. We will instantiate it in CachedPage::restore() with a smaller scope. (WebCore::FrameLoader::didRestoreFromCachedPage): Deleted; moved logic from here to WebCore::firePageShowAndPopStateEvents(). * loader/FrameLoader.h: 2017-03-30 Jason Marcell <jmarcell@apple.com> Merge r214599. rdar://problem/31356103 2017-03-29 Ryosuke Niwa <rniwa@webkit.org> Disconnecting a HTMLObjectElement does not always unload its content document https://bugs.webkit.org/show_bug.cgi?id=169606 Reviewed by Andy Estes. When removing a node, we first disconnect all subframes then update the focused element as we remove each child. However, when the removed element is a focused object element with a content document, removeFocusedNodeOfSubtree can update the style tree synchronously inside Document::setFocusedElement, and reload the document. Avoid this by instantiating a SubframeLoadingDisabler on the parent of the focused element. Test: fast/dom/removing-focused-object-element.html * dom/Document.cpp: (WebCore::Document::removeFocusedNodeOfSubtree): 2017-03-30 Jason Marcell <jmarcell@apple.com> Merge r214510. rdar://problem/31356107 2017-03-27 Brent Fulgham <bfulgham@apple.com> Only attach Attributes to a given element one time https://bugs.webkit.org/show_bug.cgi?id=170125 <rdar://problem/31279676> Reviewed by Chris Dumez. Attach the attribute node to the Element before calling 'setAttributeInternal', since that method may cause arbitrary JavaScript events to fire. Test: fast/dom/Attr/only-attach-attr-once.html * dom/Element.cpp: (WebCore::Element::attachAttributeNodeIfNeeded): Added. (WebCore::Element::setAttributeNode): Use new method. Revise to attach attribute before calling 'setAttributeInternal'. (WebCore::Element::setAttributeNodeNS): Ditto. * dom/Element.h: 2017-03-30 Jason Marcell <jmarcell@apple.com> Merge r214086. rdar://problem/31356102 2017-03-16 Dean Jackson <dino@apple.com> WebGL: Improve index validation when using uint index values https://bugs.webkit.org/show_bug.cgi?id=169798 Reviewed by Simon Fraser. Make sure that we test index validation with the correct type. Also stop using -1 in WebGLBuffer to indicate non-existant values. Test: fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Use optional<> and unsigned values. * html/canvas/WebGLBuffer.cpp: Use unsigned for maxIndex (they can't be negative) and optional<> to indicate unknown value. (WebCore::WebGLBuffer::getCachedMaxIndex): (WebCore::WebGLBuffer::setCachedMaxIndex): * html/canvas/WebGLBuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Use optional<> and unsigned values. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateVertexAttributes): No need to check if an unsigned value is less than zero. 2017-03-29 Jason Marcell <jmarcell@apple.com> Merge r214291. rdar://problem/30922110 2017-03-22 Jiewen Tan <jiewen_tan@apple.com> ASSERT_WITH_SECURITY_IMPLICATION hit when removing an <input type="range"> while dragging on iOS https://bugs.webkit.org/show_bug.cgi?id=165535 <rdar://problem/29559749> Reviewed by Ryosuke Niwa. Utimately we should prevent SliderThumbElement::unregisterForTouchEvents() being called while updating render tree. A quick fix for this is to move dispatchFormControlChangeEvent for input from stopDragging up to the callers which really needs to dispatch this event, i.e., finishing dragging the slider. It is clear that not every caller of stopDragging wants to dispatchFormControlChangeEvent. Test: fast/forms/range/range-remove-on-drag.html * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::stopDragging): (WebCore::SliderThumbElement::defaultEventHandler): (WebCore::SliderThumbElement::handleTouchEndAndCancel): 2017-03-28 Jason Marcell <jmarcell@apple.com> Merge r214365. rdar://problem/30922115 2017-03-24 Daniel Bates <dabates@apple.com> Prevent new navigations during document unload https://bugs.webkit.org/show_bug.cgi?id=169934 <rdar://problem/31247584> Reviewed by Chris Dumez. Similar to our policy of preventing new navigations from onbeforeunload handlers we should prevent new navigations that are initiated during the document unload process. The significant part of this change is the instantiation of the RAII object NavigationDisabler in Document::prepareForDestruction(). The rest of this change just renames class NavigationDisablerForBeforeUnload to NavigationDisabler now that this RAII class is used to prevent navigation from both onbeforeunload event handlers and when unloading a document. Test: fast/frames/frame-unload-navigate-and-setTimeout-assert-fail.html * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Disable new navigations when disconnecting subframes. Also assert that the document is not in the page cache before we fall off the end of the function. * loader/FrameLoader.cpp: (WebCore::FrameLoader::isNavigationAllowed): Update for renaming below. (WebCore::FrameLoader::shouldClose): Ditto. * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::shouldScheduleNavigation): Ditto. * loader/NavigationScheduler.h: (WebCore::NavigationDisabler::NavigationDisabler): Renamed class; formerly named NavigationDisablerForBeforeUnload. (WebCore::NavigationDisabler::~NavigationDisabler): Ditto. (WebCore::NavigationDisabler::isNavigationAllowed): Ditto. (WebCore::NavigationDisablerForBeforeUnload::NavigationDisablerForBeforeUnload): Deleted. (WebCore::NavigationDisablerForBeforeUnload::~NavigationDisablerForBeforeUnload): Deleted. (WebCore::NavigationDisablerForBeforeUnload::isNavigationAllowed): Deleted. 2017-03-28 Jason Marcell <jmarcell@apple.com> Merge r214194. rdar://problem/31101594 2017-03-20 Daniel Bates <dabates@apple.com> Prevent new navigations from onbeforeunload handler https://bugs.webkit.org/show_bug.cgi?id=169891 <rdar://problem/31155736> Reviewed by Ryosuke Niwa. Ensure that all navigations initiated from an onbeforeunload handler are disallowed regardless of how they were scheduled. Such navigations go against the expectation of a user. * loader/FrameLoader.cpp: (WebCore::FrameLoader::isNavigationAllowed): Added. (WebCore::FrameLoader::loadURL): Modified code to call FrameLoader::isNavigationAllowed(). (WebCore::FrameLoader::loadWithDocumentLoader): Ditto. (WebCore::FrameLoader::stopAllLoaders): Ditto. * loader/FrameLoader.h: 2017-03-28 Jason Marcell <jmarcell@apple.com> Merge r214237. rdar://problem/31178134 2017-03-21 Brady Eidson <beidson@apple.com> Disable all virtual tables. <rdar://problem/31081972> and https://bugs.webkit.org/show_bug.cgi?id=169928 Reviewed by Jer Noble. No new tests (Covered by changes to existing test). * Modules/webdatabase/DatabaseAuthorizer.cpp: (WebCore::DatabaseAuthorizer::createVTable): (WebCore::DatabaseAuthorizer::dropVTable): 2017-03-28 Jason Marcell <jmarcell@apple.com> Merge r214232. rdar://problem/30922105 2017-03-21 Zalan Bujtas <zalan@apple.com> Tear down descendant renderers when <slot>'s display value is set to no "contents". https://bugs.webkit.org/show_bug.cgi?id=169921 <rdar://problem/30336417> Reviewed by Antti Koivisto. Since "display: contents" does not generate a renderer, when an element's display value is changed to something other than "contents", we not only create a renderer but also reparent its descendant subtree (e.g from slot's parent to the newly constructed slot renderer). During this reparenting, we need to tear down the descendant subtree tree and build it up again to reflect the new rendering context. Test: fast/shadow-dom/slot-with-continuation-descendants.html * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): 2017-03-28 Jason Marcell <jmarcell@apple.com> Merge r211645. rdar://problem/30922105 2017-02-03 Chris Dumez <cdumez@apple.com> Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody() https://bugs.webkit.org/show_bug.cgi?id=167799 <rdar://problem/30237241> Reviewed by Brent Fulgham. Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody() that was expecting the root element to be an <html> element when parsing a <frameset>. While this assertion is true in theory and as per the specification, it does not hold in WebKit when parsing a DocumentFragment. This is because WebKit has an optimization causing us to have a DocumentFragment as root element when parsing a fragment. See the following constructor: "HTMLTreeBuilder(HTMLDocumentParser&, DocumentFragment&, Element&, ParserContentPolicy, const HTMLParserOptions&)" which has the following code: """ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-html-fragments // For efficiency, we skip step 5 ("Let root be a new html element with no attributes") and instead use the DocumentFragment as a root node. m_tree.openElements().pushRootNode(HTMLStackItem::create(fragment)); """ Update the assertion to expect a DocumentFragment as root element when parsing a fragment, and keep expecting an <html> element otherwise. Test: fast/parser/fragment-with-frameset-crash.html * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processStartTagForInBody): 2017-03-22 Jason Marcell <jmarcell@apple.com> Merge r214125. rdar://problem/30921831 2017-03-17 Said Abou-Hallawa <sabouhallawa@apple.com> Time channel attack on SVG Filters https://bugs.webkit.org/show_bug.cgi?id=118689 Reviewed by Simon Fraser. The time channel attack can happen if the attacker applies FEColorMatrix or FEConvolveMatrix and provides a matrix which is filled with subnormal floating point values. Performing floating-point operations on subnormals is very expensive unless the pixel in the source graphics is black (or zero). By measuring the time a filter takes to be applied, the attacker can know whether the pixel he wants to steal from an iframe is black or white. By repeating the same process on all the pixels in the iframe, the attacker can reconstruct the whole page of the iframe. To fix this issue, the values in the matrices of these filters will clamped to FLT_MIN. We do not want to consume too much time calculating filtered pixels because of such tiny values. The difference between applying FLT_MIN and applying a subnormal should not be even noticeable. Normalizing the floating-point matrices should happen only at the beginning of the filter platformApplySoftware(). * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::platformApplySoftware): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::fastSetInteriorPixels): (WebCore::FEConvolveMatrix::fastSetOuterPixels): (WebCore::FEConvolveMatrix::platformApplySoftware): * platform/graphics/filters/FEConvolveMatrix.h: * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::normalizedFloats): 2017-03-21 Jason Marcell <jmarcell@apple.com> Merge r214014. rdar://problem/30921815 2017-03-15 Daniel Bates <dabates@apple.com> Iteratively dispatch DOM events after restoring a cached page https://bugs.webkit.org/show_bug.cgi?id=169703 <rdar://problem/31075903> Reviewed by Brady Eidson. Make dispatching of DOM events when restoring a page from the page cache symmetric with dispatching of events when saving a page to the page cache. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): Move code to dispatch events from here to FrameLoader::didRestoreFromCachedPage(). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Ensure that no DOM events are dispatched during restoration of a cached page. Call didRestoreFromCachedPage() after restoring the page to dispatch DOM events on the restored frames. (WebCore::FrameLoader::willRestoreFromCachedPage): Renamed; formerly named prepareForCachedPageRestore(). (WebCore::FrameLoader::didRestoreFromCachedPage): Added. (WebCore::FrameLoader::prepareForCachedPageRestore): Renamed to willRestoreFromCachedPage(). * loader/FrameLoader.h: * page/FrameTree.cpp: (WebCore::FrameTree::traverseNextInPostOrderWithWrap): Returns the next Frame* in a post-order traversal of the frame tree optionally wrapping around to the deepest first child in the tree. (WebCore::FrameTree::deepFirstChild): Added. * page/FrameTree.h: 2017-03-20 Matthew Hanson <matthew_hanson@apple.com> Merge r213949. rdar://problem/31049771 2017-03-14 Andy Estes <aestes@apple.com> REGRESSION (r209760): Apple Pay doesn't work on sites that specify empty contact fields https://bugs.webkit.org/show_bug.cgi?id=169639 <rdar://problem/30957789> Reviewed by Anders Carlsson. Shipping and billing contact fields are allowed to be empty. * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): 2017-03-20 Matthew Hanson <matthew_hanson@apple.com> Merge r213253. rdar://problem/30773140 2017-03-01 Chris Dumez <cdumez@apple.com> [WK2][!NETWORK_SESSION] Failure to download when using a download attribute with no value on an anchor https://bugs.webkit.org/show_bug.cgi?id=169060 <rdar://problem/30773140> Reviewed by Darin Adler. Make sure we never set the suggested filename to the empty string when the download attribute is present but has no value. Test: http/tests/download/anchor-download-no-value.html * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r214059. rdar://problem/31099341 2017-03-16 Zalan Bujtas <zalan@apple.com> Stay inside the continuation while searching for a candidate ancestor for insertion. https://bugs.webkit.org/show_bug.cgi?id=169768 <rdar://problem/30959936> Reviewed by David Hyatt. Test: fast/inline/continuation-crash-with-anon-ancestors.html * rendering/RenderInline.cpp: (WebCore::RenderInline::addChildToContinuation): 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r214023. rdar://problem/31091039 2017-03-15 Zalan Bujtas <zalan@apple.com> Do not reparent floating object until after intruding/overhanging dependency is cleared. https://bugs.webkit.org/show_bug.cgi?id=169711 <rdar://problem/30959743> Reviewed by Simon Fraser. This patch ensures that we cleanup the m_floatingObjects for siblings before reparenting the fresh float. Test: fast/block/float/inline-becomes-float-and-moves-around.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleDidChange): * rendering/RenderElement.h: (WebCore::RenderElement::noLongerAffectsParentBlock): 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r213967. rdar://problem/30921827 2017-03-14 Wenson Hsieh <wenson_hsieh@apple.com> RenderElements should unregister for viewport visibility callbacks when they are destroyed https://bugs.webkit.org/show_bug.cgi?id=169521 <rdar://problem/30959545> Reviewed by Simon Fraser. When registering a RenderElement for viewport visibility callbacks, we always need to make sure that it is unregistered before it is destroyed. While we account for this in the destructor of RenderElement, we only unregister in the destructor if we are already registered for visibility callbacks. In the call to RenderObject::willBeDestroyed(), we clear out rare data, which holds RenderElement's viewport callback registration state, so upon entering the destructor of RenderElement, we skip unregistration because RenderElement thinks that it is not registered. We can mitigate this by unregistering the RenderElement earlier, in RenderElement::willBeDestroyed, prior to clearing out the rare data. However, we'd ideally want to move the cleanup logic out of the destructor altogether and into willBeDestroyed (see https://bugs.webkit.org/show_bug.cgi?id=169650). Test: fast/media/video-element-in-details-collapse.html * rendering/RenderElement.cpp: (WebCore::RenderElement::willBeDestroyed): 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r213897. rdar://problem/30921833 2017-03-13 Wenson Hsieh <wenson_hsieh@apple.com> Make RepaintRegionAccumulator hold a WeakPtr to its root RenderView https://bugs.webkit.org/show_bug.cgi?id=168480 <rdar://problem/30566976> Reviewed by Antti Koivisto. Implements two mitigations to prevent the symptoms of the bug from occurring (see the bugzilla for more details). Test: editing/execCommand/show-modal-dialog-during-execCommand.html * editing/EditorCommand.cpp: (WebCore::Editor::Command::execute): Do not allow edit commands to execute if the frame's document before and after layout differ (that is, edit commands triggered by a certain document should not run on a different document). * rendering/RenderView.cpp: (WebCore::RenderView::RenderView): (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator): Turns RepaintRegionAccumulator's reference to its root RenderView into a WeakPtr to gracefully handle the case where its RenderView is destroyed before RepaintRegionAccumulator's destructor gets a chance to flush the RenderView's repaint regions. * rendering/RenderView.h: 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r213833. rdar://problem/31092879 2017-03-13 Miguel Gomez <magomez@igalia.com> ImageDecoder can be deleted while the async decoder thread is still using it https://bugs.webkit.org/show_bug.cgi?id=169199 Reviewed by Carlos Garcia Campos. Make the image decoder used by ImageSource and ImageFrameCache into a RefPtr instead of and unique_ptr, and pass a reference to the decoder thread. This ensures that the decoder will stay alive as long as the decoding thread is processing frames. Also, stop the async decoding queue if a new decoder is set to ImageFrameCache. No new tests. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::setDecoder): (WebCore::ImageFrameCache::decoder): (WebCore::ImageFrameCache::startAsyncDecodingQueue): (WebCore::ImageFrameCache::metadata): * platform/graphics/ImageFrameCache.h: (WebCore::ImageFrameCache::setDecoder): Deleted. Moved to source file so we can keep the ImageDecoder forward declaration. (WebCore::ImageFrameCache::decoder): Deleted. Moved to source file so we can keep the ImageDecoder forward declaration. * platform/graphics/ImageSource.h: * platform/graphics/cg/ImageDecoderCG.h: (WebCore::ImageDecoder::create): * platform/graphics/win/ImageDecoderDirect2D.h: (WebCore::ImageDecoder::create): * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::create): * platform/image-decoders/ImageDecoder.h: 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r213501. rdar://problem/30921830 2017-03-06 Brent Fulgham <bfulgham@apple.com> Validate DOM after potentially destructive actions during parser insert operations https://bugs.webkit.org/show_bug.cgi?id=169222 <rdar://problem/30689729> Reviewed by Ryosuke Niwa. Do not perform an insert operation if the next child's parent is no longer part of the tree. This can happen if JavaScript runs during node removal events and modifies the contents of the document. This patch was inspired by a similar Blink change by Marius Mlynski: <https://src.chromium.org/viewvc/blink?view=revision&revision=200690> Tests: fast/parser/scriptexec-during-parserInsertBefore.html * html/parser/HTMLConstructionSite.cpp: (WebCore::executeReparentTask): (WebCore::executeInsertAlreadyParsedChildTask): 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r213385. rdar://problem/30921816 2017-03-03 Sam Weinig <sam@webkit.org> REGRESSION (r209760): Apple Pay doesn't work on casper.com, shopspring.com, maybe other sites <rdar://problem/30313445> https://bugs.webkit.org/show_bug.cgi?id=169149 Reviewed by Simon Fraser. Relax restriction that the ApplePayShippingMethod sequence must not be empty. This was incorrect. * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): 2017-03-16 Jason Marcell <jmarcell@apple.com> Merge r213311. rdar://problem/30812769 2017-03-02 Chris Dumez <cdumez@apple.com> We should prevent load of subframes inserted during FrameTree deconstruction https://bugs.webkit.org/show_bug.cgi?id=169095 Reviewed by Brent Fulgham. When deconstructing the FrameTree, we fire the unload event in each subframe. Such unload event handler may insert a new frame, we would previously load such new frame which was unsafe as we would end up with an attached subframe on a detached tree. To address the issue, we prevent new subframes from loading while deconstructing the FrameTree and firing the unload events. This new behavior is consistent with Chrome and should therefore be safe from a compatibility standpoint. Test: fast/frames/insert-frame-unload-handler.html * dom/ContainerNodeAlgorithms.cpp: (WebCore::disconnectSubframes): Update SubframeLoadingDisabler call site now that the constructor takes in a pointer instead of a reference. * html/HTMLFrameOwnerElement.h: (WebCore::SubframeLoadingDisabler::SubframeLoadingDisabler): (WebCore::SubframeLoadingDisabler::~SubframeLoadingDisabler): Update SubframeLoadingDisabler constructor to take in a pointer instead of a reference, for convenience. * loader/FrameLoader.cpp: (WebCore::FrameLoader::detachChildren): Prevent loads in subframes while detaching the subframes. It would be unsafe as we copy the list of frames before iterating to fire the unload events. Therefore, newly inserted frames would not get unloaded. 2017-03-02 Matthew Hanson <matthew_hanson@apple.com> Rollout r212893. rdar://problem/30812551 2017-02-22 Matthew Hanson <matthew_hanson@apple.com> rdar://problem/30657889 2017-02-22 Filip Pizlo <fpizlo@apple.com> A:B testing should not be contingent upon RC_SEED_BUILD Reviewed by Alexey Proskuryakov. * platform/SplitTestInitializer.cpp: 2017-03-01 Matthew Hanson <matthew_hanson@apple.com> Merge r213211. rdar://problem/30742143 2017-03-01 Per Arne Vollan <pvollan@apple.com> [Win] Popup menus are too small in HiDPI mode. https://bugs.webkit.org/show_bug.cgi?id=168965 Reviewed by Brent Fulgham. Scale font with device scale factor. * platform/win/PopupMenuWin.cpp: (WebCore::PopupMenuWin::show): (WebCore::PopupMenuWin::calculatePositionAndSize): (WebCore::PopupMenuWin::paint): * platform/win/PopupMenuWin.h: 2017-02-24 Matthew Hanson <matthew_hanson@apple.com> Merge r212822. rdar://problem/30682429 2017-02-22 Per Arne Vollan <pvollan@apple.com> [Win] Crash under CACFLayerTreeHost::acceleratedCompositingAvailable(). https://bugs.webkit.org/show_bug.cgi?id=168711 Reviewed by Alex Christensen. Add null pointer check. * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable): 2017-02-22 Brent Fulgham <bfulgham@apple.com> Merge r212828. rdar://problem/30636288 2017-02-21 Antti Koivisto <antti@apple.com> REGRESSION(r207669): Crash after mutating selector text https://bugs.webkit.org/show_bug.cgi?id=168655 <rdar://problem/30632111> Reviewed by Brent Fulgham. Test: fast/css/selector-text-mutation-crash.html * style/StyleScope.cpp: (WebCore::Style::Scope::resolver): (WebCore::Style::Scope::updateStyleResolver): Protect against entering scheduleUpdate and wiping style resolver while updating it. Extension stylesheets can trigger this. (WebCore::Style::Scope::scheduleUpdate): Clear the style resolver immediately if style sheet content changes. The resolver may have data structures that point to the old sheet contents. The resolver would get wiped anyway when the scheduled update actually occurs. * style/StyleScope.h: 2017-02-28 Matthew Hanson <matthew_hanson@apple.com> Merge r213078. rdar://problem/30704432 2017-02-27 Matthew Hanson <matthew_hanson@apple.com> Merge r213010. rdar://problem/30704432 2017-02-26 Chris Dumez <cdumez@apple.com> HitTestResult's linkSuggestedFilename should sanitize download attribute https://bugs.webkit.org/show_bug.cgi?id=168856 <rdar://problem/30683109> Reviewed by Antti Koivisto. HitTestResult's linkSuggestedFilename should sanitize download attribute. This is used by the context menu's "Download Linked File" & "Download Linked File As..." actions. * rendering/HitTestResult.cpp: (WebCore::HitTestResult::linkSuggestedFilename): * rendering/HitTestResult.h: 2017-02-28 Matthew Hanson <matthew_hanson@apple.com> Merge r213077. rdar://problem/30704432 2017-02-27 Matthew Hanson <matthew_hanson@apple.com> Merge r212987. rdar://problem/30704432 2017-02-24 Chris Dumez <cdumez@apple.com> Unreviewed, follow-up fix after r212972. Fixes a few assertions on the debug build bots. URL needs to be exactly the same as the parsed one given that we are calling the ParsedURLString constructor. * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::sanitizeSuggestedFilename): 2017-02-28 Matthew Hanson <matthew_hanson@apple.com> Merge r213076. rdar://problem/30704432 2017-02-27 Matthew Hanson <matthew_hanson@apple.com> Merge r212972. rdar://problem/30704432 2017-02-24 Chris Dumez <cdumez@apple.com> Download attribute should be sanitized before being used as suggested filename https://bugs.webkit.org/show_bug.cgi?id=168839 <rdar://problem/30683109> Reviewed by Darin Adler. Sanitize Download attribute before using it as a suggested filename for the download. We rely on ResourceResponse's sanitizing of the suggested filename to do so, which has the benefit of being consistent with downloads without the download attribute. Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::sanitizeSuggestedFilename): * platform/network/ResourceResponseBase.h: 2017-02-22 Brent Fulgham <bfulgham@apple.com> Merge r212828. rdar://problem/30636274 2017-02-21 Antti Koivisto <antti@apple.com> REGRESSION(r207669): Crash after mutating selector text https://bugs.webkit.org/show_bug.cgi?id=168655 <rdar://problem/30632111> Reviewed by Brent Fulgham. Test: fast/css/selector-text-mutation-crash.html * style/StyleScope.cpp: (WebCore::Style::Scope::resolver): (WebCore::Style::Scope::updateStyleResolver): Protect against entering scheduleUpdate and wiping style resolver while updating it. Extension stylesheets can trigger this. (WebCore::Style::Scope::scheduleUpdate): Clear the style resolver immediately if style sheet content changes. The resolver may have data structures that point to the old sheet contents. The resolver would get wiped anyway when the scheduled update actually occurs. * style/StyleScope.h: 2017-02-23 Matthew Hanson <matthew_hanson@apple.com> Rollout r212740. rdar://problem/30636274 2017-02-22 Brent Fulgham <bfulgham@apple.com> Merge r212554. rdar://problem/30636115 2017-02-16 Brent Fulgham <bfulgham@apple.com> RenderView needs to be updated when FrameView changes https://bugs.webkit.org/show_bug.cgi?id=168481 <rdar://problem/30339638> Reviewed by Andreas Kling. The state of the Document's RenderView can get out of sync with the Frame's FrameView. We need a notification mechanism so that modifications to the Frame's view are properly relayed to Document so that it can have a correct RenderView. * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInView): Create an updated render tree (if one does not already exist). (WebCore::Document::destroyRenderTree): Remove an incorrect ASSERT. We may enter this code when the Frame uses 'setView(nullptr)', which happens during certain updates. * dom/Document.h: * page/Frame.cpp: (WebCore::Frame::setView): Destroy the old render tree (if present) before switching to the new view. Then notify the document that it is now the current document in the new view. 2017-02-22 Matthew Hanson <matthew_hanson@apple.com> Merge r212730. rdar://problem/30515072 2017-02-21 Per Arne Vollan <pvollan@apple.com> [Win] WebView is not painting in accelerated compositing mode. https://bugs.webkit.org/show_bug.cgi?id=168654 Reviewed by Brent Fulgham. Initializing the uncommitted layer change flags to CoverageRectChanged in GraphicsLayerCA, stops WebView painting in accelerated mode. Covered by existing tests. * platform/graphics/ca/GraphicsLayerCA.h: 2017-02-22 Matthew Hanson <matthew_hanson@apple.com> Merge r212831. rdar://problem/30628889 2017-02-22 Per Arne Vollan <pvollan@apple.com> [Win] Compile fix. https://bugs.webkit.org/show_bug.cgi?id=168713 Reviewed by Brent Fulgham. The include file <ANGLE/ShaderLang.h> is not found. * testing/Internals.cpp: 2017-02-22 Matthew Hanson <matthew_hanson@apple.com> Merge r212819. rdar://problem/30640217 2017-02-22 Matthew Hanson <matthew_hanson@apple.com> Merge r212773. rdar://problem/30640217 2017-02-21 Chris Dumez <cdumez@apple.com> REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work https://bugs.webkit.org/show_bug.cgi?id=168677 <rdar://problem/30640101> Reviewed by Ryosuke Niwa. Add quirk to initMouseEvent to unbreak iAd Producer. * dom/MouseEvent.cpp: (WebCore::MouseEvent::initMouseEventQuirk): * dom/MouseEvent.h: * dom/MouseEvent.idl: * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::MacApplication::isIADProducer): 2017-02-21 Matthew Hanson <matthew_hanson@apple.com> Merge r212737. rdar://problem/30636274 2017-02-21 Antti Koivisto <antti@apple.com> REGRESSION(r207669): Crash after mutating selector text https://bugs.webkit.org/show_bug.cgi?id=168655 <rdar://problem/30632111> Reviewed by Brent Fulgham. Test: fast/css/selector-text-mutation-crash.html * style/StyleScope.cpp: (WebCore::Style::Scope::scheduleUpdate): Clear the style resolver immediately if style sheet content changes. The resolver may have data structures that point to the old sheet contents. The resolver would get wiped anyway when the scheduled update actually occurs. 2017-02-17 JF Bastien <jfbastien@apple.com> A/B test concurrent GC https://bugs.webkit.org/show_bug.cgi?id=168453 <rdar://problem/30553220> Reviewed by Phil Pizlo. Initialize the WTF::SplitTest singleton using the anonymous UUID from crash reporter. This makes it easy to figure out which A/B split tests were enabled from a particular crash log. * WebCore.xcodeproj/project.pbxproj: * platform/SplitTestInitializer.cpp: Added. (getUUID): (InitWebCoreSplitTest): * platform/SplitTestInitializer.h: Copied from Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm. 2017-02-21 Matthew Hanson <matthew_hanson@apple.com> Merge r212667. rdar://problem/29852056 2017-02-20 Brent Fulgham <bfulgham@apple.com> Nullptr dereferences when stopping a load https://bugs.webkit.org/show_bug.cgi?id=168608 <rdar://problem/29852056> Reviewed by Ryosuke Niwa. Don't attempt to notify a detached frame's load client that the load is stopped. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoading): Check for null frame loader and bypass dereferencing it. 2017-02-18 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r212218): Assertion failures in and after parserRemoveChild https://bugs.webkit.org/show_bug.cgi?id=168458 Reviewed by Antti Koivisto. The bug was caused by parserRemoveChild not preceeding to remove oldChild even when oldChild had been inserted elsewhere during unload evnets of the disconnected frames. Fixed the bug by checking this condition and exiting early. Also fixed various callers of parserRemoveChild to not call parserAppendChild when the removed node had already been inserted elsewhere by scripts. Tests: fast/parser/adoption-agency-unload-iframe-3.html fast/parser/adoption-agency-unload-iframe-4.html fast/parser/xml-error-unload-iframe.html * dom/ContainerNode.cpp: (WebCore::ContainerNode::parserRemoveChild): Exit early when the node had been inserted elsewhere while firing unload events. Also moved the call to notifyRemovePendingSheetIfNeeded outside NoEventDispatchAssertion since it can synchrnously fire a focus event. (WebCore::ContainerNode::parserAppendChild): Moved adoptNode call to inside NoEventDispatchAssertion since adoptNode call here should never mutate DOM. * html/parser/HTMLConstructionSite.cpp: (WebCore::executeReparentTask): Added an early exit when the node had already been inserted elsewhere. (WebCore::executeInsertAlreadyParsedChildTask): Ditto. * xml/XMLErrors.cpp: (WebCore::XMLErrors::insertErrorMessageBlock): Ditto. * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::end): Fixed a crash unveiled by one of the test cases. Exit early when insertErrorMessageBlock detached the parser (by author scripts). (WebCore::XMLDocumentParser::finish): Keep the parser alive until we exit. 2017-02-20 Ryosuke Niwa <rniwa@webkit.org> HTMLConstructionSiteTask::Insert should never be called on a node with a parent https://bugs.webkit.org/show_bug.cgi?id=168099 Reviewed by Sam Weinig. insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead of using HTMLConstructionSiteTask::Insert when fostering a child. Also combine the step to take all children and re-parenting into a single task instead of separately issuing TakeAllChildren and Reparent tasks. No new tests since this is a refactoring. * html/parser/HTMLConstructionSite.cpp: (WebCore::insert): Now asserts that the child node never have a parent. (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here. (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask now that this function also does the reparenting. (WebCore::executeTask): (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren. (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild instead of calling fosterParent which uses Insert when fostering parents. (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren. * html/parser/HTMLConstructionSite.h: (WebCore::HTMLConstructionSiteTask:Operation): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Rollout r212601. rdar://problem/30339638 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Rollout r212660. rdar://problem/30553220 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Rollout r212647. rdar://problem/30563318 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r211750. rdar://problem/30383964 2017-02-06 Simon Fraser <simon.fraser@apple.com> Safari pages are blank sometimes (missing tiles) https://bugs.webkit.org/show_bug.cgi?id=167904 Reviewed by Tim Horton. After r211683 we failed to udpate the "inWindow" flag on the page tiled layer, because usingTiledBacking() on GraphicsLayer confusingly was false for the page tiled layer. Fix by removing usingTiledBacking() entirely, and checking for tiledBacking(), looking at the layer type when necessary. Tested by tiled-drawing/tiled-backing-in-window.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): This is the bug fix. (WebCore::GraphicsLayer::getDebugBorderInfo): (WebCore::GraphicsLayer::dumpProperties): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::usingTiledBacking): Deleted. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::recursiveCommitChanges): (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): (WebCore::GraphicsLayerCA::changeLayerTypeTo): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::willDestroyLayer): (WebCore::RenderLayerBacking::compositingLayerType): * rendering/RenderLayerCompositor.cpp: A bit more logging. (WebCore::RenderLayerCompositor::setIsInWindow): (WebCore::RenderLayerCompositor::attachRootLayer): 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212651. rdar://problem/30604254 2017-02-20 Jon Lee <jonlee@apple.com> Fix build error for iOS. Unreviewed. * platform/graphics/GraphicsContext3D.cpp: Move stub function into !PLATFORM(COCOA) instead of !PLATFORM(MAC). 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212650. rdar://problem/30604254 2017-02-20 Jon Lee <jonlee@apple.com> Unreviewed, rolling out r212639. Have a fix for the linker error on iOS. Reverted changeset: "Unreviewed, rolling out r212637." https://bugs.webkit.org/show_bug.cgi?id=168595 http://trac.webkit.org/changeset/212639 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212633. rdar://problem/30592266 2017-02-19 Dean Jackson <dino@apple.com> Activate/deactivate high performance GPU when requested https://bugs.webkit.org/show_bug.cgi?id=168559 <rdar://problem/30592266> Reviewed by Jon Lee. Respect the high-performance powerPreference for WebGL, by managing an object that enables the high-performance GPU. If a WebGL context wants high-performance, and it is visible, then a manager class in GraphicsContext3D creates and retains the object, causing all the WebGL contexts to move GPUs. If all the high-performance contexts are not visible, such as in a background tab, then the manager will release the object, allowing the GPU to power down. The swapping back from the high-performance GPU happens on a timer, to make sure we don't churn between GPUs if the user is swapping between a lot of tabs, or windows. Unfortunately testing this change properly requires hardware with multiple GPUs. I plan to write an API test that fakes most of the system interaction, such as occluding the page. An API test might also be able to verify if the system has more than one GPU. Otherwise I'll have to plumb everything through Internals. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::isHighPerformanceContext): Helper to detect if the GraphicsContext3D actually used high-performance mode. (WebCore::WebGLRenderingContextBase::create): Add logging if we are actually overriding a high-performance request. (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): If we are high-performance, then register for activity state changes. (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary): (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver): (WebCore::WebGLRenderingContextBase::destroyGraphicsContext3D): Call removeActivityStateChangeObserver as the GC3D is destroyed. (WebCore::WebGLRenderingContextBase::maybeRestoreContext): If the context was restored successfully, and came back in high-performance, then we need to listen for activity state changes as usual. (WebCore::WebGLRenderingContextBase::activityStateDidChange): If we changed visibility, tell the GC3D. * html/canvas/WebGLRenderingContextBase.h: Class inherits ActivityStateChangeObserver. * page/Settings.in: No longer force low-power everywhere. * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::setContextVisibility): Empty implementation for non-Mac. * platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::powerPreferenceUsedForCreation): Tells clients what power preference was actually used during creation (e.g. a single GPU system will use default, even if they requested high-performance). * platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Helper class to look after all GraphicsContext3Ds. (WebCore::GraphicsContext3DManager::hasTooManyContexts): We have a limit on the number of contexts we can keep alive at any one time. (WebCore::manager): Helper to return the static instance. (WebCore::displayWasReconfigured): Send a message to all the contexts. (WebCore::GraphicsContext3DManager::addContext): (WebCore::GraphicsContext3DManager::removeContext): (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance): (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Check if the number of contexts requiring high-performance means we need to enable/disable that GPU. (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Releases our object that keeps the high-performance GPU on. (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Get rid of the first (oldest) context. This code was in GC3D proper, but it made more sense here in the helper. (WebCore::setPixelFormat): All contexts are created muxable now. (WebCore::GraphicsContext3D::create): Use the manager. (WebCore::GraphicsContext3D::GraphicsContext3D): Ditto. (WebCore::GraphicsContext3D::~GraphicsContext3D): Add logging. (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Better logging. (WebCore::GraphicsContext3D::updateCGLContext): (WebCore::GraphicsContext3D::setContextVisibility): This is the responder to the ActivityStateChanges in the WebGLRenderingContext. (WebCore::activeContexts): Deleted. (WebCore::addActiveContext): Deleted. (WebCore::removeActiveContext): Deleted. 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212331. rdar://problem/30522092 2017-02-14 Dean Jackson <dino@apple.com> Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower https://bugs.webkit.org/show_bug.cgi?id=168339 <rdar://problem/30522092> Reviewed by Simon Fraser. Use a setting name that more clearly reflects what it is doing. It's not preferring to use the low-power GPU, it's forcing it. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): * page/Settings.in: 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Rollout r212538. rdar://problem/30541748 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> A/B test concurrent GC https://bugs.webkit.org/show_bug.cgi?id=168453 <rdar://problem/30553220> Landed on behalf of JF Bastien. Reviewed by Alexey Proskuryakov. Initialize the WTF::SplitTest singleton using the anonymous UUID from crash reporter. This makes it easy to figure out which A/B split tests were enabled from a particular crash log. * WebCore.xcodeproj/project.pbxproj: * platform/SplitTestInitializer.cpp: Added. (getUUID): (InitWebCoreSplitTest): * platform/SplitTestInitializer.h: Copied from Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm. 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212652. rdar://problem/30435303 2017-02-20 Per Arne Vollan <pvollan@apple.com> [Win] Custom scale factor is not applied in all cases. https://bugs.webkit.org/show_bug.cgi?id=168117 Reviewed by Brent Fulgham. We should not call the function deviceScaleFactorForWindow directly, since this will return the system scale factor, and ignore the custom scale factor. * platform/graphics/ca/win/CACFLayerTreeHost.h: * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: (WebCore::WKCACFViewLayerTreeHost::initializeContext): (WebCore::WKCACFViewLayerTreeHost::resize): (WebCore::WKCACFViewLayerTreeHost::setScaleFactor): * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h: * platform/win/GDIUtilities.h: (WebCore::makeScaledPoint): * platform/win/PlatformMouseEventWin.cpp: (WebCore::positionForEvent): * platform/win/PopupMenuWin.cpp: (WebCore::PopupMenuWin::show): (WebCore::PopupMenuWin::wndProc): * platform/win/PopupMenuWin.h: 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212621. rdar://problem/30563318 2017-02-18 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r212218): Assertion failures in and after parserRemoveChild https://bugs.webkit.org/show_bug.cgi?id=168458 Reviewed by Antti Koivisto. The bug was caused by parserRemoveChild not preceeding to remove oldChild even when oldChild had been inserted elsewhere during unload evnets of the disconnected frames. Fixed the bug by checking this condition and exiting early. Also fixed various callers of parserRemoveChild to not call parserAppendChild when the removed node had already been inserted elsewhere by scripts. Tests: fast/parser/adoption-agency-unload-iframe-3.html fast/parser/adoption-agency-unload-iframe-4.html fast/parser/xml-error-unload-iframe.html * dom/ContainerNode.cpp: (WebCore::ContainerNode::parserRemoveChild): Exit early when the node had been inserted elsewhere while firing unload events. Also moved the call to notifyRemovePendingSheetIfNeeded outside NoEventDispatchAssertion since it can synchrnously fire a focus event. (WebCore::ContainerNode::parserAppendChild): Moved adoptNode call to inside NoEventDispatchAssertion since adoptNode call here should never mutate DOM. * html/parser/HTMLConstructionSite.cpp: (WebCore::executeReparentTask): Added an early exit when the node had already been inserted elsewhere. (WebCore::executeInsertAlreadyParsedChildTask): Ditto. * xml/XMLErrors.cpp: (WebCore::XMLErrors::insertErrorMessageBlock): Ditto. * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::end): Fixed a crash unveiled by one of the test cases. Exit early when insertErrorMessageBlock detached the parser (by author scripts). (WebCore::XMLDocumentParser::finish): Keep the parser alive until we exit. 2017-02-20 Matthew Hanson <matthew_hanson@apple.com> Merge r212558. rdar://problem/30451563 2017-02-17 Simon Fraser <simon.fraser@apple.com> REGRESSION (209396): Apple Pay buttons do not render https://bugs.webkit.org/show_bug.cgi?id=168523 rdar://problem/30451563 Reviewed by Geoffrey Garen. The new CSS parser mistakenly converted -apple-pay-button values to -webkit-pay-button, breaking -webkit-appearance: -apple-pay-button. Fix by excluding "-apple-pay" prefixed values from the conversion. Test: fast/css/appearance-apple-pay-button.html * css/parser/CSSPropertyParser.cpp: (WebCore::isAppleLegacyCssValueKeyword): 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Merge r212554. rdar://problem/30339638 2017-02-16 Brent Fulgham <bfulgham@apple.com> RenderView needs to be updated when FrameView changes https://bugs.webkit.org/show_bug.cgi?id=168481 <rdar://problem/30339638> Reviewed by Andreas Kling. The state of the Document's RenderView can get out of sync with the Frame's FrameView. We need a notification mechanism so that modifications to the Frame's view are properly relayed to Document so that it can have a correct RenderView. * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInView): Create an updated render tree (if one does not already exist). (WebCore::Document::destroyRenderTree): Remove an incorrect ASSERT. We may enter this code when the Frame uses 'setView(nullptr)', which happens during certain updates. * dom/Document.h: * page/Frame.cpp: (WebCore::Frame::setView): Destroy the old render tree (if present) before switching to the new view. Then notify the document that it is now the current document in the new view. 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Merge r212354. rdar://problem/30450371 2017-02-14 Ryosuke Niwa <rniwa@webkit.org> An assertion failure inside removeChildren https://bugs.webkit.org/show_bug.cgi?id=168069 Reviewed by Brent Fulgham. The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't. Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it in its call sites when they're safe. Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html * dom/ContainerNode.cpp: (WebCore::ContainerNode::takeAllChildrenFrom): (WebCore::ContainerNode::notifyChildInserted): (WebCore::ContainerNode::removeChild): (WebCore::ContainerNode::parserRemoveChild): (WebCore::ContainerNode::replaceAllChildren): (WebCore::ContainerNode::removeChildren): * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeRemoved): 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Merge r212265. rdar://problem/30231732 2017-02-13 Said Abou-Hallawa <sabouhallawa@apple.com> The current frame of an image should not deleted if another frame is asynchronously being decoded https://bugs.webkit.org/show_bug.cgi?id=167618 Reviewed by Simon Fraser. Test: fast/images/animated-image-draw-while-decode.html If the memory cache asks the BitmapImage to destroy all its frames while the next frame is being decoded, a thread contention may happen. This can happen when BitmapImage::draw() is called and the next frame is not ready yet for drawing, so the current frame has to be drawn. This will invoke a frame decoding in the same image from the drawing committing thread. We can avoid that by destroying all the frames except the current frame if the image is asynchronously decoding its frames. This should not add extra memory overhead because building the image frame cache and then destroying it, when needed, is an on-going process. The frames will be allocated and decoded all the time and all of them can be destroyed except the current one. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::destroyDecodedData): (WebCore::BitmapImage::destroyDecodedDataIfNecessary): The logic of destroying the ImageFrames was split among BitmapImage, ImageSource and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache be responsible only for destroying a range of ImageFrames. (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame is ready to be rendered if the next frame is being decoded. * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::destroyDecodedData): (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted. * platform/graphics/ImageFrameCache.h: (WebCore::ImageFrameCache::destroyAllDecodedData): (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame): (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame): Make ImageFrameCache be responsible for destroying a range of ImageFrames. This range might include all the frames, all the frames but up to a specific frame, or all the frames but exclude one frame in the middle. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear(). The decision to call clearFrameBufferCache() or clear() is moved to BitmapImage::destroyDecodedData(). (WebCore::ImageSource::destroyDecodedData): Deleted. (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted. These functions are replaced by another set of functions in ImageSource.h. * platform/graphics/ImageSource.h: (WebCore::ImageSource::destroyAllDecodedData): (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame): (WebCore::ImageSource::destroyDecodedDataBeforeFrame): (WebCore::ImageSource::hasDecodingQueue): These are new wrappers which call the corresponding ImageFrameCache functions. 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Merge r212218. rdar://problem/30339793 2017-02-12 Ryosuke Niwa <rniwa@webkit.org> parserRemoveChild should unload subframes https://bugs.webkit.org/show_bug.cgi?id=168151 Reviewed by Darin Adler. Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes. Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965. Tests: fast/parser/adoption-agency-clear-focus-range.html fast/parser/adoption-agency-unload-iframe-1.html fast/parser/adoption-agency-unload-iframe-2.html * dom/ContainerNode.cpp: (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild. Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges, the focused element, and other states in the document. Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in response to the unload event we just dispatched. Third, append these nodes using parserAppendChild to avoid dispatching mutation events. (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion in each call site of willRemoveChild and willRemoveChildren. (WebCore::willRemoveChildren): Ditto. (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion. (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion. (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states. * html/parser/HTMLConstructionSite.cpp: (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Merge r212035. rdar://problem/30433204 2017-02-09 Filip Pizlo <fpizlo@apple.com> SharedArrayBuffer does not need to be in the transfer list https://bugs.webkit.org/show_bug.cgi?id=168079 Reviewed by Geoffrey Garen and Keith Miller. Tests: workers/sab/multi-memory-multi-buffer.html workers/sab/multi-memory.html workers/sab/no-transfer.html workers/sab/postMessage-clones.html workers/sab/sent-from-worker-no-transfer.html workers/sab/sent-from-worker-transfer.html The SAB API that we originally implemented required that SABs get put in transfer lists when they are sent to workers. The new SAB API that everyone is converging towards requires that you do not put the SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB is part of any message to or from a dedicated worker then it is automatically shared. The new API provides a lot more clarity about what is supposed to happen in contexts that support transfering but don't support sharing. Right now this patch allows both styles to work, but I hope we can disable the transfer list capability soon. * bindings/js/IDBBindingUtilities.cpp: (WebCore::deserializeIDBValueToJSValue): * bindings/js/JSMessageEventCustom.cpp: (WebCore::JSMessageEvent::data): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): (WebCore::CloneSerializer::CloneSerializer): (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneDeserializer::deserialize): (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readTerminal): (WebCore::SerializedScriptValue::SerializedScriptValue): (WebCore::SerializedScriptValue::create): (WebCore::SerializedScriptValue::deserialize): * bindings/js/SerializedScriptValue.h: (): Deleted. * dom/CustomEvent.cpp: (WebCore::CustomEvent::trySerializeDetail): * dom/ErrorEvent.cpp: (WebCore::ErrorEvent::trySerializeError): * dom/MessageEvent.cpp: (WebCore::MessageEvent::trySerializeData): * dom/PopStateEvent.cpp: (WebCore::PopStateEvent::trySerializeState): * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::postMessage): * workers/Worker.cpp: (WebCore::Worker::postMessage): 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Rollout r212488. rdar://problem/29904368 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Rollout r212500. rdar://problem/29904368 2017-02-17 Matthew Hanson <matthew_hanson@apple.com> Rollout r212501. rdar://problem/29904368 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212513. rdar://problem/30301317 2017-02-16 Myles C. Maxfield <mmaxfield@apple.com> font-weight in @font-face can cause a font to be downloaded even when it's not used https://bugs.webkit.org/show_bug.cgi?id=168114 <rdar://problem/30301317> Reviewed by Darin Adler. There were two problems with our font loading code. When we are in the middle of a download, we will use a special interstitial font, and this special font has a flag set which will cause it to be invisible when it is drawn. However, when we start using this font during the load, we give it a unicode-range of U+0-0 which means that it will never be used, and fallback will happen to other weights immediately. The second problem with the font loading code is that this interstital font is just Times. Times doesn't support every character, which means that if we are trying to render some exotic character, we fall back to other weights. The solution here is to use LastResort as the interstitial font, because it supports all characters. Because its metrics are reasonable and we don't ever actually paint this interstitial font, this choice is no worse than Times. Tests: fast/text/font-style-download.html fast/text/font-weight-download-2.html fast/text/font-weight-download.html fast/text/font-weight-fallback.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::font): * css/CSSSegmentedFontFace.cpp: (WebCore::appendFont): (WebCore::CSSSegmentedFontFace::fontRanges): (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Deleted. * platform/graphics/Font.h: (WebCore::Font::widthForGlyph): * platform/graphics/FontCache.h: * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): * platform/graphics/mac/FontCacheMac.mm: (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): * platform/graphics/win/FontCacheWin.cpp: (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212441. rdar://problem/30357253 2017-02-16 Chris Fleizach <cfleizach@apple.com> AX: Make form validation accessible on iOS https://bugs.webkit.org/show_bug.cgi?id=168400 Reviewed by Chris Dumez. Hide the popover content of form validation from accessibility (since its not interactable) and instead announce the message. * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::show): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212518. rdar://problem/30541748 2017-02-16 Daniel Bates <dabates@apple.com> Remove Chromium-specific code to call FrameLoaderClient::redirectDataToPlugin(nullptr) https://bugs.webkit.org/show_bug.cgi?id=168417 <rdar://problem/30541748> Reviewed by Brent Fulgham. Remove Chromium-specific code that was added in r125500 to call FrameLoaderClient::redirectDataToPlugin(nullptr) in PluginDocument::detachFromPluginElement(). Calling redirectDataToPlugin() with nullptr was used by the Chromium port to signify that the plugin document was being destroyed so that they could tear down their plugin widget. And PluginDocument::detachFromPluginElement() is the only place that calls redirectDataToPlugin() passing nullptr. No other port made use of this machinery and the Chromium port has long since been removed from the Open Source WebKit Project. We should remove this code. * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::appendBytes): Pass the plugin widget by reference. (WebCore::PluginDocument::detachFromPluginElement): Remove call to FrameLoaderClient::redirectDataToPlugin(). This call was only used by the Chromium port as means to be notified when the plugin document was being destroyed. No other port made use of this notification or needed such a notification. * loader/EmptyClients.cpp: Change argument of redirectDataToPlugin() from Widget* to Widget& to convey that this function always takes a valid Widget. Also remove unnecessary argument name as the data type of the argument and the name of the function sufficiently describes the purpose of the argument. * loader/FrameLoaderClient.h: Ditto. 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212350. rdar://problem/30450379 2017-02-14 Brent Fulgham <bfulgham@apple.com> Revalidate URL after events that could trigger navigations https://bugs.webkit.org/show_bug.cgi?id=168071 <rdar://problem/30450379> Reviewed by Ryosuke Niwa. When arbitary javascript runs during a load, we should revalidate the URLs involved to make sure they are still valid. Tests: http/tests/plugins/navigation-during-load-embed.html http/tests/plugins/navigation-during-load.html * html/HTMLEmbedElement.cpp: (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to load the URL after executing JS callbacks. * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into existing protected method, and a new public method that checks a passed URL for validity. * html/HTMLFrameElementBase.h: * html/HTMLFrameOwnerElement.h: (WebCore::HTMLFrameOwnerElement::isURLAllowed): * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to load the URL after executing JS callbacks. * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): Ditto. 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212335. rdar://problem/29899473 2017-02-14 Brady Eidson <beidson@apple.com> Unreviewed followup to r212330 to fix Debug builds * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement(). 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212330. rdar://problem/29899473 2017-02-14 Brady Eidson <beidson@apple.com> Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived. <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337 Reviewed by Geoffrey Garen. No new tests (Unable to find a reproduction). * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212316. rdar://problem/30504444 2017-02-13 Dean Jackson <dino@apple.com> Rename preferLowPowerToHighPerformance to powerPreference https://bugs.webkit.org/show_bug.cgi?id=168269 <rdar://problem/30504444> Reviewed by Chris Dumez. Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283. Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean into a powerPreference enum taking three values. The implementation of the enum is in GraphicsContext3DAttributes. While the name and values have changed, there should be no change in behaviour caused by this patch. * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes enum GraphicsContext3DPowerPreference. * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum. * html/canvas/WebGLRenderingContextBase.cpp: Use the new values. (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker): * platform/WebGLStateTracker.cpp: * platform/WebGLStateTracker.h: Update the state tracker to use the new values. * platform/graphics/GraphicsContext3DAttributes.h: * platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter. (WebCore::GraphicsContext3D::GraphicsContext3D): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212314. rdar://problem/27685077 2017-02-14 Jeremy Jones <jeremyj@apple.com> When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback. https://bugs.webkit.org/show_bug.cgi?id=167815 rdar://problem/27685077 Reviewed by Jer Noble. Test: media/media-fullscreen-loop-inline.html When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): (WebCore::HTMLMediaElement::exitFullscreen): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212301. rdar://problem/30494674 2017-02-13 Filip Pizlo <fpizlo@apple.com> worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list https://bugs.webkit.org/show_bug.cgi?id=168277 Reviewed by Mark Lam. Test: workers/sab/postMessage-transfer-type-error.html This is a simple spec compliance change. The title says it all. * bindings/js/SerializedScriptValue.cpp: (WebCore::SerializedScriptValue::create): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212260. rdar://problem/30481079 2017-02-13 Simon Fraser <simon.fraser@apple.com> Call WKDestroyRenderingResources() on iOS when tabs are backgrounded https://bugs.webkit.org/show_bug.cgi?id=168261 rdar://problem/30481079 Reviewed by Tim Horton. Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore that do a framework include. * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h: * platform/spi/cocoa/QuartzCoreSPI.h: * platform/spi/mac/NSViewSPI.h: 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212214. rdar://problem/30451581 2017-02-12 Ryosuke Niwa <rniwa@webkit.org> REGRESSION (r179497): Crash inside setAttributeNode https://bugs.webkit.org/show_bug.cgi?id=168161 <rdar://problem/30451581> Reviewed by Andreas Kling. The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts and mutated element's m_elementData. Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData(). Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html * dom/Element.cpp: (WebCore::Element::setAttributeNode): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212174. rdar://problem/29904368 2017-02-10 Daniel Bates <dabates@apple.com> Attempt to fix the build following <https://trac.webkit.org/changeset/212173> (https://bugs.webkit.org/show_bug.cgi?id=166774) * dom/Document.cpp: (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since the parameter cachedFrame is unused in non-debug build. 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212173. rdar://problem/29904368 2017-02-10 Daniel Bates <dabates@apple.com> Detach frame from document when entering page cache https://bugs.webkit.org/show_bug.cgi?id=166774 <rdar://problem/29904368> Reviewed by Chris Dumez. When a page enters the page cache it is unnecessary for it to hold a reference to its associated frame because subsequent interactions with the page do not need to make use of it. Once a page exits the page cache we associate it with its frame. * dom/Document.cpp: (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame(). (WebCore::Document::attachToCachedFrame): Added. (WebCore::Document::detachFromCachedFrame): Added. (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to the former. (WebCore::Document::hasEverCalledWindowOpen): Deleted. (WebCore::Document::markHasCalledWindowOpen): Deleted. (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame. * dom/Document.h: (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed visibility from public to private and made this function inline. * history/CachedFrame.cpp: (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were removed from the page when it was in the page cache as there is no need to restore such frames. (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the frame tree. (WebCore::CachedFrame::CachedFrame): Detach from the frame. (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame. (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to detach the animation controller from the document as it is being destroyed. We have to do this here because the document does not have a frame. And Document::prepareForDestruction() only calls CSSAnimationController::detachFromDocument() if the document has a frame. * history/CachedFrame.h: * history/PageCache.cpp: (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open() or has an opener as it is feasible to keep such pages in the page cache. * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit. * loader/FrameLoader.cpp: (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the page is not in- or about to enter- the page cache. A page in the page cache has finished loading and its active DOM objects are suspended. Also fix style nit in comment. (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain that we protect the frame because stopAllLoaders() can cause the frame to be deallocated. * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this function will be removed. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted. (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted. * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::openedByWindowOpen): Deleted. * page/Page.h: * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener. 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212172. rdar://problem/30476807 2017-02-10 Simon Fraser <simon.fraser@apple.com> REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=168054 Reviewed by Tim Horton. When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects() to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects() ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer. Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and viewport-constrained state as for its host layer (we already assume that their geometry matches). Tested by compositing/masks/solid-color-masked.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): (WebCore::GraphicsLayerCA::recursiveCommitChanges): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212153. rdar://problem/30467120 2017-02-10 Simon Fraser <simon.fraser@apple.com> Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections https://bugs.webkit.org/show_bug.cgi?id=168127 rdar://problem/30467120 Reviewed by Tim Horton. Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants() which forgot to hit masks and replica layers with a generic traverse() function, which is then used for setting 'inWindow' as well as resetting tracked repaints. Tests: compositing/tiling/tiled-mask-inwindow.html compositing/tiling/tiled-reflection-inwindow.html * page/PageOverlayController.cpp: (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::setIsInWindow): (WebCore::GraphicsLayer::setReplicatedByLayer): (WebCore::GraphicsLayer::traverse): (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted. * platform/graphics/GraphicsLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::setIsInWindow): (WebCore::RenderLayerCompositor::resetTrackedRepaintRects): (WebCore::resetTrackedRepaintRectsRecursive): Deleted. 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212152. rdar://problem/30459055 2017-02-09 Simon Fraser <simon.fraser@apple.com> Tiled layers are sometimes left with some tiles when outside the viewport https://bugs.webkit.org/show_bug.cgi?id=168104 rdar://problem/30459055 Reviewed by Tim Horton. When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect. Minor logging changes. Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::revalidateTiles): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r212151. rdar://problem/30090186 2017-02-10 Zalan Bujtas <zalan@apple.com> Mail hangs when removing multiple rows from large table. https://bugs.webkit.org/show_bug.cgi?id=168103 <rdar://problem/30090186> Reviewed by Ryosuke Niwa. DeleteSelectionCommand::removeNode doesn't actually destroy table structure items, but instead it removes their content. In order to be able to continue editing the table after the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on each table item recursively. This patch delays the layout until after we've finished with the entire subtree delete (10x progression). Performance test added. * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded): (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates): (WebCore::shouldRemoveContentOnly): (WebCore::DeleteSelectionCommand::removeNode): * editing/DeleteSelectionCommand.h: 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r211766. rdar://problem/30467124 2017-02-06 Simon Fraser <simon.fraser@apple.com> Re-land r210095 (avoid a tile revalidation on scale change) https://bugs.webkit.org/show_bug.cgi?id=167866 Reviewed by Tim Horton. r210095 was rolled out in r211230 but now that all TileControllers unparent offscreen tiles, we can roll it back it. Also add more Tiling logging. * platform/graphics/ca/TileGrid.cpp: (WebCore::validationPolicyAsString): (WebCore::TileGrid::setScale): (WebCore::TileGrid::prepopulateRect): (WebCore::TileGrid::revalidateTiles): (WebCore::TileGrid::ensureTilesForRect): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r211688. rdar://problem/30467177 2017-02-05 Simon Fraser <simon.fraser@apple.com> Remove unparentsOffscreenTiles logic in TileController https://bugs.webkit.org/show_bug.cgi?id=167823 Reviewed by Tim Horton. Give all TileGrids the "unparents offscreen tiles" behavior. This was enabled for only the page tiles in WK2 on Mac and iOS, but there's no reason to not use it for tiled composited layers also. Also use more modern C++ idioms in a few places. * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::revalidateTiles): (WebCore::TileGrid::ensureTilesForRect): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::RenderLayerBacking): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r211662. rdar://problem/30467322 2017-02-03 Simon Fraser <simon.fraser@apple.com> Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic https://bugs.webkit.org/show_bug.cgi?id=167774 Reviewed by Tim Horton. RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses. Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so. It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking(). The fact that usingTiledBacking() was only true for the page tiled layer tripped up RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow() on the page tiled layer. These changes fix that. Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window" status of TileBackings when dumping tile caches. Test: tiled-drawing/tiled-backing-in-window.html * platform/graphics/TiledBacking.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::dumpAdditionalProperties): * platform/graphics/ca/TileController.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::RenderLayerBacking): (WebCore::computePageTiledBackingCoverage): (WebCore::RenderLayerBacking::adjustTiledBackingCoverage): (WebCore::RenderLayerBacking::setTiledBackingHasMargins): (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): (WebCore::RenderLayerBacking::shouldClipCompositedBounds): (WebCore::RenderLayerBacking::updateDescendantClippingLayer): (WebCore::RenderLayerBacking::updateRootLayerConfiguration): (WebCore::RenderLayerBacking::paintsIntoWindow): (WebCore::computeTileCoverage): Deleted. * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged): (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants): (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing): (WebCore::RenderLayerCompositor::documentUsesTiledBacking): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r211683. rdar://problem/30467272 2017-02-04 Simon Fraser <simon.fraser@apple.com> Clean up how GraphicsLayer's "inWindow" state is set, and fix some issues with Page Overlays https://bugs.webkit.org/show_bug.cgi?id=167850 Reviewed by Tim Horton. RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants() walked the RenderLayer tree to set the GraphicsLayer's "inWindow" state. This had the problem of skipping non-primary GraphicsLayers. We also never did this work for page overlay layers. Fix by giving GraphicsLayers a recursive function that sets the inWindow state, and call that from RenderLayerCompositor::setIsInWindow() and PageOverlayController. PageOverlayController also needs to implement tiledBackingUsageChanged so that tiled backings created dynamically get the correct in-window state. Page overlays also had some serious issues in MiniBrowser, in that they disappeared on reload, and on hide/show web view. This was because the overlay root layers were re-parented, but addChild() for each overlay's layer wasn't called. Clean up by replacing willAttachRootLayer() followed by viewOverlayRootLayer()/documentOverlayRootLayer() with single calls that set up the layers, update the inWindow state, and return the layer. Make it possible to dump tile caches in page overlay tests. Make showGraphicsLayers() always dump page overlay layers (source of much confusion). Test: pageoverlay/overlay-remove-reinsert-view.html * page/PageOverlayController.cpp: (WebCore::PageOverlayController::documentOverlayRootLayer): (WebCore::PageOverlayController::viewOverlayRootLayer): (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::tiledBackingUsageChanged): (WebCore::PageOverlayController::willAttachRootLayer): Deleted. * page/PageOverlayController.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): (WebCore::dumpChildren): * platform/graphics/GraphicsLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::setIsInWindow): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants): Deleted. * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::toLayerTreeFlags): (WebCore::Internals::layerTreeAsText): (WebCore::Internals::pageOverlayLayerTreeAsText): * testing/Internals.h: * testing/Internals.idl: * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::layerTreeAsText): * testing/MockPageOverlayClient.h: 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r211662. rdar://problem/30467322 2017-02-03 Simon Fraser <simon.fraser@apple.com> Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic https://bugs.webkit.org/show_bug.cgi?id=167774 Reviewed by Tim Horton. RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses. Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so. It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking(). The fact that usingTiledBacking() was only true for the page tiled layer tripped up RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow() on the page tiled layer. These changes fix that. Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window" status of TileBackings when dumping tile caches. Test: tiled-drawing/tiled-backing-in-window.html * platform/graphics/TiledBacking.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::dumpAdditionalProperties): * platform/graphics/ca/TileController.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::RenderLayerBacking): (WebCore::computePageTiledBackingCoverage): (WebCore::RenderLayerBacking::adjustTiledBackingCoverage): (WebCore::RenderLayerBacking::setTiledBackingHasMargins): (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): (WebCore::RenderLayerBacking::shouldClipCompositedBounds): (WebCore::RenderLayerBacking::updateDescendantClippingLayer): (WebCore::RenderLayerBacking::updateRootLayerConfiguration): (WebCore::RenderLayerBacking::paintsIntoWindow): (WebCore::computeTileCoverage): Deleted. * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged): (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants): (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing): (WebCore::RenderLayerCompositor::documentUsesTiledBacking): 2017-02-16 Matthew Hanson <matthew_hanson@apple.com> Merge r211501. rdar://problem/29904368 2017-02-01 Antoine Quint <graouts@apple.com> [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=165319 <rdar://problem/30284104> Reviewed by Dean Jackson. Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks- support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue is that animations are suspended by media/controls/track-menu.html with a call to internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations(). Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because the selection animation for the tracks panel menu item that is clicked never completes and the delegate to notify that an item in the tracks panel was selected is never fired, which leads to the test failure. We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current document, rather than calling into AnimationController::suspendAnimations() which would do just that, but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent document load. * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer associated with an AnimationController. * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case the document its renderer is associated with is suspended. This is required since previously CompositeAnimations would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no document to use as a basis to query its suspended state in that constructor. (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument): (WebCore::AnimationControllerPrivate::detachFromDocument): (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument): (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument): (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended): (WebCore::AnimationController::animationsAreSuspendedForDocument): (WebCore::AnimationController::detachFromDocument): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * testing/Internals.cpp: (WebCore::Internals::animationsAreSuspended): (WebCore::Internals::suspendAnimations): (WebCore::Internals::resumeAnimations): 2017-02-15 Ryan Haddad <ryanhaddad@apple.com> Merge r212238. rdar://problem/30494165 2017-02-13 Chris Dumez <cdumez@apple.com> Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree https://bugs.webkit.org/show_bug.cgi?id=168237 <rdar://problem/30494165> Reviewed by Gavin Barraclough. Drop bad assertion under document::destroyRenderTree() that was introduced in r211455. The assertion seemed like a good idea but the issue is that CachedFrame::destroy() reset's the document's pageCacheState before calling Document::prepareForDestruction(). No new tests, this fixes assertion hits on our bots. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Merge r212131. rdar://problem/30271744 2017-02-10 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make intercap property values serialize correctly https://bugs.webkit.org/show_bug.cgi?id=168073 Reviewed by Zalan Bujtas. Fix CSS value keywords to preserve case when the value contains capital letters. Examples include optimizeSpeed, translateX, scaleY, etc. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator EPointerEvents): (WebCore::CSSPrimitiveValue::operator TextRenderingMode): (WebCore::CSSPrimitiveValue::operator EImageRendering): (WebCore::CSSPrimitiveValue::operator EColorInterpolation): (WebCore::CSSPrimitiveValue::operator EColorRendering): (WebCore::CSSPrimitiveValue::operator EShapeRendering): * css/MediaQueryEvaluator.cpp: (WebCore::colorGamutEvaluate): * css/SVGCSSValueKeywords.in: * css/TransformFunctions.cpp: (WebCore::transformOperationType): (WebCore::transformsForValue): * css/makevalues.pl: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::parseTransformTranslateArguments): (WebCore::parseSimpleTransformValue): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTransformValue): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters): 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Merge r211910. rdar://problem/30358835 2017-02-08 Chris Dumez <cdumez@apple.com> Use smaller tiles in windows that are not active to facilitate App Napping https://bugs.webkit.org/show_bug.cgi?id=167997 <rdar://problem/30358835> Reviewed by Simon Fraser. Use smaller / non-adaptative tiles in windows that are not active to facilitate App Napping after <https://trac.webkit.org/r197594>. Test: compositing/tiling/non-active-window-tiles-size.html * page/FrameView.cpp: (WebCore::FrameView::contentsResized): (WebCore::FrameView::addedOrRemovedScrollbar): (WebCore::FrameView::computeScrollability): (WebCore::FrameView::updateTiledBackingAdaptiveSizing): (WebCore::FrameView::unobscuredContentSizeChanged): (WebCore::FrameView::setViewExposedRect): * page/FrameView.h: * page/Page.cpp: (WebCore::Page::setActivityState): (WebCore::Page::isWindowActive): * page/Page.h: * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setTileSizeUpdateDelayDisabledForTesting): (WebCore::TileController::notePendingTileSizeChange): * platform/graphics/ca/TileController.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::disableTileSizeUpdateDelay): * testing/Internals.h: * testing/Internals.idl: 2017-02-10 Brent Fulgham <bfulgham@apple.com> Merge r212026. rdar://problem/30096323 2017-02-09 Chris Dumez <cdumez@apple.com> Crash under FormSubmission::create() https://bugs.webkit.org/show_bug.cgi?id=167200 <rdar://problem/30096323> Reviewed by Darin Adler. The issue is that FormSubmission::create() was iterating over form.associatedElements() as was calling Element::appendFormData() in the loop. HTMLObjectElement::appendFormData() was calling pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous layout and can fire events (such as focus event) synchronously. Firing those events synchronously allows the JS to modify the form.associatedElements() vector we are currently iterating on. To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad) in HTMLObjectElement::appendFormData() as we are not allowed to fire synchronous events at this point. I also added a security assertion in FormSubmission::create() to catch cases where we fire JS events while iterating over the form associated elements to more easily notice these things in the future. Test: fast/forms/formsubmission-appendFormData-crash.html * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::appendFormData): * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): 2017-02-10 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix. * dom/Document.cpp: (WebCore::Document::adoptNode): isConnected -> inDocument. 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Rollout r212118. rdar://problem/30096323 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Merge r212026. rdar://problem/30096323 2017-02-09 Chris Dumez <cdumez@apple.com> Crash under FormSubmission::create() https://bugs.webkit.org/show_bug.cgi?id=167200 <rdar://problem/30096323> Reviewed by Darin Adler. The issue is that FormSubmission::create() was iterating over form.associatedElements() as was calling Element::appendFormData() in the loop. HTMLObjectElement::appendFormData() was calling pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous layout and can fire events (such as focus event) synchronously. Firing those events synchronously allows the JS to modify the form.associatedElements() vector we are currently iterating on. To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad) in HTMLObjectElement::appendFormData() as we are not allowed to fire synchronous events at this point. I also added a security assertion in FormSubmission::create() to catch cases where we fire JS events while iterating over the form associated elements to more easily notice these things in the future. Test: fast/forms/formsubmission-appendFormData-crash.html * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::appendFormData): * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Merge r211495. rdar://problem/30106362 2017-02-01 Jer Noble <jer.noble@apple.com> NULL-deref crash in TextTrack::removeCue() https://bugs.webkit.org/show_bug.cgi?id=167615 Reviewed by Eric Carlson. Test: http/tests/media/track-in-band-hls-metadata-crash.html Follow-up to r211401. When passing around a reference to an object, the assumption is that the caller is retaining the underlying object. This breaks down for InbandDataTextTrack::removeDataCue(), which releases its own ownership of the cue object, then passes the reference to that object to its superclass to do further remove steps. The retain count of the cue can thus drop to zero within the scope of InbandTextTrack::removeCue(). Use "take" semantics to remove the cue from the m_incompleteCueMap without releasing ownership, and pass a reference to that retained object on to removeCue(), guaranteeing that the cue will not be destroyed until after the romeveDataCue() method returns. * html/track/InbandDataTextTrack.cpp: (WebCore::InbandDataTextTrack::removeDataCue): 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Merge r211650. rdar://problem/30268004 2017-02-03 Jeremy Jones <jeremyj@apple.com> Pointer lock events should be delivered directly to the target element https://bugs.webkit.org/show_bug.cgi?id=167134 rdar://problem/30268004 Reviewed by Dean Jackson. pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests. When pointer is locked on an element, route mouse events directly to the target element, instead of doing the normal event disptach. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDoubleClickEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::handleMouseForceEvent): (WebCore::EventHandler::handleWheelEvent): * page/PointerLockController.cpp: (WebCore::PointerLockController::isLocked): Added. (WebCore::PointerLockController::dispatchLockedWheelEvent): Added. * page/PointerLockController.h: 2017-02-10 Matthew Hanson <matthew_hanson@apple.com> Merge r211375. rdar://problem/30268004 2017-01-30 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rollout r211235 Pointer lock events should be delivered directly to the target element. The LayoutTest for this change is frequently failing. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDoubleClickEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::handleMouseForceEvent): (WebCore::EventHandler::handleWheelEvent): * page/PointerLockController.cpp: (WebCore::PointerLockController::isLocked): Deleted. (WebCore::PointerLockController::dispatchLockedWheelEvent): Deleted. * page/PointerLockController.h: 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r212029. rdar://problem/30376972 2017-02-09 Chris Dumez <cdumez@apple.com> Make sure Event keeps its current target element alive https://bugs.webkit.org/show_bug.cgi?id=167885 <rdar://problem/30376972> Reviewed by Brent Fulgham. Make sure Event keeps its current target element alive to avoid crashes if it is accessed by JS after it has been garbage collected. Test: fast/events/currentTarget-gc-crash.html * dom/Event.cpp: (WebCore::Event::setCurrentTarget): * dom/Event.h: (WebCore::Event::currentTarget): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r212028. rdar://problem/30234133 2017-02-09 Ryosuke Niwa <rniwa@webkit.org> Crash in render tree after dynamically mutating the slot value https://bugs.webkit.org/show_bug.cgi?id=167502 Reviewed by Antti Koivisto. The crash was caused by attributeChanged not destructing the render tree after an assigned element had been removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to delete its render object as if the element had been removed from the DOM tree. Tests: fast/html/details-summary-slot.html fast/shadow-dom/shadow-slot-attribute-change-crash.html * dom/Element.cpp: (WebCore::Element::attributeChanged): * html/HTMLSummaryElement.cpp: (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value. (WebCore::HTMLSummaryElement::create): Use SummarySlotElement 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r212027. rdar://problem/30145076 2017-02-09 Antti Koivisto <antti@apple.com> Details element doesn't work correctly when mutating content between closing and opening https://bugs.webkit.org/show_bug.cgi?id=167310 Reviewed by Ryosuke Niwa. Tests: fast/html/details-close-modify-open.html fast/shadow-dom/slot-remove-mutate-add.html * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::didChangeSlot): Always reset the slot assignment when content is mutated. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r212025. rdar://problem/30076615 2017-02-09 Chris Dumez <cdumez@apple.com> Crash under HTMLFormElement::registerFormElement() https://bugs.webkit.org/show_bug.cgi?id=167162 Reviewed by Ryosuke Niwa. didMoveToNewDocument() was re-registering FormAttributeTargetObserver even if the element's inDocument was not set yet. As a result, it was possible for FormAssociatedElement::resetFormOwner() to be called when the element was in the tree but with its inDocument still being false (because insertedInto() has not been called yet). This could end up calling HTMLFormElement::registerFormElement() even though the element is still recognized as detached. This is an issue because HTMLFormElement::m_associatedElements's order and its corresponding indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex) rely on the position of the element with regards to the form element (before / inside / after). To address the issue, we now only register the FormAttributeTargetObserver in didMoveToNewDocument() if the inDocument flag is set to true. This is similar to what is done at other call sites of resetFormAttributeTargetObserver(). We also ignore the form content attribute in HTMLFormElement::formElementIndex() if the element is not connected. As per the HTML specification [1], the form content attribute is only taken if the element is connected (i.e. inDocument flag is true). Note that FormAssociatedElement::findAssociatedForm() was already ignoring the form content attribute if the element is disconnected. [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3) Test: fast/forms/registerFormElement-crash.html * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::didMoveToNewDocument): Only call resetFormAttributeTargetObserver() if inDocument flag is set, similarly to what is done at other call sites. (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver): Add an assertion to make sure no one call this method on an element that is not connected. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::formElementIndex): Ignore the form content attribute if the element is not connected, as per the HTML specification [1]. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r212024. rdar://problem/30051227 2017-02-09 Antti Koivisto <antti@apple.com> Tear down existing renderers when adding a shadow root. https://bugs.webkit.org/show_bug.cgi?id=167117 Reviewed by Andreas Kling. Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers tear down code would no longer reach them. Test: fast/shadow-dom/attach-shadow-teardown.html * dom/Element.cpp: (WebCore::Element::addShadowRoot): Tear down existing render tree when adding a shadow root. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r212023. rdar://problem/30041640 2017-02-09 Brent Fulgham <bfulgham@apple.com> Handle synchronous layout when setting a selection range https://bugs.webkit.org/show_bug.cgi?id=167092 <rdar://problem/30041640> Reviewed by Antti Koivisto. The 'innerTextElement' of a form control can change during layout due to arbitrary JavaScript executing. Handle the case where the inner text element has changed so that current render box height is while setting a selection range. Test: fast/forms/input-type-change-during-selection.html * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211999. rdar://problem/29930443 2017-02-09 Brent Fulgham <bfulgham@apple.com> Disconnect shadow children of root when detaching a frame https://bugs.webkit.org/show_bug.cgi?id=166851 <rdar://problem/29930443> Reviewed by Andy Estes. If the root of the tree we are disconnecting has a shadow element, include it in the set of things to disconnect. Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html * dom/ContainerNodeAlgorithms.cpp: (WebCore::disconnectSubframes): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211966. rdar://problem/30149422 2017-02-09 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r211965. * dom/Document.cpp: (WebCore::Document::adoptNode): inDocument -> isConnected 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211965. rdar://problem/30149422 2017-02-09 Ryosuke Niwa <rniwa@webkit.org> Adopting a child node of a script element can run script https://bugs.webkit.org/show_bug.cgi?id=167318 Reviewed by Darin Adler. The bug was caused by ScriptElement::childrenChanged indiscriminately running the script. Do this only if some node has been inserted as spec'ed: https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model "The script element is connected and a node or document fragment is inserted into the script element, after any script elements inserted at that time." Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate non-contents child such as text and element being removed or inserted. New behavior matches that of Gecko and Chrome as well as the latest HTML5 specification. Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's ensureCustomFontData used to completely disable this assertion but we no longer have to do this either. To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent held by EventAllowedScope. Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed Tests: fast/html/script-must-not-run-when-child-is-adopted.html fast/html/script-must-not-run-when-child-is-removed.html * dom/CharacterData.cpp: (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion. * dom/ContainerNode.cpp: (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded and insertBeforeCommon as done elsewhere. (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion. (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here. (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion. (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion. (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion. (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion. (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion. (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into NoEventDispatchAssertion. (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely. (WebCore::dispatchChildRemovalEvents): Ditto. * dom/ContainerNode.h: (WebCore::ContainerNode::ChildChange::isInsertion): Added. * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against insertionPoint since EventAllowedScope checks against the root node. * dom/Document.cpp: (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else remove() had resulted in an exception before calling TreeScope::adoptIfNeeded. * dom/Element.cpp: (WebCore::Element::childrenChanged): * dom/NoEventDispatchAssertion.h: (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node. If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider the event dispatch to be forbidden. (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted. (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted. (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of a given node as "safe" for the purpose of checking isEventDispatchForbidden. (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated RAII object, and each instance remembers prior instance. (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added. (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given node is a descendent of any node held by instances of EventAllowedScope. (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function for isAllowedNode. * dom/Node.cpp: (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely. * dom/ScriptElement.cpp: (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes. (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running arbitrary author scripts can, indeed, result dispatch any events. * dom/ScriptElement.h: * html/HTMLElement.cpp: (WebCore::textToFragment): Made this a static local function and not return an exception since there is no way appendChild called in this function can throw an exception. (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts. Because of the precise-ness of this check, this does not disable the assertion for "this" element. HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark the shadow tree into which the fragment is inserted safe. (WebCore::HTMLElement::setOuterText): * html/HTMLElement.h: * html/HTMLScriptElement.cpp: (WebCore::HTMLScriptElement::childrenChanged): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText). * html/track/VTTCue.cpp: (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since the VTT tree is never exposed to author scripts. (WebCore::VTTCue::updateDisplayTree): Ditto. * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on the new SVG document we just created instead of disabling for all DOM trees. * svg/SVGScriptElement.cpp: (WebCore::SVGScriptElement::childrenChanged): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211763. rdar://problem/30380075 2017-02-06 Brent Fulgham <bfulgham@apple.com> Correct File Path Handling in SecurityOrigin and FileSystem https://bugs.webkit.org/show_bug.cgi?id=167894 <rdar://problem/30380080> Reviewed by Alexey Proskuryakov. Roll out the URL decoding being done in the FileSystem class (added in Bug 167894), and instead ensure that SecurityOrigin properly handles file URLs, and only passes valid file strings to the FileSystem interface. Tested by FileSystemTests and SecurityOriginTests in TestWebKitAPI. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): Initialize m_filePath using the url's fileSystemPath, not the %-encoded 'path' property. (WebCore::SecurityOrigin::canDisplay): Pass the 'fileSystemPath' to 'filesHaveSameVolume', rather than the %-encoded 'path' property. * page/SecurityOrigin.h: * platform/FileSystem.cpp: (WebCore::filesHaveSameVolume): Do not use 'decodeURLEscapeSequences' in 'filesHaveSameVolume'. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211382. rdar://problem/29738514 2017-01-30 Myles C. Maxfield <mmaxfield@apple.com> Correct spacing regression on inter-element complex path shaping on some fonts https://bugs.webkit.org/show_bug.cgi?id=166013 Reviewed by Simon Fraser. This patch brings the implementation of ComplexTextController in-line with the design at https://trac.webkit.org/wiki/ComplexTextController. Previously, ComplexTextController had a few problems: - The total width computed by ComplexTextController didn't match the width if you iterated over the entire string and added up the advances - FontCascade::getGlyphsAndAdvancesForComplexText() tried to compensate for the above by construing the concepts of paint advances as distinct from layout advances - Initial advances were considered part of layout sometimes and part of painting other times, depending on which function reports the information - For RTL runs, the wrong origin was added to the initial advance, and the origin should have been subtracted instead of added This patch exhaustively updates every function in ComplexTextController to be consistent with the design linked to above. This design solves all of these problems. Tests: ComplexTextControllerTest.InitialAdvanceWithLeftRunInRTL ComplexTextControllerTest.InitialAdvanceInRTL ComplexTextControllerTest.InitialAdvanceWithLeftRunInLTR ComplexTextControllerTest.InitialAdvanceInLTR ComplexTextControllerTest.InitialAdvanceInRTLNoOrigins ComplexTextControllerTest.LeadingExpansion ComplexTextControllerTest.VerticalAdvances * platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::setLeadingExpansion): Deleted. No longer necessary. (WebCore::GlyphBuffer::leadingExpansion): Deleted. Ditto. * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::FontCascade::adjustSelectionRectForComplexText): Removed use of unnecessary leadingExpansion(). (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText): This function needs to compute paint advances, which means that it can't base this information off of layout advances. This function uses the trick mentioned at the end of the above link to compute the paint offset of an arbitrary glyph in the middle of an RTL run. * platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::computeExpansionOpportunity): Refactored for testing. (WebCore::ComplexTextController::ComplexTextController): Ditto. (WebCore::ComplexTextController::finishConstruction): Ditto. (WebCore::ComplexTextController::offsetForPosition): This function operates on layout advances, and the initial layout advance is already added into the m_adjustedBaseAdvances vector by adjustGlyphsAndAdvances(). Therefore, there is no need to add it again here. (WebCore::ComplexTextController::advance): This function had completely busted logic about the relationship between initial advances and the first origin in each run. Because of the fortunate choice of only representing layout advances in m_adjustedBaseAdvances, this entire block can be removed and the raw paint initial advance can be reported to the GlyphBuffer. Later in the function, we have to update the logic about how to compute a paint advance given a layout advance and some origins. In particular, there are two tricky pieces here: 1. The layout advance for the first glyph is equal to (initial advance - first origin + first Core Text advance, so computing the paint offset must cancel out the initial layout offset, and 2. the last paint advance in a run must actually end up at the position of the first glyph in the next run, so the next run's initial advance must be queried. (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Previously, we represented an initial advance of a successive run by just adding it to the previous run's last advance. However, this is incompatible with the new model presented in the link above, so we remove this section. We also have to add in the logic that the layout advance for the first glyph is equal to the formula presented above. * platform/graphics/mac/ComplexTextController.h: (WebCore::ComplexTextController::ComplexTextRun::initialAdvance): Adjust comment to reflect reality. (WebCore::ComplexTextController::leadingExpansion): Deleted. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211957. rdar://problem/30029354 2017-02-09 Antti Koivisto <antti@apple.com> Nullptr crash under styleForFirstLetter https://bugs.webkit.org/show_bug.cgi?id=167756 rdar://problem/30029354 Reviewed by Zalan Bujtas. Don't know how we get here. Paper over the crash. * rendering/RenderBlock.cpp: (WebCore::styleForFirstLetter): Use parent first line style if we compute null style for the first letter renderer. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211949. rdar://problem/30119483 2017-02-09 Andreas Kling <akling@apple.com> Disallow accelerated rendering for ginormous 2D canvases. <https://webkit.org/b/167968> <rdar://problem/30119483> Reviewed by Antti Koivisto. Add a "maximumAccelerated2dCanvasSize" setting that defaults to 5120x2880 which is the 5K resolution for 16:9. Also added a way to include the "accelerates drawing" flag in layer tree dumps. Test: compositing/canvas/accelerated-canvas-compositing-size-limit.html * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::shouldAccelerate): * page/Frame.h: * page/Settings.in: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpProperties): * platform/graphics/GraphicsLayerClient.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::layerTreeAsText): * testing/Internals.cpp: (WebCore::toLayerTreeFlags): * testing/Internals.h: * testing/Internals.idl: 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211926. rdar://problem/30275036 2017-02-08 Youenn Fablet <youennf@gmail.com> HTML Link elements should load data URLs as same origin https://bugs.webkit.org/show_bug.cgi?id=168032 <rdar://problem/30275036> Reviewed by Alex Christensen. Test: fast/dom/data-url-css-link-element-cors-active.html Making CSS data URLs resources considered as same origin when loaded through link elements. In the future, we should consider remove the data URL same origin flag and fully align with the fetch and HTML spec. * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211913. rdar://problem/28062149 2017-02-08 Sam Weinig <sam@webkit.org> REGRESSION (r193286): Promise chain no longer prevent UI refresh <rdar://problem/28062149> https://bugs.webkit.org/show_bug.cgi?id=161291 Reviewed by Geoffrey Garen. Add new subtest to js/dom/Promise.html * dom/Microtasks.cpp: (WebCore::MicrotaskQueue::append): (WebCore::MicrotaskQueue::remove): (WebCore::MicrotaskQueue::performMicrotaskCheckpoint): * dom/Microtasks.h: The microtask queue needs to be completely drained, even of new microtasks added while the previous task was run. Remove the m_tasksAppendedDuringMicrotaskCheckpoint as it is no longer needed. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211895. rdar://problem/30129966 2017-02-08 Brady Eidson <beidson@apple.com> Opt-out iBooks from synchronous willSendRequest on iOS. <rdar://problem/30129966> and https://bugs.webkit.org/show_bug.cgi?id=168006 Reviewed by Brent Fulgham. No new tests (Not a testable behavior change at this time). * platform/network/mac/ResourceHandleMac.mm: (WebCore::synchronousWillSendRequestEnabled): iBooks never gets synchronous willSendRequest: 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211845. rdar://problem/30187368 2017-02-06 Ryosuke Niwa <rniwa@webkit.org> WebContent process repeatedly jetsams on BuzzFeed's Another Round page https://bugs.webkit.org/show_bug.cgi?id=167830 <rdar://problem/30187368> Reviewed by Simon Fraser. The jetsams on https://www.buzzfeed.com/anotherround were caused by WebKit creating the backing store for every iframe's layer on the page regardless of whether they're in the viewport or not. This was caused by GraphicsLayerCA's setVisibleAndCoverageRects not setting CoverageRectChanged on m_uncommittedChanges on the very first call. Fixed the bug by initializing m_uncommittedChanges to always have CoverageRectChanged so that the coverage rect would get updated properly. Unfortunately, no new tests since somehow the backing store doesn't get created inside the test runner. * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211835. rdar://problem/27439617 2017-02-07 Alex Christensen <achristensen@webkit.org> Revert r166597 https://bugs.webkit.org/show_bug.cgi?id=167951 Reviewed by Andreas Kling. * platform/spi/cf/CFNetworkSPI.h: Remove now-unused SPI declaration. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211758. rdar://problem/30096129 2017-02-06 Youenn Fablet <youennf@gmail.com> Allow some schemes to opt-out of CORS https://bugs.webkit.org/show_bug.cgi?id=167795 Reviewed by Alex Christensen. Test: http/tests/security/bypassing-cors-checks-for-extension-urls.html Adding the possibility to opt out of CORS for DocumentThreadableLoader clients (fetch and XHR). This is made specific to the case of user extension URLs for pages running user scripts. Introducing a boolean flag in Page for that purpose. Introducing a helper routine in SchemeRegistry to centralize the various user script extension schemes. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): * page/Frame.cpp: (WebCore::Frame::injectUserScripts): * page/Page.h: (WebCore::Page::setAsRunningUserScripts): (WebCore::Page::isRunningUserScripts): * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::isUserExtensionScheme): * platform/SchemeRegistry.h: * testing/Internals.cpp: (WebCore::Internals::setAsRunningUserScripts): * testing/Internals.h: * testing/Internals.idl: 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211746. rdar://problem/30107622 2017-02-06 Jer Noble <jer.noble@apple.com> Playback stalls when a SourceBuffer append causes frame eviction https://bugs.webkit.org/show_bug.cgi?id=167834 Reviewed by Eric Carlson. Test: PerformanceTests/Media/MSERemoveCodedFrames.html Optimize searching through SampleMap by presentationTime. Many of the methods exposed by PresentationOrderSampleMap used the bare std::equal_range, lower_bound, or upper_bound methods. Unlike those methods exposed on std::map, the bare search methods perform a linear O(n) search, rather than a the binary O(log(n)) search used by std::map. Rewrite those methods using the bare methods in terms of the std::map search methods. Drive-by fix: rename findSampleOnOrAfterPresentationTime to findSampleStartingOnOrAfterPresentationTime to make the behavior of the method more explicit. * Modules/mediasource/SampleMap.cpp: (WebCore::PresentationOrderSampleMap::findSampleContainingPresentationTime): (WebCore::PresentationOrderSampleMap::findSampleStartingOnOrAfterPresentationTime): (WebCore::PresentationOrderSampleMap::reverseFindSampleBeforePresentationTime): (WebCore::DecodeOrderSampleMap::findSyncSampleAfterPresentationTime): (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimes): (WebCore::PresentationOrderSampleMap::findSamplesWithinPresentationRange): (WebCore::PresentationOrderSampleMap::findSampleOnOrAfterPresentationTime): Deleted. * Modules/mediasource/SampleMap.h: (WebCore::PresentationOrderSampleMap::begin): (WebCore::PresentationOrderSampleMap::end): (WebCore::PresentationOrderSampleMap::rbegin): (WebCore::PresentationOrderSampleMap::rend): (WebCore::DecodeOrderSampleMap::begin): (WebCore::DecodeOrderSampleMap::end): (WebCore::DecodeOrderSampleMap::rbegin): (WebCore::DecodeOrderSampleMap::rend): (WebCore::SampleMap::SampleMap): (WebCore::SampleMap::sizeInBytes): (WebCore::SampleMap::decodeOrder): (WebCore::SampleMap::presentationOrder): * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): (WebCore::SourceBuffer::removeCodedFrames): (WebCore::SourceBuffer::reenqueueMediaForTime): * WebCore.xcodeproj/project.pbxproj: 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211730. rdar://problem/30251840 2017-02-06 Antti Koivisto <antti@apple.com> CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Node::invalidateStyle https://bugs.webkit.org/show_bug.cgi?id=167878 rdar://problem/30251840 Reviewed by Andreas Kling. Speculative fix. We are trying to invalidate a null node from ~PostResolutionCallbackDisabler. Looks like the only way this could happen is if HTMLFrameOwnerElement::scheduleinvalidateStyleAndLayerComposition is called with null 'this'. There is one place where this might happen. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::attachRootLayer): Add null check. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211667. rdar://problem/28193222 2017-02-03 Myles C. Maxfield <mmaxfield@apple.com> REGRESSION(r204858): Synthetic bold text in vertical writing mode is rotated away from original text https://bugs.webkit.org/show_bug.cgi?id=167826 <rdar://problem/28193222> Reviewed by Zalan Bujtas. When drawing vertical text, the rotation is not reset between successive paint calls. We implement synthetic bold by drawing text twice, which means that the second draw call was getting rotated twice. This was an oversight in r204858. Test: fast/text/synthetic-bold-vertical-text.html * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::showGlyphsWithAdvances): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211663. rdar://problem/30343810 2017-02-03 Jeremy Jones <jeremyj@apple.com> WK1 mouse events are missing movementX and movementY for pointerlock. https://bugs.webkit.org/show_bug.cgi?id=167775 rdar://problem/30343810 Reviewed by Alexey Proskuryakov. pointer-lock/mouse-event-delivery.html Improve mouse-event-delivery.html test to mouse move and check for valid movementX and movementY. * platform/mac/PlatformEventFactoryMac.mm: (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): WK1 plumb throuhg movementX and movementY 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211625. rdar://problem/29168795 2017-02-03 Antti Koivisto <antti@apple.com> WebContent crash when pasting into input fields at com.apple.WebCore: WebCore::ResourceRequestBase::url const + 9 https://bugs.webkit.org/show_bug.cgi?id=167787 rdar://problem/29168795 Reviewed by Andreas Kling. No test, don't know how to get here. * page/animation/CSSPropertyAnimation.cpp: (WebCore::crossfadeBlend): Null check. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211622. rdar://problem/30116072 2017-02-02 Andreas Kling <akling@apple.com> [Mac] In-process memory pressure monitor for WebContent processes AKA websam <https://webkit.org/b/167491> <rdar://problem/30116072> Reviewed by Antti Koivisto. Add a new timer-based memory pressure monitor that checks the process memory footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy. There are four MemoryUsagePolicy values: - Unrestricted (below 1GB) - Conservative (above 1GB) - Strict (above 2GB) - Panic (above 4GB, or 3GB if 32-bit) For Strict and above, the old-style "isUnderMemoryPressure()" API will return true. Transitioning to a higher policy will cause memory pressure handlers to run: At Strict, we run the "non-critical" memory pressure handler, then carry on. At Panic, we run the "critical" memory pressure handler. If that fails to recover enough memory to bring us back below 4GB, we may kill the process: A process is eligible to get killed for using too much memory if: - It's not visible on screen (i.e it's a background tab.) - It's not playing audio. - It has not performed a main frame navigation in the last hour. Before killing the process, an exit-time callback will run. This patch installs such a callback that prints out some time-of-death statistics about C++ and JavaScript memory usage to hopefully help understand what was soaking up all the memory. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): * loader/FrameLoader.cpp: (WebCore::FrameLoader::setState): * page/MainFrame.cpp: (WebCore::MainFrame::didCompleteLoad): * page/MainFrame.h: * page/MemoryRelease.cpp: (WebCore::pageCount): (WebCore::logMemoryStatisticsAtTimeOfDeath): (WebCore::didExceedMemoryLimitAndFailedToRecover): (WebCore::processIsEligibleForMemoryKill): * page/MemoryRelease.h: * page/ResourceUsageThread.h: * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::vmPageSize): * platform/MemoryPressureHandler.cpp: (WebCore::MemoryPressureHandler::MemoryPressureHandler): (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor): (WebCore::toString): (WebCore::thresholdForPolicy): (WebCore::policyForFootprint): (WebCore::MemoryPressureHandler::measurementTimerFired): * platform/MemoryPressureHandler.h: (WebCore::MemoryPressureHandler::setMemoryKillCallback): (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback): (WebCore::MemoryPressureHandler::isUnderMemoryPressure): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211621. rdar://problem/30221102 2017-02-02 Alex Christensen <achristensen@webkit.org> URLParser: Fix parsing invalid IPv4 addresses with non-ASCII characters https://bugs.webkit.org/show_bug.cgi?id=167773 <rdar://problem/30221102> Reviewed by Ryosuke Niwa. If an invalid IPv4 address contains the first syntaxViolation (difference between input and canonicalized URL), an iterator is used to calculate how far we have parsed in the input string to copy all the syntax-violation-free characters into a Vector. If a URL contains only ASCII that doesn't contain anything percent-encoded in the host, there is a fast path to parse ASCII hosts. All my existing invalid IPv4 tests followed this path. If there is a non-ASCII character, we need to use an iterator to the original string instead of an iterator to the string after converting the input string's host to ASCII. Covered by a new API test which used to RELEASE_ASSERT. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211613. rdar://problem/30132707 2017-02-02 Wenson Hsieh <wenson_hsieh@apple.com> CrashTracer: [USER] com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::URL::host const + 9 https://bugs.webkit.org/show_bug.cgi?id=167766 <rdar://problem/30132707> Reviewed by Chris Dumez. The mainframe's document pointer may be null when tearing down a page upon navigation to a page that is in the page cache. If this triggers a GC sweep, we will attempt to reload touch bar media controls, which (as a part of the media controller heuristic) checks the mainframe's document URL to see if quirks should be enabled. This assumes that the mainframe's document exists, which is not a safe assumption if page navigation is occurring. As such, we need a null check for the mainframe's document in needsPlaybackControlsManagerQuirk(). No test, as we were unable to reproduce this crash. * html/HTMLMediaElement.cpp: (WebCore::needsPlaybackControlsManagerQuirk): 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211564. rdar://problem/29012252 2017-02-02 Antti Koivisto <antti@apple.com> Column progression wrong after enabling pagination on RTL document https://bugs.webkit.org/show_bug.cgi?id=167733 <rdar://problem/29012252> Reviewed by Zalan Bujtas. Column progression depends on document direction but was not updated when direction changed. Test: fast/multicol/pagination/pagination-dynamic-rtl.html * rendering/RenderBox.cpp: (WebCore::RenderBox::styleDidChange): Update column styles if document direction changes. 2017-02-09 Matthew Hanson <matthew_hanson@apple.com> Merge r211254. rdar://problem/30188490 2017-01-26 Chris Dumez <cdumez@apple.com> Crash when navigating back to a page in PacheCache when one of its frames has been removed https://bugs.webkit.org/show_bug.cgi?id=167421 <rdar://problem/30188490> Reviewed by Darin Adler. Disallow page caching of a page if: 1. The main window has an opener (i.e. it was opened via window.open) 2. It has ever used window.open() This is because allowing page caching in this case would allow such windows to script each other even after one of them entered Page Cache. Allowing this is dangerous and easily causes crashes. This is a short term workaround until we find a better solution to the problem. One issue is this workaround is that navigating back to a page that has an opener or used window.open() will not longer get the page from PageCache. As a result, state may be lost upon navigating back. However, we never guarantee that pages get page cached, and Chrome does not have a PageCache. Tests: fast/history/page-cache-after-window-open.html fast/history/page-cache-back-navigation-crash.html fast/history/page-cache-with-opener.html * dom/Document.cpp: (WebCore::Document::hasEverCalledWindowOpen): (WebCore::Document::markHasCalledWindowOpen): * dom/Document.h: * history/PageCache.cpp: (WebCore::canCachePage): * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): (WebCore::DiagnosticLoggingKeys::hasOpenerKey): * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::openedByWindowOpen): * page/Page.h: * page/Settings.in: 2017-02-06 Matthew Hanson <matthew_hanson@apple.com> Merge r211653. rdar://problem/29872943 2017-02-03 Chris Dumez <cdumez@apple.com> Dismiss HTML form validation popover when pressing Escape key https://bugs.webkit.org/show_bug.cgi?id=167716 <rdar://problem/29872943> Reviewed by Simon Fraser. Dismiss any visible HTML form validation popover when pressing the Escape key. Test: fast/forms/validation-bubble-escape-key-dismiss.html * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): * page/ValidationMessageClient.h: 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211504. rdar://problem/30301117 2017-02-01 Chris Dumez <cdumez@apple.com> REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw https://bugs.webkit.org/show_bug.cgi?id=167681 <rdar://problem/30301117> Reviewed by Mark Lam. As per https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-): """ If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. """ We now implement this behavior instead of throwing. Test: http/tests/security/symbols-cross-origin.html * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): * bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::getOwnPropertySlotDelegate): 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211659. rdar://problem/28725791 2017-02-03 Jer Noble <jer.noble@apple.com> ASSERT in HTMLMediaElement::~HTMLMediaElement https://bugs.webkit.org/show_bug.cgi?id=167818 Reviewed by Brent Fulgham. Test: media/audio-dealloc-crash.html HTMLMediaElement's MediaElementSession can nominate the HTMLMediaElement itself to become the playback controls session from inside the HTMLMediaElement destructor. Protect against this by clearing out the session before calling updatePlaybackControlsManager(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211676. rdar://problem/30229990 2017-02-04 Chris Dumez <cdumez@apple.com> Unreviewed, fix mistake in comment added in r211569. * history/PageCache.cpp: (WebCore::PageCache::removeAllItemsForPage): 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211569. rdar://problem/30229990 2017-02-02 Chris Dumez <cdumez@apple.com> [Crash] com.apple.WebKit.WebContent at WebKit: WebKit::WebPage::fromCorePage() https://bugs.webkit.org/show_bug.cgi?id=167738 <rdar://problem/30229990> Reviewed by Andreas Kling. Upon destruction of a Page, we destroy the BackForwardClient, which is supposed to keep track of HistoryItems associated to this particular page and remove them from the PageCache. Given the crash trace, the issue seems to be that some HistoryItems associated with the Page sometimes linger in the PageCache *after* the Page has been destroyed, which leads to crashes later on when pruning the PageCache. In order to make the process more robust, this patch refactors the code so that the Page is now in charge of removing all its associated HistoryItems from the PageCache instead of relying on the BackForwardClient. Also, instead of having the Page keep track of which HistoryItems are associated with it (which is error prone), we now scan all PageCache entries instead to find which ones are associated with the Page. While this is in theory slower, this is much safer and in practice not an issue because the PageCache usually has 3-5 entries. No new tests, could not reproduce. * history/CachedPage.cpp: (WebCore::CachedPage::CachedPage): * history/CachedPage.h: (WebCore::CachedPage::page): * history/PageCache.cpp: (WebCore::PageCache::removeAllItemsForPage): * history/PageCache.h: * page/Page.cpp: (WebCore::Page::~Page): 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211551. rdar://problem/26685576 2017-02-02 Yongjun Zhang <yongjun_zhang@apple.com> In iOS, we should take background assertion when accessing localstorage databases. https://bugs.webkit.org/show_bug.cgi?id=165478 Move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore so that it can be accessible from WebKit1 and WebKit2. Previously, to avoid dependencies on UIKit, WebKitLegacy introduced several global methods for UIKit to setup the start/end background task blocks on runtime (WebKitSetStartBackgroundTaskBlock, WebKitSetInvalidWebBackgroundTaskIdentifier and WebKitSetEndBackgroundTaskBlock). Since we have to move the background task handling to WebCore, to avoid adding WebCore dependencies on UIKit, this patch introdues a new WebCore class WebBackgroundTaskController which holds the start/end background task blocks. The existing WebKitSetStartBackgroundTaskBlock and WebKitSetEndBackgroundTaskBlock methods in WebKit1 will use WebBackgroundTaskController to store the blocks set by UIKit. Reviewed by Brady Eidson. No new test since this is code refactoring. * WebCore.xcodeproj/project.pbxproj: Add a new class WebBackgroundTaskController to the project. Also move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore. * platform/ios/WebBackgroundTaskController.h: Use properties to hold the blocks for starting or ending background tasks. * platform/ios/WebBackgroundTaskController.mm: (+[WebBackgroundTaskController sharedController]): (-[WebBackgroundTaskController dealloc]): (-[WebBackgroundTaskController startBackgroundTaskWithExpirationHandler:]): Start a background task with a expiration handler; to start the background task, we will use backgroundTaskStartBlock set up by UIKit. (-[WebBackgroundTaskController endBackgroundTaskWithIdentifier:]): Call backgroundTaskEndBlack to end a background task. * platform/ios/WebSQLiteDatabaseTrackerClient.h: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h. * platform/ios/WebSQLiteDatabaseTrackerClient.mm: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm. (WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient): Make WebSQLiteDatabaseTrackerClient a singleton. (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient): (WebCore::WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient): (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction): Use a utility class WebDatabaseTransactionBackgroundTaskController to schedule database transaction background task. (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction): Use WebDatabaseTransactionBackgroundTaskController to stop databas transaction background task. (transactionBackgroundTaskIdentifierLock: Moved from Source/WebKit/mac/Storage/WebDatabaseManager.mm. (setTransactionBackgroundTaskIdentifier): Ditto. (getTransactionBackgroundTaskIdentifier): Ditto. (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]): Ditto. (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]): Ditto. 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211446. rdar://problem/30273885 2017-01-31 Anders Carlsson <andersca@apple.com> Apple Pay button does nothing on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=167664 rdar://problem/30273885 Reviewed by Sam Weinig. Separate line item validation into convertAndValidateTotal and convertAndValidate. The former works on totals (which require an amount), and the latter works on regular line items that do not require an amount if the item type is "pending". * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidateTotal): (WebCore::convertAndValidate): Only check the amount if the type is not pending. (WebCore::ApplePaySession::completeShippingMethodSelection): (WebCore::ApplePaySession::completeShippingContactSelection): (WebCore::ApplePaySession::completePaymentMethodSelection): Call convertAndValidateTotal for totals. 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211455. rdar://problem/30241193 2017-01-31 Chris Dumez <cdumez@apple.com> com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::FrameView::didDestroyRenderTree https://bugs.webkit.org/show_bug.cgi?id=167665 <rdar://problem/30241193> Reviewed by Andreas Kling. When destroying a PageCache entry, we would call Document::prepareFromDestruction() which would destroy the render tree and then call FrameView::didDestroyRenderTree(). We would sometimes hit the ASSERT(m_widgetsInRenderTree.isEmpty()) assertion in didDestroyRenderTree(). This indicates that there are still RenderWidgets associated with the FrameView even though we claim we already destroyed the render tree. The reason for this is that, in the PageCache context, the top document's frame is reused on navigation and may not be associated with a new document that is currently displayed, has a render tree (and possible RenderWidgets). The solution proposed is to stop calling FrameView::didDestroyRenderTree() in Document::prepareFromDestruction() if the frame's document is not |this|. This happens when the document is destroyed while in PageCache. We do not want to mess with the frame / frameview in this case since they are no longer associated to the present document anymore. No new tests, already covered by existing tests which currently crash flakily. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): 2017-02-05 Matthew Hanson <matthew_hanson@apple.com> Merge r211656. rdar://problem/30102568 2017-02-03 Daniel Bates <dabates@apple.com> [Mac][WK2] Add SPI to override the Content Security Policy of a page https://bugs.webkit.org/show_bug.cgi?id=167810 <rdar://problem/30102568> Reviewed by Anders Carlsson. * dom/Document.cpp: (WebCore::Document::initSecurityContext): Apply the embedding client's override Content Security Policy to the document if one exists. * loader/FrameLoaderClient.h: Add function overrideContentSecurityPolicy() that a FrameLoaderClient can override to provide a custom Content Security Policy for a document (defaults: null string - no policy). As its name implies, the policy returned by overrideContentSecurityPolicy() will define the Content Security Policy for the document, overriding any subsequently received Content Security Policy for the document. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::copyStateFrom): Only copy policies from the specified ContentSecurityPolicy object if our policy was not specified by the embedding client. (WebCore::ContentSecurityPolicy::didReceiveHeader): Set ContentSecurityPolicy::m_hasAPIPolicy to true when we receive an API policy from the embedding client (ContentSecurityPolicy::PolicyFrom::API). An API policy must be defined before a policy received from a document. Do not process a received header if we already have an API policy as the API policy overrides all other policies. * page/csp/ContentSecurityPolicy.h: 2017-02-02 Matthew Hanson <matthew_hanson@apple.com> Merge r211541. rdar://problem/30100286 2017-02-01 Simon Fraser <simon.fraser@apple.com> [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible https://bugs.webkit.org/show_bug.cgi?id=167710 rdar://problem/30100286 Reviewed by Wenson Hsieh. Add a bit of logging to show when RLC decides to not composite a fixed element which is out of bounds. Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): 2017-02-02 Matthew Hanson <matthew_hanson@apple.com> Merge r211471. rdar://problem/30270210 2017-01-31 Wenson Hsieh <wenson_hsieh@apple.com> Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions https://bugs.webkit.org/show_bug.cgi?id=167525 <rdar://problem/30270210> Reviewed by Ryosuke Niwa. Test: fast/events/input-events-insert-newlines-after-mutation.html Reverts an unintended change made while refactoring code for input events that caused input events to be dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within* the scope by calling typingAddedToOpenCommand. Instead, TypingCommands should always dispatch events synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change than we should currently allow, so we should revert to our old behavior for the time being. * editing/Editor.cpp: 2017-02-02 Matthew Hanson <matthew_hanson@apple.com> Merge r211433. rdar://problem/30091558 2017-01-31 Simon Fraser <simon.fraser@apple.com> REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works https://bugs.webkit.org/show_bug.cgi?id=167630 rdar://problem/30091558 Reviewed by Zalan Bujtas. r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to the root layer, which is where we scroll the document. Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::getRectToExpose): 2017-02-01 Matthew Hanson <matthew_hanson@apple.com> Merge r211502. rdar://problem/30298722 2017-02-01 Brent Fulgham <bfulgham@apple.com> Correct "filesHaveSameVolume" predicate https://bugs.webkit.org/show_bug.cgi?id=167696 <rdar://problem/30298722> Reviewed by David Kilzer. We are passing %-encoded strings to the underlying operating system's file system APIs. This doesn't work. Instead, we need to present a decoded version of the file path that matches what the system APIs expect. Tested by new TestWebKitAPI Test. * platform/FileSystem.cpp: (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying operating system are not percent encoded. * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system. 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211387. rdar://problem/29500273 2017-01-30 Simon Fraser <simon.fraser@apple.com> [iOS] position:fixed inside touch-scrollable overflow is mispositioned https://bugs.webkit.org/show_bug.cgi?id=167604 rdar://problem/29500273 Reviewed by Zalan Bujtas. For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with box-shadow, for example. Also make the compositing log output a little easier to read. Test: compositing/scrolling/fixed-inside-scroll.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211386. rdar://problem/30204866 2017-01-30 Jer Noble <jer.noble@apple.com> NULL-deref crash at PlatformMediaSession::endInterruption https://bugs.webkit.org/show_bug.cgi?id=167595 Reviewed by Eric Carlson. Use the same, NULL-aware forEachSession() iterator rather than iterating over m_sessions directly. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211337. rdar://problem/30126535 2017-01-28 Zalan Bujtas <zalan@apple.com> Resolve beforeChild's render tree position before calling addChildIgnoringContinuation. https://bugs.webkit.org/show_bug.cgi?id=167540 <rdar://problem/30126535> Reviewed by Simon Fraser. Use the actual render tree position for the beforeChild when inside a flow thread. Test: fast/multicol/assert-on-continuation-with-spanner.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::addChild): * rendering/RenderInline.cpp: (WebCore::RenderInline::addChild): * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::RenderMultiColumnFlowThread::resolveMovedChild): 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211309. rdar://problem/30240378 2017-01-27 Michael Saboff <msaboff@apple.com> JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<> https://bugs.webkit.org/show_bug.cgi?id=167522 Reviewed by Filip Pizlo. Added all provided callbacks to the global object with a private name the same way that the constructor was added. This will keep these callbacks from being GC'ed. * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211305. rdar://problem/29320059 2017-01-27 Simon Fraser <simon.fraser@apple.com> Element with a backdrop-filter and a mask may not correctly mask the backdrop https://bugs.webkit.org/show_bug.cgi?id=167456 rdar://problem/29320059 Reviewed by Antoine Quint. If a layer had a backdrop filter, but also corner radii that triggered using a mask layer, then the call to updateClippingStrategy() in GraphicsLayerCA::updateBackdropFiltersRect() would set the backdrop layer's mask, but GraphicsLayerCA::updateMaskLayer() would promptly then set the mask layer back to nil. Fix by having GraphicsLayerCA::updateMaskLayer() put the mask on the structural layer, if there is one. We always have a structural layer with backdrops, so this will mask both the layer and the backdrop. Test: css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateMaskLayer): * platform/graphics/mac/WebLayer.mm: (-[CALayer _descriptionWithPrefix:]): Dump the mask layer. 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211249. rdar://problem/29539389 2017-01-26 Jeremy Jones <jeremyj@apple.com> Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture https://bugs.webkit.org/show_bug.cgi?id=167126 Reviewed by Jon Lee. Enabled pointer-lock/locked-element-removed-from-dom.html for WK2. Not enable in WK1 because of https://bugs.webkit.org/show_bug.cgi?id=167127 This change allows a page to lock the pointer again without a user gesture if it was unlocked by the page and not by the user. See https://www.w3.org/TR/2016/REC-pointerlock-20161027/ 5.1 Methods * page/PointerLockController.cpp: When a document acquires pointer lock with a user gesture, that document is allowed to request pointer lock again until the user takes an action to end pointer lock. We know it is a user action because user actions always call requestPointerUnlockAndForceCursorVisible(). When the page requests a pointer unlock (via requestPointerUnlock), that document is allowed to continue to relock the page. This continues until there is either an unlock request form the user via requestPointerUnlockAndForceCursorVisible or a didLosePointerLock without a pointer unlock request. (WebCore::PointerLockController::PointerLockController): (WebCore::PointerLockController::requestPointerLock): (WebCore::PointerLockController::requestPointerUnlock): (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible): (WebCore::PointerLockController::elementRemoved): (WebCore::PointerLockController::documentDetached): (WebCore::PointerLockController::didAcquirePointerLock): (WebCore::PointerLockController::didLosePointerLock): (WebCore::PointerLockController::clearElement): * page/PointerLockController.h: 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r211240. rdar://problem/30247467b 2017-01-26 Jer Noble <jer.noble@apple.com> Autoplay muted videos stop playback of any streaming app in the background https://bugs.webkit.org/show_bug.cgi?id=163993 <rdar://problem/29020431> Reviewed by Eric Carlson. Added test in TestWebKitAPI, WebKit1.AudioSessionCategoryIOS. Previously, we would set the audio session category to "playback" if there was a media- element-type media session, and if there was a session capable of playing audio. But because this was an "or" operation, we would incorrectly set the category to "playback" if there was a video element incapable of rendering audio (due to being muted, without an audio track, etc.), and also a session capable of producing audio, such as WebAudio. With this change, this turns into an "and" operation; there must be a media element capable of rendering audio in order to switch the audio session category to "playback". Additionally, we no longer cache the value of "canProduceAudio()"; it's queried directly whenever updateSessionState() is called. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::constructCommon): * Modules/webaudio/AudioContext.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::insertedInto): (WebCore::HTMLMediaElement::loadResource): (WebCore::HTMLMediaElement::setMuted): (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::clearMediaPlayer): (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): (WebCore::HTMLMediaElement::presentationType): (WebCore::HTMLMediaElement::characteristics): (WebCore::HTMLMediaElement::canProduceAudio): * html/HTMLMediaElement.h: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::activeAudioSessionRequired): (WebCore::PlatformMediaSession::canProduceAudio): (WebCore::PlatformMediaSession::canProduceAudioChanged): (WebCore::PlatformMediaSession::setCanProduceAudio): Deleted. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSessionClient::canProduceAudio): (WebCore::PlatformMediaSession::canProduceAudio): Deleted. * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): 2017-01-31 Matthew Hanson <matthew_hanson@apple.com> Merge r210217. rdar://problem/30260068 Committed on behalf of Chris Dumez. * bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::nameGetter): Early-return false if an item has an exception (after propagating it.) 2017-01-27 Ryan Haddad <ryanhaddad@apple.com> Merge r211285. 2017-01-27 Ryan Haddad <ryanhaddad@apple.com> Rebaseline bindings tests after r211238. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::JSTestDOMJIT::visitChildren): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::JSTestEventTarget::visitChildren): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNode::visitChildren): 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211244. rdar://problem/29956321 2017-01-26 Dean Jackson <dino@apple.com> WebGL content in Safari sticks to GPU that it was started on, sometimes causing extra battery drain and difficulty interacting with UI https://bugs.webkit.org/show_bug.cgi?id=167477 <rdar://problem/29956321> Reviewed by Tim Horton. We were not implementing the recommended approach to properly handle GPU switching, causing some contexts to remain on a GPU and slow down the machine's UI. It also could stop the discrete GPU from turning off. Register for CGL's display reconfiguration notification, so that we can alert any active CGLContexts and cause them to update. The code change here doesn't lend itself to automated testing because it is specific to hardware with multiple GPUs, relies on some separate tools to detect which GPU is active, and an external method of triggering a GPU switch. It's best tested by the manual workflow in Radar. * platform/graphics/GraphicsContext3D.h: Add a macOS-specific update call. * platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::displayWasReconfigured): The callback for display reconfigurations. (WebCore::addActiveContext): Helper to keep track of active contexts, so we can register/unregister the callback when necessary. (WebCore::removeActiveContext): (WebCore::GraphicsContext3D::create): Use the new helpers. (WebCore::GraphicsContext3D::~GraphicsContext3D): (WebCore::GraphicsContext3D::updateCGLContext): Tell the CGLContextRef to update. 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211242. rdar://problem/29957753 2017-01-26 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r210328. https://bugs.webkit.org/show_bug.cgi?id=167476 Blocking bug is fixed <rdar://problem/29957753> (Requested by keith_miller on #webkit). Reverted changeset: "Disable smooth playhead animation for main content media in the Touch Bar" https://bugs.webkit.org/show_bug.cgi?id=166715 http://trac.webkit.org/changeset/210328 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211241. rdar://problem/30099051 2017-01-26 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: iOS: Memory timeline shows impossible values for Page size (underflowed) https://bugs.webkit.org/show_bug.cgi?id=167468 <rdar://problem/30099051> Reviewed by Andreas Kling. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::vmPageSize): This value matches the sysctl value we were attempting to access, and is the most appropriate when dealing with mach APIs, as we are using here. 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211235. rdar://problem/30058933 2017-01-26 Jeremy Jones <jeremyj@apple.com> Pointer lock events should be delivered directly to the target element https://bugs.webkit.org/show_bug.cgi?id=167134 Reviewed by Jon Lee. pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests. When pointer is locked on an element, route mouse events directly to the target element, instead of doing the normal event disptach. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::handleMouseDoubleClickEvent): (WebCore::EventHandler::handleMouseMoveEvent): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::handleMouseForceEvent): (WebCore::EventHandler::handleWheelEvent): * page/PointerLockController.cpp: (WebCore::PointerLockController::isLocked): Added. (WebCore::PointerLockController::dispatchLockedWheelEvent): Added. * page/PointerLockController.h: 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211233. rdar://problem/30220959 2017-01-26 Chris Dumez <cdumez@apple.com> Fix CPU / Memory diagnostic logging in PerformanceMonitor https://bugs.webkit.org/show_bug.cgi?id=167469 <rdar://problem/30220959> Reviewed by Alex Christensen. Fix CPU / Memory diagnostic logging in PerformanceMonitor to use logDiagnosticMessage() instead of logDiagnosticMessageWithValue(). logDiagnosticMessageWithValue() should only be used with numeric values but we already take care of the bucketing on our side. * page/DiagnosticLoggingClient.h: * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey): (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey): (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey): (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey): (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): Deleted. (WebCore::DiagnosticLoggingKeys::postPageLoadKey): Deleted. (WebCore::DiagnosticLoggingKeys::memoryUsageKey): Deleted. * page/DiagnosticLoggingKeys.h: * page/PerformanceMonitor.cpp: (WebCore::PerformanceMonitor::measurePostLoadCPUUsage): (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage): (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage): (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage): 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211231. rdar://problem/30217518 2017-01-26 Brady Eidson <beidson@apple.com> Gamepads: Some DPads are still not exposed in the HID backend. rdar://problem/30217518 and https://bugs.webkit.org/show_bug.cgi?id=167465 Reviewed by Alex Christensen. No new tests (Currently unable to test HID backend directly) * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::maybeAddButton): Allow GenericDesktop paged elements that are DPads to be buttons. 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211230. rdar://problem/30009849 2017-01-26 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r210095. https://bugs.webkit.org/show_bug.cgi?id=167464 broke tiling on mac (Requested by thorton on #webkit). Reverted changeset: "TileGrid revalidates tiles twice during flush, first with wrong visible rect" https://bugs.webkit.org/show_bug.cgi?id=166406 http://trac.webkit.org/changeset/210095 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211229. rdar://problem/30216981 2017-01-26 Chris Dumez <cdumez@apple.com> Fix WebGL diagnostic logging https://bugs.webkit.org/show_bug.cgi?id=167463 <rdar://problem/30216981> Reviewed by Alex Christensen. Fix WebGL diagnostic logging so that it no longer uses logDiagnosticMessageWithValue(). This is because the value apparently needs to be numeric on Mac. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::checkForContextLossHandling): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey): (WebCore::WebCore::DiagnosticLoggingKeys::webGLStateKey): (WebCore::DiagnosticLoggingKeys::stateKey): Deleted. (WebCore::DiagnosticLoggingKeys::handlesContextLossKey): Deleted. (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey): Deleted. * page/DiagnosticLoggingKeys.h: 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211220. rdar://problem/29578619 2017-01-26 Brady Eidson <beidson@apple.com> Gamepad support shows wrong values for PS4 controllers (D-pad is missing). <rdar://problem/29578619> and https://bugs.webkit.org/show_bug.cgi?id=165588 Reviewed by Alex Christensen. No new tests (Currently unable to test HID backend directly) DPads report their HID type as "a button", but their HID usage is "Hatswitch". This patch adds a new element type that maps a "hatswitch" value to 4 additional buttons. * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::initElements): (WebCore::HIDGamepad::initElementsFromArray): (WebCore::HIDGamepad::maybeAddButton): (WebCore::HIDGamepad::maybeAddDPad): (WebCore::HIDGamepad::maybeAddAxis): (WebCore::fillInButtonValues): (WebCore::HIDGamepad::valueChanged): * platform/gamepad/mac/HIDGamepad.h: (WebCore::HIDGamepadElement::isDPad): (WebCore::HIDGamepadDPad::HIDGamepadDPad): (WebCore::HIDGamepadDPad::normalizedValue): 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211201. rdar://problem/30134866 2017-01-25 Ryosuke Niwa <rniwa@webkit.org> Crash under DOMSelection::deleteFromDocument() https://bugs.webkit.org/show_bug.cgi?id=167232 Reviewed by Chris Dumez. The crash was caused by DOMSelection's deleteFromDocument() mutating contents inside the user-agent shadow tree of an input element when the text field is readonly. Fixed the bug by exiting early whenever the selection is inside a shadow tree since getSelection().getRangeAt(0) always returns a range outside the input element or any shadow tree for that matter. New behavior matches that of Gecko. The working draft spec of which I'm the editor states that deleteFromDocument() must invoke Range's deleteContents() on the associated range, which is the collapsed range returned by getSelection().getRangeAt(0) in the spec: https://www.w3.org/TR/2016/WD-selection-api-20160921/#widl-Selection-deleteFromDocument-void And Range's deleteContents() immediately terminates in step 1 when start and end are identical: https://dom.spec.whatwg.org/commit-snapshots/6b7621282c2e3b222ac585650e484abf4c0a416b/ Note that Range's DOM mutating methods are not available inside an user-agent shadow tree because WebKit never returns a Range whose end boundary points are inside the tree to author scripts. Editing commands (ones executable from document.execCommand) that mutate DOM like this check whether the content is editable or not. Since VisibleSelection's validate() function makes sure the selection is either entirely within or outside of an root editable element (editing host in the W3C spec lingo), editing commands should never mutate a random node inside an user-agent shadow tree. Test: editing/selection/deleteFromDocument-shadow-tree-crash.html * page/DOMSelection.cpp: (WebCore::DOMSelection::deleteFromDocument): 2017-01-26 Matthew Hanson <matthew_hanson@apple.com> Merge r211238. rdar://problem/30216742 2017-01-26 Filip Pizlo <fpizlo@apple.com> EventTarget should visit the JSEventListeners using visitAdditionalChildren https://bugs.webkit.org/show_bug.cgi?id=167462 Reviewed by Michael Saboff. No new tests because this is already caught by existing testing. This would show up as ASSERTs in debug, and we suspect it might be at fault for null deref crashes. Previously, EventTarget would have its event listeners visited by its subclasses' visitChildren methods. Every subclass of EventTarget would call EventTarget's visitJSEventListeners. For example, this means that if JSFoo has seven classes between it and JSEventTarget in the JSCell class hierarchy, then JSFoo::visitChildren would end up calling visitJSEventListeners seven extra times. Also, the weird way that visitJSEventListeners was called meant that it was not part of the GC's output constraint processing. This meant that it would not be called when the GC tried to terminate. So, if something about the event listener changes during a GC cycle, the GC would potentially fail to mark one of the references. Both problems can be solved by simply moving the call to visitJSEventListeners into visitAdditionalChildren. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::visitAdditionalChildren): * bindings/js/JSEventTargetCustom.cpp: (WebCore::JSEventTarget::visitAdditionalChildren): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * dom/EventTarget.idl: 2017-01-26 Andreas Kling <akling@apple.com> Branch-specific fix for a crash seen after merging r201777. <rdar://problem/30209068> Reviewed by Andy Estes. Add null checking of the FrameView in Document::destroyRenderTree() before calling functions on it. This is not necessary in trunk, as the FrameView is guaranteed to be present there. FrameView can be missing on the branch, since render trees for page cached documents are destroyed when leaving the page cache, not when entering it (trunk behavior.) When leaving the page cache, the FrameView is already detached, hence the bug. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211151. rdar://problem/30171195 2017-01-25 Chris Dumez <cdumez@apple.com> Measure how common it is for content to deal with WebGL context loss https://bugs.webkit.org/show_bug.cgi?id=166866 <rdar://problem/30171195> Reviewed by Alex Christensen. Add diagnostic logging to measure how common it is for sites to handle WebGL context loss via the webglcontextlost & webglcontextrestored events. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::checkForContextLossHandling): * html/canvas/WebGLRenderingContextBase.h: * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::noKey): (WebCore::DiagnosticLoggingKeys::yesKey): (WebCore::DiagnosticLoggingKeys::handlesContextLossKey): * page/DiagnosticLoggingKeys.h: 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge 210777. rdar://problem/30186526 2017-01-15 Andreas Kling <akling@apple.com> FrameView shouldn't keep dangling pointers into dead render trees. <https://webkit.org/b/167011> Reviewed by Antti Koivisto. Added some pretty paranoid assertions to FrameView that verify all of its raw pointers into the render tree are gone after the render tree has been destroyed. They immediately caught two bugs, also fixed in this patch. * page/FrameView.h: * page/FrameView.cpp: (WebCore::FrameView::willDestroyRenderTree): (WebCore::FrameView::didDestroyRenderTree): Added these two callbacks for before/after Document tears down its render tree. The former clears the layout root, and detaches custom scrollbars. The latter contains a bunch of sanity assertions that pointers into the now-destroyed render tree are gone. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): Notify FrameView before/after teardown. * page/animation/AnimationController.h: * page/animation/AnimationController.cpp: (WebCore::AnimationController::hasAnimations): Added a helper to check if there are any composite animations around, as these contain raw pointers to renderers. * rendering/RenderElement.cpp: (WebCore::RenderElement::willBeRemovedFromTree): (WebCore::RenderElement::willBeDestroyed): Moved slow repaint object unregistration from willBeRemovedFromTree() to willBeDestroyed(). The willBeRemovedFromTree() callback is skipped as an optimization during full tree teardown, but willBeDestroyed() always gets called. This fixes a bug where we'd fail to remove dangling pointers. 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211126. rdar://problem/30174873 2017-01-24 Simon Fraser <simon.fraser@apple.com> [iOS WK2] Avoid IOSurface readback for snapshot creation https://bugs.webkit.org/show_bug.cgi?id=167397 rdar://problem/30174873 Reviewed by Tim Horton. Export sinkIntoImage(). * platform/graphics/cocoa/IOSurface.h: 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211120. rdar://problem/30151767 2017-01-24 Andreas Kling <akling@apple.com> Add memory footprint reporting using diagnostic logging. <https://webkit.org/b/167285> <rdar://problem/30151767> Reviewed by Chris Dumez. Add some basic logging of physical memory footprint post-load and post-backgrounding. The logging works similarly to the CPU usage logging, though with slightly longer delays to allow the measurement to stabilize. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::memoryUsageKey): (WebCore::DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey): * page/DiagnosticLoggingKeys.h: * page/PerformanceLogging.cpp: (WebCore::PerformanceLogging::physicalFootprint): * page/PerformanceLogging.h: * page/PerformanceMonitor.cpp: (WebCore::PerformanceMonitor::PerformanceMonitor): (WebCore::PerformanceMonitor::didFinishLoad): (WebCore::PerformanceMonitor::activityStateChanged): (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage): (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage): * page/PerformanceMonitor.h: * page/Settings.h: (WebCore::Settings::isPostLoadMemoryUsageMeasurementEnabled): (WebCore::Settings::isPostBackgroundingMemoryUsageMeasurementEnabled): * page/cocoa/PerformanceLoggingCocoa.mm: (WebCore::PerformanceLogging::physicalFootprint): 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211125. rdar://problem/30074665 2017-01-24 Brent Fulgham <bfulgham@apple.com> Bug 167392: REGRESSION(r210531): Relax same-volume display requirement for iOS https://bugs.webkit.org/show_bug.cgi?id=167392 <rdar://problem/30074665> Reviewed by Brady Eidson. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canDisplay): Exclude the new check when building on iOS. 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211137. rdar://problem/29896656 2017-01-24 Alex Christensen <achristensen@webkit.org> REGRESSION (r208902): URLWithUserTypedString returns nil with file URLs https://bugs.webkit.org/show_bug.cgi?id=167402 <rdar://problem/29896656> Reviewed by Ryosuke Niwa. Covered by a new API test. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNameWithRange): uidna_IDNToASCII succeeds when length is 0. uidna_nameToASCII fails when length is 0. This causes bad things to happen with file URLs, which have no host, so their host length is 0. This makes us match behavior before r208902. 2017-01-25 Dean Jackson <dino@apple.com> Disable Variation fonts on this branch. <rdar://problem/30085249> * Configurations/FeatureDefines.xcconfig: 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211114. rdar://problem/29857388 2017-01-24 Anders Carlsson <andersca@apple.com> When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!) https://bugs.webkit.org/show_bug.cgi?id=167391 rdar://problem/29857388 Reviewed by Sam Weinig. * page/Page.cpp: (WebCore::Page::refreshPlugins): Remove an unused variable. * plugins/PluginInfoProvider.cpp: (WebCore::PluginInfoProvider::refresh): Make sure to call refreshPlugins(). Instead of reloading subframes, just reload all the main frames with subframes that contain plug-ins. 2017-01-25 Matthew Hanson <matthew_hanson@apple.com> Merge r211052. rdar://problem/29857388 2017-01-20 Anders Carlsson <andersca@apple.com> When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!) https://bugs.webkit.org/show_bug.cgi?id=167268 rdar://problem/29857388 Reviewed by Sam Weinig. * page/Page.cpp: (WebCore::Page::refreshPlugins): Call PluginInfoProvider::refresh instead. (WebCore::Page::clearPluginData): Add new setter. * page/Page.h: Declare new members. * plugins/PluginInfoProvider.cpp: (WebCore::PluginInfoProvider::refresh): Put the logic to clear plug-in data and reload frames here. * plugins/PluginInfoProvider.h: Add new members. 2017-01-24 Matthew Hanson <matthew_hanson@apple.com> Merge r211067. rdar://problem/29319962 2017-01-23 Alex Christensen <achristensen@webkit.org> URLParser should fail to parse percent-encoded invalid UTF-8 sequences https://bugs.webkit.org/show_bug.cgi?id=167330 <rdar://problem/29319962> Reviewed by Tim Horton. Covered by new API tests. * platform/URLParser.cpp: (WebCore::containsOnlyASCII): (WebCore::URLParser::parseHostAndPort): If UTF-8 decoding fails after percent-decoding the host, fail to parse. This matches Chrome and Firefox, and it was proposed to the spec in https://github.com/whatwg/url/issues/215 2017-01-24 Matthew Hanson <matthew_hanson@apple.com> Merge r211058. rdar://problem/29526875 2017-01-23 Alex Christensen <achristensen@webkit.org> Make URLs with non-special schemes and a query or fragment but no slash after the host more compatible https://bugs.webkit.org/show_bug.cgi?id=167317 <rdar://problem/29526875> Reviewed by Sam Weinig. This is currently being added to the URL spec in https://github.com/whatwg/url/issues/212 Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): Only add a slash if there wasn't one if the URL has a special scheme. This new behavior matches the old behavior of URL::parse. 2017-01-24 Matthew Hanson <matthew_hanson@apple.com> Merge r211045. rdar://problem/29486368 2017-01-23 Jer Noble <jer.noble@apple.com> REGRESSION (r208149): Video details does not apear and missing scrubber in Control Center https://bugs.webkit.org/show_bug.cgi?id=167233 Reviewed by Alex Christensen. Test: In TestWebKitAPI, NowPlayingControlsTests.NowPlayingControlsIOS In r208149, we introduced a new media type, Video, and renamed the old type to VideoAudio (to be able to distinguish between video-with-audio and silent-video). But we missed one place where that type needs to be renamed. For testing purposes, overload methods from PlatformMediaSessionManager which WebKit2 uses to report the current now playing session and it's information. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): 2017-01-24 Matthew Hanson <matthew_hanson@apple.com> Merge r211028. rdar://problem/30060378 2017-01-20 Dean Jackson <dino@apple.com> [WebGL] Do not allow GPU muxing on some old Mac hardware https://bugs.webkit.org/show_bug.cgi?id=167259 <rdar://problem/30060378> Reviewed by Simon Fraser and Darin Adler. Some old Macbook Pro models should never use the integrated GPU for WebGL, because they are unstable when swapping between that and the discrete GPU. Unfortunately this hardware configuration isn't in our testing infrastructure, so it was confirmed manually. Meanwhile, our existing tests make sure this patch doesn't break anything elsewhere. * platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::attachToAppleGraphicsControl): Helper function to get a mach port that talks to Apple's Graphics Control system. (WebCore::hasMuxCapability): Decides whether a system can do live GPU switching, based on whether or not it has a muxable GPU, and if that GPU is not the old hardware we know is problematic. (WebCore::hasMuxableGPU): Helper to return the static hasMuxCapability value. (WebCore::setPixelFormat): Only request the integrated card when the GPU is muxable. 2017-01-24 Matthew Hanson <matthew_hanson@apple.com> Merge r211007. rdar://problem/28620919 2017-01-20 Brady Eidson <beidson@apple.com> Require a button press on a gamepad for them to be exposed to the DOM. <rdar://problem/28620919> and https://bugs.webkit.org/show_bug.cgi?id=167272 Reviewed by Alex Christensen. Test: gamepad/gamepad-visibility-1.html * Modules/gamepad/GamepadManager.cpp: (WebCore::GamepadManager::platformGamepadInputActivity): * Modules/gamepad/GamepadManager.h: * platform/gamepad/GamepadProvider.cpp: (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity): * platform/gamepad/GamepadProvider.h: (WebCore::GamepadProvider::~GamepadProvider): Deleted. (WebCore::GamepadProvider::isMockGamepadProvider): Deleted. * platform/gamepad/GamepadProviderClient.h: * platform/gamepad/cocoa/GameControllerGamepad.h: * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/gamepad/cocoa/GameControllerGamepadProvider.h: * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: (WebCore::GameControllerGamepadProvider::gamepadHadInput): (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired): * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::valueChanged): * platform/gamepad/mac/HIDGamepad.h: * platform/gamepad/mac/HIDGamepadProvider.cpp: (WebCore::HIDGamepadProvider::valuesChanged): (WebCore::HIDGamepadProvider::inputNotificationTimerFired): * platform/gamepad/mac/HIDGamepadProvider.h: * testing/MockGamepadProvider.cpp: (WebCore::MockGamepadProvider::setMockGamepadButtonValue): (WebCore::MockGamepadProvider::gamepadInputActivity): * testing/MockGamepadProvider.h: 2017-01-20 Matthew Hanson <matthew_hanson@apple.com> Merge r210951. rdar://problem/29562247 2017-01-19 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION(r206156): Animated images are repeated one extra iteration than the value which is saved in the image file https://bugs.webkit.org/show_bug.cgi?id=167174 Reviewed by Simon Fraser. Before r206156, BitmapImage::repetitionCount() used to return zero for the case loopCount = 1, -1 for loopCount = Infinity and loopCount for all other cases. Having repetitionCount() return zero for loopCount = 1 makes the condition if (++m_repetitionsComplete > repetitionCount()) break the animation loop after one iteration. But it was wrong for all loopCount > 1. It was causing an extra iteration to be played for the animated image. After r206156, BitmapImage::repetitionCount() returns loopCount for all cases loopCount != Infinity. Keeping the same condition causes the extra iteration to be played even for loopCount = 1. Test: fast/images/animated-image-loop-count.html * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::internalStartAnimation): 2017-01-20 Matthew Hanson <matthew_hanson@apple.com> Merge r210949. rdar://problem/30108531 2017-01-19 Chris Dumez <cdumez@apple.com> iterable<> should be enabled on WK1 https://bugs.webkit.org/show_bug.cgi?id=167221 <rdar://problem/30108531> Reviewed by Youenn Fablet. * Modules/fetch/FetchHeaders.idl: * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodePrototype::finishCreation): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjPrototype::finishCreation): * bindings/scripts/test/TestNode.idl: * bindings/scripts/test/TestObj.idl: * css/FontFaceSet.idl: * dom/NodeList.idl: 2017-01-20 Matthew Hanson <matthew_hanson@apple.com> Merge r210945. rdar://problem/28745101 2017-01-19 Jer Noble <jer.noble@apple.com> CRASH at WebCore::TrackListBase::remove https://bugs.webkit.org/show_bug.cgi?id=167217 Reviewed by Brent Fulgham. Test: media/media-source/media-source-error-crash.html In very specific conditions, a HTMLMediaElement backed by a MediaSource can try to remove the same track from its track list twice. If there are two SourceBuffers attached to a HTMLMediaElement, and one has not yet been initialized, when the second fails to parse an appended buffer after receiving an initialization segment, the HTMLMediaElement will remove all its tracks in mediaLoadingFailed(), then MediaSource object itself will attempt remove the same track in removeSourceBuffer(). Solving this the safest way possible: bail early from TrackListBase if asked to remove a track which the list does not contain. * html/track/TrackListBase.cpp: (TrackListBase::remove): 2017-01-20 Matthew Hanson <matthew_hanson@apple.com> Merge r210936. rdar://problem/30058349 2017-01-19 Chris Dumez <cdumez@apple.com> Implement per activity state CPU usage reporting using diagnostic logging https://bugs.webkit.org/show_bug.cgi?id=167163 <rdar://problem/30058349> Reviewed by Andreas Kling. Implement per activity state CPU usage reporting using diagnostic logging. * WebCore.xcodeproj/project.pbxproj: * page/ActivityState.h: * page/ChromeClient.h: * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::nonVisibleStateKey): (WebCore::DiagnosticLoggingKeys::visibleNonActiveStateKey): (WebCore::DiagnosticLoggingKeys::visibleAndActiveStateKey): (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLogginKey): (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLogginKey): * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::isUtilityPageChromeClient): (WebCore::Page::Page): (WebCore::Page::~Page): (WebCore::Page::didStartProvisionalLoad): (WebCore::Page::didFinishLoad): (WebCore::Page::isUtilityPage): (WebCore::Page::setActivityState): (WebCore::Page::setIsVisibleInternal): * page/Page.h: (WebCore::Page::activityState): (WebCore::Page::isUtilityPage): * page/PerformanceMonitor.cpp: Added. (WebCore::activityStateForCPUSampling): (WebCore::PerformanceMonitor::PerformanceMonitor): (WebCore::PerformanceMonitor::didStartProvisionalLoad): (WebCore::PerformanceMonitor::didFinishLoad): (WebCore::PerformanceMonitor::activityStateChanged): (WebCore::PerformanceMonitor::measurePostLoadCPUUsage): (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage): (WebCore::PerformanceMonitor::measurePerActivityStateCPUUsage): (WebCore::stringForCPUSamplingActivityState): (WebCore::PerformanceMonitor::measureCPUUsageInActivityState): * page/PerformanceMonitor.h: Copied from Source/WebCore/page/ActivityState.h. * page/Settings.cpp: * page/Settings.h: (WebCore::Settings::isPostLoadCPUUsageMeasurementEnabled): (WebCore::Settings::isPostBackgroundingCPUUsageMeasurementEnabled): (WebCore::Settings::isPerActivityStateCPUUsageMeasurementEnabled): 2017-01-20 Matthew Hanson <matthew_hanson@apple.com> Merge r210473. rdar://problem/29204422 2017-01-06 Jer Noble <jer.noble@apple.com> Crash in WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime(const MediaTime&, const FloatSize&)::block_invoke https://bugs.webkit.org/show_bug.cgi?id=166738 Reviewed by Eric Carlson. AVFoundation can potentially call the same boundary time observer multiple times, and in that case, it's possible that the observer queue will be empty when we attempt to remove the first item from the queue. There's an ASSERT() in Deque for this case, but we need to explicitly protect against this case. Drive-by fix: Explicitly unregister the observer before releasing it. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime): 2017-01-20 Matthew Hanson <matthew_hanson@apple.com> Merge r210939. rdar://problem/29885052 2017-01-19 Chris Dumez <cdumez@apple.com> Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached https://bugs.webkit.org/show_bug.cgi?id=167215 <rdar://problem/29885052> Reviewed by Andreas Kling. Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached and that we do not crash. Tests: fast/forms/validation-message-detached-iframe.html fast/forms/validation-message-detached-iframe2.html * dom/Document.cpp: (WebCore::Document::prepareForDestruction): * page/ValidationMessageClient.h: 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210888. rdar://problem/30068195 2017-01-18 Michael Catanzaro <mcatanzaro@igalia.com> REGRESSION(r210531): Broke local resource loads from custom local protocols https://bugs.webkit.org/show_bug.cgi?id=167058 Reviewed by Brent Fulgham. Allow local protocols to access resources on different volumes unless the protocol is "file". * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canDisplay): 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210862. rdar://problem/30055009 2017-01-18 Youenn Fablet <youenn@apple.com> [Streams API] ReadableStream generic reader constructor does not need to call ReadableStream getReader https://bugs.webkit.org/show_bug.cgi?id=167137 Reviewed by Xabier Rodriguez-Calvar. Test: streams/shadowing-getReader.html * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::constructJSReadableStreamDefaultReader): Using private constructor instead of getReader. 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210860. rdar://problem/30080035 2017-01-18 Youenn Fablet <youenn@apple.com> Reject fetch promise in case of ReadableStream upload https://bugs.webkit.org/show_bug.cgi?id=167145 Reviewed by Alex Christensen. Covered by rebased tests. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): Storing the fact that body data is represented as a ReadableStream. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::isReadableStream): * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): Rejecting if request body data is a ReadableStream. 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210774. rdar://problem/30019773 2017-01-14 Chris Dumez <cdumez@apple.com> Report CPU usage of tabs after they become non-visible using diagnostic logging https://bugs.webkit.org/show_bug.cgi?id=167019 <rdar://problem/30019773> Reviewed by Darin Adler. Report CPU usage of tabs after they become non-visible using diagnostic logging. We start measure CPU usage 5 seconds after a tab goes to the background, for 5 minutes and report how much CPU the tab used during those 5 minutes. We will not log if the tab gets closed or moved to the foreground during those 5 minutes. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::didStartProvisionalLoad): (WebCore::Page::didFinishLoad): (WebCore::foregroundCPUUsageToDiagnosticLogginKey): (WebCore::Page::measurePostLoadCPUUsage): (WebCore::backgroundCPUUsageToDiagnosticLogginKey): (WebCore::Page::measurePostBackgroundingCPUUsage): (WebCore::Page::setIsVisibleInternal): * page/Page.h: * page/Settings.cpp: (WebCore::Settings::isPostBackgroundingCPUUsageMeasurementEnabled): * page/Settings.h: 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210733. rdar://problem/30014496 2017-01-13 Chris Dumez <cdumez@apple.com> Report post-page load CPU usage using diagnostic logging https://bugs.webkit.org/show_bug.cgi?id=166950 <rdar://problem/30014496> Reviewed by Alex Christensen. Shortly after page load (5 seconds), we measure the WebContent process' CPU usage over 10 seconds and report the percentage back via release logging. We also log the percentage using diagnostic logging using the following buckets: - Below 10% - 10 to 20% - 20 to 40% - 60 to 80% - Over 80% The logging works on both Mac and iOS. I verified that I get results consistent with Activity Monitor or top. No new tests, no Web-facing behavior change, only extra logging. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkLoadCompleteForThisFrame): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::postPageLoadKey): (WebCore::DiagnosticLoggingKeys::cpuUsageKey): * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::didFinishLoad): (WebCore::cpuUsageToDiagnosticLogginKey): (WebCore::Page::measurePostLoadCPUUsage): * page/Page.h: * page/Settings.cpp: (WebCore::Settings::isPostLoadCPUUsageMeasurementEnabled): * page/Settings.h: * platform/CPUTime.cpp: Added. (WebCore::getCPUTime): (WebCore::CPUTime::percentageCPUUsageSince): * platform/CPUTime.h: Added. * platform/cocoa/CPUTimeCocoa.mm: Added. (WebCore::timeValueToMicroseconds): (WebCore::getCPUTime): 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210762. rdar://problem/29883469 2017-01-13 Alex Christensen <achristensen@webkit.org> Fix WinCairo build after r210753. https://bugs.webkit.org/show_bug.cgi?id=166730 * platform/WebGLStateTracker.h: WTF::Function apparently needs to explicitly be differentiated from JSC::Attribute Function in PropertySlot.h. 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210753. rdar://problem/29883469 2017-01-13 Chris Dumez <cdumez@apple.com> [WK2] Add diagnostic logging to measure WebGL usage https://bugs.webkit.org/show_bug.cgi?id=166730 <rdar://problem/29883469> Reviewed by Alex Christensen. Add diagnostic logging to measure high performance WebGL usage. We report at regular intervals in which WebGL state Safari is: - Inactive - ActiveInForegroundTab - ActiveInBackgroundTabOnly This should give us an estimate of: - What % of the time is Safari using high performance graphics - What % of this time is only due to background tabs No new tests, no Web-facing behavior change. * WebCore.xcodeproj/project.pbxproj: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker): * html/canvas/WebGLRenderingContextBase.h: * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::inactiveKey): (WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey): (WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey): (WebCore::DiagnosticLoggingKeys::stateKey): (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey): * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::webGLStateTracker): * page/PageConfiguration.cpp: * page/PageConfiguration.h: * platform/WebGLStateTracker.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h. (WebCore::WebGLStateTracker::WebGLStateTracker): (WebCore::m_stateChangeHandler): (WebCore::WebGLStateTracker::updateWebGLState): * platform/WebGLStateTracker.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h. * platform/graphics/GraphicsContext3DAttributes.h: 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210748. rdar://problem/27745030 2017-01-13 Jer Noble <jer.noble@apple.com> Use a strong reference when calling callOnMainThread to schedule events in AudioScheduledSourceNode. https://bugs.webkit.org/show_bug.cgi?id=166983 Reviewed by Brent Fulgham. * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::finish): * Modules/webaudio/AudioScheduledSourceNode.h: 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210831. rdar://problem/29057611 2017-01-17 Zalan Bujtas <zalan@apple.com> Editing nested RTL-LTR content makes the process unresponsive. https://bugs.webkit.org/show_bug.cgi?id=167140 rdar://problem/29057611 Reviewed by Ryosuke Niwa. Break out of the loop if we keep coming back to the same position. This is a workaround for the underlying editing/position bug -> webkit.org/b/167138. Test: editing/rtl-to-ltr-editing-word-move-spin.html * editing/VisibleUnits.cpp: (WebCore::visualWordPosition): 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210795. rdar://problem/24457632 2017-01-16 Antti Koivisto <antti@apple.com> CrashTracer: com.apple.WebKit.WebContent at JavaScriptCore: WTF::StringImpl::containsOnlyWhitespace https://bugs.webkit.org/show_bug.cgi?id=167106 <rdar://problem/24457632> Reviewed by Tim Horton. Speculative fix. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::detectContentInRange): Test before casting to Text. 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210750. rdar://problem/29995070 2017-01-13 Brent Fulgham <bfulgham@apple.com> Avoid nullptr frame dereference when scrollTo is called on a disconnected DOMWindow https://bugs.webkit.org/show_bug.cgi?id=167030 <rdar://problem/29995070> Reviewed by Dean Jackson. Correct DOMWindow::scrollTo to match all other functions in the class so that the it checks that the current frame is valid before attempting to use it. * page/DOMWindow.cpp: (WebCore::DOMWindow::scrollTo): 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210727. rdar://problem/29668223 2017-01-12 Tim Horton <timothy_horton@apple.com> Keyboard accessory bar can appear on top of full-screen video https://bugs.webkit.org/show_bug.cgi?id=166902 <rdar://problem/29668223> Reviewed by Darin Adler. * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: (WebVideoFullscreenInterfaceAVKit::setupFullscreen): Increase the full-screen video window level to one above the keyboard, to ensure that the video is never obscured by the keyboard or its accessory views. 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210844. rdar://problem/29993906 2017-01-16 Filip Pizlo <fpizlo@apple.com> Make opaque root scanning truly constraint-based https://bugs.webkit.org/show_bug.cgi?id=165760 Reviewed by Geoffrey Garen. No new tests yet. I think that writing tests for this is a big investigation: https://bugs.webkit.org/show_bug.cgi?id=165808 Remove the previous advancing wavefront DOM write barrier. I don't think this will scale very well. It's super confusing. This change makes it so that visitAdditionalChildren can become a GC constraint that executes as part of the fixpoint. This changes all WebCore visitAdditionalChildren into output constraints by using new JSC API for Subspaces and MarkingConstraints. * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Added. * ForwardingHeaders/heap/MarkedBlockInlines.h: Added. * ForwardingHeaders/heap/MarkingConstraint.h: Added. * ForwardingHeaders/heap/SubspaceInlines.h: Added. * ForwardingHeaders/heap/VisitingTimeout.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): (WebCore::writeBarrierOpaqueRootSlow): Deleted. * bindings/js/CommonVM.h: (WebCore::writeBarrierOpaqueRoot): Deleted. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::finishCreation): (WebCore::JSDOMGlobalObject::scriptExecutionContext): * bindings/js/JSDOMWrapper.cpp: (WebCore::outputConstraintSubspaceFor): (WebCore::globalObjectOutputConstraintSubspaceFor): * bindings/js/JSDOMWrapper.h: * bindings/js/WebCoreJSClientData.cpp: Added. (WebCore::JSVMClientData::JSVMClientData): (WebCore::JSVMClientData::~JSVMClientData): (WebCore::JSVMClientData::getAllWorlds): (WebCore::initNormalWorldClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::outputConstraintSpace): (WebCore::JSVMClientData::globalObjectOutputConstraintSpace): (WebCore::JSVMClientData::forEachOutputConstraintSpace): (WebCore::JSVMClientData::JSVMClientData): Deleted. (WebCore::JSVMClientData::~JSVMClientData): Deleted. (WebCore::JSVMClientData::getAllWorlds): Deleted. (WebCore::initNormalWorldClientData): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): (WebCore::notifyChildNodeRemoved): 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210829. rdar://problem/30044439 2017-01-16 Filip Pizlo <fpizlo@apple.com> JSCell::classInfo() shouldn't have a bunch of mitigations for being called during destruction https://bugs.webkit.org/show_bug.cgi?id=167066 Reviewed by Keith Miller and Michael Saboff. No new tests because no new behavior. It's now necessary to avoid jsCast in destructors and finalizers. This was an easy rule to introduce because this used to always be the rule. * bindings/js/JSCSSValueCustom.cpp: (WebCore::JSDeprecatedCSSOMValueOwner::finalize): * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::destroy): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): 2017-01-18 Matthew Hanson <matthew_hanson@apple.com> Merge r210822. rdar://problem/15607819 2017-01-17 Joseph Pecoraro <pecoraro@apple.com> Crash when closing tab with debugger paused https://bugs.webkit.org/show_bug.cgi?id=161746 <rdar://problem/15607819> Reviewed by Brian Burg and Brent Fulgham. * page/Page.h: (WebCore::Page::incrementNestedRunLoopCount): (WebCore::Page::decrementNestedRunLoopCount): (WebCore::Page::insideNestedRunLoop): Keep track of whether or not this Page is inside of a nested run loop. Currently the only nested run loop we know about is EventLoop used by Web Inspector when debugging JavaScript. (WebCore::Page::whenUnnested): Callback that can be called when we are no longer inside of a nested run loop. (WebCore::Page::~Page): Ensure we are not in a known nested run loop when destructing, since that could be unsafe. * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): Increment and decrement as we go into or leave the nested runloop. * inspector/InspectorController.cpp: (WebCore::InspectorController::inspectedPageDestroyed): (WebCore::InspectorController::disconnectAllFrontends): Rework destruction to allow disconnectAllFrontends to happen earlier if necessary. WebKit clients may use this to disconnect remote frontends when closing a Page. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210447. rdar://problem/29872292 2017-01-06 Chris Dumez <cdumez@apple.com> [Form Validation] "character" in maxlength validation message should be singular when maxlength is 1 https://bugs.webkit.org/show_bug.cgi?id=166712 <rdar://problem/29872292> Reviewed by Darin Adler. Fix validation message to use singular form of "character" when maxLength value is 1. Test: fast/forms/validation-message-maxLength.html * English.lproj/Localizable.strings: * English.lproj/Localizable.stringsdict: Added. * WebCore.xcodeproj/project.pbxproj: * extract-localizable-strings.pl: * platform/LocalizedStrings.cpp: * platform/LocalizedStrings.h: * platform/cocoa/LocalizedStringsCocoa.mm: (WebCore::localizedNString): (WebCore::localizedString): (WebCore::validationMessageTooLongText): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210474. rdar://problem/29762809 2017-01-06 Daniel Bates <dabates@apple.com> Ensure navigation only allowed for documents not in the page cache https://bugs.webkit.org/show_bug.cgi?id=166773 <rdar://problem/29762809> Reviewed by Brent Fulgham. It is wise to ensure that navigation is only allowed when initiated from a document that is not in- or about to be put in- the page cache. Such a navigation would surprise a person that had navigated away from the initiating document among other issues. * dom/Document.cpp: (WebCore::Document::canNavigate): Only allow navigation if the document is not in the page cache. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): Ditto. * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::handleClick): Ditto. * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): Assert triggering event's document is not in the page cache. (WebCore::FrameLoader::submitForm): Allow submission if the document is not in the page cache. (WebCore::FrameLoader::loadFrameRequest): Assert triggering event's document is not in the page cache. * mathml/MathMLElement.cpp: (WebCore::MathMLElement::defaultEventHandler): Only allow navigation if the document is not in the page cache. * svg/SVGAElement.cpp: (WebCore::SVGAElement::defaultEventHandler): Ditto. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210536. rdar://problem/29939970 2017-01-09 Chris Dumez <cdumez@apple.com> REGRESSION(r189555): ImageDocument title no longer includes the size of the image https://bugs.webkit.org/show_bug.cgi?id=166876 <rdar://problem/29939970> Reviewed by Tim Horton. ImageDocument title no longer included the size of the image after r189555. This is because Document::setTitle() is a no-op if the document does not have a <head> element. To address the issue, we now include a <head> element in ImageDocuments so that their title element properly gets added to it. Test: fast/images/imageDocument-title.html * html/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210689. rdar://problem/29985957 2017-01-12 Chris Dumez <cdumez@apple.com> [iOS] HTML form validation popover sometimes does not go away https://bugs.webkit.org/show_bug.cgi?id=166990 <rdar://problem/29985957> Reviewed by Tim Horton. The issue was that [UIViewController presentViewController:] is asynchronous and that we sometimes tried to call [m_popoverController dismissViewControllerAnimated:] before presentViewController had completed. This is something that UIKit does not handle nicely and the popover just stays visible even though we have asked for the controller to be dismissed and destroyed the ValidationBubble object. To address the issue, I made ValidationBubble RefCounted and make sure the ValidationBubble object stays alive at least until the completion handler for [UIViewController presentViewController:] has been called. This is done via protecting the object using a RefPtr<> and capturing it in the lambda. Because dismissViewControllerAnimated is called in the destructor, it is no longer possible to call dismissViewControllerAnimated before the call to presentViewController has completed. No new tests, no easily testable since the popover was staying visible after being destroyed (held on by UIKit). * platform/ValidationBubble.h: (WebCore::ValidationBubble::create): * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::show): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210685. rdar://problem/29775711 2017-01-12 Chris Dumez <cdumez@apple.com> Unreviewed EFL/GTK build fix after r210684. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210684. rdar://problem/29775711 2017-01-12 Brady Eidson <beidson@apple.com> REGRESSION (r209977): Crash in UniqueIDBDatabase::executeNextDatabaseTask. https://bugs.webkit.org/show_bug.cgi?id=166984 Reviewed by Alex Christensen. No new tests (Unable to reproduce, speculative fix). * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): If we're not already prefetching for this cursor, starting doing so after holding a protector ref. (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): If we're now done prefetching for this cursor, schedule the protector ref to be destroyed on the main thread. * Modules/indexeddb/server/UniqueIDBDatabase.h: 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210679. rdar://problem/29910273 2017-01-12 Youenn Fablet <youenn@apple.com> OneDrive application crashes upon launch https://bugs.webkit.org/show_bug.cgi?id=166975 Reviewed by Brady Eidson. Checking whether load is terminated just after calling ResourceLoader::willSendRequestInternal. The reason is that delegate call may actually cancel the load at that point. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210677. rdar://problem/21482487 2017-01-12 Jer Noble <jer.noble@apple.com> Protect MediaPlayer from being destroyed mid-load() https://bugs.webkit.org/show_bug.cgi?id=166976 Reviewed by Eric Carlson. It's possible for a message sent by MediaPlayer to HTMLMediaElement to cause MediaPlayer to be destroyed before MediaPlayer::load() completes. We have previously protected against this same problem in HTMLMediaElement::loadResource() by ref'ing at the beginning of the function and deref'ing on exit. To do the same in MediaPlayer, it must become RefCounted. To keep the same semantics about m_client in MediaPlayer (always available without requiring a null-check), make a new static MediaPlayerClient object which can replace the real (HTMLMediaElement) client when the MediaPlayer is invalidated. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::clearMediaPlayer): (WebCore::HTMLMediaElement::createMediaPlayer): * html/HTMLMediaElement.h: * platform/graphics/MediaPlayer.cpp: (WebCore::nullMediaPlayerClient): (WebCore::MediaPlayer::create): (WebCore::MediaPlayer::MediaPlayer): (WebCore::MediaPlayer::invalidate): (WebCore::MediaPlayer::load): (WebCore::MediaPlayer::loadWithNextMediaEngine): (WebCore::MediaPlayer::inMediaDocument): (WebCore::MediaPlayer::fullscreenMode): (WebCore::MediaPlayer::requestedRate): (WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged): (WebCore::MediaPlayer::networkStateChanged): (WebCore::MediaPlayer::readyStateChanged): (WebCore::MediaPlayer::volumeChanged): (WebCore::MediaPlayer::muteChanged): (WebCore::MediaPlayer::timeChanged): (WebCore::MediaPlayer::sizeChanged): (WebCore::MediaPlayer::repaint): (WebCore::MediaPlayer::durationChanged): (WebCore::MediaPlayer::rateChanged): (WebCore::MediaPlayer::playbackStateChanged): (WebCore::MediaPlayer::firstVideoFrameAvailable): (WebCore::MediaPlayer::characteristicChanged): (WebCore::MediaPlayer::cachedKeyForKeyId): (WebCore::MediaPlayer::keyNeeded): (WebCore::MediaPlayer::mediaKeysStorageDirectory): (WebCore::MediaPlayer::referrer): (WebCore::MediaPlayer::userAgent): (WebCore::MediaPlayer::graphicsDeviceAdapter): (WebCore::MediaPlayer::cachedResourceLoader): (WebCore::MediaPlayer::createResourceLoader): (WebCore::MediaPlayer::addAudioTrack): (WebCore::MediaPlayer::removeAudioTrack): (WebCore::MediaPlayer::addTextTrack): (WebCore::MediaPlayer::removeTextTrack): (WebCore::MediaPlayer::addVideoTrack): (WebCore::MediaPlayer::removeVideoTrack): (WebCore::MediaPlayer::outOfBandTrackSources): (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge): (WebCore::MediaPlayer::handlePlaybackCommand): (WebCore::MediaPlayer::sourceApplicationIdentifier): (WebCore::MediaPlayer::preferredAudioCharacteristics): (WebCore::MediaPlayer::doesHaveAttribute): (WebCore::MediaPlayer::mediaPlayerNetworkInterfaceName): (WebCore::MediaPlayer::getRawCookies): (WebCore::MediaPlayer::shouldDisableSleep): * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayer::platformVolumeConfigurationRequired): (WebCore::MediaPlayer::client): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210663. rdar://problem/29916484 2017-01-12 Said Abou-Hallawa <sabouhallawa@apple.com> [iOS][WK1] Fix initialization of CADisplayLink::preferredFramesPerSecond https://bugs.webkit.org/show_bug.cgi?id=166956 Reviewed by Tim Horton. Set this option to 60fps instead of leaving set to the default. * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: (-[WebDisplayLinkHandler initWithMonitor:]): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210616. rdar://problem/29971105 2017-01-11 Youenn Fablet <youenn@apple.com> Remove request.formData property until it gets implemented https://bugs.webkit.org/show_bug.cgi?id=166920 <rdar://problem/29971105> Reviewed by Chris Dumez. Covered by rebased tests. * Modules/fetch/FetchBody.idl: 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210609. rdar://problem/27896585 2017-01-11 Andreas Kling <akling@apple.com> Crash when WebCore's GC heap grows way too large. <https://webkit.org/b/166875> <rdar://problem/27896585> Reviewed by Mark Lam. Cap the common WebCore VM at 4 GB of live JavaScript heap objects. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210599. rdar://problem/15307582 2017-01-11 Brent Fulgham <bfulgham@apple.com> File scheme should not allow access of a resource on a different volume. https://bugs.webkit.org/show_bug.cgi?id=158552 <rdar://problem/15307582> Reviewed by Alex Christensen. Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content on a different storage device (volume) unless universal access is enabled. Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads where the device changes in the midst of a load. Also properly reflect that SecurityOrigin is never null by passing as a reference, rather than as a pointer. Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canAccess): Pass argument as reference. (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume. (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference. * page/SecurityOrigin.h: * platform/FileSystem.cpp: (WebCore::filesHaveSameVolume): Added. * platform/FileSystem.h: * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork the storage device at the time of the start of the load so we can trigger a failure if this changes during the load operation. * platform/posix/FileSystemPOSIX.cpp: (WebCore::getFileDeviceId): Added. * platform/win/FileSystemWin.cpp: (WebCore::getFileDeviceId): Added. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210593. rdar://problem/29970907 2017-01-11 Chris Dumez <cdumez@apple.com> Iterating over URLSearchParams does not work https://bugs.webkit.org/show_bug.cgi?id=166921 <rdar://problem/29970907> Reviewed by Alex Christensen. Make URLSearchParams iterable, as per: - https://url.spec.whatwg.org/#urlsearchparams Test: fast/dom/DOMURL/searchparams-iterable.html * html/URLSearchParams.cpp: (WebCore::URLSearchParams::Iterator::next): (WebCore::URLSearchParams::Iterator::Iterator): * html/URLSearchParams.h: (WebCore::URLSearchParams::createIterator): * html/URLSearchParams.idl: 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210564. rdar://problem/29944582 2017-01-10 Ryosuke Niwa <rniwa@webkit.org> :active and :hover states may not be updated across slots https://bugs.webkit.org/show_bug.cgi?id=166881 <rdar://problem/29944582> Reviewed by Antti Koivisto. The bug was caused by updateHoverActiveState not updating :hover and :active states on elements when nodes are assigned to slots because they were walking up the tree using parentOrShadowHostElement and parentNode. Fixed the bug by using parentElementInComposedTree instead since :hover and :active states need to be updated in accordance with the render tree, which is created from the "flat tree" or the "composed tree" in WebKit's terminology (this is old terminology in the spec). Tests: fast/shadow-dom/clear-active-state-in-shadow.html fast/shadow-dom/hover-over-nested-slotted-content.html * dom/Document.cpp: (WebCore::Document::updateHoverActiveState): Fixed the bug. * dom/Node.cpp: (WebCore::Node::parentElementInComposedTree): Added. * dom/Node.h: 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210546. rdar://problem/29491188 2017-01-10 Youenn Fablet <youenn@apple.com> CachedScript cloning does not clone encodedSize https://bugs.webkit.org/show_bug.cgi?id=166865 Reviewed by Darin Adler. Covered by updated test. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource. * loader/cache/CachedScript.cpp: (WebCore::CachedScript::script): (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210508. rdar://problem/29801059 2017-01-09 Daniel Bates <dabates@apple.com> Evaluating window named element may return wrong result https://bugs.webkit.org/show_bug.cgi?id=166792 <rdar://problem/29801059> Reviewed by Chris Dumez. * bindings/js/JSDOMWindowProperties.cpp: (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210472. rdar://problem/29767412 2017-01-06 Joseph Pecoraro <pecoraro@apple.com> REGRESSION(r208886) Web Inspector: Toggling CSS Properties in Styles Sidebar (comment / uncomment) https://bugs.webkit.org/show_bug.cgi?id=166786 <rdar://problem/29767412> Reviewed by Brian Burg. * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyle::populateAllProperties): Match earlier behavior and don't send the frontend information about disabled (commented out) properties. Follow-up later to send this information when implementing proper handling of them in the frontend. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210468. rdar://problem/29859121 2017-01-06 Chris Dumez <cdumez@apple.com> Regression(r189230): DOM Callbacks may use wrong global object https://bugs.webkit.org/show_bug.cgi?id=166784 Reviewed by Mark Lam. DOM Callbacks could end up using the wrong global object after r189230 because we were getting the globalObject from the callback object instead of the one at the point the callback object was passed in by JavaScript. This patch fixes the issue. Test: fast/frames/frame-window-as-callback.html * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): * bindings/js/JSCallbackData.h: (WebCore::JSCallbackData::globalObject): (WebCore::JSCallbackData::JSCallbackData): (WebCore::JSCallbackDataStrong::JSCallbackDataStrong): (WebCore::JSCallbackDataStrong::callback): (WebCore::JSCallbackDataStrong::invokeCallback): (WebCore::JSCallbackDataWeak::JSCallbackDataWeak): (WebCore::JSCallbackDataWeak::callback): (WebCore::JSCallbackDataWeak::invokeCallback): * bindings/scripts/CodeGeneratorJS.pm: (GenerateCallbackImplementationContent): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210425. rdar://problem/29872021 2017-01-05 Chris Dumez <cdumez@apple.com> [Form Validation] lengthy validation messages should be truncated with an ellipsis https://bugs.webkit.org/show_bug.cgi?id=166747 <rdar://problem/29872021> Reviewed by Simon Fraser. Lengthy HTML validation messages should be truncated with an ellipsis. Previously, they were truncated but there was no ellipsis. No new tests, not easily testable. Manually tested on - http://codepen.io/cdumez/full/zoOZmZ/ (last field) * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210378. rdar://problem/29024384 2017-01-05 Zalan Bujtas <zalan@apple.com> Start hittesting a clean tree in RenderEmbeddedObject::isReplacementObscured https://bugs.webkit.org/show_bug.cgi?id=166743 <rdar://problem/29024384> Reviewed by Simon Fraser. Unable to reproduce. * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::isReplacementObscured): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210376. rdar://problem/29763079 2017-01-04 Ryosuke Niwa <rniwa@webkit.org> Crash inside Editor::styleForSelectionStart https://bugs.webkit.org/show_bug.cgi?id=166710 Reviewed by Chris Dumez. Added a null pointer check. This crash can happen when the DOM is mutated as editorState tries to compute the style at the selection start. No new tests since there is no reproducible test case, and I couldn't come up with one either. This crash seems to retire some intricate dependency between when DOM is mutated, selection is updated, and then performPostLayoutTasks ends up updating the editor state in response to the element's editabilty changing. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::styleForSelectionStart): 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210147. rdar://problem/29675551 2016-12-23 Simon Fraser <simon.fraser@apple.com> REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad https://bugs.webkit.org/show_bug.cgi?id=166472 rdar://problem/29675551 Reviewed by Tim Horton. r209299 broke autoscroll in zoomed pages because it changed RenderLayer::scrollRectToVisible() to shrink viewRect by page scale. This is incorrect for all callers of scrollRectToVisible, since the "absoluteRect" passed in is actually in zoomed document coordinates for all the callers I tested. This code is also fixed to account for headers and footers. getRectToExpose() takes rectangles in "scroll view contents" coordinates (i.e. including header, and zoomed document), so doesn't need the separate visibleRectRelativeToDocument parameter. Tests: fast/events/autoscroll-main-document.html fast/events/autoscroll-when-zoomed.html fast/events/drag-select-when-zoomed-with-header.html fast/events/drag-select-when-zoomed.html fast/scrolling/scroll-to-anchor-zoomed-header.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollRectToVisible): (WebCore::RenderLayer::getRectToExpose): * rendering/RenderLayer.h: 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210095. rdar://problem/29912221 2016-12-21 Tim Horton <timothy_horton@apple.com> TileGrid revalidates tiles twice during flush, first with wrong visible rect https://bugs.webkit.org/show_bug.cgi?id=166406 Reviewed by Simon Fraser. No new tests; existing tests cover this code, this is just a perf win, specifically reducing the amount of layer churn during zooming. * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::setScale): Schedule a revalidation, which will happen later in the same flush, instead of doing it immediately. Doing it immediately is problematic, because we're currently in the middle of a GraphicsLayer tree flush, and don't have the complete picture of the new state yet. We're guaranteed to get the new scale *before* the flush calls revalidateTiles. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210432. rdar://problem/29633667 2017-01-05 Ryosuke Niwa <rniwa@webkit.org> Finding text doesn't work across shadow boundary https://bugs.webkit.org/show_bug.cgi?id=158503 Reviewed by Antti Koivisto. Added a new TextIterator behavior flag, TextIteratorTraversesFlatTree, which makes TextIterator traverse the flat tree instead of the DOM tree, and made this behavior default in findPlainText. Also added a new find options flag, DoNotTraverseFlatTree, to suppress this behavior in window.find(~) and execCommand('FindString', false, ~) as they should not be able to peek information inside shadow trees. Unfortunately these APIs have been deprecated in the standards so there is no specification to follow. For now, we don't support finding a word or a keyword across a shadow boundary as this would require making rangeOfString and other related functions return a Range-like object that can cross shadow boundaries. Also added internals.rangeOfString to test Editor::rangeOfString, and replaced the bit-flag arguments to internals.countMatchesForText and internals.countFindMatches by an array of strings for better portability. Test: editing/text-iterator/find-string-on-flat-tree.html * editing/Editor.cpp: (WebCore::Editor::rangeOfString): Use the modern containingShadowRoot instead of nonBoundaryShadowTreeRootNode since the start container can be a shadow root, which nonBoundaryShadowTreeRootNode asserts not be the case. * editing/Editor.h: * editing/EditorCommand.cpp: (WebCore::executeFindString): Don't traverse across shadow boundaries. * editing/FindOptions.h: Added DoNotTraverseFlatTree. * editing/TextIterator.cpp: (WebCore::assignedAuthorSlot): Added. (WebCore::authorShadowRoot): Added. (WebCore::firstChildInFlatTreeIgnoringUserAgentShadow): Added. (WebCore::nextSiblingInFlatTreeIgnoringUserAgentShadow): Added. (WebCore::firstChild): Added. Traverses the flat tree when TextIteratorTraversesFlatTree is set. (WebCore::nextSibling): Ditto. (WebCore::parentNodeOrShadowHost): Ditto. (WebCore::TextIterator::advance): Don't set m_handledChildren to true when the current node has display: contents. (WebCore::findPlainText): Use TextIteratorTraversesFlatTree unless DoNotTraverseFlatTree is set. * editing/TextIteratorBehavior.h: Added TextIteratorTraversesFlatTree. * page/DOMWindow.cpp: (WebCore::DOMWindow::find): Don't traverse across shadow boundaries. * testing/Internals.cpp: (WebCore::parseFindOptions): Added. (WebCore::Internals::rangeOfString): Added. (WebCore::Internals::countMatchesForText): Replaced the find options by an array of strings instead of a bit mask. (WebCore::Internals::countFindMatches): Ditto. * testing/Internals.h: * testing/Internals.idl: Added rangeOfString, and replaced find options bit-flag in countMatchesForText and countFindMatches by an array of strings so that the tests themselves don't rely on a specific value of each bit flag. 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210131. rdar://problem/29633667 2016-12-23 Ryosuke Niwa <rniwa@webkit.org> Eliminate the use of lastChild in TextIterator https://bugs.webkit.org/show_bug.cgi?id=166456 Reviewed by Antti Koivisto. Just use the node we just existed in TextIterator::exitNode and in emitting additional new line to eliminate the use of Node::lastChild. Also initialize member variables in the declaration instead of the constructor to modernize the code. * editing/TextIterator.cpp: (WebCore::TextIterator::TextIterator): (WebCore::TextIterator::advance): (WebCore::TextIterator::exitNode): * editing/TextIterator.h: 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210094. rdar://problem/29912214 2016-12-21 Tim Horton <timothy_horton@apple.com> TileGrid creates new tiles when there are recyclable tiles about to be removed https://bugs.webkit.org/show_bug.cgi?id=166408 Reviewed by Simon Fraser. No new tests; existing tests cover this code, this is just a perf win, specifically reducing the amount of layer churn during zooming. * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::revalidateTiles): Remove all the tiles that will be removed first, then add new tiles. Strictly ordering it this way means that tiles will be removed, go into the LayerPool, then be pulled back out of the LayerPool to sit in the newly-covered areas. Previously, we would sometimes make new layers for newly-covered areas, and then remove unneeded but otherwise recyclable tiles, which would then just go sit in the LayerPool (and often get pruned, wastefully). 2017-01-12 Matthew Hanson <matthew_hanson@apple.com> Merge r210078. rdar://problem/29633667 2016-12-21 Ryosuke Niwa <rniwa@webkit.org> Modernize findPlainText https://bugs.webkit.org/show_bug.cgi?id=166299 Reviewed by Sam Weinig. Modernized findPlainText by merging the static version of it into it and extracting the main nested loop out as findPlainTextOffset. No new tests since there should be no behavioral change. * editing/TextIterator.cpp: (WebCore::findPlainTextOffset): (WebCore::findPlainText): 2017-01-06 Matthew Hanson <matthew_hanson@apple.com> Merge r210221. rdar://problem/29449474 2017-01-01 Jeff Miller <jeffm@apple.com> Update user-visible copyright strings to include 2017 https://bugs.webkit.org/show_bug.cgi?id=166278 Reviewed by Dan Bernstein. * Info.plist: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210372. rdar://problem/29870033 2017-01-05 Chris Dumez <cdumez@apple.com> Turn preferLowPowerWebGLRendering setting on by default https://bugs.webkit.org/show_bug.cgi?id=166737 <rdar://problem/29870033> Reviewed by Dean Jackson. Temporarily turn preferLowPowerWebGLRendering setting on by default until we deal better with WebGL content in background tabs. * page/Settings.in: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210369. rdar://problem/29100419 2017-01-05 Zalan Bujtas <zalan@apple.com> Mark the dedicated root linebox for trailing floats in empty inlines dirty. https://bugs.webkit.org/show_bug.cgi?id=166732 <rdar://problem/29100419> Reviewed by Antti Koivisto. We normally attach floating boxes to the last root linebox. However when the floatbox is preceded by a <br> we generate a dedicated root linebox (TrailingFloatsRootInlineBox) for the floatbox. When this floatbox is a RenderInline descendant and this RenderInline does not generate lineboxes (it's ancestor RenderBlockFlow does) we have to make sure that this special root linebox gets marked dirty when the associated floatbox changes. (Unfortunately through the recursive calls on dirtyLinesFromChangedChild(), we lose the information about the "changed child" since the inlines propagates the marking logic to the RenderBlockFlow, see FIXME.) Test: fast/inline/trailing-floats-inline-crash2.html * rendering/RenderLineBoxList.cpp: (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210368. rdar://problem/28908164 2017-01-05 Antoine Quint <graouts@apple.com> [Cocoa] Both modern-media-controls/images/iOS modern-media-controls/images/macOS are installed on both platforms https://bugs.webkit.org/show_bug.cgi?id=163871 Reviewed by Eric Carlson. We now only copy modern media controls images, if any, for the current platform. * WebCore.xcodeproj/project.pbxproj: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210361. rdar://problem/29870245 2017-01-05 Chris Dumez <cdumez@apple.com> Form validation: Align email validation with the latest HTML specification https://bugs.webkit.org/show_bug.cgi?id=166697 <rdar://problem/29870245> Reviewed by Alex Christensen. Align email validation with the latest HTML specification: - https://html.spec.whatwg.org/#valid-e-mail-address It particular, the following changes were made: - The first and last character of the domain now needs to be a letter or a digit - Parts of the domain can only be 63 characters in length No new tests, extended existing test. * html/EmailInputType.cpp: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210360. rdar://problem/19595567 2017-01-05 Enrica Casucci <enrica@apple.com> Support File Promise during drag for macOS. https://bugs.webkit.org/show_bug.cgi?id=165204 rdar://problem/19595567 Reviewed by Tim Horton. Adds the support for handling File Promise type during drag. DragData now has the knowledge of the NSFilesPromisePboardType and checks for the data type during drag. * page/mac/DragControllerMac.mm: (WebCore::DragController::dragOperation): * platform/DragData.h: (WebCore::DragData::setFileNames): (WebCore::DragData::fileNames): * platform/mac/DragDataMac.mm: (WebCore::DragData::containsFiles): (WebCore::DragData::numberOfFiles): (WebCore::DragData::asFilenames): (WebCore::DragData::containsCompatibleContent): (WebCore::DragData::containsPromise): (WebCore::DragData::asURL): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210359. rdar://problem/29882478 2017-01-05 Per Arne Vollan <pvollan@apple.com> [Win] Compile error. https://bugs.webkit.org/show_bug.cgi?id=166726 Reviewed by Alex Christensen. Add include folder. * CMakeLists.txt: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210328. rdar://problem/29870673 2017-01-05 Wenson Hsieh <wenson_hsieh@apple.com> Disable smooth playhead animation for main content media in the Touch Bar https://bugs.webkit.org/show_bug.cgi?id=166715 <rdar://problem/29870673> Reviewed by Eric Carlson. Passing in a non-zero playback rate to WebPlaybackControlsManager's timing property causes unintended effects further down the stack. Please see the Radar for more details. * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210288. rdar://problem/29741862 2016-01-04 Brent Fulgham <bfulgham@apple.com> Correct DOMWindow handling during FrameLoader::clear https://bugs.webkit.org/show_bug.cgi?id=166357 <rdar://problem/29741862> Reviewed by Andy Estes. Make sure that we always clean up the DOM window when clearing Window properties, even if the document will remain in the page cache. Since 'clearWindowShell' is only used in FrameLoader, divide it's beahvior into two steps: 1. Rename 'clearWindowShell' to 'clearWIndowShellsNotMatchingDOMWindow' to better describe its function. Switch to a modern C++ loop. Do not switch to the new DOMWindow here, but detach and clear existing DOMWindow connections. 2. Add a new method 'setDOMWindowForWindowShell'. Complete switch to the new DOMWindow. This change allows us to disconnect the old DOMWindow, perform the 'setDocument(nullptr)' operation, and then connect to the new Window without leaving the loader in an inconsistent state. * loader/bindings/js/ScriptController.cpp: (WebCore::clearWindowShellsNotMatchingDOMWindow): Renamed from 'clearWindowShell' (WebCore::setDOMWindowForWindowShell): Added. * loader/bindings/js/ScriptController.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): Revise to use the new two-step DOMWindow switch logic. 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210284. rdar://problem/29865854 2017-01-04 Chris Dumez <cdumez@apple.com> Assertion hit on redfin.com: ASSERTION FAILED: collection->length() > 1 https://bugs.webkit.org/show_bug.cgi?id=166687 <rdar://problem/29865854> Reviewed by Darin Adler. We were mistakenly calling Document::addWindowNamedItem() / Document::removeWindowNamedItem() for elements in Shadow DOMs. As a result, the windowNamedItem DocumentOrderedMap would contain elements in shadow DOMs. This would cause the assertion to be hit in window's named property getter because of the length mismatch between the windowNamedItem DocumentOrderedMap and the WindowNameCollection. Tests: fast/shadow-dom/document-named-property.html fast/shadow-dom/window-named-property.html * dom/Element.cpp: (WebCore::Element::updateNameForDocument): (WebCore::Element::updateIdForDocument): * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseAttribute): * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::updateDocNamedItem): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210279. rdar://problem/29607569 2017-01-04 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Cross Origin importScripts() scripts lack source URL, causes issues with Inspector showing Resource https://bugs.webkit.org/show_bug.cgi?id=165569 <rdar://problem/29607569> Reviewed by Youenn Fablet. Test: http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didReceiveResponse): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): * loader/ThreadableLoader.h: * loader/WorkerThreadableLoader.cpp: (WebCore::LoaderTaskOptions::LoaderTaskOptions): Add a new ThreadableLoader option to avoid filtering the response. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::loadAsynchronously): Disable filtering of the response. This is an internal load, we don't want to filter data that would be valuable later. 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210267. rdar://problem/29796608 2017-01-03 Ryosuke Niwa <rniwa@webkit.org> label element with tabindex >= 0 is not focusable https://bugs.webkit.org/show_bug.cgi?id=102780 <rdar://problem/29796608> Reviewed by Darin Adler. Fixed the bug by removing the override for HTMLLabelElement::isFocusable which always returned false. This is a behavior from r5532 but it doesn't match the latest HTML specification or that of Chrome and Firefox. Also fixed an existing bug in HTMLLabelElement::focus and HTMLLegendElement::focus which focused the associated form control when there is one even if the element itself is focusable. Without this fix, traversing from control with shift+tab would break since focusing the label would move the focus back to the input element inside the label element. Finally, fixed a bug in HTMLLegendElement::focus that we can call inFocus without updating layout first. The fix was inspired by https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb Test: fast/events/focus-label-legend-elements-with-tabindex.html * html/HTMLLabelElement.cpp: (WebCore::HTMLLabelElement::focus): (WebCore::HTMLLabelElement::isFocusable): Deleted. * html/HTMLLabelElement.h: * html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::focus): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210273. rdar://problem/29834093 2017-01-04 Tim Horton <timothy_horton@apple.com> Provide a setting for clients to always prefer low-power WebGL https://bugs.webkit.org/show_bug.cgi?id=166675 <rdar://problem/29834093> Reviewed by Dan Bernstein. No new tests; as noted in r204664, we don't know how to reliably test automatic graphics switching. One could use the manual test introduced in that commit; after this commit, with the setting switched on, on a dual-GPU machine that is actively using integrated graphics, that test should return the same result for both contexts. * page/Settings.in: Add a setting to prefer low-power WebGL. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): If said setting is enabled, set preferLowPowerToHighPerformance. 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210266. rdar://problem/29447824 2017-01-03 Tim Horton <timothy_horton@apple.com> NSSpellChecker's recordResponse isn't called for unseen automatic corrections https://bugs.webkit.org/show_bug.cgi?id=166450 <rdar://problem/29447824> Reviewed by Darin Adler. Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::recordAutocorrectionResponse): (WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted. * editing/AlternativeTextController.h: Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection of the private overload of recordAutocorrectionResponseReversed, since there's only one caller. * editing/Editor.cpp: (WebCore::Editor::markAndReplaceFor): Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection. (WebCore::Editor::changeBackToReplacedString): Adopt recordAutocorrectionResponse. * page/AlternativeTextClient.h: Add an "AutocorrectionAccepted" response type. 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210142. rdar://problem/29109053 2016-12-23 Andreas Kling <akling@apple.com> REGRESSION(r209865): Crash when navigating back to some pages with compositing layers. <https://webkit.org/b/166469> <rdar://problem/29109053> Reviewed by Darin Adler. Remove the old WK1-era clear/restoreBackingStores optimization from the page cache. When enabling it on non-iOS platforms, we started hitting lots of assertions, and none of our memory tests showed any significant improvement anyway. Test: compositing/page-cache-back-crash.html * history/CachedFrame.cpp: (WebCore::CachedFrameBase::CachedFrameBase): (WebCore::CachedFrameBase::restore): (WebCore::CachedFrame::CachedFrame): * history/CachedFrame.h: * page/FrameView.cpp: (WebCore::FrameView::restoreBackingStores): Deleted. * page/FrameView.h: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210122. rdar://problem/29763012 2016-12-22 Brent Fulgham <bfulgham@apple.com> Nested calls to setDocument can omit firing 'unload' events https://bugs.webkit.org/show_bug.cgi?id=166422 <rdar://problem/29763012> Reviewed by Alex Christensen. Test: fast/loader/nested-document-handling.html Only allow a single document change to be taking place during a given runloop cycle. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): Block script changing the document when we are in the middle of changing the document. * page/Frame.cpp: (WebCore::Frame::setDocument): Keep track of document change state. * page/Frame.h: 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210120. rdar://problem/29772233 2016-12-22 Zalan Bujtas <zalan@apple.com> Do not destroy the RenderNamedFlowFragment as leftover anonymous block. https://bugs.webkit.org/show_bug.cgi?id=166436 rdar://problem/29772233 Reviewed by Simon Fraser. When as the result of certain style change, the generated anonymous block is not needed anymore, we move its descendants up to the parent and destroy the generated box. While RenderNamedFlowFragment is a generated block, the cleanup code should just ignore it the same way we ignore boxes like multicolumn, mathml etc. Test: fast/regions/flow-fragment-as-anonymous-block-crash.html * rendering/RenderObject.h: (WebCore::RenderObject::isAnonymousBlock): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210112. rdar://problem/29742039 2016-12-22 Daniel Bates <dabates@apple.com> Bypass pop-up blocker from cross-origin or sandboxed frame https://bugs.webkit.org/show_bug.cgi?id=166290 <rdar://problem/29742039> Reviewed by Darin Adler. Tests: fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html * page/DOMWindow.cpp: (WebCore::DOMWindow::open): Use FrameLoader::findFrameForNavigation() to find the target frame to navigate with respect to the active document just as we do in WebCore::createWindow(). 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210104. rdar://problem/29139619 2016-12-22 Jer Noble <jer.noble@apple.com> NULL-deref CRASH in WebCore::PlatformMediaSession::mediaType https://bugs.webkit.org/show_bug.cgi?id=166407 Reviewed by Darin Adler. In r207688, we added a facility in PlatformMediaSessionManager for safely walking through a list of PlatformMediaSessions by replacing entries of deleted sessions with nullptr. We now need to use those new iteration falicities in MediaSessionManageriOS. In addition to the existing iterators, add one which takes a predicate, and returns the first session which matches the predicate, or nullptr, if none do. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::findSession): (WebCore::PlatformMediaSessionManager::anyOfSessions): * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::sessions): Deleted. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange): (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): (WebCore::MediaSessionManageriOS::applicationWillEnterForeground): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210100. rdar://problem/28388000 2016-12-22 Jer Noble <jer.noble@apple.com> Muted media element playback should not interrupt other audio playback https://bugs.webkit.org/show_bug.cgi?id=166347 Reviewed by Eric Carlson. Test: TestWebKitAPI/WebKit/ios/AudioSessionCategoryIOS.mm * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210083. rdar://problem/25391382 2016-12-21 Jiewen Tan <jiewen_tan@apple.com> WebKit should set Original URL of a download request correctly https://bugs.webkit.org/show_bug.cgi?id=166394 <rdar://problem/25391382> Reviewed by Alex Christensen. WebKit should set Original URL of a download request correctly if the download is initiated by clicking on a link with target=_blank. Manually tested as the requested test infrastructure doesn't exist yet. We need actual loading process for API test such that we could simulate the real situation which PolicyDownload is only set when we receive responds. Currently we can only set PolicyDownload in a NavigationDelegate when the load starts. Hence we cannot simulate the following process: load starts -> PolicyUse -> creates a new WebView -> respond receives -> PolicyDownload -> downloads. * loader/FrameLoader.cpp: (WebCore::FrameLoader::setOriginalURLForDownloadRequest): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210061. rdar://problem/29763143 2016-12-21 Eric Carlson <eric.carlson@apple.com> [MediaStream] MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer can be called before it has a media stream https://bugs.webkit.org/show_bug.cgi?id=166344 <rdar://problem/29763143> Reviewed by Jer Noble. There is a very narrow window during which a MediaStream player can be asked for its layer before it has a steam, resulting in a NULL dereference and crash. Don't do that. Unable to reproduce. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210059. rdar://problem/29727145 2016-12-21 Simon Fraser <simon.fraser@apple.com> Fixed bars are positioned incorrectly when there are header and footer banners https://bugs.webkit.org/show_bug.cgi?id=166302 rdar://problem/29727145 Reviewed by Tim Horton. The computation of the visual viewport was wrong in the presence of header and footer banners. It needs to take into account the fact that "visibleContentRect" applies to the scroll view contents, which includes header and footer (unscaled), and the potentially scaled document, and we need to return a rectangle in unscaled document coordinates. Make a static method in FrameView to do this computation, and call it from FrameView::visualViewportRect() and ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition(). layoutViewportForScrollPosition() is only called on Mac, so remove the #ifdeffing related to scaling, and pass in an unscaled scroll position. Test: fast/visual-viewport/zoomed-fixed-header-and-footer.html * page/FrameView.cpp: (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::visibleDocumentRect): (WebCore::FrameView::visualViewportRect): * page/FrameView.h: * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): 2017-01-05 Matthew Hanson <matthew_hanson@apple.com> Merge r210035. rdar://problem/29704862 2016-12-20 Zalan Bujtas <zalan@apple.com> SVG elements should inherit the root's flow thread state. https://bugs.webkit.org/show_bug.cgi?id=166173 rdar://problem/29704862 Reviewed by Simon Fraser. When the <svg> is not part of the multicolumn context (out of flow positioning), its descendants should not be in the flow either. Test: fast/multicol/svg-inside-multicolumn.html * rendering/RenderObject.cpp: (WebCore::RenderObject::computedFlowThreadState): * rendering/RenderObject.h: (WebCore::RenderObject::isProgress): (WebCore::RenderObject::isRenderSVGBlock): * rendering/svg/RenderSVGBlock.h: 2017-01-04 Matthew Hanson <matthew_hanson@apple.com> Merge r209990. rdar://problem/29705967 2016-12-18 Brent Fulgham <bfulgham@apple.com> Side effects while restting form elements https://bugs.webkit.org/show_bug.cgi?id=165959 <rdar://problem/29705967> Reviewed by Anders Carlsson. JavaScript logic can run while resetting FormElement objects. This can lead to unintended side-effets and other unwanted behavior. We should protect these elements during the reset. Test: fast/html/form-mutate.html * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::HTMLFormElement): Switch to C++11 initialization. (WebCore::HTMLFormElement::reset): Protect elements until the reset operation is finished. (WebCore::HTMLFormElement::resetAssociatedFormControlElements): Added to share code with 'resumeFromDocument'. (WebCore::HTMLFormElement::resumeFromDocument): Protect elements until the reset operation is finished. 2017-01-04 Matthew Hanson <matthew_hanson@apple.com> Merge r210045. rdar://problem/29560853 2016-12-20 Alex Christensen <achristensen@webkit.org> Remove initEvent quirk https://bugs.webkit.org/show_bug.cgi?id=166284 Reviewed by Dan Bernstein. We added this quirk in r207908 and expanded it in r209946 and r210034. Many web compatibility issues have been found, which leads us to believe that many more exist. This reverts the behavior to match how it was before r203848. This change was proposed to the spec in https://github.com/whatwg/dom/issues/387 * dom/Event.cpp: (WebCore::Event::initEventForBindings): Deleted. * dom/Event.h: * dom/Event.idl: * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::IOSApplication::isBaiduNuomi): Deleted. (WebCore::IOSApplication::isAutoNaviAMap): Deleted. (WebCore::IOSApplication::isFlipboard): Deleted. 2017-01-04 Matthew Hanson <matthew_hanson@apple.com> Merge r210034. rdar://problem/29560853 2016-12-20 Alex Christensen <achristensen@webkit.org> Fix yet another app that uses initEvent with fewer than 3 parameters https://bugs.webkit.org/show_bug.cgi?id=166257 <rdar://problem/29420268> Reviewed by Sam Weinig. * dom/Event.cpp: (WebCore::Event::initEventForBindings): * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::IOSApplication::isAutoNaviAMap): AutoNavi amap has content that uses initEvent with one parameter. This quirk is needed here, too. 2016-12-21 Babak Shafiei <bshafiei@apple.com> Roll out r209261. 2016-12-21 Babak Shafiei <bshafiei@apple.com> Roll out r209510. 2016-12-19 Dean Jackson <dino@apple.com> Merge another patch for rdar://problem/29466493. 2016-12-19 Dean Jackson <dino@apple.com> Disable some features on the safari-603-branch. <rdar://problem/29466493> * Configurations/FeatureDefines.xcconfig: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): * css/SelectorFilter.cpp: (WebCore::SelectorFilter::collectIdentifierHashes): * css/parser/CSSSelectorParser.cpp: (WebCore::isOnlyPseudoClassFunction): (WebCore::CSSSelectorParser::consumePseudo): (WebCore::CSSSelectorParser::consumeCombinator): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): 2016-12-19 Babak Shafiei <bshafiei@apple.com> Merge patch for rdar://problem/29466493. 2016-12-19 Dean Jackson <dino@apple.com> Disable some features on the safari-603-branch. <rdar://problem/29466493> - Force the default state of experimental features to off. - Move some experimental features that should be enabled on this branch into the general feature list, so they can't be disabled. - Disable some features that are not ready. * Configurations/FeatureDefines.xcconfig: 2016-12-18 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Prefetch cursor records in the server. https://bugs.webkit.org/show_bug.cgi?id=166014 Reviewed by Andy Estes. No new tests (Covered by existing LayoutTests and PerformanceTests). This patch implements the followng: 1 - After a backing store cursor completes a fetch in the server, it will schedule the next fetch even before the client requests one. It will do this up to a limited number of prefetches. 2 - Once a client request to advance the cursor comes in, we'll work our way through prefetched records instead of reading anything from disk, which might then cause us to continue prefetch. 3 - If any changes to the object store occur, it will throw away all previously fetched records (There's room for future improvement here) * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::postDatabaseTask): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): (WebCore::IDBServer::SQLiteIDBBackingStore::prefetchCursor): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged): (WebCore::IDBServer::SQLiteIDBCursor::prefetch): (WebCore::IDBServer::SQLiteIDBCursor::advance): * Modules/indexeddb/server/SQLiteIDBCursor.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask): * Modules/indexeddb/server/UniqueIDBDatabase.h: 2016-12-18 Wenson Hsieh <wenson_hsieh@apple.com> Changing text direction fires input events with null inputTypes and no data https://bugs.webkit.org/show_bug.cgi?id=166007 <rdar://problem/29557205> Reviewed by Sam Weinig. Adds support for the "formatSetInlineTextDirection" input type, triggered when using the context menu on Mac in an editable area (for both plain and rich text cases) to change paragraph direction. To do this, we add cases for EditActionSetWritingDirection in inputTypeNameForEditingAction and inputEventDataForEditingStyleAndAction. When changing text direction for a plaintext editable element, we have logic in Editor::setBaseWritingDirection that sets the focused element's dir attribute to the requested value (ltr or rtl). We add similar hooks here to dispatch input events and handle preventing default. Test: fast/events/before-input-events-prevent-text-direction.html * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): Handle the EditActionSetWritingDirection case. * editing/Editor.cpp: (WebCore::inputEventDataForEditingStyleAndAction): (WebCore::Editor::applyParagraphStyle): Include input event data when dispatching an input event here. (WebCore::Editor::setBaseWritingDirection): * testing/Internals.cpp: (WebCore::Internals::setBaseWritingDirection): * testing/Internals.h: * testing/Internals.idl: Introduce an internal testing support hook for setting base writing direction (the same codepath taken when using the context menu to change paragraph direction). Currently, using testRunner.execCommand creates and applies style with an additional `unicode-bidi` attribute, and appears to also be intentionally disabled for plaintext editable elements. 2016-12-17 Simon Fraser <simon.fraser@apple.com> Build fix: linking WebCore was failing: you can't export inline functions. * css/DeprecatedCSSOMPrimitiveValue.cpp: (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType): (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue): (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue): * css/DeprecatedCSSOMPrimitiveValue.h: (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType): Deleted. (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Deleted. (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue): Deleted. (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Deleted. (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue): Deleted. 2016-12-16 Dave Hyatt <hyatt@apple.com> [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM https://bugs.webkit.org/show_bug.cgi?id=165968 Reviewed by Andreas Kling. This patch changes the CSS OM for values to use distinct wrapper classes instead of cloning the existing classes. By actually wrapping values instead of cloning, we are freed up to change our CSS value hierarchy however we'd like (such as changing to match the new CSS Values OM that is coming soon). All of the CSS Values wrapper classes are prefixed with "DeprecatedCSSOM" to reflect our desire (ultimately) to remove this API from our tree. We're the only ones that support it, and it's not used on the Web, but it is part of the WebKitLegacy API and might be used internally. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMWrapperWorld.h: * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): * bindings/js/JSCSSValueCustom.cpp: (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots): (WebCore::JSDeprecatedCSSOMValueOwner::finalize): (WebCore::toJSNewlyCreated): (WebCore::toJS): (WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots): Deleted. (WebCore::JSCSSValueOwner::finalize): Deleted. * css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): * css/CSSComputedStyleDeclaration.h: * css/CSSGridLineNamesValue.cpp: (WebCore::CSSGridLineNamesValue::cloneForCSSOM): Deleted. * css/CSSGridLineNamesValue.h: * css/CSSImageSetValue.cpp: (WebCore::CSSImageSetValue::cloneForCSSOM): Deleted. * css/CSSImageSetValue.h: * css/CSSImageValue.cpp: (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper): (WebCore::CSSImageValue::cloneForCSSOM): Deleted. * css/CSSImageValue.h: * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::createDeprecatedCSSOMPrimitiveWrapper): (WebCore::CSSPrimitiveValue::cloneForCSSOM): Deleted. * css/CSSPrimitiveValue.h: * css/CSSPrimitiveValue.idl: Removed. * css/CSSStyleDeclaration.h: * css/CSSStyleDeclaration.idl: * css/CSSValue.cpp: (WebCore::CSSValue::traverseSubresources): (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): (WebCore::CSSValue::createDeprecatedCSSOMWrapper): (): Deleted. (WebCore::CSSValue::cloneForCSSOM): Deleted. * css/CSSValue.h: (WebCore::CSSValue::CSSValue): (WebCore::CSSValue::setCssText): Deleted. (WebCore::CSSValue::isCSSOMSafe): Deleted. (WebCore::CSSValue::isSubtypeExposedToCSSOM): Deleted. * css/CSSValue.idl: Removed. * css/CSSValueList.cpp: (WebCore::CSSValueList::cloneForCSSOM): Deleted. * css/CSSValueList.h: (WebCore::CSSValueList::separator): * css/CSSValueList.idl: Removed. * css/Counter.h: * css/Counter.idl: Removed. * css/DeprecatedCSSOMCounter.h: Added. * css/DeprecatedCSSOMCounter.idl: Copied from Source/WebCore/css/Counter.idl. * css/DeprecatedCSSOMPrimitiveValue.cpp: Added. (WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue): (WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue): (WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue): * css/DeprecatedCSSOMPrimitiveValue.h: Added. (WebCore::DeprecatedCSSOMPrimitiveValue::create): (WebCore::DeprecatedCSSOMPrimitiveValue::equals): (WebCore::DeprecatedCSSOMPrimitiveValue::cssValueType): (WebCore::DeprecatedCSSOMPrimitiveValue::cssText): (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType): (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue): (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue): (WebCore::DeprecatedCSSOMPrimitiveValue::stringValue): (WebCore::DeprecatedCSSOMPrimitiveValue::DeprecatedCSSOMPrimitiveValue): * css/DeprecatedCSSOMPrimitiveValue.idl: Copied from Source/WebCore/css/CSSPrimitiveValue.idl. * css/DeprecatedCSSOMRGBColor.h: Added. * css/DeprecatedCSSOMRGBColor.idl: Copied from Source/WebCore/css/RGBColor.idl. * css/DeprecatedCSSOMRect.h: Added. * css/DeprecatedCSSOMRect.idl: Copied from Source/WebCore/css/Rect.idl. * css/DeprecatedCSSOMValue.cpp: Added. (WebCore::compareCSSOMValues): (WebCore::DeprecatedCSSOMValue::equals): (WebCore::DeprecatedCSSOMValue::destroy): (WebCore::DeprecatedCSSOMValue::cssValueType): (WebCore::DeprecatedCSSOMValue::cssText): * css/DeprecatedCSSOMValue.h: Added. (WebCore::DeprecatedCSSOMValue::deref): (WebCore::DeprecatedCSSOMValue::setCssText): (WebCore::DeprecatedCSSOMValue::operator==): (WebCore::DeprecatedCSSOMValue::isComplexValue): (WebCore::DeprecatedCSSOMValue::isPrimitiveValue): (WebCore::DeprecatedCSSOMValue::isValueList): (WebCore::DeprecatedCSSOMValue::classType): (WebCore::DeprecatedCSSOMValue::DeprecatedCSSOMValue): (WebCore::DeprecatedCSSOMValue::~DeprecatedCSSOMValue): (WebCore::DeprecatedCSSOMComplexValue::create): (WebCore::DeprecatedCSSOMComplexValue::equals): (WebCore::DeprecatedCSSOMComplexValue::cssText): (WebCore::DeprecatedCSSOMComplexValue::cssValueType): (WebCore::DeprecatedCSSOMComplexValue::DeprecatedCSSOMComplexValue): * css/DeprecatedCSSOMValue.idl: Copied from Source/WebCore/css/CSSValue.idl. * css/DeprecatedCSSOMValueList.cpp: Added. (WebCore::DeprecatedCSSOMValueList::equals): (WebCore::DeprecatedCSSOMValueList::cssText): * css/DeprecatedCSSOMValueList.h: Added. (WebCore::DeprecatedCSSOMValueList::create): (WebCore::DeprecatedCSSOMValueList::cssValueType): (WebCore::DeprecatedCSSOMValueList::length): (WebCore::DeprecatedCSSOMValueList::item): (WebCore::DeprecatedCSSOMValueList::DeprecatedCSSOMValueList): * css/DeprecatedCSSOMValueList.idl: Copied from Source/WebCore/css/CSSValueList.idl. * css/LengthRepeat.h: * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue): (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM): (WebCore::StyleRuleCSSStyleDeclaration::didMutate): (WebCore::InlineCSSStyleDeclaration::didMutate): (WebCore::PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM): Deleted. * css/PropertySetCSSStyleDeclaration.h: * css/RGBColor.cpp: (WebCore::RGBColor::red): Deleted. (WebCore::RGBColor::green): Deleted. (WebCore::RGBColor::blue): Deleted. (WebCore::RGBColor::alpha): Deleted. * css/RGBColor.h: * css/RGBColor.idl: Removed. * css/Rect.h: (WebCore::RectBase::RectBase): * css/Rect.idl: Removed. * svg/SVGElement.cpp: (WebCore::SVGElement::getPresentationAttribute): * svg/SVGElement.h: * svg/SVGElement.idl: 2016-12-17 Philippe Normand <pnormand@igalia.com> Unreviewed, rollout r209860 OWR player shouldn't be selected for normal video playback * platform/GStreamer.cmake: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr): (WebCore::MediaPlayerPrivateGStreamerOwr::play): (WebCore::MediaPlayerPrivateGStreamerOwr::pause): (WebCore::MediaPlayerPrivateGStreamerOwr::load): (WebCore::MediaPlayerPrivateGStreamerOwr::stop): (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged): (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h: * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::createMutedRemoteSource): * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Removed. * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Removed. * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Removed. 2016-12-17 Michael Catanzaro <mcatanzaro@igalia.com> warning: the compiler can assume that the address of 'thisObject' will always evaluate to 'true' [-Waddress] in WebCore::JSHTMLDocument::getOwnPropertySlot https://bugs.webkit.org/show_bug.cgi?id=165987 Reviewed by Mark Lam. Work around the warning by passing the JSObject pointer this function receives directly to ASSERT_GC_OBJECT_INHERITS, instead of casting it to a reference and then taking the address of that, to avoid the -Waddress warning. * bindings/js/JSHTMLDocumentCustom.cpp: (WebCore::JSHTMLDocument::getOwnPropertySlot): 2016-12-17 Jer Noble <jer.noble@apple.com> Add implementation for navigator.requestMediaKeySystemAccess() https://bugs.webkit.org/show_bug.cgi?id=165850 Reviewed by Eric Carlson. Test: media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html Add an implementation of NavigatorEME::requestMediaKeySystemAccess() as well as the CDM object on which it depends. * Modules/encryptedmedia/CDM.cpp: Added. (WebCore::cdmFactories): (WebCore::createCDMPrivateForKeySystem): (WebCore::CDM::registerCDMFactory): (WebCore::CDM::unregisterCDMFactory): (WebCore::CDM::supportsKeySystem): (WebCore::CDM::create): (WebCore::CDM::CDM): (WebCore::CDM::getSupportedConfiguration): (WebCore::CDM::doSupportedConfigurationStep): (WebCore::CDM::isPersistentType): (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType): (WebCore::CDM::getConsentStatus): * Modules/encryptedmedia/CDM.h: Added. (WebCore::CDMFactory::~CDMFactory): (WebCore::CDM::keySystem): (WebCore::CDM::createWeakPtr): * Modules/encryptedmedia/CDMPrivate.h: Added. (WebCore::CDMPrivate::~CDMPrivate): * Modules/encryptedmedia/NavigatorEME.cpp: (WebCore::NavigatorEME::requestMediaKeySystemAccess): (WebCore::tryNextSupportedConfiguration): * Modules/encryptedmedia/NavigatorEME.h: * Modules/encryptedmedia/NavigatorEME.idl: To aid in testing, a new Internals object is added, MockCDMFactory, which can be controlled by LayoutTests to change the behavior of the Mock objects it creates. * testing/Internals.cpp: (WebCore::Internals::registerMockCDM): * testing/Internals.h: * testing/Internals.idl: * testing/MockCDMFactory.cpp: Added. (WebCore::MockCDMFactory::MockCDMFactory): (WebCore::MockCDMFactory::~MockCDMFactory): (WebCore::MockCDMFactory::unregister): (WebCore::MockCDMFactory::supportsKeySystem): (WebCore::MockCDMFactory::createCDM): (WebCore::MockCDM::MockCDM): (WebCore::MockCDM::supportsInitDataType): (WebCore::MockCDM::supportsConfiguration): (WebCore::MockCDM::supportsConfigurationWithRestrictions): (WebCore::MockCDM::supportsSessionTypeWithConfiguration): (WebCore::MockCDM::supportsRobustness): (WebCore::MockCDM::distinctiveIdentifiersRequirement): (WebCore::MockCDM::persistentStateRequirement): (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable): * testing/MockCDMFactory.h: Added. (WebCore::MockCDMFactory::create): (WebCore::MockCDMFactory::supportedDataTypes): (WebCore::MockCDMFactory::setSupportedDataTypes): (WebCore::MockCDMFactory::supportedRobustness): (WebCore::MockCDMFactory::setSupportedRobustness): (WebCore::MockCDMFactory::distinctiveIdentifiersRequirement): (WebCore::MockCDMFactory::setDistinctiveIdentifiersRequirement): (WebCore::MockCDMFactory::persistentStateRequirement): (WebCore::MockCDMFactory::setPersistentStateRequirement): * testing/MockCDMFactory.idl: Added. Move the MediaKeySessionType definition out of the MediaKeys.idl file and into its own. Move the MediaKeysRequiriment definition out of the MediaKeySystemConfiguration.idl file and into its own. Generally fix up the .idl files so that they properly work with their implementation files. * Modules/encryptedmedia/MediaKeySessionType.idl: Added. * Modules/encryptedmedia/MediaKeySystemAccess.cpp: (WebCore::MediaKeySystemAccess::create): (WebCore::MediaKeySystemAccess::MediaKeySystemAccess): (WebCore::MediaKeySystemAccess::keySystem): Deleted. (WebCore::MediaKeySystemAccess::getConfiguration): Deleted. * Modules/encryptedmedia/MediaKeySystemAccess.h: (WebCore::MediaKeySystemAccess::keySystem): (WebCore::MediaKeySystemAccess::getConfiguration): (WebCore::MediaKeySystemAccess::create): Deleted. * Modules/encryptedmedia/MediaKeySystemAccess.idl: * Modules/encryptedmedia/MediaKeySystemConfiguration.h: * Modules/encryptedmedia/MediaKeySystemConfiguration.idl: * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: * Modules/encryptedmedia/MediaKeys.idl: * Modules/encryptedmedia/MediaKeysRequirement.idl: Added. * Modules/encryptedmedia/MediaKeysRestrictions.h: Added. * bindings/js/JSMediaKeySystemAccessCustom.cpp: Removed. As some of these enums are referenced in the Internals project, they need to be exported from WebCore correctly. Teach the code generator how to export the symbols generated by enums. * bindings/scripts/CodeGeneratorJS.pm: (GenerateEnumerationHeaderContent): Add new files to the project. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: 2016-12-17 Darin Adler <darin@apple.com> Remove WebCore::Dictionary, which is now unused https://bugs.webkit.org/show_bug.cgi?id=165988 Reviewed by Andreas Kling. * CMakeLists.txt: Removed the files. * WebCore.xcodeproj/project.pbxproj: Ditto. * bindings/js/Dictionary.cpp: Removed. * bindings/js/Dictionary.h: Removed. * bindings/js/JSBindingsAllInOne.cpp: Removed include of Dictionary.cpp. 2016-12-17 Youenn Fablet <youenn@apple.com> Cloned CachedResource should not have an empty response https://bugs.webkit.org/show_bug.cgi?id=165947 Reviewed by Sam Weinig. Test: http/tests/loading/reusing-cached-stylesheet-from-different-domain.html * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setBodyDataFrom): Copying the response to the cloned resource. Even though the issue is appearing for stylesheets only, it is safer to do that for all cloned ressources. 2016-12-16 Brady Eidson <beidson@apple.com> IndexedDB: Refactor SQLiteIDBCursor to prepare for cursor prefetching. https://bugs.webkit.org/show_bug.cgi?id=165978 Reviewed by Alex Christensen. No new tests (Refactor, no behavior change). In preparation for cursor prefetching, we need to shift the cursor off of keeping "the current record" and onto keeping "a deque of fetched records", the first of which is "the current record". This patch does just that, but with no behavior change; The deque only ever holds 0 or 1 records. * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::currentData): (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged): (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement): (WebCore::IDBServer::SQLiteIDBCursor::prefetch): (WebCore::IDBServer::SQLiteIDBCursor::advance): (WebCore::IDBServer::SQLiteIDBCursor::fetch): (WebCore::IDBServer::SQLiteIDBCursor::fetchNextRecord): (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored): (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord): (WebCore::IDBServer::SQLiteIDBCursor::iterate): (WebCore::IDBServer::SQLiteIDBCursor::currentKey): (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey): (WebCore::IDBServer::SQLiteIDBCursor::currentValue): (WebCore::IDBServer::SQLiteIDBCursor::didComplete): (WebCore::IDBServer::SQLiteIDBCursor::didError): (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID): (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::advanceOnce): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Deleted. * Modules/indexeddb/server/SQLiteIDBCursor.h: (WebCore::IDBServer::SQLiteIDBCursor::SQLiteCursorRecord::isTerminalRecord): (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::currentKey): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::currentValue): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::didComplete): Deleted. (WebCore::IDBServer::SQLiteIDBCursor::didError): Deleted. 2016-12-16 Darin Adler <darin@apple.com> Remove all custom bindings from media streams, using dictionaries instead https://bugs.webkit.org/show_bug.cgi?id=165943 Reviewed by Sam Weinig. * CMakeLists.txt: Added and removed files. * DerivedSources.make: Ditto. * Modules/mediastream/DoubleRange.h: Added. Moved dictionary here so it can be shared by both MediaStreamTrack and MediaTrackSupportedConstraints. * Modules/mediastream/DoubleRange.idl: Ditto. * Modules/mediastream/LongRange.h: Ditto. * Modules/mediastream/LongRange.idl: Ditto. * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::getSupportedConstraints): Changed to return a struct instead of a reference counted object. * Modules/mediastream/MediaDevices.h: Updated for the above. * Modules/mediastream/MediaDevices.idl: Added a conditional on the dictionary in this file; not needed because the conditional on the interface automatically affects the entire fiel, but for now the style seems to be to put these on all the dictionaries. * Modules/mediastream/MediaSourceSettings.cpp: Removed. * Modules/mediastream/MediaSourceSettings.h: Removed. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::getSettings): Changed to return a struct instead of a reference counted object. (WebCore::capabilityDoubleRange): Added. Helper for getCapabilities. (WebCore::capabilityIntRange): Ditto. (WebCore::capabilityStringVector): Ditto. (WebCore::capabilityBooleanVector): Ditto. (WebCore::MediaStreamTrack::getCapabilities): Changed to return a struct instead of a reference counted object. * Modules/mediastream/MediaStreamTrack.h: Updated for the above changes. Also defined the structs here in the class. * Modules/mediastream/MediaStreamTrack.idl: Defined the two dictionaries here and changed the functions to return them and not use [Custom] any more. * Modules/mediastream/MediaTrackConstraints.h: Moved DoubleRange and LongRange out of this file and into their own headers. Also removed the currently unimplemented latency and channelCount; there are FIXME comments in the IDL file about eventually adding these to match the specification. * Modules/mediastream/MediaTrackConstraints.idl: Added conditionals, and removed the unimplemented latency and channelCount. style of marking everything consistently. * Modules/mediastream/MediaTrackSupportedConstraints.h: Replaced this class with a struct. * Modules/mediastream/MediaTrackSupportedConstraints.idl: Replaced this interface with a dictionary. * WebCore.xcodeproj/project.pbxproj: Added and removed files. * bindings/js/JSMediaStreamTrackCustom.cpp: Removed. * bindings/js/JSMediaTrackSupportedConstraintsCustom.cpp: Removed. * platform/mediastream/MediaStreamTrackPrivate.cpp: Removed include of the MediaSourceSettings.h header. * platform/mediastream/MediaStreamTrackPrivate.h: Removed forward declaration of the MediaSourceSettings class. 2016-12-16 Zalan Bujtas <zalan@apple.com> Possible nullptr dereference when applying pagination to viewport https://bugs.webkit.org/show_bug.cgi?id=165926 Reviewed by Simon Fraser. Static analysis found a code path where a null dereference could occur. * page/FrameView.cpp: (WebCore::FrameView::applyPaginationToViewport): 2016-12-16 Ryan Haddad <ryanhaddad@apple.com> Fix the Windows build. Unreviewed build fix. * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp: 2016-12-16 Ryan Haddad <ryanhaddad@apple.com> Yet another attempt to fix the Windows build after r209936. Unreviewed build fix. * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: 2016-12-16 Alex Christensen <achristensen@webkit.org> Use initEvent quirk added in r207908 for Flipboard https://bugs.webkit.org/show_bug.cgi?id=165974 <rdar://problem/28264190> Reviewed by Chris Dumez. * dom/Event.cpp: (WebCore::Event::initEventForBindings): * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::IOSApplication::isFlipboard): Flipboard also has JavaScript content that calls initEvent with not enough arguments. 2016-12-16 Chris Dumez <cdumez@apple.com> [iOS] Align HTML from validation popover style with Copy/Paste callout bar https://bugs.webkit.org/show_bug.cgi?id=165973 <rdar://problem/29336638> Reviewed by Simon Fraser. Tweak font size and padding of the HTML from validation popover to match the style of the Copy/Paste callout bar on iOS. * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): 2016-12-16 Ryan Haddad <ryanhaddad@apple.com> Another attempt to fix the Windows build after r209936. Unreviewed build fix. * CMakeLists.txt: 2016-12-16 Andy Estes <aestes@apple.com> Add a setting to suppress keyboard input during provisional navigation https://bugs.webkit.org/show_bug.cgi?id=165830 Reviewed by Brent Fulgham. Added a setting that suppresses keyboard input during provisional navigation. When the setting is enabled, DOM propogation of keyboard input events (KeyboardEvents, CompositionEvents, InputEvents, and some TextEvents) is suppressed, and text insertion is disabled in the editor. Non-editing default event handling still occurs, for instance keyboard scrolling, access keys, and focus navigation. Test: http/tests/navigation/keyboard-events-during-provisional-navigation.html * dom/CompositionEvent.h: Added a type trait specialization. * dom/EventDispatcher.cpp: (WebCore::shouldSuppressEventDispatchInDOM): Added. Returns true if the event is trusted, FrameLoader::shouldSuppressKeyboardInput() returns true, and the event is a CompositionEvent, InputEvent, KeyboardEvent, or keyboard/composition TextEvent. (WebCore::EventDispatcher::dispatchEvent): Called stopPropogation() on the event if shouldSuppressEventDispatchInDOM() returns true. * dom/InputEvent.h: Removed the inline no-op destructor so that DataTransfer does not need to be a complete type in every translation unit that includes this header. Added a type trait specialization. * dom/TextEvent.h: Added isKeyboard() to determine if m_inputType is TextEventInputKeyboard. * editing/Editor.cpp: (WebCore::Editor::shouldInsertText): Returned false if FrameLoader::shouldSuppressKeyboardInput() returns true and the action is EditorInsertActionTyped. * loader/FrameLoader.cpp: (WebCore::FrameLoader::shouldSuppressKeyboardInput): Added. Returns true if Settings::shouldSuppressKeyboardInputDuringProvisionalNavigation() returns true and the state is FrameStateProvisional. * loader/FrameLoader.h: Declared shouldSuppressKeyboardInput(). * page/EventHandler.h: Exported accessKeyModifiers(). * page/Settings.in: Defined shouldSuppressKeyboardInputDuringProvisionalNavigation with an initial value of false. * testing/Internals.cpp: (WebCore::Internals::accessKeyModifiers): Added. Returns a vector of strings representing the access key modifiers. * testing/Internals.h: Declared accessKeyModifiers(). * testing/Internals.idl: Exposed accessKeyModifiers() on the internals object. 2016-12-16 Brady Eidson <beidson@apple.com> More SQLiteIDBCursor refactoring. https://bugs.webkit.org/show_bug.cgi?id=165956 Reviewed by Tim Horton. No new tests (No behavior change). This is a simple patch that encapsulates the current state of the cursor in one structure which will allow for storing multiple-such states in the future (to support prefetching). * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::currentData): (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement): (WebCore::IDBServer::SQLiteIDBCursor::advance): (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique): (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored): (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): (WebCore::IDBServer::SQLiteIDBCursor::iterate): * Modules/indexeddb/server/SQLiteIDBCursor.h: (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID): (WebCore::IDBServer::SQLiteIDBCursor::currentKey): (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey): (WebCore::IDBServer::SQLiteIDBCursor::currentValue): (WebCore::IDBServer::SQLiteIDBCursor::didComplete): (WebCore::IDBServer::SQLiteIDBCursor::didError): 2016-12-16 Jer Noble <jer.noble@apple.com> Follow-up build fix after r209936; also rename MockCDM -> LegacyMockCDM in CMakeLists.txt. * CMakeLists.txt: 2016-12-16 Sam Weinig <sam@webkit.org> [Bindings] Remove use of Dictionary/ArrayValue in CDMSessionClearKey https://bugs.webkit.org/show_bug.cgi?id=165961 Reviewed by Darin Adler. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: Remove ArrayValue.h/cpp * bindings/js/ArrayValue.cpp: Removed. * bindings/js/ArrayValue.h: Removed. * bindings/js/Dictionary.cpp: * bindings/js/Dictionary.h: Remove support for ArrayValue. * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::update): Replace use of Dictionary/ArrayValue with direct JSObject functions. This should really be replaced with a JSON parser that does not require round tripping through JavaScript objects. 2016-12-13 Jer Noble <jer.noble@apple.com> Move existing CDM* implementations into modules/encryptedmedia/legacy https://bugs.webkit.org/show_bug.cgi?id=165823 Rubber-stamped by Sam Weinig. * Modules/encryptedmedia/legacy/LegacyCDM.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDM.cpp. (WebCore::CDMFactory::CDMFactory): (WebCore::installedCDMFactories): (WebCore::CDM::registerCDMFactory): (WebCore::CDMFactoryForKeySystem): (WebCore::CDM::supportsKeySystem): (WebCore::CDM::keySystemSupportsMimeType): (WebCore::CDM::create): (WebCore::CDM::CDM): (WebCore::CDM::~CDM): (WebCore::CDM::supportsMIMEType): (WebCore::CDM::createSession): (WebCore::CDM::mediaPlayer): * Modules/encryptedmedia/legacy/LegacyCDM.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDM.h. (WebCore::CDMClient::~CDMClient): (WebCore::CDM::keySystem): (WebCore::CDM::client): (WebCore::CDM::setClient): * Modules/encryptedmedia/legacy/LegacyCDMPrivate.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivate.h. (WebCore::CDMPrivateInterface::CDMPrivateInterface): (WebCore::CDMPrivateInterface::~CDMPrivateInterface): * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.cpp. (WebCore::CDMPrivateClearKey::supportsKeySystem): (WebCore::CDMPrivateClearKey::supportsKeySystemAndMimeType): (WebCore::CDMPrivateClearKey::supportsMIMEType): (WebCore::CDMPrivateClearKey::createSession): * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.h. (WebCore::CDMPrivateClearKey::CDMPrivateClearKey): (WebCore::CDMPrivateClearKey::~CDMPrivateClearKey): * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp. (WebCore::CDMPrivateMediaPlayer::supportsKeySystem): (WebCore::CDMPrivateMediaPlayer::supportsKeySystemAndMimeType): (WebCore::CDMPrivateMediaPlayer::supportsMIMEType): (WebCore::CDMPrivateMediaPlayer::createSession): * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivateMediaPlayer.h. (WebCore::CDMPrivateMediaPlayer::CDMPrivateMediaPlayer): (WebCore::CDMPrivateMediaPlayer::~CDMPrivateMediaPlayer): (WebCore::CDMPrivateMediaPlayer::cdm): * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp. (WebCore::clearKeyVM): (WebCore::CDMSessionClearKey::CDMSessionClearKey): (WebCore::CDMSessionClearKey::~CDMSessionClearKey): (WebCore::CDMSessionClearKey::generateKeyRequest): (WebCore::CDMSessionClearKey::releaseKeys): (WebCore::CDMSessionClearKey::update): (WebCore::CDMSessionClearKey::cachedKeyForKeyID): * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.h. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/LegacyCDMSession.h: Renamed from Source/WebCore/platform/graphics/CDMSession.h. (WebCore::CDMSessionClient::~CDMSessionClient): (WebCore::CDMSession::CDMSession): (WebCore::CDMSession::~CDMSession): (WebCore::CDMSession::type): (WebCore::CDMSession::cachedKeyForKeyID): * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h: * testing/Internals.cpp: * testing/LegacyMockCDM.cpp: Renamed from Source/WebCore/testing/MockCDM.cpp. (WebCore::MockCDMSession::~MockCDMSession): (WebCore::MockCDM::supportsKeySystem): (WebCore::MockCDM::supportsKeySystemAndMimeType): (WebCore::MockCDM::supportsMIMEType): (WebCore::MockCDM::createSession): (WebCore::initDataPrefix): (WebCore::keyPrefix): (WebCore::keyRequest): (WebCore::generateSessionId): (WebCore::MockCDMSession::MockCDMSession): (WebCore::MockCDMSession::generateKeyRequest): (WebCore::MockCDMSession::releaseKeys): (WebCore::MockCDMSession::update): * testing/LegacyMockCDM.h: Renamed from Source/WebCore/testing/MockCDM.h. (WebCore::MockCDM::MockCDM): (WebCore::MockCDM::~MockCDM): 2016-12-16 Andreas Kling <akling@apple.com> Subframes going into page cache don't need to resetScrollbars(). <https://webkit.org/b/163750> <rdar://problem/29273020> Reviewed by Antti Koivisto. The main frame is the only frame that switches its FrameView when using the page cache, subframes just suspend their DOM and wait around to be either killed or restored. Thus there is no reason for subframes to reset their FrameView's scrollbars when going into page cache, since nothing affects them while cached, and their layout should end up identical when restoring. This was causing some flakiness with subframe scrollbars jumping between different sizes in when restoring from page cache in macOS/WK1. This change makes the behavior consistent in both WK1 and WK2, and removes the flakiness. * dom/Document.cpp: (WebCore::Document::setPageCacheState): 2016-12-16 Wenson Hsieh <wenson_hsieh@apple.com> Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements https://bugs.webkit.org/show_bug.cgi?id=165767 <rdar://problem/29602382> Reviewed by Simon Fraser. When changing the layout viewport override, mark viewport-constrained objects as needing layout. If only the width and height of the old and new layout viewports are compared, EditorState info (namely selection and caret rects) that depends on the document location of fixed elements may be stale immediately after the layout viewport override changes and before layout occurs. This caused one of the tests (fixed-caret-position-after-scroll.html) to occasionally fail. Tests: editing/caret/ios/absolute-caret-position-after-scroll.html editing/caret/ios/fixed-caret-position-after-scroll.html editing/selection/ios/absolute-selection-after-scroll.html editing/selection/ios/fixed-selection-after-scroll.html * page/FrameView.cpp: (WebCore::FrameView::setLayoutViewportOverrideRect): 2016-12-14 Sam Weinig <sam@webkit.org> [ApplePay] Remove remaining custom bindings from the ApplePay code https://bugs.webkit.org/show_bug.cgi?id=165860 Reviewed by Darin Adler. * DerivedSources.make: Add new IDL files. * WebCore.xcodeproj/project.pbxproj: Add/remove files. * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp: Removed. * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp: Removed. * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp: Removed. * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp: Removed. Remove custom bindings. * Modules/applepay/ApplePayLineItem.h: Added. * Modules/applepay/ApplePayLineItem.idl: Added. * Modules/applepay/ApplePayPayment.h: Added. * Modules/applepay/ApplePayPayment.idl: Added. * Modules/applepay/ApplePayPaymentContact.h: Added. * Modules/applepay/ApplePayPaymentContact.idl: Added. * Modules/applepay/ApplePayPaymentMethod.h: Added. * Modules/applepay/ApplePayPaymentMethod.idl: Added. * Modules/applepay/ApplePayPaymentPass.h: Added. * Modules/applepay/ApplePayPaymentPass.idl: Added. * Modules/applepay/ApplePayPaymentRequest.h: Added. * Modules/applepay/ApplePayPaymentRequest.idl: Added. * Modules/applepay/ApplePayShippingMethod.h: Added. * Modules/applepay/ApplePayShippingMethod.idl: Added. Split out dictionaries and enums into separate files where needed. * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp: (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent): * Modules/applepay/ApplePayPaymentAuthorizedEvent.h: * Modules/applepay/ApplePayPaymentAuthorizedEvent.idl: Convert the 'payment' property to return an ApplePayPayment dictionary, removing the need for custom bindings. * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp: (WebCore::ApplePayPaymentMethodSelectedEvent::ApplePayPaymentMethodSelectedEvent): * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h: * Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl: Convert the 'paymentMethod' property to return an ApplePayPaymentMethod dictionary, removing the need for custom bindings. * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): (WebCore::ApplePaySession::create): (WebCore::ApplePaySession::ApplePaySession): (WebCore::ApplePaySession::completeShippingMethodSelection): (WebCore::ApplePaySession::completeShippingContactSelection): (WebCore::ApplePaySession::completePaymentMethodSelection): (WebCore::ApplePaySession::didSelectShippingMethod): * Modules/applepay/ApplePaySession.h: Update for new names, remove need for ExecState in the create function, and simplify billingContact and shippingContact now that they are strongly typed. * Modules/applepay/ApplePaySession.idl: Move dictionaries and enums to their own files. * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp: (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent): * Modules/applepay/ApplePayShippingContactSelectedEvent.h: * Modules/applepay/ApplePayShippingContactSelectedEvent.idl: Convert the 'shippingContact' property to return an ApplePayPaymentContact dictionary, removing the need for custom bindings. * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp: * Modules/applepay/ApplePayShippingMethodSelectedEvent.h: * Modules/applepay/ApplePayShippingMethodSelectedEvent.idl: Convert the 'shippingMethod' property to return an ApplePayShippingMethod dictionary, removing the need for custom bindings. * Modules/applepay/Payment.h: * Modules/applepay/PaymentContact.h: * Modules/applepay/PaymentMethod.h: * Modules/applepay/cocoa/PaymentCocoa.mm: * Modules/applepay/cocoa/PaymentContactCocoa.mm: * Modules/applepay/cocoa/PaymentMethodCocoa.mm: Replace toJS/fromJS functions with ones that convert to/from the associated dictionary type. * bindings/generic/IDLTypes.h: (WebCore::IDLJSON::nullValue): (WebCore::IDLJSON::isNullValue): (WebCore::IDLJSON::extractValueFromNullable): * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLJSON>::convert): (WebCore::JSConverter<IDLJSON>::convert): Add a new custom type, JSON, which converts from a String to a JS object. * bindings/scripts/CodeGenerator.pm: * bindings/scripts/CodeGeneratorJS.pm: Add support for the new JSON type, and improve scoped naming to allow for enums in dictionary only IDL files. * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: Update test result for improved scoped naming. 2016-12-16 Zalan Bujtas <zalan@apple.com> Defer certain accessibility callbacks until after layout is finished. https://bugs.webkit.org/show_bug.cgi?id=165861 rdar://problem/29646301 Reviewed by Chris Fleizach. Currently with certain AXObjectCache callbacks, we can end up in a layout while the render tree is being mutated. This patch ensures that such callbacks are deferred until after tree mutation/layout is finished. Test: accessibility/accessibility-crash-with-dynamic-inline-content.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::performDeferredIsIgnoredChange): (WebCore::AXObjectCache::insertDeferredIsIgnoredChange): * accessibility/AXObjectCache.h: * page/FrameView.cpp: (WebCore::FrameView::performPostLayoutTasks): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::deleteLines): * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::createAndAppendRootInlineBox): 2016-12-16 Ryan Haddad <ryanhaddad@apple.com> Rebaseline bindings tests after r209897. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObj::visitChildren): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterface::visitChildren): 2016-12-15 Brent Fulgham <bfulgham@apple.com> Arguments called in wrong order https://bugs.webkit.org/show_bug.cgi?id=165923 Reviewed by Simon Fraser. Correct the ordering of several function calls. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): The 'nearestToPresentationStartTime' argument is being checked for validity, but 'nearestToPresentationEndTime' is being used in the calculation. This seems like a copy/paste error. * page/PrintContext.cpp: (WebCore::PrintContext::outputLinkedDestinations): FloatPoint::expandedTo returns a new object that has been expanded. This code continued using the 'unexpanded' point. * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::computeImageSizeInBytes): The 'bytesPerComponent' and 'componentsPerPixel' variables were being passed in the wrong order. * platform/network/CacheValidation.cpp: The 'last-modified' header string was being concatenated with the following string, resulting in an incorrect 'last-modifiedproxy-authenticate' string value. * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::firstGlyph): The ASSERT was assigning to the (by-value) input parameter 'codePoint', rather than comparing it to the firstGlyph value's codePoint. 2016-12-16 Youenn Fablet <youenn@apple.com> [Fetch API] Improve resource loading console logging https://bugs.webkit.org/show_bug.cgi?id=160546 Reviewed by Alex Christensen. Covered by rebased tests. Adding support for logging of resource loading failures in ThreadableLoader. This will allow doing consistent logging for clients such as fetch, XHR, event source... Doing logging for Fetch API only at the moment in ThreadableLoader. Future patches should migrate XHR to this logging system. Logging routine is implemented in ThreadableLoader. It is used directly by DocumentThreadableLoader before calling didFail client callback. DocumentThreadableLoader has a new option to not log errors, in the case the client is WorkerThreadableLoader::MainBridge. In that case, the logging is done in the worker context within WorkerThreadableLoader::MainBridge::didFail * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Enable logging. (WebCore::DocumentThreadableLoader::create): Passing logging parameter to constructor. (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Adding initialization of logging parameter. (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Making use of the new logErrorAndFail helper routine. (WebCore::DocumentThreadableLoader::cancel): No need to log error if it is being cancelled. (WebCore::DocumentThreadableLoader::redirectReceived): Made the reportXX routines methods of DocumentThreadableLoaders and using logErrorAndFail internally. (WebCore::DocumentThreadableLoader::didFail): Wrapper around logErrorAndFail since cancel is not calling it anymore. (WebCore::DocumentThreadableLoader::preflightFailure): (WebCore::DocumentThreadableLoader::loadRequest): (WebCore::DocumentThreadableLoader::reportRedirectionWithBadScheme): (WebCore::DocumentThreadableLoader::reportContentSecurityPolicyError): (WebCore::DocumentThreadableLoader::reportCrossOriginResourceSharingError): (WebCore::DocumentThreadableLoader::logErrorAndFail): (WebCore::reportContentSecurityPolicyError): Deleted. (WebCore::reportCrossOriginResourceSharingError): Deleted. (WebCore::reportRedirectionWithBadScheme): Deleted. * loader/DocumentThreadableLoader.h: * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::logError): * loader/ThreadableLoader.h: * loader/ThreadableLoaderClientWrapper.h: (WebCore::ThreadableLoaderClientWrapper::create): (WebCore::ThreadableLoaderClientWrapper::initiator): (WebCore::ThreadableLoaderClientWrapper::ThreadableLoaderClientWrapper): * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::WorkerThreadableLoader): (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail): 2016-12-16 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] Fix build warning in MediaPlayerPrivateGStreamer.cpp using gcc 6.2 https://bugs.webkit.org/show_bug.cgi?id=165900 Reviewed by Žan Doberšek. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs): Move the variable asignation out of the if condition. 2016-12-16 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Implement ReadableByteStreamController cancel internal method https://bugs.webkit.org/show_bug.cgi?id=165798 Reviewed by Youenn Fablet. Implemented cancel method of ReadableByteStreamController. Also fixed small inconsistency in readableByteStreamControllerClose. Added one test to check cancel behaviour. More tests may be added as the API is implemented. * Modules/streams/ReadableByteStreamInternals.js: (privateInitializeReadableByteStreamController): Define cancel internal method. (readableByteStreamControllerCancel): Added. (readableByteStreamControllerClose): Fixed behaviour (no value should be dequeued). * bindings/js/WebCoreBuiltinNames.h: Removed bytesFilled (previous addition was not needed). 2016-12-16 Youenn Fablet <youennf@gmail.com> svg/as-image/svg-image-with-data-uri-use-data-uri.svg is flaky after r207754 https://bugs.webkit.org/show_bug.cgi?id=163887 <rdar://problem/29266436> Reviewed by Alex Christensen. Test: http/tests/security/cross-origin-cached-images-with-memory-pressure.html With the introduction of cached resource cloning, an Image may be referenced by several CachedImage. This did not work well with Image observer system as it mandates a one-to-one relationship. Introducing CachedImageObserver to restore the one-to-one relationship between Image and its observer. CachedImageObserver can keep references for more than one CachedImage. In the future, it might be better to split more clearly CachedImageObserver and its API from CachedImage. Or remove the concept of CachedResource cloning and find new ways to provide CachedResource origin information to clients. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::load): Moved boolean image observer fields to CachedImageObserver. (WebCore::CachedImage::setBodyDataFrom): Keeping a reference of the image observer when cloning the resource. (WebCore::CachedImage::createImage): Creating the observer when creating the image. (WebCore::CachedImage::CachedImageObserver::CachedImageObserver): (WebCore::CachedImage::CachedImageObserver::decodedSizeChanged): (WebCore::CachedImage::CachedImageObserver::didDraw): (WebCore::CachedImage::CachedImageObserver::animationAdvanced): (WebCore::CachedImage::CachedImageObserver::changedInRect): (WebCore::CachedImage::clearImage): * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setBodyDataFrom): Now that each cached image receives decodedSizeChanged callback, we need to set its size correctly. 2016-12-15 Joonghun Park <jh718.park@samsung.com> [EFL] Fix debug build break since r209873. Unreviewed. https://bugs.webkit.org/show_bug.cgi?id=165945 No new tests, no new behaviours. Use Primitive System Data Type uint64_t instead of unsigned long long. * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::openInternal): * Modules/indexeddb/IDBFactory.h: 2016-12-15 Zalan Bujtas <zalan@apple.com> text-align: justify and word-spacing combine to overflow column https://bugs.webkit.org/show_bug.cgi?id=165796 rdar://problem/29672168 Reviewed by Myles C. Maxfield. The value of the word-spacing property is not applied on the inline-tree boxes (normal line layout) with kerning enabled. It causes hittest failures and selection/rendering glitches. We normally use the pre-computed 'WordMeasurements' values to figure out the run widths. However with kerning on, in some cases we need to re-measure a certain part of the text by calling RenderText::width(). This function omits the word-spacing value for leading whitespace, so when this text fragment starts with a whitespace, (while it's not at the beginning of the run) we have to manually add the word-spacing value back. r146087 added this logic with the restriction of applying it only to whitespace-only runs. Test: fast/css/word-spacing-with-normal-layout.html * rendering/RenderBlockLineLayout.cpp: (WebCore::setLogicalWidthForTextRun): 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator https://bugs.webkit.org/show_bug.cgi?id=165931 Reviewed by Alex Christensen. No new tests because there is no behavior change. * dom/CharacterData.cpp: (WebCore::CharacterData::parserAppendData): * editing/TextCheckingHelper.cpp: (WebCore::findMisspellings): * editing/VisibleUnits.cpp: (WebCore::wordBreakIteratorForMinOffsetBoundary): (WebCore::wordBreakIteratorForMaxOffsetBoundary): (WebCore::isLogicalStartOfWord): (WebCore::islogicalEndOfWord): (WebCore::visualWordPosition): (WebCore::startSentenceBoundary): (WebCore::endSentenceBoundary): (WebCore::previousSentencePositionBoundary): (WebCore::nextSentencePositionBoundary): * html/HTMLInputElement.cpp: * html/HTMLTextAreaElement.cpp: * html/InputType.cpp: * html/TextFieldInputType.cpp: * html/TextInputType.cpp: * platform/graphics/StringTruncator.cpp: (WebCore::textBreakAtOrPreceding): (WebCore::boundedTextBreakFollowing): (WebCore::rightClipToWordBuffer): * platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::offsetForPosition): * platform/text/TextBoundaries.cpp: (WebCore::findNextWordFromIndex): (WebCore::findWordBoundary): (WebCore::findEndWordBoundary): * platform/text/mac/TextBoundaries.mm: (WebCore::findNextWordFromIndex): * rendering/BreakLines.h: (WebCore::nextBreakablePositionNonLoosely): (WebCore::nextBreakablePositionLoosely): * rendering/RenderBlock.cpp: * rendering/RenderText.cpp: (WebCore::makeCapitalized): (WebCore::RenderText::previousOffset): (WebCore::RenderText::previousOffsetForBackwardDeletion): (WebCore::RenderText::nextOffset): * rendering/SimpleLineLayoutTextFragmentIterator.h: * rendering/line/LineBreaker.h: 2016-12-15 Darin Adler <darin@apple.com> Use asString instead of toWTFString, toString, or getString when we already checked isString https://bugs.webkit.org/show_bug.cgi?id=165895 Reviewed by Yusuke Suzuki. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): Use asString/value instead of toWTFString. * Modules/mediastream/SDPProcessor.cpp: (WebCore::SDPProcessor::callScript): Use asString/value instead of getString. * bindings/js/ArrayValue.cpp: (WebCore::ArrayValue::get): Use asString/value instead of toWTFString. * bindings/js/IDBBindingUtilities.cpp: (WebCore::get): Use asString/length instead of toString/length. (WebCore::createIDBKeyFromValue): Use asString/value instead of toWTFString. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): Ditto. * bindings/js/JSDataCueCustom.cpp: (WebCore::constructJSDataCue): Use asString/value instead of getString. * bindings/js/JSInspectorFrontendHostCustom.cpp: (WebCore::populateContextMenuItems): Use asString/value instead of toWTFString. * bindings/js/ScriptController.cpp: (WebCore::jsValueToModuleKey): Use asString/toIdentifier instead of jsCast<JSString*>/value/Identifier::fromString. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): Streamline by getting rid of local variable. * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::getDomainList): Use asString instead of jsCast<JSString*>. (WebCore::ContentExtensions::loadTrigger): Use asString/value instead of toWTFString. (WebCore::ContentExtensions::loadAction): Ditto. * css/FontFace.cpp: (WebCore::FontFace::create): Use asString/value instead of getString. 2016-12-15 Zalan Bujtas <zalan@apple.com> Change ::computeLogicalHeight's computedValues out argument to the return value. https://bugs.webkit.org/show_bug.cgi?id=165789 Reviewed by Simon Fraser. No change in functionality. * html/shadow/SliderThumbElement.cpp: (WebCore::RenderSliderContainer::computeLogicalHeight): * html/shadow/mac/ImageControlsButtonElementMac.cpp: (WebCore::RenderImageControlsButton::computeLogicalHeight): * html/shadow/mac/ImageControlsRootElementMac.cpp: (WebCore::RenderImageControls::computeLogicalHeight): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::computeBlockPreferredLogicalWidths): (WebCore::RenderBlock::estimateRegionRangeForBoxChild): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::checkForPaginationLogicalHeightChange): * rendering/RenderBox.cpp: (WebCore::RenderBox::updateLogicalHeight): (WebCore::RenderBox::computeLogicalHeight): (WebCore::RenderBox::computePercentageLogicalHeight): (WebCore::RenderBox::computeReplacedLogicalHeightUsing): (WebCore::RenderBox::availableLogicalHeightUsing): * rendering/RenderBox.h: (WebCore::RenderBox::ComputedMarginValues::ComputedMarginValues): Deleted. (WebCore::RenderBox::LogicalExtentComputedValues::LogicalExtentComputedValues): Deleted. * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::mainAxisContentExtent): * rendering/RenderFlowThread.cpp: (WebCore::RenderFlowThread::computeLogicalHeight): * rendering/RenderFlowThread.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::computeLogicalHeight): * rendering/RenderListBox.h: * rendering/RenderMeter.cpp: (WebCore::RenderMeter::computeLogicalHeight): * rendering/RenderMeter.h: * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::RenderMultiColumnFlowThread::computeLogicalHeight): * rendering/RenderMultiColumnFlowThread.h: * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::computeLogicalHeight): * rendering/RenderMultiColumnSet.h: * rendering/RenderProgress.cpp: (WebCore::RenderProgress::computeLogicalHeight): * rendering/RenderProgress.h: * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::computeLogicalHeight): * rendering/RenderTextControl.h: * rendering/RenderView.cpp: (WebCore::RenderView::computeLogicalHeight): * rendering/RenderView.h: * rendering/svg/RenderSVGForeignObject.cpp: (WebCore::RenderSVGForeignObject::computeLogicalHeight): * rendering/svg/RenderSVGForeignObject.h: 2016-12-15 Chris Dumez <cdumez@apple.com> Make sure HTML validation bubble's state is updated after layout https://bugs.webkit.org/show_bug.cgi?id=165922 <rdar://problem/29694730> Reviewed by Simon Fraser. Make sure HTML validation bubble's state is updated after layout. In particular, if the validation bubble's associated element has moved or is no longer visible, we now hide the bubble. Tests: fast/forms/validation-bubble-disappears-when-input-detached.html fast/forms/validation-bubble-disappears-when-input-moved.html fast/forms/validation-bubble-disappears-when-input-no-longer-visible.html * page/FrameView.cpp: (WebCore::FrameView::viewportContentsChanged): * page/Page.cpp: (WebCore::Page::updateValidationBubbleStateIfNeeded): * page/Page.h: * page/ValidationMessageClient.h: 2016-12-15 Sam Weinig <sam@webkit.org> [WebIDL] Remove use of Dictionary from JSCryptoAlgorithmDictionary https://bugs.webkit.org/show_bug.cgi?id=165919 Reviewed by Darin Adler. * bindings/js/JSCryptoAlgorithmDictionary.cpp: * bindings/js/JSCryptoAlgorithmDictionary.h: * bindings/js/JSCryptoOperationData.cpp: * bindings/js/JSCryptoOperationData.h: * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Replace simplistic use of Dictionary with simplistic use of direct JSObject functions. Also, pass the ExecState by reference. 2016-12-15 Filip Pizlo <fpizlo@apple.com> Get rid of HeapRootVisitor and make SlotVisitor less painful to use https://bugs.webkit.org/show_bug.cgi?id=165911 Reviewed by Geoffrey Garen. No new tests because no new behavior. This updates WebCore code to new JSC API. * bindings/js/JSDOMBinding.cpp: (WebCore::DOMConstructorJSBuiltinObject::visitChildren): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::visitChildren): * bindings/js/JSDOMPromise.h: (WebCore::DeferredPromise::visitAggregate): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::visitJSFunction): * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::JSWorkerGlobalScopeBase::visitChildren): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> Sort Xcode project files https://bugs.webkit.org/show_bug.cgi?id=165937 Reviewed by Simon Fraser. No new tests because there is no behavior change. * WebCore.xcodeproj/project.pbxproj: 2016-12-15 Chris Dumez <cdumez@apple.com> Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent https://bugs.webkit.org/show_bug.cgi?id=165904 Reviewed by Sam Weinig. Move 'charCode' / 'keyCode' attributes from UIEvent to KeyboardEvent and add 'which' to KeyboardEvent to match the specification: - https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent We keep a 'which' attribute on UIEvent even though the specification does not say we should because Firefox and Chrome have 'which' on UIEvent still. Specification: - 'charCode' / 'keyCode' / 'which' on KeyboardEvent only Firefox: - 'charCode' / 'keyCode' on KeyboardEvent only - 'which' on UIEvent only Chrome: - 'charCode' / 'keyCode' / 'which' on KeyboardEvent - 'which' on UIEvent as well Old WebKit behavior: - 'charCode' / 'keyCode' / 'which' on UIEvent only New WebKit behavior: - 'charCode' / 'keyCode' / 'which' on KeyboardEvent - 'which' on UIEvent as well Our new behavior is identical to Chrome, much closer to the specification, and closer to Firefox as well. No new tests, updated / rebaselined existing tests. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): (WebCore::KeyboardEvent::keyCode): (WebCore::KeyboardEvent::charCode): (WebCore::KeyboardEvent::which): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * dom/MouseEvent.cpp: (WebCore::MouseEvent::which): * dom/UIEvent.cpp: * dom/UIEvent.h: * dom/UIEvent.idl: 2016-12-15 Brady Eidson <beidson@apple.com> IndexedDB: Add an "IDBCursorRecord" struct. https://bugs.webkit.org/show_bug.cgi?id=165929 Reviewed by Alex Christensen. No new tests (Refactor, no behavior change). * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::currentData): (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement): (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique): (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): (WebCore::IDBServer::SQLiteIDBCursor::iterate): * Modules/indexeddb/server/SQLiteIDBCursor.h: (WebCore::IDBServer::SQLiteIDBCursor::currentKey): (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey): (WebCore::IDBServer::SQLiteIDBCursor::currentValue): * Modules/indexeddb/shared/IDBCursorRecord.h: Added. (WebCore::IDBCursorRecord::encode): (WebCore::IDBCursorRecord::decode): * WebCore.xcodeproj/project.pbxproj: 2016-12-15 Keith Rollin <krollin@apple.com> Refactor Document::suspend/resume https://bugs.webkit.org/show_bug.cgi?id=165921 Reviewed by Chris Dumez. Update Document::suspend to call Document::suspendScheduledTasks rather than duplicating the latter's code within itself. Similar treatment of Document::resume and Document::resumeScheduledTasks. No new tests -- no new functionality, just refactoring existing code. * dom/Document.cpp: (WebCore::Document::suspend): (WebCore::Document::resume): 2016-12-15 Alex Christensen <achristensen@webkit.org> Remove flex and bison build dependencies; commit generated XPath parser https://bugs.webkit.org/show_bug.cgi?id=165783 Reviewed by Brent Fulgham. flex and bison are annoying to install and use, especially on Windows. Since only XPathGrammar uses them and that's not actively developed, let's just check in the one generated file and make building WebKit easier forever! * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * css/makegrammar.pl: Removed. * xml/XPathGrammar.cpp: Added. (xpathyylex): (xpathyyerror): (yysyntax_error): * xml/XPathGrammar.h: Added. * xml/XPathGrammar.y: Rename TEXT to TEXT_ to fix a build error on Windows. TEXT is already defined. 2016-12-15 Brady Eidson <beidson@apple.com> Enhance some of the logging statements just added for IndexedDB Operation scheduling. Rubberstamped by Tim Horton. No new tests (No behavior change). * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::iterateCursor): (WebCore::IDBTransaction::requestGetRecord): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::requestPutOrAdd): * Modules/indexeddb/shared/IDBCursorInfo.cpp: (WebCore::IDBCursorInfo::loggingString): * Modules/indexeddb/shared/IDBIterateCursorData.cpp: (WebCore::IDBIterateCursorData::loggingString): 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Implement font-synthesis: small-caps https://bugs.webkit.org/show_bug.cgi?id=165892 Reviewed by David Hyatt. The CSS Fonts level 4 spec adds a new value to the "font-synthesis" property which controls whether or not small-caps is allowed to be synthesized. Luckily, we already have an implementation of this straightforward, so the implementation is quite simple. Tests: css3/font-synthesis-small-caps.html fast/text/font-synthesis-parsing.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::fontSynthesisFromStyle): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertFontSynthesis): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontSynthesis): * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::makeFlagsKey): * platform/graphics/FontDescription.cpp: (WebCore::FontDescription::FontDescription): * platform/graphics/FontDescription.h: (WebCore::FontCascadeDescription::initialFontSynthesis): * platform/graphics/mac/ComplexTextController.cpp: (WebCore::shouldSynthesize): (WebCore::ComplexTextController::collectComplexTextRuns): 2016-12-15 Brady Eidson <beidson@apple.com> Add a new Logging Channel for IndexedDB Operation scheduling. https://bugs.webkit.org/show_bug.cgi?id=165912 Reviewed by Alex Christensen. No new tests (No behavior change). * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::transaction): * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::openInternal): (WebCore::IDBFactory::deleteDatabase): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::commit): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::createIndex): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::doRequestOpenCursor): (WebCore::IDBTransaction::iterateCursor): (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): (WebCore::IDBTransaction::requestGetAllIndexRecords): (WebCore::IDBTransaction::requestGetRecord): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::requestCount): (WebCore::IDBTransaction::requestDeleteRecord): (WebCore::IDBTransaction::requestClearObjectStore): (WebCore::IDBTransaction::requestPutOrAdd): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::deleteIndex): * Modules/indexeddb/shared/IDBCursorInfo.cpp: (WebCore::IDBCursorInfo::loggingString): * Modules/indexeddb/shared/IDBCursorInfo.h: * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp: (WebCore::IDBGetAllRecordsData::loggingString): * Modules/indexeddb/shared/IDBGetAllRecordsData.h: * Modules/indexeddb/shared/IDBGetRecordData.cpp: (WebCore::IDBGetRecordData::loggingString): * Modules/indexeddb/shared/IDBGetRecordData.h: * Modules/indexeddb/shared/IDBIndexInfo.cpp: (WebCore::IDBIndexInfo::condensedLoggingString): * Modules/indexeddb/shared/IDBIndexInfo.h: * Modules/indexeddb/shared/IDBIterateCursorData.cpp: (WebCore::IDBIterateCursorData::loggingString): * Modules/indexeddb/shared/IDBIterateCursorData.h: * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::condensedLoggingString): * Modules/indexeddb/shared/IDBObjectStoreInfo.h: * platform/Logging.h: 2016-12-15 Konstantin Tokarev <annulen@yandex.ru> Added missing override and final specifiers https://bugs.webkit.org/show_bug.cgi?id=165903 Reviewed by Darin Adler. No new tests needed. * Modules/mediastream/OverconstrainedErrorEvent.h: * bindings/js/JSCallbackData.h: * bindings/js/JSCustomXPathNSResolver.h: * bindings/js/JSErrorHandler.h: * css/StyleRuleImport.h: * dom/SecurityPolicyViolationEvent.h: * editing/CreateLinkCommand.h: * editing/DeleteSelectionCommand.h: * editing/DictationCommand.h: * editing/Editor.cpp: * editing/FormatBlockCommand.h: * editing/IndentOutdentCommand.h: * editing/InsertLineBreakCommand.h: * editing/InsertParagraphSeparatorCommand.h: * editing/ModifySelectionListLevel.h: * editing/MoveSelectionCommand.h: * editing/RemoveFormatCommand.h: * editing/RemoveNodePreservingChildrenCommand.h: * editing/ReplaceSelectionCommand.h: * editing/SimplifyMarkupCommand.h: * editing/SplitTextNodeContainingElementCommand.h: * editing/UnlinkCommand.h: * fileapi/FileReaderLoader.h: * html/canvas/ANGLEInstancedArrays.h: * html/canvas/WebGLVertexArrayObjectBase.h: * loader/SinkDocument.h: * loader/archive/mhtml/MHTMLArchive.h: * page/animation/CSSPropertyAnimation.cpp: * platform/audio/MultiChannelResampler.cpp: * platform/audio/SincResampler.cpp: * platform/audio/gstreamer/AudioDestinationGStreamer.h: * platform/audio/gstreamer/AudioSourceProviderGStreamer.h: * platform/graphics/TextTrackRepresentation.cpp: * platform/graphics/displaylists/DisplayListItems.h: * platform/graphics/filters/FEBlend.h: * platform/graphics/filters/FEColorMatrix.h: * platform/graphics/filters/FEComponentTransfer.h: * platform/graphics/filters/FEConvolveMatrix.h: * platform/graphics/filters/FEDiffuseLighting.h: * platform/graphics/filters/FEDropShadow.h: * platform/graphics/filters/FEGaussianBlur.h: * platform/graphics/filters/FELighting.h: * platform/graphics/filters/FEMerge.h: * platform/graphics/filters/FEMorphology.h: * platform/graphics/filters/FEOffset.h: * platform/graphics/filters/FESpecularLighting.h: * platform/graphics/filters/FETile.h: * platform/graphics/filters/FETurbulence.h: * platform/graphics/filters/SourceAlpha.h: * platform/graphics/filters/SourceGraphic.h: * platform/graphics/opengl/Extensions3DOpenGL.h: * platform/graphics/opengl/Extensions3DOpenGLCommon.h: * platform/graphics/texmap/TextureMapperBackingStore.h: * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: * platform/mock/GeolocationClientMock.h: * platform/text/TextCodecICU.h: * platform/text/TextCodecLatin1.h: * platform/text/TextCodecUTF16.h: * platform/text/TextCodecUTF8.h: * platform/text/TextCodecUserDefined.h: * rendering/RenderFullScreen.cpp: * storage/StorageEvent.h: * svg/properties/SVGListProperty.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGStaticPropertyTearOff.h: * xml/NativeXPathNSResolver.h: * xml/XMLHttpRequestProgressEvent.h: * xml/XMLHttpRequestProgressEventThrottle.h: * xml/XPathVariableReference.h: * xml/XSLImportRule.h: 2016-12-15 Chris Dumez <cdumez@apple.com> Inline Document::existingAXObjectCache() https://bugs.webkit.org/show_bug.cgi?id=165906 Reviewed by Darin Adler. Inline Document::existingAXObjectCache() to avoid paying function call cost in the common case where AX is disabled. * dom/Document.cpp: (WebCore::Document::existingAXObjectCacheSlow): (WebCore::Document::existingAXObjectCache): Deleted. * dom/Document.h: (WebCore::Document::existingAXObjectCache): 2016-12-15 Ryan Haddad <ryanhaddad@apple.com> Rebaseline bindings tests after r209864. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<DictionaryImplName>): 2016-12-15 Andreas Kling <akling@apple.com> Always clear RenderLayer backing stores when going into page cache. <https://webkit.org/b/165901> Reviewed by Simon Fraser. We were already doing this for the iOS and GTK+ ports, let's do it everywhere for consistency, and a bit of memory usage improvement. This patch just removes the setting and always calls FrameView::clearBackingStores() when there is composited content going into page cache. * history/CachedFrame.cpp: (WebCore::CachedFrame::CachedFrame): * history/PageCache.h: (WebCore::PageCache::shouldClearBackingStores): Deleted. (WebCore::PageCache::setShouldClearBackingStores): Deleted. 2016-12-15 Darin Adler <darin@apple.com> Remove custom binding for MediaDevices https://bugs.webkit.org/show_bug.cgi?id=165894 Reviewed by Eric Carlson. Removes the explicit code to parse the MediaStreamConstraints and MediaTrackConstraints. Next step could be to change the internal code to use the structs from bindings directly so we don't need code to convert to an internal format. * CMakeLists.txt: Added MediaTrackConstraints.idl and MediaTrackConstraints.cpp, removed JSMediaDevicesCustom.cpp. * DerivedSources.make: Added MediaTrackConstraints.idl. Also sorted list of IDL files and fixed use of tabs. * Modules/mediastream/MediaDevices.cpp: (WebCore::createMediaConstraintsImpl): Added. (WebCore::MediaDevices::getUserMedia): Changed this function to take arguments that are generated by the bindings script, and call createMediaConstraintsImpl to convert into the internal data structure. * Modules/mediastream/MediaDevices.h: Added StreamConstraints struct and changed getUserMedia to take that as specified in the IDL. * Modules/mediastream/MediaDevices.idl: Added definition of the MediaStreamConstraints dictionary. Removed [Custom] from getUserMedia. * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::MediaStream): Pass a reference to addObserver. (WebCore::MediaStream::~MediaStream): Pass a rference to removeObserver. (WebCore::MediaStream::internalAddTrack): Ditto. (WebCore::MediaStream::internalRemoveTrack): Ditto. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::createMediaConstraintsImpl): Added. (WebCore::MediaStreamTrack::applyConstraints): Changed to take an optional MediaTrackConstraints argument and call createMediaConstraintsImpl to convert into the internal data structure. Also merged the multiple overloads of this all into a single function, used auto to make the code easier to read, and moved the code that stores new constrains into the success handling, since the specification says that's the only case where we should store it. (WebCore::MediaStreamTrack::addObserver): Take a reference instead of a pointer. (WebCore::MediaStreamTrack::removeObserver): Ditto. * Modules/mediastream/MediaStreamTrack.h: Removed many unneeded includes. Changed getConstraints to return const MediaTrackConstraints&, applyConstraints to take an optional MediaTrackConstraints, add/removeObserver to take a reference rather than a pointer, and changed m_constraints to be a MediaTrackConstraints instead of a RefPtr<MediaConstraints>. * Modules/mediastream/MediaStreamTrack.idl: Removed [Custom] from getConstraints and applyConstraints. * Modules/mediastream/MediaTrackConstraints.cpp: Added. (WebCore::set): Overloaded function to set constriaints in a MediaTrackConstraintSetMap. (WebCore::convertToInternalForm): Helper function that takes a MediaTrackConstraintSet and turns it into a MediaTrackConstraintSetMap. (WebCore::convertAdvancedToInternalForm): More of the same, but for vectors. (WebCore::createMediaConstraintsImpl): Top level function. Calls the other functions and then MediaConstraintsImpl::create. * Modules/mediastream/MediaTrackConstraints.h: Added. Contains all the structures and type definitions for the dictionaries defined in the IDL file, and also the createMediaConstraintsImpl function declaration. * Modules/mediastream/MediaTrackConstraints.idl: Added. Contains the MediaTrackConstraints and all the other dictionaries and typedefs that are needed to define that dictionary. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::start): Changed to not depend on MediaDevices::Promise. (WebCore::UserMediaRequest::UserMediaRequest): Ditto. (WebCore::isSecure): Rearranged to be easier to understand. (WebCore::UserMediaRequest::start): Removed a local variable for simplicity. (WebCore::UserMediaRequest::document): Removed a redundant null check. * Modules/mediastream/UserMediaRequest.h: Reduced includes, changed to not depend on MediaDevices::Promise, removing the reason to include MediaDevices.h. * WebCore.xcodeproj/project.pbxproj: Updated to remove old files and add new ones. * bindings/js/JSBindingsAllInOne.cpp: Removed JSMediaDevicesCustom.cpp. * bindings/js/JSMediaDevicesCustom.cpp: Removed. * bindings/js/JSMediaDevicesCustom.h: Removed. * bindings/js/JSMediaStreamTrackCustom.cpp: (WebCore::JSMediaStreamTrack::applyConstraints): Deleted. (WebCore::JSMediaStreamTrack::getConstraints): Deleted. * bindings/scripts/CodeGenerator.pm: (ProcessDocument): Updated to allow multiple standalone dictionaries, as long as the name of one of the dictionaries matches the name of the file. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionary): Added "other dictionaries" argument so we can support files with multiple dictionaries in them. (GenerateDictionariesHeaderContent): Completed support for dictionaries that are not named after a top level interface by added one more check for a missing $interface in a place that otherwise would not handle it correctly. (GenerateImplementation): Removed code that set $currentCachedAttribute and $cacheIndex, since no was reading the value of either any longer. (GenerateDictionaryHeader): Added "other dictionaries". (GenerateDictionaryImplementation): Ditto. (WriteData): Removed unnnecessarily indirect code that was using FileNamePrefix and a local variable named $prefix instead of just writing "JS". * bindings/scripts/generate-bindings.pl: Corrected the use of the fileparse function from the Path::Basename module; after reading the documentation for this it is clear that there is no need to first call basename, and fileparse should also be used instead of basename. * platform/mediastream/MediaConstraints.h: Removed unneeded includes. (WebCore::StringConstraint::appendExact): Removed an incorrect use of clear here that would mess up cases where there is supposed to be more than one exact value. * platform/mediastream/MediaStreamTrackPrivate.cpp: Remvoed unneeded includes. (WebCore::MediaStreamTrackPrivate::clone): Removed code to copy m_constraints. (WebCore::MediaStreamTrackPrivate::constraints): Deleted. * platform/mediastream/MediaStreamTrackPrivate.h: Removed the constraints function member and the m_constraints data member. 2016-12-15 Dave Hyatt <hyatt@apple.com> [CSS Parser] Enable CSS Deferred Parsing https://bugs.webkit.org/show_bug.cgi?id=165869 Reviewed by Sam Weinig. Enable CSS deferred parsing once again. It's now behind a pref, so it's easy to flip off and on. To address the memory regression that caused the previous rollout, the tokenizer is no longer retained. Instead the sheet text and escaped strings are retained by CSSDeferredParser, and then DeferredStyleProperties and DeferredStyleGroupRuleList make copies of the tokens from the original tokenization process. As the rules get parsed, these tokens get thrown away. This means that instead of the entire set of tokens staying in memory as long as even one unparsed rule remained, now only the tokens that still need parsing will remain alive. Unparsed rules will consume slightly more memory than parsed rules, but the more unparsed rules you have, the bigger the performance win as well, so this is a tradeoff. Given that the parsing speed is going up by anywhere from 25-40% on cold loads of pages (where all stylesheets have to parse), this seems worth it to me. * css/parser/CSSParserMode.h: * page/Settings.in: 2016-12-15 Alejandro G. Castro <alex@igalia.com> [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html https://bugs.webkit.org/show_bug.cgi?id=165316 Reviewed by Philippe Normand. Fixed the ended support of the video element in the OWR player and fixed the videoTracks support. Now the OW player properly adds and removes the audio and video tracks. Added the getSettings support to the mediastream interface. Solved also the size handling in some of the enable/muted situations. Unskipping fast/mediastream/MediaStream-video-element-track-stop.html. * platform/GStreamer.cmake: Added the new RealtimeMediaSourceOwr.cpp with the new code handling the settings. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr): Release the new video and audio maps that creates a relationship of the mediastream tracks with the mediatracks of the video element. (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to false when we start playing. (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media tracks to the player so that the videoTracks API returns it, and add an entry in the map to be able to restore it using the mediastream track. (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks): Move some part of the stop function to this one in order to use it in pause method and avoid changing the video selection in that case. (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the function disableMediaTracks and we also change teh selected videoTrack. (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For videoTrack reset the size and the selected element. In case there is no media playing we Make sure we set the ended variable to true and call the timeChange to modify the state of the player. (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged): Handle properly the situation when the user changed the enabled value, we disable the media. (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the size of the source. (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided to make sure we return a size even when the sample is not ready for gst. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h: Added the ended attribute and the maps. * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new realtime video and audio sources classes, this new classes implement the settings of each type of media element. * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): Use the new audio and video source classes instead of the general one in order to handle the settings properly. * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the subclass and return the new currentSettings attribute. (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the subclass initialization of the supportedSettings. * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to initialize the settings before returning the value. Implemented in the subclass. (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints): Added to initialize the supported settings of the media. Implemented in the subclass. (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp file, implemented using the initialize functions of the subclass * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added this new class to handle the settings of the video elements. The class initializes the settings and the supportedSettings. * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added this new class to handle the settings of the audio elements. The class initializes the settings and the supportedSettings. 2016-12-15 Alex Christensen <achristensen@webkit.org> REGRESSION (r208902) Null pointer dereference in wkIsPublicSuffix https://bugs.webkit.org/show_bug.cgi?id=165885 <rdar://problem/29476917> Reviewed by Darin Adler. wkIsPublicSuffix crashes if you give it a nil NSString*. This was possible before IDN2008 adoption, but it's more common now because domains like "r4---asdf.example.com" fail in uidna_nameToASCII but not in uidna_IDNToASCII. decodeHostName can return a nil NSString. We can't use it unchecked, so instead we use an algorithm that allows for decoding failures while still finding top privately controlled domains correctly. Tested by new API tests which crash before this change and verify the behavior matches behavior before r208902. * platform/mac/PublicSuffixMac.mm: (WebCore::isPublicSuffix): (WebCore::topPrivatelyControlledDomain): 2016-12-15 Alex Christensen <achristensen@webkit.org> Fix Windows WebGL build after r209832 * CMakeLists.txt: 2016-12-14 Hunseop Jeong <hs85.jeong@samsung.com> Unreviewed build fix after r209832 * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::sharedDisplay): Added the guard for the clang 2016-12-14 Yusuke Suzuki <utatane.tea@gmail.com> [GTK] Support latest SubtleCrypto HMAC APIs https://bugs.webkit.org/show_bug.cgi?id=165863 Reviewed by Sam Weinig. SubtleCrypto spec is updated, and new delegate implementations are required to support these interfaces. This patch implements platformSign and platformVerify with WorkQueues for gcrypt backend. * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: (WebCore::calculateSignature): (WebCore::CryptoAlgorithmHMAC::platformSign): (WebCore::CryptoAlgorithmHMAC::platformVerify): 2016-12-14 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r209415. This workaround is no longer needed now that <rdar://problem/29518605> has been fixed Reverted changeset: "Add HTML interactive form validation blacklist for some WebKit-specific sites" https://bugs.webkit.org/show_bug.cgi?id=165470 http://trac.webkit.org/changeset/209415 2016-12-14 Dean Jackson <dino@apple.com> Update prefers-reduced-motion syntax https://bugs.webkit.org/show_bug.cgi?id=165880 <rdar://problems/29671807> Reviewed by Sam Weinig. After discussion in: https://github.com/w3c/csswg-drafts/issues/442 ... the syntax of prefers-reduced-motion was changed to accept "reduce" or "no-preference". Updated the tests in fast/media. * css/CSSValueKeywords.in: Add no-preference keyword. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): 2016-12-14 Sam Weinig <sam@webkit.org> REGRESSION (204679): Google notifications never load (expecting DOMStringList rather than JS array for Location.ancestorOrigins) <rdar://problem/29573563> https://bugs.webkit.org/show_bug.cgi?id=165872 Reviewed by Chris Dumez. Revert the Location.ancestorOrigins part of r204679 because google.com is relying on it returning a DOMStringList (or at least something with a .item() function), rather than a frozen javascript array. Spec changes are tracked with https://github.com/whatwg/html/issues/2179. * page/Location.cpp: (WebCore::Location::ancestorOrigins): * page/Location.h: * page/Location.idl: Change Location.ancestorOrigins back to returning a DOMStringList. 2016-12-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Rename StyleKeyframe to StyleRuleKeyframe https://bugs.webkit.org/show_bug.cgi?id=165876 Reviewed by Simon Fraser. * css/CSSKeyframeRule.cpp: (WebCore::StyleRuleKeyframe::StyleRuleKeyframe): (WebCore::StyleRuleKeyframe::~StyleRuleKeyframe): (WebCore::StyleRuleKeyframe::mutableProperties): (WebCore::StyleRuleKeyframe::keyText): (WebCore::StyleRuleKeyframe::setKeyText): (WebCore::StyleRuleKeyframe::cssText): (WebCore::CSSKeyframeRule::CSSKeyframeRule): (WebCore::StyleKeyframe::StyleKeyframe): Deleted. (WebCore::StyleKeyframe::~StyleKeyframe): Deleted. (WebCore::StyleKeyframe::mutableProperties): Deleted. (WebCore::StyleKeyframe::keyText): Deleted. (WebCore::StyleKeyframe::setKeyText): Deleted. (WebCore::StyleKeyframe::cssText): Deleted. * css/CSSKeyframeRule.h: * css/CSSKeyframesRule.cpp: (WebCore::StyleRuleKeyframes::keyframes): (WebCore::StyleRuleKeyframes::parserAppendKeyframe): (WebCore::StyleRuleKeyframes::wrapperAppendKeyframe): (WebCore::CSSKeyframesRule::appendRule): (WebCore::CSSKeyframesRule::item): * css/CSSKeyframesRule.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForKeyframe): (WebCore::StyleResolver::keyframeStylesForAnimation): * css/StyleResolver.h: * css/StyleRule.cpp: (WebCore::StyleRuleBase::destroy): * css/StyleRule.h: * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseKeyframeRule): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseDeferredKeyframeList): (WebCore::CSSParserImpl::consumeKeyframesRule): (WebCore::CSSParserImpl::consumeKeyframeStyleRule): * css/parser/CSSParserImpl.h: 2016-12-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make deferred parsing retain the sheet text. Fix invalidation to avoid deferred parsing. https://bugs.webkit.org/show_bug.cgi?id=165868 Reviewed by Simon Fraser. With this new model of token copying, the sheet text needs to be retained. The tokenizer did this, but we're no longer keeping it around. StyleInvalidation is also aggressively crawling media rules, even unsupported ones, so fix it to avoid deferred parsing. * css/StyleInvalidationAnalysis.cpp: (WebCore::shouldDirtyAllStyle): * css/parser/CSSDeferredParser.cpp: (WebCore::CSSDeferredParser::CSSDeferredParser): * css/parser/CSSDeferredParser.h: (WebCore::CSSDeferredParser::create): * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::CSSParserImpl): 2016-12-14 Ryosuke Niwa <rniwa@webkit.org> iOS: An element with tabindex is not focusable unless there is no mouse event handler https://bugs.webkit.org/show_bug.cgi?id=165843 Reviewed by Antti Koivisto. The bug was caused by ancestorRespondingToClickEvents not checking the precense of tabindex attribute. Check that condition along with event listeners. Test: fast/events/focusing-element-with-tabindex-by-tap-or-click.html * page/ios/FrameIOS.mm: (WebCore::ancestorRespondingToClickEvents): 2016-12-14 Alex Christensen <achristensen@webkit.org> Progress towards using ANGLE to do WebGL rendering https://bugs.webkit.org/show_bug.cgi?id=165864 Reviewed by Dean Jackson. No new tests, no change in behavior. Just compile fixes for a configuration that will soon be standard that can be landed now without breaking anything. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::sharedDisplay): Ignore some clang warnings that will cause problems when this is compiled on Mac. 2016-12-14 Dean Jackson <dino@apple.com> [iOS] MediaDocuments have controls on the bottom of the page https://bugs.webkit.org/show_bug.cgi?id=165865 <rdar://problem/28757268> Reviewed by Jon Lee. MediaDocuments on iOS are incorrectly placing the controls at the bottom of the page. This is due to the <video> element getting a height of 100%. It should be "auto" instead. * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure): 2016-12-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes https://bugs.webkit.org/show_bug.cgi?id=165743 Reviewed by Dean Jackson. Added new tests in fast/css/deferred-parsing. This patch implements deferred parsing in CSS. By default, when parsing author stylesheets, the parser goes into a deferred mode where it leaves the declaration block of all style rules unparsed initially. Instead of creating and setting an ImmutableStyleProperties object on the StyleRule, the parser creates a DeferredStyleProperties object instead that is capable of calling into CSSDeferredParser to parse the properties and values only when the properties are finally asked for. In addition, this patch defers the parsing of the interior of @media, @supports, and @keyframes rules. @media blocks that are never matched will never parse any of the rules inside. @supports conditions for unsupported features will also not be parsed. For @keyframes, if the animation is never referenced/used, then the @keyframes child rules will never be parsed. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: Add CSSDeferredParser to the build. * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::matchingFaces): Patched to drop the StyleSheetContents* argument from parseValue, since it is no longer needed. * css/CSSKeyframesRule.cpp: (WebCore::StyleRuleKeyframes::StyleRuleKeyframes): (WebCore::StyleRuleKeyframes::parseDeferredRulesIfNeeded): (WebCore::StyleRuleKeyframes::keyframes): (WebCore::StyleRuleKeyframes::wrapperAppendKeyframe): (WebCore::StyleRuleKeyframes::wrapperRemoveKeyframe): (WebCore::StyleRuleKeyframes::findKeyframeIndex): * css/CSSKeyframesRule.h: Keyframes now hold both a keyframes Vector and a DeferredStyleGroupRuleList object. The keyframes vector won't be populated until it is needed, and the population is done by DeferredStyleGroupRuleList, which holds both the original tokens of the keyframes rule interior, and a references to the CSSDeferredParser that will do the parsing. * css/DOMCSSNamespace.cpp: (WebCore::DOMCSSNamespace::supports): Patched to drop the StyleSheetContents* argument from parseValue, since it is no longer needed. * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::collectMatchingRulesForList): ElementRuleCollector tests to see if a rule is empty by counting properties(), but we don't want to initiate deferred parsing just to check this. Instead we invoke propertiesWithoutDeferredParsing, which will hand back a nullptr if the properties haven't been parsed yet. In order to ensure this optimization continues to work, any rules whose interiors consist of only whitespace do not get deferred. * css/FontFace.cpp: (WebCore::FontFace::setVariant): * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::setProperty): (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): Patched to drop the StyleSheetContents* argument from parseValue, since it is no longer needed. * css/StyleProperties.cpp: (WebCore::MutableStyleProperties::MutableStyleProperties): (WebCore::MutableStyleProperties::setProperty): (WebCore::DeferredStyleProperties::create): (WebCore::DeferredStyleProperties::DeferredStyleProperties): (WebCore::DeferredStyleProperties::~DeferredStyleProperties): (WebCore::DeferredStyleProperties::parseDeferredProperties): * css/StyleProperties.h: (WebCore::StylePropertiesBase::type): (WebCore::StylePropertiesBase::cssParserMode): (WebCore::StylePropertiesBase::StylePropertiesBase): (WebCore::StyleProperties::isMutable): (WebCore::StyleProperties::StyleProperties): (WebCore::StylePropertiesBase::deref): (isType): (WebCore::StyleProperties::cssParserMode): Deleted. (WebCore::StyleProperties::deref): Deleted. Right now StyleProperties has two subclasses, ImmutableStyleProperties (which is created by the parser when not deferring), and MutableStyleProperties (used when making changes and doing DOM Manipulations). This patch adds a new base class called StylePropertiesBase, and StyleProperties now derives from it. DeferredStyleProperties derives from this base. The members of StyleProperties have been moved up into StylePropertiesBase. The m_isMutable bit, used to determine the type for downcasting has been enhanced to m_type (2 bits), since there are now three possible subclasses. * css/StyleRule.cpp: (WebCore::StyleRule::StyleRule): (WebCore::StyleRule::properties): (WebCore::StyleRule::mutableProperties): (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount): Patched to ensure that when properties() are accessed, that if the current stored StylePropertyBase in the rule is a DeferredStyleProperties, we then parse and replace DeferredStyleProperties with ImmutableStyleProperties on the rule. By using a common base class, we avoid increasing memory usage in StyleRule. (WebCore::DeferredStyleGroupRuleList::create): (WebCore::DeferredStyleGroupRuleList::DeferredStyleGroupRuleList): (WebCore::DeferredStyleGroupRuleList::parseDeferredRules): (WebCore::DeferredStyleGroupRuleList::parseDeferredKeyframes): DeferredStyleGroupList is used to handle deferred parsing of objects with child rules. These include @media, @supports and @keyframes. (WebCore::StyleRuleGroup::StyleRuleGroup): (WebCore::StyleRuleGroup::childRules): (WebCore::StyleRuleGroup::wrapperInsertRule): (WebCore::StyleRuleGroup::wrapperRemoveRule): (WebCore::StyleRuleGroup::parseDeferredRulesIfNeeded): (WebCore::StyleRuleMedia::StyleRuleMedia): (WebCore::StyleRuleSupports::StyleRuleSupports): StyleRuleGroup now holds both a child rules Vector and a DeferredStyleGroupRuleList. If DeferredStyleGroupRuleList is set, then when the childRules are finally accessed, we will populate the childRules Vector and then null out the DeferredStyleGroupRuleList. * css/StyleRule.h: (WebCore::StyleRule::propertiesWithoutDeferredParsing): (WebCore::StyleRuleGroup::childRulesWithoutDeferredParsing): (WebCore::StyleRuleGroup::childRules): Deleted. Add new accesors for fetching properties and child rules without causing deferred parsing to happen. * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::parseAuthorStyleSheet): (WebCore::StyleSheetContents::parseString): Patched to turn on deferred parsing for author sheets and for all non-UA stylesheets parsed from a string (e.g., <style>). (WebCore::traverseSubresourcesInRules): The broken resource check was aggressively accessing properties(). Patch it to call propertiesWithoutDeferredParsing() instead so that it doesn't defeat the new optimization. * css/WebKitCSSMatrix.cpp: (WebCore::WebKitCSSMatrix::setMatrixValue): Patched to drop the StyleSheetContents* argument from parseValue, since it is no longer needed. * css/parser/CSSDeferredParser.cpp: Added. (WebCore::CSSDeferredParser::CSSDeferredParser): (WebCore::CSSDeferredParser::parseDeclaration): (WebCore::CSSDeferredParser::parseRuleList): (WebCore::CSSDeferredParser::parseKeyframeList): * css/parser/CSSDeferredParser.h: Added. (WebCore::CSSDeferredParser::create): (WebCore::CSSDeferredParser::tokenizer): (WebCore::CSSDeferredParser::mode): (WebCore::CSSDeferredParser::context): (WebCore::CSSDeferredParser::styleSheet): The CSSDeferredParser. It caches the original tokenizer's' escaped strings. Because the CSSDeferredParser is referenced by all the rules that have yet to parse, it will stay alive until all rules in the stylesheet has been fully parsed. The parser receives CSSParserTokenRanges from DeferredStyleProperties or DeferredStyleGroupRuleList and feeds them to CSSParserImpl, which then is able to do the parsing as it would have occurred originally had the range not been deferred. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSheet): (WebCore::CSSParser::parseSupportsCondition): (WebCore::CSSParser::parseSingleValue): (WebCore::CSSParser::parseValue): * css/parser/CSSParser.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::parseKeywordValue): (WebCore::CSSParserFastPaths::maybeParseValue): * css/parser/CSSParserFastPaths.h: Drop the StyleSheetContents* argument from the methods that no longer need them. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::CSSParserImpl): (WebCore::CSSParserImpl::tokenizer): (WebCore::CSSParserImpl::parseValue): (WebCore::CSSParserImpl::parseCustomPropertyValue): (WebCore::CSSParserImpl::parseDeclarationList): (WebCore::CSSParserImpl::parseInlineStyleDeclaration): (WebCore::CSSParserImpl::parseRule): (WebCore::CSSParserImpl::parseStyleSheet): (WebCore::CSSParserImpl::parseDeclarationListForInspector): (WebCore::CSSParserImpl::parseStyleSheetForInspector): (WebCore::CSSParserImpl::consumeQualifiedRule): (WebCore::CSSParserImpl::consumeMediaRule): (WebCore::CSSParserImpl::consumeSupportsRule): (WebCore::CSSParserImpl::consumeKeyframesRule): (WebCore::CSSParserImpl::consumeStyleRule): Drop the StyleSheetContents* argument from the methods that no longer need them. (WebCore::CSSParserImpl::createDeferredStyleProperties): (WebCore::CSSParserImpl::parseDeferredDeclaration): (WebCore::CSSParserImpl::parseDeferredRuleList): (WebCore::CSSParserImpl::parseDeferredKeyframeList): The methods that handle deferred parsing. They make sure to initialize new CSSParserImpls with the original deferred parser, and then call existing methods to do the parsing. * css/parser/CSSParserImpl.h: Patched to remove StyleSheetContents* arguments from some methods and to add the new deferred parsing methods. * css/parser/CSSParserTokenRange.cpp: (WebCore::CSSParserTokenRange::consumeBlockCheckingForEditability): * css/parser/CSSParserTokenRange.h: In order to preserve the editability optimization from r180867, when a style rule's block is consumed, we use a special method that looks for -webkit-user-modify tokens. If one is seen, then the editability optimization is turned off. Because we do this at the token level, the optimization keeps working even if properties don't get parsed. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseFontFaceDescriptor): (WebCore::CSSPropertyParser::consumeFont): (WebCore::CSSPropertyParser::parseShorthand): Patched to remove StyleSheetContents* arguments now that the editability check is in CSSTokenizer instead. * css/parser/CSSTokenizer.cpp: (WebCore::CSSTokenizer::tokenRange): * css/parser/CSSTokenizer.h: Make tokenRange() const. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::setFont): Patched to drop the StyleSheetContents* argument. * testing/Internals.cpp: (WebCore::deferredStyleRulesCountForList): (WebCore::Internals::deferredStyleRulesCount): (WebCore::deferredGroupRulesCountForList): (WebCore::Internals::deferredGroupRulesCount): (WebCore::deferredKeyframesRulesCountForList): (WebCore::Internals::deferredKeyframesRulesCount): * testing/Internals.h: * testing/Internals.idl: Add new testing methods that can count the deferred style rules and group child rule lists. These methods are used by the new layout tests. 2016-12-14 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Massively speedup IDBIndex.get(). https://bugs.webkit.org/show_bug.cgi?id=165802 Reviewed by Alex Christensen. No new tests (No behavior change to Javascript, table upgrade change covered by API test). This change upgrades the IndexRecords schema to include the ObjectStore record ID for the referenced record. It also adds a SQLite Index-by-key on IndexRecords. This speeds up PerformanceTests/IndexedDB/index-get.html by 15-20x. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::v3IndexRecordsTableSchema): (WebCore::IDBServer::v3IndexRecordsTableSchemaAlternate): (WebCore::IDBServer::v1IndexRecordsIndexSchema): (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable): (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::markAsErrored): (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): * Modules/indexeddb/server/SQLiteIDBCursor.h: (WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID): 2016-12-14 Sam Weinig <sam@webkit.org> Actually set the shipping contact when validating the payment request Reviewed by Anders Carlsson. * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): Fix typo. 2016-12-14 John Wilander <wilander@apple.com> Handle key generation with empty challenge string https://bugs.webkit.org/show_bug.cgi?id=165835 <rdar://problem/29128710> Reviewed by Anders Carlsson. https://bugs.webkit.org/show_bug.cgi?id=160945 didn't set the challenge length to 1 for empty challenge strings. Thus the null terminator was not included. Empty challenge strings are allowed: "If the element has a challenge attribute, then let challenge be that attribute's value. Otherwise, let challenge be the empty string." https://www.w3.org/TR/html5/forms.html#the-keygen-element (fetched 2016-12-13) Email certificate generation at https://www.comodo.com/home/email-security/free-email-certificate.php broke because of https://bugs.webkit.org/show_bug.cgi?id=160945. No new tests. The original patch did not have tests and the breakage was in the produced key material so a test would have to validate the crypto output. * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): Now adds 1 to the length of the challenge to account for its null terminator. This matches the old behavior. 2016-12-14 Daniel Bates <dabates@apple.com> CSP: Allow HTTPS URL to match HTTP source expression https://bugs.webkit.org/show_bug.cgi?id=159520 <rdar://problem/27287177> Reviewed by Brent Fulgham. Test: http/tests/security/contentSecurityPolicy/script-src-parsing-implicit-and-explicit-port-number.html * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::schemeMatches): (WebCore::ContentSecurityPolicySource::portMatches): 2016-12-14 Alex Christensen <achristensen@webkit.org> REGRESSION (r209776): [ios-simulator] LayoutTest http/tests/xmlhttprequest/on-network-timeout-error-during-preflight.html is timing out https://bugs.webkit.org/show_bug.cgi?id=165836 Reviewed by Brady Eidson. * loader/CrossOriginAccessControl.cpp: (WebCore::createAccessControlPreflightRequest): Use the platform default timeout for CORS preflight requests. 2016-12-14 Antti Koivisto <antti@apple.com> WebContent crash under WebCore::CachedResource::load in WebCore::FrameLoader::outgoingReferrer const https://bugs.webkit.org/show_bug.cgi?id=165852 <rdar://problem/27297153> Reviewed by Chris Dumez. There appears to be some path where we get here with a null frame. No test, don't know how exactly this happens. * loader/FrameLoader.cpp: (WebCore::FrameLoader::outgoingReferrer): Null check the frame. 2016-12-14 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r209766. Regressed Dromaeo JSLib by ~50% Reverted changeset: "Make opaque root scanning truly constraint-based" https://bugs.webkit.org/show_bug.cgi?id=165760 http://trac.webkit.org/changeset/209766 2016-12-14 Andy Estes <aestes@apple.com> EventDispatcher::dispatchEvent() should take its Node by reference https://bugs.webkit.org/show_bug.cgi?id=165840 Reviewed by Andreas Kling. No new tests. No change in behavior. * dom/Element.cpp: (WebCore::Element::dispatchWheelEvent): Dereferenced |this| when calling EventDispatcher::dispatchEvent(). (WebCore::Element::dispatchKeyEvent): Ditto. (WebCore::Element::dispatchFocusEvent): Ditto. (WebCore::Element::dispatchBlurEvent): Ditto. * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): Changed |origin| from a Node* to a Node&, renamed it to |node|, and protected it with a Ref called |protectedNode| to match our preferred style. * dom/EventDispatcher.h: Changed dispatchEvent's first parameter type from Node* to Node&. * dom/Node.cpp: (WebCore::Node::dispatchEvent): Dereferenced |this| when calling EventDispatcher::dispatchEvent(). (WebCore::Node::dispatchTouchEvent): Ditto. (WebCore::Node::dispatchUIRequestEvent): Ditto. * dom/ScopedEventQueue.cpp: (WebCore::ScopedEventQueue::dispatchEvent): Dereferenced |node| when calling EventDispatcher::dispatchEvent(). * dom/SimulatedClick.cpp: (WebCore::simulateMouseEvent): Passed |element| as a reference to EventDispatcher::dispatchEvent(). 2016-12-14 Chris Dumez <cdumez@apple.com> Remove Unicode case-insensitive matching for usemap="" https://bugs.webkit.org/show_bug.cgi?id=163894 Reviewed by Antti Koivisto. Remove Unicode case-insensitive matching for usemap="" as this no longer matches the specification [1] or Firefox. Also align our parsing logic for the usemap attribute to match the specification [2]. This simplifies the code a bit, is more efficient and the compatibility risk should be low based on Firefox's behavior and Chome's usage data. [1] https://github.com/whatwg/html/commit/6acdb2122298d2bb7bb839c0a61b4e1f9b0f9bc9 [2] https://html.spec.whatwg.org/#rules-for-parsing-a-hash-name-reference Test: fast/images/image-usemap-parsing.html * dom/Document.cpp: (WebCore::Document::addImageElementByUsemap): (WebCore::Document::removeImageElementByUsemap): (WebCore::Document::imageElementByUsemap): * dom/Document.h: * dom/DocumentOrderedMap.cpp: (WebCore::DocumentOrderedMap::getElementByUsemap): * dom/DocumentOrderedMap.h: * dom/TreeScope.cpp: (WebCore::TreeScope::getImageMap): * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseAttribute): (WebCore::HTMLImageElement::insertedInto): (WebCore::HTMLImageElement::removedFrom): (WebCore::HTMLImageElement::matchesUsemap): * html/HTMLImageElement.h: * html/HTMLMapElement.cpp: (WebCore::HTMLMapElement::imageElement): (WebCore::HTMLMapElement::parseAttribute): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLHashNameReference): * html/parser/HTMLParserIdioms.h: 2016-12-14 Ryan Haddad <ryanhaddad@apple.com> Attempt to fix the Windows build after r209805. Unreviewed build fix. * css/CSSAllInOne.cpp: 2016-12-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Remove WebkitCSSTransformValue https://bugs.webkit.org/show_bug.cgi?id=165844 Reviewed by Zalan Bujtas. Remove WebkitCSSTransformValue and just use a CSSFunctionValue instead. No other browsers support it, and the information it provides is easily obtainable from cssText. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCSSValueCustom.cpp: (WebCore::toJSNewlyCreated): * css/CSSComputedStyleDeclaration.cpp: (WebCore::matrixTransformValue): * css/CSSValue.cpp: (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): (WebCore::CSSValue::cloneForCSSOM): * css/CSSValue.h: (WebCore::CSSValue::isSpringTimingFunctionValue): (WebCore::CSSValue::isWebKitCSSTransformValue): Deleted. * css/StyleResolver.cpp: * css/TransformFunctions.cpp: (WebCore::transformOperationType): (WebCore::transformsForValue): * css/TransformFunctions.h: * css/WebKitCSSTransformValue.cpp: Removed. * css/WebKitCSSTransformValue.h: Removed. * css/WebKitCSSTransformValue.idl: Removed. * css/parser/CSSParserFastPaths.cpp: (WebCore::parseTransformTranslateArguments): (WebCore::parseTransformNumberArguments): (WebCore::parseSimpleTransformValue): (WebCore::parseSimpleTransformList): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTranslate3d): (WebCore::consumeNumbers): (WebCore::consumePerspective): (WebCore::consumeTransformValue): (WebCore::transformOperationForCSSValueID): Deleted. 2016-12-14 Antti Koivisto <antti@apple.com> Make Style::Update const in RenderTreeUpdater https://bugs.webkit.org/show_bug.cgi?id=165845 Reviewed by Andreas Kling. Moving style away from unique_ptrs leaves them in weird state. * style/RenderTreeUpdater.cpp: (WebCore::findRenderingRoots): (WebCore::RenderTreeUpdater::commit): (WebCore::RenderTreeUpdater::updateElementRenderer): Clone the style instead of moving it. This is not meaningfully more expensive. Remove null checks, style is never null. * style/RenderTreeUpdater.h: 2016-12-13 Yusuke Suzuki <utatane.tea@gmail.com> Use JSValue::toWTFString instead of calling toString(exec) and value(exec) https://bugs.webkit.org/show_bug.cgi?id=165795 Reviewed by Saam Barati. * bindings/js/IDBBindingUtilities.cpp: (WebCore::createIDBKeyFromValue): * bindings/js/JSAudioTrackCustom.cpp: (WebCore::JSAudioTrack::setKind): (WebCore::JSAudioTrack::setLanguage): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setLocation): * bindings/js/JSDeviceMotionEventCustom.cpp: (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): * bindings/js/JSDeviceOrientationEventCustom.cpp: (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSHTMLAllCollectionCustom.cpp: (WebCore::callHTMLAllCollection): (WebCore::JSHTMLAllCollection::namedItem): * bindings/js/JSHTMLFormControlsCollectionCustom.cpp: (WebCore::JSHTMLFormControlsCollection::namedItem): * bindings/js/JSHTMLInputElementCustom.cpp: (WebCore::JSHTMLInputElement::setSelectionDirection): * bindings/js/JSInspectorFrontendHostCustom.cpp: (WebCore::populateContextMenuItems): * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): * bindings/js/JSSQLTransactionCustom.cpp: (WebCore::JSSQLTransaction::executeSql): * bindings/js/JSTextTrackCustom.cpp: (WebCore::JSTextTrack::setLanguage): * bindings/js/JSVideoTrackCustom.cpp: (WebCore::JSVideoTrack::setKind): (WebCore::JSVideoTrack::setLanguage): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::cryptoKeyFormatFromJSValue): (WebCore::cryptoKeyUsagesFromJSValue): * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::send): * bindings/js/JSXSLTProcessorCustom.cpp: (WebCore::JSXSLTProcessor::setParameter): (WebCore::JSXSLTProcessor::getParameter): (WebCore::JSXSLTProcessor::removeParameter): * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::create): * bridge/c/c_utility.cpp: (JSC::Bindings::convertValueToNPVariant): * bridge/testbindings.cpp: (main): 2016-12-14 Joonghun Park <jh718.park@samsung.com> [EFL] Fix debug build break since r207192. Unreviewed. https://bugs.webkit.org/show_bug.cgi?id=165847 No new tests, no new behaviours. In JSDOMBinding.h, JSClass::info() returns each js class's "static const JSC::ClassInfo s_info"'s address. It's static variable's address, so always non-null. * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::callPromiseOperation): (WebCore::BindingCaller::callOperation): (WebCore::BindingCaller::setAttribute): (WebCore::BindingCaller::attribute): 2016-12-14 Enrique Ocaña González <eocanha@igalia.com> REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early https://bugs.webkit.org/show_bug.cgi?id=164022 Reviewed by Xabier Rodriguez-Calvar. Covered by existing tests. * page/Settings.cpp: Added new setting to disable GStreamer players, so the selection of MockMediaPlayerMediaSource can be forced for some tests, just like it's already being done for the AVFoundation player in Mac. (WebCore::Settings::setGStreamerEnabled): * page/Settings.h: (WebCore::Settings::isGStreamerEnabled): * platform/graphics/MediaPlayer.cpp: (WebCore::buildMediaEnginesVector): Don't register GStreamer players when they're disabled. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime): Use doubles instead of floats. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Use doubles instead of floats for m_durationAtEOS. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: Don't reset m_sample on videoSink drain, it causes too many problems. (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Removed unused methods. * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: Keep releasing m_sample on drain, but don't report the event externally via signal anymore. The base player private isn't listening to it anymore. (webkitVideoSinkEvent): (webkit_video_sink_class_init): * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Check if the demuxer caps correspond to a supported codec. (WebCore::AppendPipeline::didReceiveInitializationSegment): Empty m_track is now legal and means unsupported codec. (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread): Warn about more than one stream, but "support" it by ignoring it using a black hole probe. (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): Also report the duration when it's detected for the first time. Invalid stream types now mean that unsupported codecs have been detected. Complete init segment processing in that case. (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread): Disconnect black hole probe. (WebCore::appendPipelineDemuxerBlackHolePadProbe): Ignore buffers. (WebCore::appendPipelineDemuxerPadRemoved): New parameter used. * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs): Check supported codecs by matching against wildcard expressions. (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): Check for supported codecs. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: New supportsCodecs() method. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::resetParserState): Implemented parser resetting by aborting the AppendPipeline. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Added resetParserState(). * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::resetParserState): Implemented it. * testing/Internals.cpp: (WebCore::Internals::initializeMockMediaSource): Disable the GStreamer players when initializing the mock media source, like it's already done for the AVFoundation player to force the selection of MockMediaPlayerMediaSource. 2016-12-14 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] Fix player private selection when MSE is enabled https://bugs.webkit.org/show_bug.cgi?id=164116 Reviewed by Philippe Normand. Covered by existing tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::load): 2016-12-13 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r209792. https://bugs.webkit.org/show_bug.cgi?id=165841 Cause build failures (Requested by yusukesuzuki on #webkit). Reverted changeset: "Use JSValue::toWTFString instead of calling toString(exec) and value(exec)" https://bugs.webkit.org/show_bug.cgi?id=165795 http://trac.webkit.org/changeset/209792 2016-12-13 Yusuke Suzuki <utatane.tea@gmail.com> Use JSValue::toWTFString instead of calling toString(exec) and value(exec) https://bugs.webkit.org/show_bug.cgi?id=165795 Reviewed by Saam Barati. * bindings/js/IDBBindingUtilities.cpp: (WebCore::createIDBKeyFromValue): (WebCore::getNthValueOnKeyPath): Deleted. (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath): Deleted. (WebCore::ensureNthValueOnKeyPath): Deleted. (WebCore::canInjectNthValueOnKeyPath): Deleted. (WebCore::injectIDBKeyIntoScriptValue): Deleted. (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath): Deleted. (WebCore::canInjectIDBKeyIntoScriptValue): Deleted. (WebCore::deserializeIDBValueToJSValue): Deleted. (WebCore::scriptValueToIDBKey): Deleted. (WebCore::idbKeyDataToScriptValue): Deleted. (WebCore::createKeyPathArray): Deleted. (WebCore::generateIndexKeyForValue): Deleted. * bindings/js/JSAudioTrackCustom.cpp: (WebCore::JSAudioTrack::setKind): (WebCore::JSAudioTrack::setLanguage): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setLocation): * bindings/js/JSDeviceMotionEventCustom.cpp: (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): * bindings/js/JSDeviceOrientationEventCustom.cpp: (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): (WebCore::JSEventListener::virtualisAttribute): Deleted. (WebCore::JSEventListener::operator==): Deleted. (WebCore::eventHandlerAttribute): Deleted. (WebCore::createEventListenerForEventHandlerAttribute): Deleted. (WebCore::setEventHandlerAttribute): Deleted. (WebCore::windowEventHandlerAttribute): Deleted. (WebCore::setWindowEventHandlerAttribute): Deleted. (WebCore::documentEventHandlerAttribute): Deleted. (WebCore::setDocumentEventHandlerAttribute): Deleted. * bindings/js/JSHTMLAllCollectionCustom.cpp: (WebCore::callHTMLAllCollection): (WebCore::JSHTMLAllCollection::namedItem): * bindings/js/JSHTMLFormControlsCollectionCustom.cpp: (WebCore::JSHTMLFormControlsCollection::namedItem): * bindings/js/JSHTMLInputElementCustom.cpp: (WebCore::JSHTMLInputElement::setSelectionDirection): (WebCore::JSHTMLInputElement::setSelectionRange): Deleted. * bindings/js/JSInspectorFrontendHostCustom.cpp: (WebCore::populateContextMenuItems): (WebCore::JSInspectorFrontendHost::showContextMenu): Deleted. * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): * bindings/js/JSSQLTransactionCustom.cpp: (WebCore::JSSQLTransaction::executeSql): * bindings/js/JSTextTrackCustom.cpp: (WebCore::JSTextTrack::setLanguage): * bindings/js/JSVideoTrackCustom.cpp: (WebCore::JSVideoTrack::setKind): (WebCore::JSVideoTrack::setLanguage): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::cryptoKeyFormatFromJSValue): (WebCore::cryptoKeyUsagesFromJSValue): * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::send): (WebCore::JSXMLHttpRequest::responseText): Deleted. (WebCore::JSXMLHttpRequest::retrieveResponse): Deleted. * bindings/js/JSXSLTProcessorCustom.cpp: (WebCore::JSXSLTProcessor::setParameter): (WebCore::JSXSLTProcessor::getParameter): (WebCore::JSXSLTProcessor::removeParameter): * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::create): * bridge/c/c_utility.cpp: (JSC::Bindings::convertValueToNPVariant): * bridge/testbindings.cpp: (main): * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForEventListener): 2016-12-13 Yusuke Suzuki <utatane.tea@gmail.com> ASSERTION FAILED: hasParserBlockingScript() seen with js/dom/modules/module-will-fire-beforeload.html https://bugs.webkit.org/show_bug.cgi?id=164883 Reviewed by Ryosuke Niwa. This is *attempt to fix* patch since I cannot reproduce the crash reported in this issue. One possible scenario of this crash is the following. 1. There is pending deferred scripts, that is not fetched yet. 2. Then, we start watching on the script. And stop document parser. 3. The document parser is stopped/detached by calling finishJSTest in beforeload. 4. At this critical timing, (2)'s script is fetched, and notifyFinished is called since it is watched. In this patch, we ignore the script execution if the document parser is stopped / detached. Previously, it goes into the wrong path. And it causes assertion failure. * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::notifyFinished): 2016-12-13 Keith Rollin <krollin@apple.com> Memory warning logging appears to capture resident footprint, missing compress/swap. https://bugs.webkit.org/show_bug.cgi?id=165533 <rdar://problem/29318410> Reviewed by Daniel Bates. Fix GTK build by adding an explicit constructor. * platform/MemoryPressureHandler.h: (WebCore::MemoryPressureHandler::ReliefLogger::MemoryUsage::MemoryUsage): 2016-12-13 Daniel Bates <dabates@apple.com> CSP: ws: and wss: blocked with connect-src * https://bugs.webkit.org/show_bug.cgi?id=165804 <rdar://problem/28563643> Reviewed by David Kilzer. Allow * to match ws: and wss:. This will make our behavior of * more closely conform the behavior of * in the Content Security Policy Level 3 spec., <https://w3c.github.io/webappsec-csp/#match-url-to-source-expression> (Editor's Draft, 2 December 2016). Tests: http/tests/security/contentSecurityPolicy/connect-src-star-secure-websocket-allowed.html http/tests/security/contentSecurityPolicy/connect-src-star-websocket-allowed.html http/tests/security/contentSecurityPolicy/default-src-star-secure-websocket-allowed.html http/tests/security/contentSecurityPolicy/default-src-star-websocket-allowed.html * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::isProtocolAllowedByStar): 2016-12-13 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make CSSFunctionValue derive from CSSValueList https://bugs.webkit.org/show_bug.cgi?id=165832 Reviewed by Dean Jackson. With the old parser gone, we can now shrink CSSFunctionValue a bit by having it derive from CSSValueList instead of having an extra member that holds a value list of arguments. This is similar to the trick already employed by WebkitCSSTransformValue. * css/CSSComputedStyleDeclaration.cpp: (WebCore::specifiedValueForGridTrackSize): * css/CSSFunctionValue.cpp: (WebCore::CSSFunctionValue::customCSSText): (WebCore::CSSFunctionValue::CSSFunctionValue): Deleted. (WebCore::CSSFunctionValue::equals): Deleted. (WebCore::CSSFunctionValue::append): Deleted. * css/CSSFunctionValue.h: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertScrollSnapPoints): (WebCore::StyleBuilderConverter::createGridTrackSize): * css/StyleResolver.cpp: (WebCore::StyleResolver::createFilterOperations): * css/parser/CSSPropertyParser.cpp: (WebCore::isGridTrackFixedSized): 2016-12-13 Chris Dumez <cdumez@apple.com> Make Document a FrameDestructionObserver https://bugs.webkit.org/show_bug.cgi?id=165810 <rdar://problem/29157645> Reviewed by Ryosuke Niwa. Make Document a FrameDestructionObserver to make sure Document::m_frame is properly nulled out when a Frame gets destroyed. Document::disconnectFromFrame() is supposed to be called before the Frame gets destroyed so this also adds an assertion to try and identify places where we fail to call it. No new tests, no known reproduction case. * dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::disconnectFromFrame): (WebCore::Document::frameDestroyed): * dom/Document.h: (WebCore::Document::frame): Deleted. 2016-12-13 Joseph Pecoraro <pecoraro@apple.com> REGRESSION(r204163): Web Inspector: Page crashes when Inspector tries to load insecure SourceMap https://bugs.webkit.org/show_bug.cgi?id=165806 <rdar://problem/28169025> Reviewed by Alex Christensen. Test: http/tests/inspector/network/loadResource-insecure-resource.html * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::loadResource): DocumentThreadableLoader now triggers the ThreadableLoaderClient's didFail callback, so this didFailLoaderCreation is now redundent and incorrect. 2016-12-13 Dave Hyatt <hyatt@apple.com> [CSS Parser] Enhance fast path translate transforms to allow percentages https://bugs.webkit.org/show_bug.cgi?id=165822 Reviewed by Simon Fraser. * css/parser/CSSParserFastPaths.cpp: (WebCore::parseTransformTranslateArguments): 2016-12-13 Ryosuke Niwa <rniwa@webkit.org> :hover rule causes a single tap to not activate a slotted anchor element https://bugs.webkit.org/show_bug.cgi?id=165551 Reviewed by Antti Koivisto. Fixed a bug in ancestorRespondingToClickEvents that we were traversing the ancestor nodes without taking shadow roots and slots into account. This prevented tapping on a text node assigned to a slot inside an anchor element to activate the hyperlink on iOS. This bug was supposed to be fixed in r206605, and it was still broken on iOS due to the bug in ancestorRespondingToClickEvents. It is now tested by click-text-inside-linked-slot.html. Tests: fast/shadow-dom/click-on-slotted-anchor-with-hover.html fast/shadow-dom/click-text-inside-linked-slot.html * page/ios/FrameIOS.mm: (WebCore::ancestorRespondingToClickEvents): (WebCore::Frame::qualifyingNodeAtViewportLocation): 2016-12-13 Dave Hyatt <hyatt@apple.com> [CSS Parser] Eliminate SVGPaint and SVGColor https://bugs.webkit.org/show_bug.cgi?id=165819 Reviewed by Dean Jackson. Remove SVGColor and SVGPaint CSS values from the tree. The new parser already stopped making these values when parsing, so all that's left is to make sure computed style doesn't use these values either. We are the only browser engine to support these CSS values, they see no use on the Web, and they're already gone at the parsing level, so it's time to remove these interfaces from our tree. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCSSValueCustom.cpp: (WebCore::toJSNewlyCreated): * css/CSSComputedStyleDeclaration.h: * css/CSSValue.cpp: (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): (WebCore::CSSValue::cloneForCSSOM): * css/CSSValue.h: (WebCore::CSSValue::isSubtypeExposedToCSSOM): (WebCore::CSSValue::isSVGColor): Deleted. (WebCore::CSSValue::isSVGPaint): Deleted. * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGColor): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueFill): (WebCore::StyleBuilderCustom::applyValueStroke): * page/animation/CSSPropertyAnimation.cpp: (WebCore::PropertyWrapperSVGPaint::PropertyWrapperSVGPaint): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::fillPaintType): (WebCore::RenderStyle::setFillPaintColor): (WebCore::RenderStyle::strokePaintType): (WebCore::RenderStyle::setStrokePaintColor): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialFillPaintType): (WebCore::SVGRenderStyle::initialStrokePaintType): (WebCore::SVGRenderStyle::setFillPaint): (WebCore::SVGRenderStyle::setStrokePaint): (WebCore::SVGRenderStyle::fillPaintType): (WebCore::SVGRenderStyle::strokePaintType): (WebCore::SVGRenderStyle::visitedLinkFillPaintType): (WebCore::SVGRenderStyle::visitedLinkStrokePaintType): (WebCore::SVGRenderStyle::hasStroke): (WebCore::SVGRenderStyle::hasFill): * rendering/style/SVGRenderStyleDefs.h: * rendering/svg/RenderSVGResource.cpp: (WebCore::requestPaintingResource): * rendering/svg/SVGResources.cpp: (WebCore::paintingResourceFromSVGPaint): * svg/SVGAllInOne.cpp: * svg/SVGAnimatedColor.cpp: (WebCore::SVGAnimatedColorAnimator::constructFromString): (WebCore::parseColorFromString): (WebCore::SVGAnimatedColorAnimator::calculateDistance): * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: * svg/SVGColor.cpp: Removed. * svg/SVGColor.h: Removed. * svg/SVGColor.idl: Removed. * svg/SVGFEDiffuseLightingElement.cpp: * svg/SVGFESpecularLightingElement.cpp: * svg/SVGPaint.cpp: Removed. * svg/SVGPaint.h: Removed. * svg/SVGPaint.idl: Removed. 2016-12-13 Alex Christensen <achristensen@webkit.org> Restore NSURLRequest's default time interval to match behavior before NSURLSession adoption https://bugs.webkit.org/show_bug.cgi?id=165821 <rdar://problem/28492939> Reviewed by Brady Eidson. Before adopting NSURLSession, iOS used CFURLConnection, not NSURLConnection. iOS used to have a default timeout of INT_MAX and it now has a default timeout of 0, which means use the default NSURLRequest timeout, which is 60 seconds. This is not enough for some slow mobile networks, so we want to match behavior of our CFURLConnection code here. * platform/network/ResourceRequestBase.cpp: Use INT_MAX as the default timeout of requests on iOS. 2016-12-13 Filip Pizlo <fpizlo@apple.com> Make opaque root scanning truly constraint-based https://bugs.webkit.org/show_bug.cgi?id=165760 Reviewed by Saam Barati. No new tests yet. I think that writing tests for this is a big investigation: https://bugs.webkit.org/show_bug.cgi?id=165808 Remove the previous advancing wavefront DOM write barrier. I don't think this will scale very well. It's super confusing. This change makes it so that visitChildren can become a GC constraint that executes as part of the fixpoint. This changes all WebCore visitChildren methods that do opaque roots into constraints. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): (WebCore::writeBarrierOpaqueRootSlow): Deleted. * bindings/js/CommonVM.h: (WebCore::writeBarrierOpaqueRoot): Deleted. * bindings/js/JSAttrCustom.cpp: (WebCore::JSAttr::visitAdditionalChildren): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::visitAdditionalChildren): * bindings/js/JSIDBCursorCustom.cpp: (WebCore::JSIDBCursor::visitAdditionalChildren): * bindings/js/JSMessageChannelCustom.cpp: (WebCore::JSMessageChannel::visitAdditionalChildren): * bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::visitAdditionalChildren): * bindings/js/JSNodeIteratorCustom.cpp: (WebCore::JSNodeIterator::visitAdditionalChildren): * bindings/js/JSTextTrackCueCustom.cpp: (WebCore::JSTextTrackCue::visitAdditionalChildren): * bindings/js/JSTreeWalkerCustom.cpp: (WebCore::JSTreeWalker::visitAdditionalChildren): * bindings/js/JSWorkerGlobalScopeCustom.cpp: (WebCore::JSWorkerGlobalScope::visitAdditionalChildren): * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::visitAdditionalChildren): * bindings/js/JSXPathResultCustom.cpp: (WebCore::JSXPathResult::visitAdditionalChildren): * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): (WebCore::notifyChildNodeRemoved): 2016-12-12 Sam Weinig <sam@webkit.org> [WebIDL] Remove use of Dictionary in ApplePaySession https://bugs.webkit.org/show_bug.cgi?id=165787 Reviewed by Anders Carlsson. First take at generating the bindings for ApplePaySession and removing all use of Dictionary. - Removes all use of Dictionary! - Removes use of logging errors to the console with improved Exception messages. - Use ExceptionOr extensively to pass exception state. Still to do: - Reconcile / merge ApplePaySession::PaymentRequest with WebCore::PaymentRequest and all the sub-objects held within. - Remove PaymentRequestValidator entirely, merging validation into the validation we already do in ApplePaySession.cpp - Make ApplePayEvents use generated dictionary creation code. Test: http/tests/ssl/applepay/ApplePaySession.html * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): (WebCore::canCallApplePaySessionAPIs): (WebCore::ApplePaySession::create): (WebCore::ApplePaySession::ApplePaySession): (WebCore::ApplePaySession::supportsVersion): (WebCore::ApplePaySession::canMakePayments): (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): (WebCore::ApplePaySession::openPaymentSetup): (WebCore::ApplePaySession::begin): (WebCore::ApplePaySession::completeMerchantValidation): (WebCore::ApplePaySession::completeShippingMethodSelection): (WebCore::ApplePaySession::completeShippingContactSelection): (WebCore::ApplePaySession::completePaymentMethodSelection): (WebCore::ApplePaySession::didSelectShippingMethod): (WebCore::createContactFields): Deleted. (WebCore::toLineItemType): Deleted. (WebCore::isValidLineItemPropertyName): Deleted. (WebCore::createLineItem): Deleted. (WebCore::createLineItems): Deleted. (WebCore::createMerchantCapabilities): Deleted. (WebCore::createSupportedNetworks): Deleted. (WebCore::toShippingType): Deleted. (WebCore::isValidShippingMethodPropertyName): Deleted. (WebCore::createShippingMethod): Deleted. (WebCore::createShippingMethods): Deleted. (WebCore::isValidPaymentRequestPropertyName): Deleted. (WebCore::createPaymentRequest): Deleted. * Modules/applepay/ApplePaySession.h: Replace hand written dictionary extraction code with autogenerated code and hand written additional validation. * Modules/applepay/ApplePaySession.idl: Add helper dictionaries and enums. * Modules/applepay/PaymentRequestValidator.cpp: (WebCore::PaymentRequestValidator::validate): (WebCore::PaymentRequestValidator::validateTotal): (WebCore::validateCountryCode): (WebCore::validateCurrencyCode): (WebCore::validateMerchantCapabilities): (WebCore::validateSupportedNetworks): (WebCore::validateShippingMethod): (WebCore::validateShippingMethods): (WebCore::PaymentRequestValidator::PaymentRequestValidator): Deleted. (WebCore::PaymentRequestValidator::~PaymentRequestValidator): Deleted. (WebCore::PaymentRequestValidator::validateCountryCode): Deleted. (WebCore::PaymentRequestValidator::validateCurrencyCode): Deleted. (WebCore::PaymentRequestValidator::validateMerchantCapabilities): Deleted. (WebCore::PaymentRequestValidator::validateShippingMethod): Deleted. (WebCore::PaymentRequestValidator::validateSupportedNetworks): Deleted. (WebCore::PaymentRequestValidator::validateShippingMethods): Deleted. * Modules/applepay/PaymentRequestValidator.h: Instead of reporting the validation errors to the console, pass them in the exception. This allows us to remove the window member, and move the helpers to the implementation file as statics. * WebCore.xcodeproj/project.pbxproj: Remove file. * bindings/generic/IDLTypes.h: (WebCore::IDLObject::nullValue): (WebCore::IDLObject::isNullValue): (WebCore::IDLObject::extractValueFromNullable): Add nullability traits for IDLObject. * bindings/js/JSApplePaySessionCustom.cpp: Removed. 2016-12-13 Daniel Bates <dabates@apple.com> CSP: Teach the preload scanner about the 'nonce' attribute https://bugs.webkit.org/show_bug.cgi?id=161192 <rdar://problem/28010354> Reviewed by Darin Adler. This patch was inspired by a similar Blink change: <https://chromium.googlesource.com/chromium/src/+/dde5487f380cf774e4c0e96ba7f88ea68e723907> Preload external scripts and stylesheets whose HTML script and link elements have a nonce attribute that is listed in the Content Security Policy (CSP) of the page. Currently the preload scanner ignores the nonce attribute on HTML script and link elements. So, WebKit does not preload their associated subresources unless the value of the src attribute or href attribute is whitelisted in the CSP of the page for script and link elements, respectively. Instead the preload scanner should recognize the nonce attribute on script and link elements and query the CSP of the page with it. If the nonce attribute is whitelisted then the request should be preloaded. Tests: http/tests/loading/do-not-preload-css-blocked-by-csp.html http/tests/loading/do-not-preload-script-src-blocked-by-csp.html http/tests/loading/preload-css-with-csp-nonce.html http/tests/loading/preload-script-src-with-csp-nonce.html * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Set the nonce on the PreloadRequest to the nonce that we found during the scan. (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): For script and link tag names, save the value of the nonce attribute (if it has one). * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): Skip CSP policy check if the nonce is listed in the CSP of the page. * html/parser/HTMLResourcePreloader.h: (WebCore::PreloadRequest::setNonce): Added. 2016-12-13 Dave Hyatt <hyatt@apple.com> [CSS Parser] Rename CSSPrimitiveValue::UnitTypes to CSSPrimitiveValue::UnitType https://bugs.webkit.org/show_bug.cgi?id=165776 Reviewed by Zalan Bujtas. * css/CSSCalculationValue.cpp: (WebCore::unitCategory): (WebCore::hasDoubleValue): (WebCore::determineCategory): (WebCore::CSSCalcExpressionNodeParser::parseValue): * css/CSSCalculationValue.h: * css/CSSPrimitiveValue.cpp: (WebCore::isValidCSSUnitTypeForDoubleConversion): (WebCore::isStringType): (WebCore::CSSPrimitiveValue::unitCategory): (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::cleanup): (WebCore::CSSPrimitiveValue::computeLengthDouble): (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble): (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): (WebCore::CSSPrimitiveValue::getFloatValue): (WebCore::CSSPrimitiveValue::doubleValue): (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory): (WebCore::CSSPrimitiveValue::doubleValueInternal): (WebCore::CSSPrimitiveValue::cloneForCSSOM): * css/CSSPrimitiveValue.h: (WebCore::CSSPrimitiveValue::isFontRelativeLength): (WebCore::CSSPrimitiveValue::isLength): (WebCore::CSSPrimitiveValue::isResolution): (WebCore::CSSPrimitiveValue::createAllowingMarginQuirk): * css/CSSValue.h: * css/CSSValuePool.cpp: (WebCore::CSSValuePool::createValue): * css/CSSValuePool.h: (WebCore::CSSValuePool::createValue): * css/MediaQueryExp.cpp: (WebCore::featureWithValidDensity): (WebCore::MediaQueryExpression::MediaQueryExpression): * css/parser/CSSParserFastPaths.cpp: (WebCore::parseSimpleLength): (WebCore::parseSimpleLengthValue): (WebCore::parseColorIntOrPercentage): (WebCore::fastParseColorInternal): (WebCore::parseTransformTranslateArguments): (WebCore::parseTransformNumberArguments): * css/parser/CSSParserToken.cpp: (WebCore::cssPrimitiveValueUnitFromTrie): (WebCore::stringToUnitType): (WebCore::CSSParserToken::CSSParserToken): (WebCore::CSSParserToken::convertToPercentage): * css/parser/CSSParserToken.h: (WebCore::CSSParserToken::unitType): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeTransformOrigin): (WebCore::consumeCounter): (WebCore::consumeAnimationName): (WebCore::consumePerspective): (WebCore::consumePositionLonghand): (WebCore::consumeCounterContent): (WebCore::consumeReflect): (WebCore::consumeGridBreadth): (WebCore::CSSPropertyParser::consumeFlex): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber): (WebCore::CSSPropertyParserHelpers::consumeInteger): (WebCore::CSSPropertyParserHelpers::consumeLength): (WebCore::CSSPropertyParserHelpers::consumePercent): (WebCore::CSSPropertyParserHelpers::consumeAngle): (WebCore::CSSPropertyParserHelpers::consumeTime): (WebCore::CSSPropertyParserHelpers::consumeCustomIdent): (WebCore::CSSPropertyParserHelpers::consumeString): (WebCore::CSSPropertyParserHelpers::consumeUrl): (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint): (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop): (WebCore::CSSPropertyParserHelpers::consumeCrossFade): (WebCore::CSSPropertyParserHelpers::consumeImageSet): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::readFeatureValue): * css/parser/SizesAttributeParser.cpp: (WebCore::SizesAttributeParser::computeLength): * css/parser/SizesAttributeParser.h: * dom/StyledElement.cpp: (WebCore::StyledElement::setInlineStyleProperty): (WebCore::StyledElement::addPropertyToPresentationAttributeStyle): * dom/StyledElement.h: * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::toCSSPrimitiveValue): 2016-12-13 Eric Carlson <eric.carlson@apple.com> Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag https://bugs.webkit.org/show_bug.cgi?id=165251 Reviewed by Youenn Fablet. No new tests, fixes an API test. * page/Settings.in: Delete mediaStreamEnabled and peerConnectionEnabled, we don't need a setting and a runtime feature. 2016-12-13 Antti Koivisto <antti@apple.com> REGRESSION (r198990): Cannot edit content inside <details> in wysiwyg editor https://bugs.webkit.org/show_bug.cgi?id=165757 Reviewed by Andreas Kling. Test: fast/html/details-edit.html -webkit-user-modify is reset on shadow boundary so it doesn't go through <details> shadow tree. * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForElement): (WebCore::StyleResolver::pseudoStyleForElement): (WebCore::StyleResolver::styleForPage): (WebCore::StyleResolver::applyMatchedProperties): * dom/Node.cpp: (WebCore::computeEditabilityFromComputedStyle): (WebCore::Node::computeEditability): Make -webkit-user-modify (which we would want to get rid of completely eventually) have no effect in shadow trees. Check for contenteditable directly instead. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::createInnerTextStyle): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::createInnerTextStyle): * html/shadow/TextControlInnerElements.cpp: * rendering/RenderFlowThread.cpp: (WebCore::RenderFlowThread::createFlowThreadStyle): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): * rendering/RenderListItem.cpp: (WebCore::RenderListItem::styleDidChange): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::createAnonymousStyleWithDisplay): (WebCore::RenderStyle::createStyleInheritingFromPseudoStyle): (WebCore::RenderStyle::inheritFrom): Let -webkit-user-modify inherit through shadow boundary as normal. * rendering/style/RenderStyle.h: 2016-12-12 Darin Adler <darin@apple.com> Remove bindings generation support for legacy WebCore::Dictionary https://bugs.webkit.org/show_bug.cgi?id=165762 Reviewed by Sam Weinig. After this patch, all use of legacy WebCore::Dictionary is within custom bindings or inside the DOM code itself. Bindings generation machinery no longer has a special type named "Dictionary" but has increasingly good support for IDL-defined dictionaries. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::create): Take ExecState and a JSValue rather than a Dictionary. (WebCore::ApplePaySession::completeMerchantValidation): Ditto. * Modules/applepay/ApplePaySession.h: Updated for the above changes. * Modules/applepay/ApplePaySession.idl: For this last file using Dictionary in IDL, move to "[CallWith=ScriptState]" and "any" as a stopgap. Later we can return and use IDL dictionaries or other more modern solutions. * Modules/mediastream/MediaDevices.idl: For the custom binding written in JavaScript, use the type mentioned in the specification rather than Dictionary. The bindings generator ignores the type, so this is more like changing a comment rather than changing source code. * Modules/mediastream/RTCPeerConnection.js: (initializeRTCPeerConnection): Refer to a non-object as not a valid "dictionary", lowercase rather than "Dictionary". * Modules/mediastream/RTCPeerConnectionInternals.js: (callbacksAndDictionaryOverload): Ditto. * bindings/generic/IDLTypes.h: Removed IDLLegacyDictionary. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::getHashAlgorithm): Fixed a comment. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLLegacyDictionary<T>>::convert): Deleted. * bindings/scripts/CodeGenerator.pm: (IsBuiltinType): Removed special case for "Dictionary". * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): Ditto. (AreTypesDistinguishableForOverloadResolution): Ditto. (GenerateOverloadedFunctionOrConstructor): Ditto. (GenerateParametersCheck): Ditto. (GetBaseIDLType): Ditto. * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated results. * bindings/scripts/test/TestObj.idl: Removed test case for Dictionary. 2016-12-12 Chris Dumez <cdumez@apple.com> Drop unnecessary null check in removeDetachedChildrenInContainer() https://bugs.webkit.org/show_bug.cgi?id=165778 Reviewed by Alex Christensen. Drop unnecessary null check in removeDetachedChildrenInContainer(). Node cannot be null but we do an implicit null check. No new tests, no Web-exposed behavior change. * dom/ContainerNodeAlgorithms.cpp: (WebCore::removeDetachedChildrenInContainer): 2016-12-12 Chris Dumez <cdumez@apple.com> Add Document.onvisibilitychange event handler attribute https://bugs.webkit.org/show_bug.cgi?id=165784 Reviewed by Daniel Bates. Add Document.onvisibilitychange event handler attribute as per Page Visibility Level 2 API: - http://w3c.github.io/page-visibility/#onvisiblitychange-event-handler Test: fast/events/page-visibility-onvisibilitychange.html * dom/Document.idl: 2016-12-12 Dean Jackson <dino@apple.com> [iOS] MediaDocument "Done" button should navigate the page back https://bugs.webkit.org/show_bug.cgi?id=165779 Reviewed by Sam Weinig. Detect if the exit from fullscreen was caused by the Done button, and if so, tell the page to navigate back. Unfortunately this is not yet testable. It's waiting on the UI-based device testing in development by the media team. * platform/cocoa/WebVideoFullscreenModel.h: Add a finishedWithMedia parameter to requestFullscreenMode, to indicate if the change in mode is associated with the closing of the media document. * platform/cocoa/WebVideoFullscreenModelVideoElement.h: * platform/cocoa/WebVideoFullscreenModelVideoElement.mm: (WebVideoFullscreenModelVideoElement::requestFullscreenMode): If we're a media document, and we say we're finished with the media, tell the document to navigate back a page. * platform/ios/WebVideoFullscreenControllerAVKit.mm: (WebVideoFullscreenControllerContext::requestFullscreenMode): * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): 2016-12-12 Zalan Bujtas <zalan@apple.com> Infinite recursion when viewport is set to the size of the content but the content overflows the viewport. https://bugs.webkit.org/show_bug.cgi?id=165775 rdar://problem/29366628 Reviewed by Simon Fraser. In certain cases when the viewport is sized to accomodate the content and the content always overflows the viewport, we might end up in recursive FrameView::layout calls. This is specific to content with viewport units, because we always invalidate elements with vw/vh units on viewport size change. However if this viewport size change is in response to content size change (layout), invalidating elements could trigger synchronous layout, while we are still inside this current layout. This is very similar to the m_setNeedsLayoutWasDeferred case and they should eventually be merged. It also means that we might be behind by one layout on elements with vw/vh units (fixed layout only though). Currently not testable. * page/FrameView.cpp: (WebCore::FrameView::availableContentSizeChanged): 2016-12-12 Keith Rollin <krollin@apple.com> Memory warning logging appears to capture resident footprint, missing compress/swap. https://bugs.webkit.org/show_bug.cgi?id=165533 <rdar://problem/29318410> Reviewed by Andreas Kling. Have platformMemoryUsage return both resident and resident + swapped values. This is now returned as a struct in a std::optional to better support cases where values cannot or are not returned. Report these values in logMemoryUsageChange. Remove most of the ReliefLogger instances and their messages. We no longer free up fastMalloc memory after each memory-release operation, so there are no memory regions returned to the OS. Instead, we now free up fastMalloc memory regions at the end of all memory-releasing operations in one fell swoop and report a grand total of memory returned. No new tests -- no changes to user accessible functionality. * page/MemoryRelease.cpp: (WebCore::releaseNoncriticalMemory): (WebCore::releaseCriticalMemory): (WebCore::releaseMemory): * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): * platform/MemoryPressureHandler.cpp: (WebCore::MemoryPressureHandler::releaseMemory): (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange): (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): * platform/MemoryPressureHandler.h: (WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger): (WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger): (WebCore::MemoryPressureHandler::ReliefLogger::loggingEnabled): * platform/cocoa/MemoryPressureHandlerCocoa.mm: (WebCore::MemoryPressureHandler::platformReleaseMemory): (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): * platform/linux/MemoryPressureHandlerLinux.cpp: * platform/win/MemoryPressureHandlerWin.cpp: (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): 2016-12-12 Chris Dumez <cdumez@apple.com> Document.visibilityState should use an IDL string enumeration https://bugs.webkit.org/show_bug.cgi?id=165774 Reviewed by Daniel Bates. Document.visibilityState should use an IDL string enumeration: - http://w3c.github.io/page-visibility/#extensions-to-the-document-interface No new tests, there should be no Web-exposed behavior change. * CMakeLists.txt: * Modules/vibration/NavigatorVibration.cpp: (WebCore::NavigatorVibration::vibrate): * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::hidden): (WebCore::Document::pageVisibilityState): Deleted. (WebCore::Document::visibilityState): Deleted. * dom/Document.h: * dom/Document.idl: * page/Page.cpp: (WebCore::Page::visibilityState): * page/PageVisibilityState.cpp: Removed. * page/PageVisibilityState.h: (): Deleted. 2016-12-12 Jer Noble <jer.noble@apple.com> Remove implementation of legacy Mozilla-based Fullscreen API. https://bugs.webkit.org/show_bug.cgi?id=165689 Reviewed by Eric Carlson. Alias the legacy webkitRequestFull_S_creen() function on Element to webkitRequestFull_s_creen(). Remove the custom behavior in Document::requestFullScreenForElement() to handle the legacy path. * dom/Document.cpp: (WebCore::Document::requestFullScreenForElement): * dom/Document.h: * dom/Element.cpp: (WebCore::Element::webkitRequestFullscreen): (WebCore::Element::webkitRequestFullScreen): Deleted. * dom/Element.h: * dom/Element.idl: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): 2016-12-12 Zalan Bujtas <zalan@apple.com> The CSS 'columns' property when set on the <body> element makes short columns https://bugs.webkit.org/show_bug.cgi?id=164891 Reviewed by Darin Adler and David Hyatt. Currently when the body has auto height, we use the height of the viewport as the available height for the columns defined on the body element. This is the desired behaviour for paginated content. However in case of a simple, non-paginated multicolumn context, we should let the columns grow beyond the viewport vertically. This is also what other browsers do. This patch sets the available height on columns (in non-paginated context) only if the logical height is defined (we are right before layout, so applying non-defined values does not make much sense anyway). The reason why it is only broken on the <body> is because it stretches to the viewport by default (see stretchesToViewport()) while other block renderers do not. Test: fast/multicol/columns-on-body.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::checkForPaginationLogicalHeightChange): 2016-12-09 Dean Jackson <dino@apple.com> Autoplay isn't working in iPhone MediaDocuments https://bugs.webkit.org/show_bug.cgi?id=165710 <rdar://problems/29606761> Reviewed by Darin Adler. Our silent video autoplay detection disabled autoplay of videos in MediaDocuments. Test: media/ios/autoplay-only-in-main-document.html * html/MediaElementSession.cpp: (WebCore::MediaElementSession::playbackPermitted): Return true if we're in a top-level media document. 2016-12-12 Zan Dobersek <zdobersek@igalia.com> Unreviewed. Fixing build breakage in GStreamer's WebKitCommonEncryptionDecryptorGStreamer. * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: (webkitMediaCommonEncryptionDecryptTransformInPlace): WTF::Seconds should be used instead of std::chrono::seconds. 2016-12-11 Simon Fraser <simon.fraser@apple.com> REGRESSION (r200283): Transform, overflow hidden and filter combination completely hides the element https://bugs.webkit.org/show_bug.cgi?id=161509 Reviewed by David Hyatt. When the filter painting code needs to recompute a paintDirtyRect, it was using selfClipRect() which is obviously wrong because it returns a rect in absolute coordinates. Use code factored out of localClipRect() instead, which returns a rect relative to the painting root. Test: css3/filters/filter-on-overflow-hidden.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): 2016-12-11 Saam Barati <sbarati@apple.com> We should be able to throw exceptions from Wasm code and when Wasm frames are on the stack https://bugs.webkit.org/show_bug.cgi?id=165429 Reviewed by Keith Miller. * bindings/js/JSDOMBinding.cpp: (WebCore::GetCallerGlobalObjectFunctor::operator()): 2016-12-11 Darin Adler <darin@apple.com> Remove uses of Dictionary in WebRTC IDL files https://bugs.webkit.org/show_bug.cgi?id=165736 Reviewed by Sam Weinig. Also removed quite a bit of unused code. There were some mocks that were out of date and no longer matched the types used in the real code, that also were no longer hooked up, and other types of dead code. We will have to implement anew when we want to restore tests like the ones these were intended to enable. * CMakeLists.txt: Updated for all the removed files. * Modules/mediastream/MediaEndpointPeerConnection.cpp: Moved some types in here that don't need to be in the header. (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection): Use make_unique. (WebCore::MediaEndpointPeerConnection::setConfiguration): Changed argument type, obviating the need for most of the code that was here. * Modules/mediastream/MediaEndpointPeerConnection.h: Updated for the above. Made more things private and final. Marked the constructor explicit. Removed unneeded includes. * Modules/mediastream/PeerConnectionBackend.h: Removed unneeded includes and forward declarations. Changed the argument type for setConfiguration (see above). * Modules/mediastream/RTCConfiguration.cpp: Removed. None of the code here was needed except for the ICE server validation, and that was moved into RTCPeerConnection::setConfiguration. * Modules/mediastream/RTCConfiguration.h: Changed this from a class to a struct since this is now a dictionary rather than an interface. * Modules/mediastream/RTCConfiguration.idl: Changed this from an interface to a dictionary. * Modules/mediastream/RTCDTMFSender.cpp: Removed some of the code from this file. This class currently isn't implemented, but was depending on RTCPeerConnectionHandler. I removed some of the dead code. Someone will have to straighten this out so we can turn it back on. * Modules/mediastream/RTCDTMFSender.h: Ditto. * Modules/mediastream/RTCDataChannel.cpp: Updated includes. * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): Removed most of the code, since this now takes a structure rather than a WebCore::Dictionary, and so the bindings take care of the work. * Modules/mediastream/RTCIceCandidate.h: Updated for the above. * Modules/mediastream/RTCIceCandidate.idl: Changed the constructor to take a RTCIceCandidateInit instead of a Dictionary. * Modules/mediastream/RTCIceServer.h: Changed this from a class to a struct since this is now a dictionary rather than an interface. * Modules/mediastream/RTCIceServer.idl: Changed this from an interface to a dictionary. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::initializeWith): Take an RTCConfiguration rather than a Dictionary. (WebCore::RTCPeerConnection::getConfiguration): Moved to header, now an inline. (WebCore::RTCPeerConnection::setConfiguration): Use the configuration dictionary now instead of the configuration class. Also moved validation of server URLs here, formerly in the RTCConfiguration RTCConfiguration::initialize function. Also moved code to convert from RTCConfiguration to MediaEndpointConfiguration here, formerly in MediaEndpointPeerConnection::setConfiguration. * Modules/mediastream/RTCPeerConnection.h: Updated for the above. * Modules/mediastream/RTCPeerConnection.idl: Changed argument to initializeWith and setConfiguration from Dictionary to RTCConfiguration. * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::parseTypeString): Deleted. (WebCore::RTCSessionDescription::create): Changed to take struct instead of Dictionary. * Modules/mediastream/RTCSessionDescription.h: Added Init struct and changed create to take it. * Modules/mediastream/RTCSessionDescription.idl: Changed constructor argument to take RTCSessionDescriptionInit dictionary instead of Dictionary. * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: Updated includes. * WebCore.xcodeproj/project.pbxproj: Updated for all the removed files. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): Fixed convertDictionaryToJS to work with other nullable types besides RefPtr. * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated. * platform/mediastream/RTCConfigurationPrivate.h: Removed. * platform/mediastream/RTCIceServerPrivate.h: Removed. * platform/mediastream/RTCPeerConnectionHandler.cpp: Removed. * platform/mediastream/RTCPeerConnectionHandler.h: Removed. * platform/mock/RTCDTMFSenderHandlerMock.cpp: Removed. * platform/mock/RTCDTMFSenderHandlerMock.h: Removed. * platform/mock/RTCDataChannelHandlerMock.h: Updated includes, made more things private and final. * platform/mock/RTCPeerConnectionHandlerMock.cpp: Removed. * platform/mock/RTCPeerConnectionHandlerMock.h: Removed. * testing/Internals.cpp: (WebCore::Internals::Internals): Removed call to enableMockRTCPeerConnectionHandler. (WebCore::Internals::enableMockRTCPeerConnectionHandler): Deleted. 2016-12-11 Darin Adler <darin@apple.com> Use std::vsnprintf instead of vasprintf https://bugs.webkit.org/show_bug.cgi?id=165740 Reviewed by Sam Weinig. * platform/FileHandle.cpp: (WebCore::FileHandle::printf): Use vsnprintf, including StringExtras.h to ensure compatibility with older versions of the Visual Studio library, and Vector for the buffer. Use inline capacity in the vector so we normally don't need to allocate any memory on the heap. * xml/XSLTUnicodeSort.cpp: (xsltTransformErrorTrampoline): Ditto. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::error): Ditto. 2016-12-11 Darin Adler <darin@apple.com> Make some refinements to HTMLPlugInImageElement https://bugs.webkit.org/show_bug.cgi?id=165742 Reviewed by Sam Weinig. * html/HTMLPlugInImageElement.cpp: Removed many unneeded includes. (WebCore::titleText): Use HashMap::ensure, correct argument types. (WebCore::subtitleText): Ditto. (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Moved initialization of most scalars to the class definition. (WebCore::HTMLPlugInImageElement::isImageType): Use auto. (WebCore::HTMLPlugInImageElement::wouldLoadAsPlugIn): Removed unneeded local variable and if statement. (WebCore::HTMLPlugInImageElement::willDetachRenderers): Use auto. (WebCore::HTMLPlugInImageElement::updateSnapshot): Do not call renderer twice unnecessarily. (WebCore::plugInImageElementIsolatedWorld): Use auto. (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Use auto. (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay): Use auto. (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns): Got rid of unnecessary typedef. (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Take a reference rather than PassRefPtr. (WebCore::documentHadRecentUserGesture): Removed unneeded if. (WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting): Use auto. (WebCore::isSmallerThanTinySizingThreshold): Use auto. (WebCore::HTMLPlugInImageElement::isTopLevelFullPagePlugin): Use auto. (WebCore::HTMLPlugInImageElement::checkSnapshotStatus): Use auto. (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Got rid of unnecessary local variable. Use auto. (WebCore::HTMLPlugInImageElement::requestObject): Got rid of unnecessary local variable. * html/HTMLPlugInImageElement.h: Updated for the above. Removed incorrect use of const. Initialized all scalars. Made function private and final. * rendering/RenderSnapshottedPlugIn.cpp: (WebCore::RenderSnapshottedPlugIn::handleEvent): Pass reference instead of pointer. 2016-12-11 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Cleanup some InspectorInstrumentation network loading notifications https://bugs.webkit.org/show_bug.cgi?id=165688 Reviewed by Brian Burg. Eliminate InspectorInstrumentation::willReceiveResourceResponse by folding it into InspectorInstrumentation::didReceiveResourceResponse. Simplify other related InspectorInstrumentation calls by using references and using more consistent InspectorInstrumentation patterns. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl): (WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl): Deleted. (WebCore::InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl): Deleted. (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl): Deleted. (WebCore::InspectorInstrumentation::continueWithPolicyDownloadImpl): Deleted. (WebCore::InspectorInstrumentation::continueWithPolicyIgnoreImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willReceiveResourceResponse): Deleted. * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): (WebCore::DocumentLoader::continueAfterContentPolicy): * loader/ResourceLoadNotifier.cpp: (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didReceiveResponse): 2016-12-11 Eric Carlson <eric.carlson@apple.com> [MediaStream] Protect MediaDevicesRequest during callback https://bugs.webkit.org/show_bug.cgi?id=165711 <rdar://problem/28400468> Reviewed by Sam Weinig. No new tests, I was unable to create a reproducible test but this fix avoids an occasional crash in existing tests. * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: (WebCore::MediaDevicesEnumerationRequest::start): Take a reference to the object before calling the controller in case the completion handler is called synchronously. 2016-12-09 Filip Pizlo <fpizlo@apple.com> The DOM should have an advancing wavefront opaque root barrier https://bugs.webkit.org/show_bug.cgi?id=165712 Reviewed by Yusuke Suzuki. No new tests because this was covered by crashing tests. Consider these two cases: Removal: 1) DOM at start: D->X->Y 2) Mark X, X->visitChildren, addOpaqueRoot(D) 3) remove X 4) Y thinks it's not reachable (its opaque root, X, is not in the set). Insertion: 1) DOM at start: D, X->Y 2) Mark X, X->visitChildren, addOpaqueRoot(X) 3) insert X into D 4) Y thinks it's not reachable (its opaque root, D, is not in the set). We can fix this with two barriers: Removal: add X (the removed child) to the opaque root set. Insertion: add D (the insertion point) to the opaque root set. Thanks Rysosuke for coming up with this idea! Both barriers advance the wavefront. We could consider retreating wavefront barriers in the future (where we cause visitChildren to be called again on wrappers that belonged to roots that got affected by insertion/removal) but those would probably require more bookkeeping. To make this barrier very fast, the WebCore caches the JSC VM's barrier state in its own global variable for very fast access. This variable will be false most of the time. It's false when there is no VM, so triggering the barrier won't cause the VM to be created. It's only true when GC is running, which is rare by design. To make that caching more sensible, I finally gave WebCore a central header for the common VM (CommonVM.h). * CMakeLists.txt: * Modules/mediastream/SDPProcessor.cpp: (WebCore::SDPProcessor::callScript): * WebCore.xcodeproj/project.pbxproj: * bindings/js/CommonVM.cpp: Added. (WebCore::commonVMSlow): (WebCore::writeBarrierOpaqueRootSlow): * bindings/js/CommonVM.h: Added. (WebCore::commonVM): (WebCore::writeBarrierOpaqueRoot): * bindings/js/DOMWrapperWorld.cpp: (WebCore::mainThreadNormalWorld): * bindings/js/GCController.cpp: (WebCore::collect): (WebCore::GCController::garbageCollectSoon): (WebCore::GCController::garbageCollectNow): (WebCore::GCController::garbageCollectNowIfNotDoneRecently): (WebCore::GCController::setJavaScriptGarbageCollectorTimerEnabled): (WebCore::GCController::deleteAllCode): (WebCore::GCController::deleteAllLinkedCode): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMBinding.cpp: (WebCore::addImpureProperty): * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow): (WebCore::JSDOMWindowBase::commonVM): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::setWindow): * bindings/js/JSNodeCustom.h: (WebCore::root): * bindings/js/ScriptCachedFrameData.cpp: (WebCore::ScriptCachedFrameData::ScriptCachedFrameData): (WebCore::ScriptCachedFrameData::restore): (WebCore::ScriptCachedFrameData::clear): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::~ScriptController): (WebCore::ScriptController::createWorld): (WebCore::ScriptController::getAllWorlds): (WebCore::ScriptController::clearWindowShell): (WebCore::ScriptController::cacheableBindingRootObject): (WebCore::ScriptController::bindingRootObject): (WebCore::ScriptController::windowScriptNPObject): (WebCore::ScriptController::jsObjectForPluginElement): (WebCore::ScriptController::clearScriptObjects): * dom/CollectionIndexCache.cpp: (WebCore::reportExtraMemoryAllocatedForCollectionIndexCache): * dom/ContainerNode.cpp: * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): (WebCore::notifyChildNodeRemoved): * dom/Document.cpp: (WebCore::Document::shouldBypassMainWorldContentSecurityPolicy): * dom/Node.h: (WebCore::Node::opaqueRoot): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::vm): * html/HTMLImageLoader.cpp: (WebCore::HTMLImageLoader::notifyFinished): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseAfterDetachedTask): (WebCore::HTMLMediaElement::ensureIsolatedWorld): * html/HTMLPlugInImageElement.cpp: (WebCore::plugInImageElementIsolatedWorld): * inspector/InspectorController.cpp: (WebCore::InspectorController::vm): * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): * page/PerformanceLogging.cpp: (WebCore::PerformanceLogging::memoryUsageStatistics): (WebCore::PerformanceLogging::javaScriptObjectCounts): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::createThreadIfNeeded): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::reportApproximateMemoryCost): * testing/MemoryInfo.h: (WebCore::MemoryInfo::MemoryInfo): 2016-12-11 Dan Bernstein <mitz@apple.com> [Cocoa] NSAttributedString representation of text copied from -webkit-nbsp-mode:space element contains non-breaking space characters, but shouldn’t https://bugs.webkit.org/show_bug.cgi?id=165515 <rdar://problem/4108460> Reviewed by Darin Adler. Test: platform/mac/fast/text/attributed-substring-from-range.html * editing/cocoa/HTMLConverter.mm: (HTMLConverter::_processText): Emit a space instead of a non-breaking space if the text node is styled with -webkit-nbsp-mode:space. (WebCore::editingAttributedStringFromRange): Replace all non-breaking spaces with spaces if they come from a text node with -webkit-nbsp-mode:space. 2016-12-11 Konstantin Tokarev <annulen@yandex.ru> Unreviewed, add KHR include dir to fix ANGLE build after r209665 https://bugs.webkit.org/show_bug.cgi?id=165686 * CMakeLists.txt: 2016-12-10 Dave Hyatt <hyatt@apple.com> Rolling out 165737, since it broke layout tests. I need to find a different place to put the init. * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidSelector): 2016-12-10 Simon Fraser <simon.fraser@apple.com> Support the deprecated dictionary constructor for DOMPointReadOnly and DOMPoint https://bugs.webkit.org/show_bug.cgi?id=165732 Reviewed by Sam Weinig. For compatibility with other browsers, support the DOMPointInit constructor to DOMPoint and DOMPointReadOnly per <https://www.w3.org/TR/geometry-1/#DOMPoint> Extended geometry/DOMPoint-001.html to test. * dom/DOMPoint.h: * dom/DOMPoint.idl: * dom/DOMPointReadOnly.h: (WebCore::DOMPointReadOnly::create): * dom/DOMPointReadOnly.idl: 2016-12-10 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure content extensions initialize AtomicString https://bugs.webkit.org/show_bug.cgi?id=165737 Reviewed by Simon Fraser. Fixes two broken tests in TestWebkitAPI. * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidSelector): 2016-12-10 Simon Fraser <simon.fraser@apple.com> Animation followed by transition doesn't always fire transitionend event https://bugs.webkit.org/show_bug.cgi?id=165731 rdar://problem/28471240 Reviewed by Zalan Bujtas. After r200047, a keyframe animation of an accelerated property followed by a transition didn't always fire a transitionend event. This happened if CompositeAnimation::timeToNextService() happend to be called when the transitions's timeToNextService() returned a positive value, but the keyframe animation still existed, but its timeToNextService() returned -1. In this case that -1 would clobber the positing minT. Fix by just continuing in each loop when the timeToNextService() returns -1. This code should probably be rewritten to use std::optional<double> rather than magic values. Test: animations/animation-followed-by-transition.html * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::timeToNextService): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::addAnimation): (WebCore::GraphicsLayerCA::pauseAnimation): (WebCore::GraphicsLayerCA::removeAnimation): (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted): (WebCore::GraphicsLayerCA::platformCALayerAnimationEnded): 2016-12-10 Sam Weinig <sam@webkit.org> [WebIDL] Merge JSDictionary into Dictionary, and remove unused bits https://bugs.webkit.org/show_bug.cgi?id=165641 Reviewed by Dan Bernstein. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: Remove JSDictionary.h/cpp * Modules/mediastream/RTCDataChannel.cpp: Remove unused #include of Dictionary.h * Modules/mediastream/RTCPeerConnection.cpp: * Modules/mediastream/RTCPeerConnection.h: Replace unnecessary #include of Dictionary in a header with forward declaration. * bindings/js/Dictionary.cpp: (WebCore::Dictionary::Dictionary): (WebCore::Dictionary::tryGetProperty): (WebCore::Dictionary::getOwnPropertyNames): (WebCore::Dictionary::convertValue): (WebCore::Dictionary::asJSObject<Notification>): Deleted. (WebCore::Dictionary::getOwnPropertiesAsStringHashMap): Deleted. (WebCore::Dictionary::getWithUndefinedOrNullCheck): Deleted. * bindings/js/Dictionary.h: (WebCore::Dictionary::isObject): (WebCore::Dictionary::isUndefinedOrNull): (WebCore::Dictionary::execState): (WebCore::Dictionary::initializerObject): (WebCore::Dictionary::isValid): (WebCore::Dictionary::convertValue): (WebCore::Dictionary::get): (WebCore::Dictionary::tryGetPropertyAndResult): (WebCore::Dictionary::getEventListener): Deleted. Merge JSDictionary into Dictionary. Remove all unused functions (some getters, lots of convertValue overrides). Modernize to taste. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): (WebCore::getHashAlgorithm): (WebCore::createHmacParams): (WebCore::createHmacKeyParams): (WebCore::createRsaKeyGenParams): (WebCore::createRsaOaepParams): (WebCore::createRsaSsaParams): Update for rename. JSDictionary is now Dictionary. * bindings/js/JSDictionary.cpp: Removed. * bindings/js/JSDictionary.h: Removed. * dom/MutationObserver.cpp: Remove unused #include of Dictionary.h 2016-12-10 Dave Hyatt <hyatt@apple.com> [CSS Parser] Move CSSParserValues.h/.cpp to CSSParserSelector.h/.cpp https://bugs.webkit.org/show_bug.cgi?id=165730 Reviewed by Simon Fraser. * WebCore.xcodeproj/project.pbxproj: * css/CSSCustomPropertyValue.cpp: * css/CSSPrimitiveValue.cpp: * css/CSSSelectorList.cpp: * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/parser/CSSParserImpl.cpp: * css/parser/CSSParserSelector.cpp: Copied from Source/WebCore/css/parser/CSSParserValues.cpp. * css/parser/CSSParserSelector.h: Copied from Source/WebCore/css/parser/CSSParserValues.h. * css/parser/CSSParserValues.cpp: Removed. * css/parser/CSSParserValues.h: Removed. * css/parser/CSSSelectorParser.h: 2016-12-10 Dave Hyatt <hyatt@apple.com> [CSS Parser] Remove the pseudoclass/element hacks https://bugs.webkit.org/show_bug.cgi?id=165729 Reviewed by Sam Weinig. * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoElementTypeMap.in: * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): 2016-12-09 Sam Weinig <sam@webkit.org> [WebIDL] Remove custom bindings for Geolocation https://bugs.webkit.org/show_bug.cgi?id=165625 Reviewed by Alex Christensen. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: Add/remove files. * Modules/geolocation/GeoNotifier.cpp: (WebCore::GeoNotifier::GeoNotifier): (WebCore::GeoNotifier::hasZeroTimeout): (WebCore::GeoNotifier::startTimerIfNeeded): * Modules/geolocation/GeoNotifier.h: (WebCore::GeoNotifier::create): (WebCore::GeoNotifier::options): Update to store PositionOptions as a value, and pass the PositionCallback as a Ref, rather than a RefPtr, since it is not optional. * Modules/geolocation/Geolocation.cpp: (WebCore::createGeoposition): Use auto, to get the good type for Coordinates (Ref). (WebCore::Geolocation::getCurrentPosition): (WebCore::Geolocation::watchPosition): (WebCore::Geolocation::haveSuitableCachedPosition): (WebCore::Geolocation::startUpdating): * Modules/geolocation/Geolocation.h: Update to pass PositionOptions itself now that it is a plain struct. * Modules/geolocation/Geolocation.idl: Remove [Custom] extended attribute and add FIXME about nullable annotation. * Modules/geolocation/Geoposition.h: Pass/store Coordinates as a Ref. * Modules/geolocation/PositionOptions.h: Convert to be a simple struct. * Modules/geolocation/PositionOptions.idl: Added. * bindings/js/JSGeolocationCustom.cpp: Removed. 2016-12-09 Dave Hyatt <hyatt@apple.com> [CSS Parser] Remove the old CSS Parser https://bugs.webkit.org/show_bug.cgi?id=165645 Reviewed by Daniel Bates. Remove the old CSS parser code. In doing so, code that used documentless CSSParserContexts is now going through the new parser. This resulted in some additional changes. These include: (1) Canvas color parsing switched to new parser's code. This resulted in progressions on canvas tests. (2) Support for CSSNamespaceRule in the CSS OM, since the Inspector's creation of CSS OM wrappers made it necessary to add this in. The old parser did not create style rules for namespaces, but the new one (and other browsers) did. (3) <font face="X"> now uses the new parser's font-family parsing code. This change was made in createFontFaceValue in CSSValuePool. (4) FontFace now uses a new function on the new parser called parseFontFaceDescriptor. This function sets things up so that parsing occurs as though you are inside a @font-face. The old parser let you call parseValue to parse "properties", but descriptors need to be handled differently in the new parser. (5) Illegal CSS rules in mediaControlsApple/ios.css forced me to add a quirk to handle chained shadow DOM pseudo-elements. This should not be allowed, but for now it is. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/JSCSSStyleDeclarationCustom.cpp: * css/CSSCalculationValue.cpp: (WebCore::unitCategory): (WebCore::hasDoubleValue): (WebCore::checkDepthAndIndexDeprecated): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::parseCalc): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::operatorValue): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValue): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueTerm): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueMultiplicativeExpression): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::parseAdditiveValueExpression): Deleted. (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueExpression): Deleted. * css/CSSCalculationValue.h: * css/CSSComputedStyleDeclaration.cpp: (WebCore::specifiedValueForGridTrackSize): * css/CSSCustomPropertyValue.cpp: (WebCore::CSSCustomPropertyValue::checkVariablesForCycles): (WebCore::CSSCustomPropertyValue::resolveVariableReferences): * css/CSSCustomPropertyValue.h: * css/CSSFunctionValue.cpp: (WebCore::CSSFunctionValue::CSSFunctionValue): (WebCore::CSSFunctionValue::customCSSText): (WebCore::CSSFunctionValue::append): (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables): Deleted. * css/CSSFunctionValue.h: * css/CSSGrammar.y.in: Removed. * css/CSSGrammar.y.includes: Removed. * css/CSSGroupingRule.cpp: (WebCore::CSSGroupingRule::insertRule): * css/CSSKeyframeRule.h: * css/CSSKeyframesRule.cpp: (WebCore::CSSKeyframesRule::appendRule): * css/CSSNamespaceRule.cpp: Added. (WebCore::CSSNamespaceRule::CSSNamespaceRule): (WebCore::CSSNamespaceRule::~CSSNamespaceRule): (WebCore::CSSNamespaceRule::namespaceURI): (WebCore::CSSNamespaceRule::prefix): (WebCore::CSSNamespaceRule::cssText): (WebCore::CSSNamespaceRule::reattach): * css/CSSNamespaceRule.h: Added. * css/CSSNamespaceRule.idl: Added. * css/CSSPrimitiveValue.cpp: (WebCore::isValidCSSUnitTypeForDoubleConversion): (WebCore::isStringType): (WebCore::CSSPrimitiveValue::cleanup): (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): (WebCore::CSSPrimitiveValue::cloneForCSSOM): (WebCore::CSSPrimitiveValue::equals): (WebCore::CSSPrimitiveValue::buildParserValue): Deleted. * css/CSSPrimitiveValue.h: * css/CSSRule.h: * css/CSSRule.idl: * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::insertRule): * css/CSSValue.cpp: (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): * css/CSSValue.h: (WebCore::CSSValue::isCustomPropertyValue): (WebCore::CSSValue::hasVariableReferences): (WebCore::CSSValue::isVariableDependentValue): Deleted. (WebCore::CSSValue::isVariableValue): Deleted. * css/CSSValueList.cpp: (WebCore::CSSValueList::customCSSText): (WebCore::CSSValueList::containsVariables): Deleted. (WebCore::CSSValueList::checkVariablesForCycles): Deleted. (WebCore::CSSValueList::buildParserValueSubstitutingVariables): Deleted. (WebCore::CSSValueList::buildParserValueListSubstitutingVariables): Deleted. * css/CSSValueList.h: (WebCore::CSSValueList::createSlashSeparated): (WebCore::CSSValueList::createFromParserValueList): Deleted. * css/CSSValuePool.cpp: (WebCore::CSSValuePool::createFontFaceValue): * css/CSSVariableData.cpp: * css/CSSVariableDependentValue.cpp: Removed. * css/CSSVariableDependentValue.h: Removed. * css/CSSVariableValue.cpp: Removed. * css/CSSVariableValue.h: Removed. * css/DOMCSSNamespace.cpp: * css/FontFace.cpp: (WebCore::FontFace::parseString): * css/InspectorCSSOMWrappers.cpp: * css/MediaQueryExp.cpp: (WebCore::isFeatureValidWithIdentifier): Deleted. (WebCore::isFeatureValidWithNonNegativeLengthOrNumber): Deleted. (WebCore::isFeatureValidWithDensity): Deleted. (WebCore::isFeatureValidWithNonNegativeInteger): Deleted. (WebCore::isFeatureValidWithNonNegativeNumber): Deleted. (WebCore::isFeatureValidWithZeroOrOne): Deleted. (WebCore::isFeatureValidWithNumberWithUnit): Deleted. (WebCore::isFeatureValidWithNumber): Deleted. (WebCore::isSlash): Deleted. (WebCore::isPositiveIntegerValue): Deleted. * css/MediaQueryExp.h: * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::setCssText): (WebCore::PropertySetCSSStyleDeclaration::setProperty): * css/SelectorPseudoTypeMap.h: * css/StyleProperties.cpp: (WebCore::StyleProperties::getPropertyValue): (WebCore::StyleProperties::getPropertyCSSValue): (WebCore::MutableStyleProperties::setCustomProperty): (WebCore::MutableStyleProperties::parseDeclaration): (WebCore::StyleProperties::asText): * css/StyleProperties.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::applyProperty): * css/StyleResolver.h: * css/StyleRule.cpp: (WebCore::StyleRuleBase::createCSSOMWrapper): * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::parseAuthorStyleSheet): (WebCore::StyleSheetContents::parseString): (WebCore::StyleSheetContents::completeURL): (WebCore::StyleSheetContents::parseStringAtPosition): Deleted. * css/StyleSheetContents.h: * css/WebKitCSSMatrix.cpp: * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::CSSParser::CSSParser): (WebCore::CSSParser::parseSheet): (WebCore::CSSParser::parseRule): (WebCore::CSSParser::parseKeyframeRule): (WebCore::CSSParser::parseSupportsCondition): (WebCore::CSSParser::parseColor): (WebCore::CSSParser::parseSystemColor): (WebCore::CSSParser::parseSingleValue): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseCustomPropertyValue): (WebCore::CSSParser::parseSelector): (WebCore::CSSParser::parseInlineStyleDeclaration): (WebCore::CSSParser::parseDeclaration): (WebCore::CSSParser::parseValueWithVariableReferences): (WebCore::CSSParser::parseKeyframeKeyList): (WebCore::CSSParser::parseFontFaceDescriptor): (WebCore::equalLettersIgnoringASCIICase): Deleted. (WebCore::hasPrefix): Deleted. (WebCore::createPrimitiveValuePair): Deleted. (WebCore::AnimationParseContext::commitFirstAnimation): Deleted. (WebCore::AnimationParseContext::hasCommittedFirstAnimation): Deleted. (WebCore::AnimationParseContext::commitAnimationPropertyKeyword): Deleted. (WebCore::AnimationParseContext::animationPropertyKeywordAllowed): Deleted. (WebCore::AnimationParseContext::hasSeenAnimationPropertyKeyword): Deleted. (WebCore::AnimationParseContext::sawAnimationPropertyKeyword): Deleted. (): Deleted. (WebCore::convertToASCIILowercaseInPlace): Deleted. (WebCore::CSSParserString::convertToASCIILowercaseInPlace): Deleted. (WebCore::CSSParser::setupParser): Deleted. (WebCore::isColorPropertyID): Deleted. (WebCore::CSSParser::isValidSystemColorValue): Deleted. (WebCore::validPrimitiveValueColor): Deleted. (WebCore::parseColorValue): Deleted. (WebCore::isSimpleLengthPropertyID): Deleted. (WebCore::parseSimpleLength): Deleted. (WebCore::parseSimpleLengthValue): Deleted. (WebCore::isValidKeywordPropertyAndValue): Deleted. (WebCore::isUniversalKeyword): Deleted. (WebCore::isKeywordPropertyID): Deleted. (WebCore::parseKeywordValue): Deleted. (WebCore::parseTransformTranslateArguments): Deleted. (WebCore::parseTranslateTransformValue): Deleted. (WebCore::CSSParser::parseFontFaceValue): Deleted. (WebCore::CSSParser::parseColorFromString): Deleted. (WebCore::CSSParser::parseDeclarationDeprecated): Deleted. (WebCore::filterProperties): Deleted. (WebCore::CSSParser::createStyleProperties): Deleted. (WebCore::CSSParser::addProperty): Deleted. (WebCore::CSSParser::rollbackLastProperties): Deleted. (WebCore::CSSParser::clearProperties): Deleted. (WebCore::CSSParser::completeURL): Deleted. (WebCore::CSSParser::validateCalculationUnit): Deleted. (WebCore::CSSParser::shouldAcceptUnitLessValues): Deleted. (WebCore::CSSParser::validateUnit): Deleted. (WebCore::CSSParser::createPrimitiveNumericValue): Deleted. (WebCore::CSSParser::createPrimitiveStringValue): Deleted. (WebCore::isComma): Deleted. (WebCore::isForwardSlashOperator): Deleted. (WebCore::CSSParser::isValidSize): Deleted. (WebCore::CSSParser::parseValidPrimitive): Deleted. (WebCore::CSSParser::addExpandedPropertyForValue): Deleted. (WebCore::isImageSetFunctionValue): Deleted. (WebCore::CSSParser::addFillValue): Deleted. (WebCore::isContentDistributionKeyword): Deleted. (WebCore::isContentPositionKeyword): Deleted. (WebCore::isBaselinePositionKeyword): Deleted. (WebCore::isAlignmentOverflowKeyword): Deleted. (WebCore::isItemPositionKeyword): Deleted. (WebCore::CSSParser::parseLegacyPosition): Deleted. (WebCore::CSSParser::parseContentDistributionOverflowPosition): Deleted. (WebCore::CSSParser::parseItemPositionOverflowPosition): Deleted. (WebCore::parseBackgroundClip): Deleted. (WebCore::CSSParser::useLegacyBackgroundSizeShorthandBehavior): Deleted. (WebCore::CSSParser::parseNonElementSnapPoints): Deleted. (WebCore::CSSParser::parseScrollSnapPositions): Deleted. (WebCore::CSSParser::parseScrollSnapDestination): Deleted. (WebCore::CSSParser::parseScrollSnapCoordinate): Deleted. (WebCore::CSSParser::parseFillShorthand): Deleted. (WebCore::CSSParser::addAnimationValue): Deleted. (WebCore::CSSParser::parseAnimationShorthand): Deleted. (WebCore::CSSParser::parseColumnWidth): Deleted. (WebCore::CSSParser::parseColumnCount): Deleted. (WebCore::CSSParser::parseColumnsShorthand): Deleted. (WebCore::CSSParser::parseTransitionShorthand): Deleted. (WebCore::CSSParser::parseShorthand): Deleted. (WebCore::CSSParser::parse4Values): Deleted. (WebCore::CSSParser::parsePage): Deleted. (WebCore::CSSParser::parseSize): Deleted. (WebCore::CSSParser::parseSizeParameter): Deleted. (WebCore::CSSParser::parseQuotes): Deleted. (WebCore::CSSParser::parseAlt): Deleted. (WebCore::CSSParser::parseCustomPropertyDeclaration): Deleted. (WebCore::CSSParser::parseContent): Deleted. (WebCore::CSSParser::parseAttr): Deleted. (WebCore::CSSParser::parseBackgroundColor): Deleted. (WebCore::CSSParser::parseFillImage): Deleted. (WebCore::CSSParser::parsePositionX): Deleted. (WebCore::CSSParser::parsePositionY): Deleted. (WebCore::CSSParser::parseFillPositionComponent): Deleted. (WebCore::isValueConflictingWithCurrentEdge): Deleted. (WebCore::isFillPositionKeyword): Deleted. (WebCore::CSSParser::parse4ValuesFillPosition): Deleted. (WebCore::CSSParser::parse3ValuesFillPosition): Deleted. (WebCore::CSSParser::isPotentialPositionValue): Deleted. (WebCore::CSSParser::parseFillPosition): Deleted. (WebCore::CSSParser::parse2ValuesFillPosition): Deleted. (WebCore::CSSParser::parseFillRepeat): Deleted. (WebCore::CSSParser::parseFillSize): Deleted. (WebCore::CSSParser::parseFillProperty): Deleted. (WebCore::CSSParser::parseAnimationDelay): Deleted. (WebCore::CSSParser::parseAnimationDirection): Deleted. (WebCore::CSSParser::parseAnimationDuration): Deleted. (WebCore::CSSParser::parseAnimationFillMode): Deleted. (WebCore::CSSParser::parseAnimationIterationCount): Deleted. (WebCore::CSSParser::parseAnimationName): Deleted. (WebCore::CSSParser::parseAnimationPlayState): Deleted. (WebCore::CSSParser::parseAnimationTrigger): Deleted. (WebCore::CSSParser::parseAnimationProperty): Deleted. (WebCore::CSSParser::parseTransformOriginShorthand): Deleted. (WebCore::CSSParser::isSpringTimingFunctionEnabled): Deleted. (WebCore::CSSParser::parseCubicBezierTimingFunctionValue): Deleted. (WebCore::CSSParser::parseSpringTimingFunctionValue): Deleted. (WebCore::CSSParser::parseAnimationTimingFunction): Deleted. (WebCore::isValidGridPositionCustomIdent): Deleted. (WebCore::CSSParser::parseIntegerOrCustomIdentFromGridPosition): Deleted. (WebCore::CSSParser::parseGridPosition): Deleted. (WebCore::gridMissingGridPositionValue): Deleted. (WebCore::CSSParser::parseGridItemPositionShorthand): Deleted. (WebCore::CSSParser::parseGridGapShorthand): Deleted. (WebCore::CSSParser::parseGridTemplateColumns): Deleted. (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns): Deleted. (WebCore::CSSParser::parseGridTemplateShorthand): Deleted. (WebCore::parseImplicitAutoFlow): Deleted. (WebCore::CSSParser::parseGridShorthand): Deleted. (WebCore::CSSParser::parseGridAreaShorthand): Deleted. (WebCore::CSSParser::parseSingleGridAreaLonghand): Deleted. (WebCore::CSSParser::parseGridLineNames): Deleted. (WebCore::isGridTrackFixedSized): Deleted. (WebCore::CSSParser::parseGridTrackList): Deleted. (WebCore::CSSParser::parseGridTrackRepeatFunction): Deleted. (WebCore::CSSParser::parseGridTrackSize): Deleted. (WebCore::CSSParser::parseGridBreadth): Deleted. (WebCore::isValidGridAutoFlowId): Deleted. (WebCore::CSSParser::parseGridAutoFlow): Deleted. (WebCore::skipCommaInDashboardRegion): Deleted. (WebCore::CSSParser::parseDashboardRegions): Deleted. (WebCore::parseGridTemplateAreasColumnNames): Deleted. (WebCore::CSSParser::parseGridTemplateAreasRow): Deleted. (WebCore::CSSParser::parseGridTemplateAreas): Deleted. (WebCore::CSSParser::parseCounterContent): Deleted. (WebCore::CSSParser::parseClipShape): Deleted. (WebCore::completeBorderRadii): Deleted. (WebCore::CSSParser::parseInsetRoundedCorners): Deleted. (WebCore::CSSParser::parseBasicShapeInset): Deleted. (WebCore::CSSParser::parseShapeRadius): Deleted. (WebCore::CSSParser::parseBasicShapeCircle): Deleted. (WebCore::CSSParser::parseBasicShapeEllipse): Deleted. (WebCore::CSSParser::parseBasicShapePolygon): Deleted. (WebCore::CSSParser::parseBasicShapePath): Deleted. (WebCore::isBoxValue): Deleted. (WebCore::CSSParser::parseBasicShapeAndOrBox): Deleted. (WebCore::CSSParser::parseShapeProperty): Deleted. (WebCore::CSSParser::parseClipPath): Deleted. (WebCore::CSSParser::parseBasicShape): Deleted. (WebCore::CSSParser::parseFont): Deleted. (WebCore::CSSParser::parseSystemFont): Deleted. (WebCore::FontFamilyValueBuilder::FontFamilyValueBuilder): Deleted. (WebCore::FontFamilyValueBuilder::add): Deleted. (WebCore::FontFamilyValueBuilder::commit): Deleted. (WebCore::valueIsCSSKeyword): Deleted. (WebCore::CSSParser::parseFontFamily): Deleted. (WebCore::CSSParser::parseLineHeight): Deleted. (WebCore::CSSParser::parseFontSize): Deleted. (WebCore::createFontWeightValueKeyword): Deleted. (WebCore::CSSParser::parseFontWeight): Deleted. (WebCore::CSSParser::parseFontSynthesis): Deleted. (WebCore::CSSParser::parseFontFaceSrcURI): Deleted. (WebCore::CSSParser::parseFontFaceSrcLocal): Deleted. (WebCore::CSSParser::parseFontFaceSrc): Deleted. (WebCore::CSSParser::parseFontFaceUnicodeRange): Deleted. (WebCore::checkForValidDouble): Deleted. (WebCore::parseDouble): Deleted. (WebCore::parseColorIntOrPercentage): Deleted. (WebCore::isTenthAlpha): Deleted. (WebCore::parseAlphaValue): Deleted. (WebCore::mightBeRGBA): Deleted. (WebCore::mightBeRGB): Deleted. (WebCore::fastParseColorInternal): Deleted. (WebCore::CSSParser::fastParseColor): Deleted. (WebCore::CSSParser::parsedDouble): Deleted. (WebCore::CSSParser::isCalculation): Deleted. (WebCore::isPercent): Deleted. (WebCore::CSSParser::parseColorInt): Deleted. (WebCore::CSSParser::parseColorDouble): Deleted. (WebCore::CSSParser::parseRGBParameters): Deleted. (WebCore::CSSParser::parseColorFunctionParameters): Deleted. (WebCore::CSSParser::parseHSLParameters): Deleted. (WebCore::CSSParser::parseColorFromValue): Deleted. (WebCore::ShadowParseContext::ShadowParseContext): Deleted. (WebCore::ShadowParseContext::allowLength): Deleted. (WebCore::ShadowParseContext::commitValue): Deleted. (WebCore::ShadowParseContext::commitLength): Deleted. (WebCore::ShadowParseContext::commitColor): Deleted. (WebCore::ShadowParseContext::commitStyle): Deleted. (WebCore::CSSParser::parseShadow): Deleted. (WebCore::CSSParser::parseReflect): Deleted. (WebCore::CSSParser::parseFlex): Deleted. (WebCore::BorderImageParseContext::BorderImageParseContext): Deleted. (WebCore::BorderImageParseContext::canAdvance): Deleted. (WebCore::BorderImageParseContext::setCanAdvance): Deleted. (WebCore::BorderImageParseContext::allowCommit): Deleted. (WebCore::BorderImageParseContext::allowImage): Deleted. (WebCore::BorderImageParseContext::allowImageSlice): Deleted. (WebCore::BorderImageParseContext::allowRepeat): Deleted. (WebCore::BorderImageParseContext::allowForwardSlashOperator): Deleted. (WebCore::BorderImageParseContext::requireWidth): Deleted. (WebCore::BorderImageParseContext::requireOutset): Deleted. (WebCore::BorderImageParseContext::commitImage): Deleted. (WebCore::BorderImageParseContext::commitImageSlice): Deleted. (WebCore::BorderImageParseContext::commitForwardSlashOperator): Deleted. (WebCore::BorderImageParseContext::commitBorderWidth): Deleted. (WebCore::BorderImageParseContext::commitBorderOutset): Deleted. (WebCore::BorderImageParseContext::commitRepeat): Deleted. (WebCore::BorderImageParseContext::commitWebKitBorderImage): Deleted. (WebCore::BorderImageParseContext::commitBorderImage): Deleted. (WebCore::BorderImageParseContext::commitBorderImageProperty): Deleted. (WebCore::CSSParser::parseBorderImage): Deleted. (WebCore::isBorderImageRepeatKeyword): Deleted. (WebCore::CSSParser::parseBorderImageRepeat): Deleted. (WebCore::BorderImageSliceParseContext::BorderImageSliceParseContext): Deleted. (WebCore::BorderImageSliceParseContext::allowNumber): Deleted. (WebCore::BorderImageSliceParseContext::allowFill): Deleted. (WebCore::BorderImageSliceParseContext::allowFinalCommit): Deleted. (WebCore::BorderImageSliceParseContext::top): Deleted. (WebCore::BorderImageSliceParseContext::commitNumber): Deleted. (WebCore::BorderImageSliceParseContext::commitFill): Deleted. (WebCore::BorderImageSliceParseContext::commitBorderImageSlice): Deleted. (WebCore::CSSParser::parseBorderImageSlice): Deleted. (WebCore::BorderImageQuadParseContext::BorderImageQuadParseContext): Deleted. (WebCore::BorderImageQuadParseContext::allowNumber): Deleted. (WebCore::BorderImageQuadParseContext::allowFinalCommit): Deleted. (WebCore::BorderImageQuadParseContext::top): Deleted. (WebCore::BorderImageQuadParseContext::commitNumber): Deleted. (WebCore::BorderImageQuadParseContext::setAllowFinalCommit): Deleted. (WebCore::BorderImageQuadParseContext::setTop): Deleted. (WebCore::BorderImageQuadParseContext::commitBorderImageQuad): Deleted. (WebCore::CSSParser::parseBorderImageQuad): Deleted. (WebCore::CSSParser::parseBorderImageWidth): Deleted. (WebCore::CSSParser::parseBorderImageOutset): Deleted. (WebCore::CSSParser::parseBorderRadius): Deleted. (WebCore::CSSParser::parseAspectRatio): Deleted. (WebCore::CSSParser::parseCounter): Deleted. (WebCore::parseDeprecatedGradientPoint): Deleted. (WebCore::parseDeprecatedGradientColorStop): Deleted. (WebCore::CSSParser::parseDeprecatedGradient): Deleted. (WebCore::valueFromSideKeyword): Deleted. (WebCore::parseGradientColorOrKeyword): Deleted. (WebCore::CSSParser::parseDeprecatedLinearGradient): Deleted. (WebCore::CSSParser::parseDeprecatedRadialGradient): Deleted. (WebCore::CSSParser::parseLinearGradient): Deleted. (WebCore::CSSParser::parseRadialGradient): Deleted. (WebCore::CSSParser::parseGradientColorStops): Deleted. (WebCore::CSSParser::isGeneratedImageValue): Deleted. (WebCore::CSSParser::parseGeneratedImage): Deleted. (WebCore::CSSParser::parseFilterImage): Deleted. (WebCore::CSSParser::parseCrossfade): Deleted. (WebCore::CSSParser::parseCanvas): Deleted. (WebCore::CSSParser::parseNamedImage): Deleted. (WebCore::CSSParser::parseImageResolution): Deleted. (WebCore::CSSParser::parseImageSet): Deleted. (WebCore::TransformOperationInfo::TransformOperationInfo): Deleted. (WebCore::TransformOperationInfo::type): Deleted. (WebCore::TransformOperationInfo::argCount): Deleted. (WebCore::TransformOperationInfo::unit): Deleted. (WebCore::TransformOperationInfo::unknown): Deleted. (WebCore::TransformOperationInfo::hasCorrectArgCount): Deleted. (WebCore::CSSParser::parseTransform): Deleted. (WebCore::CSSParser::parseTransformValue): Deleted. (WebCore::CSSParser::isBlendMode): Deleted. (WebCore::CSSParser::isCompositeOperator): Deleted. (WebCore::isValidPrimitiveFilterFunction): Deleted. (WebCore::CSSParser::parseBuiltinFilterArguments): Deleted. (WebCore::cssValueKeywordIDForFunctionName): Deleted. (WebCore::CSSParser::parseFilter): Deleted. (WebCore::validFlowName): Deleted. (WebCore::CSSParser::isTextAutosizingEnabled): Deleted. (WebCore::CSSParser::isCSSGridLayoutEnabled): Deleted. (WebCore::CSSParser::parseFlowThread): Deleted. (WebCore::CSSParser::parseRegionThread): Deleted. (WebCore::CSSParser::parseTransformOrigin): Deleted. (WebCore::CSSParser::parsePerspectiveOrigin): Deleted. (WebCore::CSSParser::addTextDecorationProperty): Deleted. (WebCore::CSSParser::parseTextDecoration): Deleted. (WebCore::CSSParser::parseTextDecorationSkip): Deleted. (WebCore::CSSParser::parseTextUnderlinePosition): Deleted. (WebCore::CSSParser::parseTextEmphasisStyle): Deleted. (WebCore::CSSParser::parseTextEmphasisPosition): Deleted. (WebCore::CSSParser::parseTextIndent): Deleted. (WebCore::CSSParser::parseHangingPunctuation): Deleted. (WebCore::CSSParser::parseLineBoxContain): Deleted. (WebCore::CSSParser::parseFontFeatureTag): Deleted. (WebCore::CSSParser::parseFontFeatureSettings): Deleted. (WebCore::CSSParser::parseFontVariationTag): Deleted. (WebCore::CSSParser::parseFontVariationSettings): Deleted. (WebCore::CSSParser::parseFontVariantLigatures): Deleted. (WebCore::CSSParser::parseFontVariantNumeric): Deleted. (WebCore::CSSParser::parseFontVariantEastAsian): Deleted. (WebCore::CSSParser::parseFontVariant): Deleted. (WebCore::isValidWillChangeAnimatableFeature): Deleted. (WebCore::CSSParser::parseWillChange): Deleted. (WebCore::CSSParser::parseCalculation): Deleted. (WebCore::isCSSLetter): Deleted. (WebCore::isCSSEscape): Deleted. (WebCore::isURILetter): Deleted. (WebCore::isIdentifierStartAfterDash): Deleted. (WebCore::isCustomPropertyIdentifier): Deleted. (WebCore::isEqualToCSSIdentifier): Deleted. (WebCore::isEqualToCSSCaseSensitiveIdentifier): Deleted. (WebCore::checkAndSkipEscape): Deleted. (WebCore::skipWhiteSpace): Deleted. (WebCore::CSSParserString::characters<LChar>): Deleted. (WebCore::CSSParserString::characters<UChar>): Deleted. (WebCore::CSSParser::currentCharacter<LChar>): Deleted. (WebCore::CSSParser::currentCharacter<UChar>): Deleted. (WebCore::CSSParser::currentCharacter16): Deleted. (WebCore::CSSParser::tokenStart<LChar>): Deleted. (WebCore::CSSParser::tokenStart<UChar>): Deleted. (WebCore::CSSParser::currentLocation): Deleted. (WebCore::CSSParser::isIdentifierStart): Deleted. (WebCore::checkAndSkipString): Deleted. (WebCore::CSSParser::parseEscape): Deleted. (WebCore::CSSParser::UnicodeToChars<LChar>): Deleted. (WebCore::CSSParser::UnicodeToChars<UChar>): Deleted. (WebCore::CSSParser::parseIdentifierInternal): Deleted. (WebCore::CSSParser::parseIdentifier): Deleted. (WebCore::CSSParser::parseStringInternal): Deleted. (WebCore::CSSParser::parseString): Deleted. (WebCore::CSSParser::findURI): Deleted. (WebCore::CSSParser::parseURIInternal): Deleted. (WebCore::CSSParser::parseURI): Deleted. (WebCore::CSSParser::parseUnicodeRange): Deleted. (WebCore::CSSParser::parseNthChild): Deleted. (WebCore::CSSParser::parseNthChildExtra): Deleted. (WebCore::CSSParser::detectFunctionTypeToken): Deleted. (WebCore::CSSParser::detectMediaQueryToken): Deleted. (WebCore::CSSParser::detectNumberToken): Deleted. (WebCore::CSSParser::detectDashToken): Deleted. (WebCore::CSSParser::detectAtToken): Deleted. (WebCore::CSSParser::detectSupportsToken): Deleted. (WebCore::CSSParser::realLex): Deleted. (WebCore::CSSParser::createImportRule): Deleted. (WebCore::CSSParser::createMediaRule): Deleted. (WebCore::CSSParser::createEmptyMediaRule): Deleted. (WebCore::CSSParser::createSupportsRule): Deleted. (WebCore::CSSParser::markSupportsRuleHeaderStart): Deleted. (WebCore::CSSParser::markSupportsRuleHeaderEnd): Deleted. (WebCore::CSSParser::popSupportsRuleData): Deleted. (WebCore::CSSParser::processAndAddNewRuleToSourceTreeIfNeeded): Deleted. (WebCore::CSSParser::addNewRuleToSourceTree): Deleted. (WebCore::CSSParser::popRuleData): Deleted. (WebCore::CSSParser::syntaxError): Deleted. (WebCore::CSSParser::isLoggingErrors): Deleted. (WebCore::CSSParser::logError): Deleted. (WebCore::CSSParser::createKeyframesRule): Deleted. (WebCore::CSSParser::createStyleRule): Deleted. (WebCore::CSSParser::createFontFaceRule): Deleted. (WebCore::CSSParser::addNamespace): Deleted. (WebCore::CSSParser::determineNameInNamespace): Deleted. (WebCore::CSSParser::rewriteSpecifiersWithNamespaceIfNeeded): Deleted. (WebCore::CSSParser::rewriteSpecifiersWithElementName): Deleted. (WebCore::CSSParser::rewriteSpecifiers): Deleted. (WebCore::CSSParser::createPageRule): Deleted. (WebCore::CSSParser::createSelectorVector): Deleted. (WebCore::CSSParser::recycleSelectorVector): Deleted. (WebCore::CSSParser::createRegionRule): Deleted. (WebCore::CSSParser::createMarginAtRule): Deleted. (WebCore::CSSParser::startDeclarationsForMarginBox): Deleted. (WebCore::CSSParser::endDeclarationsForMarginBox): Deleted. (WebCore::CSSParser::createKeyframe): Deleted. (WebCore::CSSParser::invalidBlockHit): Deleted. (WebCore::CSSParser::updateLastMediaLine): Deleted. (WebCore::fixUnparsedProperties): Deleted. (WebCore::CSSParser::fixUnparsedPropertyRanges): Deleted. (WebCore::CSSParser::markRuleHeaderStart): Deleted. (WebCore::CSSParser::setRuleHeaderEnd): Deleted. (WebCore::CSSParser::markRuleHeaderEnd): Deleted. (WebCore::CSSParser::markSelectorStart): Deleted. (WebCore::CSSParser::markSelectorEnd): Deleted. (WebCore::CSSParser::markRuleBodyStart): Deleted. (WebCore::CSSParser::markRuleBodyEnd): Deleted. (WebCore::CSSParser::markPropertyStart): Deleted. (WebCore::CSSParser::markPropertyEnd): Deleted. (WebCore::CSSParser::createViewportRule): Deleted. (WebCore::CSSParser::parseViewportProperty): Deleted. (WebCore::CSSParser::parseViewportShorthand): Deleted. (WebCore::isAppleLegacyCSSPropertyKeyword): Deleted. (WebCore::cssPropertyID): Deleted. (WebCore::cssPropertyNameIOSAliasing): Deleted. (WebCore::isAppleLegacyCSSValueKeyword): Deleted. (WebCore::cssValueKeywordID): Deleted. (WebCore::isValidNthToken): Deleted. * css/parser/CSSParser.h: (): Deleted. (WebCore::CSSParser::ValueWithCalculation::ValueWithCalculation): Deleted. (WebCore::CSSParser::ValueWithCalculation::value): Deleted. (WebCore::CSSParser::ValueWithCalculation::operator CSSParserValue&): Deleted. (WebCore::CSSParser::ValueWithCalculation::calculation): Deleted. (WebCore::CSSParser::ValueWithCalculation::setCalculation): Deleted. (WebCore::CSSParser::hasProperties): Deleted. (WebCore::CSSParser::startNestedSelectorList): Deleted. (WebCore::CSSParser::endNestedSelectorList): Deleted. (WebCore::CSSParser::resetPropertyRange): Deleted. (WebCore::CSSParser::isExtractingSourceData): Deleted. (WebCore::CSSParser::lex): Deleted. (WebCore::CSSParser::token): Deleted. (WebCore::CSSParser::markViewportRuleBodyStart): Deleted. (WebCore::CSSParser::markViewportRuleBodyEnd): Deleted. (WebCore::CSSParser::setCustomPropertyName): Deleted. (WebCore::CSSParser::is8BitSource): Deleted. (WebCore::CSSParser::setStyleSheet): Deleted. (WebCore::CSSParser::inStrictMode): Deleted. (WebCore::CSSParser::inQuirksMode): Deleted. (WebCore::CSSParser::setupParser): Deleted. (WebCore::CSSParser::inShorthand): Deleted. (WebCore::CSSParser::inViewport): Deleted. (WebCore::CSSParser::operator|): Deleted. (WebCore::CSSParser::validateUnit): Deleted. (WebCore::ShorthandScope::ShorthandScope): Deleted. (WebCore::ShorthandScope::~ShorthandScope): Deleted. (WebCore::CSSParser::setTokenStart<LChar>): Deleted. (WebCore::CSSParser::setTokenStart<UChar>): Deleted. (WebCore::CSSParser::tokenStartOffset): Deleted. (WebCore::CSSParser::currentCharacterOffset): Deleted. (WebCore::CSSParser::tokenStartChar): Deleted. (WebCore::isCustomPropertyName): Deleted. (WebCore::cssyylex): Deleted. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * css/parser/CSSParserMode.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::setSelectorList): (WebCore::destroy): Deleted. (WebCore::CSSParserValueList::~CSSParserValueList): Deleted. (WebCore::CSSParserValueList::addValue): Deleted. (WebCore::CSSParserValueList::insertValueAt): Deleted. (WebCore::CSSParserValueList::extend): Deleted. (WebCore::CSSParserValueList::containsVariables): Deleted. (WebCore::CSSParserValue::createCSSValue): Deleted. (WebCore::CSSParserSelector::parsePseudoElementSelector): Deleted. (WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector): Deleted. (WebCore::CSSParserSelector::parsePseudoElementSlottedFunctionSelector): Deleted. (WebCore::CSSParserSelector::parsePseudoClassHostFunctionSelector): Deleted. (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector): Deleted. (WebCore::CSSParserSelector::setPseudoClassValue): Deleted. * css/parser/CSSParserValues.h: (WebCore::CSSParserString::init): Deleted. (WebCore::CSSParserString::clear): Deleted. (WebCore::CSSParserString::is8Bit): Deleted. (WebCore::CSSParserString::characters8): Deleted. (WebCore::CSSParserString::characters16): Deleted. (WebCore::CSSParserString::length): Deleted. (WebCore::CSSParserString::setLength): Deleted. (WebCore::CSSParserString::operator[]): Deleted. (WebCore::CSSParserString::operator String): Deleted. (WebCore::CSSParserString::operator AtomicString): Deleted. (WebCore::CSSParserString::toStringView): Deleted. (): Deleted. (WebCore::CSSParserValueList::CSSParserValueList): Deleted. (WebCore::CSSParserValueList::size): Deleted. (WebCore::CSSParserValueList::currentIndex): Deleted. (WebCore::CSSParserValueList::current): Deleted. (WebCore::CSSParserValueList::next): Deleted. (WebCore::CSSParserValueList::previous): Deleted. (WebCore::CSSParserValueList::setCurrentIndex): Deleted. (WebCore::CSSParserValueList::valueAt): Deleted. (WebCore::CSSParserValueList::clear): Deleted. (WebCore::CSSParserValue::setFromValueList): Deleted. (WebCore::equalLettersIgnoringASCIICase): Deleted. * css/parser/CSSPropertyParser.cpp: (WebCore::isCustomPropertyName): (WebCore::cssPropertyNameIOSAliasing): * css/parser/CSSPropertyParser.h: * css/parser/SVGCSSParser.cpp: Removed. * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::ensureSourceData): (WebCore::InspectorStyleSheetForInlineStyle::ruleSourceData): * page/animation/AnimationController.cpp: * rendering/style/RenderStyle.cpp: * svg/SVGAnimateElementBase.cpp: * svg/SVGAnimationElement.cpp: * svg/SVGElement.cpp: 2016-12-10 Konstantin Tokarev <annulen@yandex.ru> [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them https://bugs.webkit.org/show_bug.cgi?id=165686 Reviewed by Michael Catanzaro. This change reduces duplication of include path lists between modules, and reduces future need for fixes like r209605 (broken build because of WebCore header suddenly becoming used in WebKit2). No new tests needed. * CMakeLists.txt: * PlatformEfl.cmake: * PlatformGTK.cmake: * PlatformMac.cmake: * PlatformWinCairo.cmake: 2016-12-10 Ryosuke Niwa <rniwa@webkit.org> Replace isUnclosedNode by isClosedShadowHidden https://bugs.webkit.org/show_bug.cgi?id=165722 Reviewed by Antti Koivisto. Replaced Node::isUnclosedNode by Node::isClosedShadowHidden and negated the semantics as done in the spec: https://dom.spec.whatwg.org/#concept-closed-shadow-hidden https://github.com/whatwg/dom/pull/306 Also added a version which follows the spec text for a debug assertion. No new tests since this has no behavioral change. * dom/EventContext.h: (WebCore::EventContext::isUnreachableNode): * dom/EventPath.cpp: (WebCore::EventPath::computePathUnclosedToTarget): (WebCore::RelatedNodeRetargeter::checkConsistency): * dom/Node.cpp: (WebCore::isClosedShadowHiddenUsingSpecDefinition): Added to assert our implementation matches the spec text. (WebCore::Node::isClosedShadowHidden): Renamed from Node::isUnclosedNode and negated the return value. * dom/Node.h: 2016-12-10 Antti Koivisto <antti@apple.com> CrashTracer: com.apple.WebKit.WebContent.Development at com.apple.WebCore: WTF::match_constness<WebCore::CSSValue, WebCore::CSSContentDistributionValue>::type& WTF::downcast<WebCore::CSSContentDistributionValue, WebCore::CSSValue> + 65 https://bugs.webkit.org/show_bug.cgi?id=165652 rdar://problem/28465278 Reviewed by Darin Adler. No, test don't know how to get here. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertContentAlignmentData): Add type checks. 2016-12-10 Jiewen Tan <jiewen_tan@apple.com> [WebCrypto] RSA algorithms should allow importing keys without usages https://bugs.webkit.org/show_bug.cgi?id=165680 <rdar://problem/29601354> Reviewed by Brent Fulgham. Tests: crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages.html crypto/subtle/rsa-oaep-import-spki-key-empty-usages.html crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages.html crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages.html crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages.html * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): 2016-12-10 Frederic Wang <fred.wang@free.fr> Add STIX Two Math to the list of math fonts in mathml.css https://bugs.webkit.org/show_bug.cgi?id=165676 Reviewed by Darin Adler. No new tests, this is just changing default style. * css/mathml.css: (math): 2016-12-09 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Implement ReadableByteStreamController desiredSize https://bugs.webkit.org/show_bug.cgi?id=165599 Reviewed by Darin Adler. Implemented ReadableByteStreamController attribute desiredSize. Added test to check desiredSize value. * Modules/streams/ReadableByteStreamController.js: (desiredSize): * Modules/streams/ReadableByteStreamInternals.js: (readableByteStreamControllerGetDesiredSize): 2016-12-09 Ryosuke Niwa <rniwa@webkit.org> document.pointerLockElement exposes a node inside a shadow tree https://bugs.webkit.org/show_bug.cgi?id=165702 Reviewed by Simon Fraser. Expose pointerLockElement on ShadowRoot as spec'ed (DocumentOrShadowRoot): https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin Use ancestorElementInThisScope to find the correct node in pointerLockElement. Tests: fast/shadow-dom/pointerlockelement-in-shadow-tree.html fast/shadow-dom/pointerlockelement-in-slot.html * dom/Document.cpp: (WebCore::Document::pointerLockElement): Moved to TreeScope. * dom/Document.h: * dom/Document.idl: Moved ointerLockElement to DocumentOrShadowRoot.idl. * dom/DocumentOrShadowRoot.idl: Ditto. * dom/TreeScope.cpp: (WebCore::TreeScope::focusedElementInScope): Use documentScope instead of acessing it via m_rootNode. (WebCore::TreeScope::pointerLockElement): Moved from Document. * dom/TreeScope.h: 2016-12-09 Daniel Bates <dabates@apple.com> Add reflected nonce attribute to HTML Link element IDL https://bugs.webkit.org/show_bug.cgi?id=165709 Reviewed by Ryosuke Niwa. Add the reflected nonce attribute to the HTML Link element IDL definition as per the HTML standard <https://html.spec.whatwg.org/multipage/semantics.html#the-link-element> (9 December 2016). Test: fast/dom/nonce-attribute-reflection.html * html/HTMLLinkElement.idl: 2016-12-09 Eric Carlson <eric.carlson@apple.com> Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag https://bugs.webkit.org/show_bug.cgi?id=165251 Reviewed by Dean Jackson. Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com> No new tests, covered by existing tests. * Modules/mediastream/MediaStreamEvent.idl: Add "EnabledAtRuntime". * Modules/mediastream/NavigatorMediaDevices.idl: Ditto. * Modules/mediastream/NavigatorUserMedia.idl: Ditto. * Modules/mediastream/RTCDTMFToneChangeEvent.idl: Ditto. * Modules/mediastream/RTCIceCandidate.idl: Ditto. * Modules/mediastream/RTCPeerConnection.idl: Ditto. * Modules/mediastream/RTCRtpReceiver.idl: Ditto. * Modules/mediastream/RTCRtpSender.idl: Ditto. * Modules/mediastream/RTCRtpTransceiver.idl: Ditto. * Modules/mediastream/RTCSessionDescription.idl: Ditto. * Modules/mediastream/RTCTrackEvent.idl: Ditto. * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): Set m_isMediaStreamEnabled in the constructor instead of in reset() because the later is called by the Internals constructor, making it impossible to override the runtime flag from WTR or DRT. (WebCore::RuntimeEnabledFeatures::reset): Don't set m_isMediaStreamEnabled. * page/Settings.in: Add peerConnectionEnabled. 2016-12-09 Daniel Bates <dabates@apple.com> Remove QuickLook scheme from the list of secure schemes https://bugs.webkit.org/show_bug.cgi?id=165699 Reviewed by Andy Estes. Following r207155 we use a unique origin for QuickLook documents. Unique origins are not subject to mixed content restrictions. Prior to r207155 QuickLook documents used the origin from which they were served. We added the QuickLook scheme to the list of secure schemes as a workaround to avoid mixed content errors when loading subresources in a QuickLook document served over HTTPS. Now that we use a unique origin for QuickLook documents we no longer need this workaround. * platform/SchemeRegistry.cpp: (WebCore::secureSchemes): 2016-12-09 Brady Eidson <beidson@apple.com> Re-landing: Add _WKIconLoadingDelegate SPI. https://bugs.webkit.org/show_bug.cgi?id=164894 Reviewed by Alex Christensen. No new tests (Manual testing possible in MiniBrowser now, WKTR tests coming soon in https://bugs.webkit.org/show_bug.cgi?id=164895). With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>. WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load. For icons the app decides to load, WebKit will pass the data to the app without storing locally. * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::implicitClose): * html/LinkIconCollector.cpp: (WebCore::iconSize): (WebCore::compareIcons): * html/LinkIconCollector.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startIconLoading): (WebCore::DocumentLoader::didGetLoadDecisionForIcon): (WebCore::DocumentLoader::finishedLoadingIcon): * loader/DocumentLoader.h: * loader/FrameLoaderClient.h: * loader/icon/IconLoader.cpp: (WebCore::IconLoader::IconLoader): (WebCore::IconLoader::startLoading): (WebCore::IconLoader::notifyFinished): * loader/icon/IconLoader.h: * platform/LinkIcon.h: Copied from Source/WebCore/html/LinkIconCollector.h. (WebCore::LinkIcon::encode): (WebCore::LinkIcon::decode): 2016-12-06 Jiewen Tan <jiewen_tan@apple.com> [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey https://bugs.webkit.org/show_bug.cgi?id=129978 <rdar://problem/21799829> Reviewed by Brent Fulgham. This is part 2 of Bug 129978. In this patch, it adds the PKCS8 format support for SubtleCrypto.importKey/exportKey. Currently support algorithms are RSAES-PKCS1-v1_5, RSASSA-PKCS1-v1_5 and RSA-OAEP. Tests: crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html crypto/subtle/rsa-oaep-import-pkcs8-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html crypto/workers/subtle/rsa-export-pkcs8-key.html crypto/workers/subtle/rsa-import-pkcs8-key.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::toKeyData): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): (WebCore::CryptoAlgorithmRSA_OAEP::exportKey): * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::importPkcs8): (WebCore::CryptoKeyRSA::exportPkcs8): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::importSpki): (WebCore::CryptoKeyRSA::importPkcs8): (WebCore::CryptoKeyRSA::exportPkcs8): 2016-12-09 Geoffrey Garen <ggaren@apple.com> Deploy OrdinalNumber in JSC::SourceCode https://bugs.webkit.org/show_bug.cgi?id=165687 Reviewed by Michael Saboff. Updated for interface changes. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateModule): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::startLine): 2016-12-09 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Some resources fetched via Fetch API do not have data https://bugs.webkit.org/show_bug.cgi?id=165230 <rdar://problem/29449220> Reviewed by Alex Christensen. Tests: http/tests/inspector/network/fetch-response-body.html http/tests/inspector/network/xhr-response-body.html * platform/network/ResourceRequestBase.h: Distinguish Fetch requests. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): Set the requester type as Fetch. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didReceiveResponse): * loader/DocumentThreadableLoader.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponseImpl): (WebCore::InspectorInstrumentation::didReceiveXHRResponseImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveXHRResponse): Deleted. * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveThreadableLoaderResponse): (WebCore::InspectorNetworkAgent::didFinishXHRLoading): (WebCore::InspectorNetworkAgent::didReceiveXHRResponse): Deleted. Add a generic way for a ThreadableLoader load to update the type of a network request. This will include both XHR and Fetch requests. * inspector/InspectorPageAgent.cpp: (WebCore::hasTextContent): (WebCore::createXHRTextDecoder): (WebCore::InspectorPageAgent::resourceTypeJson): (WebCore::InspectorPageAgent::cachedResourceType): (WebCore::InspectorPageAgent::createTextDecoder): (WebCore::textContentForCachedResource): * inspector/InspectorPageAgent.h: * inspector/NetworkResourcesData.cpp: (WebCore::createOtherResourceTextDecoder): Deleted. Share the logic that creates a Text Decoders for XHR with other non-buffered requests (like Fetch). This moves us to identical behavior for now. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::isSupportedJSONMIMEType): (WebCore::MIMETypeRegistry::isTextMIMEType): * platform/MIMETypeRegistry.h: Better detect different JSON content based on MIME Type. 2016-12-09 Ryosuke Niwa <rniwa@webkit.org> document.webkitFullscreenElement leaks elements inside a shadow tree https://bugs.webkit.org/show_bug.cgi?id=158471 Reviewed by Chris Dumez. Fixed the bug by calling the newly added ancestorElementInThisScope in webkitCurrentFullScreenElementForBindings and webkitFullscreenElementForBinding. The specification (https://fullscreen.spec.whatwg.org/#dom-document-fullscreenelement) uses "the result of retargeting fullscreen element" and returns null if the result is not in the same tree as the context object. This is equivalent to the algorithm implemented by ancestorElementInThisScope. Observe that the retargeting algorithm (https://dom.spec.whatwg.org/#retarget) finds the lowest common tree scope of the retargetee and the context object. There are two cases to consider. 1. The context object's tree scope is the lowest common tree scope: In this case, an ancestor shadow host or the retargetee itself is in this tree scope. It's sufficient traverse every shadow host to find the one that resides in the same tree scope as the context object. This is precisely what ancestorElementInThisScope does. 2. The context object's tree scope is not the lowest common tree scope: In this case, the context object is inside a shadow tree whose ancestor shadow host is in the lowest common tree scope. In this case, retargeting algorithm finds a node which is not in the same tree as the context object. Thus, the result is null. ancestorElementInThisScope traveres ancestor shadow hosts and returns null if no shadow host's tree scope matches that of the context object's tree scope. Thus, it would return null in this case as desired. Also renamed TreeScope::focusedElement to focusedElementInScope for clarity since Document which inherits from TreeScope also has a distinct member function named focusedElement called by TreeScope::focusedElement, and used ancestorElementInThisScope since it uses the same algorithm. Tests: fast/shadow-dom/activeElement-for-focused-element-in-another-shadow.html fast/shadow-dom/blur-on-shadow-host-with-focused-shadow-content.html fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html fast/shadow-dom/fullscreen-in-shadow-webkitCurrentFullScreenElement.html fast/shadow-dom/fullscreen-in-slot-fullscreenElement.html fast/shadow-dom/fullscreen-in-slot-webkitCurrentFullScreenElement.html * dom/Document.cpp: (WebCore::Document::removeFocusedNodeOfSubtree): (WebCore::Document::activeElement): * dom/Document.h: (WebCore::Document::webkitCurrentFullScreenElementForBindings): Added. (WebCore::Document::webkitFullscreenElementForBindings): Added. * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::blur): * dom/ShadowRoot.h: (WebCore::ShadowRoot::activeElement): * dom/TreeScope.cpp: (WebCore::TreeScope::ancestorNodeInThisScope): Renamed from ancestorInThisScope for clarity. (WebCore::TreeScope::ancestorElementInThisScope): (WebCore::TreeScope::focusedElementInScope): Renamed from focusedElement to disambiguate it from Document's focusedElement. * dom/TreeScope.h: * editing/VisibleSelection.cpp: (WebCore::adjustPositionForEnd): (WebCore::adjustPositionForStart): * editing/htmlediting.cpp: (WebCore::comparePositions): (WebCore::firstEditablePositionAfterPositionInRoot): (WebCore::lastEditablePositionBeforePositionInRoot): * page/DOMSelection.cpp: (WebCore::selectionShadowAncestor): (WebCore::DOMSelection::shadowAdjustedNode): (WebCore::DOMSelection::shadowAdjustedOffset): * rendering/HitTestResult.cpp: (WebCore::HitTestResult::addNodeToRectBasedTestResult): Added a FIXME here since this is clearly wrong for shadow trees created by author scripts. 2016-12-09 Geoffrey Garen <ggaren@apple.com> TextPosition and OrdinalNumber should be more like idiomatic numbers https://bugs.webkit.org/show_bug.cgi?id=165678 Reviewed by Filip Pizlo. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourcePosition): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::eventHandlerPosition): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::create): * dom/ScriptElement.h: * html/parser/HTMLTreeBuilder.cpp: (WebCore::uninitializedPositionValue1): * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo): Adopt default construtor. * xml/XMLErrors.cpp: (WebCore::XMLErrors::XMLErrors): (WebCore::XMLErrors::handleError): * xml/XMLErrors.h: Use std::optional instead of belowRangePosition() because in-band signaling is harder to reason about. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::textPosition): Adopt default constructor. 2016-12-09 Chris Dumez <cdumez@apple.com> [Cocoa] Validation message for required checkbox doesn’t conform the the Apple Style Guide https://bugs.webkit.org/show_bug.cgi?id=165661 Reviewed by Dan Bernstein. Update validation message as per Apple Style Guide. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::validationMessageValueMissingForCheckboxText): 2016-12-09 Zalan Bujtas <zalan@apple.com> ASSERTION FAILED: !beforeChild->isRubyRun() in WebCore::RenderRubyAsBlock::addChild https://bugs.webkit.org/show_bug.cgi?id=141433 <rdar://problem/27711351> Reviewed by Dean Jackson. Do not try to inject the list marker into a block ruby subtree. Have it as the sibling of the ruby instead (with an anonymous block wrapper ofc). Test: fast/ruby/assert-with-listitem-and-block-ruby.html * rendering/RenderListItem.cpp: (WebCore::getParentOfFirstLineBox): 2016-12-09 Antoine Quint <graouts@apple.com> [Modern Media Controls] Implement the pageScaleFactor property https://bugs.webkit.org/show_bug.cgi?id=165660 Reviewed by Dean Jackson. We implement the pageScaleFactor property on MediaController. This property is set by the HTMLMediaElement when the page scale factor changes, and we only choose to handle it on iOS by setting controlsDependOnPageScaleFactor to true on the MediaControlsHost. To do so, we now size the media controls by multiplying the layout size of the media by the page scale factor, and apply an inverse CSS zoom on the media controls themselves. Test: media/modern-media-controls/media-controller/media-controller-scale-factor.html * Modules/modern-media-controls/controls/media-controls.css: (.media-controls-container,): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.prototype.get scaleFactor): (MediaControls.prototype.set scaleFactor): (MediaControls.prototype.commitProperty): * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype.set pageScaleFactor): (MediaController.prototype._updateControlsSize): * html/HTMLMediaElement.cpp: (WebCore::controllerJSValue): (WebCore::HTMLMediaElement::setControllerJSProperty): We no longer hit a JSC assertion when trying to set the pageScaleFactor property before the JS controller was actually created. 2016-12-09 Daniel Bates <dabates@apple.com> Attempt to fix the Mac CMake build following <http://trac.webkit.org/changeset/209549> (https://bugs.webkit.org/show_bug.cgi?id=165572) Add directory html/canvas to the list of forwarding headers directories so that the Legacy WebKit Objective-C DOM binding DOMHTMLCanvasElement.mm can ultimately include header WebGLContextAttributes.h. * PlatformMac.cmake: 2016-12-09 Brady Eidson <beidson@apple.com> LinkIconCollector refactoring. https://bugs.webkit.org/show_bug.cgi?id=165657 Reviewed by Dean Jackson. No new tests (Refactor, no behavior change) * WebCore.xcodeproj/project.pbxproj: * html/LinkIconCollector.cpp: (WebCore::iconSize): (WebCore::compareIcons): * html/LinkIconCollector.h: * platform/LinkIcon.h: Move outside of LinkIconCollector for future expandability. 2016-12-09 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r209574. This change broke the Windows build. Reverted changeset: "[WebIDL] Remove custom bindings for Geolocation" https://bugs.webkit.org/show_bug.cgi?id=165625 http://trac.webkit.org/changeset/209574 2016-12-09 Ryosuke Niwa <rniwa@webkit.org> Custom Elements from a different document are not customized when created with innerHTML https://bugs.webkit.org/show_bug.cgi?id=165617 Reviewed by Antti Koivisto. The bug was caused by a superflous null check on window in createHTMLElementOrFindCustomElementInterface. Removed the nullcheck to fix the bug. Test: fast/custom-elements/adopting-from-frameless-document.html * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): 2016-12-09 Daniel Bates <dabates@apple.com> [CSP] Policy of window opener not applied to about:blank window https://bugs.webkit.org/show_bug.cgi?id=165531 <rdar://problem/29426639> Reviewed by Brent Fulgham. Fixes an issue where the content security policy of the opener document was not applied to an about:blank window. An about:blank window inherits its security origin from its opener document. It should also copy (inherit) the ContentSecurityPolicy from its opener document. When copying the ContentSecurityPolicy state from the opener document to the about:blank document we must take care to avoid copying any upgrade-insecure-request directive because new windows should not inherit it by definition. With respect to upgrade-insecure-requests, new windows should only inherit the insecure navigation set from their opener document. Test: http/tests/security/contentSecurityPolicy/image-blocked-in-about-blank-window.html * dom/Document.cpp: (WebCore::Document::initContentSecurityPolicy): Copy the ContentSecurityPolicy state from the owner document to this document when it inherits its security origin from its owner. An about:blank window is one example of a document that inherits its security origin from its owner. * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Call ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom() to copy the upgrade insecure requests state from the owner document to the worker now that ContentSecurityPolicy::copyStateFrom() no longer does this. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::copyStateFrom): Do not copy the upgrade insecure request state. Callers are now responsible for calling ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom() to copy this state. * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::parse): Ignore directive upgrade-insecure-requests when inheriting ContentSecurityPolicy state as this directive as the Upgrade Insecure Requests feature has its own inheritance semantics that differ from the semantics of copying a ContentSecurityPolicy object. * xml/XSLTProcessor.cpp: (WebCore::XSLTProcessor::createDocumentFromSource): Call ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom() to copy the upgrade insecure requests state from the original document to the transformed document now that ContentSecurityPolicy::copyStateFrom() no longer does this. 2016-12-09 Antoine Quint <graouts@apple.com> [Modern Media Controls] Remaining time label first appears way to the left https://bugs.webkit.org/show_bug.cgi?id=165637 Reviewed by Dean Jackson. We would sometimes see the remaining time label be laid out in an incorrect position when a video would start playing. This happened because the time label was being committed from a previous value before, in the same frame, we would call the layout() function of MacOSInlineMediaControls. This would set the newly computed location for the remaining time label, but because we would reset the list of dirty properties after calling all layout functions, the new value set in MacOSInlineMediaControls.layout() would be disregarded and the wrong, committed value would persist until it was reset in a much later frame. We now correctly clear the list of dirty nodes before laying them out, giving all nodes a chance to become dirty again during layout, and updated again in the next frame. Test: media/modern-media-controls/layout-node/node-made-dirty-during-layout.html * Modules/modern-media-controls/controls/layout-node.js: (performScheduledLayout): 2016-12-09 Per Arne Vollan <pvollan@apple.com> Fix compile errors on Windows when building with .proj files. Unreviewed build fix. Fix include paths. * platform/graphics/win/IntPointWin.cpp: * platform/graphics/win/IntRectWin.cpp: * platform/graphics/win/IntSizeWin.cpp: 2016-12-09 Csaba Osztrogonác <ossy@webkit.org> Unreviewed buildfix after r209570. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::addBuiltinGlobals): 2016-12-01 Sergio Villar Senin <svillar@igalia.com> [css-grid] Pass Grid as argument to items' placement methods https://bugs.webkit.org/show_bug.cgi?id=165250 Reviewed by Darin Adler. In order to constify computeIntrinsicLogicalWidths() it is required to constify placeItemsOnGrid() first, which is the base method of the grid items' positioning logic. The first step is to constify all the methods invoked by the latter, which basically means to pass the Grid as argument to all of them instead of directly using the m_grid attribute from RenderGrid. As this is an intermediate step, a new const_cast<> was required in the intrinsic size computation. However it will be promptly removed after the const-ification of placeItemsOnGrid(). After this, only the methods used by the track sizing algorithm will directly access m_grid. All those would get a reference to the Grid via GridSizingData, but that's a matter of a follow up patch. Apart from that, m_gridIsDirty was removed because it was always too confusing. It was replaced by Grid's m_needsItemsPlacement which is much more concise. The clearGrid() call was indeed only forcing a new placement of the grid items. No new tests as this is a refactoring. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): New method to flag the Grid whenever grid items' placement algorithm needs to be run. (WebCore::RenderGrid::canPerformSimplifiedLayout): (WebCore::RenderGrid::layoutBlock): (WebCore::RenderGrid::computeIntrinsicLogicalWidths): (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): (WebCore::RenderGrid::placeItemsOnGrid): (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): Constified. Got Grid as argument. (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid): Ditto. (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid): Ditto. (WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid): Ditto. (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): Ditto. (WebCore::RenderGrid::clearGrid): (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): (WebCore::RenderGrid::numTracks): * rendering/RenderGrid.h: 2016-12-09 Gavin Barraclough <barraclough@apple.com> Revert - Add _WKIconLoadingDelegate SPI https://bugs.webkit.org/show_bug.cgi?id=164894 Unreviewed rollout due to performance regression. * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::implicitClose): * html/LinkIconCollector.cpp: (WebCore::iconSize): (WebCore::compareIcons): * html/LinkIconCollector.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startIconLoading): Deleted. (WebCore::DocumentLoader::didGetLoadDecisionForIcon): Deleted. (WebCore::DocumentLoader::finishedLoadingIcon): Deleted. * loader/DocumentLoader.h: * loader/FrameLoaderClient.h: * loader/icon/IconLoader.cpp: (WebCore::IconLoader::IconLoader): (WebCore::IconLoader::startLoading): (WebCore::IconLoader::notifyFinished): * loader/icon/IconLoader.h: * platform/LinkIcon.h: Removed. 2016-12-08 Jiewen Tan <jiewen_tan@apple.com> [WebCrypto] Remove NoInterfaceObject attribute from SubtleCrypto Interface https://bugs.webkit.org/show_bug.cgi?id=165629 <rdar://problem/29586203> Reviewed by Chris Dumez. Covered by existing tests. * crypto/SubtleCrypto.idl: 2016-12-08 Keith Rollin <krollin@apple.com> FileHandle::printf doesn't build on Windows https://bugs.webkit.org/show_bug.cgi?id=165642 Reviewed by Ryosuke Niwa. Fix the build -- vasprintf does not exist on Windows, so make FileHandle::printf a no-op on that platform. No new tests -- affected facility is currently only used in testing code and is not user reachable. * platform/FileHandle.cpp: (WebCore::FileHandle::printf): 2016-12-08 Antoine Quint <graouts@apple.com> [Modern Media Controls] Exiting fullscreen with paused media shows the start button https://bugs.webkit.org/show_bug.cgi?id=165640 Reviewed by Dean Jackson. Like all supporting objects, the StartSupport instance gets recreated when creating controls for new layout traits, which happens when going from fullscreen to inline. Due to this, the "_isPlayed" property is not longer set to true, even if the media has played prior to being paused in fullscreen. We now also check the media's played range to identify whether media has been played. * Modules/modern-media-controls/media/start-support.js: (StartSupport.prototype._shouldShowStartButton): (StartSupport): 2016-12-08 Myles C. Maxfield <mmaxfield@apple.com> ASSERTION FAILED: locale in WebCore::lastHyphenLocation https://bugs.webkit.org/show_bug.cgi?id=164182 Reviewed by Zalan Bujtas. Our hyphenation code assumes the locale is in a small set of known locales. However, web content can put whatever string it wants in the locale field. Test: fast/text/hyphenation-unknown-locale.html * platform/text/cf/HyphenationCF.cpp: (WebCore::lastHyphenLocation): * rendering/RenderText.cpp: (WebCore::maxWordFragmentWidth): When computing the minimum preferred width of an element, we want to know the size of the widest nonbreakable unit. When hyphenation is enabled, we have to measure the width of each fragment of each word (where "fragment" is determined by a substring between two successive hyphenation points, appended with a hyphen character). A hyphenation point at string offset 0 is irrelevant for this purpose, because it would lead to an empty fragment. Therefore, skip this situation. 2016-12-08 David Kilzer <ddkilzer@apple.com> Always check the return value of pthread_key_create() <https://webkit.org/b/165274> Reviewed by Darin Adler. * platform/ios/wak/WebCoreThread.mm: (InitThreadContextKey): Call CRASH() if pthread_key_create() returns an error. The error code will be stored in a register available in a crash log, so no need to log the value explicitly. 2016-12-08 Alex Christensen <achristensen@webkit.org> Reduce PassRefPtr use in platform/graphics https://bugs.webkit.org/show_bug.cgi?id=165636 Reviewed by Dean Jackson. No change in behavior. * platform/graphics/GraphicsContext3D.h: * platform/graphics/mac/DisplayRefreshMonitorMac.h: (WebCore::DisplayRefreshMonitorMac::create): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::createForCurrentGLContext): (WebCore::GraphicsContext3D::paintRenderingResultsToImageData): 2016-12-08 Keith Rollin <krollin@apple.com> Move FileHandle to WebCore FileHandle.h https://bugs.webkit.org/show_bug.cgi?id=165562 Reviewed by Alex Christensen. Add FileHandle, a small wrapper around FileSystem facilities to manage the lifetime of an open file and give the facilities a C++ interface. No new tests -- affected facility is currently only used in testing code and is not user reachable. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * platform/FileHandle.cpp: Added. (WebCore::FileHandle::FileHandle): (WebCore::FileHandle::~FileHandle): (WebCore::FileHandle::operator=): (WebCore::FileHandle::operator bool): (WebCore::FileHandle::open): (WebCore::FileHandle::read): (WebCore::FileHandle::write): (WebCore::FileHandle::printf): (WebCore::FileHandle::close): * platform/FileHandle.h: Added. 2016-12-07 Ryosuke Niwa <rniwa@webkit.org> ASSERTION FAILED: m_items.isEmpty() in CustomElementReactionQueue destructor https://bugs.webkit.org/show_bug.cgi?id=162029 <rdar://problem/28945851> Reviewed by Chris Dumez. The bug was caused by Document::removedLastRef enqueuing disconnectedCallback during a tear down. Don't enqueue a disconnectedCallback while a document is getting torn down since that should not be observable to author scripts. The connected, adopted, and attributeChanged callbacks are immune from this problem since they don't happen during a document destruction. Note that this was also the case prior to this patch since the disconnectedCallback would have been added to the current CustomElementReactionQueue which will be destructed without invoking callbacks (or hit a release assertion added in r208785 and r209426 for now). Tests: fast/custom-elements/disconnected-callback-in-detached-iframe.html fast/custom-elements/element-queue-during-document-destruction.html * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Added an assertion that document's refCount hasn't reached zero yet. (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Fixed the bug. (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Added the same assertion. (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto. 2016-12-08 Daniel Bates <dabates@apple.com> Add Strict Mixed Content Checking and Upgrade Insecure Requests to WebKit Feature Status dashboard https://bugs.webkit.org/show_bug.cgi?id=165635 Rubber-stamped by Ryosuke Niwa. * features.json: 2016-12-08 Daniel Bates <dabates@apple.com> Implement Strict Mixed Content Checking https://bugs.webkit.org/show_bug.cgi?id=165438 <rdar://problem/26103867> Reviewed by Brent Fulgham and Andy Estes. Add support for the CSP directive block-all-mixed-content to enable strict mixed content checking as per <https://www.w3.org/TR/2016/CR-mixed-content-20160802/#strict-checking> (2 August 2016). Currently WebKit only blocks blockable content as such content can contaminate the security origin that loaded it. Optionally-blockable content, including images, would be allowed to load as mixed content. When strict mixed content checking is enabled all mixed content is blocked. That is, both blockable and optionally-blockable content will be blocked. A web site can opt into strict mixed content checking by adding the directive block-all-mixed-content to their content security policy. Tests: http/tests/security/contentSecurityPolicy/block-all-mixed-content/data-url-iframe-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/duplicate-directive.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-in-iframe-report-only.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-blob-url-iframe-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-iframe-with-enforced-and-report-policies.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-iframe-with-inherited-policy.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-javascript-url-iframe-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-xslt-document-in-iframe-with-inherited-policy.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-plugin-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-plugin-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-script-in-iframe-with-inherited-policy.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-script-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-script-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-asynchronous-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-synchronous-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-xhr-synchronous-in-main-frame.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/secure-image-after-upgrade-in-iframe.html http/tests/security/contentSecurityPolicy/block-all-mixed-content/secure-image-after-upgrade-redirect-in-iframe.html * dom/Document.cpp: (WebCore::Document::initSecurityContext): Inherit strict mixed content checking mode from parent document. * dom/SecurityContext.h: (WebCore::SecurityContext::isStrictMixedContentMode): Added. (WebCore::SecurityContext::setStrictMixedContentMode): Added. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Check mixed content policy with respect to the current frame. The document in the current frame may have opted into strict mixed content checking or inherited it from its parent document. * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::begin): Inherit the strict mixed content checking mode from the owner document when loading a JavaScript URL in a frame (e.g. <iframe src="javascript:...">) because such URLs inherit the security origin of their parent document. * loader/MixedContentChecker.cpp: (WebCore::MixedContentChecker::canDisplayInsecureContent): Check the content security policy of the document and the strict mixed content checking mode bit on the document (in that order) to determine if we are in strict mode. Block display of insecure content when in strict mode. Modified to take enum AlwaysDisplayInNonStrictMode (defaults to AlwaysDisplayInNonStrictMode::No) as to whether to allow our current relaxed behavior of displaying insecure content in non-strict mode. (WebCore::MixedContentChecker::canRunInsecureContent): Check the content security policy of the document and the strict mixed content checking mode bit on the document (in that order) to determine if we are in strict mode. Block running of insecure content when in strict mode. * loader/MixedContentChecker.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::checkInsecureContent): Always check mixed content policy with respect to the current frame. The document in the current frame may have opted into strict mixed content checking or inherited it from its parent document. Also renamed a local variable f to frame to better describe its purpose. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowRunningOrDisplayingInsecureContent): Added. Iterate through all the policies and report violations with respect to policies that have directive block-all-mixed-content. (WebCore::ContentSecurityPolicy::didReceiveHeader): Move logic to set eval() error message from here... (WebCore::ContentSecurityPolicy::applyPolicyToScriptExecutionContext): ...to here so that we only perform it once we are ready to apply the CSP policy to the script execution context. Additionally, enable strict mixed content checking on the script execution context if applicable. (WebCore::ContentSecurityPolicy::reportViolation): Added overrides that take a string and a directive list object (ContentSecurityPolicyDirectiveList) for the effective violated directive and its associated directive list, respectively. We make use of these overrides so as to support reporting block-all-mixed-content violations, which are not implemented using a ContentSecurityPolicyDirective object as it seemed sufficient to implement it as a boolean on ContentSecurityPolicyDirectiveList. * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::setBlockAllMixedContentEnabled): Added. (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Parse the directive block-all-mixed-content. * page/csp/ContentSecurityPolicyDirectiveList.h: (WebCore::ContentSecurityPolicyDirectiveList::hasBlockAllMixedContentDirective): Added. * page/csp/ContentSecurityPolicyDirectiveNames.cpp: * page/csp/ContentSecurityPolicyDirectiveNames.h: Add constant for "block-all-mixed-content". 2016-12-08 Sam Weinig <sam@webkit.org> [WebIDL] Remove custom bindings for Geolocation https://bugs.webkit.org/show_bug.cgi?id=165625 Reviewed by Alex Christensen. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: Add/remove files. * Modules/geolocation/GeoNotifier.cpp: (WebCore::GeoNotifier::GeoNotifier): (WebCore::GeoNotifier::hasZeroTimeout): (WebCore::GeoNotifier::startTimerIfNeeded): * Modules/geolocation/GeoNotifier.h: (WebCore::GeoNotifier::create): (WebCore::GeoNotifier::options): Update to store PositionOptions as a value, and pass the PositionCallback as a Ref, rather than a RefPtr, since it is not optional. * Modules/geolocation/Geolocation.cpp: (WebCore::createGeoposition): Use auto, to get the good type for Coordinates (Ref). (WebCore::Geolocation::getCurrentPosition): (WebCore::Geolocation::watchPosition): (WebCore::Geolocation::haveSuitableCachedPosition): (WebCore::Geolocation::startUpdating): * Modules/geolocation/Geolocation.h: Update to pass PositionOptions itself now that it is a plain struct. * Modules/geolocation/Geolocation.idl: Remove [Custom] extended attribute and add FIXME about nullable annotation. * Modules/geolocation/Geoposition.h: Pass/store Coordinates as a Ref. * Modules/geolocation/PositionOptions.h: Convert to be a simple struct. * Modules/geolocation/PositionOptions.idl: Added. * bindings/js/JSGeolocationCustom.cpp: Removed. 2016-12-08 Alex Christensen <achristensen@webkit.org> REGRESSION (URL parser): Relative URLs aren’t resolved correctly when the base URL is an applewebdata: URL https://bugs.webkit.org/show_bug.cgi?id=165621 Reviewed by Dan Bernstein. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): URLs with nonspecial schemes and no slash after the host get no slash as the path to maintain compatibility with all browsers. This was proposed to the URL spec in https://github.com/whatwg/url/issues/148 When such as URL is used as a base URL with a relative path, in order to maintain compatibility with URL::parse we need to prepend a slash to the path. For completeness I added tests with a relative path, a relative query, a relative fragment, and a relative empty string, and because the fate of the spec is unclear in this case, I decided to maintain compatibility with URL::parse in all these cases. 2016-12-06 Filip Pizlo <fpizlo@apple.com> Concurrent GC should be stable enough to land enabled on X86_64 https://bugs.webkit.org/show_bug.cgi?id=164990 Reviewed by Geoffrey Garen. Made WebCore down with concurrent marking by adding some locking and adapting to some new API. This has new test modes in run-sjc-stress-tests. Also, the way that LayoutTests run is already a fantastic GC test. * ForwardingHeaders/heap/DeleteAllCodeEffort.h: Added. * ForwardingHeaders/heap/LockDuringMarking.h: Added. * bindings/js/GCController.cpp: (WebCore::GCController::deleteAllCode): (WebCore::GCController::deleteAllLinkedCode): * bindings/js/GCController.h: * bindings/js/JSDOMBinding.cpp: (WebCore::getCachedDOMStructure): (WebCore::cacheDOMStructure): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::addBuiltinGlobals): (WebCore::JSDOMGlobalObject::visitChildren): * bindings/js/JSDOMGlobalObject.h: (WebCore::getDOMConstructor): * bindings/js/JSDOMPromise.cpp: (WebCore::DeferredPromise::DeferredPromise): (WebCore::DeferredPromise::clear): * bindings/js/JSXPathResultCustom.cpp: (WebCore::JSXPathResult::visitAdditionalChildren): * dom/EventListenerMap.cpp: (WebCore::EventListenerMap::clear): (WebCore::EventListenerMap::replace): (WebCore::EventListenerMap::add): (WebCore::EventListenerMap::remove): (WebCore::EventListenerMap::find): (WebCore::EventListenerMap::removeFirstEventListenerCreatedFromMarkup): (WebCore::EventListenerMap::copyEventListenersNotCreatedFromMarkupToTarget): (WebCore::EventListenerIterator::EventListenerIterator): * dom/EventListenerMap.h: (WebCore::EventListenerMap::lock): * dom/EventTarget.cpp: (WebCore::EventTarget::visitJSEventListeners): * dom/EventTarget.h: (WebCore::EventTarget::visitJSEventListeners): Deleted. * dom/Node.cpp: (WebCore::Node::eventTargetDataConcurrently): (WebCore::Node::ensureEventTargetData): (WebCore::Node::clearEventTargetData): * dom/Node.h: * page/MemoryRelease.cpp: (WebCore::releaseCriticalMemory): * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation): (WebCore::registerMemoryReleaseNotifyCallbacks): 2016-12-08 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add strict checking for right parens to selector functions like :matches, :not etc. https://bugs.webkit.org/show_bug.cgi?id=165624 Reviewed by Dean Jackson. Unskipped fast/selectors/invalid-functional-pseudo-class.html. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): Bail if we don't actually consume a right parenthesis. 2016-12-08 Jeremy Jones <jeremyj@apple.com> Exit fullscreen on escape key down, not up. https://bugs.webkit.org/show_bug.cgi?id=165618 rdar://problem/29581688 This problem was introduced by https://bugs.webkit.org/show_bug.cgi?id=165416 The fix to only exit fullscreen on key down, not key up. Reviewed by Jer Noble. * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): 2016-12-08 Dave Hyatt <hyatt@apple.com> [CSS Parser] Unskip background parsing tests https://bugs.webkit.org/show_bug.cgi?id=165619 Reviewed by Zalan Bujtas. Change background-position so that the origin being set is tracked on a per-x/y basis instead of as a single boolean. The single boolean caused lousy computed style dumping, since we would switch into verbose mode for both x and y, even if only one of them had a pair set for it. * css/CSSComputedStyleDeclaration.cpp: (WebCore::createPositionListForLayer): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertPositionComponent): * rendering/style/FillLayer.cpp: (WebCore::FillLayer::FillLayer): (WebCore::FillLayer::operator=): (WebCore::FillLayer::fillUnsetProperties): * rendering/style/FillLayer.h: (WebCore::FillLayer::isBackgroundXOriginSet): (WebCore::FillLayer::isBackgroundYOriginSet): (WebCore::FillLayer::setBackgroundXOrigin): (WebCore::FillLayer::setBackgroundYOrigin): (WebCore::FillLayer::clearXPosition): (WebCore::FillLayer::clearYPosition): (WebCore::FillLayer::isBackgroundOriginSet): Deleted. 2016-12-08 Jeremy Jones <jeremyj@apple.com> pointer lock should exit when a js alert is shown https://bugs.webkit.org/show_bug.cgi?id=165423 rdar://problem/29430803 Reviewed by Jer Noble. Test: pointer-lock/lock-lost-on-alert.html * page/DOMWindow.cpp: (WebCore::DOMWindow::alert): (WebCore::DOMWindow::confirm): (WebCore::DOMWindow::prompt): 2016-12-07 Sam Weinig <sam@webkit.org> [WebIDL] WebGLContextAttributes should be a dictionary https://bugs.webkit.org/show_bug.cgi?id=165572 Reviewed by Dean Jackson. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: Remove unused files. * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::JSHTMLCanvasElement::getContext): (WebCore::attributesFor3DContext): Deleted. Re-work getContext to use JSDOMConvert and use the WebGLContextAttributes dictionary. * bindings/scripts/CodeGeneratorJS.pm: (NativeToJSValueDOMConvertNeedsState): (NativeToJSValueDOMConvertNeedsGlobalObject): Add missing inclusion of dictionaries. * html/HTMLCanvasElement.cpp: (WebCore::maxActivePixelMemory): (WebCore::HTMLCanvasElement::getContext): (WebCore::HTMLCanvasElement::is2dType): (WebCore::HTMLCanvasElement::getContext2d): (WebCore::shouldEnableWebGL): (WebCore::HTMLCanvasElement::is3dType): (WebCore::HTMLCanvasElement::getContextWebGL): * html/HTMLCanvasElement.h: Refactor context creation of 2d and WebGL contexts into their own functions. Make the WebGL one take a WebGLContextAttributes struct. * html/HTMLCanvasElement.idl: No functionality change. Make IDL match the latest spec. * html/canvas/CanvasContextAttributes.cpp: Removed. * html/canvas/CanvasContextAttributes.h: Removed. Remove unneeded base class. * html/canvas/WebGLContextAttributes.cpp: Removed. * html/canvas/WebGLContextAttributes.h: Instead of a class, we can use a type alias of GraphicsContext3D::Attributes for WebGLContextAttributes. * html/canvas/WebGLContextAttributes.idl: Convert to a dictionary. * html/canvas/WebGL2RenderingContext.cpp: * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::clearIfComposited): (WebCore::WebGLRenderingContextBase::getContextAttributes): (WebCore::WebGLRenderingContextBase::applyStencilTest): * html/canvas/WebGLRenderingContextBase.h: Update to WebGLContextAttributes by value, since it is a simple struct now. Update getContextAttributes to return a std::optional<WebGLContextAttributes>. * html/canvas/WebGLRenderingContextBase.idl: Make getContextAttributes return a nullable WebGLContextAttributes, as per spec. * platform/graphics/GraphicsContext3D.h: Sort attributes into categories, one that match WebGLContextAttributes, and the remainder. 2016-12-08 Zalan Bujtas <zalan@apple.com> Do not create multicolumn context for certain type of renderers. https://bugs.webkit.org/show_bug.cgi?id=135601 <rdar://problem/27686300> Reviewed by David Hyatt. Certain type of renderers including forms should not initialize multicolumn context for their inner (shadow) content. It just does not makes sense and is inline with what other browsers do. Test: fast/multicol/no-multicol-for-textareas.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willCreateColumns): (WebCore::RenderBlockFlow::requiresColumns): * rendering/RenderBlockFlow.h: 2016-12-08 Dave Hyatt <hyatt@apple.com> [CSS Parser] REGRESSION: Values of 0 should not be allowed for -webkit-aspect-ratio https://bugs.webkit.org/show_bug.cgi?id=165607 Reviewed by Simon Fraser. Unskipped fast/css/aspect-ratio-parsing-tests.html. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWebkitAspectRatio): Don't allow 0 as either the left or right value of the ratio. 2016-12-08 Antti Koivisto <antti@apple.com> ::after and ::before don't work on :host https://bugs.webkit.org/show_bug.cgi?id=164675 <rdar://problem/29231874> Reviewed by Andreas Kling. We didn't allow combining :host with any other selectors. Pseudo elements should be allowed. Test: fast/shadow-dom/shadow-host-with-before-after.html * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::matchAuthorRules): Allow pseudo element matching. (WebCore::ElementRuleCollector::matchHostPseudoClassRules): Use the normal collectMatchingRulesForList path instead of a direct call to SelectorChecker::matchHostPseudoClass. This path supports pseudo elements. Pass the information that we are matching :host rules with m_isMatchingHostPseudoClass bit similarly to how this is done with slots. (WebCore::ElementRuleCollector::ruleMatches): * css/ElementRuleCollector.h: * css/RuleSet.cpp: Collect :host rules similarly to other rules. (WebCore::RuleSet::addRule): * css/SelectorChecker.cpp: Rename didMoveToShadowHost->mayMatchHostPseudoClass for clarity. (WebCore::SelectorChecker::match): Enable :host matching in the current context immediately if needed. (WebCore::SelectorChecker::matchHostPseudoClass): The check for illegal combinations with :host is now done in checkOne(). (WebCore::localContextForParent): (WebCore::SelectorChecker::checkOne): In context where :host matches nothing else can match, except pseudo elements. * css/SelectorChecker.h: 2016-12-08 Alex Christensen <achristensen@webkit.org> Fix CMake build. * PlatformMac.cmake: Add PerformanceLoggingCocoa.mm after r209181. 2016-12-08 Per Arne Vollan <pvollan@apple.com> [Win] Some versions of Cygwin Perl generate incorrect C++ code. https://bugs.webkit.org/show_bug.cgi?id=165524 rdar://problem/29508043 Reviewed by Daniel Bates. Perl strings with variables seems to be handled differently, depending on which version of Cygwin Perl you are running. To make sure they are handled identically, specify variables in strings as "${var}" instead of "$var". * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): 2016-12-08 Alex Christensen <achristensen@webkit.org> Fix EFL build after r209526 https://bugs.webkit.org/show_bug.cgi?id=165594 * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw): nullptr is being automatically converted to false everywhere but EFL. It should be false. This function returns a bool. 2016-12-07 Dave Hyatt <hyatt@apple.com> REGRESSION: font shorthand parsing is broken https://bugs.webkit.org/show_bug.cgi?id=165594 Reviewed by Zalan Bujtas. Unskipping fast/css/font-calculated-value.html. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontWeight): The new parser did not support calc() in the font-weight property. In order to support a positive integer, add new functions to consume and handle positive integers without making a CSSPrimitiveValue out of the number. These correspond to consumeNumberRaw but are limited to positive integers. (WebCore::CSSPropertyParser::consumeFont): The implicit bool was incorrectly set to true when properties were defined because releaseNonNull() cleared the variables being null checked. Add separate booleans to avoid this. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::CalcParser::consumePositiveIntegerRaw): (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw): * css/parser/CSSPropertyParserHelpers.h: Add the new helpers that consume positive integers without creating CSSPrimitiveValues out of them. 2016-12-07 Jeremy Jones <jeremyj@apple.com> Exit pointer lock when page goes into page cache. https://bugs.webkit.org/show_bug.cgi?id=165425 rdar://problem/29430834 Reviewed by Jer Noble. Test: pointer-lock/lock-lost-on-navigation.html Cancel pointer lock when page goes into page cache and add methods to Internals so it can be tested. * dom/Document.cpp: (WebCore::Document::setPageCacheState): * page/PointerLockController.h: * testing/Internals.cpp: (WebCore::Internals::pageHasPendingPointerLock): (WebCore::Internals::pageHasPointerLock): * testing/Internals.h: * testing/Internals.idl: 2016-12-07 Antoine Quint <graouts@apple.com> [Modern Media Controls] Tracks panel does not display in the right location in fullscreen and cannot be dismissed https://bugs.webkit.org/show_bug.cgi?id=165575 Reviewed by Dean Jackson. We position the tracks panel programmatically based on the current bounds of the fullscreen button in fullscreen. This allows for the tracks panel to be shown in the right spot even after dragging the controls bar. We also use the fullscreen media controls as the target for tracking "mousedown" events when the tracks panel is shown in a fullscreen presentation. Tests: media/modern-media-controls/tracks-support/tracks-support-show-panel-after-dragging-controls.html media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: (.media-controls.mac.fullscreen .scrubber): (.media-controls.mac.fullscreen .tracks-panel): Deleted. * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: (MacOSFullscreenMediaControls.prototype.showTracksPanel): * Modules/modern-media-controls/controls/tracks-panel.js: (TracksPanel.prototype.presentInParent): (TracksPanel.prototype.hide): (TracksPanel.prototype.get bottomY): (TracksPanel.prototype.set bottomY): (TracksPanel.prototype.commitProperty): (TracksPanel.prototype._mousedownTarget): 2016-12-07 Antoine Quint <graouts@apple.com> [Modern Media Controls] Use a small picture-in-picture button in fullscreen https://bugs.webkit.org/show_bug.cgi?id=165587 Reviewed by Dean Jackson. Use a newer, smaller asset for picture-in-picture in fullscreen. * Modules/modern-media-controls/controls/icon-service.js: * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@2x.png: Added. 2016-12-07 Dean Jackson <dino@apple.com> Remove runtime toggle for pointer-lock https://bugs.webkit.org/show_bug.cgi?id=165577 <rdar://problems/29566996> Reviewed by Jon Lee. Remove any runtime calls to check if pointer-lock is enabled. It's either compiled in or out. Covered by existing tests. * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setPointerLockEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::pointerLockEnabled): Deleted. * dom/Document.idl: * dom/Element.idl: * page/Page.h: * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): (WebCore::PointerLockController::requestPointerUnlock): (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible): 2016-12-07 John Wilander <wilander@apple.com> Allow commas in Accept, Accept-Language, and Content-Language request headers for simple CORS https://bugs.webkit.org/show_bug.cgi?id=165566 <rdar://problem/29560983> Reviewed by Alex Christensen. Updated the existing tests. * platform/network/HTTPParsers.cpp: (WebCore::isValidAcceptHeaderValue): Now also accepts ','. (WebCore::isValidLanguageHeaderValue): Ditto. 2016-12-07 Dave Hyatt <hyatt@apple.com> [CSS Parser] Stop skipping tests in the css3 LayoutTests subdirectory https://bugs.webkit.org/show_bug.cgi?id=165574 Reviewed by Dean Jackson. * css/CSSGroupingRule.cpp: (WebCore::CSSGroupingRule::insertRule): The old parser didn't support the creation of @namespace rules in the CSS OM, but the new parser does. We need to ensure that just like for @import rules, that the insertion of a @namespace rule inside a @supports rule is not allowed. This test passed in the old parser because the rule just didn't get created, but in the new parser, we need to add a check along with the @import rule check to ensure it isn't allowed. 2016-12-07 Antoine Quint <graouts@apple.com> [Modern Media Controls] Remove aspect ratio button https://bugs.webkit.org/show_bug.cgi?id=165571 Reviewed by Dean Jackson. Since we do not have a way to toggle letterboxing on an HTMLMediaElement, we remove the corresponding button in the media controls. * Modules/modern-media-controls/controls/aspect-ratio-button.js: Removed. * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: * Modules/modern-media-controls/js-files: 2016-12-07 Jeremy Jones <jeremyj@apple.com> One esc to exit fullscreen and pointer lock https://bugs.webkit.org/show_bug.cgi?id=165416 rdar://problem/29430711 Reviewed by Jer Noble. Test: pointer-lock/lock-lost-on-esc-in-fullscreen.html When handling escape, also exit fullscreen on escape. This also means that escape can exit fullscreen in TestRunner. * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): 2016-12-07 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] Drop translate phase in module loader https://bugs.webkit.org/show_bug.cgi?id=164861 Reviewed by Saam Barati. * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: 2016-12-07 Keith Rollin <krollin@apple.com> Network event record/replay https://bugs.webkit.org/show_bug.cgi?id=164527 <rdar://problem/29168157> Reviewed by Alex Christensen. Export parseURLEncodedForm. No new tests -- no functionality added, changed, or removed. * platform/URLParser.h: 2016-12-07 Dave Hyatt <hyatt@apple.com> [CSS Parser] Consolidate string/ident/url serialization functions https://bugs.webkit.org/show_bug.cgi?id=165552 Reviewed by Zalan Bujtas. Right now CSSParser has string, ident and url serialization functions called quoteCSStringIfNeeded (which actually serializes both strings and identifiers), as well as quoteCSSURLIfNeeded. CSSMarkup already has serialization functions that exist outside of the CSSParser and that handle serialization of strings, idents and URLs. This patch eliminates the CSSParser functions and consolidates all of the serialization to use CSSMarkup's functions. Note that we are not spec-compliant at all here, and so I had to amend the functions to support our non-spec-compliant serialization. The goal of this patch is consolidation and not to fix our broken serialization. Notable changes include parameterizing string serialization so that both single and double quotes are supported, since in the existing code we're sometimes spec-compliant (CSSSelectors) and sometimes not (CSSPrimitiveValue). We also overload CSS_STRING primitive value type and have it act as both a string and a custom identifier. This is lame, since the parser should have made two different types of objects instead, but since our parser doesn't do that yet, I added a serializeAsStringOrCustomIdent that preserves our old behavior of "quote the string only if needed." In this case what that really meant was "Try to guess that we were originally a custom ident and leave off quotes if so." This function will go away once we properly create CSSStringValues and CSSCustomIdentValues instead of turning the latter into strings. * css/CSSBasicShapes.cpp: (WebCore::buildPathString): * css/CSSImageValue.cpp: (WebCore::CSSImageValue::customCSSText): * css/CSSMarkup.cpp: (WebCore::isCSSTokenizerURL): (WebCore::serializeString): (WebCore::serializeURL): (WebCore::serializeAsStringOrCustomIdent): (WebCore::serializeURI): Deleted. * css/CSSMarkup.h: * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText): * css/parser/CSSParser.cpp: (WebCore::isCSSTokenizerIdent): Deleted. (WebCore::isCSSTokenizerURL): Deleted. (WebCore::quoteCSSStringInternal): Deleted. (WebCore::quoteCSSString): Deleted. (WebCore::quoteCSSStringIfNeeded): Deleted. (WebCore::quoteCSSURLIfNeeded): Deleted. * css/parser/CSSParser.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::mapLanguageAttributeToLocale): 2016-12-07 Dean Jackson <dino@apple.com> Expose internal API to detect media documents https://bugs.webkit.org/show_bug.cgi?id=165559 <rdar://problems/29564054> Reviewed by Antoine Quint. Expose via MediaControlsHost whether or not we're in a MediaDocument. Since MediaControlsHost is only exposed to our internal controls, it's not possible to test this directly. However, a subsequent test for media documents with audio-only content will cover this change. * Modules/mediacontrols/MediaControlsHost.cpp: Add isInMediaDocument and put const on various methods that should have it. (WebCore::MediaControlsHost::captionDisplayMode): (WebCore::MediaControlsHost::supportsFullscreen): (WebCore::MediaControlsHost::isVideoLayerInline): (WebCore::MediaControlsHost::isInMediaDocument): * Modules/mediacontrols/MediaControlsHost.h: * Modules/mediacontrols/MediaControlsHost.idl: Add isInMediaDocument. 2016-12-07 Zalan Bujtas <zalan@apple.com> ASSERTION FAILED: count >= 1 in WebCore::RenderMultiColumnSet::columnCount https://bugs.webkit.org/show_bug.cgi?id=136365 <rdar://problem/27686727> Reviewed by Simon Fraser. Margin value overflow ends up confusing the column count computing logic. Test: fast/multicol/assert-on-column-count-when-zoomed-in.html * css/StyleResolver.cpp: (WebCore::addIntrinsicMargins): 2016-12-07 Ryosuke Niwa <rniwa@webkit.org> document.caretRangeFromPoint doesn't retarget the resultant Range correctly. https://bugs.webkit.org/show_bug.cgi?id=165146 Reviewed by Sam Weinig. The bug was caused by caretRangeFromPoint not retargeting the resultant Range correctly. Namely, it's possible for RenderObject::positionForPoint to move across shadow boundary even if node was identically equal to ancestorInThisScope(node). Fixed the bug by directly retargeting the range's container node and its offset as done for elementFromPoint in r206795. Test: fast/shadow-dom/caret-range-from-point-in-shadow-tree.html * dom/Document.cpp: (WebCore::Document::caretRangeFromPoint): 2016-12-07 Antoine Quint <graouts@apple.com> [Modern Media Controls] Entering fullscreen and returning to inline shows fullscreen controls https://bugs.webkit.org/show_bug.cgi?id=165536 Reviewed by Tim Horton. We regressed when we implemented the fix for webkit.org/b/165494 and we started to rely solely on the "webkitpresentationmodechanged" event to identify presention mode changes. As it turns out, when the "webkitpresentationmodechanged" event is dispatched when exiting fullscreen and returning to the inline presentation mode, querying the "webkitPresentationMode" property says "inline" while "webkitDisplayingFullscreen" still returns true (raised as webkit.org/b/165538). We now use the "webkitPresentationMode" property when that property is supported and we're using the "webkitpresentationmodechanged" event, and we use the "webkitDisplayingFullscreen" property otherwise. Test: media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.get layoutTraits): 2016-12-07 Wenson Hsieh <wenson_hsieh@apple.com> Scroll position jumps to the origin when scrolling without momentum at the end of a scroll snapping container https://bugs.webkit.org/show_bug.cgi?id=165474 <rdar://problem/29534305> Reviewed by Simon Fraser. When initializing an AppKit _NSScrollingMomentumCalculator, if the initial and target positions are the same and the initial velocity is (0, 0), the momentum calculator will output (0, 0) as the animated scroll position when animating. This causes the scroll position to jump to the top left in some cases when scrolling in scroll snap containers. To fix this, we teach the ScrollingMomentumCalculatorMac to return an animation duration of 0 and an animated scroll position equal to the final scroll position when this is the case. Test: tiled-drawing/scrolling/scroll-snap/scrolling-jumps-to-top.html * page/scrolling/mac/ScrollingMomentumCalculatorMac.h: * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm: (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac): (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime): (WebCore::ScrollingMomentumCalculatorMac::animationDuration): 2016-12-07 Nan Wang <n_wang@apple.com> AX: menu type toolbar should be mapped correctly on Mac https://bugs.webkit.org/show_bug.cgi?id=165537 Reviewed by Chris Fleizach. The menu tag with a toolbar type should have the corresponding role. Test: accessibility/mac/menu-type-toolbar.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::determineAccessibilityRole): 2016-12-07 Wenson Hsieh <wenson_hsieh@apple.com> Add a new project for recording and playing back editing commands in editable web content https://bugs.webkit.org/show_bug.cgi?id=165114 <rdar://problem/29408135> Reviewed by Beth Dakin. Adds new scripts used to record and play back editing, as well as a new Xcode Copy files phase that pushes these scripts to the internal system directory when installing. See the Tools ChangeLog and individual comments below for more details. Covered by 3 new unit tests in the EditingHistory project. * InternalScripts/DumpEditingHistory.js: Added. (beginProcessingTopLevelUpdate): (endProcessingTopLevelUpdate): (appendDOMUpdatesFromRecords): (appendSelectionUpdateIfNecessary): Adds new entries into the top-level list of DOM updates captured when editing. Respectively, these are input events and selection changes. (EditingHistory.getEditingHistoryAsJSONString): * InternalScripts/EditingHistoryUtil.js: Added. (prototype._scramble): (prototype.applyToText): (prototype.applyToFilename): (prototype._scrambedNumberIndexForCode): (prototype._scrambedLowercaseIndexForCode): (prototype._scrambedUppercaseIndexForCode): Naive implementation of an obfuscator. Currently, this only affects alphanumeric characters. Obfuscation is off by default, but can be toggled on in JavaScript. (elementFromMarkdown): (GlobalNodeMap): (GlobalNodeMap.prototype.nodesForGUIDs): (GlobalNodeMap.prototype.guidsForTNodes): (GlobalNodeMap.prototype.nodeForGUID): (GlobalNodeMap.prototype.guidForNode): (GlobalNodeMap.prototype.hasGUIDForNode): (GlobalNodeMap.prototype.nodes): (GlobalNodeMap.prototype.toObject): (GlobalNodeMap.fromObject): (GlobalNodeMap.dataForNode): (GlobalNodeMap.elementFromTagName): (GlobalNodeMap.nodeAttributesToObject): (GlobalNodeMap.prototype.descriptionHTMLForGUID): (GlobalNodeMap.prototype.descriptionHTMLForNode): The GlobalNodeMap keeps track of every node that has appeared in the DOM, assigning each node a globally unique identifier (GUID). This GUID is used when reconstructing the DOM, as well as unapplying or applying editing. (SelectionState): (SelectionState.prototype.isEqual): (SelectionState.prototype.applyToSelection): (SelectionState.fromSelection): (SelectionState.prototype.toObject): (SelectionState.fromObject): Represents a snapshot of the Selection state (determined by getSelection()). (DOMUpdate): (DOMUpdate.prototype.apply): (DOMUpdate.prototype.unapply): (DOMUpdate.prototype.targetNode): (DOMUpdate.prototype.detailsElement): (DOMUpdate.ofType): (DOMUpdate.fromRecords): A DOMUpdate is an abstract object representing a change in the DOM that may be applied and unapplied. These are also serializable as hashes, which may then be converted to JSON when generating editing history data. (ChildListUpdate): (ChildListUpdate.prototype.apply): (ChildListUpdate.prototype.unapply): (ChildListUpdate.prototype._nextSibling): (ChildListUpdate.prototype._removedNodes): (ChildListUpdate.prototype._addedNodes): (ChildListUpdate.prototype.toObject): (ChildListUpdate.prototype.detailsElement): (ChildListUpdate.fromObject): These three update types correspond to the three types of DOM mutations. These may appear as top-level updates if they are not captured during an input event, but for the majority of user-input-driven changes, they will be children of an input event. (CharacterDataUpdate): (CharacterDataUpdate.prototype.apply): (CharacterDataUpdate.prototype.unapply): (CharacterDataUpdate.prototype.detailsElement): (CharacterDataUpdate.prototype.toObject): (CharacterDataUpdate.fromObject): (AttributeUpdate): (AttributeUpdate.prototype.apply): (AttributeUpdate.prototype.unapply): (AttributeUpdate.prototype.detailsElement): (AttributeUpdate.prototype.toObject): (AttributeUpdate.fromObject): (SelectionUpdate): (SelectionUpdate.prototype.apply): (SelectionUpdate.prototype.unapply): (SelectionUpdate.prototype.toObject): (SelectionUpdate.fromObject): (SelectionUpdate.prototype._rangeDescriptionHTML): (SelectionUpdate.prototype._anchorDescriptionHTML): (SelectionUpdate.prototype._focusDescriptionHTML): (SelectionUpdate.prototype.detailsElement): Represents a change in the Selection. While no changes to the DOM structure occur as a result of a SelectionUpdate, the information contained in these updates is used to determine where the selection should be when rewinding or playing back the editing history. (InputEventUpdate): (InputEventUpdate.prototype._obfuscatedData): (InputEventUpdate.prototype.apply): (InputEventUpdate.prototype.unapply): (InputEventUpdate.prototype.toObject): (InputEventUpdate.fromObject): (InputEventUpdate.prototype.detailsElement): Represents an update due to user input, which consists of some number of child DOM mutation updates. * WebCore.xcodeproj/project.pbxproj: 2016-12-07 Jer Noble <jer.noble@apple.com> ASSERT crash while running media-source/mediasource-activesourcebuffers.html under Stress GC bot. https://bugs.webkit.org/show_bug.cgi?id=165514 Reviewed by Eric Carlson. If a track associated with MSE is disabled after a SourceBuffer begins parsing a queued append operation, SourceBuffer can get into a state where it asks SourceBufferPrivateAVFObjC if it is ready to accept data for that disabled track. This causes an ASSERT_NOT_REACHED in isReadyForMoreData(). However, this seems to be a valid condition; we can safely just return "false" from isReadyForMoreSamples() (and also bail from notifyClientWhenReadyForMoreSamples()) when asked about a disabled track. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): 2016-12-07 Dave Hyatt <hyatt@apple.com> [CSS Parser] Eliminate the Scope class and fold it into CSSTokenizer https://bugs.webkit.org/show_bug.cgi?id=165532 Reviewed by Dean Jackson. The Scope class, nested inside CSSTokenizer, is both poorly named and serves no purpose. It's especially weird that it was the entry point into tokenization instead of CSSTokenizer. Eliminate the class, fold its members and functions into CSSTokenizer, and have callers just make a CSSTokenizer instead. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSupportsCondition): (WebCore::CSSParser::parseSelector): * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseValue): (WebCore::CSSParserImpl::parseCustomPropertyValue): (WebCore::CSSParserImpl::parseInlineStyleDeclaration): (WebCore::CSSParserImpl::parseDeclarationList): (WebCore::CSSParserImpl::parseRule): (WebCore::CSSParserImpl::parseStyleSheet): (WebCore::CSSParserImpl::parseKeyframeKeyList): (WebCore::CSSParserImpl::parseDeclarationListForInspector): (WebCore::CSSParserImpl::parseStyleSheetForInspector): * css/parser/CSSTokenizer.cpp: (WebCore::CSSTokenizer::CSSTokenizer): (WebCore::CSSTokenizer::tokenRange): (WebCore::CSSTokenizer::tokenCount): (WebCore::CSSTokenizer::registerString): (WebCore::CSSTokenizer::Scope::Scope): Deleted. (WebCore::CSSTokenizer::Scope::tokenRange): Deleted. (WebCore::CSSTokenizer::Scope::tokenCount): Deleted. * css/parser/CSSTokenizer.h: (WebCore::CSSTokenizer::Scope::storeString): Deleted. * css/parser/CSSTokenizerInputStream.cpp: (WebCore::CSSTokenizerInputStream::CSSTokenizerInputStream): * css/parser/CSSTokenizerInputStream.h: * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::parseMediaQuerySet): * css/parser/SizesAttributeParser.cpp: (WebCore::SizesAttributeParser::SizesAttributeParser): 2016-12-07 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Remove unused and mostly untested Page domain commands and events https://bugs.webkit.org/show_bug.cgi?id=165507 Reviewed by Brian Burg. Remove any code associated with the commands/events being removed. * inspector/DOMPatchSupport.cpp: * inspector/DOMPatchSupport.h: * inspector/InspectorClient.h: (WebCore::InspectorClient::handleJavaScriptDialog): Deleted. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::scriptsEnabledImpl): Deleted. (WebCore::InspectorInstrumentation::willRunJavaScriptDialogImpl): Deleted. (WebCore::InspectorInstrumentation::didRunJavaScriptDialogImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::scriptsEnabled): Deleted. (WebCore::InspectorInstrumentation::willRunJavaScriptDialog): Deleted. (WebCore::InspectorInstrumentation::didRunJavaScriptDialog): Deleted. * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::disable): (WebCore::InspectorPageAgent::didClearWindowObjectInWorld): (WebCore::InspectorPageAgent::didPaint): (WebCore::InspectorPageAgent::buildObjectForFrame): (WebCore::InspectorPageAgent::archive): (WebCore::createXHRTextDecoder): Deleted. (WebCore::InspectorPageAgent::getScriptExecutionStatus): Deleted. (WebCore::InspectorPageAgent::setScriptExecutionDisabled): Deleted. (WebCore::InspectorPageAgent::willRunJavaScriptDialog): Deleted. (WebCore::InspectorPageAgent::didRunJavaScriptDialog): Deleted. (WebCore::InspectorPageAgent::scriptsEnabled): Deleted. (WebCore::InspectorPageAgent::handleJavaScriptDialog): Deleted. * inspector/InspectorPageAgent.h: * page/Chrome.cpp: (WebCore::Chrome::runBeforeUnloadConfirmPanel): (WebCore::Chrome::runJavaScriptAlert): (WebCore::Chrome::runJavaScriptConfirm): (WebCore::Chrome::runJavaScriptPrompt): * page/Settings.cpp: (WebCore::Settings::setScriptEnabled): 2016-12-07 Jer Noble <jer.noble@apple.com> [pointer-lock] Cursor should become visible when exiting pointer-lock via ESC key. https://bugs.webkit.org/show_bug.cgi?id=165377 Reviewed by Eric Carlson. Follow up to previous patch; clear the m_forceCursorVisibleUponUnlock flag upon losing pointer lock, so that subsequent unlocks don't erroneously cause the cursor to become visible. * page/PointerLockController.cpp: (WebCore::PointerLockController::didLosePointerLock): 2016-12-06 Geoffrey Garen <ggaren@apple.com> performance.now() should truncate to 100us https://bugs.webkit.org/show_bug.cgi?id=165503 <rdar://problem/29544531> Reviewed by Mark Lam. * page/Performance.cpp: (WebCore::Performance::reduceTimeResolution): 2016-12-07 Dave Hyatt <hyatt@apple.com> [CSS Parser] Turn back on a bunch of layout tests https://bugs.webkit.org/show_bug.cgi?id=165529 Reviewed by Zalan Bujtas. Fixes fast/css/transform-origin-parsing.html. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeTransformOrigin): The implicit check was relying on a null check of the z value, but we called releaseNonNull on it already. This meant all z properties were marked as implicit incorrectly. Fix by storing whether or not we had a z value in a local variable. 2016-12-07 Andreas Kling <akling@apple.com> [iOS] Remove bitrotted FrameLoader attempt to limit page caching under memory pressure. <https://webkit.org/b/165527> Reviewed by Antti Koivisto. This code no longer does anything, as the page cache is hard capped at 0 entries while under memory pressure. * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): 2016-12-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Use tap and pinch gestures on iOS https://bugs.webkit.org/show_bug.cgi?id=165518 Reviewed by Dean Jackson. We now use touch events to identify taps and pinches on media controls to respond immediately to user interaction on buttons and enter fullscreen when pinching out. * Modules/modern-media-controls/controls/button.css: (button): * Modules/modern-media-controls/controls/button.js: (Button): (Button.prototype.handleEvent): (Button.prototype.gestureRecognizerStateDidChange): (Button.prototype._notifyDelegateOfActivation): (Button.prototype._handleUIEvent): Deleted. * Modules/modern-media-controls/controls/controls-bar.js: (ControlsBar.prototype.set fadesWhileIdle): (ControlsBar.prototype.gestureRecognizerStateDidChange): * Modules/modern-media-controls/controls/icon-button.js: (IconButton.prototype._updateImage): (IconButton): * Modules/modern-media-controls/controls/ios-inline-media-controls.js: (IOSInlineMediaControls.prototype.gestureRecognizerStateDidChange): * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js: Added. (GestureRecognizer): (GestureRecognizer.prototype.get state): (GestureRecognizer.prototype.set state): (GestureRecognizer.prototype.get target): (GestureRecognizer.prototype.set target): (GestureRecognizer.prototype.get numberOfTouches): (GestureRecognizer.prototype.get enabled): (GestureRecognizer.prototype.set enabled): (GestureRecognizer.prototype.reset): (GestureRecognizer.prototype.locationInElement): (GestureRecognizer.prototype.locationInClient): (GestureRecognizer.prototype.locationOfTouchInElement): (GestureRecognizer.prototype.touchesBegan): (GestureRecognizer.prototype.touchesMoved): (GestureRecognizer.prototype.touchesEnded): (GestureRecognizer.prototype.touchesCancelled): (GestureRecognizer.prototype.gestureBegan): (GestureRecognizer.prototype.gestureChanged): (GestureRecognizer.prototype.gestureEnded): (GestureRecognizer.prototype.enterPossibleState): (GestureRecognizer.prototype.enterBeganState): (GestureRecognizer.prototype.enterEndedState): (GestureRecognizer.prototype.enterCancelledState): (GestureRecognizer.prototype.enterFailedState): (GestureRecognizer.prototype.enterChangedState): (GestureRecognizer.prototype.enterRecognizedState): (GestureRecognizer.prototype.handleEvent): (GestureRecognizer.prototype._initRecognizer): (GestureRecognizer.prototype._updateBaseListeners): (GestureRecognizer.prototype._removeTrackingListeners): (GestureRecognizer.prototype._updateTargetTouches): (GestureRecognizer.prototype._updateKeyboardModifiers): * Modules/modern-media-controls/gesture-recognizers/pinch.js: Added. (PinchGestureRecognizer): (PinchGestureRecognizer.prototype.get velocity): (PinchGestureRecognizer.prototype.touchesBegan): (PinchGestureRecognizer.prototype.touchesMoved): (PinchGestureRecognizer.prototype.touchesEnded): (PinchGestureRecognizer.prototype.gestureBegan): (PinchGestureRecognizer.prototype.gestureChanged): (PinchGestureRecognizer.prototype.gestureEnded): (PinchGestureRecognizer.prototype.reset): (PinchGestureRecognizer.prototype._recordGesture): (PinchGestureRecognizer.prototype._updateStateWithEvent): (PinchGestureRecognizer.prototype._distance): * Modules/modern-media-controls/gesture-recognizers/tap.js: Added. (TapGestureRecognizer): (TapGestureRecognizer.prototype.touchesBegan): (TapGestureRecognizer.prototype.touchesMoved): (TapGestureRecognizer.prototype.touchesEnded): (TapGestureRecognizer.prototype.reset): (TapGestureRecognizer.prototype.locationInElement): (TapGestureRecognizer.prototype.locationInClient): (TapGestureRecognizer.prototype._clearTimer): (TapGestureRecognizer.prototype._rewindTimer): (TapGestureRecognizer.prototype._timerFired): * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/airplay-support.js: (AirplaySupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/controls-visibility-support.js: (ControlsVisibilitySupport): (ControlsVisibilitySupport.prototype.handleEvent): (ControlsVisibilitySupport.prototype.syncControl): Deleted. * Modules/modern-media-controls/media/fullscreen-support.js: (FullscreenSupport): (FullscreenSupport.prototype.iOSInlineMediaControlsRecognizedPinchInGesture): (FullscreenSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/media-controller-support.js: (MediaControllerSupport): (MediaControllerSupport.prototype.handleEvent): (MediaControllerSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/mute-support.js: (MuteSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/pip-support.js: (PiPSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/playback-support.js: (PlaybackSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/skip-back-support.js: (SkipBackSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/start-support.js: (StartSupport.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/tracks-support.js: (TracksSupport.prototype.buttonWasClicked): Deleted. 2016-12-06 Dean Jackson <dino@apple.com> Apply styling to media documents with modern controls https://bugs.webkit.org/show_bug.cgi?id=165499 <rdar://problems/29543847> Reviewed by Antoine Quint. Forgot to commit most of the changes in MediaDocument.cpp :( * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure): 2016-12-06 Simon Fraser <simon.fraser@apple.com> Two tiled drawing tests failing with visual viewports enabled. https://bugs.webkit.org/show_bug.cgi?id=165489 Reviewed by Dean Jackson. computeLayoutViewportOrigin() gets called for iframes when the layout viewport is zero-sized, but the visual viewport is non-zero. It doesn't really make sense to compute a layout viewport when the visual viewport is larger than the layout viewport, but if this happens just anchor the layout viewport at the origin of the visual viewport. * page/FrameView.cpp: (WebCore::FrameView::computeLayoutViewportOrigin): 2016-12-04 Darin Adler <darin@apple.com> Remove various stray uses of WebCore::Dictionary https://bugs.webkit.org/show_bug.cgi?id=165358 Reviewed by Sam Weinig. I discovered three completely unused classes in the MediaStream code: MediaTrackConstraint, MediaTrackConstraintSet, and MediaTrackConstraints. While there is some chance we may implement these at some point, they are likely to be dictionaries or some other kind of data structure rather than clases, and there is no reason to keep the current classes. * CMakeLists.txt: Removed MediaTrackConstraint, MediaTrackConstraintSet, and MediaTrackConstraints. * DerivedSources.cpp: Ditto. * DerivedSources.make: Ditto. * Modules/indexeddb/IDBDatabase.h: Removed include of Dictionary.h. * Modules/indexeddb/IDBObjectStore.cpp: Added include of HeapInlines.h. * Modules/indexeddb/IDBRequest.cpp: Added include of StrongInlines.h. * Modules/indexeddb/IDBTransaction.cpp: Added include of SerializedScriptValue.h. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::getConstraints): Deleted. This function is implemented entirely in the bindings layer. * Modules/mediastream/MediaStreamTrack.h: Removed getConstraints. * Modules/mediastream/MediaTrackConstraint.cpp: Removed. * Modules/mediastream/MediaTrackConstraint.h: Removed. * Modules/mediastream/MediaTrackConstraint.idl: Removed. * Modules/mediastream/MediaTrackConstraintSet.cpp: Removed. * Modules/mediastream/MediaTrackConstraintSet.h: Removed. * Modules/mediastream/MediaTrackConstraintSet.idl: Removed. * Modules/mediastream/MediaTrackConstraints.cpp: Removed. * Modules/mediastream/MediaTrackConstraints.h: Removed. * Modules/mediastream/MediaTrackConstraints.idl: Removed. * Modules/mediastream/NavigatorUserMedia.idl: Use the type names from the latest getUserMedia specification for the arguments to webkitGetUserMedia; not sure they are precisely correct for this legacy function, but since this is a JSBuiltin, it's all ignored anyway. Just important not to call anything "Dictionary". * WebCore.xcodeproj/project.pbxproj: Removed MediaTrackConstraint, MediaTrackConstraintSet, and MediaTrackConstraints. * bindings/js/JSApplePaySessionCustom.cpp: (WebCore::JSApplePaySession::completeShippingMethodSelection): Use uncheckedArgument, since the code explicitly checks the number of arguments. (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto. (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto. * bindings/js/JSFontFaceCustom.cpp: Removed include of Dictionary.h. * dom/Document.cpp: Ditto. * dom/Element.cpp: Ditto. * dom/Element.h: Removed forward declaration of Dictionary. 2016-12-06 Wenson Hsieh <wenson_hsieh@apple.com> After preventing a beforeinput event, an input event is fired when formatting rich text https://bugs.webkit.org/show_bug.cgi?id=165435 <rdar://problem/29522314> Reviewed by Ryosuke Niwa. This regressed after I refactored some input event event dispatch logic when formatting text in r208461. I moved the logic for dispatching input events when applying styles into Editor::applyStyle, but left out an early return after firing the beforeinput event if the default behavior was prevented, which caused us to continue on and dispatch an input event. The fix is to bail from applyStyle if default was prevented. Augmented an existing layout test to cover this case. * editing/Editor.cpp: (WebCore::Editor::applyStyle): (WebCore::Editor::applyParagraphStyle): 2016-12-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Instantiate iOS media controls https://bugs.webkit.org/show_bug.cgi?id=165498 Reviewed by Dean Jackson. Add support for the modern media controls runtime flags in RenderThemeIOS and, when instantiating iOS controls, return an IOSInlineMediaControls class. * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._controlsClass): (MediaController): * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::mediaControlsStyleSheet): (WebCore::RenderThemeIOS::mediaControlsScript): (WebCore::RenderThemeIOS::mediaControlsBase64StringForIconAndPlatform): 2016-12-06 Dean Jackson <dino@apple.com> Apply styling to media documents with modern controls https://bugs.webkit.org/show_bug.cgi?id=165499 <rdar://problems/29543847> Reviewed by Antoine Quint. Existing MediaDocuments got styling from the injected style sheet, which had rules for such documents. The modern media controls use a scoped style rule, so we can't touch the document style. Instead, inline the style directly from MediaDocument. Test: media/modern-media-controls/media-documents/background-color-and-centering.html * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure): 2016-12-06 Zalan Bujtas <zalan@apple.com> Move RenderElement::rendererForRootBackground to RenderView. https://bugs.webkit.org/show_bug.cgi?id=165454 Reviewed by Simon Fraser. Currently RenderElement::rendererForRootBackground can only be called on document element's renderer. This patch removes this limitation and moves the functionality from RenderElement to RenderView. No change in functionality. * page/FrameView.cpp: (WebCore::FrameView::calculateExtendedBackgroundMode): * rendering/RenderBox.cpp: (WebCore::RenderBox::paintRootBoxFillLayers): * rendering/RenderElement.cpp: (WebCore::RenderElement::rendererForRootBackground): Deleted. * rendering/RenderElement.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::rendererBackgroundColor): * rendering/RenderView.cpp: (WebCore::RenderView::rendererForRootBackground): (WebCore::rendererObscuresBackground): (WebCore::RenderView::paintBoxDecorations): (WebCore::RenderView::rootBackgroundIsEntirelyFixed): * rendering/RenderView.h: 2016-12-05 Jiewen Tan <jiewen_tan@apple.com> [Part 1 of 2] Add support for SPKI format while doing SubtleCrypto.importKey/exportKey https://bugs.webkit.org/show_bug.cgi?id=129978 <rdar://problem/21799829> This is part 1 of Bug 129978. In this patch, it adds the SPKI format support for SubtleCrypto.importKey/exportKey. Currently support algorithms are RSAES-PKCS1-v1_5, RSASSA-PKCS1-v1_5 and RSA-OAEP. Reviewed by Brent Fulgham. Tests: crypto/subtle/rsa-import-jwk-key-export-spki-key.html crypto/subtle/rsa-import-spki-key-export-jwk-key.html crypto/subtle/rsa-import-spki-key-export-spki-key.html crypto/subtle/rsa-import-spki-small-key.html crypto/subtle/rsa-oaep-generate-export-key-spki.html crypto/subtle/rsa-oaep-import-spki-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-spki.html crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-spki.html crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key.html crypto/workers/subtle/rsa-export-spki-key.html crypto/workers/subtle/rsa-import-spki-key.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::toKeyData): * crypto/CommonCryptoUtilities.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): (WebCore::CryptoAlgorithmRSA_OAEP::exportKey): * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::importSpki): (WebCore::CryptoKeyRSA::exportSpki): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::bytesUsedToEncodedLength): (WebCore::bytesNeededForEncodedLength): (WebCore::addEncodedASN1Length): (WebCore::CryptoKeyRSA::importSpki): (WebCore::CryptoKeyRSA::exportSpki): 2016-12-06 Simon Fraser <simon.fraser@apple.com> Fix editing text flakiness introduced in r209411 https://bugs.webkit.org/show_bug.cgi?id=165500 Reviewed by Dean Jackson. The "insideFixed" out param was left uninitialized sometimes. This affected FrameSelection's m_caretInsidePositionFixed, which caused problems in these tests. Tested by editing tests in WK1. * editing/htmlediting.cpp: (WebCore::absoluteBoundsForLocalCaretRect): 2016-12-06 Alexey Proskuryakov <ap@apple.com> Correct SDKROOT values in xcconfig files https://bugs.webkit.org/show_bug.cgi?id=165487 rdar://problem/29539209 Reviewed by Dan Bernstein. Fix suggested by Dan Bernstein. * Configurations/DebugRelease.xcconfig: 2016-12-06 Saam Barati <sbarati@apple.com> Remove old Wasm object model https://bugs.webkit.org/show_bug.cgi?id=165481 Reviewed by Keith Miller and Mark Lam. * testing/Internals.cpp: (WebCore::Internals::parserMetaData): 2016-12-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media controls use the fullscreen layout after going from inline to fullscreen to PiP to inline https://bugs.webkit.org/show_bug.cgi?id=165494 Reviewed by Dean Jackson. We would only call _updateControlsIfNeeded() when entering or leaving fullscreen, so we going from fullscreen to PiP to inline would retain fullscreen controls since we would not check for the event that indicates we went back from PiP to inline. On platforms that support it, we listen to the "webkitpresentationmodechanged" event to update the controls, and only "webkitfullscreenchange" on others (ie. Yosemite). Test: media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype.handleEvent): (MediaController.prototype._returnMediaLayerToInlineIfNeeded): 2016-12-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Rendering issues with controls bar when captions are on https://bugs.webkit.org/show_bug.cgi?id=165390 Reviewed by Dean Jackson. We would face some layout issues with captions due to RenderImage::layoutShadowControls() expecting a single RenderBox in the media controls shadow root, which was the case with legacy media controls, but no longer the case with modern media controls. We now host both the captions and the media controls elements under a single container, and add an asertion in RenderImage to check that a single RenderBox child exists. Test: media/modern-media-controls/media-controller/media-controller-single-container.html * Modules/modern-media-controls/controls/media-controls.css: (.media-controls-container): (.media-controls-container,): (.media-controls-container > *): (.media-controls): * Modules/modern-media-controls/controls/text-tracks.css: (video::-webkit-media-text-track-container): * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype._updateControlsIfNeeded): * rendering/RenderImage.cpp: (WebCore::RenderImage::layoutShadowControls): 2016-12-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Automatically hide the controls bar when the mouse is idle https://bugs.webkit.org/show_bug.cgi?id=165492 Reviewed by Dean Jackson. We now automatically hide the controls bar. When the media is no longer paused, the controls remain visible for 4 seconds, regardless of where the mouse pointer is located. When the user mouses over the media, the controls become visible and automatically hide 4 seconds after the last time the user has moved his mouse over the media. When the user mouses out of the media, the controls automatically hide. When the mouse is over the controls bar, it remains visible. When the media is paused, the controls bar remain visible regardless of the mouse position. Tests: media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-and-mouse-leave.html media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-over-controls-bar.html media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html media/modern-media-controls/media-controller/media-controller-auto-hide-pause.html media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html media/modern-media-controls/media-controller/media-controller-auto-hide.html * Modules/modern-media-controls/controls/controls-bar.css: Added. (.controls-bar): (.controls-bar.faded): * Modules/modern-media-controls/controls/controls-bar.js: (ControlsBar.prototype.get userInteractionEnabled): (ControlsBar.prototype.set userInteractionEnabled): (ControlsBar.prototype.get fadesWhileIdle): (ControlsBar.prototype.set fadesWhileIdle): (ControlsBar.prototype.get visible): (ControlsBar.prototype.set visible): (ControlsBar.prototype.get faded): (ControlsBar.prototype.set faded): (ControlsBar.prototype.handleEvent): (ControlsBar.prototype.commitProperty): (ControlsBar.prototype._cancelAutoHideTimer): (ControlsBar.prototype._rewindAutoHideTimer): (ControlsBar.prototype._autoHideTimerFired): * Modules/modern-media-controls/controls/media-controls.js: * Modules/modern-media-controls/media/controls-visibility-support.js: (ControlsVisibilitySupport.prototype.get mediaEvents): (ControlsVisibilitySupport.prototype.syncControl): (ControlsVisibilitySupport): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._updateControlsIfNeeded): 2016-12-06 Zalan Bujtas <zalan@apple.com> Can not select whole line when using flexbox https://bugs.webkit.org/show_bug.cgi?id=165299 Reviewed by David Hyatt. RootInlineBox::selectionTopAdjustedForPrecedingBlock assumes that the preceding block is always above the current line. However in certain layout contexts (flex as an example) the block before could just be on the same line as the current one. This patch checks if we actually need to adjust the selection top to avoid vertical selection overlap. Test: fast/flexbox/flexbox-fail-to-select-same-line.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::blockBeforeWithinSelectionRoot): Deleted. * rendering/RenderBlock.h: * rendering/RootInlineBox.cpp: (WebCore::blockBeforeWithinSelectionRoot): (WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock): 2016-12-06 Ryosuke Niwa <rniwa@webkit.org> Add more assertions to ElementQueue diagnose a bug https://bugs.webkit.org/show_bug.cgi?id=164814 Reviewed by Alexey Proskuryakov. Set m_invoking in release builds now that assertions are also run in release builds. * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): 2016-12-06 Jer Noble <jer.noble@apple.com> YouTube sometimes pauses when switching tabs https://bugs.webkit.org/show_bug.cgi?id=165468 Reviewed by Eric Carlson. Test: media/media-session-restrictions.html The bitfield which represents the restrictions for "VideoAudio" media type was unititialized, leading to what was effectively a random set of restrictions at runtime. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::resetRestrictions): * testing/Internals.cpp: (WebCore::mediaTypeFromString): (WebCore::Internals::setMediaSessionRestrictions): (WebCore::Internals::mediaSessionRestrictions): * testing/Internals.h: * testing/Internals.idl: 2016-12-06 Mark Lam <mark.lam@apple.com> Introduce the concept of Immutable Prototype Exotic Objects to comply with the spec. https://bugs.webkit.org/show_bug.cgi?id=165227 <rdar://problem/29442665> Reviewed by Saam Barati. Make all objects in window.__proto__'s prototype chain immutable prototype exotic objects. This gives us roughly equivalent behavior to other browsers. Firefox's behavior differ slightly in that Firefox will fail any attempted assignment their __proto__, while the immutable prototype exotic objects will only fail if the assignment is of a different value. See https://tc39.github.io/ecma262/#sec-immutable-prototype-exotic-objects. Chrome differs in that assignment to window.__proto__ is also handled like an immutable prototype exotic object. Instead we adhere to the current HTML spec that says that the assignment should fail unconditionally. See https://html.spec.whatwg.org/#the-windowproxy-exotic-object and https://html.spec.whatwg.org/#windowproxy-setprototypeof. If the HTML spec is changed to make the WindowProxy and Location objects into immutable prototype exotic objects later, we can update to match the spec then. Test: js/prototype-assignment.html * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/IDLAttributes.txt: * dom/EventTarget.idl: * page/DOMWindow.idl: 2016-12-06 Andreas Kling <akling@apple.com> [Cocoa] Add some memory usage related information to sysdiagnose state dumps <https://webkit.org/b/165375> <rdar://problem/29057243> Reviewed by Darin Adler. Follow-up to address two more review comments. * page/PerformanceLogging.cpp: (WebCore::PerformanceLogging::javaScriptObjectCounts): Use WTFMove() when returning the HashCountedSet to avoid making an extra copy. 2016-12-06 Dave Hyatt <hyatt@apple.com> REGRESSION (Safari 10): Scrolling not working inside height 100% table https://bugs.webkit.org/show_bug.cgi?id=164366 <rdar://problem/29095535> Reviewed by Zalan Bujtas. Added fast/table/overflow-percent-height-regression.html * rendering/RenderBox.cpp: (WebCore::RenderBox::computePercentageLogicalHeight): This patch wasn't merged correctly from Blink. The value returned needed to be 0, not unset. 2016-12-06 Sam Weinig <sam@webkit.org> REGRESSION: media/track LayoutTests are flaky failures https://bugs.webkit.org/show_bug.cgi?id=165432 Reviewed by Antoine Quint. RenderThemeMac was caching the media controls script / style sheets and not being invalidated when the RuntimeEnabledFeatures changed. So, we can just cache both. * bindings/generic/RuntimeEnabledFeatures.h: Initialize m_areModernMediaControlsEnabled to false. * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsStyleSheet): (WebCore::RenderThemeMac::mediaControlsScript): Have separate caches for the modern and legacy media control scripts/style sheets. 2016-12-06 Sam Weinig <sam@webkit.org> DumpRenderTree crashed in com.apple.WebCore: WebCore::MockMediaEndpoint::generateDtlsInfo const + 23 https://bugs.webkit.org/show_bug.cgi?id=165486 <rdar://problem/29149588> Reviewed by Tim Horton. The MockMediaEndpoint can be destroyed before the task created in MockMediaEndpoint::generateDtlsInfo() gets a chance to run, so guard it with a weak pointer. * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::MockMediaEndpoint): (WebCore::MockMediaEndpoint::generateDtlsInfo): * platform/mock/MockMediaEndpoint.h: 2016-12-06 Chris Dumez <cdumez@apple.com> Add HTML interactive form validation blacklist for some WebKit-specific sites https://bugs.webkit.org/show_bug.cgi?id=165470 <rdar://problem/29509424> Reviewed by Simon Fraser. Add HTML interactive form validation blacklist for some WebKit-specific sites expecting our old behavior, until they get a chance to be updated. * html/HTMLFormElement.cpp: (WebCore::isURLBlacklistedForInteractiveFormValidation): (WebCore::HTMLFormElement::prepareForSubmission): 2016-12-06 Chris Dumez <cdumez@apple.com> Unreviewed, rollout r209050. This change may impact other popovers than the HTML validation one. The previous code is safer. * platform/ValidationBubble.h: * platform/ios/ValidationBubbleIOS.mm: (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]): (WebCore::ValidationBubble::setAnchorRect): * platform/spi/ios/UIKitSPI.h: 2016-12-05 Simon Fraser <simon.fraser@apple.com> Improve the behavior of scroll-into-view when the target is inside position:fixed https://bugs.webkit.org/show_bug.cgi?id=165354 Reviewed by Zalan Bujtas. The existing RenderLayer::scrollRectToVisible() code paid no heed to whether the target was inside position:fixed, resulting in unwanted scrolls. Fix this by plumbing through from the call sites a "insideFixed" flag which we get when we call localToAbsolute(), and use this flag to avoid scrolling at all if unzoomed. If zoomed and we're focussing something inside position:fixed, and if visual viewports are enabled, we can compute the visual viewport required to reveal the target rect, which gives us the ideal scroll position. Fix a bug on non-iOS platforms when zoomed, which is to scale the viewRect since frameView.visibleContentRect() gives an unscaled rect on those platforms. Not all callers of scrollRectToVisible() are fixed, but those that are not will get the current behavior. Tests: fast/overflow/scroll-anchor-in-position-fixed.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html * dom/Element.cpp: (WebCore::Element::scrollIntoView): (WebCore::Element::scrollIntoViewIfNeeded): (WebCore::Element::scrollIntoViewIfNotVisible): (WebCore::Element::updateFocusAppearance): * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::absoluteCaretBounds): (WebCore::FrameSelection::recomputeCaretRect): (WebCore::FrameSelection::revealSelection): * editing/FrameSelection.h: * editing/VisiblePosition.cpp: (WebCore::VisiblePosition::absoluteCaretBounds): * editing/VisiblePosition.h: * editing/htmlediting.cpp: (WebCore::absoluteBoundsForLocalCaretRect): * editing/htmlediting.h: * page/FrameView.cpp: (WebCore::FrameView::scrollElementToRect): (WebCore::FrameView::scrollToAnchor): * page/PrintContext.cpp: (WebCore::PrintContext::outputLinkedDestinations): * rendering/RenderElement.cpp: (WebCore::RenderElement::getLeadingCorner): (WebCore::RenderElement::getTrailingCorner): (WebCore::RenderElement::absoluteAnchorRect): (WebCore::RenderElement::anchorRect): Deleted. * rendering/RenderElement.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollRectToVisible): (WebCore::RenderLayer::getRectToExpose): (WebCore::RenderLayer::autoscroll): * rendering/RenderLayer.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::scrollRectToVisible): * rendering/RenderObject.h: 2016-12-06 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] REGRESSION(r205396): Intermediate CTRuns with initial advances get double counted when glyph origins are enabled https://bugs.webkit.org/show_bug.cgi?id=165084 Reviewed by Simon Fraser. When glyph origins are not enabled, an intermediate CTRun's initial advance is simply added to the previous glyph's advance. However, when glyph origins are enabled, this shouldn't occur. Test: fast/text/initial-advance-in-intermediate-run-complex.html * platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): 2016-12-06 Simon Fraser <simon.fraser@apple.com> Enable visual viewports by default on Mac, and iOS Wk2 https://bugs.webkit.org/show_bug.cgi?id=165452 Reviewed by Zalan Bujtas. Some tests revealed an issue where, during scrollbar updates, the visual viewport would be 15px wider than the layout viewport, which results in the layout viewport shifting 15px to the right. Prevent this by disallowing viewport updates during the AdjustViewSize phase; we'll be called again in postLayoutTasks. * page/FrameView.cpp: (WebCore::FrameView::updateLayoutViewport): 2016-12-06 Daniel Bates <dabates@apple.com> Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines https://bugs.webkit.org/show_bug.cgi?id=165451 Reviewed by Alex Christensen. Rename Document::shouldEnforceHTTP0_9Sandbox() and ResourceResponseBase::isHttpVersion0_9() to Document::shouldEnforceHTTP09Sandbox() and ResourceResponseBase::isHTTP09, respectively, to conform to the WebKit Code Style Guidelines. * dom/Document.cpp: (WebCore::Document::initSecurityContext): (WebCore::Document::shouldEnforceHTTP09Sandbox): Renamed; formerly named shouldEnforceHTTP0_9Sandbox * dom/Document.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::isHTTP09): Renamed; formerly named isHttpVersion0_9. * platform/network/ResourceResponseBase.h: 2016-12-06 Daniel Bates <dabates@apple.com> Use Vector::uncheckedAppend() in more places https://bugs.webkit.org/show_bug.cgi?id=164952 Reviewed by Darin Adler. We can use Vector::uncheckedAppend() whenever the number of items that will be appended to a vector is equal to or less than its capacity. Using Vector::uncheckedAppend() is more efficient than Vector::append() as it avoids checking the capacity of the vector before appending a value to the end of it. * bindings/js/SerializedScriptValue.cpp: (WebCore::SerializedScriptValue::SerializedScriptValue): * contentextensions/DFABytecodeCompiler.cpp: (WebCore::ContentExtensions::DFABytecodeCompiler::extractJumpTable): * contentextensions/DFAMinimizer.cpp: * css/StyleProperties.cpp: (WebCore::StyleProperties::copyPropertiesInSet): Use Vector::uncheckedAppend() and inline the assignment of the temporary variable value into the if condition to limit its scope as it is referenced exactly once in the loop body. * css/StyleRule.cpp: (WebCore::StyleRuleGroup::StyleRuleGroup): Use Vector::uncheckedAppend() and write for-loop using a C++11 range-based for-loop. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::setLangArgumentList): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChildOf): * dom/DocumentMarkerController.cpp: (WebCore::updateRenderedRectsForMarker): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::convertToLayoutUnits): * platform/audio/AudioBus.cpp: (WebCore::AudioBus::AudioBus): * platform/graphics/FontCache.cpp: (WebCore::FontCache::purgeInactiveFontData): * platform/graphics/PathUtilities.cpp: (WebCore::polygonsForRect): * platform/mediastream/CaptureDeviceManager.cpp: (CaptureDeviceManager::bestSourcesForTypeAndConstraints): * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::fitnessDistance): * platform/network/cf/FormDataStreamCFNet.cpp: (WebCore::formCreate): 2016-12-04 Darin Adler <darin@apple.com> Use ASCIICType more, and improve it a little bit https://bugs.webkit.org/show_bug.cgi?id=165360 Reviewed by Sam Weinig. * css/CSSGrammar.y.in: Use isASCIIDigit. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseFontFaceUnicodeRange): Use isASCIIHexDigit and toASCIIHexValue. (WebCore::isEqualToCSSIdentifier): Use isASCIILower. * html/FormController.cpp: (WebCore::isNotFormControlTypeCharacter): Use isASCIILower. * html/parser/CSSPreloadScanner.cpp: (WebCore::CSSPreloadScanner::tokenize): Use isASCIIAlpha. * platform/Decimal.cpp: (WebCore::Decimal::fromString): Use isASCIIDigit. * platform/FileSystem.cpp: (WebCore::decodeFromFilename): Use isASCIIHexDigit and toASCIIHexValue. * platform/URL.cpp: (WebCore::isLetterMatchIgnoringCase): Deleted. (WebCore::isSchemeCharacterMatchIgnoringCase): Deleted. (WebCore::assertProtocolIsGood): Use isASCIIUpper. (WebCore::URL::protocolIs): Use isASCIIAlphaCaselessEqual. (WebCore::URL::parse): Ditto. (WebCore::protocolIs): Ditto. (WebCore::protocolIsInHTTPFamily): Ditto. * platform/URLParser.cpp: (WeCore::URLParser::parseIPv4Piece): Use isASCIIDigit. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isRussianDomainNameCharacter): Use isASCIIDigit. (WebCore::allCharactersAllowedByTLDRules): Ditto. (WebCore::dataWithUserTypedString): Use upperNibbleToASCIIHexDigit and lowerNibbleToASCIIHexDigit. (WebCore::dataForURLComponentType): Ditto. (WebCore::createStringWithEscapedUnsafeCharacters): Ditto. (WebCore::userVisibleString): Use isASCIIHexDigit, toASCIIHexValue, upperNibbleToASCIIHexDigit, and lowerNibbleToASCIIHexDigit. (WebCore::isUserVisibleURL): Use isASCIIHexDigit and toASCIIHexValue. * platform/network/FormDataBuilder.cpp: (WebCore::FormDataBuilder::encodeStringAsFormData): Use isASCIIAlphanumeric. * rendering/mathml/RenderMathMLToken.cpp: (WebCore::mathVariant): Use isASCIIUpper, isASCIILower, and isASCIIDigit. * svg/SVGParserUtilities.cpp: (WebCore::genericParseNumber): Use isASCIIDigit. * svg/SVGPathStringSource.cpp: (WebCore::nextCommandHelper): Ditto. * xml/XPathParser.cpp: (WebCore::XPath::Parser::lexNumber): Ditto. (WebCore::XPath::Parser::nextTokenInternal): Ditto. 2016-12-06 Ryan Haddad <ryanhaddad@apple.com> Rebaseline bindings tests after r209390. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestObj.h: 2016-12-06 Tim Horton <timothy_horton@apple.com> PDF markup/annotations visible in Mail on macOS but not on iOS https://bugs.webkit.org/show_bug.cgi?id=165444 <rdar://problem/28942896> Reviewed by Simon Fraser. No new tests, but enabled an existing test for this feature. * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::drawPDFPage): * platform/spi/cg/CoreGraphicsSPI.h: Make use of CGContextDrawPDFPageWithAnnotations where available, to paint the page with annotations. 2016-12-06 Dave Hyatt <hyatt@apple.com> [CSS Parser] Turn on the new CSS parser https://bugs.webkit.org/show_bug.cgi?id=165213 Reviewed by Zalan Bujtas. * page/Settings.in: 2016-12-06 Dan Bernstein <mitz@apple.com> Tried to fix the USE(APPLE_INTERNAL_SDK) build after r209385. * platform/spi/cocoa/NSTouchBarSPI.h: 2016-12-05 Jer Noble <jer.noble@apple.com> [pointer-lock] Cursor should become visible when exiting pointer-lock via ESC key. https://bugs.webkit.org/show_bug.cgi?id=165377 Reviewed by Darin Adler. Introduce the concept of "force cursor to become visible" when requesting the pointer be unlocked. ESC events will cause the pointer to become visible, while normal key events will not. * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerUnlock): (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible): (WebCore::PointerLockController::documentDetached): (WebCore::PointerLockController::didLosePointerLock): * page/PointerLockController.h: Drive-by fix: apply Darin's feedback to existing functions: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): * dom/Element.cpp: (WebCore::Element::removedFrom): * page/PointerLockController.cpp: (WebCore::PointerLockController::elementRemoved): (WebCore::PointerLockController::documentDetached): 2016-12-06 Sam Weinig <sam@webkit.org> [WebIDL] Add support for converting dictionaries to JS https://bugs.webkit.org/show_bug.cgi?id=165367 Reviewed by Darin Adler and Alex Christensen. - Adds support for converting dictionary types to JSValues via JSDOMConvert. - Adopts that functionality to correct the CryptoKeyPair implementation, which is supposed to be a dictionary. (While doing this, I also update places that were passing both a CryptoKey and CryptoKeyPair to use a Variant, since they always only wanted one.) - Re-works DOMPromise and DeferredPromise to be based on JSDOMConvert and IDLTypes. * CMakeLists.txt: * PlatformEfl.cmake: * PlatformGTK.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: Remove JSCryptoKeyPairCustom.cpp and CryptoKeyPair.cpp. * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: * Modules/mediasource/MediaSource.cpp: * Modules/mediasource/SourceBuffer.cpp: * bindings/js/JSMediaDevicesCustom.cpp: * html/MediaController.cpp: * html/track/TextTrack.cpp: Add some missing includes. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): (WebCore::ApplePaySession::openPaymentSetup): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::text): (WebCore::FetchBody::consume): (WebCore::FetchBody::loadingFailed): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolveWithData): (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::text): * Modules/fetch/FetchResponse.h: * Modules/mediastream/MediaDevices.h: * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::replaceTrack): (WebCore::MediaEndpointPeerConnection::replaceTrackTask): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::applyConstraints): * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::addIceCandidate): * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::queuedSetLocalDescription): (WebCore::RTCPeerConnection::queuedSetRemoteDescription): (WebCore::RTCPeerConnection::queuedAddIceCandidate): (WebCore::RTCPeerConnection::replaceTrack): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::replaceTrack): * Modules/mediastream/RTCRtpSender.h: * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::deny): * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::suspend): (WebCore::AudioContext::resume): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::whenDefinedPromise): * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::notifyFinished): * css/FontFace.h: * css/FontFaceSet.cpp: (WebCore::FontFaceSet::load): * css/FontFaceSet.h: * dom/CustomElementRegistry.cpp: (WebCore::CustomElementRegistry::addElementDefinition): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::rejectPendingPlayPromises): * html/HTMLMediaElement.h: Update to use new IDLType based promises. * bindings/generic/IDLTypes.h: Add a new type, ParameterType, to use as the parameter to DOMPromise/DeferredPromise. * bindings/js/JSCryptoKeyPairCustom.cpp: Removed. * bindings/js/JSDOMConvert.h: (WebCore::JSConverter<IDLDictionary<T>>::convert): Add JSConverter specialization for IDLDictionary. Have it simply forward to a generated convertDictionaryToJS function, following the convention set in place by IDLEnumeration. * bindings/js/JSDOMPromise.cpp: * bindings/js/JSDOMPromise.h: Re-write to be based on IDLTypes and JSDOMConvert, simplifying the implementation. * bindings/js/JSSubtleCryptoCustom.cpp: * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Update for variant based KeyOrKeyPair. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryHeaderContent): (GenerateDictionaryImplementationContent): Add generation of the convertDictionaryToJS function. I made it require the JSGenerateToJSObject extended attribute for now, as the majority of dictionaries do not need this code generated for them. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/TestObj.idl: Add JSGenerateToJSObject to a dictionary to test generation in bindings tests. * crypto/CryptoAlgorithm.h: Change KeyOrKeyPairCallback to take a Variant<RefPtr<CryptoKey>, CryptoKeyPair>, rather than two separate arguments. * crypto/CryptoKeyPair.cpp: Removed. * crypto/CryptoKeyPair.h: Convert to a struct. * crypto/CryptoKeyPair.idl: Convert to a dictionary. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): Update for new signature of KeyOrKeyPairCallback. 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Reject invalid hex colors on the fast path https://bugs.webkit.org/show_bug.cgi?id=165461 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::fastParseColorInternal): Make sure to check for success. There was even a FIXME in the code about this! Matches our old parser's behavior. 2016-12-05 Antoine Quint <graouts@apple.com> [Modern Media Controls] Controls bar in fullscreen cannot be dragged https://bugs.webkit.org/show_bug.cgi?id=165448 Reviewed by Simon Fraser. We weren't listening to mousemove and mouseup events on the right event target, window in the context of a fullscreen shadow root makes no sense. We now listen to those events on the media controls, which we size to fit the whole of the media element's bounds. We then apply a transform to the controls bar to apply the dragging distance. Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html * Modules/modern-media-controls/controls/controls-bar.js: (ControlsBar.prototype.get translation): (ControlsBar.prototype.set translation): (ControlsBar.prototype.commitProperty): (ControlsBar): Deleted. * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: (.media-controls.mac.fullscreen): (.media-controls.mac.fullscreen > .controls-bar): * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: (MacOSFullscreenMediaControls.prototype._handleMousedown): (MacOSFullscreenMediaControls.prototype._handleMousemove): (MacOSFullscreenMediaControls.prototype._handleMouseup): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Allow calc in SVG attributes https://bugs.webkit.org/show_bug.cgi?id=165459 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeLength): 2016-12-05 Brady Eidson <beidson@apple.com> Build fix followup to r209379: STP 19 fails to launch on 16B255 https://bugs.webkit.org/show_bug.cgi?id=165388 -and corresponding- rdar://problem/29514476 Rubberstamped by Tim Horton. No new tests (No behavior change). * platform/spi/cocoa/NSTouchBarSPI.h: Strategically relocate NS_ASSUME_NONNULL* macros. 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure the SVGPaint URI and currentColor style still paints using the URI https://bugs.webkit.org/show_bug.cgi?id=165457 Reviewed by Zalan Bujtas. * rendering/svg/SVGResources.cpp: (WebCore::paintingResourceFromSVGPaint): Add support for this paint type. The old parser doesn't use it. 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix dashboard region parsing https://bugs.webkit.org/show_bug.cgi?id=165456 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWebkitDashboardRegion): Make sure to reject whitespace by itself as well as unclosed dashboard-region functions. 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Properly reject large numeric values https://bugs.webkit.org/show_bug.cgi?id=165455 Reviewed by Zalan Bujtas. The new parser clamped numeric values in both the slow and fast paths to the max and min float values. The old parser simply allowed the values to be inf, and then had std::isinf checks to reject. Blink rejects also even though it clamps, but I could not discern the mechanism by which they did so. Therefore I am changing the new parser to exactly match the old parser. Numeric values are no longer clamped, but instead are allowed to be inf, and isinf checks now exist in the new parser in the same places they do in the old parser. * css/parser/CSSParserFastPaths.cpp: (WebCore::parseSimpleLength): (WebCore::parseSimpleLengthValue): * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::CSSParserToken): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeLength): (WebCore::CSSPropertyParserHelpers::consumePercent): 2016-12-05 Ricky Mondello <rmondello@apple.com> STP 19 fails to launch on 16B255 https://bugs.webkit.org/show_bug.cgi?id=165388 -and corresponding- rdar://problem/29514476 Reviewed by Tim Horton. * platform/spi/cocoa/NSTouchBarSPI.h: Re-declare the SPI symbols as weak. The cited crash itself is for a symbol we weren't handling here, but is part of the same group. Re-declare all four of these symbols to be safe. 2016-12-05 Antoine Quint <graouts@apple.com> ERROR: post-layout: dirty renderer(s) - Encountered with LayoutTest media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html https://bugs.webkit.org/show_bug.cgi?id=165312 Reviewed by Simon Fraser. Reverting part of the code added in https://bugs.webkit.org/show_bug.cgi?id=165287 that triggered an assertion. We go back to removing previous media controls as we add new ones when the fullscreen status changes, and simply hide the controls during the animated transition using a CSS pseudo-class. This also fixes an issue where we wouldn't have removed the previous controls should we have entered fullscreen in a different way than clicking on the fullscreen button in the media controls. We restore testing coverage that was fixed due to this assertion. * Modules/modern-media-controls/controls/media-controls.css: (:host(:-webkit-animating-full-screen-transition) .media-controls): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.prototype.fadeIn): (MediaControls.prototype.presentInElement): Deleted. * Modules/modern-media-controls/media/fullscreen-support.js: (FullscreenSupport.prototype.buttonWasClicked): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._updateControlsIfNeeded): 2016-12-05 Dean Jackson <dino@apple.com> MediaDocuments crash with modern media controls https://bugs.webkit.org/show_bug.cgi?id=165446 <rdar://problem/29524959> Reviewed by Antoine Quint. The modern media controls inject a <style> element into the document, which exposed a bug when used in MediaDocuments. Such documents were not getting a charset, and the hash table for the CSSParserContexts was crashing. Test: media/modern-media-controls/media-documents/insert-style-should-not-crash.html * css/parser/CSSParserMode.h: Guard against an empty charset. (WebCore::CSSParserContextHash::hash): * dom/InlineStyleSheetOwner.cpp: Ask for the charset with fallback. (WebCore::parserContextForElement): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] shape-rendering supports crispEdges rather than crisp-edges https://bugs.webkit.org/show_bug.cgi?id=165443 Reviewed by Tim Horton. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support setting of custom properties from the CSS OM https://bugs.webkit.org/show_bug.cgi?id=165442 Reviewed by Tim Horton. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseCustomPropertyValue): Call in to a new function in CSSParserImpl that can handle custom property parsing. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseCustomPropertyValue): New function that is similar to parseValue, but handling custom properties. (WebCore::CSSParserImpl::consumeDeclaration): (WebCore::CSSParserImpl::consumeCustomPropertyValue): (WebCore::CSSParserImpl::consumeVariableValue): Deleted. * css/parser/CSSParserImpl.h: Rename consumeVariableValue to consumeCustomPropertyValue, since that is more clear. consumeVariableValue sounds like you might be resolving a variable reference rather than parsing a custom property's value. 2016-12-05 Tim Horton <timothy_horton@apple.com> Adopt CAMachPort-as-layer-contents https://bugs.webkit.org/show_bug.cgi?id=141687 <rdar://problem/19393233> Reviewed by Darin Adler. No new tests, just a performance bump. * platform/spi/cocoa/QuartzCoreSPI.h: Add some SPI. 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] calcs on column-width that resolve to 0 should be discarded https://bugs.webkit.org/show_bug.cgi?id=165439 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeColumnWidth): 2016-12-05 Dean Jackson <dino@apple.com> pointer lock needs to be feature detectable https://bugs.webkit.org/show_bug.cgi?id=165426 <rdar://problem/29486715> Reviewed by Antoine Quint. Annotate the public-facing API for pointer-lock, so that it is hidden when not available. Also move the Setting to a RuntimeEnabledFeature, since pointer-lock is exposed from WebKit as a feature. Tests: pointer-lock/pointerlock-interface-disabled.html pointer-lock/pointerlock-interface.html * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setPointerLockEnabled): (WebCore::RuntimeEnabledFeatures::pointerLockEnabled): * dom/Document.idl: * dom/Element.idl: * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): (WebCore::PointerLockController::requestPointerUnlock): * page/Settings.in: 2016-12-05 Keith Rollin <krollin@apple.com> Reduce number of platformMemoryUsage calls https://bugs.webkit.org/show_bug.cgi?id=164375 Reviewed by Darin Adler. Removed the calls to WTF::releaseFastMallocFreeMemory (it's already called elsewhere in the free-all-memory pipeline) and malloc_zone_pressure_relief (it should be called by the OS on its own terms). No new tests -- no new or changed features. * platform/cocoa/MemoryPressureHandlerCocoa.mm: (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Leave the Animation type alone when the property is invalid https://bugs.webkit.org/show_bug.cgi?id=165418 Reviewed by Dean Jackson. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationProperty): 2016-12-05 Antti Koivisto <antti@apple.com> keyframes do not work when defined inside a style in a shadowRoot https://bugs.webkit.org/show_bug.cgi?id=164608 <rdar://problem/29210251> Reviewed by Darin Adler. With :host and ::slotted rules a keyframe animation affecting an element can be defined in a style scope different from the element's own scope. Style resolver loses the scope information when building the RenderStyle so there is no way to find out the correct scope. Fix by passing style scope through to style builder and including a scope association with the animation name. Find the correct scope when resolving keyframes. Test: fast/shadow-dom/shadow-host-animation.html * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationName): Include scope with the name. * css/ElementRuleCollector.cpp: (WebCore::MatchRequest::MatchRequest): (WebCore::ElementRuleCollector::addMatchedRule): (WebCore::ElementRuleCollector::sortAndTransferMatchedRules): (WebCore::ElementRuleCollector::matchAuthorRules): (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules): (WebCore::ElementRuleCollector::matchHostPseudoClassRules): (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules): (WebCore::ElementRuleCollector::collectMatchingRulesForList): Replace treeContextOrdinal int with Style::ScopeOrdinal enum carrying the same information. Simplify the code removing unnecessary use of MatchRequest struct. (WebCore::compareRules): * css/ElementRuleCollector.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::MatchResult::addMatchedProperties): (WebCore::StyleResolver::CascadedProperties::setPropertyInternal): (WebCore::StyleResolver::CascadedProperties::set): (WebCore::StyleResolver::CascadedProperties::setDeferred): Pass styleScopeOrdinal through the cascade mechanism (WebCore::cascadeLevelForIndex): (WebCore::StyleResolver::CascadedProperties::addMatch): (WebCore::StyleResolver::CascadedProperties::addImportantMatches): (WebCore::StyleResolver::CascadedProperties::Property::apply): Set styleScopeOrdinal in State when applying style. (WebCore::StyleResolver::CascadedProperties::addStyleProperties): Deleted. Move the code to the only caller. * css/StyleResolver.h: (WebCore::StyleResolver::State::styleScopeOrdinal): (WebCore::StyleResolver::State::setStyleScopeOrdinal): * page/animation/CompositeAnimation.cpp: (WebCore::KeyframeAnimation::KeyframeAnimation): (WebCore::KeyframeAnimation::resolveKeyframeStyles): Find the correct scope for resolving keyframes based on the scope ordinal. * platform/animation/Animation.cpp: * platform/animation/Animation.h: Add m_nameStyleScopeOrdinal that tells the scope where the name is defined. * style/StyleScope.cpp: (WebCore::Style::Scope::forOrdinal): Find the scope for ordinal. * style/StyleScope.h: Define ScopeOrdinal types. (WebCore::Style::operator++): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support glyph-orientation-horizontal and glyph-orientation-vertical https://bugs.webkit.org/show_bug.cgi?id=165414 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeGlyphOrientation): (WebCore::CSSPropertyParser::parseSingleValue): Add support for the glyph-orientation-horizontal and glyph-orientation-vertical properties. They take an angle and allow unitless values. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeAngle): Fix a bug in the handling of unitless values for angles. Make sure to actually pass in the value instead of always doing 0. Blink does not accept unitless values for angles at all, so this is another difference to investigate for SVG in the future. 2016-12-05 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r209299. This change appears to have caused LayoutTest failures on Sierra WK1. Reverted changeset: "Improve the behavior of scroll-into-view when the target is inside position:fixed" https://bugs.webkit.org/show_bug.cgi?id=165354 http://trac.webkit.org/changeset/209299 2016-12-05 Andreas Kling <akling@apple.com> [Cocoa] Add some memory usage related information to sysdiagnose state dumps <https://webkit.org/b/165375> <rdar://problem/29057243> Reviewed by Darin Adler. Add a flag to memoryUsageStatistics() to allow gathering of slightly more expensive information. This mode is used when capturing a state dump for sysdiagnose. The more expensive information added in this patch relates to information about live objects and memory on the JavaScript heap. * WebCore.xcodeproj/project.pbxproj: * page/PerformanceLogging.cpp: (WebCore::PerformanceLogging::memoryUsageStatistics): (WebCore::PerformanceLogging::javaScriptObjectCounts): (WebCore::PerformanceLogging::didReachPointOfInterest): * page/PerformanceLogging.h: 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure the transform fast path uses WebKitCSSTransformValue https://bugs.webkit.org/show_bug.cgi?id=165399 Reviewed by Dean Jackson. * css/parser/CSSParserFastPaths.cpp: (WebCore::parseTransformTranslateArguments): (WebCore::parseTransformNumberArguments): (WebCore::parseSimpleTransformValue): (WebCore::parseSimpleTransformList): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix calc() with -webkit-line-clamp https://bugs.webkit.org/show_bug.cgi?id=165398 Reviewed by Zalan Bujtas. Remove the aggressive token type checking up front, since it was causing calc() to not be allowed. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeLineClamp): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-text-decoration https://bugs.webkit.org/show_bug.cgi?id=165391 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseShorthand): 2016-12-05 Beth Dakin <bdakin@apple.com> STP 19 fails to launch on 16B255 https://bugs.webkit.org/show_bug.cgi?id=165388 -and corresponding- rdar://problem/29514476 Rubber-stamped by Brady Eidson. * platform/spi/cocoa/NSTouchBarSPI.h: 2016-12-05 Beth Dakin <bdakin@apple.com> STP 19 fails to launch on 16B255 https://bugs.webkit.org/show_bug.cgi?id=165388 -and corresponding- rdar://problem/29514476 Reviewed by Tim Horton. Speculative fix. * platform/spi/cocoa/NSTouchBarSPI.h: 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the 'alphabetic' keyword for text-underline-position https://bugs.webkit.org/show_bug.cgi?id=165387 Reviewed by Simon Fraser. Fixes fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-underline-position.html * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix assert when unknown properties are encountered. https://bugs.webkit.org/show_bug.cgi?id=165385 Reviewed by Zalan Bujtas. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationProperty): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix rx and ry parsing https://bugs.webkit.org/show_bug.cgi?id=165383 Reviewed by Dean Jackson. * css/parser/CSSParserFastPaths.cpp: (WebCore::isSimpleLengthPropertyID): rx and ry can be negative in the slow path, so make sure they can be negative in the fast path too. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeRxOrRy): Disallow auto as a value since we are not equipped to handle it, and it's not clear if it's even valid. 2016-12-05 Konstantin Tokarev <annulen@yandex.ru> Add __STDC_FORMAT_MACROS before inttypes.h is included https://bugs.webkit.org/show_bug.cgi?id=165374 We need formatting macros like PRIu64 to be available in all places where inttypes.h header is used. All these usages get inttypes.h definitions via wtf/Assertions.h header, except SQLiteFileSystem.cpp where formatting macros are not used anymore since r185129. This patch fixes multiple build errors with MinGW and reduces number of independent __STDC_FORMAT_MACROS uses in the code base. Reviewed by Darin Adler. No new tests needed. * platform/sql/SQLiteFileSystem.cpp: Removed unused inttypes.h inclusion. 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Properly fail on bad values for -webkit-clip-path https://bugs.webkit.org/show_bug.cgi?id=165382 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBasicShapeOrBox): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] The page-break-* properties are only keyword props for old parser. https://bugs.webkit.org/show_bug.cgi?id=165381 Reviewed by Dean Jackson. * css/parser/CSSParser.cpp: (WebCore::isKeywordPropertyID): * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isKeywordPropertyID): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Don't use CSS_PARSER_INTEGER unit for resolved integer calcs. https://bugs.webkit.org/show_bug.cgi?id=165379 Reviewed by Dean Jackson. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber): 2016-12-05 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add parseValue support to new parser. Use new parser for UA sheet too if useNewParser is set. https://bugs.webkit.org/show_bug.cgi?id=165376 Reviewed by Zalan Bujtas. * css/StyleColor.cpp: (WebCore::StyleColor::isColorKeyword): Include system colors when using the fast parseValue path. * css/parser/CSSParser.cpp: (WebCore::CSSParser::setupParser): Add an assert to catch any code path using the old parser when the new parser flag is set. (WebCore::CSSParser::parseSheet): (WebCore::CSSParser::parseRule): (WebCore::CSSParser::parseKeyframeRule): (WebCore::CSSParser::parseSupportsCondition): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseSelector): (WebCore::CSSParser::parseDeclaration): Patched to use the new parser in UASheetMode as well as other modes when the new parser flag is set. parseValue is patched to use the new parser's fast paths and to call into CSSParserImpl's parseValue. * css/parser/CSSParserFastPaths.cpp: (WebCore::isSimpleLengthPropertyID): Support CSSPropertyShapeMargin in the fast path since the old parser did in its fast path. (WebCore::parseSimpleLengthValue): Don't ever return unitless numbers. If we accept a unitless number, convert the unit to PX still. (WebCore::CSSParserFastPaths::parseColor): Use the CSSValuePool when creating colors on the fast path. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseValue): * css/parser/CSSParserImpl.h: Change the return type to be compatible with the old parser's ParseResult flag. 2016-12-05 Konstantin Tokarev <annulen@yandex.ru> Removed MediaPlayerPrivateTaskTimer https://bugs.webkit.org/show_bug.cgi?id=165373 Reviewed by Sam Weinig. It is not used anywhere since QTSDK removal in r165476. No new tests needed. * platform/graphics/win/MediaPlayerPrivateTaskTimer.cpp: Removed. * platform/graphics/win/MediaPlayerPrivateTaskTimer.h: Removed. 2016-12-04 Dave Hyatt <hyatt@apple.com> [CSS Parser] Eliminate in-place lowercasing in the parser. https://bugs.webkit.org/show_bug.cgi?id=165368 Reviewed by Darin Adler. Replace the in-place lowercasing that the parser does with new mechanisms. In-place lowercasing ruins serialization and doesn't work on CSS parsed from static strings. It also has the side effect of mutating strings passed in from JavaScript like for querySelectorAll. For class/id selectors, we now check if the string is lowercase or not. If it contains uppercase ASCII characters, then we allocate the RareData for the selector. RareData now has two fields instead of one for the value, a matching value (all lowercase in quirks mode), and a serializing value (the original string). Because this is done at the CSSSelector level, the old parser has been patched as well for these cases. In addition, in-place lowercasing was done for pseudo-elements, for media query features, and for attr(). In all of these cases we do lowercase converting by first checking if it's needed. Serialization will not retain the original string in these cases, so we may want to revisit these cases in the future and apply a solution similar to what we did for selectors. * css/CSSGrammar.y.in: * css/CSSSelector.cpp: (WebCore::CSSSelector::createRareData): (WebCore::CSSSelector::selectorText): (WebCore::CSSSelector::RareData::RareData): (WebCore::CSSSelector::RareData::~RareData): * css/CSSSelector.h: (WebCore::CSSSelector::RareData::create): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::value): (WebCore::CSSSelector::serializingValue): * css/MediaQueryExp.cpp: (WebCore::MediaQueryExpression::MediaQueryExpression): * css/parser/CSSParserToken.cpp: (WebCore::convertToASCIILowercaseInPlace): Deleted. (WebCore::CSSParserToken::convertToASCIILowercaseInPlace): Deleted. * css/parser/CSSParserToken.h: * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::setValue): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeAttr): * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeId): (WebCore::CSSSelectorParser::consumeClass): (WebCore::CSSSelectorParser::consumePseudo): * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::readFeature): 2016-12-04 Gyuyoung Kim <gyuyoung.kim@webkit.org> Fix a build break on EFL since r209303. Unreviewed build fix. * bindings/js/SerializedScriptValue.cpp: (WebCore::exceptionForSerializationFailure): Add a return in the end of function. 2016-12-03 Dan Bernstein <mitz@apple.com> [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI https://bugs.webkit.org/show_bug.cgi?id=165276 <rdar://problem/29467040> Reviewed by Darin Adler. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): Make sure to put the client data on the pasteboard, like we do on macOS. 2016-12-03 Dave Hyatt <hyatt@apple.com> [CSS Parser] Remove line numbers from StyleRule. https://bugs.webkit.org/show_bug.cgi?id=165361 Reviewed by Simon Fraser. StyleRules have a concept of a source line that is eventually passed to the inspector. This was only ever used by normal rules, i.e., ones with selectors, and set to 0 for all other rules. This line was set to the line number at which the end of the selector text occurred. Because Inspector already computes the start and end range for the selector text, storing a source line on StyleRule ends up being redundant. This patch gets rid of the source line and uses the end line of the selector text instead. * css/CSSGrammar.y.in: Remove the code that updates the last seen selector line. * css/CSSKeyframeRule.cpp: (WebCore::StyleKeyframe::StyleKeyframe): * css/CSSKeyframesRule.cpp: (WebCore::StyleRuleKeyframes::StyleRuleKeyframes): No longer need to pass in a 0 line number. * css/StyleRule.cpp: (WebCore::StyleRule::StyleRule): (WebCore::StyleRule::create): (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount): (WebCore::StyleRuleFontFace::StyleRuleFontFace): (WebCore::StyleRuleGroup::StyleRuleGroup): (WebCore::StyleRuleCharset::StyleRuleCharset): (WebCore::StyleRuleNamespace::StyleRuleNamespace): * css/StyleRule.h: (WebCore::StyleRuleBase::StyleRuleBase): (WebCore::StyleRuleBase::sourceLine): Deleted. * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::StyleRuleImport): Remove m_sourceLine and change the create methods and constructors to not require a line number. * css/parser/CSSParser.cpp: (WebCore::CSSParser::createStyleRule): Line number no longer needed. (WebCore::CSSParser::updateLastSelectorLineAndPosition): Deleted. * css/parser/CSSParser.h: Got rid of the function that tracks and updates the last seen selector line. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeStyleRule): Fix the rule creation in the new parser to not pass in a 0 line number. * inspector/InspectorStyleSheet.cpp: (WebCore::buildSourceRangeObject): (WebCore::InspectorStyleSheet::buildObjectForSelectorList): (WebCore::InspectorStyleSheet::buildObjectForRule): * inspector/InspectorStyleSheet.h: Patch the methods that build up the selector range to return the end line information for selector text so that it can be set as the source line for the rule (thus eliminating the need to store the line number on the style rule itself). 2016-12-02 Sam Weinig <sam@webkit.org> optional sequence values not handled correctly by binding generator https://bugs.webkit.org/show_bug.cgi?id=142562 Also fixes: Remove non-standard postMessage overload https://bugs.webkit.org/show_bug.cgi?id=161911 and Wrong argument order in window.postMessage https://bugs.webkit.org/show_bug.cgi?id=63141 Reviewed by Darin Adler. * WebCore.xcodeproj/project.pbxproj: Remove no longer needed files. * bindings/generic/IDLTypes.h: * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLObject>::convert): Add support for the WebIDL object type. * bindings/js/JSDOMBinding.cpp: (WebCore::createDOMException): Add support for throwing stack overflow errors. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::handlePostMessage): Deleted. (WebCore::JSDOMWindow::postMessage): Deleted. * bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp: Removed. * bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::postMessage): Deleted. (WebCore::extractTransferables): Deleted. * bindings/js/JSMessagePortCustom.h: Removed. * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorker::postMessage): Deleted. Remove custom bindings for postMessage. * bindings/js/SerializedScriptValue.h: Switch to using enum class. * bindings/js/SerializedScriptValue.cpp: (WebCore::SerializedScriptValue::transferArrayBuffers): (WebCore::SerializedScriptValue::create): Add new create function that takes the transfer list, processes it, and returns MessagePorts and SerializedScriptValue / exception. (WebCore::CloneBase::throwStackOverflow): Deleted. (WebCore::CloneDeserializer::throwValidationError): Deleted. Remove uncalled functions. * bindings/scripts/CodeGenerator.pm: (IsRefPtrType): (IsBuiltinType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Add support for the WebIDL 'object' type. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/TestObj.idl: Add tests for 'object'. * dom/ExceptionCode.h: Add two new ExceptionCodes: - ExistingExceptionError, to indicate that implementation code threw a JS exception. - StackOverflowError, to indicate that a stack overflow exception should be thrown. * dom/MessagePort.cpp: (WebCore::MessagePort::postMessage): * dom/MessagePort.h: * dom/MessagePort.idl: * page/DOMWindow.cpp: (WebCore::DOMWindow::postMessage): * page/DOMWindow.h: * page/DOMWindow.idl: * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::postMessage): * workers/DedicatedWorkerGlobalScope.h: * workers/DedicatedWorkerGlobalScope.idl: * workers/Worker.cpp: (WebCore::Worker::postMessage): * workers/Worker.h: * workers/Worker.idl: Update to call new SerializedScriptValue create function. 2016-12-03 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support Dashboard Regions https://bugs.webkit.org/show_bug.cgi?id=165357 Reviewed by Daniel Bates. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWebkitDashboardRegion): (WebCore::CSSPropertyParser::parseSingleValue): 2016-12-02 Simon Fraser <simon.fraser@apple.com> Improve the behavior of scroll-into-view when the target is inside position:fixed https://bugs.webkit.org/show_bug.cgi?id=165354 Reviewed by Zalan Bujtas. The existing RenderLayer::scrollRectToVisible() code paid no heed to whether the target was inside position:fixed, resulting in unwanted scrolls. Fix this by plumbing through from the call sites a "insideFixed" flag which we get when we call localToAbsolute(), and use this flag to avoid scrolling at all if unzoomed. If zoomed and we're focussing something inside position:fixed, and if visual viewports are enabled, we can compute the visual viewport required to reveal the target rect, which gives us the ideal scroll position. Fix a bug on non-iOS platforms when zoomed, which is to scale the viewRect since frameView.visibleContentRect() gives an unscaled rect on those platforms. Not all callers of scrollRectToVisible() are fixed, but those that are not will get the current behavior. Tests: fast/overflow/scroll-anchor-in-position-fixed.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html * dom/Element.cpp: (WebCore::Element::scrollIntoView): (WebCore::Element::scrollIntoViewIfNeeded): (WebCore::Element::scrollIntoViewIfNotVisible): (WebCore::Element::updateFocusAppearance): * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::absoluteCaretBounds): (WebCore::FrameSelection::recomputeCaretRect): (WebCore::FrameSelection::revealSelection): * editing/FrameSelection.h: * editing/VisiblePosition.cpp: (WebCore::VisiblePosition::absoluteCaretBounds): * editing/VisiblePosition.h: * editing/htmlediting.cpp: (WebCore::absoluteBoundsForLocalCaretRect): * editing/htmlediting.h: * page/FrameView.cpp: (WebCore::FrameView::scrollElementToRect): (WebCore::FrameView::scrollToAnchor): * page/PrintContext.cpp: (WebCore::PrintContext::outputLinkedDestinations): * rendering/RenderElement.cpp: (WebCore::RenderElement::getLeadingCorner): (WebCore::RenderElement::getTrailingCorner): (WebCore::RenderElement::absoluteAnchorRect): (WebCore::RenderElement::anchorRect): Renamed to absoluteAnchorRect(). * rendering/RenderElement.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollRectToVisible): (WebCore::RenderLayer::getRectToExpose): (WebCore::RenderLayer::autoscroll): * rendering/RenderLayer.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::scrollRectToVisible): * rendering/RenderObject.h: 2016-11-30 Simon Fraser <simon.fraser@apple.com> localToAbsolute() does incorrect conversion for elements inside position:fixed with zooming https://bugs.webkit.org/show_bug.cgi?id=165244 Reviewed by Zalan Bujtas. RenderView::mapLocalToContainer() and RenderView::mapAbsoluteToLocalPoint() handle the coordinate mapping through the RenderView's transform (when zoomed), and apply the scroll offset for position:fixed elements. They did this in the wrong order; "local to absolute" applied the zoom scale, and then adjusted for the scroll position, and "absolute to local" applied the scroll position and then the transform. However that scroll position adjustment should be in unzoomed coordinates, since it's accounting for the layout adjustment that position:fixed receives (which actually occurs via the localToAbsolute() call in RenderLayer's accumulateOffsetTowardsAncestor()). "local to absolute" should therefore apply the scroll adjustment first before the transform, and "absolute to local" the reverse. In both visual viewport mode, and legacy drifty fixed mode FrameView::scrollPositionForFixedPosition() returns a scroll offset that is unaffected by zoom, which is correct and confirms this change. [Confusingly, ScrollView scroll positions _are_ affected by zoom, as the entire document gets bigger.] RenderGeometryMap::mapToContainer(), which is an optimization on top of RenderView::mapLocalToContainer(), gets a similar fix. Test: fast/zooming/client-rect-in-fixed-zoomed.html * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): * rendering/RenderView.cpp: (WebCore::RenderView::mapLocalToContainer): (WebCore::RenderView::mapAbsoluteToLocalPoint): 2016-12-02 Simon Fraser <simon.fraser@apple.com> Put names on layers in release builds https://bugs.webkit.org/show_bug.cgi?id=165347 Reviewed by Tim Horton. Put names on GraphicsLayers (and therefore CALayers) in release builds. Release names are a simpler, truncated version of debug names, with <tagname> id class names. Non-primary layer names converted to lowercase and "layer" removed. Fix comments that refer to gdb. Use ENABLE(TREE_DEBUGGING) in more places. * dom/Node.h: * dom/Position.h: * dom/Range.h: * editing/FrameSelection.h: * editing/VisiblePosition.h: * editing/VisibleSelection.h: * history/HistoryItem.h: * page/FrameTree.h: * platform/graphics/GraphicsLayer.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setName): (WebCore::GraphicsLayerCA::setContentsToSolidColor): (WebCore::GraphicsLayerCA::updateNames): (WebCore::GraphicsLayerCA::updateBackdropFilters): (WebCore::GraphicsLayerCA::updateContentsImage): (WebCore::GraphicsLayerCA::updateClippingStrategy): (WebCore::GraphicsLayerCA::updateContentsRects): (WebCore::GraphicsLayerCA::changeLayerTypeTo): * platform/graphics/ca/TileController.cpp: (WebCore::TileController::tileGridContainerLayerName): (WebCore::TileController::zoomedOutTileGridContainerLayerName): (WebCore::TileController::createTileLayer): * rendering/CounterNode.h: * rendering/InlineBox.h: * rendering/InlineFlowBox.h: * rendering/RenderCounter.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::name): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::createGraphicsLayer): (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): (WebCore::RenderLayerBacking::updateAncestorClippingLayer): (WebCore::RenderLayerBacking::updateDescendantClippingLayer): (WebCore::RenderLayerBacking::updateForegroundLayer): (WebCore::RenderLayerBacking::updateBackgroundLayer): (WebCore::RenderLayerBacking::updateMaskingLayer): (WebCore::RenderLayerBacking::updateChildClippingStrategy): (WebCore::RenderLayerBacking::updateScrollingLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea): (WebCore::RenderLayerCompositor::updateLayerForHeader): (WebCore::RenderLayerCompositor::updateLayerForFooter): (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): (WebCore::RenderLayerCompositor::ensureRootLayer): * rendering/RenderObject.h: 2016-12-02 Antoine Quint <graouts@apple.com> [Modern Media Controls] Update the media controls size as the media element is resized https://bugs.webkit.org/show_bug.cgi?id=165346 Reviewed by Dean Jackson. The "resize" event dispatched by HTMLMediaElement indicates a change in the media's intrinsic size, while the "resize" event dispatched by the HTMLMediaElement's ShadowRoot indicates that the layout size of the media element has changed. We now use the latter. * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype.handleEvent): 2016-12-02 Andy Estes <aestes@apple.com> [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting https://bugs.webkit.org/show_bug.cgi?id=164492 Reviewed by Dan Bernstein. * Configurations/WebCore.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to com.apple.$(PRODUCT_NAME:rfc1034identifier). * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}. 2016-12-02 Chris Dumez <cdumez@apple.com> HTML Interactive Form Validation popovers do not show in iOS WKWebViews https://bugs.webkit.org/show_bug.cgi?id=165340 <rdar://problem/29489966> Reviewed by Simon Fraser. HTML Interactive Form Validation popovers do not show in iOS WKWebViews, only in MobileSafari. To address the issue try to find an appropriate UIViewController to present the popover when the client does not provide a presenting view controller. * platform/ValidationBubble.h: * platform/ios/ValidationBubbleIOS.mm: (WebCore::fallbackViewController): (WebCore::ValidationBubble::setAnchorRect): * platform/spi/ios/UIKitSPI.h: 2016-12-02 Zalan Bujtas <zalan@apple.com> Remove redundant LayoutUnit conversions. https://bugs.webkit.org/show_bug.cgi?id=165338 Reviewed by Simon Fraser. RenderBlockFlow::computeColumnCountAndWidth has some redundant LayoutUnti <-> unsigned conversions. No change in functionality. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::computeColumnCountAndWidth): 2016-12-02 Antoine Quint <graouts@apple.com> [Modern Media Controls] Add rewind and fast-forward support https://bugs.webkit.org/show_bug.cgi?id=165294 Reviewed by Dean Jackson. We implement support for rewinding and fast-forwarding the media by pressing dedicated buttons in fullscreen on macOS. We introduce a new SeekButton class that the existing RewindButton and ForwardButton classes now extend and which provides handling of "mousedown" and "mouseup" events to indicate that a button is being pressed to the UI delegate. We also introduce a new SeekSupport class from which SeekBackwardSupport and SeekForwardSupport inherit to integrate with those controls and update the media time. Tests: media/modern-media-controls/layout-node/layout-node-parent-of-type.html media/modern-media-controls/seek-backward-support/seek-backward-support.html media/modern-media-controls/seek-forward-support/seek-forward-support.html * Modules/modern-media-controls/controls/forward-button.js: * Modules/modern-media-controls/controls/layout-node.js: (LayoutNode.prototype.parentOfType): * Modules/modern-media-controls/controls/rewind-button.js: * Modules/modern-media-controls/controls/seek-button.js: Added. (SeekButton): (SeekButton.prototype.handleEvent): (SeekButton.prototype._didStartPressing): (SeekButton.prototype._didStopPressing): (SeekButton.prototype._notifyDelegateOfPressingState): * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._updateControlsIfNeeded): * Modules/modern-media-controls/media/seek-backward-support.js: Added. (SeekBackwardSupport.prototype.get control): (SeekBackwardSupport.prototype.get multiplier): (SeekBackwardSupport): * Modules/modern-media-controls/media/seek-forward-support.js: Added. (SeekForwardSupport.prototype.get control): (SeekForwardSupport.prototype.get multiplier): (SeekForwardSupport): * Modules/modern-media-controls/media/seek-support.js: Added. (SeekSupport.prototype.get multiplier): (SeekSupport.prototype.buttonPressedStateDidChange): (SeekSupport.prototype._startSeeking): (SeekSupport.prototype._stopSeeking): (SeekSupport.prototype._seek): (SeekSupport): * WebCore.xcodeproj/project.pbxproj: 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Need to set edit flags properly when user-modify/select are used. https://bugs.webkit.org/show_bug.cgi?id=165334 Reviewed by Dean Jackson. The old parser calls parserSetUsesStyleBasedEditability on StyleSheetContents* from inside isValidKeywordPropertyAndValue. This is pretty lame, but we have to do the same in order to pass editing layout tests. All of the functions below have been patched with the sole purpose of propagating StyleSheetContents* through to isValidKeywordPropertyAndValue in the new parser. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValueWithVariableReferences): * css/parser/CSSParser.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::parseKeywordValue): (WebCore::CSSParserFastPaths::maybeParseValue): * css/parser/CSSParserFastPaths.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeDeclarationValue): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::CSSPropertyParser): (WebCore::CSSPropertyParser::parseValue): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseFontFaceDescriptor): (WebCore::CSSPropertyParser::consumeFont): (WebCore::CSSPropertyParser::parseShorthand): * css/parser/CSSPropertyParser.h: 2016-12-02 Beth Dakin <bdakin@apple.com> REGRESSION (r208802): TouchBar pause button doesn't work https://bugs.webkit.org/show_bug.cgi?id=165333 -and corresponding- rdar://problem/29487187 Reviewed by Wenson Hsieh. The previous code got this right by using self.playing. _playing was totally un- used, so this patch just removes it. * platform/mac/WebPlaybackControlsManager.h: * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager setPlaying:]): 2016-12-02 John Wilander <wilander@apple.com> Require preflight for non-standard CORS-safelisted request headers Accept, Accept-Language, and Content-Language https://bugs.webkit.org/show_bug.cgi?id=165178 <rdar://problem/18792250> Reviewed by Youenn Fablet. Fetch currently only restricts the header Content-Type for simple requests: https://fetch.spec.whatwg.org/#cors-safelisted-request-header This means simple CORS requests can send unexpected characters in Accept, Accept-Language, and Content-Language header values. RFC 7231 implies restrictions on these header values: - Accept https://tools.ietf.org/html/rfc7231#section-5.3.2 - Accept-Language https://tools.ietf.org/html/rfc7231#section-5.3.5 - Content-Language https://tools.ietf.org/html/rfc7231#section-3.1.3.2 As per discussions in the W3C WebAppSec group we should try to restrict these header values to help protect servers that do not expect simple CORS requests. Non-standard, safelisted header values should trigger a preflight and require the headers to be whitelisted in the response's Access-Control-Allow-Headers. For Fetch in no-cors mode this change means non-standard header values are not allowed to be set. Test: http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html * loader/CrossOriginAccessControl.cpp: (WebCore::isSimpleCrossOriginAccessRequest): Now calls WebCore::isCrossOriginSafeRequestHeader() instead of WebCore::isOnAccessControlSimpleRequestHeaderWhitelist(). (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Deleted. It was a duplicate of WebCore::isCrossOriginSafeRequestHeader(). * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightResultCache.cpp: (WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders): Now calls WebCore::isCrossOriginSafeRequestHeader() instead of WebCore::isOnAccessControlSimpleRequestHeaderWhitelist(). * platform/network/HTTPParsers.cpp: (WebCore::isValidAcceptHeaderValue): Basic check that the characters are all ASCII alphanumeric, ' ', '*', '.', '/', ';', or '='. (WebCore::isValidLanguageHeaderValue): Basic check that the characters are all ASCII alphanumeric, ' ', '*', '-', '.', ';', or '='. (WebCore::isSimpleHeader): Removed duplicate code. Now calls WebCore::isCrossOriginSafeRequestHeader(). (WebCore::isCrossOriginSafeRequestHeader): Now makes a call to WebCore::isValidAcceptHeaderValue() for Accept headers and WebCore::isValidLanguageHeaderValue() for Accept-Language and Content-Language headers. * platform/network/HTTPParsers.h: 2016-12-02 Zalan Bujtas <zalan@apple.com> ASSERTION FAILED: flowThread->regionInRange(region, startRegion, endRegion) in WebCore::RenderBox::borderBoxRectInRegion https://bugs.webkit.org/show_bug.cgi?id=152113 <rdar://problem/27720221> Reviewed by David Hyatt. In a nested column context, do not process a spanner if it belongs to an inner column. While populating a flow, we search for possible spanners and construct multicolumnsets accordingly. However due to the top-down nature of populating flows, a descendant spanner could belong to an inner flow which hasn't been populated yet. This patch checks if a potential spanner has an ancestor (which is also a descendant of the flow that we are populating -> nested) that will eventually create a flow context. Test: fast/multicol/assert-with-nested-columns-and-spanner.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::computeColumnCountAndWidth): (WebCore::RenderBlockFlow::willCreateColumns): * rendering/RenderBlockFlow.h: * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::isValidColumnSpanner): 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure the z-component of transform-origin can be implicit https://bugs.webkit.org/show_bug.cgi?id=165326 Reviewed by Tim Horton. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeTransformOrigin): 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix :any/:host to allow pseudo-elements. Support -webkit-border-radius. https://bugs.webkit.org/show_bug.cgi?id=165323 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseShorthand): * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): 2016-12-02 Chris Dumez <cdumez@apple.com> [iOS] Tapping on an HTML validation bubble should dismiss it https://bugs.webkit.org/show_bug.cgi?id=165122 <rdar://problem/29429372> Reviewed by Simon Fraser. Tapping on an HTML validation bubble should dismiss it. Previously it did nothing. No new tests, I tried writing one but the validation popover does not show in the simulator, only on device. I believe at least one reason is that _presentingViewControllerForWebView() is required and is currently not implemented by WKTR. I'll look into this issue separately. * platform/ValidationBubble.h: * platform/ios/ValidationBubbleIOS.mm: (-[WebValidationBubbleTapRecognizer initWithPopoverController:withPopoverView:]): (-[WebValidationBubbleTapRecognizer dismissPopover]): (WebCore::ValidationBubble::ValidationBubble): 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add support for the SVG 'kerning' property https://bugs.webkit.org/show_bug.cgi?id=165315 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeKerning): (WebCore::CSSPropertyParser::parseSingleValue): 2016-12-02 Sam Weinig <sam@webkit.org> [WebIDL] Remove support for the 'Nondeterministic' extended attribute https://bugs.webkit.org/show_bug.cgi?id=165307 Reviewed by Chris Dumez. We are not currently using the WebReplay functionality that the Nondeterministic extended attribute is intended to aide. If we come back to WebReplay in the future, we can bring it back. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GenerateImplementationFunctionCall): (GetNativeTypeForMemoization): Deleted. * bindings/scripts/IDLAttributes.txt: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: Removed. * bindings/scripts/test/JS/JSTestNondeterministic.h: Removed. * bindings/scripts/test/TestNondeterministic.idl: Removed. * page/Navigator.idl: * page/Screen.idl: 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the -webkit-letterpress value for text-decoration https://bugs.webkit.org/show_bug.cgi?id=165313 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTextDecorationLine): 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix the color-gamut media query evaluator https://bugs.webkit.org/show_bug.cgi?id=165309 Reviewed by Zalan Bujtas). * css/MediaQueryEvaluator.cpp: (WebCore::colorGamutEvaluate): Unknown values should result in a failed match, not a successful match. 2016-12-02 Darin Adler <darin@apple.com> Remove use of WebCore::Dictionary in MediaSession https://bugs.webkit.org/show_bug.cgi?id=165296 Reviewed by Chris Dumez. I am not exactly sure of the status of this code. When I enabled it to test my changes it did not compile until I fixed some things, and it's far out of date of the latest draft of the Media Session Standard. But despite that I updated it. * DerivedSources.make: Removed a line that was breaking the build for some configurations, perhaps only for programmers from Apple, after r209198. * Modules/mediasession/MediaSession.cpp: (WebCore::MediaSession::MediaSession): Fixed so it compiles. (WebCore::MediaSession::setMetadata): Changed argument to use a struct rather htan a WebCore::Dictionary. * Modules/mediasession/MediaSession.h: Added a Metadata struct, and used it. Also fixed the arguments to the constructor. * Modules/mediasession/MediaSession.idl: Added MediaMetadata and used it instead of Dictionary. 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure margin and font set the implicit flag properly https://bugs.webkit.org/show_bug.cgi?id=165306 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeFont): (WebCore::CSSPropertyParser::consume4Values): 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure the templatized consumeIdent uses CSSValuePool https://bugs.webkit.org/show_bug.cgi?id=165302 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParserHelpers.h: (WebCore::CSSPropertyParserHelpers::consumeIdent): 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix font-variant parsing https://bugs.webkit.org/show_bug.cgi?id=165301 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontVariantEastAsian): (WebCore::CSSPropertyParser::consumeFontVariantShorthand): Fix a bug with font-variant-east-asian parsing where the id was getting improperly consumed even when it didn't match. 2016-12-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix animation property parsing https://bugs.webkit.org/show_bug.cgi?id=165305 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeAnimationPropertyList): Match the old parser by only creating a list for animation properties if there are two or more comma-separated values. Otherwise just return the CSSValue for the singleton without creating a list. 2016-12-02 Gustavo Sverzut Barbieri <barbieri@profusion.mobi> Fix build break when disabling some features. https://bugs.webkit.org/show_bug.cgi?id=165254 Reviewed by Michael Catanzaro. If we disable SVG_FONTS or XSLT, then WebCore::CachedResource::isCORSSameOrigin() would have assertions on non-existent members. These should be isolated within "#if" as the other places. If we're in DEVELOPER_MODE but did not provide TEST_HYPHENATAION_PATH, then we must mark UNUSED_PARAM() if we're not on GTK port (ie: EFL). No new tests as this is a build fix. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::isCORSSameOrigin): - missing #if ENABLED(SVG_FONTS) - missing #if ENABLED(XSLT) * platform/text/hyphen/HyphenationLibHyphen.cpp: (WebCore::scanTestDictionariesDirectoryIfNecessary): - missing UNUSED_PARAM() 2016-12-02 Miguel Gomez <magomez@igalia.com> [GTK] Use an OpenGL < 3.0 compliant way to request the OpenGL version https://bugs.webkit.org/show_bug.cgi?id=165253 Reviewed by Carlos Garcia Campos. Use glGetString(GL_VERSION) to get the OpenGL version, as glGetIntegerv with GL_MAJOR_VERSION and GL_MINOR_VERSION is only supported from 3.0 on. Covered by existent tests. * platform/graphics/GLContext.cpp: (WebCore::GLContext::version): 2016-12-02 Alex Christensen <achristensen@webkit.org> Fix WinCairo build after r208997 https://bugs.webkit.org/show_bug.cgi?id=165283 Reviewed by Carlos Garcia Campos. * platform/graphics/GLContext.cpp: glGetIntegerv is defined in gl2.h. GL_MAJOR_VERSION is defined in gl3.h. These are not included in the WinCairo build. 2016-11-30 Darin Adler <darin@apple.com> Stop using WebCore::Dictionary in bindings for Fetch https://bugs.webkit.org/show_bug.cgi?id=165241 Reviewed by Chris Dumez. * Modules/fetch/DOMWindowFetch.idl: Use RequestInit instead of Dictionary. No effect on code generated since this is a JSBuiltin. * Modules/fetch/FetchRequest.cpp: (WebCore::setReferrerPolicy): Deleted. Bindings handle this now. (WebCore::setMode): Ditto. (WebCore::setCredentials): Ditto. (WebCore::setCache): Ditto. (WebCore::setRedirect): Ditto. (WebCore::setReferrer): Changed argument from Dictionary to String. (WebCore::buildOptions): Changed argument from Dictionary to FetchRequest::Init, and simplified the code accordingly. (WebCore::FetchRequest::initializeOptions): Ditto. (WebCore::FetchRequest::initializeWith): Ditto. * Modules/fetch/FetchRequest.h: Updated for above changes. Also added the Init struct. * Modules/fetch/FetchRequest.idl: Added missing "only-if-cached" value to RequestCache. Added RequestInit dictionary and used it instead of Dictionary. Used more-specific string types for the method and referrer attributes; no effect at runtime, since the code for getters is the same for ByteString, USVString, and DOMString and these are read-only. * Modules/fetch/WorkerGlobalScopeFetch.idl: Use RequestInit instead of Dictionary. No effect on code generated since this is a JSBuiltin. 2016-12-01 Jiewen Tan <jiewen_tan@apple.com> Add a runtime flag for SubtleCrypto https://bugs.webkit.org/show_bug.cgi?id=164982 Reviewed by Brent Fulgham. * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setSubtleCryptoEnabled): (WebCore::RuntimeEnabledFeatures::subtleCryptoEnabled): * page/Crypto.idl: 2016-12-01 Saam Barati <sbarati@apple.com> Rename CallFrame::callee() to CallFrame::jsCallee() https://bugs.webkit.org/show_bug.cgi?id=165293 Reviewed by Keith Miller. * bindings/js/JSDOMConstructor.h: (WebCore::JSBuiltinConstructor<JSClass>::construct): * bindings/js/JSDataCueCustom.cpp: (WebCore::constructJSDataCue): * bindings/js/JSHTMLAllCollectionCustom.cpp: (WebCore::callHTMLAllCollection): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): * bindings/js/JSImageConstructor.cpp: (WebCore::JSImageConstructor::construct): * bindings/js/JSMutationObserverCustom.cpp: (WebCore::constructJSMutationObserver): * bindings/js/JSPluginElementFunctions.cpp: (WebCore::callPlugin): * bindings/js/JSWorkerCustom.cpp: (WebCore::constructJSWorker): * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinition): * bindings/scripts/test/JS/JSFloat64Array.cpp: (WebCore::JSFloat64ArrayConstructor::constructJSFloat64Array): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::JSTestEventConstructorConstructor::construct): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::construct): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::construct): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodeConstructor::construct): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::construct): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::constructJSTestOverloadedConstructors1): (WebCore::constructJSTestOverloadedConstructors2): (WebCore::constructJSTestOverloadedConstructors3): (WebCore::constructJSTestOverloadedConstructors4): (WebCore::constructJSTestOverloadedConstructors5): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::constructJSTestOverloadedConstructorsWithSequence1): (WebCore::constructJSTestOverloadedConstructorsWithSequence2): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefsConstructor::construct): * bridge/objc/objc_runtime.mm: (JSC::Bindings::callObjCFallbackObject): * bridge/runtime_method.cpp: (JSC::callRuntimeMethod): * bridge/runtime_object.cpp: (JSC::Bindings::callRuntimeObject): (JSC::Bindings::callRuntimeConstructor): 2016-12-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Fade controls in when entering and exiting fullscreen https://bugs.webkit.org/show_bug.cgi?id=165287 Reviewed by Dean Jackson. Fade controls in when we enter and leave fullscreen. Test: media/modern-media-controls/media-controller/media-controller-fade-controls-when-entering-fullscreen.html * Modules/modern-media-controls/controls/media-controls.css: (.media-controls.fade-in): (@keyframes fade-in): (to): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.prototype.presentInElement): * Modules/modern-media-controls/media/fullscreen-support.js: (FullscreenSupport.prototype.buttonWasClicked): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._updateControlsIfNeeded): 2016-12-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Show and populate the tracks panel https://bugs.webkit.org/show_bug.cgi?id=165284 Reviewed by Dean Jackson. We added a TracksPanel in https://bugs.webkit.org/show_bug.cgi?id=165239 which allows to show a list of media tracks and text tracks to choose from. We now show this panel when clicking on the tracks button in the controls bar and populate its content with the list of audio and text tracks for the media element. As an item is picked from the tracks panel, we toggle the represented track's enabled state and dismiss the panel. We also pick up the text track container display mostly unchanged from current media controls. Tests: media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html media/modern-media-controls/tracks-support/tracks-support-show-and-populate-panel.html * Modules/modern-media-controls/controls/macos-inline-media-controls.js: (MacOSInlineMediaControls.prototype.showTracksPanel): * Modules/modern-media-controls/controls/text-tracks.css: Added. (video::-webkit-media-text-track-container): (video::cue): (video::-webkit-media-text-track-display): (video::-webkit-media-text-track-display-backdrop): (video::cue(:future)): (video::-webkit-media-text-track-container b): (video::-webkit-media-text-track-container u): (video::-webkit-media-text-track-container i): (video::-webkit-media-text-track-container .hidden): * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/tracks-support.js: (TracksSupport): (TracksSupport.prototype.destroy): (TracksSupport.prototype.buttonWasClicked): (TracksSupport.prototype.tracksPanelNumberOfSections): (TracksSupport.prototype.tracksPanelTitleForSection): (TracksSupport.prototype.tracksPanelNumberOfTracksInSection): (TracksSupport.prototype.tracksPanelTitleForTrackInSection): (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected): (TracksSupport.prototype.tracksPanelSelectionDidChange): (TracksSupport.prototype.syncControl): (TracksSupport.prototype._textTracks): (TracksSupport.prototype._audioTracks): (TracksSupport.prototype._canPickAudioTracks): (TracksSupport.prototype._canPickTextTracks): (TracksSupport.prototype._sortedTrackList): 2016-12-01 Brent Fulgham <bfulgham@apple.com> Rare crash when preparing to print https://bugs.webkit.org/show_bug.cgi?id=165280 <rdar://problem/28240254> Reviewed by Dean Jackson. * page/Frame.cpp: (WebCore::Frame::setPrinting): Only manipulate the FrameView if it is non-null. (WebCore::Frame::documentAtPoint): Drive-by fix to change a 0 return to nullptr. 2016-12-01 Simon Fraser <simon.fraser@apple.com> Put an obvious debug border on layers with backdrop filters https://bugs.webkit.org/show_bug.cgi?id=165291 Reviewed by Tim Horton. Put a wide magenta border on layers with backdrop filters, to highlight their performance impact. Change the "contents layer" color (used by WebGL, video etc) to blue. Make the clipping layer border slightly narrower. * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::getDebugBorderInfo): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setBackdropFilters): 2016-12-01 Brian Burg <bburg@apple.com> Fix the Windows Release build after r209198 https://bugs.webkit.org/show_bug.cgi?id=165285 Unreviewed build fix. * Modules/webdriver/NavigatorWebDriver.cpp: Brute force include all the inlines to work around a JSC issue. 2016-12-01 Dave Hyatt <hyatt@apple.com> [CSS Parser] Only allow a single font-family in @font-face https://bugs.webkit.org/show_bug.cgi?id=165278 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontFamilyDescriptor): (WebCore::CSSPropertyParser::parseFontFaceDescriptor): 2016-12-01 Beth Dakin <bdakin@apple.com> Blacklist Netflix for TouchBar support https://bugs.webkit.org/show_bug.cgi?id=165104 Rubber-stamped by Tim Horton. Meant to not have the www. in the first case because that is covered by the second case. * html/HTMLMediaElement.cpp: (WebCore::needsPlaybackControlsManagerQuirk): 2016-12-01 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-overflow-scrolling: touch https://bugs.webkit.org/show_bug.cgi?id=165275 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-12-01 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::unwrapKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164747 <rdar://problem/29258198> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::unwrapKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-unwrapKey. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-unwrapKey. 2. It implements unwrapKey operations of the following algorithms: AES-KW. Tests: crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-private.html crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html crypto/subtle/aes-kw-generate-key-wrap-key-unwrap-key.html crypto/subtle/aes-kw-import-key-unwrap-raw-key.html crypto/subtle/rsa-oaep-import-key-unwrap-jwk-oct-key.html crypto/subtle/unwrapKey-malformed-parameters.html crypto/workers/subtle/aes-cbc-import-key-unwrap-key.html crypto/workers/subtle/aes-kw-import-key-unwrap-key.html crypto/workers/subtle/rsa-oaep-import-key-unwrap-key.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionWrapKeyPromise): Add some comments. (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise): (WebCore::JSSubtleCrypto::unwrapKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::unwrapKey): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::unwrapKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey): * crypto/mac/CryptoAlgorithmAES_KWMac.cpp: (WebCore::unwrapKeyAES_KW): (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey): (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): 2016-12-01 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix font-variant parsing https://bugs.webkit.org/show_bug.cgi?id=165266 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontVariantEastAsian): (WebCore::consumeFontVariantAlternates): (WebCore::consumeFontVariantPosition): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseFontFaceDescriptor): (WebCore::CSSPropertyParser::consumeFontVariantShorthand): (WebCore::consumeFontVariantList): Deleted. 2016-12-01 Brian Burg <bburg@apple.com> Web Automation: expose navigator.webdriver if the page is controlled by automation https://bugs.webkit.org/show_bug.cgi?id=165245 <rdar://problem/29449874> Reviewed by Joseph Pecoraro. Move the implementation into OpenSource. It's in Modules/webdriver/. * CMakeLists.txt: * DerivedSources.make: Add new paths and files. * Modules/webdriver/NavigatorWebDriver.cpp: Added. (WebCore::NavigatorWebDriver::NavigatorWebDriver): (WebCore::NavigatorWebDriver::~NavigatorWebDriver): (WebCore::NavigatorWebDriver::supplementName): (WebCore::NavigatorWebDriver::isControlledByAutomation): (WebCore::NavigatorWebDriver::from): (WebCore::JSNavigator::webdriver): * Modules/webdriver/NavigatorWebDriver.h: Added. * Modules/webdriver/NavigatorWebDriver.idl: Added. * WebCore.xcodeproj/project.pbxproj: 2016-12-01 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Implement IDBObjectStore.getKey(). https://bugs.webkit.org/show_bug.cgi?id=165256 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/idbobjectstore-getkey-1-private.html storage/indexeddb/modern/idbobjectstore-getkey-1.html * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::get): (WebCore::IDBObjectStore::getKey): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBObjectStore.idl: * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::createObjectStoreGet): (WebCore::IDBRequest::IDBRequest): (WebCore::IDBRequest::requestedObjectStoreRecordType): * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::requestGetRecord): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::didGetRecordOnServer): * Modules/indexeddb/IndexedDB.h: * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::getRecord): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/MemoryObjectStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::getRecord): (WebCore::IDBServer::UniqueIDBDatabase::performGetRecord): * Modules/indexeddb/server/UniqueIDBDatabase.h: * Modules/indexeddb/shared/IDBGetRecordData.cpp: (WebCore::IDBGetRecordData::isolatedCopy): * Modules/indexeddb/shared/IDBGetRecordData.h: (WebCore::IDBGetRecordData::encode): (WebCore::IDBGetRecordData::decode): 2016-12-01 Joseph Pecoraro <pecoraro@apple.com> Misc. cleanup in Modules/fetch https://bugs.webkit.org/show_bug.cgi?id=165240 Reviewed by Darin Adler. * Modules/fetch/DOMWindowFetch.h: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyConsumer.cpp: * Modules/fetch/FetchBodyOwner.cpp: * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchInternals.js: (consumeStream): * Modules/fetch/FetchLoader.cpp: * Modules/fetch/FetchResponse.h: Remove unnecessary includes and forward declarations. * Modules/fetch/DOMWindowFetch.js: (fetch): * Modules/fetch/FetchResponse.js: (initializeFetchResponse): * Modules/fetch/WorkerGlobalScopeFetch.js: (fetch): Improve style. 2016-12-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Turn off text selection https://bugs.webkit.org/show_bug.cgi?id=165261 Reviewed by Dean Jackson. We turn off text selection and force a non-text cursor for all text in media controls. Tests: media/modern-media-controls/airplay-placard/airplay-placard-text-section.html media/modern-media-controls/pip-placard/pip-placard-text-section.html media/modern-media-controls/status-label/status-label-text-selection.html * Modules/modern-media-controls/controls/media-controls.css: (.media-controls): 2016-12-01 Chris Dumez <cdumez@apple.com> Parameter to DOMStringList.contains() should be mandatory https://bugs.webkit.org/show_bug.cgi?id=165257 Reviewed by Alex Christensen. Parameter to DOMStringList.contains() should be mandatory. Gecko and Blink have it mandatory but WebKit had it optional and the string 'undefined" was used by default, which is not helpful. No new tests, updated existing test. * dom/DOMStringList.idl: 2016-12-01 Jiewen Tan <jiewen_tan@apple.com> SubtleCrypto::deriveBits always return NOT_SUPPORTED_ERR for now https://bugs.webkit.org/show_bug.cgi?id=164745 <rdar://problem/29258118> Reviewed by Darin Adler. Since we don't support any cryptography algorithms that has deriveBits operations, SubtleCrypto::deriveBits will always return NOT_SUPPORTED_ERR for now. Test: crypto/subtle/deriveBits-malformed-parameters.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise): (WebCore::JSSubtleCrypto::deriveBits): * crypto/SubtleCrypto.idl: 2016-12-01 Eric Carlson <eric.carlson@apple.com> [MediaStream][Mac] Video presets sometimes don't work https://bugs.webkit.org/show_bug.cgi?id=165214 <rdar://problem/29444533> Reviewed by Jer Noble. * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::setPreset): Set videoSettings width and height. (WebCore::AVVideoCaptureSource::setupCaptureSession): Store videoSettings object for later use. Set videoSettings width and height. (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): (WebCore::AVVideoCaptureSource::sizeForPreset): New. 2016-12-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Promote the "on" property from AirPlayButton to IconButton https://bugs.webkit.org/show_bug.cgi?id=165260 Reviewed by Dean Jackson. With the fix for https://bugs.webkit.org/show_bug.cgi?id=165239 we now set the "on" property for the TracksButton as well, so it makes sense to provide that property for all IconButton subclasses, not just AirplayButton. Test: media/modern-media-controls/icon-button/icon-button-on.html * Modules/modern-media-controls/controls/airplay-button.css: (button.airplay.on): * Modules/modern-media-controls/controls/airplay-button.js: (AirplayButton): (AirplayButton.prototype.get on): Deleted. (AirplayButton.prototype.set on): Deleted. * Modules/modern-media-controls/controls/icon-button.css: (button.icon:active,): (button.icon:active): Deleted. * Modules/modern-media-controls/controls/icon-button.js: (IconButton.prototype.get on): (IconButton.prototype.set on): 2016-11-30 Sam Weinig <sam@webkit.org> [WebIDL] Remove custom bindings for File and Blob constructors https://bugs.webkit.org/show_bug.cgi?id=165218 Reviewed by Darin Adler. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: Add/remove new files. * bindings/js/JSBlobCustom.cpp: (WebCore::constructJSBlob): Deleted. * bindings/js/JSFileCustom.cpp: Removed. Remove custom constructors. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateDictionaryImplementationContent): (GenerateParametersCheck): Add support for optional sequences without default values. Move string default value optimizations into GenerateDefaultValue. * fileapi/Blob.cpp: (WebCore::Blob::Blob): * fileapi/Blob.h: (WebCore::Blob::create): * fileapi/Blob.idl: * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: * fileapi/File.idl: Add support for the generated constructors. * fileapi/BlobBuilder.cpp: Copied from Source/WebCore/fileapi/WebKitBlobBuilder.cpp. * fileapi/BlobBuilder.h: Copied from Source/WebCore/fileapi/WebKitBlobBuilder.h. * fileapi/WebKitBlobBuilder.cpp: Removed. * fileapi/WebKitBlobBuilder.h: Removed. Rename WebKitBlobBuilder to BlobBuilder, and update to work with generated constructor. * fileapi/BlobPropertyBag.h: Added. * fileapi/BlobPropertyBag.idl: Added. Added. * fileapi/ThreadableBlobRegistry.cpp: (WebCore::ThreadableBlobRegistry::registerBlobURL): * fileapi/ThreadableBlobRegistry.h: * platform/network/BlobRegistry.h: * platform/network/BlobRegistryImpl.cpp: (WebCore::BlobRegistryImpl::registerBlobURL): * platform/network/BlobRegistryImpl.h: Avoid copies of the BlobPart Vector. * platform/network/BlobPart.h: Replace header-guards with #pragma once. 2016-12-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Provide a UI object to show a list of tracks https://bugs.webkit.org/show_bug.cgi?id=165239 Reviewed by Dean Jackson. We add a new TracksPanel object which we will be using to display a list of audio and text tracks. The tracks panel can be shown by calling showTracksPanel() on a MacOSMediaControls object and will be dismissed by hitting the Escape key or mousing down outside of the panel's bounds. While the tracks panel is up, arrows can be used to focus individual tracks which can be activated by either pressing the Space bar or Enter key. Activating a track will briefly animate its background to indicate selection and dismissing the tracks panel is also animated with a quick fade-out animation. Data for the tracks panel is provided by specifying a dataSource property and implementing the required methods to provide the number of sections in the panel, the number of tracks in each section, etc. Tests: media/modern-media-controls/tracks-panel/tracks-panel-hide-click-outside.html media/modern-media-controls/tracks-panel/tracks-panel-hide-esc-key.html media/modern-media-controls/tracks-panel/tracks-panel-hide.html media/modern-media-controls/tracks-panel/tracks-panel-population.html media/modern-media-controls/tracks-panel/tracks-panel-right-x.html media/modern-media-controls/tracks-panel/tracks-panel-select-track-with-keyboard.html media/modern-media-controls/tracks-panel/tracks-panel-select-track-with-mouse.html media/modern-media-controls/tracks-panel/tracks-panel.html * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: (.media-controls.mac.fullscreen): (.media-controls.mac.fullscreen > .controls-bar): (.media-controls.mac.fullscreen .tracks-panel): * Modules/modern-media-controls/controls/macos-inline-media-controls.css: (.media-controls.mac.inline .tracks-panel): * Modules/modern-media-controls/controls/macos-media-controls.js: (MacOSMediaControls.prototype.showTracksPanel): (MacOSMediaControls.prototype.hideTracksPanel): (MacOSMediaControls): * Modules/modern-media-controls/controls/media-controls.css: (.media-controls): * Modules/modern-media-controls/controls/placard.css: (.placard): * Modules/modern-media-controls/controls/status-label.css: (.status-label): * Modules/modern-media-controls/controls/tracks-panel.css: Added. (.tracks-panel): (.tracks-panel *): (.tracks-panel.fade-out): (.tracks-panel-section): (.tracks-panel-section:first-of-type): (.tracks-panel-section > h3): (.tracks-panel-section > ul): (.tracks-panel-section > ul > li): (.tracks-panel-section > ul > li:focus): (.tracks-panel-section > ul > li.selected:before): (.tracks-panel-section > ul > li.animated): (@keyframes tracks-panel-item-selection): (22.22%): * Modules/modern-media-controls/controls/tracks-panel.js: Added. (TracksPanel.prototype.get presented): (TracksPanel.prototype.presentInParent): (TracksPanel.prototype.hide): (TracksPanel.prototype.get rightX): (TracksPanel.prototype.set rightX): (TracksPanel.prototype.trackNodeSelectionAnimationDidEnd): (TracksPanel.prototype.mouseMovedOverTrackNode): (TracksPanel.prototype.mouseExitedTrackNode): (TracksPanel.prototype.commitProperty): (TracksPanel.prototype.handleEvent): (TracksPanel.prototype._childrenFromDataSource.): (TracksPanel.prototype._childrenFromDataSource): (TracksPanel.prototype._handleMousedown): (TracksPanel.prototype._handleKeydown): (TracksPanel.prototype._dismiss): (TracksPanel.prototype._focusTrackNode): (TracksPanel.prototype._focusPreviousTrackNode): (TracksPanel.prototype._focusNextTrackNode): (TracksPanel.prototype._focusFirstTrackNode): (TracksPanel.prototype._focusLastTrackNode): (TrackNode): (TrackNode.prototype.activate): (TrackNode.prototype.handleEvent): (TrackNode.prototype._animationDidEnd): * Modules/modern-media-controls/js-files: * WebCore.xcodeproj/project.pbxproj: 2016-12-01 Andreas Kling <akling@apple.com> Log some basic memory usage stats at interesting points in time <https://webkit.org/b/165206> Reviewed by Antti Koivisto. This patch adds a mechanism to mark points of interests where we might want to do performance-related logging: class PerformanceLogging { enum PointOfInterest { MainFrameLoadStarted, MainFrameLoadCompleted, } void didReachPointOfInterest(PointOfInterest) } You get to this object via MainFrame::performanceLogging(). We respond to these callbacks by logging some basic data about memory usage to the PerformanceLogging channel. More PointOfInterest values will be added soon. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::setState): * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): * page/MainFrame.h: * page/PerformanceLogging.cpp: Added. (WebCore::toString): (WebCore::getMemoryUsageStatistics): (WebCore::PerformanceLogging::PerformanceLogging): (WebCore::writeLog): (WebCore::PerformanceLogging::didReachPointOfInterest): (WebCore::PerformanceLogging::getPlatformMemoryUsageStatistics): * page/PerformanceLogging.h: Added. * page/cocoa/PerformanceLoggingCocoa.mm: Added. (WebCore::PerformanceLogging::getPlatformMemoryUsageStatistics): * platform/Logging.h: 2016-11-28 Sergio Villar Senin <svillar@igalia.com> [css-grid] Move more attributes from RenderGrid to the new Grid class https://bugs.webkit.org/show_bug.cgi?id=165094 Reviewed by Darin Adler. Moved more attributes from RenderGrid to Grid as they are not really part of the state of the RenderGrid object. In particular m_autoRepeat{Columns|Rows}, m_autoRepeatEmpty{Columns|Rows} and m_orderIterator. All of them are now private attributes of the Grid class so clients should use the getters/setters provided by this patch. This change allows to definitely remove the grid{Column|Row}Count() methods from RenderGrid. These two became Grid::numTracks() which returns the number of tracks in the data structure used to represent the grid (currently a matrix). Contrary to that, RenderGrid::numTracks() returns the actual size of the grid. No new tests as this is a refactoring. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::Grid::numTracks): (WebCore::RenderGrid::Grid::ensureGridSize): (WebCore::RenderGrid::Grid::setAutoRepeatTracks): (WebCore::RenderGrid::Grid::autoRepeatTracks): (WebCore::RenderGrid::Grid::setAutoRepeatEmptyColumns): (WebCore::RenderGrid::Grid::setAutoRepeatEmptyRows): (WebCore::RenderGrid::Grid::hasAutoRepeatEmptyTracks): (WebCore::RenderGrid::Grid::isEmptyAutoRepeatTrack): (WebCore::RenderGrid::Grid::autoRepeatEmptyTracks): (WebCore::RenderGrid::Grid::gridItemSpan): (WebCore::RenderGrid::Grid::clear): (WebCore::RenderGrid::RenderGrid): (WebCore::RenderGrid::computeTrackSizesForDirection): (WebCore::RenderGrid::guttersSize): (WebCore::RenderGrid::computeIntrinsicLogicalHeight): (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): (WebCore::RenderGrid::rawGridTrackSize): (WebCore::RenderGrid::gridTrackSize): (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): (WebCore::RenderGrid::placeItemsOnGrid): (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid): (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid): (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): (WebCore::RenderGrid::trackSizesForComputedStyle): (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild): (WebCore::RenderGrid::gridAreaBreadthForChild): (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets): (WebCore::RenderGrid::populateGridPositionsForDirection): (WebCore::RenderGrid::columnAxisOffsetForChild): (WebCore::RenderGrid::rowAxisOffsetForChild): (WebCore::RenderGrid::numTracks): (WebCore::RenderGrid::paintChildren): (WebCore::RenderGrid::gridColumnCount): Deleted. (WebCore::RenderGrid::gridRowCount): Deleted. (WebCore::RenderGrid::hasAutoRepeatEmptyTracks): Deleted. (WebCore::RenderGrid::isEmptyAutoRepeatTrack): Deleted. (WebCore::RenderGrid::cachedGridSpan): Deleted. * rendering/RenderGrid.h: (WebCore::RenderGrid::autoRepeatCountForDirection): Deleted. 2016-11-30 Brady Eidson <beidson@apple.com> Unreviewed, rolling out r209168. Caused 2 API tests to fail Reverted changeset: "IndexedDB: When doing puts, don't "updateAllIndexesForAddRecord" if there are no indexes." https://bugs.webkit.org/show_bug.cgi?id=165215 http://trac.webkit.org/changeset/209168 2016-11-30 Gyuyoung Kim <gyuyoung.kim@webkit.org> Build break when using --minimal https://bugs.webkit.org/show_bug.cgi?id=165238 Reviewed by Darin Adler. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): Use #if ENABLE(VIDEO_TRACK) guard. 2016-11-30 Antoine Quint <graouts@apple.com> [Modern Media Controls] Add support for right-to-left layouts https://bugs.webkit.org/show_bug.cgi?id=165229 Reviewed by Dean Jackson. We implement the "usesLTRUserInterfaceLayoutDirection" property which is set by HTMLMediaElement and set a CSS class when the layout is left-to-right, flipping the fullscreen volume slider in the case that it would not be present (right-to-left). Test: media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: (.media-controls.mac.fullscreen:not(.uses-ltr-user-interface-layout-direction) .volume.slider): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.prototype.get usesLTRUserInterfaceLayoutDirection): (MediaControls.prototype.set usesLTRUserInterfaceLayoutDirection): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.set usesLTRUserInterfaceLayoutDirection): (MediaController.prototype._updateControlsIfNeeded): 2016-11-30 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Remove unused parameter of InspectorInstrumentation::didFinishXHRLoading https://bugs.webkit.org/show_bug.cgi?id=165233 Reviewed by Brian Burg. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didFinishXHRLoading): * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didFinishXHRLoading): * inspector/InspectorNetworkAgent.h: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::didFinishLoading): Remove unused ThreadableLoaderClient parameter. 2016-11-30 Brady Eidson <beidson@apple.com> IndexedDB: When doing puts, don't "updateAllIndexesForAddRecord" if there are no indexes. https://bugs.webkit.org/show_bug.cgi?id=165215 Reviewed by Alex Christensen. No new tests (No observable behavior change). * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Don't "updateAllIndexesForAddRecord" if there are no indexes. Avoiding this saved us some IDBKey serialization and Javascript object manipulation. 2016-11-30 Antoine Quint <graouts@apple.com> [Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value https://bugs.webkit.org/show_bug.cgi?id=165236 Reviewed by Simon Fraser. Check that the new value is different than the current value before marking the property as dirty. * Modules/modern-media-controls/controls/layout-node.js: (LayoutNode.prototype.set x): (LayoutNode.prototype.set y): (LayoutNode.prototype.set width): (LayoutNode.prototype.set height): (LayoutNode.prototype.set visible): (performScheduledLayout): * Modules/modern-media-controls/controls/scheduler.js: (const.scheduler.new.prototype.get hasScheduledLayoutCallbacks): 2016-11-30 Jiewen Tan <jiewen_tan@apple.com> SubtleCrypto::deriveKey always return NOT_SUPPORTED_ERR for now https://bugs.webkit.org/show_bug.cgi?id=164744 <rdar://problem/29258083> Reviewed by Darin Adler. Since we don't support any cryptography algorithms that has deriveKey operations, SubtleCrypto::deriveKey will always return NOT_SUPPORTED_ERR for now. Test: crypto/subtle/deriveKey-malformed-parameters.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise): (WebCore::JSSubtleCrypto::deriveKey): * crypto/SubtleCrypto.idl: 2016-11-26 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::digest to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164742 <rdar://problem/29258037> Reviewed by Darin Adler. This patch updates the SubtleCrypto::digest method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-digest. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-digest. Currently supported digest algorithms are SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512. Tests: crypto/subtle/digest-malformed-parameters.html crypto/subtle/sha1-digest.html crypto/subtle/sha224-digest.html crypto/subtle/sha256-digest.html crypto/subtle/sha384-digest.html crypto/subtle/sha512-digest.html crypto/workers/subtle/sha1-digest.html crypto/workers/subtle/sha224-digest.html crypto/workers/subtle/sha256-digest.html crypto/workers/subtle/sha384-digest.html crypto/workers/subtle/sha512-digest.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::jsSubtleCryptoFunctionDigestPromise): (WebCore::JSSubtleCrypto::digest): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::digest): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::digest): * crypto/algorithms/CryptoAlgorithmSHA1.h: * crypto/algorithms/CryptoAlgorithmSHA224.cpp: (WebCore::CryptoAlgorithmSHA224::digest): * crypto/algorithms/CryptoAlgorithmSHA224.h: * crypto/algorithms/CryptoAlgorithmSHA256.cpp: (WebCore::CryptoAlgorithmSHA256::digest): * crypto/algorithms/CryptoAlgorithmSHA256.h: * crypto/algorithms/CryptoAlgorithmSHA384.cpp: (WebCore::CryptoAlgorithmSHA384::digest): * crypto/algorithms/CryptoAlgorithmSHA384.h: * crypto/algorithms/CryptoAlgorithmSHA512.cpp: (WebCore::CryptoAlgorithmSHA512::digest): * crypto/algorithms/CryptoAlgorithmSHA512.h: 2016-11-30 Antoine Quint <graouts@apple.com> [Modern Media Controls] UI Library: <audio> controls https://bugs.webkit.org/show_bug.cgi?id=164619 <rdar://problem/29207215> Reviewed by Dean Jackson. Add a default size for <audio> elements (200x50). Tests: media/modern-media-controls/audio/audio-controls-buttons.html media/modern-media-controls/audio/audio-controls-metrics.html * Modules/modern-media-controls/controls/media-controls.css: (:host(audio)): 2016-11-30 Brady Eidson <beidson@apple.com> REGRESSION (r209144): API test IndexedDB.DeleteRecovery failing. https://bugs.webkit.org/show_bug.cgi?id=165216 Rubberstamped by Tim Horton. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB): Change invalid ASSERT into a null check. 2016-11-30 Said Abou-Hallawa <sabouhallawa@apple.com> Add separate settings and preferences to enable/disable async decoding for large images and animated images https://bugs.webkit.org/show_bug.cgi?id=165177 Reviewed by Simon Fraser. Instead of having the async image decoding be controlled by one setting, two separate settings are added: largeImageAsyncDecodingEnabled animatedImageAsyncDecodingEnabled And an existing setting is removed: asyncImageDecodingEnabled * loader/cache/CachedImage.cpp: (WebCore::CachedImage::load): * loader/cache/CachedImage.h: * page/Settings.in: * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::internalStartAnimation): * platform/graphics/BitmapImage.h: * platform/graphics/ImageObserver.h: 2016-11-30 Zalan Bujtas <zalan@apple.com> ASSERTION FAILED: layoutState->m_renderer == this in WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage https://bugs.webkit.org/show_bug.cgi?id=155364 <rdar://problem/27720461> Reviewed by David Hyatt. RenderNamedFlowThread is considered to be a root for the current renderer context so we need to bail out from the containing block traversal here (like we do for the RenderView). Test: fast/replaced/replaced-element-with-percentage-width-inside-flow-asserts.html * rendering/RenderBox.cpp: (WebCore::RenderBox::computeReplacedLogicalHeightUsing): 2016-11-30 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Send operations off to the server in batches instead of one at a time. https://bugs.webkit.org/show_bug.cgi?id=165221 Reviewed by Myles C. Maxfield. No new tests (No observable behavior change). On a profile of "Lots of writes to an IndexedDB", timer scheduling/firing presented as over 10% of the time. This patch negates much of that. * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::pendingOperationTimerFired): Send 100 operations off to the server before spinning the runloop, instead of only 1. 2016-11-30 Antoine Quint <graouts@apple.com> [Modern Media Controls] Controls are not visible when returning from picture-in-picture playback https://bugs.webkit.org/show_bug.cgi?id=165183 Reviewed by Dean Jackson. We need to call MediaControlsHost::setPreparedToReturnVideoLayerToInline() when we return from picture-in-picture playback such that the video layer is correctly stacked under the media controls. We call that function in a rAF call to ensure it's performed in sync with the next scheduled layout or the media controls would not appear in sync with the video layer. We also fix an error from a previous commit in ControlsVisibilitySupport. * Modules/modern-media-controls/media/controls-visibility-support.js: (ControlsVisibilitySupport.prototype.syncControl): (ControlsVisibilitySupport): * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype.handleEvent): (MediaController.prototype._returnMediaLayerToInlineIfNeeded): 2016-11-30 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::wrapKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164746 <rdar://problem/29258160> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::wrapKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-wrapKey. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-wrapKey. 2. It implements wrapKey operations of the following algorithms: AES-KW. 3. It also replaces JSSubtleCrypto* with auto in all promise functions. Tests: crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html crypto/subtle/aes-kw-import-key-wrap-raw-key.html crypto/subtle/aes-kw-wrap-key-malformed-parameters.html crypto/subtle/rsa-oaep-import-key-wrap-jwk-oct-key.html crypto/subtle/wrapKey-malformed-parameters.html crypto/workers/subtle/aes-cbc-import-key-wrap-key.html crypto/workers/subtle/aes-kw-import-key-wrap-key.html crypto/workers/subtle/rsa-oaep-import-key-wrap-key.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::supportExportKeyThrow): (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::jsSubtleCryptoFunctionDecryptPromise): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::jsSubtleCryptoFunctionWrapKeyPromise): (WebCore::JSSubtleCrypto::wrapKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::wrapKey): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::wrapKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_KW::platformWrapKey): * crypto/mac/CryptoAlgorithmAES_KWMac.cpp: (WebCore::wrapKeyAES_KW): (WebCore::CryptoAlgorithmAES_KW::platformWrapKey): (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): 2016-11-29 Sam Weinig <sam@webkit.org> [WebIDL] Add support for more missing / exotic IDLTypes https://bugs.webkit.org/show_bug.cgi?id=165156 Reviewed by Alex Christensen. - Adds JSDOMConvert support for WebIDL's 'callback interface' and 'callback function'. - Adds JSDOMConvert support for WebIDL extensions for SerializedScriptValue, Dictionary, EventListener and XPathNSResolver (moving much of their special casing out of perl and into JSDOMConvert). * DerivedSources.make: Adds $(WebCore)/testing to the list of available IDL directories to keep internals compiling. * Modules/webaudio/WaveShaperNode.cpp: * Modules/webaudio/WaveShaperNode.h: Update to take curve by reference. * bindings/generic/IDLTypes.h: (WebCore::IDLWrapper): Add helper type, IDLWrapper, which serves as a base type for all IDLTypes that are RefCounted. * bindings/js/JSDOMConvert.h: (WebCore::convert): (WebCore::Converter<IDLNullable<T>>::convert): (WebCore::Converter<IDLCallbackFunction<T>>::convert): (WebCore::JSConverter<IDLCallbackFunction<T>>::convert): (WebCore::JSConverter<IDLCallbackFunction<T>>::convertNewlyCreated): (WebCore::Converter<IDLCallbackInterface<T>>::convert): (WebCore::JSConverter<IDLCallbackInterface<T>>::convert): (WebCore::JSConverter<IDLCallbackInterface<T>>::convertNewlyCreated): (WebCore::Converter<IDLSerializedScriptValue<T>>::convert): (WebCore::JSConverter<IDLSerializedScriptValue<T>>::convert): (WebCore::Converter<IDLLegacyDictionary<T>>::convert): (WebCore::Converter<IDLEventListener<T>>::convert): (WebCore::Converter<IDLXPathNSResolver<T>>::convert): (WebCore::JSConverter<IDLXPathNSResolver<T>>::convert): (WebCore::JSConverter<IDLXPathNSResolver<T>>::convertNewlyCreated): Add converters for the new types. IDLSerializedScriptValue, IDLLegacyDictionary, IDLEventListener and IDLXPathNSResolver have been templatized to avoid including their implementation classes everywhere. We can improve this in the future by splitting JSDOMConvert up into to separate files. * bindings/scripts/CodeGenerator.pm: (IsBuiltinType): (IsInterfaceType): (IsWrapperType): (ComputeIsCallbackInterface): (ComputeIsCallbackFunction): Add new predicates, IsBuiltinType and IsInterfaceType, and re-work IsWrapperType to determine all types that have a JS wrapper (and consequently a JS{name}.h file). * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): Update to add include for EventListener. (GetArgumentExceptionFunction): (GetArgumentExceptionThrower): (GetAttributeExceptionFunction): (GetAttributeExceptionThrower): Add support for exceptions for callbacks. (PassArgumentExpression): Factor out logic on how to pass arguments to C++. (GenerateHeader): Make toWrapped and JSDOMWrapperConverterTraits work with XPathNSResolver. (GenerateImplementation): Update to use PassArgumentExpression and pass a global object reference to JSValueToNative. (GenerateParametersCheck): Remove special casing for callbacks. (GenerateCallbackHeaderContent): (GenerateCallbackImplementationContent): Simplify toJS functions. State and global object are not necessary. (GetBaseIDLType): Add support for new types. Add assertion so that unknown types can't get through. (ShouldPassArgumentByReference): Rename from ShouldPassWrapperByReference, and merge in CodeGenerator's ShouldPassWrapperByReference. (JSValueToNativeDOMConvertNeedsThisObject): Added. Predicate to determine types that need a this object for conversion. (JSValueToNativeDOMConvertNeedsGlobalObject): Added. Predicate to determine types that need a global object for conversion. (JSValueToNative): Remove special cases for new types. (NativeToJSValueDOMConvertNeedsState): Add SerializedScriptValue and XPathNSResolver. (NativeToJSValueDOMConvertNeedsGlobalObject): Add SerializedScriptValue and XPathNSResolver. (NativeToJSValueUsingReferences): (NativeToJSValueUsingPointers): (NativeToJSValue): Remove unused $statePointer and replace $globalObject with $globalObjectReference. Remove special cases for new types. (GenerateConstructorDefinition): Use PassArgumentExpression. * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: * bindings/scripts/test/JS/JSTestCallbackFunction.h: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: * bindings/scripts/test/JS/JSTestCallbackInterface.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestSerializedScriptValueInterface.idl: Update tests. Remove test for a readonly attribute returning a Promise, which is not supported yet (this was caught by the assertion added to GetBaseIDLType). Add tests for passing and returning SerializedScriptValues from functions. 2016-11-30 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::verify to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164741 <rdar://problem/29257935> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::verify method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-verify. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-verify. 2. It implements verify operations of the following algorithms: HMAC, and RSASSA-PKCS1-V1_5. Tests: crypto/subtle/hmac-generate-key-sign-verify.html crypto/subtle/hmac-import-key-verify-sha1.html crypto/subtle/hmac-import-key-verify-sha224.html crypto/subtle/hmac-import-key-verify-sha256.html crypto/subtle/hmac-import-key-verify-sha384.html crypto/subtle/hmac-import-key-verify-sha512.html crypto/subtle/rsassa-pkcs1-v1_5-generate-key-sign-verify.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha1.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha224.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha256.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha384.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha512.html crypto/subtle/verify-malformed-parameters.html crypto/workers/subtle/hmac-import-key-verify.html crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-verify.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionVerifyPromise): (WebCore::JSSubtleCrypto::verify): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::verify): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::verify): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: (WebCore::CryptoAlgorithmHMAC::platformVerify): * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: (WebCore::CryptoAlgorithmHMAC::platformVerify): * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::CryptoAlgorithmHMAC::platformVerify): * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::verifyRSASSA_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): 2016-11-30 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix columns shorthand parsing https://bugs.webkit.org/show_bug.cgi?id=165210 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeColumns): (WebCore::consumeColumnWidthOrCount): Deleted. Bring over the old parser code, since it was actually better at creating implicit values for auto. 2016-11-30 Andy Estes <aestes@apple.com> [Cocoa] Pass the embedding app's bundle ID to new instances of NEFilterSource https://bugs.webkit.org/show_bug.cgi?id=165168 <rdar://problem/29003618> Reviewed by Simon Fraser. * platform/RuntimeApplicationChecks.h: Declared applicationBundleIdentifier(). * platform/RuntimeApplicationChecks.mm: (WebCore::applicationBundleIdentifier): Made non-static. * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::initialize): If the new NEFilterSource instance responds to -setSourceAppBundleID:, call it with applicationBundleIdentifier(). * platform/spi/cocoa/NEFilterSourceSPI.h: Moved NEFilterSourceOptionsRedirectURL into the !USE(APPLE_INTERNAL_SDK) section and unconditionally declared @property sourceAppBundleID in a new category on NEFilterSource. 2016-11-30 Brent Fulgham <bfulgham@apple.com> Use 'childOfType' template when retrieving Shadow DOM elements https://bugs.webkit.org/show_bug.cgi?id=165145 <rdar://problem/29331830> Reviewed by Antti Koivisto. Tests: fast/shadow-dom/color-input-element-shadow-manipulation.html fast/shadow-dom/file-input-element-shadow-manipulation.html fast/shadow-dom/keygen-shadow-manipulation.html fast/shadow-dom/media-shadow-manipulation.html fast/shadow-dom/range-input-element-shadow-manipulation.html fast/shadow-dom/textarea-shadow-manipulation.html Switch to using 'childOfType' when retrieving Shadow DOM elements, rather than relying on expected element positions, as these can be changed by JavaScript. Drive by fix: Make more use of is<> and downcast<> templates rather than blindly casting. * dom/Element.h: (WebCore::Element::isUploadButton): Added. (WebCore::Element::isSliderContainerElement): Added. * html/ColorInputType.cpp: (WebCore::ColorInputType::shadowColorSwatch): Use 'childOfType' rather than assuming the first child is the one we want. * html/FileInputType.cpp: (isType): Added. (WebCore::FileInputType::disabledAttributeChanged): Use 'childOfType' rather than assuming the first child is the one we want. (WebCore::FileInputType::multipleAttributeChanged): Ditto. * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::shadowSelect): Ditto. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaControls): Ditto. (WebCore::HTMLMediaElement::hasMediaControls): Ditto. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::innerTextElement): Ditto. * html/RangeInputType.cpp: (WebCore::RangeInputType::sliderTrackElement): Ditto. * html/shadow/SliderThumbElement.h: (isType): Added. * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::targetClone): Use 'childOfType' rather than assuming the first child is the one we want. 2016-11-30 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend. https://bugs.webkit.org/show_bug.cgi?id=164974 Reviewed by Alex Christensen. No new tests (No behavior change other than being faster). Instead of building new SQLiteStatements from scratch each time they're needed and then finalizing them after they're used for a single operation, we cache them. For tests that do puts and/or gets in tight loops, this shows up as a 5%-20% speedup on profiles. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::~SQLiteIDBBackingStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore): (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement): (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB): (WebCore::IDBServer::queryForGetAllObjectStoreRecords): Deleted. * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 2016-11-30 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure -webkit-background-size coalesces identical values. https://bugs.webkit.org/show_bug.cgi?id=165207 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBackgroundSize): 2016-11-30 Eric Carlson <eric.carlson@apple.com> [MediaStream] Sync video preview layer and parent layer sizes https://bugs.webkit.org/show_bug.cgi?id=165139 Reviewed by Jer Noble. CALayer auto-resizing doesn't work on iOS, so manually reize the video capture preview layer whenever the background layer's bounds change. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Create layer observer. (WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Sync preview layer and background layer sizes. (WebCore::AVVideoSourcePreview::invalidate): Invalidate and clear observer. (-[WebCoreAVVideoCaptureSourceObserver initWithParent:]): (-[WebCoreAVVideoCaptureSourceObserver setParent:]): Add KVO bounds observer. (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Call parent when "bounds" changes. (-[WebCoreAVVideoCaptureSourceObserver actionForKey:]): Return nil to disable all animations. 2016-11-30 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix crash in -webkit-shape-outside parsing https://bugs.webkit.org/show_bug.cgi?id=165202 Reviewed by Dean Jackson. * css/CSSBasicShapes.cpp: (WebCore::buildSerializablePositionOffset): The old parser never passed in a singleton value ID for top/right/bottom/left. The new parser does, and it exposed a bug in the serialization code for shapes that didn't properly create the offset primitive value as a percentage in those cases. 2016-11-30 Carlos Garcia Campos <cgarcia@igalia.com> [GLIB] IndexedDB: Switch to use new encoder for IDBKeyData https://bugs.webkit.org/show_bug.cgi?id=165191 Reviewed by Sergio Villar Senin. Instead of using KeyedEncoder. * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::isLegacySerializedIDBKeyData): Helper function to check whether the given data were encoded with KeyedEncoder or not. (WebCore::serializedTypeForKeyType): Remove #ifdefs for CF and always use the new encoder. (WebCore::encodeKey): Ditto. (WebCore::serializeIDBKeyData): Ditto. (WebCore::decodeKey): Ditto. (WebCore::deserializeIDBKeyData): Ditto. 2016-11-30 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Null ResourceResponse Preflight requests cause crash https://bugs.webkit.org/show_bug.cgi?id=165120 <rdar://problem/27911350> Reviewed by Brian Burg. * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Only inform Web Inspector about successful responses. Informing with a null response would break the expected Inspector API contract when notifying about did receive response. Also, when informing Web Inspector include a didFinishLoading event so the frontend knows this pre-flight request is complete. 2016-11-30 Brady Eidson <beidson@apple.com> REGRESSION (209086): IDB tests crash under GuardMalloc. https://bugs.webkit.org/show_bug.cgi?id=165201 Reviewed by Chris Dumez. No new tests (Covered by literally every IDB test when run under GuardMalloc). * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::commitOnServer): "Commit on Server" operations are special, in that they are the last operation a transaction does, and they remove themselves from the protector map right away. So when we remove them from the protector map we also need to remove their raw-pointer from the "in-progress" queue. 2016-11-30 Said Abou-Hallawa <sabouhallawa@apple.com> Some animated image do not animate after reseting their animations https://bugs.webkit.org/show_bug.cgi?id=165131 Reviewed by Simon Fraser. Test: fast/images/reset-image-animation.html The bug happens because the ImageFrameCache does not reset its cached frames properly when the BitmapImage rests its animation. -- We need to ignore caching the new NativeImage of an ImageFrame if the decoding thread is terminated after asynchronously calling cacheFrameNativeImageAtIndex() on the main thread through callOnMainThread(). Although the decoding thread was terminated this call is still scheduled to be executed later on the main thread. -- We need to open the m_frameRequestQueue before starting a new decoding thread. Opening m_frameRequestQueue clears the enqueued requests from the previous decoding thread and allows enqueueing requests for the new thread. -- We need to clear the ImageFrames which were being decoded at the time the decoding queue was closing and their new NativeImages were not cached. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Assert the NativeImage is cached for an ImageFrame which is still being decoded. (WebCore::ImageFrameCache::startAsyncDecodingQueue): Open the m_frameRequestQueue before starting the decoding thread. Don't cache the NativeImage of an ImageFrame unless the decoding thread is still alive and it the same as the one that makes the asynchronous call to cacheFrameNativeImageAtIndex(). (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Don't request an image frame to be be asynchronously decoded if it is already being decoded. (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Clear the ImageFrames that were being decoded when the decoding thread terminates. * testing/Internals.cpp: (WebCore::Internals::resetImageAnimation): * testing/Internals.h: * testing/Internals.idl: Expose BitmapImage::resetAnimation() through Internals so tests can force it. 2016-11-30 Darin Adler <darin@apple.com> Streamline and speed up tokenizer and segmented string classes https://bugs.webkit.org/show_bug.cgi?id=165003 Reviewed by Sam Weinig. Profiling Speedometer on my iMac showed the tokenizer as one of the hottest functions. This patch streamlines the segmented string class, removing various unused features, and also improves some other functions seen on the Speedometer profile. On my iMac I measured a speedup of about 3%. Changes include: - Removed m_pushedChar1, m_pushedChar2, and m_empty data members from the SegmentedString class and all the code that used to handle them. - Simplified the SegmentedString advance functions so they are small enough to get inlined in the HTML tokenizer. - Updated callers to call the simpler SegmentedString advance functions that don't handle newlines in as many cases as possible. - Cut down on allocations of SegmentedString and made code move the segmented string and the strings that are moved into it rather than copying them whenever possible. - Simplified segmented string functions, removing some branches, mostly from the non-fast paths. - Removed small unused functions and small functions used in only one or two places, made more functions private and renamed for clarity. * bindings/js/JSHTMLDocumentCustom.cpp: (WebCore::documentWrite): Moved a little more of the common code in here from the two functions belwo. Removed obsolete comment saying this was not following the DOM specification because it is. Removed unneeded special cases for 1 argument and no arguments. Take a reference instead of a pointer. (WebCore::JSHTMLDocument::write): Updated for above. (WebCore::JSHTMLDocument::writeln): Ditto. * css/parser/CSSTokenizer.cpp: Added now-needed include. * css/parser/CSSTokenizer.h: Removed unneeded include. * css/parser/CSSTokenizerInputStream.h: Added definition of kEndOfFileMarker here; this is now separate from the use in the HTMLParser. In the long run, unclear to me whether it is really needed in either. * dom/Document.cpp: (WebCore::Document::prepareToWrite): Added. Helper function used by the three different variants of write. Using this may prevent us from having to construct a SegmentedString just to append one string after future refactoring. (WebCore::Document::write): Updated to take an rvalue reference and move the value through. (WebCore::Document::writeln): Use a single write call instead of two. * dom/Document.h: Changed write to take an rvalue reference to SegmentedString rather than a const reference. * dom/DocumentParser.h: Changed insert to take an rvalue reference to SegmentedString. In the future, should probably overload to take a single string since that is the normal case. * dom/RawDataDocumentParser.h: Updated for change to DocumentParser. * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocumentParser::append): Refactored a bit, just enough so that we don't need an assignment operator for SegmentedString that can copy a String. * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::insert): Updated to take an rvalue reference, and move the value through. * html/parser/HTMLDocumentParser.h: Updated for the above. * html/parser/HTMLEntityParser.cpp: (WebCore::HTMLEntityParser::consumeNamedEntity): Updated for name changes. Changed the twao calls to advance here to call advancePastNonNewline; no change in behavior, but asserts what the code was assuming before, that the character was not a newline. * html/parser/HTMLInputStream.h: (WebCore::HTMLInputStream::appendToEnd): Updated to take an rvalue reference, and move the value through. (WebCore::HTMLInputStream::insertAtCurrentInsertionPoint): Ditto. (WebCore::HTMLInputStream::markEndOfFile): Removed the code to construct a SegmentedString, overkill since we can just append an individual string. (WebCore::HTMLInputStream::splitInto): Rewrote the move idiom here to actually use move, which will reduce reference count churn and other unneeded work. * html/parser/HTMLMetaCharsetParser.cpp: (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Removed unneeded construction of a SegmentedString, just to append a string. * html/parser/HTMLSourceTracker.cpp: (WebCore::HTMLSourceTracker::HTMLSourceTracker): Moved to the class definition. (WebCore::HTMLSourceTracker::source): Updated for function name change. * html/parser/HTMLSourceTracker.h: Updated for above. * html/parser/HTMLTokenizer.cpp: Added now-needed include. (WebCore::HTMLTokenizer::emitAndResumeInDataState): Use advancePastNonNewline, since this function is never called in response to a newline character. (WebCore::HTMLTokenizer::commitToPartialEndTag): Ditto. (WebCore::HTMLTokenizer::commitToCompleteEndTag): Ditto. (WebCore::HTMLTokenizer::processToken): Use ADVANCE_PAST_NON_NEWLINE_TO macro instead of ADVANCE_TO in cases where the character we are advancing past is known not to be a newline, so we can use the more efficient advance function that doesn't check for the newline character. * html/parser/InputStreamPreprocessor.h: Moved kEndOfFileMarker to SegmentedString.h; not sure that's a good place for it either. In the long run, unclear to me whether this is really needed. (WebCore::InputStreamPreprocessor::peek): Added UNLIKELY for the empty check. Added LIKELY for the not-special character check. (WebCore::InputStreamPreprocessor::advance): Updated for the new name of the advanceAndUpdateLineNumber function. (WebCore::InputStreamPreprocessor::advancePastNonNewline): Added. More efficient than advance for cases where the last characer is known not to be a newline character. (WebCore::InputStreamPreprocessor::skipNextNewLine): Deleted. Was unused. (WebCore::InputStreamPreprocessor::reset): Deleted. Was unused except in the constructor; added initial values for the data members to replace. (WebCore::InputStreamPreprocessor::processNextInputCharacter): Removed long FIXME comment that didn't really need to be here. Reorganized a bit. (WebCore::InputStreamPreprocessor::isAtEndOfFile): Renamed and made static. * html/track/BufferedLineReader.cpp: (WebCore::BufferedLineReader::nextLine): Updated to not use the poorly named scanCharacter function to advance past a newline. Also renamed from getLine and changed to return Optional<String> instead of using a boolean to indicate failure and an out argument. * html/track/BufferedLineReader.h: (WebCore::BufferedLineReader::BufferedLineReader): Use the default, putting initial values on each data member below. (WebCore::BufferedLineReader::append): Updated to take an rvalue reference, and move the value through. (WebCore::BufferedLineReader::scanCharacter): Deleted. Was poorly named, and easy to replace with two lines of code at its two call sites. (WebCore::BufferedLineReader::reset): Rewrote to correctly clear all the data members of the class, not just the segmented string. * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Updated to take an rvalue reference and move the value through. * html/track/InbandGenericTextTrack.h: Updated for the above. * html/track/InbandTextTrack.h: Updated since parseWebVTTFileHeader now takes an rvalue reference. * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::parseFileHeader): Updated to take an rvalue reference and move the value through. (WebCore::WebVTTParser::parseBytes): Updated to pass ownership of the string in to the line reader append function. (WebCore::WebVTTParser::parseCueData): Use auto and WTFMove for WebVTTCueData. (WebCore::WebVTTParser::flush): More of the same. (WebCore::WebVTTParser::parse): Changed to use nextLine instead of getLine. * html/track/WebVTTParser.h: Updated for the above. * html/track/WebVTTTokenizer.cpp: (WebCore::advanceAndEmitToken): Use advanceAndUpdateLineNumber by its new name, just advance. No change in behavior. (WebCore::WebVTTTokenizer::WebVTTTokenizer): Pass a String, not a SegmentedString, to add the end of file marker. * platform/graphics/InbandTextTrackPrivateClient.h: Updated since parseWebVTTFileHeader takes an rvalue reference. * platform/text/SegmentedString.cpp: (WebCore::SegmentedString::Substring::appendTo): Moved here from the header. The only caller is SegmentedString::toString, inside this file. (WebCore::SegmentedString::SegmentedString): Deleted the copy constructor. No longer needed. (WebCore::SegmentedString::operator=): Defined a move assignment operator rather than an ordinary assignment operator, since that's what the call sites really need. (WebCore::SegmentedString::length): Simplified since we no longer need to support pushed characters. (WebCore::SegmentedString::setExcludeLineNumbers): Simplified, since we can just iterate m_otherSubstrings without an extra check. Also changed to write directly to the data member of Substring instead of using a function. (WebCore::SegmentedString::updateAdvanceFunctionPointersForEmptyString): Added. Used when we run out of characters. (WebCore::SegmentedString::clear): Removed code to clear now-deleted members. Updated for changes to other member names. (WebCore::SegmentedString::appendSubstring): Renamed from just append to avoid ambiguity with the public append function. Changed to take an rvalue reference, and move in, and added code to set m_currentCharacter properly, so the caller doesn't have to deal with that. (WebCore::SegmentedString::close): Updated to use m_isClosed by its new name. Also removed unneeded comment about assertion that fires when trying to close an already closed string. (WebCore::SegmentedString::append): Added overloads for rvalue references of both entire SegmentedString objects and of String. Streamlined to just call appendSubstring and append to the deque. (WebCore::SegmentedString::pushBack): Tightened up since we don't allow empty strings and changed to take just a string, not an entire segmented string. (WebCore::SegmentedString::advanceSubstring): Moved logic into the advancePastSingleCharacterSubstringWithoutUpdatingLineNumber function. (WebCore::SegmentedString::toString): Simplified now that we don't need to support pushed characters. (WebCore::SegmentedString::advancePastNonNewlines): Deleted. (WebCore::SegmentedString::advance8): Deleted. (WebCore::SegmentedString::advanceWithoutUpdatingLineNumber16): Renamed from advance16. Simplified now that there are no pushed characters. Also changed to access data members of m_currentSubstring directly instead of calling a function. (WebCore::SegmentedString::advanceAndUpdateLineNumber8): Deleted. (WebCore::SegmentedString::advanceAndUpdateLineNumber16): Ditto. (WebCore::SegmentedString::advancePastSingleCharacterSubstringWithoutUpdatingLineNumber): Renamed from advanceSlowCase. Removed uneeded logic to handle pushed characters. Moved code in here from advanceSubstring. (WebCore::SegmentedString::advancePastSingleCharacterSubstring): Renamed from advanceAndUpdateLineNumberSlowCase. Simplified by calling the function above. (WebCore::SegmentedString::advanceEmpty): Broke assertion up into two. (WebCore::SegmentedString::updateSlowCaseFunctionPointers): Updated for name changes. (WebCore::SegmentedString::advancePastSlowCase): Changed name and meaning of boolean argument. Rewrote to use the String class less; it's now used only when we fail to match after the first character rather than being used for the actual comparison with the literal. * platform/text/SegmentedString.h: Moved all non-trivial function bodies out of the class definition to make things easier to read. Moved the SegmentedSubstring class inside the SegmentedString class, making it a private struct named Substring. Removed the m_ prefix from data members of the struct, removed many functions from the struct and made its union be anonymous instead of naming it m_data. Removed unneeded StringBuilder.h include. (WebCore::SegmentedString::isEmpty): Changed to use the length of the substring instead of a separate boolean. We never create an empty substring, nor leave one in place as the current substring unless the entire segmented string is empty. (WebCore::SegmentedString::advancePast): Updated to use the new member function template instead of a non-template member function. The new member function is entirely rewritten and does the matching directly rather than allocating a string just to do prefix matching. (WebCore::SegmentedString::advancePastLettersIgnoringASCIICase): Renamed to make it clear that the literal must be all non-letters or lowercase letters as with the other "letters ignoring ASCII case" functions. The three call sites all fit the bill. Implement by calling the new function template. (WebCore::SegmentedString::currentCharacter): Renamed from currentChar. (WebCore::SegmentedString::Substring::Substring): Use an rvalue reference and move the string in. (WebCore::SegmentedString::Substring::currentCharacter): Simplified since this is never used on an empty substring. (WebCore::SegmentedString::Substring::incrementAndGetCurrentCharacter): Ditto. (WebCore::SegmentedString::SegmentedString): Overload to take an rvalue reference. Simplified since there are now fewer data members. (WebCore::SegmentedString::advanceWithoutUpdatingLineNumber): Renamed from advance, since this is only safe to use if there is some reason it is OK to skip updating the line number. (WebCore::SegmentedString::advance): Renamed from advanceAndUpdateLineNumber, since doing that is the normal desired behavior and not worth mentioning in the public function name. (WebCore::SegmentedString::advancePastNewline): Renamed from advancePastNewlineAndUpdateLineNumber. (WebCore::SegmentedString::numberOfCharactersConsumed): Greatly simplified since pushed characters are no longer supported. (WebCore::SegmentedString::characterMismatch): Added. Used by advancePast. * xml/parser/CharacterReferenceParserInlines.h: (WebCore::unconsumeCharacters): Use toString rather than toStringPreserveCapacity because the SegmentedString is going to take ownership of the string. (WebCore::consumeCharacterReference): Updated to use the pushBack that takes just a String, not a SegmentedString. Also use advancePastNonNewline. * xml/parser/MarkupTokenizerInlines.h: Added ADVANCE_PAST_NON_NEWLINE_TO. * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::insert): Updated since this takes an rvalue reference. (WebCore::XMLDocumentParser::append): Removed unnecessary code to create a SegmentedString. * xml/parser/XMLDocumentParser.h: Updated for above. Also fixed indentation and initialized most data members. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::XMLDocumentParser): Moved most data member initialization into the class definition. (WebCore::XMLDocumentParser::resumeParsing): Removed code that copied a segmented string, but converted the whole thing into a string before using it. Now we convert to a string right away. 2016-11-30 Csaba Osztrogonác <ossy@webkit.org> Unreviewed speculative cmake buildfix after r209070. * PlatformMac.cmake: New sources added. 2016-11-29 Philippe Normand <pnormand@igalia.com> [WebRTC][OpenWebRTC] Temporary device selection support https://bugs.webkit.org/show_bug.cgi?id=165141 Reviewed by Alejandro G. Castro. Make sure the player handles only one audio and video track at most for now. The device choice can be influenced with the WEBKIT_VIDEO_DEVICE and WEBKIT_AUDIO_DEVICE environment variables. Each variable optionally holds the name of the device to use. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::play): (WebCore::MediaPlayerPrivateGStreamerOwr::load): 2016-11-29 Claudio Saavedra <csaavedra@igalia.com> Build fix with !HAVE(ACCESSIBILITY) * accessibility/AXObjectCache.h: (WebCore::AccessibilityReplacedText::AccessibilityReplacedText): (WebCore::AccessibilityReplacedText::postTextStateChangeNotification): Add dummy implementations. 2016-11-29 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r209058 and r209074. https://bugs.webkit.org/show_bug.cgi?id=165188 These changes caused API test StringBuilderTest.Equal to crash and/or fail. (Requested by ryanhaddad on #webkit). Reverted changesets: "Streamline and speed up tokenizer and segmented string classes" https://bugs.webkit.org/show_bug.cgi?id=165003 http://trac.webkit.org/changeset/209058 "REGRESSION (r209058): API test StringBuilderTest.Equal crashing" https://bugs.webkit.org/show_bug.cgi?id=165142 http://trac.webkit.org/changeset/209074 2016-11-29 Nan Wang <n_wang@apple.com> AX: ARIA tree & treeitem roles & aria-expanded state not spoken to VoiceOver iOS 10 https://bugs.webkit.org/show_bug.cgi?id=164936 <rdar://problem/29334274> Reviewed by Chris Fleizach. Added a new container type on iOS for trees. Also, since the treeitem role is ignored on iOS, we should expose the expanded status of a treeitem to its accessible children. Test: accessibility/ios-simulator/treeitem-expanded.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]): (-[WebAccessibilityObjectWrapper treeItemParentForObject:]): (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]): (-[WebAccessibilityObjectWrapper accessibilityIsExpanded]): 2016-11-29 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r209096, r209104, and r209114. Caused over 200 layout test failures on the bots Reverted changesets: "IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend." https://bugs.webkit.org/show_bug.cgi?id=164974 http://trac.webkit.org/changeset/209096 "Followup to:" https://bugs.webkit.org/show_bug.cgi?id=164974 http://trac.webkit.org/changeset/209104 "REGRESSION (r209104): storage/indexeddb/modern/gc-closes- database(-private).html timeout." https://bugs.webkit.org/show_bug.cgi?id=165186 http://trac.webkit.org/changeset/209114 2016-11-29 Antoine Quint <graouts@apple.com> [Modern Media Controls] Localization https://bugs.webkit.org/show_bug.cgi?id=165176 Reviewed by Dean Jackson. We add a new localization file for the purpose of modern media controls, since we may require different strings than the legacy one. * English.lproj/modern-media-controls-localized-strings.js: Added. * Modules/modern-media-controls/controls/airplay-placard.js: (AirplayPlacard): * Modules/modern-media-controls/controls/pip-placard.js: (PiPPlacard): * Modules/modern-media-controls/main.js: (UIString): * Modules/modern-media-controls/media/status-support.js: (StatusSupport.prototype.syncControl): (StatusSupport): * WebCore.xcodeproj/project.pbxproj: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsScript): 2016-11-29 Antoine Quint <graouts@apple.com> [Modern Media Controls] Show an invalid placard when we fail to load a media file https://bugs.webkit.org/show_bug.cgi?id=165180 Reviewed by Dean Jackson. We now show a placard with an "invalid" icon when we fail to load the media file. Tests: media/modern-media-controls/invalid-placard/invalid-placard.html media/modern-media-controls/placard-support/placard-support-error.html * Modules/modern-media-controls/controls/icon-service.js: * Modules/modern-media-controls/controls/invalid-placard.js: Added. (InvalidPlacard): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.prototype.get showsStartButton): (MediaControls.prototype.set showsStartButton): (MediaControls.prototype.get showsPlacard): (MediaControls.prototype.hidePlacard): (MediaControls.prototype._invalidateChildren): * Modules/modern-media-controls/controls/placard.css: (.placard .icon): * Modules/modern-media-controls/images/iOS/invalid-placard@1x.png: Added. * Modules/modern-media-controls/images/iOS/invalid-placard@2x.png: Added. * Modules/modern-media-controls/images/iOS/invalid-placard@3x.png: Added. * Modules/modern-media-controls/images/macOS/invalid-placard@1x.png: Added. * Modules/modern-media-controls/images/macOS/invalid-placard@2x.png: Added. * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/placard-support.js: (PlacardSupport.prototype.get mediaEvents): (PlacardSupport.prototype._updatePlacard): (PlacardSupport): * WebCore.xcodeproj/project.pbxproj: 2016-11-29 Antoine Quint <graouts@apple.com> [Modern Media Controls] Only show controls when the controls attribute is set https://bugs.webkit.org/show_bug.cgi?id=165175 We now respect the value of the media's "controls" attribute so that the start button and the controls bar are only shown when that attribute is set to "true". Reviewed by Dean Jackson. Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-off-audio.html media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-off.html media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio.html media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on.html media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-toggle.html * Modules/modern-media-controls/controls/controls-bar.js: Added. (ControlsBar): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.): Deleted. * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/controls-visibility-support.js: Added. (ControlsVisibilitySupport): (ControlsVisibilitySupport.prototype.destroy): (ControlsVisibilitySupport.prototype.get mediaEvents): (ControlsVisibilitySupport.prototype.syncControl): * Modules/modern-media-controls/media/media-controller-support.js: (MediaControllerSupport): (MediaControllerSupport.prototype.handleEvent): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._updateControlsIfNeeded): * WebCore.xcodeproj/project.pbxproj: 2016-11-29 Brady Eidson <beidson@apple.com> Followup to: IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend. https://bugs.webkit.org/show_bug.cgi?id=164974 Unreviewed. * Modules/indexeddb/IDBTransaction.h: Until I can explore further why these operations are not protected in the map, change these raw pointers to RefPtrs. This fixes issues seen under GuardMalloc. 2016-11-29 Antoine Quint <graouts@apple.com> [Modern Media Controls] Inline controls show when entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=165161 Reviewed by Dean Jackson. We would error when entering fullscreen due to the TracksSupport having its destroy() method called when tearing down the inline controls and the `mediaController` reference being incorrect. * Modules/modern-media-controls/media/tracks-support.js: (TracksSupport.prototype.destroy): 2016-11-29 Antoine Quint <graouts@apple.com> [Modern Media Controls] Status text stuck saying "Loading" after media starts playing https://bugs.webkit.org/show_bug.cgi?id=165162 Reviewed by Dean Jackson. We forgot to handle the case where none of the special messages need to be set and the status text should be just an empty string, meaning there is no status text shown in the controls bar and the scrubber appears instead. Test: media/modern-media-controls/status-support/status-support-playing.html * Modules/modern-media-controls/media/status-support.js: (StatusSupport.prototype.syncControl): (StatusSupport): 2016-11-29 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend. https://bugs.webkit.org/show_bug.cgi?id=164974 Reviewed by Alex Christensen. No new tests (No behavior change other than being faster). Instead of building new SQLiteStatements from scratch each time they're needed and then finalizing them after used for a single operation, cache them. For tests that do puts and/or gets in tight loops, this shows up as a 5%-20% speedup on profiles. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore): (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement): (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB): (WebCore::IDBServer::queryForGetAllObjectStoreRecords): Deleted. * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 2016-11-22 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::sign to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164740 <rdar://problem/29257864> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::sign method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-sign. 2. It implements sign operations of the following algorithms: HMAC, and RSASSA-PKCS1-V1_5. 3. It also replaces promise.copyRef() with WTFMove(promise) for all the capture lists of exception callbacks in promise functions. Tests: crypto/subtle/hmac-import-key-sign-sha1.html crypto/subtle/hmac-import-key-sign-sha224.html crypto/subtle/hmac-import-key-sign-sha256.html crypto/subtle/hmac-import-key-sign-sha384.html crypto/subtle/hmac-import-key-sign-sha512.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html crypto/subtle/sign-malformed-parameters.html crypto/workers/subtle/hmac-import-key-sign.html crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionDecryptPromise): Fix a minor bug. (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::jsSubtleCryptoFunctionDecryptPromise): (WebCore::jsSubtleCryptoFunctionSignPromise): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::jsSubtleCryptoFunctionImportKeyPromise): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::JSSubtleCrypto::sign): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::sign): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::sign): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: (WebCore::CryptoAlgorithmHMAC::platformSign): * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: (WebCore::CryptoAlgorithmHMAC::platformSign): * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::commonCryptoHMACAlgorithm): (WebCore::calculateSignature): Remove a null guardance since the depending bug is resolved. (WebCore::CryptoAlgorithmHMAC::platformSign): (WebCore::CryptoAlgorithmHMAC::platformVerify): * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::signRSASSA_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): 2016-11-29 Chris Dumez <cdumez@apple.com> Can't download move.simple.com direct deposit transition PDF: Non user-triggered activations of anchors that have a download attribute are ignored https://bugs.webkit.org/show_bug.cgi?id=165148 <rdar://problem/29421771> Reviewed by Daniel Bates. We were ignoring non user-triggered activations of anchors that have a download attribute which is stricter than Chrome and Firefox and breaks downloads on move.simple.com. This patch relaxes our policy to allow simulated clicks on such links, similarly to other browsers. Web authors can anyway already trigger downloads using script by setting window.location to a specific URL and serving to right HTTP headers to trigger a download. Note that our previous behavior matches the current version of the specification so I also filed a bug against the HTML specification to see if we can get it changed to match the behavior of browsers: - https://github.com/whatwg/html/issues/2116 No new tests, updated existing test. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2016-11-29 Andy Estes <aestes@apple.com> [Cocoa] Enable two clang warnings recommended by Xcode https://bugs.webkit.org/show_bug.cgi?id=164498 Reviewed by Mark Lam. * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE. 2016-11-29 Wenson Hsieh <wenson_hsieh@apple.com> Address post-review feedback following r209070 (AppKit momentum scrolling adoption for scroll snapping) https://bugs.webkit.org/show_bug.cgi?id=165147 Reviewed by Simon Fraser. Addresses some additional review feedback after r209070, which adopts _NSScrollingMomentumCalculator for scroll snapping. See individual changes below for more details. No new tests, since there is no behavior change. * page/EventHandler.cpp: (WebCore::handleWheelEventInAppropriateEnclosingBox): (WebCore::EventHandler::defaultWheelEventHandler): * page/Page.cpp: (WebCore::Page::ensureTestTrigger): * page/WheelEventDeltaFilter.cpp: (WebCore::WheelEventDeltaFilter::filteredVelocity): * page/WheelEventDeltaFilter.h: * page/mac/WheelEventDeltaFilterMac.mm: (WebCore::WheelEventDeltaFilterMac::updateFromDelta): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Rather than force a complete layout pass when the Page first acquires a WheelEventTestTrigger, we now simply have the scrolling coordinator update its frame node to expect a wheel event test trigger. * page/scrolling/ScrollingMomentumCalculator.cpp: (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator): (WebCore::ScrollingMomentumCalculator::create): (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator): (WebCore::BasicScrollingMomentumCalculator::scrollOffsetAfterElapsedTime): (WebCore::BasicScrollingMomentumCalculator::animationDuration): (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve): (WebCore::BasicScrollingMomentumCalculator::animationProgressAfterElapsedTime): * page/scrolling/ScrollingMomentumCalculator.h: * page/scrolling/mac/ScrollingMomentumCalculatorMac.h: * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm: (WebCore::ScrollingMomentumCalculator::create): (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac): (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime): (WebCore::ScrollingMomentumCalculatorMac::animationDuration): (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator): * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::copyWithDeltasAndVelocity): (WebCore::PlatformWheelEvent::scrollingVelocity): Change scrolling velocity in PlatformWheelEvent to be a FloatSize instead of a FloatPoint. This change propagates to the ScrollController, where state variables and arguments pertaining to scrolling velocity are also now sizes instead of points. * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::scheduleStatelessScrollSnap): * platform/cocoa/ScrollSnapAnimatorState.h: * platform/cocoa/ScrollSnapAnimatorState.mm: (WebCore::ScrollSnapAnimatorState::transitionToGlideAnimationState): (WebCore::ScrollSnapAnimatorState::setupAnimationForState): (WebCore::ScrollSnapAnimatorState::teardownAnimationForState): (WebCore::ScrollSnapAnimatorState::currentAnimatedScrollOffset): Refactor elapsed time to be Seconds instead of double. Additionally, use MonotonicTime::now() instead of monotonicallyIncreasingTime(), and MonotonicTime instead of double for keeping track of the start time. * platform/spi/mac/NSScrollingMomentumCalculatorSPI.h: 2016-11-29 Brady Eidson <beidson@apple.com> IndexedDB 2.0: The client's transaction operation queue should flush as much to the server as possible. https://bugs.webkit.org/show_bug.cgi?id=164932 Reviewed by Alex Christensen. No new tests (No new test necessary, covered extensively by all existing tests). Profiles showed that on tests with lots of rapid IDBRequests in a row, both the main thread and database threads were largely idle. The explanation was simple. Currently the client IDBTransaction queues up operations and only vends them out to the server 1 at a time, waiting for the previous operation to complete. While some operations do need to wait for the server to reply, by making the change to send most operations (all operations with an associated IDBRequest) to the server without waiting we get rid of most of the idleness. It is possible we can find a few other types of operations to send without waiting, but we haven't yet seen any test case where they would show up on profiles. Sending more than one operation at a time was actually a very small part of this change. As many "edge case" regression tests revealed, we also needed to start having IDBTransaction track all of their "in progress" operations such that they could be aborted on the client side in exceptional circumstances. * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::abortInProgressOperations): Abort's all in-progress operations (ones that have already been sent to the server) (WebCore::IDBTransaction::abortOnServerAndCancelRequests): Abort in-progress operations before pending ones. (WebCore::IDBTransaction::operationTimerFired): If we just started an operation with an associated IDBRequest, schedule the timer to send another one right away. (WebCore::IDBTransaction::operationDidComplete): (WebCore::IDBTransaction::connectionClosedFromServer): Abort in-progress operations before pending ones. * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/TransactionOperation.cpp: (WebCore::IDBClient::TransactionOperation::TransactionOperation): * Modules/indexeddb/client/TransactionOperation.h: (WebCore::IDBClient::TransactionOperation::completed): (WebCore::IDBClient::TransactionOperation::hasIDBRequest): 2016-11-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix ::cue parsing https://bugs.webkit.org/show_bug.cgi?id=165152 Reviewed by Zalan Bujtas. * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::setPseudoElementType): * css/parser/CSSSelectorParser.cpp: (WebCore::isOnlyPseudoClassFunction): (WebCore::isOnlyPseudoElementFunction): (WebCore::CSSSelectorParser::consumePseudo): (WebCore::isPseudoClassFunction): Deleted. (WebCore::isPseudoElementFunction): Deleted. 2016-11-28 Gavin Barraclough <barraclough@apple.com> HTMLMediaElement::updateVolume should updateIsPlayingMedia https://bugs.webkit.org/show_bug.cgi?id=165132 Reviewed by Darin Adler & Jer Noble. HTMLMediaElement::mediaState takes the volume into account when determining whether media is playing (audio is not considered to be playing if volume is 0). As such, any change to the volume may require mediaState to be recomputed. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updateVolume): 2016-11-29 Daniel Bates <dabates@apple.com> Avoid ref-count churn in ShadowParseContext::commitColor() https://bugs.webkit.org/show_bug.cgi?id=165125 Reviewed by Simon Fraser. Avoid ref-count churn in ShadowParseContext::commitColor() by moving the passed color into its instance variable. Also modified ShadowParseContext::commitColor() to take a Ref<> instead of a RefPtr<> because it is never passed a nullptr. * css/parser/CSSParser.cpp: (WebCore::ShadowParseContext::commitColor): 2016-11-29 Daniel Bates <dabates@apple.com> Avoid ref-count churn in CSSParser::ValueWithCalculation::setCalculation() https://bugs.webkit.org/show_bug.cgi?id=165127 Reviewed by Simon Fraser. Use WTFMove() to move the passed RefPtr into CSSParser::ValueWithCalculation::m_calculation instead of copying it. * css/parser/CSSParser.h: (WebCore::CSSParser::ValueWithCalculation::setCalculation): 2016-11-29 Daniel Bates <dabates@apple.com> CryptoAlgorithm::generateKey() should take lvalue reference to const CryptoAlgorithmParameters https://bugs.webkit.org/show_bug.cgi?id=165111 Reviewed by Darin Adler. CryptoAlgorithm::generateKey() and its overrides always expect to receive a non-null pointer to a CryptoAlgorithmParameter object and never take ownership of it. This kind of relationship is best expressed by modifying CryptoAlgorithm::generateKey() to take a lvalue reference to a const CryptoAlgorithmParameter object. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::generateKey): * crypto/CryptoAlgorithm.h: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: 2016-11-29 Andy Estes <aestes@apple.com> window.name leaks information across domains https://bugs.webkit.org/show_bug.cgi?id=158216 <rdar://problem/14548481> Reviewed by Brent Fulgham. When updating the history after a cross-origin navigation, the HTML Standard says: "If the browsing context is a top-level browsing context, but not an auxiliary browsing context, then set the browsing context's name to the empty string." https://html.spec.whatwg.org/multipage/browsers.html#resetBCName Tests: http/tests/security/window-name-after-cross-origin-aux-frame-navigation.html http/tests/security/window-name-after-cross-origin-main-frame-navigation.html http/tests/security/window-name-after-cross-origin-sub-frame-navigation.html http/tests/security/window-name-after-same-origin-aux-frame-navigation.html http/tests/security/window-name-after-same-origin-main-frame-navigation.html http/tests/security/window-name-after-same-origin-sub-frame-navigation.html * loader/FrameLoader.cpp: (WebCore::shouldClearWindowName): Returns true if frame is a main frame with no opener and newDocument does not have the same origin as the frame's current document. (WebCore::FrameLoader::clear): Changed to set m_frame's name to nullAtom if clearWindowProperties and shouldClearWindowName() are true. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canAccessStorage): Changed to call isSameOriginAs() and check m_universalAccess. (WebCore::SecurityOrigin::isSameOriginAs): Renamed from isThirdParty(); removed the check for m_universalAccess. (WebCore::SecurityOrigin::isThirdParty): Renamed to isSameOriginAs(). * page/SecurityOrigin.h: Renamed isThirdParty() to isSameOriginAs() and made it public. 2016-11-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix parsing of "all" in transitions https://bugs.webkit.org/show_bug.cgi?id=165144 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTransitionProperty): 2016-11-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix @page rule parsing https://bugs.webkit.org/show_bug.cgi?id=165143 Reviewed by Zalan Bujtas. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parsePageSelector): 2016-11-29 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the build after r209070 -[ScrollingMomentumCalculatorMac calculateToReachDestination] is only available on Sierra. * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm: (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator): * platform/spi/mac/NSScrollingMomentumCalculatorSPI.h: 2016-11-28 Wenson Hsieh <wenson_hsieh@apple.com> Scroll snapping on Mac should use AppKit animations https://bugs.webkit.org/show_bug.cgi?id=147261 <rdar://problem/29395293> Reviewed by Brent Fulgham. Refactors the scroll snapping animation logic to support arbitrary scrolling momentum calculators and introduces ScrollingMomentumCalculatorMac, which wraps AppKit's _NSScrollingMomentumCalculator. On macOS El Capitan and later, we use the platform scrolling momentum calculator and for all other cases, we fall back to the preexissting platform-invariant momentum calculator. Previously, the scroll snapping animation logic was shared between the ScrollSnapAnimatorState and ScrollController -- namely, the ScrollController would update various parameters of the ScrollSnapAnimatorState and then tell it to compute animation-specific constants and coefficients. After this patch, ScrollController will no longer directly set the ScrollSnapAnimatorState's member variables. Instead, it will tell the animator state to transition to a new ScrollSnapState with the necessary parameters, and the ScrollSnapAnimatorState is responsible for modifying itself accordingly. Furthermore, logic pertaining to computing animated scroll offsets is now split out into a new ScrollingMomentumCalculator, which may have different platform-dependent implementations. The correct calculator is initialized via ScrollingMomentumCalculator::create, which currently returns a ScrollingMomentumCalculatorMac on El Capitan and later, and a BasicScrollingMomentumCalculator otherwise. The new abstracted ScrollingMomentumCalculator is initialized with various parameters describing the scrolled content and viewport, as well as the initial and target scrolling offsets. The momentum calculator is then able to compute the animated scroll offset at any given elapsed time, as well as the total duration of the snapping animation. The ScrollController's scroll snap timer uses this information (via the ScrollSnapAnimatorState) to animate its client's scroll offset during a snap or glide. Also reenables 8 failing and/or flaky scroll snapping tests and adds a new layout test. This patch addresses two causes for failures and flakiness in these scroll snapping tests: 1. When starting or stopping the scroll snap animation timer, we call deferTestsForReason and removeTestDeferralForReason, respectively. These were actually noops for the first simulated scroll gesture on each of the failing mainframe scrolling tests due to m_expectsWheelEventTestTrigger being false. This member variable is updated when AsyncScrollingCoordinator::frameViewLayoutUpdated is invoked, wherein we call ScrollingStateFrameScrollingNode::setExpectsWheelEventTestTrigger(true) when the test has started monitoring wheel events. However, if this does not happen before scrolling begins in the test (which is the case here), then the mainframe scrolling node will not expect a wheel event test trigger even though eventSender.monitorWheelEvents() has been called. To fix this, we simply make the Page trigger a layout of the main FrameView when first ensuring the wheel event test trigger on the Page. 2. The second reason for flakiness affects both overflow and mainframe scrolling. Previously, due to the way we would wait for multiple momentum scroll events before starting to glide, we would end up starting the scroll snap timer for a snapping animation, stopping it, and then starting it again for the glide animation. Thus, if the wheel event test trigger's timer fires right after the scroll snap timer stops and before it starts again due to a glide animation, it will erroneously think that scroll snapping is complete, even though it's only just about to begin! Now that we know scrolling velocity when we receive the initial "momentum begin", we now directly transition the scroll snap state from a snapping state to a gliding state and no longer stop and start the timer during this transition, which means that the test trigger will be deferred for at least the entire duration of the scroll snapping animation (starting right after the first "drag end" wheel event). Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-vertical-then-horizontal.html * WebCore.xcodeproj/project.pbxproj: * page/EventHandler.cpp: (WebCore::handleWheelEventInAppropriateEnclosingBox): (WebCore::EventHandler::defaultWheelEventHandler): * page/Page.cpp: (WebCore::Page::ensureTestTrigger): Addresses test failures by forcing the mainframe scrolling node to expect wheel event test triggers. * page/WheelEventDeltaFilter.cpp: (WebCore::WheelEventDeltaFilter::create): (WebCore::WheelEventDeltaFilter::filteredVelocity): * page/WheelEventDeltaFilter.h: * page/mac/WheelEventDeltaFilterMac.mm: (WebCore::WheelEventDeltaFilterMac::updateFromDelta): Add support for plumbing filtered scrolling velocity over to the ScrollController. * page/scrolling/ScrollingMomentumCalculator.cpp: Copied from Source/WebCore/platform/cocoa/ScrollSnapAnimatorState.mm. (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator): (WebCore::ScrollingMomentumCalculator::create): Creates a platform-independent BasicScrollingMomentumCalculator. (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator): (WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress): (WebCore::BasicScrollingMomentumCalculator::cubicallyInterpolatedOffsetAtProgress): (WebCore::BasicScrollingMomentumCalculator::scrollOffsetAfterElapsedTime): (WebCore::BasicScrollingMomentumCalculator::animationDuration): (WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary): (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve): (WebCore::BasicScrollingMomentumCalculator::animationProgressAfterElapsedTime): Interpolation logic ported over from ScrollSnapAnimatorState. * page/scrolling/ScrollingMomentumCalculator.h: Added. (WebCore::ScrollingMomentumCalculator::~ScrollingMomentumCalculator): * page/scrolling/mac/ScrollingMomentumCalculatorMac.h: Copied from Source/WebCore/page/WheelEventDeltaFilter.h. * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm: Added. (WebCore::ScrollingMomentumCalculator::create): Creates a ScrollingMomentumCalculatorMac. (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac): (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime): (WebCore::ScrollingMomentumCalculatorMac::animationDuration): (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollOffset): (WebCore::ScrollingTreeFrameScrollingNodeMac::viewportSize): (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollOffsetOnAxis): Deleted. * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::copyWithDeltasAndVelocity): (WebCore::PlatformWheelEvent::scrollingVelocity): (WebCore::PlatformWheelEvent::copyWithDeltas): Deleted. * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::scrollOffset): (WebCore::ScrollAnimator::viewportSize): (WebCore::ScrollAnimator::scrollOffsetOnAxis): Deleted. * platform/ScrollAnimator.h: * platform/cocoa/ScrollController.h: * platform/cocoa/ScrollController.mm: (WebCore::otherScrollEventAxis): (WebCore::ScrollController::ScrollController): (WebCore::ScrollController::shouldOverrideInertialScrolling): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::statelessSnapTransitionTimerFired): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): (WebCore::ScrollController::processWheelEventForScrollSnap): (WebCore::ScrollController::updateScrollSnapState): (WebCore::ScrollController::updateScrollSnapPoints): Update the ScrollController's ScrollSnapAnimationState for both vertical and horizontal axes. If both axes lack any snap points, the pointer to the animation state will be nulled out; otherwise, the animation state will exist. (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::scrollSnapTimerFired): (WebCore::ScrollController::activeScrollSnapIndexForAxis): (WebCore::ScrollController::setActiveScrollSnapIndexForAxis): (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset): (WebCore::ScrollController::setActiveScrollSnapIndicesForOffset): (WebCore::ScrollController::scrollSnapPointState): Deleted. (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Deleted. (WebCore::ScrollController::shouldOverrideWheelEvent): Deleted. (WebCore::projectedInertialScrollDistance): Deleted. (WebCore::ScrollController::beginScrollSnapAnimation): Deleted. (WebCore::ScrollController::endScrollSnapAnimation): Deleted. (WebCore::ScrollController::initializeScrollSnapAnimationParameters): Deleted. (WebCore::ScrollController::isSnappingOnAxis): Deleted. * platform/cocoa/ScrollSnapAnimatorState.h: (WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis): (WebCore::ScrollSnapAnimatorState::setSnapOffsetsForAxis): (WebCore::ScrollSnapAnimatorState::currentState): (WebCore::ScrollSnapAnimatorState::activeSnapIndexForAxis): (WebCore::ScrollSnapAnimatorState::setActiveSnapIndexForAxis): * platform/cocoa/ScrollSnapAnimatorState.mm: (WebCore::projectedInertialScrollDistance): (WebCore::ScrollSnapAnimatorState::transitionToSnapAnimationState): (WebCore::ScrollSnapAnimatorState::transitionToGlideAnimationState): (WebCore::ScrollSnapAnimatorState::transitionToUserInteractionState): (WebCore::ScrollSnapAnimatorState::transitionToDestinationReachedState): These methods are used to update the ScrollSnapAnimationState. These state transitions should (and do) encapsulate all changes that need to be made to the animation state; in other words, the ScrollController should no longer be reaching directly into the ScrollSnapAnimatorState to change member variables. (WebCore::ScrollSnapAnimatorState::setupAnimationForState): (WebCore::ScrollSnapAnimatorState::teardownAnimationForState): (WebCore::ScrollSnapAnimatorState::currentAnimatedScrollOffset): (WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset): (WebCore::ScrollSnapAnimatorState::ScrollSnapAnimatorState): Deleted. (WebCore::ScrollSnapAnimatorState::pushInitialWheelDelta): Deleted. (WebCore::ScrollSnapAnimatorState::averageInitialWheelDelta): Deleted. (WebCore::ScrollSnapAnimatorState::clearInitialWheelDeltaWindow): Deleted. (WebCore::ScrollSnapAnimatorState::isSnapping): Deleted. (WebCore::ScrollSnapAnimatorState::canReachTargetWithCurrentInitialScrollDelta): Deleted. (WebCore::ScrollSnapAnimatorState::wheelDeltaTrackingIsInProgress): Deleted. (WebCore::ScrollSnapAnimatorState::hasFinishedTrackingWheelDeltas): Deleted. (WebCore::ScrollSnapAnimatorState::interpolatedOffsetAtProgress): Deleted. (WebCore::ScrollSnapAnimationCurveState::initializeSnapProgressCurve): Deleted. (WebCore::ScrollSnapAnimationCurveState::initializeInterpolationCoefficientsIfNecessary): Deleted. (WebCore::ScrollSnapAnimationCurveState::interpolatedPositionAtProgress): Deleted. (WebCore::ScrollSnapAnimationCurveState::shouldCompleteSnapAnimationImmediatelyAtTime): Deleted. (WebCore::ScrollSnapAnimationCurveState::animationProgressAtTime): Deleted. The ScrollSnapAnimatorState now tracks state across both axes. This simplifies coordinating scroll snapping in both horizontal and vertical axes and fixes the issue of the scroll offset not snapping when performing a scroll in one direction without momentum, then scrolling with momentum in the other direction in a single gesture. * platform/spi/mac/NSScrollingMomentumCalculatorSPI.h: Added. 2016-11-29 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Queue up completed requests in the client, handle them one by one. https://bugs.webkit.org/show_bug.cgi?id=165000 Reviewed by Alex Christensen. No new tests (Covered extensively by every existing test). Currently when a TransactionOperation completes on the server, it immediately completes itself on the client side, including scheduling an event dispatch if necessary. This patch changes it so that "server completed operations" instead queue up in the IDBTransaction and are "client-side completed" asynchronously, 1-by-1. Currently this is a "no behavior change" because only one operation is ever sent to the server at a time. But that will change with https://webkit.org/b/164932 And this patch is a pre-requisite for that. * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::dispatchEvent): (WebCore::IDBRequest::didOpenOrIterateCursor): (WebCore::IDBRequest::completeRequestAndDispatchEvent): (WebCore::IDBRequest::requestCompleted): Deleted. * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::IDBTransaction): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::abortOnServerAndCancelRequests): (WebCore::IDBTransaction::scheduleOperation): (WebCore::IDBTransaction::schedulePendingOperationTimer): (WebCore::IDBTransaction::pendingOperationTimerFired): (WebCore::IDBTransaction::operationCompletedOnServer): (WebCore::IDBTransaction::scheduleCompletedOperationTimer): (WebCore::IDBTransaction::completedOperationTimerFired): (WebCore::IDBTransaction::completeNoncursorRequest): (WebCore::IDBTransaction::completeCursorRequest): (WebCore::IDBTransaction::finishedDispatchEventForRequest): (WebCore::IDBTransaction::didStart): (WebCore::IDBTransaction::didOpenCursorOnServer): (WebCore::IDBTransaction::didIterateCursorOnServer): (WebCore::IDBTransaction::didGetAllRecordsOnServer): (WebCore::IDBTransaction::didGetRecordOnServer): (WebCore::IDBTransaction::didGetCountOnServer): (WebCore::IDBTransaction::didDeleteRecordOnServer): (WebCore::IDBTransaction::didClearObjectStoreOnServer): (WebCore::IDBTransaction::putOrAddOnServer): (WebCore::IDBTransaction::didPutOrAddOnServer): (WebCore::IDBTransaction::operationCompletedOnClient): (WebCore::IDBTransaction::deactivate): (WebCore::IDBTransaction::connectionClosedFromServer): (WebCore::IDBTransaction::scheduleOperationTimer): Deleted. (WebCore::IDBTransaction::operationTimerFired): Deleted. (WebCore::IDBTransaction::operationDidComplete): Deleted. * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::completeOperation): * Modules/indexeddb/client/TransactionOperation.cpp: (WebCore::IDBClient::TransactionOperation::TransactionOperation): * Modules/indexeddb/client/TransactionOperation.h: (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread): (WebCore::IDBClient::TransactionOperation::transitionToComplete): (WebCore::IDBClient::TransactionOperation::doComplete): (WebCore::IDBClient::TransactionOperation::idbRequest): (WebCore::IDBClient::TransactionOperation::performCompleteOnOriginThread): Deleted. (WebCore::IDBClient::TransactionOperation::completed): Deleted. 2016-11-29 Zalan Bujtas <zalan@apple.com> Safari (WebKit) doesn't wrap element within flex when width comes below min-width https://bugs.webkit.org/show_bug.cgi?id=136041 <rdar://problem/25569370> Reviewed by Darin Adler. While figuring out whether a particular flex item fits the current line, we need to take the min-width into account too. This matches both FF and Chrome behaviour. Tests: fast/flexbox/flex-wrap-when-min-widht-is-set-1.html fast/flexbox/flex-wrap-when-min-widht-is-set-2.html * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeNextFlexLine): 2016-11-29 Antti Koivisto <antti@apple.com> Try to fix win/gtk build. * style/StyleUpdate.h: (WebCore::Style::ElementUpdate::ElementUpdate): Add explicit constructor for compilers that don't support C++14 list initialization correctly. 2016-11-28 Antti Koivisto <antti@apple.com> Slotted nodes ignore transition https://bugs.webkit.org/show_bug.cgi?id=160866 <rdar://problem/29231901> Reviewed by Sam Weinig. The problem is that slot (display:contents) always triggers full render tree rebuild when something changes in the slotted subtree. This causes animation to jump to end (may be another bug). Test: fast/shadow-dom/shadow-host-transition.html * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): * style/StyleChange.h: Rearrange so the strongest ('Detach') is the highest. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::createAnimatedElementUpdate): If style was display:contents and stays that way, use 'Inherit' StyleChange which doesn't force render tree rebuild. Refactor more of the functionality to createAnimatedElementUpdate. * style/StyleTreeResolver.h: 2016-11-28 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Crash in WebCore::PlatformDisplayX11::supportsXComposite when running under Wayland https://bugs.webkit.org/show_bug.cgi?id=164917 Reviewed by Michael Catanzaro. WebKitGTK+ appplications are expected to call gtk_init(), because WebKitGTK+, like GTK+ itself, requires a display to work. We currently fallback to create a X11 display when X11 is enabled in cases where GTK+ doesn't have a default display (gtk_init() wasn't called or failed). That's why we end up creating an X11 display under Wayland when both Wayland and X11 option are enabled. The code assumes X11 display creation will always work if X11 is enabled, but that's not true now that we support also Wayland at runtime. So, we should try to get a native display before creating the PlatformDisplay. Rendering will not work in any case when gtk_init() is not called, but in most of the cases those applications are not actually going to render anything, so this way at least we will not crash. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::createPlatformDisplay): Use create() method for X11 and Wayland if we couldn't get a native display from GTK+. If everything fails create a display with no native. (WebCore::PlatformDisplay::PlatformDisplay): Add NativeDisplayOwned parameter. * platform/graphics/PlatformDisplay.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::create): Try to create a native Wayland display or return nullptr. (WebCore::PlatformDisplayWayland::PlatformDisplayWayland): Initialize NativeDisplayOwned parameter. (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland): Destroy the display if owned. (WebCore::PlatformDisplayWayland::initialize): Return early if native display is nullptr. * platform/graphics/wayland/PlatformDisplayWayland.h: * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::create): Try to create a native X11 display or return nullptr. (WebCore::PlatformDisplayX11::PlatformDisplayX11): Use NativeDisplayOwned now. (WebCore::PlatformDisplayX11::~PlatformDisplayX11): Ditto. * platform/graphics/x11/PlatformDisplayX11.h: 2016-11-28 Matt Baker <mattbaker@apple.com> Web Inspector: Debugger should have an option for showing asynchronous call stacks https://bugs.webkit.org/show_bug.cgi?id=163230 <rdar://problem/28698683> Reviewed by Joseph Pecoraro. Test: inspector/debugger/async-stack-trace.html * inspector/InspectorInstrumentation.cpp: (WebCore::didScheduleAsyncCall): Helper function used by by instrumentation hooks. Informs the debugger agent that an asynchronous call was scheduled for the current script execution state. (WebCore::InspectorInstrumentation::didInstallTimerImpl): (WebCore::InspectorInstrumentation::didRemoveTimerImpl): (WebCore::InspectorInstrumentation::willFireTimerImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): Asynchronous stack trace plumbing for timers (setTimeout, setInterval). (WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl): (WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl): (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): Asynchronous stack trace plumbing for requestAnimationFrame. 2016-11-28 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, followup patch after r209059. * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): 2016-11-28 Jiewen Tan <jiewen_tan@apple.com> ASSERTION FAILED: m_scriptExecutionContext->isContextThread() seen with LayoutTest crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html https://bugs.webkit.org/show_bug.cgi?id=165124 <rdar://problem/29413805> Reviewed by Daniel Bates. We should only dereference callbacks after being back to the Document/Worker threads as it might destroy promises in the work queue which will then trigger the assertion. Covered by existing tests. * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): 2016-11-28 Darin Adler <darin@apple.com> Streamline and speed up tokenizer and segmented string classes https://bugs.webkit.org/show_bug.cgi?id=165003 Reviewed by Sam Weinig. Profiling Speedometer on my iMac showed the tokenizer as one of the hottest functions. This patch streamlines the segmented string class, removing various unused features, and also improves some other functions seen on the Speedometer profile. On my iMac I measured a speedup of about 3%. Changes include: - Removed m_pushedChar1, m_pushedChar2, and m_empty data members from the SegmentedString class and all the code that used to handle them. - Simplified the SegmentedString advance functions so they are small enough to get inlined in the HTML tokenizer. - Updated callers to call the simpler SegmentedString advance functions that don't handle newlines in as many cases as possible. - Cut down on allocations of SegmentedString and made code move the segmented string and the strings that are moved into it rather than copying them whenever possible. - Simplified segmented string functions, removing some branches, mostly from the non-fast paths. - Removed small unused functions and small functions used in only one or two places, made more functions private and renamed for clarity. * bindings/js/JSHTMLDocumentCustom.cpp: (WebCore::documentWrite): Moved a little more of the common code in here from the two functions belwo. Removed obsolete comment saying this was not following the DOM specification because it is. Removed unneeded special cases for 1 argument and no arguments. Take a reference instead of a pointer. (WebCore::JSHTMLDocument::write): Updated for above. (WebCore::JSHTMLDocument::writeln): Ditto. * css/parser/CSSTokenizer.cpp: Added now-needed include. * css/parser/CSSTokenizer.h: Removed unneeded include. * css/parser/CSSTokenizerInputStream.h: Added definition of kEndOfFileMarker here; this is now separate from the use in the HTMLParser. In the long run, unclear to me whether it is really needed in either. * dom/Document.cpp: (WebCore::Document::prepareToWrite): Added. Helper function used by the three different variants of write. Using this may prevent us from having to construct a SegmentedString just to append one string after future refactoring. (WebCore::Document::write): Updated to take an rvalue reference and move the value through. (WebCore::Document::writeln): Use a single write call instead of two. * dom/Document.h: Changed write to take an rvalue reference to SegmentedString rather than a const reference. * dom/DocumentParser.h: Changed insert to take an rvalue reference to SegmentedString. In the future, should probably overload to take a single string since that is the normal case. * dom/RawDataDocumentParser.h: Updated for change to DocumentParser. * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocumentParser::append): Refactored a bit, just enough so that we don't need an assignment operator for SegmentedString that can copy a String. * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::insert): Updated to take an rvalue reference, and move the value through. * html/parser/HTMLDocumentParser.h: Updated for the above. * html/parser/HTMLEntityParser.cpp: (WebCore::HTMLEntityParser::consumeNamedEntity): Updated for name changes. Changed the twao calls to advance here to call advancePastNonNewline; no change in behavior, but asserts what the code was assuming before, that the character was not a newline. * html/parser/HTMLInputStream.h: (WebCore::HTMLInputStream::appendToEnd): Updated to take an rvalue reference, and move the value through. (WebCore::HTMLInputStream::insertAtCurrentInsertionPoint): Ditto. (WebCore::HTMLInputStream::markEndOfFile): Removed the code to construct a SegmentedString, overkill since we can just append an individual string. (WebCore::HTMLInputStream::splitInto): Rewrote the move idiom here to actually use move, which will reduce reference count churn and other unneeded work. * html/parser/HTMLMetaCharsetParser.cpp: (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Removed unneeded construction of a SegmentedString, just to append a string. * html/parser/HTMLSourceTracker.cpp: (WebCore::HTMLSourceTracker::HTMLSourceTracker): Moved to the class definition. (WebCore::HTMLSourceTracker::source): Updated for function name change. * html/parser/HTMLSourceTracker.h: Updated for above. * html/parser/HTMLTokenizer.cpp: Added now-needed include. (WebCore::HTMLTokenizer::emitAndResumeInDataState): Use advancePastNonNewline, since this function is never called in response to a newline character. (WebCore::HTMLTokenizer::commitToPartialEndTag): Ditto. (WebCore::HTMLTokenizer::commitToCompleteEndTag): Ditto. (WebCore::HTMLTokenizer::processToken): Use ADVANCE_PAST_NON_NEWLINE_TO macro instead of ADVANCE_TO in cases where the character we are advancing past is known not to be a newline, so we can use the more efficient advance function that doesn't check for the newline character. * html/parser/InputStreamPreprocessor.h: Moved kEndOfFileMarker to SegmentedString.h; not sure that's a good place for it either. In the long run, unclear to me whether this is really needed. (WebCore::InputStreamPreprocessor::peek): Added UNLIKELY for the empty check. Added LIKELY for the not-special character check. (WebCore::InputStreamPreprocessor::advance): Updated for the new name of the advanceAndUpdateLineNumber function. (WebCore::InputStreamPreprocessor::advancePastNonNewline): Added. More efficient than advance for cases where the last characer is known not to be a newline character. (WebCore::InputStreamPreprocessor::skipNextNewLine): Deleted. Was unused. (WebCore::InputStreamPreprocessor::reset): Deleted. Was unused except in the constructor; added initial values for the data members to replace. (WebCore::InputStreamPreprocessor::processNextInputCharacter): Removed long FIXME comment that didn't really need to be here. Reorganized a bit. (WebCore::InputStreamPreprocessor::isAtEndOfFile): Renamed and made static. * html/track/BufferedLineReader.cpp: (WebCore::BufferedLineReader::nextLine): Updated to not use the poorly named scanCharacter function to advance past a newline. Also renamed from getLine and changed to return Optional<String> instead of using a boolean to indicate failure and an out argument. * html/track/BufferedLineReader.h: (WebCore::BufferedLineReader::BufferedLineReader): Use the default, putting initial values on each data member below. (WebCore::BufferedLineReader::append): Updated to take an rvalue reference, and move the value through. (WebCore::BufferedLineReader::scanCharacter): Deleted. Was poorly named, and easy to replace with two lines of code at its two call sites. (WebCore::BufferedLineReader::reset): Rewrote to correctly clear all the data members of the class, not just the segmented string. * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Updated to take an rvalue reference and move the value through. * html/track/InbandGenericTextTrack.h: Updated for the above. * html/track/InbandTextTrack.h: Updated since parseWebVTTFileHeader now takes an rvalue reference. * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::parseFileHeader): Updated to take an rvalue reference and move the value through. (WebCore::WebVTTParser::parseBytes): Updated to pass ownership of the string in to the line reader append function. (WebCore::WebVTTParser::parseCueData): Use auto and WTFMove for WebVTTCueData. (WebCore::WebVTTParser::flush): More of the same. (WebCore::WebVTTParser::parse): Changed to use nextLine instead of getLine. * html/track/WebVTTParser.h: Updated for the above. * html/track/WebVTTTokenizer.cpp: (WebCore::advanceAndEmitToken): Use advanceAndUpdateLineNumber by its new name, just advance. No change in behavior. (WebCore::WebVTTTokenizer::WebVTTTokenizer): Pass a String, not a SegmentedString, to add the end of file marker. * platform/graphics/InbandTextTrackPrivateClient.h: Updated since parseWebVTTFileHeader takes an rvalue reference. * platform/text/SegmentedString.cpp: (WebCore::SegmentedString::Substring::appendTo): Moved here from the header. The only caller is SegmentedString::toString, inside this file. (WebCore::SegmentedString::SegmentedString): Deleted the copy constructor. No longer needed. (WebCore::SegmentedString::operator=): Defined a move assignment operator rather than an ordinary assignment operator, since that's what the call sites really need. (WebCore::SegmentedString::length): Simplified since we no longer need to support pushed characters. (WebCore::SegmentedString::setExcludeLineNumbers): Simplified, since we can just iterate m_otherSubstrings without an extra check. Also changed to write directly to the data member of Substring instead of using a function. (WebCore::SegmentedString::updateAdvanceFunctionPointersForEmptyString): Added. Used when we run out of characters. (WebCore::SegmentedString::clear): Removed code to clear now-deleted members. Updated for changes to other member names. (WebCore::SegmentedString::appendSubstring): Renamed from just append to avoid ambiguity with the public append function. Changed to take an rvalue reference, and move in, and added code to set m_currentCharacter properly, so the caller doesn't have to deal with that. (WebCore::SegmentedString::close): Updated to use m_isClosed by its new name. Also removed unneeded comment about assertion that fires when trying to close an already closed string. (WebCore::SegmentedString::append): Added overloads for rvalue references of both entire SegmentedString objects and of String. Streamlined to just call appendSubstring and append to the deque. (WebCore::SegmentedString::pushBack): Tightened up since we don't allow empty strings and changed to take just a string, not an entire segmented string. (WebCore::SegmentedString::advanceSubstring): Moved logic into the advancePastSingleCharacterSubstringWithoutUpdatingLineNumber function. (WebCore::SegmentedString::toString): Simplified now that we don't need to support pushed characters. (WebCore::SegmentedString::advancePastNonNewlines): Deleted. (WebCore::SegmentedString::advance8): Deleted. (WebCore::SegmentedString::advanceWithoutUpdatingLineNumber16): Renamed from advance16. Simplified now that there are no pushed characters. Also changed to access data members of m_currentSubstring directly instead of calling a function. (WebCore::SegmentedString::advanceAndUpdateLineNumber8): Deleted. (WebCore::SegmentedString::advanceAndUpdateLineNumber16): Ditto. (WebCore::SegmentedString::advancePastSingleCharacterSubstringWithoutUpdatingLineNumber): Renamed from advanceSlowCase. Removed uneeded logic to handle pushed characters. Moved code in here from advanceSubstring. (WebCore::SegmentedString::advancePastSingleCharacterSubstring): Renamed from advanceAndUpdateLineNumberSlowCase. Simplified by calling the function above. (WebCore::SegmentedString::advanceEmpty): Broke assertion up into two. (WebCore::SegmentedString::updateSlowCaseFunctionPointers): Updated for name changes. (WebCore::SegmentedString::advancePastSlowCase): Changed name and meaning of boolean argument. Rewrote to use the String class less; it's now used only when we fail to match after the first character rather than being used for the actual comparison with the literal. * platform/text/SegmentedString.h: Moved all non-trivial function bodies out of the class definition to make things easier to read. Moved the SegmentedSubstring class inside the SegmentedString class, making it a private struct named Substring. Removed the m_ prefix from data members of the struct, removed many functions from the struct and made its union be anonymous instead of naming it m_data. Removed unneeded StringBuilder.h include. (WebCore::SegmentedString::isEmpty): Changed to use the length of the substring instead of a separate boolean. We never create an empty substring, nor leave one in place as the current substring unless the entire segmented string is empty. (WebCore::SegmentedString::advancePast): Updated to use the new member function template instead of a non-template member function. The new member function is entirely rewritten and does the matching directly rather than allocating a string just to do prefix matching. (WebCore::SegmentedString::advancePastLettersIgnoringASCIICase): Renamed to make it clear that the literal must be all non-letters or lowercase letters as with the other "letters ignoring ASCII case" functions. The three call sites all fit the bill. Implement by calling the new function template. (WebCore::SegmentedString::currentCharacter): Renamed from currentChar. (WebCore::SegmentedString::Substring::Substring): Use an rvalue reference and move the string in. (WebCore::SegmentedString::Substring::currentCharacter): Simplified since this is never used on an empty substring. (WebCore::SegmentedString::Substring::incrementAndGetCurrentCharacter): Ditto. (WebCore::SegmentedString::SegmentedString): Overload to take an rvalue reference. Simplified since there are now fewer data members. (WebCore::SegmentedString::advanceWithoutUpdatingLineNumber): Renamed from advance, since this is only safe to use if there is some reason it is OK to skip updating the line number. (WebCore::SegmentedString::advance): Renamed from advanceAndUpdateLineNumber, since doing that is the normal desired behavior and not worth mentioning in the public function name. (WebCore::SegmentedString::advancePastNewline): Renamed from advancePastNewlineAndUpdateLineNumber. (WebCore::SegmentedString::numberOfCharactersConsumed): Greatly simplified since pushed characters are no longer supported. (WebCore::SegmentedString::characterMismatch): Added. Used by advancePast. * xml/parser/CharacterReferenceParserInlines.h: (WebCore::unconsumeCharacters): Use toString rather than toStringPreserveCapacity because the SegmentedString is going to take ownership of the string. (WebCore::consumeCharacterReference): Updated to use the pushBack that takes just a String, not a SegmentedString. Also use advancePastNonNewline. * xml/parser/MarkupTokenizerInlines.h: Added ADVANCE_PAST_NON_NEWLINE_TO. * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::insert): Updated since this takes an rvalue reference. (WebCore::XMLDocumentParser::append): Removed unnecessary code to create a SegmentedString. * xml/parser/XMLDocumentParser.h: Updated for above. Also fixed indentation and initialized most data members. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::XMLDocumentParser): Moved most data member initialization into the class definition. (WebCore::XMLDocumentParser::resumeParsing): Removed code that copied a segmented string, but converted the whole thing into a string before using it. Now we convert to a string right away. 2016-11-28 Chris Dumez <cdumez@apple.com> [iOS] Use UIKit SPI to force popover presentation style on iPhone for html validation popovers https://bugs.webkit.org/show_bug.cgi?id=165107 Reviewed by Simon Fraser. Use UIKit SPI to force popover presentation style on iPhone for html validation popovers as this results in simpler code and achieves the same behavior. * platform/ValidationBubble.h: * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::setAnchorRect): (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]): Deleted. * platform/spi/ios/UIKitSPI.h: 2016-11-28 Chris Dumez <cdumez@apple.com> [Mac] Clicking on an HTML validation bubble should dismiss it https://bugs.webkit.org/show_bug.cgi?id=165117 <rdar://problem/29409837> Reviewed by Simon Fraser. Clicking on an HTML validation bubble should dismiss it. It previously did nothing. No new tests, this is not easily testable as EventSender.keyDown() sends the event to the view, not to a particular screen location. * platform/mac/ValidationBubbleMac.mm: (-[WebValidationPopover mouseDown:]): (WebCore::ValidationBubble::ValidationBubble): 2016-11-27 Sam Weinig <sam@webkit.org> Make CanvasRenderingContext2D use WebIDL unions / Variants for createPattern and drawImage https://bugs.webkit.org/show_bug.cgi?id=165086 Reviewed by Darin Adler. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::size): Add overloads of size for each type of CanvasSource. (WebCore::CanvasRenderingContext2D::drawImage): (WebCore::CanvasRenderingContext2D::createPattern): * html/canvas/CanvasRenderingContext2D.h: * html/canvas/CanvasRenderingContext2D.idl: Use variants to reduce code duplication and match spec language in drawImage and createPattern. 2016-11-28 Beth Dakin <bdakin@apple.com> Blacklist Netflix for TouchBar support https://bugs.webkit.org/show_bug.cgi?id=165104 -and corresponding- rdar://problem/29404778 Reviewed by Tim Horton. This patch moves the algorithm to bestMediaElementForShowingPlaybackControlsManager() so that Now Playing can also use it. * html/HTMLMediaElement.cpp: (WebCore::needsPlaybackControlsManagerQuirk): (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): (WebCore::HTMLMediaElement::updatePlaybackControlsManager): 2016-11-28 Mark Lam <mark.lam@apple.com> Fix exception scope verification failures in more miscellaneous files. https://bugs.webkit.org/show_bug.cgi?id=165102 Reviewed by Saam Barati. No new tests because these are fixes to failures detected by existing tests when exception check verification is enabled. * bindings/js/IDBBindingUtilities.cpp: (WebCore::toJS): * bindings/js/JSCommandLineAPIHostCustom.cpp: (WebCore::getJSListenerFunctions): * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::buildJSONForRSAComponents): (WebCore::addUsagesToJSON): * bindings/js/JSDOMBinding.h: (WebCore::toJS): * bridge/runtime_array.cpp: (JSC::RuntimeArray::put): 2016-11-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix bugs in the @supports parser https://bugs.webkit.org/show_bug.cgi?id=165115 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): Clean up the display property to match the old parser to ensure that @supports conditions on display are the same. * css/parser/CSSSupportsParser.cpp: (WebCore::CSSSupportsParser::consumeCondition): (WebCore::CSSSupportsParser::consumeNegation): (WebCore::CSSSupportsParser::consumeConditionInParenthesis): * css/parser/CSSSupportsParser.h: What follows are all bugs in Blink that need to be fixed to pass our tests. Fix the supports parser to allow the whitespace after not/or/and to be optional. Allow the whitespace following parenthetical conditions to be optional. With whitespace being optional, this means that "not(" will parse as a FunctionToken type, as will "or(" and "and(". Handle this situation by checking for FunctionToken along with IdentToken and parameterizing consumeConditionInParenthesis to do the right thing when it starts with a FunctionToken instead of an IdentToken. Fix the general enclosure FunctionToken for forward compatibility to require that the function still be enclosed within parentheses. 2016-11-28 Mark Lam <mark.lam@apple.com> Fix exception scope verification failures in ObjectConstructor.cpp and ObjectPrototype.cpp. https://bugs.webkit.org/show_bug.cgi?id=165051 Reviewed by Saam Barati. No new tests because this is covered by the existing test http/tests/security/cross-frame-access-object-prototype.html with the help of a new ASSERT in ObjectPrototype.cpp. Fixed jsDOMWindowGetOwnPropertySlotRestrictedAccess() to return false when it throws an exception. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): 2016-11-28 Tim Horton <timothy_horton@apple.com> Obvious change in saturation/color when swiping to a previously visited page https://bugs.webkit.org/show_bug.cgi?id=165112 <rdar://problem/29257229> Reviewed by Simon Fraser. * platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::createFromImage): IOSurface::createFromImage should take into account the colorspace of the originating image, instead of just hardcoding sRGB. Otherwise, on a non-sRGB display, the display-space snapshot that we take for back-forward swipe is converted to sRGB, then the colorspace information is lost (without a way to maintain it inside the IOSurface), and displayed as layer contents interpreted as display space (instead of sRGB). 2016-11-28 Chris Dumez <cdumez@apple.com> Unreviewed, fix crashes on Yosemite after r209009 NSTextField's maximumNumberOfLines was introduced in ElCapitan so disable it at compile-time on previous OSes for now. * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): 2016-11-28 Keith Rollin <krollin@apple.com> Unreviewed, rolling out r208607. The actual changes aren't inline with what was requested. Reverted changeset: "Reduce number of platformMemoryUsage calls" https://bugs.webkit.org/show_bug.cgi?id=164375 http://trac.webkit.org/changeset/208607 2016-11-28 Beth Dakin <bdakin@apple.com> Blacklist Netflix for TouchBar support https://bugs.webkit.org/show_bug.cgi?id=165104 -and corresponding- rdar://problem/29404778 Reviewed by Darin Adler. * html/HTMLMediaElement.cpp: (WebCore::needsPlaybackControlsManagerQuirk): (WebCore::HTMLMediaElement::updatePlaybackControlsManager): 2016-11-28 Chris Dumez <cdumez@apple.com> Limit HTML Form validation popovers to 4 lines https://bugs.webkit.org/show_bug.cgi?id=165098 <rdar://problem/29403286> Reviewed by Darin Adler. Limit HTML Form validation popovers to 4 lines as per recent feedback. * platform/ios/ValidationBubbleIOS.mm: (WebCore::ValidationBubble::ValidationBubble): * platform/mac/ValidationBubbleMac.mm: (WebCore::ValidationBubble::ValidationBubble): 2016-11-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Filters and Reflections Fixes https://bugs.webkit.org/show_bug.cgi?id=165103 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeReflect): Support the "none" keyword for box-reflect. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): Don't rely on range checking, since invert isn't grouped with the other function values. Actually check every keyword. 2016-11-28 Brent Fulgham <bfulgham@apple.com> ImageData does not match specification https://bugs.webkit.org/show_bug.cgi?id=164663 Reviewed by Simon Fraser. The W3C specification https://www.w3.org/TR/2dcontext/ clearly states that the width and height attributes of the ImageData type should be unsigned. Our current implementation has signed integer values. In practice, we have enforced the unsigned requirement by throwing a TypeError if you attempt to construct an ImageData with negative width or height. This change simply updates the IDL and impelemntation to match the spec. Test coverage is already provided by fast/canvas/canvas-imageData.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): Serialize as uint32_t values. * html/ImageData.idl: Revise width and height to be unsigned long. 2016-11-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] flex-basis should be pixel units not percentages. https://bugs.webkit.org/show_bug.cgi?id=165100 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeFlex): 2016-11-28 Daniel Bates <dabates@apple.com> Replace CSSPropertyNames.in with a JSON file https://bugs.webkit.org/show_bug.cgi?id=164691 Reviewed by Simon Fraser. Convert CSSPropertyNames.in to a structured JSON file. This is the first step towards exposing a CSS feature status dashboard and generating more of the boilerplate code for a CSS property. A side effect of this change is that makeprop.pl no longer detects duplicate CSS property definitions. We will look to bring such duplication detection back in a subsequent commit. * CMakeLists.txt: Substitute CSSProperties.json for CSSPropertyNames.in and update the invocation of makeprop.pl as we no longer need to pass the bindings/scripts/preprocessor.pm Perl module. Makeprop.pl supports conditional CSS properties and values without the need to preprocess CSSProperties.json using the C preprocessor. * DerivedSources.make: Ditto. Pass WTF_PLATFORM_IOS to makeprop.pl when building for iOS as we no longer make use of bindings/scripts/preprocessor.pm. * css/CSSProperties.json: Added. * css/CSSPropertyNames.in: Removed. * css/StyleResolver.cpp: Remove variable lastHighPriorityProperty as we now generate it. * css/makeprop.pl: Extracted the input file name, now CSSProperties.json, into a global variable and referenced this variable throughout this script instead of hardcoding the input file name at each call site. Updated code to handle CSS longhand names being encoded in a JSON array as opposed to a string of '|'-separated values. I added a FIXME comment to do the same for the codegen property "custom". Fixed Perl uninitialized variable warnings when die()-ing with error "Unknown CSS property used in all shorthand ..." or "Unknown CSS property used in longhands ...". (isPropertyEnabled): Added. Determine whether code should be generated for a property. (addProperty): Added. (sortByDescendingPriorityAndName): Added. (getScopeForFunction): Lowercase option names so that we can use a consistent case throughout the JSON file. (getNameForMethods): Ditto. (generateColorValueSetter): (generateAnimationPropertyInitialValueSetter): Ditto. (generateAnimationPropertyInheritValueSetter): Ditto. (generateFillLayerPropertyInitialValueSetter): Ditto. (generateFillLayerPropertyInheritValueSetter): Ditto. (generateSetValueStatement): Ditto. (generateInitialValueSetter): Ditto. (generateInheritValueSetter): Ditto. (generateValueSetter): Ditto. 2016-11-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-animation-trigger https://bugs.webkit.org/show_bug.cgi?id=165095 Reviewed by Zalan Bujtas. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWebkitAnimationTrigger): (WebCore::consumeAnimationValue): (WebCore::CSSPropertyParser::parseSingleValue): 2016-11-28 Antti Koivisto <antti@apple.com> Remove FIRST_LINE_INHERITED fake pseudo style https://bugs.webkit.org/show_bug.cgi?id=165071 Reviewed by Andreas Kling. These are create during layout an then cached to the RenderStyle. Cache computed first line style to RenderObject rare data instead, avoiding style mutation an other confusing messiness. * rendering/RenderElement.cpp: (WebCore::RenderElement::RenderElement): (WebCore::RenderElement::computeFirstLineStyle): (WebCore::RenderElement::firstLineStyle): Cache the first line style. (WebCore::RenderElement::invalidateCachedFirstLineStyle): (WebCore::RenderElement::styleWillChange): Invalidate subtree if we have cached first line style. (WebCore::RenderElement::getUncachedPseudoStyle): (WebCore::RenderElement::uncachedFirstLineStyle): Deleted. (WebCore::RenderElement::cachedFirstLineStyle): Deleted. * rendering/RenderElement.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::rareDataMap): (WebCore::RenderObject::rareData): (WebCore::RenderObject::ensureRareData): * rendering/RenderObject.h: Stop copying rare data objects. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresLayout): Use the normal mechanism for invalidating layout for first-line instead of a hack in pseudoStyleCacheIsInvalid. * rendering/style/RenderStyleConstants.h: * style/RenderTreeUpdater.cpp: (WebCore::pseudoStyleCacheIsInvalid): Simplify. 2016-11-28 Miguel Gomez <magomez@igalia.com> [GTK] Dramatic increase on memory usage since 2.14.x https://bugs.webkit.org/show_bug.cgi?id=164049 Reviewed by Žan Doberšek. Use OpenGL version 3.2 Core for rendering when available. Update some operations that have changed when using 3.2 Core: - Use glGetStringi to get the extensions list. - Do not use GL_POINT_SPRITE. - Always use a VAO when rendering. - Use a GLSL 1.50 compatible shader. No new tests needed. * platform/graphics/GLContext.cpp: (WebCore::GLContext::version): Add a method to get OpenGL version we are using. * platform/graphics/GLContext.h: Ditto. * platform/graphics/GraphicsContext3D.h: Add an attribute to store the VAO used for rendering. * platform/graphics/OpenGLShims.cpp: (WebCore::initializeOpenGLShims): Add glGetStringi to the list of functions. * platform/graphics/OpenGLShims.h: Ditto. * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::GraphicsContext3D): Set appropriate output to the shader compiler and initalize the VAO if needed. (WebCore::GraphicsContext3D::~GraphicsContext3D): Delete the VAO if needed. (WebCore::GraphicsContext3D::getExtensions): Use glGetExtensionsi for OpenGL versions >= 3.2. * platform/graphics/glx/GLContextGLX.cpp: (WebCore::hasGLXARBCreateContextExtension): Check whether the GLX_ARB_create_context extension is available. (WebCore::GLContextGLX::createWindowContext): Use glXCreateContextAttribsARB() if possible to request an OpenGL 3.2 context. (WebCore::GLContextGLX::createPbufferContext): Ditto. * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): Enable glGetStringi for GTK. * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Do not use default getExtensions() method for GTK. * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: Ditto. 2016-11-24 Sergio Villar Senin <svillar@igalia.com> [css-grid] Move attributes from RenderGrid to the new Grid class https://bugs.webkit.org/show_bug.cgi?id=165065 Reviewed by Darin Adler. A new class called Grid was added in 208973. This is the first of a couple of patches moving private attributes from RenderGrid to Grid. Apart from that this is adding a couple of new helper functions that will decouple the existence of in-flow items from the actual data structures storing that information. Last but not least, the Grid::insert() method does not only insert the item in the m_grid data structure, but also stores the GridArea associated to that item, so there is no need to do it in two different calls. No new tests required as this is a refactoring. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::Grid::insert): Added a new parameter. (WebCore::RenderGrid::Grid::setSmallestTracksStart): (WebCore::RenderGrid::Grid::smallestTrackStart): (WebCore::RenderGrid::Grid::gridItemArea): (WebCore::RenderGrid::Grid::setGridItemArea): (WebCore::RenderGrid::Grid::clear): Clear the newly added attributes. (WebCore::RenderGrid::repeatTracksSizingIfNeeded): (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): (WebCore::RenderGrid::rawGridTrackSize): (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): (WebCore::RenderGrid::placeItemsOnGrid): (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid): (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): (WebCore::RenderGrid::clearGrid): (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): (WebCore::RenderGrid::cachedGridSpan): (WebCore::RenderGrid::cachedGridArea): Deleted. * rendering/RenderGrid.h: 2016-11-27 Sam Weinig <sam@webkit.org> Remove unused DOMRequestState https://bugs.webkit.org/show_bug.cgi?id=165085 Reviewed by Simon Fraser. Remove DOMRequestState. It was unused. * Modules/fetch/FetchBody.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMRequestState.h: Removed. 2016-11-27 Csaba Osztrogonác <ossy@webkit.org> Fix various --minimal build issues https://bugs.webkit.org/show_bug.cgi?id=165060 Reviewed by Darin Adler. * css/parser/CSSPropertyParser.cpp: * dom/Document.cpp: * loader/EmptyClients.cpp: 2016-11-26 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Import std::optional reference implementation as WTF::Optional https://bugs.webkit.org/show_bug.cgi?id=164199 Reviewed by Saam Barati and Sam Weinig. Rename valueOr to value_or. This is specified in C++17 proposal. Use Optional::emplace. C++17 Optional::operator=(Optional&&) requires either copy assignment operator or move assignment operator. But DFG::JSValueOperand etc. only defines move constructors and drop implicit copy assignment operators. It was OK in the previous WTF::Optional since it always uses move constructors. But it is not valid in C++17 Optional. We use Optional::emplace instead. This function has the same semantics to the previous WTF::Optional's operator=. No behavior change. * Modules/applepay/ApplePaySession.cpp: (WebCore::parseAmount): (WebCore::createContactFields): (WebCore::toLineItemType): (WebCore::createLineItem): (WebCore::createLineItems): (WebCore::createMerchantCapabilities): (WebCore::createSupportedNetworks): (WebCore::toShippingType): (WebCore::createShippingMethod): (WebCore::createShippingMethods): (WebCore::createPaymentRequest): (WebCore::toPaymentAuthorizationStatus): * Modules/applepay/PaymentContact.h: * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::completeShippingMethodSelection): (WebCore::PaymentCoordinator::completeShippingContactSelection): (WebCore::PaymentCoordinator::completePaymentMethodSelection): * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/applepay/PaymentMerchantSession.h: * Modules/applepay/PaymentRequest.h: * Modules/applepay/cocoa/PaymentContactCocoa.mm: (WebCore::PaymentContact::fromJS): * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: (WebCore::PaymentMerchantSession::fromJS): * Modules/encryptedmedia/MediaKeyStatusMap.cpp: (WebCore::MediaKeyStatusMap::Iterator::next): * Modules/encryptedmedia/MediaKeyStatusMap.h: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): * Modules/fetch/FetchBody.h: * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::FetchBodyOwner): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchHeaders.cpp: (WebCore::FetchHeaders::Iterator::next): * Modules/fetch/FetchHeaders.h: * Modules/fetch/FetchRequest.cpp: (WebCore::setReferrerPolicy): (WebCore::setMode): (WebCore::setCredentials): (WebCore::setCache): (WebCore::setRedirect): (WebCore::setMethod): (WebCore::setReferrer): (WebCore::buildOptions): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::cloneForJS): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::BodyLoader::stop): * Modules/fetch/FetchResponse.h: * Modules/geolocation/Coordinates.cpp: (WebCore::Coordinates::altitude): (WebCore::Coordinates::altitudeAccuracy): (WebCore::Coordinates::heading): (WebCore::Coordinates::speed): * Modules/geolocation/Coordinates.h: * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::stringToDirection): * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::hash): * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::open): * Modules/indexeddb/IDBFactory.h: * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::getAll): (WebCore::IDBIndex::getAllKeys): * Modules/indexeddb/IDBIndex.h: * Modules/indexeddb/IDBKeyPath.h: (WebCore::isolatedCopy): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::keyPath): (WebCore::IDBObjectStore::getAll): (WebCore::IDBObjectStore::getAllKeys): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): (WebCore::IDBTransaction::requestGetAllIndexRecords): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/IDBVersionChangeEvent.cpp: (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent): * Modules/indexeddb/IDBVersionChangeEvent.h: * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::serializeIDBKeyPath): (WebCore::deserializeIDBKeyPath): * Modules/indexeddb/server/IDBSerialization.h: * Modules/indexeddb/server/MemoryIndex.cpp: (WebCore::IDBServer::MemoryIndex::getAllRecords): * Modules/indexeddb/server/MemoryIndex.h: * Modules/indexeddb/server/MemoryObjectStore.cpp: (WebCore::IDBServer::MemoryObjectStore::getAllRecords): * Modules/indexeddb/server/MemoryObjectStore.h: * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp: (WebCore::IDBServer::MemoryObjectStoreCursor::objectStoreCleared): (WebCore::IDBServer::MemoryObjectStoreCursor::keyDeleted): (WebCore::IDBServer::MemoryObjectStoreCursor::setFirstInRemainingRange): (WebCore::IDBServer::MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange): (WebCore::IDBServer::MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange): (WebCore::IDBServer::MemoryObjectStoreCursor::incrementForwardIterator): (WebCore::IDBServer::MemoryObjectStoreCursor::incrementReverseIterator): * Modules/indexeddb/server/MemoryObjectStoreCursor.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): * Modules/indexeddb/shared/IDBDatabaseInfo.cpp: (WebCore::IDBDatabaseInfo::createNewObjectStore): * Modules/indexeddb/shared/IDBDatabaseInfo.h: * Modules/indexeddb/shared/IDBGetAllRecordsData.h: * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::IDBObjectStoreInfo): * Modules/indexeddb/shared/IDBObjectStoreInfo.h: (WebCore::IDBObjectStoreInfo::keyPath): * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::displayNameForTrack): * Modules/mediacontrols/MediaControlsHost.h: * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::endOfStream): (WebCore::MediaSource::streamEndedWithError): * Modules/mediasource/MediaSource.h: * Modules/mediastream/MediaStreamTrack.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createOfferFailed): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::createAnswerFailed): (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded): (WebCore::PeerConnectionBackend::setLocalDescriptionFailed): (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded): (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed): (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): (WebCore::PeerConnectionBackend::addIceCandidateFailed): (WebCore::PeerConnectionBackend::stop): * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCDTMFSender.cpp: (WebCore::RTCDTMFSender::insertDTMF): * Modules/mediastream/RTCDTMFSender.h: * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): (WebCore::RTCIceCandidate::RTCIceCandidate): * Modules/mediastream/RTCIceCandidate.h: (WebCore::RTCIceCandidate::sdpMLineIndex): * Modules/mediastream/SDPProcessor.cpp: (WebCore::iceCandidateFromJSON): * Modules/proximity/DeviceProximityEvent.h: * Modules/streams/ReadableStreamSource.h: (WebCore::ReadableStreamSource::startFinished): (WebCore::ReadableStreamSource::pullFinished): (WebCore::ReadableStreamSource::clean): * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::start): * Modules/webaudio/AudioBufferSourceNode.h: * Modules/webdatabase/SQLResultSet.h: * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::close): * Modules/websockets/WebSocket.h: * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::didReceiveSocketStreamData): * Modules/websockets/WebSocketChannel.h: * bindings/generic/IDLTypes.h: (WebCore::IDLType::nullValue): * bindings/js/CachedModuleScript.h: (WebCore::CachedModuleScript::error): * bindings/js/Dictionary.h: (WebCore::Dictionary::get): * bindings/js/IDBBindingUtilities.cpp: (WebCore::toJS): * bindings/js/IDBBindingUtilities.h: * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): * bindings/js/JSCryptoKeySerializationJWK.h: * bindings/js/JSDOMConvert.h: (WebCore::Detail::VariadicConverterBase::convert): (WebCore::Detail::VariadicConverterBase<IDLInterface<T>>::convert): (WebCore::convertVariadicArguments): * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::next): * bindings/js/JSDOMPromise.h: (WebCore::DOMPromise::DOMPromise): (WebCore::DOMPromise::operator=): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getOwnPropertySlot): * bindings/js/JSDictionary.h: (WebCore::JSDictionary::convertValue): * bindings/js/JSFileCustom.cpp: (WebCore::constructJSFile): * bindings/js/JSHTMLAllCollectionCustom.cpp: (WebCore::callHTMLAllCollection): (WebCore::JSHTMLAllCollection::item): * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::JSHTMLCanvasElement::toDataURL): * bindings/js/JSImageConstructor.cpp: (WebCore::JSImageConstructor::construct): * bindings/js/JSMediaDevicesCustom.cpp: (WebCore::createStringConstraint): (WebCore::createBooleanConstraint): (WebCore::createDoubleConstraint): (WebCore::createIntConstraint): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::importKey): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::setupModuleScriptHandlers): (WebCore::ScriptController::executeScriptInWorld): (WebCore::ScriptController::executeScript): * bindings/scripts/CodeGeneratorJS.pm: (GenerateGetOwnPropertySlotBody): (GenerateEnumerationImplementationContent): (GenerateEnumerationHeaderContent): (GenerateDefaultValue): (GenerateImplementation): (GenerateParametersCheck): * bindings/scripts/test/JS/JSFloat64Array.cpp: (WebCore::JSFloat64Array::getOwnPropertySlot): (WebCore::JSFloat64Array::getOwnPropertyDescriptor): (WebCore::JSFloat64Array::put): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::JSTestEventTarget::getOwnPropertySlot): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::parseEnumeration<TestObj::EnumType>): (WebCore::parseEnumeration<TestObj::Optional>): (WebCore::parseEnumeration<AlternateEnumName>): (WebCore::parseEnumeration<TestObj::EnumA>): (WebCore::parseEnumeration<TestObj::EnumB>): (WebCore::parseEnumeration<TestObj::EnumC>): (WebCore::parseEnumeration<TestObj::Kind>): (WebCore::parseEnumeration<TestObj::Size>): (WebCore::parseEnumeration<TestObj::Confidence>): (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::JSTestObj::getOwnPropertySlot): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArgCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgsCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalRecordCaller): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2Caller): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2Caller): (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentCaller): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: (WebCore::parseEnumeration<TestStandaloneEnumeration>): * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h: * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::jsTestTypedefsPrototypeFunctionSetShadowCaller): (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClampCaller): * bridge/runtime_array.cpp: (JSC::RuntimeArray::getOwnPropertySlot): (JSC::RuntimeArray::put): * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::identifier): * crypto/CryptoAlgorithmRegistry.h: * crypto/CryptoKeySerialization.h: * crypto/JsonWebKey.h: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: (WebCore::calculateSignature): * crypto/keys/CryptoKeyAES.h: * crypto/keys/CryptoKeyHMAC.h: * crypto/keys/CryptoKeyRSA.cpp: (WebCore::CryptoKeyRSA::importJwk): * crypto/keys/CryptoKeyRSA.h: * crypto/keys/CryptoKeySerializationRaw.cpp: (WebCore::CryptoKeySerializationRaw::reconcileAlgorithm): * crypto/keys/CryptoKeySerializationRaw.h: * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::commonCryptoHMACAlgorithm): * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::cryptoDigestAlgorithm): * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: * css/CSSFontFace.cpp: (WebCore::CSSFontFace::calculateStyleMask): (WebCore::CSSFontFace::calculateWeightMask): * css/CSSFontFace.h: * css/CSSFontFaceSet.cpp: (WebCore::computeFontTraitsMask): * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::doubleValue): (WebCore::CSSPrimitiveValue::doubleValueInternal): * css/CSSPrimitiveValue.h: * css/CSSPropertyNames.in: * css/CSSSegmentedFontFace.cpp: * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::create): (WebCore::CSSStyleSheet::CSSStyleSheet): (WebCore::CSSStyleSheet::addRule): * css/CSSStyleSheet.h: * css/FontFace.cpp: (WebCore::FontFace::fontStateChanged): * css/FontFace.h: * css/FontFaceSet.cpp: (WebCore::FontFaceSet::completedLoading): * css/FontFaceSet.h: * css/MediaQueryEvaluator.cpp: (WebCore::doubleValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertGridPosition): (WebCore::StyleBuilderConverter::convertWordSpacing): (WebCore::StyleBuilderConverter::convertPerspective): (WebCore::StyleBuilderConverter::convertMarqueeIncrement): (WebCore::StyleBuilderConverter::convertFilterOperations): (WebCore::StyleBuilderConverter::convertLineHeight): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueLineHeight): * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::requestStyleSheet): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseCubicBezierTimingFunctionValue): (WebCore::CSSParser::parseSpringTimingFunctionValue): (WebCore::CSSParser::parseColorFunctionParameters): (WebCore::CSSParser::parseColorFromValue): * css/parser/CSSParser.h: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation): * dom/CustomElementReactionQueue.cpp: * dom/Document.cpp: (WebCore::Document::lastModified): * dom/Element.cpp: (WebCore::Element::scrollBy): (WebCore::Element::getIntegralAttribute): (WebCore::Element::getUnsignedIntegralAttribute): (WebCore::Element::resolveCustomStyle): * dom/Element.h: * dom/ElementIteratorAssertions.h: (WebCore::ElementIteratorAssertions::dropEventDispatchAssertion): (WebCore::ElementIteratorAssertions::clear): * dom/ExceptionOr.h: * dom/InlineStyleSheetOwner.cpp: (WebCore::makeInlineStyleSheetCacheKey): * dom/KeyboardEvent.h: * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::error): * dom/LoadableClassicScript.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::error): * dom/LoadableModuleScript.h: * dom/LoadableScript.h: * dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): (WebCore::MessageEvent::create): (WebCore::MessageEvent::initMessageEvent): * dom/MessageEvent.h: * dom/MutationObserver.cpp: (WebCore::MutationObserver::observe): * dom/MutationObserver.h: * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): * dom/PseudoElement.cpp: (WebCore::PseudoElement::resolveCustomStyle): * dom/PseudoElement.h: * dom/RangeBoundaryPoint.h: (WebCore::RangeBoundaryPoint::setToBeforeChild): (WebCore::RangeBoundaryPoint::setToAfterChild): (WebCore::RangeBoundaryPoint::setToEndOfNode): (WebCore::RangeBoundaryPoint::invalidateOffset): * dom/ScriptElement.cpp: (WebCore::ScriptElement::determineScriptType): (WebCore::ScriptElement::prepareScript): (WebCore::ScriptElement::executeScriptAndDispatchEvent): * dom/ScriptElement.h: * dom/TextDecoder.cpp: (WebCore::TextDecoder::decode): * dom/TextDecoder.h: * dom/UserGestureIndicator.cpp: (WebCore::UserGestureIndicator::UserGestureIndicator): * dom/UserGestureIndicator.h: * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::moveParagraphs): * editing/CompositeEditCommand.h: * fileapi/File.h: * history/CachedFrame.h: (WebCore::CachedFrame::hasInsecureContent): * html/DOMTokenList.cpp: (WebCore::DOMTokenList::toggle): * html/DOMTokenList.h: * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toDataURL): * html/HTMLCanvasElement.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::parseBorderWidthAttribute): (WebCore::HTMLElement::parseAttribute): * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::createForJSConstructor): (WebCore::HTMLImageElement::width): (WebCore::HTMLImageElement::height): * html/HTMLImageElement.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::findClosestTickMarkValue): (WebCore::HTMLInputElement::maxLengthAttributeChanged): (WebCore::HTMLInputElement::minLengthAttributeChanged): * html/HTMLInputElement.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::initializeStyleSheet): (WebCore::HTMLLinkElement::iconType): * html/HTMLLinkElement.h: * html/HTMLOListElement.h: * html/HTMLOptionsCollection.cpp: (WebCore::HTMLOptionsCollection::add): * html/HTMLOptionsCollection.h: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::add): (WebCore::HTMLSelectElement::setLength): * html/HTMLSelectElement.h: * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged): (WebCore::HTMLTextAreaElement::minLengthAttributeChanged): * html/ImageInputType.cpp: (WebCore::ImageInputType::height): (WebCore::ImageInputType::width): * html/InputType.cpp: (WebCore::InputType::findClosestTickMarkValue): * html/InputType.h: * html/LinkIconCollector.cpp: * html/LinkRelAttribute.h: * html/RangeInputType.cpp: (WebCore::RangeInputType::findClosestTickMarkValue): * html/RangeInputType.h: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::restore): (WebCore::CanvasRenderingContext2D::setStrokeColor): (WebCore::CanvasRenderingContext2D::setFillColor): (WebCore::CanvasRenderingContext2D::isPointInPathInternal): (WebCore::CanvasRenderingContext2D::isPointInStrokeInternal): (WebCore::CanvasRenderingContext2D::setShadow): (WebCore::CanvasRenderingContext2D::fillText): (WebCore::CanvasRenderingContext2D::strokeText): (WebCore::CanvasRenderingContext2D::drawTextInternal): * html/canvas/CanvasRenderingContext2D.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::arrayBufferViewElementSize): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::bufferData): (WebCore::WebGLRenderingContextBase::bufferSubData): (WebCore::WebGLRenderingContextBase::texSubImage2D): (WebCore::WebGLRenderingContextBase::validateArrayBufferType): (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::texImage2D): * html/canvas/WebGLRenderingContextBase.h: * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::indexOfFirstUnopenFormattingElement): (WebCore::HTMLConstructionSite::reconstructTheActiveFormattingElements): * html/parser/HTMLConstructionSite.h: * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTMLIntegerInternal): (WebCore::parseHTMLInteger): (WebCore::parseHTMLNonNegativeInteger): (WebCore::parseValidHTMLNonNegativeIntegerInternal): (WebCore::parseValidHTMLNonNegativeInteger): (WebCore::parseValidHTMLFloatingPointNumberInternal): (WebCore::parseValidHTMLFloatingPointNumber): (WebCore::parseHTTPRefreshInternal): * html/parser/HTMLParserIdioms.h: (WebCore::limitToOnlyHTMLNonNegative): * html/parser/HTMLSrcsetParser.cpp: (WebCore::parseDescriptors): * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::setPositionFromPoint): (WebCore::SliderThumbElement::resolveCustomStyle): (WebCore::SliderContainerElement::resolveCustomStyle): * html/shadow/SliderThumbElement.h: * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerElement::resolveCustomStyle): (WebCore::TextControlInnerTextElement::resolveCustomStyle): (WebCore::TextControlPlaceholderElement::resolveCustomStyle): * html/shadow/TextControlInnerElements.h: * html/track/TrackEvent.h: * inspector/InspectorIndexedDBAgent.cpp: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didFinishXHRLoading): * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::addRule): * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::setInstruments): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startIconLoading): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight): (WebCore::DocumentThreadableLoader::clearResource): (WebCore::DocumentThreadableLoader::preflightSuccess): (WebCore::DocumentThreadableLoader::preflightFailure): * loader/DocumentThreadableLoader.h: * loader/EmptyClients.cpp: * loader/EmptyClients.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::open): (WebCore::FrameLoader::dispatchDidCommitLoad): (WebCore::FrameLoader::clearTestingOverrides): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/LinkLoader.cpp: (WebCore::LinkLoader::resourceTypeFromAsAttribute): (WebCore::LinkLoader::loadLink): * loader/LinkLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::SubresourceLoader): (WebCore::SubresourceLoader::didReceiveResponse): (WebCore::SubresourceLoader::notifyDone): * loader/SubresourceLoader.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setLoadPriority): * loader/cache/CachedResource.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::CachedResourceRequest): * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::priority): * mathml/MathMLElement.h: (WebCore::MathMLElement::specifiedDisplayStyle): (WebCore::MathMLElement::specifiedMathVariant): * mathml/MathMLFractionElement.cpp: (WebCore::MathMLFractionElement::cachedFractionAlignment): (WebCore::MathMLFractionElement::parseAttribute): * mathml/MathMLFractionElement.h: * mathml/MathMLMathElement.cpp: (WebCore::MathMLMathElement::specifiedDisplayStyle): (WebCore::MathMLMathElement::parseAttribute): * mathml/MathMLMathElement.h: * mathml/MathMLMencloseElement.cpp: (WebCore::MathMLMencloseElement::parseAttribute): * mathml/MathMLMencloseElement.h: * mathml/MathMLOperatorDictionary.cpp: (WebCore::MathMLOperatorDictionary::search): * mathml/MathMLOperatorDictionary.h: * mathml/MathMLOperatorElement.cpp: (WebCore::MathMLOperatorElement::computeOperatorFlag): (WebCore::MathMLOperatorElement::childrenChanged): (WebCore::attributeNameToPropertyFlag): (WebCore::MathMLOperatorElement::parseAttribute): * mathml/MathMLOperatorElement.h: * mathml/MathMLPaddedElement.cpp: (WebCore::MathMLPaddedElement::parseAttribute): * mathml/MathMLPaddedElement.h: * mathml/MathMLPresentationElement.cpp: (WebCore::MathMLPresentationElement::cachedBooleanAttribute): (WebCore::MathMLPresentationElement::cachedMathMLLength): (WebCore::MathMLPresentationElement::specifiedDisplayStyle): (WebCore::MathMLPresentationElement::specifiedMathVariant): (WebCore::MathMLPresentationElement::parseAttribute): * mathml/MathMLPresentationElement.h: (WebCore::MathMLPresentationElement::toOptionalBool): * mathml/MathMLScriptsElement.cpp: (WebCore::MathMLScriptsElement::parseAttribute): * mathml/MathMLScriptsElement.h: * mathml/MathMLSpaceElement.cpp: (WebCore::MathMLSpaceElement::parseAttribute): * mathml/MathMLSpaceElement.h: * mathml/MathMLTokenElement.cpp: (WebCore::MathMLTokenElement::convertToSingleCodePoint): * mathml/MathMLTokenElement.h: * mathml/MathMLUnderOverElement.cpp: (WebCore::MathMLUnderOverElement::parseAttribute): * mathml/MathMLUnderOverElement.h: * page/ChromeClient.h: * page/DOMTimer.cpp: (WebCore::DOMTimer::alignedFireTime): * page/DOMTimer.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::scrollBy): * page/DOMWindow.h: * page/EventSource.cpp: (WebCore::EventSource::parseEventStream): (WebCore::EventSource::parseEventStreamLine): * page/EventSource.h: * page/FrameView.cpp: (WebCore::FrameView::recalculateScrollbarOverlayStyle): (WebCore::FrameView::setLayoutViewportOverrideRect): (WebCore::FrameView::setViewExposedRect): * page/FrameView.h: * page/Page.cpp: (WebCore::Page::takeAnyMediaCanStartListener): * page/Page.h: (WebCore::Page::eventThrottlingBehaviorOverride): (WebCore::Page::setEventThrottlingBehaviorOverride): * page/ScrollToOptions.h: * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): (WebCore::SecurityOriginData::databaseIdentifier): (WebCore::SecurityOriginData::fromDatabaseIdentifier): * page/SecurityOriginData.h: (WebCore::SecurityOriginData::SecurityOriginData): (WebCore::SecurityOriginData::isEmpty): (WebCore::SecurityOriginDataHash::hash): * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/WindowFeatures.cpp: (WebCore::parseDialogFeatures): (WebCore::boolFeature): (WebCore::floatFeature): * page/WindowFeatures.h: * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): * page/scrolling/AsyncScrollingCoordinator.h: (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate): * page/scrolling/ScrollingCoordinator.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): * page/scrolling/ios/ScrollingTreeIOS.cpp: (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll): * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): * platform/DragImage.cpp: * platform/LinkIcon.h: * platform/MemoryPressureHandler.h: * platform/ScrollView.cpp: (WebCore::ScrollView::handleDeferredScrollUpdateAfterContentSizeChange): * platform/ScrollView.h: * platform/Theme.h: (WebCore::Theme::controlFont): * platform/Timer.h: (WebCore::TimerBase::alignedFireTime): * platform/URL.cpp: (WebCore::URL::port): (WebCore::defaultPortForProtocol): (WebCore::portAllowed): * platform/URL.h: * platform/URLParser.cpp: (WebCore::URLParser::defaultPortForProtocol): (WebCore::findLongestZeroSequence): (WebCore::URLParser::parseIPv4Piece): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv4PieceInsideIPv6): (WebCore::URLParser::parseIPv4AddressInsideIPv6): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::formURLDecode): * platform/URLParser.h: * platform/graphics/BitmapImage.h: * platform/graphics/Color.h: (WebCore::colorWithOverrideAlpha): * platform/graphics/DisplayRefreshMonitorClient.h: * platform/graphics/Font.h: * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::drawText): (WebCore::FontCascade::drawEmphasisMarks): (WebCore::FontCascade::adjustSelectionRectForText): (WebCore::FontCascade::getEmphasisMarkGlyphData): (WebCore::FontCascade::emphasisMarkAscent): (WebCore::FontCascade::emphasisMarkDescent): (WebCore::FontCascade::emphasisMarkHeight): * platform/graphics/FontCascade.h: * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawText): (WebCore::GraphicsContext::drawEmphasisMarks): (WebCore::GraphicsContext::drawBidiText): * platform/graphics/GraphicsContext.h: (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::setPosition): (WebCore::GraphicsLayer::setApproximatePosition): * platform/graphics/Image.h: (WebCore::Image::hotSpot): * platform/graphics/ImageBuffer.h: * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::clearMetadata): (WebCore::ImageFrameCache::metadata): (WebCore::ImageFrameCache::frameMetadataAtIndex): (WebCore::ImageFrameCache::hotSpot): * platform/graphics/ImageFrameCache.h: * platform/graphics/ImageSource.h: (WebCore::ImageSource::hotSpot): * platform/graphics/PathUtilities.cpp: (WebCore::rectFromPolygon): (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline): * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::calculateLayerBoundingRect): * platform/graphics/TiledBacking.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::flush): (WebCore::SourceBufferPrivateAVFObjC::naturalSize): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect): * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::toDataURL): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::encodeImage): (WebCore::dataURL): (WebCore::ImageBuffer::toDataURL): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoder::hotSpot): * platform/graphics/cg/ImageDecoderCG.h: * platform/graphics/cocoa/FontCocoa.mm: (WebCore::openTypeFeature): (WebCore::advanceForColorBitmapFont): * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::DrawGlyphs::localBounds): (WebCore::DisplayList::DrawLine::localBounds): (WebCore::DisplayList::DrawLinesForText::localBounds): (WebCore::DisplayList::DrawLineForDocumentMarker::localBounds): (WebCore::DisplayList::DrawFocusRingPath::localBounds): (WebCore::DisplayList::DrawFocusRingRects::localBounds): (WebCore::DisplayList::StrokeRect::localBounds): (WebCore::DisplayList::StrokePath::localBounds): (WebCore::DisplayList::StrokeEllipse::localBounds): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::DrawingItem::localBounds): * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::updateItemExtent): (WebCore::DisplayList::Recorder::ContextState::rotate): (WebCore::DisplayList::Recorder::ContextState::concatCTM): * platform/graphics/efl/ImageBufferEfl.cpp: (WebCore::encodeImageJPEG): (WebCore::ImageBuffer::toDataURL): * platform/graphics/filters/Filter.h: (WebCore::Filter::mapAbsolutePointToLocalPoint): * platform/graphics/gtk/ImageBufferGtk.cpp: (WebCore::encodeImage): (WebCore::ImageBuffer::toDataURL): * platform/graphics/harfbuzz/HarfBuzzShaper.cpp: (WebCore::HarfBuzzShaper::selectionRect): * platform/graphics/mac/ComplexTextController.cpp: (WebCore::capitalized): (WebCore::shouldSynthesize): * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica): (WebCore::TextureMapperLayer::replicaTransform): (WebCore::TextureMapperLayer::mapScrollOffset): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::transformedVisibleRect): (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect): * platform/graphics/transforms/AffineTransform.cpp: (WebCore::AffineTransform::inverse): * platform/graphics/transforms/AffineTransform.h: * platform/graphics/transforms/TransformState.cpp: (WebCore::TransformState::mappedPoint): (WebCore::TransformState::mappedSecondaryQuad): (WebCore::TransformState::mapQuad): (WebCore::TransformState::flattenWithTransform): * platform/graphics/transforms/TransformState.h: * platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::inverse): * platform/graphics/transforms/TransformationMatrix.h: * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::toDataURL): * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::hotSpot): * platform/graphics/win/ImageDecoderDirect2D.h: * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::supportsXDamage): * platform/graphics/x11/PlatformDisplayX11.h: * platform/image-decoders/ImageDecoder.h: (WebCore::ImageDecoder::hotSpot): * platform/image-decoders/ico/ICOImageDecoder.cpp: (WebCore::ICOImageDecoder::hotSpot): (WebCore::ICOImageDecoder::hotSpotAtIndex): * platform/image-decoders/ico/ICOImageDecoder.h: * platform/image-encoders/JPEGImageEncoder.cpp: (WebCore::compressRGBABigEndianToJPEG): * platform/image-encoders/JPEGImageEncoder.h: * platform/ios/LegacyTileCache.h: * platform/ios/LegacyTileCache.mm: (WebCore::LegacyTileCache::setOverrideVisibleRect): * platform/ios/LegacyTileLayer.mm: (-[LegacyTileHostLayer renderInContext:]): * platform/linux/MemoryPressureHandlerLinux.cpp: * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::controlFont): * platform/mediastream/MediaConstraints.cpp: (WebCore::MediaTrackConstraintSetMap::set): * platform/mediastream/MediaConstraints.h: (WebCore::MediaTrackConstraintSetMap::width): (WebCore::MediaTrackConstraintSetMap::height): (WebCore::MediaTrackConstraintSetMap::sampleRate): (WebCore::MediaTrackConstraintSetMap::sampleSize): (WebCore::MediaTrackConstraintSetMap::aspectRatio): (WebCore::MediaTrackConstraintSetMap::frameRate): (WebCore::MediaTrackConstraintSetMap::volume): (WebCore::MediaTrackConstraintSetMap::echoCancellation): (WebCore::MediaTrackConstraintSetMap::facingMode): (WebCore::MediaTrackConstraintSetMap::deviceId): (WebCore::MediaTrackConstraintSetMap::groupId): * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): (WebCore::RealtimeMediaSource::applySizeAndFrameRate): (WebCore::RealtimeMediaSource::applyConstraints): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::applySizeAndFrameRate): (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: * platform/network/CacheValidation.cpp: (WebCore::computeCurrentAge): (WebCore::computeFreshnessLifetimeForHTTPFamily): * platform/network/CacheValidation.h: * platform/network/DataURLDecoder.h: * platform/network/HTTPHeaderMap.h: (WebCore::HTTPHeaderMap::HTTPHeaderMapConstIterator::updateKeyValue): * platform/network/HTTPParsers.cpp: (WebCore::parseHTTPDate): * platform/network/HTTPParsers.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::cacheControlMaxAge): (WebCore::parseDateValueInHeader): (WebCore::ResourceResponseBase::date): (WebCore::ResourceResponseBase::age): (WebCore::ResourceResponseBase::expires): (WebCore::ResourceResponseBase::lastModified): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::certificateInfo): * platform/network/SocketStreamHandle.h: * platform/network/SocketStreamHandleClient.h: * platform/network/cf/SocketStreamHandleImpl.h: * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::readStreamCallback): (WebCore::SocketStreamHandleImpl::platformSend): * platform/network/curl/SocketStreamHandleImpl.h: * platform/network/curl/SocketStreamHandleImplCurl.cpp: (WebCore::SocketStreamHandleImpl::platformSend): * platform/network/mac/CookieJarMac.mm: (WebCore::cookiesInPartitionForURL): * platform/network/soup/SocketStreamHandleImpl.h: * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::SocketStreamHandleImpl::readBytes): (WebCore::SocketStreamHandleImpl::platformSend): * rendering/BreakLines.h: (WebCore::nextBreakablePositionNonLoosely): (WebCore::nextBreakablePositionLoosely): (WebCore::isBreakable): * rendering/HitTestingTransformState.cpp: (WebCore::HitTestingTransformState::flattenWithTransform): * rendering/ImageQualityController.cpp: (WebCore::ImageQualityController::interpolationQualityFromStyle): (WebCore::ImageQualityController::chooseInterpolationQuality): * rendering/ImageQualityController.h: * rendering/InlineIterator.h: (WebCore::InlineIterator::moveTo): (WebCore::InlineIterator::nextBreakablePosition): (WebCore::InlineIterator::setNextBreakablePosition): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintSelection): (WebCore::InlineTextBox::substringToRender): (WebCore::InlineTextBox::hyphenatedStringForTextRun): (WebCore::InlineTextBox::constructTextRun): * rendering/InlineTextBox.h: (WebCore::InlineTextBox::substringToRender): (WebCore::InlineTextBox::hyphenatedStringForTextRun): (WebCore::InlineTextBox::constructTextRun): * rendering/OrderIterator.cpp: (WebCore::OrderIterator::reset): * rendering/OrderIterator.h: * rendering/PaintInfo.h: (WebCore::PaintInfo::applyTransform): * rendering/RenderBlock.cpp: (WebCore::RenderBlockRareData::RenderBlockRareData): (WebCore::RenderBlock::baselinePosition): (WebCore::RenderBlock::firstLineBaseline): (WebCore::RenderBlock::inlineBlockBaseline): (WebCore::RenderBlock::setCachedFlowThreadContainingBlockNeedsUpdate): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::firstLineBaseline): (WebCore::RenderBlockFlow::inlineBlockBaseline): * rendering/RenderBlockFlow.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::constrainLogicalHeightByMinMax): (WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax): (WebCore::RenderBox::overrideContainingBlockContentLogicalWidth): (WebCore::RenderBox::overrideContainingBlockContentLogicalHeight): (WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth): (WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight): (WebCore::RenderBox::adjustContentBoxLogicalHeightForBoxSizing): (WebCore::RenderBox::computeLogicalHeight): (WebCore::RenderBox::computeLogicalHeightUsing): (WebCore::RenderBox::computeContentLogicalHeight): (WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing): (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing): (WebCore::RenderBox::computePercentageLogicalHeight): (WebCore::RenderBox::computeReplacedLogicalHeightUsing): (WebCore::RenderBox::availableLogicalHeight): (WebCore::RenderBox::availableLogicalHeightUsing): * rendering/RenderBox.h: (WebCore::RenderBox::firstLineBaseline): (WebCore::RenderBox::inlineBlockBaseline): * rendering/RenderCombineText.cpp: (WebCore::RenderCombineText::computeTextOrigin): * rendering/RenderCombineText.h: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::baselinePosition): (WebCore::RenderFlexibleBox::firstLineBaseline): (WebCore::RenderFlexibleBox::inlineBlockBaseline): (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild): (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): (WebCore::RenderFlexibleBox::marginBoxAscentForChild): (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing): (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax): (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): * rendering/RenderFlexibleBox.h: * rendering/RenderFlowThread.cpp: (WebCore::RenderFlowThread::addForcedRegionBreak): * rendering/RenderGrid.cpp: (WebCore::GridTrack::setGrowthLimit): (WebCore::GridTrack::setGrowthLimitCap): (WebCore::GridTrack::growthLimitCap): (WebCore::RenderGrid::GridSizingData::freeSpace): (WebCore::RenderGrid::GridSizingData::availableSpace): (WebCore::RenderGrid::GridSizingData::setAvailableSpace): (WebCore::RenderGrid::GridSizingData::setFreeSpace): (WebCore::RenderGrid::layoutBlock): (WebCore::RenderGrid::computeIntrinsicLogicalWidths): (WebCore::RenderGrid::computeIntrinsicLogicalHeight): (WebCore::RenderGrid::computeIntrinsicLogicalContentHeightUsing): (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): (WebCore::overrideContainingBlockContentSizeForChild): (WebCore::setOverrideContainingBlockContentSizeForChild): (WebCore::RenderGrid::logicalHeightForChild): (WebCore::RenderGrid::minSizeForChild): (WebCore::RenderGrid::minContentForChild): (WebCore::RenderGrid::maxContentForChild): (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): (WebCore::sortByGridTrackGrowthPotential): (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): (WebCore::RenderGrid::computeAutoRepeatTracksCount): (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): (WebCore::RenderGrid::layoutGridItems): * rendering/RenderGrid.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerByApplyingTransform): (WebCore::RenderLayer::hitTestLayer): * rendering/RenderLayerBacking.cpp: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItem): (WebCore::RenderListBox::listIndexIsVisible): (WebCore::RenderListBox::computeFirstIndexesVisibleInPaddingTopBottomAreas): * rendering/RenderListBox.h: * rendering/RenderMenuList.h: * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::calculateMaxColumnHeight): * rendering/RenderTable.cpp: (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight): (WebCore::RenderTable::baselinePosition): (WebCore::RenderTable::inlineBlockBaseline): (WebCore::RenderTable::firstLineBaseline): * rendering/RenderTable.h: * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::cellBaselinePosition): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::firstLineBaseline): * rendering/RenderTableSection.h: * rendering/RenderText.cpp: (WebCore::RenderText::computePreferredLogicalWidths): (WebCore::RenderText::stringView): * rendering/RenderText.h: * rendering/RenderTextControl.h: * rendering/RenderView.cpp: (WebCore::RenderView::setSelection): (WebCore::RenderView::splitSelectionBetweenSubtrees): (WebCore::RenderView::getSelection): (WebCore::RenderView::clearSelection): * rendering/RenderView.h: * rendering/SelectionSubtreeRoot.h: (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::SelectionSubtreeData): (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartPos): (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEndPos): (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionStartPos): (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionEndPos): (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::clearSelection): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::LineState::lastFragment): (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns): (WebCore::SimpleLineLayout::createTextRuns): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): * rendering/line/BreakingContext.h: (WebCore::WordTrailingSpace::width): (WebCore::BreakingContext::commitLineBreakAtCurrentWidth): (WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition): (WebCore::BreakingContext::InlineIteratorHistory::moveTo): (WebCore::tryHyphenating): (WebCore::BreakingContext::computeAdditionalBetweenWordsWidth): (WebCore::BreakingContext::handleText): (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): * rendering/mathml/MathMLStyle.cpp: (WebCore::MathMLStyle::resolveMathMLStyle): * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::RenderMathMLBlock::baselinePosition): (WebCore::RenderMathMLTable::firstLineBaseline): * rendering/mathml/RenderMathMLBlock.h: (WebCore::RenderMathMLBlock::ascentForChild): * rendering/mathml/RenderMathMLFraction.cpp: (WebCore::RenderMathMLFraction::firstLineBaseline): * rendering/mathml/RenderMathMLFraction.h: * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::firstLineBaseline): * rendering/mathml/RenderMathMLOperator.h: * rendering/mathml/RenderMathMLPadded.cpp: (WebCore::RenderMathMLPadded::firstLineBaseline): * rendering/mathml/RenderMathMLPadded.h: * rendering/mathml/RenderMathMLRow.cpp: (WebCore::RenderMathMLRow::firstLineBaseline): * rendering/mathml/RenderMathMLRow.h: * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): (WebCore::RenderMathMLScripts::firstLineBaseline): * rendering/mathml/RenderMathMLScripts.h: * rendering/mathml/RenderMathMLSpace.cpp: (WebCore::RenderMathMLSpace::firstLineBaseline): * rendering/mathml/RenderMathMLSpace.h: * rendering/mathml/RenderMathMLToken.cpp: (WebCore::RenderMathMLToken::updateMathVariantGlyph): (WebCore::RenderMathMLToken::firstLineBaseline): * rendering/mathml/RenderMathMLToken.h: * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::nodeAtFloatPoint): * rendering/svg/RenderSVGForeignObject.cpp: (WebCore::RenderSVGForeignObject::nodeAtFloatPoint): * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::nodeAtFloatPoint): * rendering/svg/RenderSVGResourceClipper.cpp: (WebCore::RenderSVGResourceClipper::hitTestClipContent): * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::postApplyResource): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::nodeAtPoint): * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::setupNonScalingStrokeContext): (WebCore::RenderSVGShape::nodeAtFloatPoint): (WebCore::RenderSVGShape::calculateStrokeBoundingBox): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::nodeAtFloatPoint): * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::intersectRepaintRectWithShadows): * rendering/svg/SVGRenderingContext.cpp: (WebCore::SVGRenderingContext::clipToImageBuffer): * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures): * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::Parent::Parent): * style/RenderTreeUpdater.h: * style/StyleScope.h: * svg/SVGElement.cpp: (WebCore::SVGElement::parseAttribute): (WebCore::SVGElement::resolveCustomStyle): * svg/SVGElement.h: * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::transcodeGlyphPaths): (WebCore::SVGToOTFFontConverter::processGlyphElement): (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): (WebCore::convertSVGToOTFFont): * svg/SVGToOTFFontConversion.h: * testing/Internals.cpp: (WebCore::Internals::setEventThrottlingBehaviorOverride): (WebCore::Internals::eventThrottlingBehaviorOverride): * testing/Internals.h: * workers/Worker.h: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::prepareToSend): (WebCore::XMLHttpRequest::didFinishLoading): * xml/XMLHttpRequest.h: 2016-11-26 Csaba Osztrogonác <ossy@webkit.org> Fix build warnings in WebCore/Modules/indexeddb/server/IDBSerialization.cp https://bugs.webkit.org/show_bug.cgi?id=165070 Reviewed by Brady Eidson. * Modules/indexeddb/server/IDBSerialization.cpp: 2016-11-26 Sam Weinig <sam@webkit.org> Convert IntersectionObserver over to using RuntimeEnabledFeatures so it can be properly excluded from script https://bugs.webkit.org/show_bug.cgi?id=164965 Reviewed by Simon Fraser. * bindings/generic/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::reset): * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setIntersectionObserverEnabled): (WebCore::RuntimeEnabledFeatures::intersectionObserverEnabled): Add intersection observer setting. * page/IntersectionObserver.idl: * page/IntersectionObserverEntry.idl: Convert to use EnabledAtRuntime extended attribute. * page/Settings.in: Remove the old intersection observer setting. 2016-11-26 Simon Fraser <simon.fraser@apple.com> Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime https://bugs.webkit.org/show_bug.cgi?id=164992 Reviewed by Darin Adler. std::chrono::milliseconds -> Seconds. Rename Document::elapsedTime() to timeSinceDocumentCreation() which is more explicit. Replace INSTRUMENT_LAYOUT_SCHEDULING with LOG(Layout...). * dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::implicitClose): (WebCore::Document::isLayoutTimerActive): (WebCore::Document::minimumLayoutDelay): (WebCore::Document::timeSinceDocumentCreation): (WebCore::Document::elapsedTime): Deleted. * dom/Document.h: * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::layoutTimerFired): (WebCore::FrameView::scheduleRelayout): (WebCore::FrameView::scheduleRelayoutOfSubtree): (WebCore::FrameView::unscheduleRelayout): * page/Settings.cpp: (WebCore::Settings::setLayoutInterval): * page/Settings.h: (WebCore::Settings::layoutInterval): * style/StyleScope.cpp: (WebCore::Style::Scope::removePendingSheet): * workers/WorkerRunLoop.cpp: (WebCore::WorkerRunLoop::runInMode): 2016-11-26 Simon Fraser <simon.fraser@apple.com> Composited negative z-index elements are hidden behind the body sometimes https://bugs.webkit.org/show_bug.cgi?id=165080 rdar://problem/22260229 Reviewed by Zalan Bujtas. If the <body> falls into the "directly composited background color" code path (say, because it's composited because of composited negative z-index children, and has content of its own), then we failed to take root background propagation into account, and put the opaque root background color on the body's layer. Fix by sharing some code from RenderBox related to whether the body's renderer paints its background. Tests cover the buggy case, and the case where the <html> has its own background color. Tests: compositing/backgrounds/negative-z-index-behind-body-non-propagated.html compositing/backgrounds/negative-z-index-behind-body.html * rendering/RenderBox.cpp: (WebCore::RenderBox::paintsOwnBackground): (WebCore::RenderBox::paintBackground): (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): (WebCore::skipBodyBackground): Deleted. * rendering/RenderBox.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor): 2016-11-25 Myles C. Maxfield <mmaxfield@apple.com> [CSS Font Loading] FontFace.load() promises don't always fire https://bugs.webkit.org/show_bug.cgi?id=165037 Reviewed by Simon Fraser. We currently handle web fonts in two phases. The first phase is building up StyleRuleFontFace objects which reflect the style on the page. The second is creating CSSFontFace objects from those StyleRuleFontFace objects. When script modifies the style on the page, we can often update the CSSFontFace objects, but there are some modifications which we don't know how to model. For these operations, we destroy the CSSFontFace objects and rebuild them from the newly modified StyleRuleFontFace objects. Normally, this is fine. However, with the CSS font loading API, the CSSFontFaces back Javascript objects which will persist across the rebuilding step mentioned above. This means that the FontFace objects need to adopt the new CSSFontFace objects and forget the old CSSFontFace objects. This gets a little tricky because the operation which caused the rebuild may actually be a modification to the specific @font-face block which backs a Javascript FontFace object. Because the CSSOM can be used to change the src: attribute of the FontFace object, I decided in r201971 to clear the FontFace's promise in case an old load would cause the promise to resolve. However, this would never happen because the old CSSFontFace is unparented during the FontFace::adopt()ion of the new CSSFontFace. Therefore, old loads may still complete, but the signal would never make it to the FontFace and therefore would not cause the promise to resolve. In addition, clearing the promise during a rebuild is problematic because that rebuild may be caused by operations which have nothing to do with the specific FontFace object in question (so the FontFace object should be observably uneffected.) Because of the above reasons, this patch simply stops clearing the promise during the rebuild phase. Tests: fast/text/fontface-rebuild-during-loading.html fast/text/fontface-rebuild-during-loading-2.html * css/FontFace.cpp: (WebCore::FontFace::adopt): 2016-11-25 Andreas Kling <akling@apple.com> MemoryPressureHandler should only trigger synchronous GC on iOS <https://webkit.org/b/165043> <rdar://problem/29312684> Reviewed by Sam Weinig. On iOS we know that there is really only one web process in play at a time, so it's okay to do a synchronous GC immediately in response to high memory pressure. On other platforms, we may have tens or hundreds of web processes, and if they all start doing full GCs at the same time, it can easily bring a system to its knees if it's already under pressure. Fix this by using garbageCollectSoon() on non-iOS platforms. * page/MemoryRelease.cpp: (WebCore::releaseCriticalMemory): 2016-11-23 Sergio Villar Senin <svillar@igalia.com> [css-grid] Convert grid representation into a class https://bugs.webkit.org/show_bug.cgi?id=165042 Reviewed by Manuel Rego Casasnovas. So far grids are represented as Vectors of Vectors. There are a couple of issues associated to that decision. First or all, the source code in RenderGrid assumes the existence of that data structure, meaning that we cannot eventually change it without changing a lot of code. Apart from the coupling there is another issue, RenderGrid is full of methods to access and manipulate that data structure. Instead, it'd be much better to have a Grid class encapsulating both the data structures and the methods required to access/manipulate it. Note that follow-up patches will move even more data and procedures into this new class from the RenderGrid code. No new tests required as this is a refactoring. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::Grid::ensureGridSize): Moved from RenderGrid. (WebCore::RenderGrid::Grid::insert): Ditto. (WebCore::RenderGrid::Grid::clear): Ditto. (WebCore::RenderGrid::GridIterator::GridIterator): (WebCore::RenderGrid::gridColumnCount): Use Grid's methods. (WebCore::RenderGrid::gridRowCount): Ditto. (WebCore::RenderGrid::placeItemsOnGrid): Use Grid's methods to insert children. (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): Ditto. (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid): Ditto. (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): Ditto. (WebCore::RenderGrid::numTracks): Use Grid's methods. (WebCore::RenderGrid::ensureGridSize): Deleted. Moved to Grid class. (WebCore::RenderGrid::insertItemIntoGrid): Deleted. Moved to Grid class. * rendering/RenderGrid.h: 2016-11-24 Antti Koivisto <antti@apple.com> Remove unused bool return from Element::willRecalcStyle https://bugs.webkit.org/show_bug.cgi?id=165059 Reviewed by Andreas Kling. It is always true. * dom/Element.cpp: (WebCore::Element::willRecalcStyle): * dom/Element.h: * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::willRecalcStyle): * html/HTMLFrameSetElement.h: * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::willRecalcStyle): * html/HTMLPlugInImageElement.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveComposedTree): * svg/SVGElement.cpp: (WebCore::SVGElement::willRecalcStyle): * svg/SVGElement.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::willRecalcStyle): * svg/SVGUseElement.h: 2016-11-22 Antti Koivisto <antti@apple.com> CrashTracer: [USER] com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::ExtensionStyleSheets::pageUserSheet + 14 https://bugs.webkit.org/show_bug.cgi?id=165030 Reviewed by Darin Adler. We failed to reset the style scope when an element was moved to a different document. This could lead to having dangling document pointers in style scope and style resolver. Test: fast/shadow-dom/shadow-host-move-to-different-document.html * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::didMoveToNewDocument): Reset style scope. * dom/ShadowRoot.h: * style/StyleScope.cpp: (WebCore::Style::Scope::resolver): Some more assertions. * style/StyleScope.h: (WebCore::Style::Scope::document): 2016-11-22 Darin Adler <darin@apple.com> Make normal case fast in the input element limitString function https://bugs.webkit.org/show_bug.cgi?id=165023 Reviewed by Dan Bernstein. When running Speedometer, the limitLength function was showing up as hot. Fixed a couple obvious problems with that function's performance. * html/TextFieldInputType.cpp: (WebCore::isASCIILineBreak): Deleted. The isHTMLLineBreak function does the same thing, but faster. (WebCore::limitLength): Added a FIXME comment explaining that the function isn't really a good idea. Don't call through to numCharactersInGraphemeClusters at all for 8-bit strings since we don't allow CR or LF characters in the string anyway, so there are no grapheme clusters more than a single code unit. Removed optimization when the length is the string's length that String::left already does. (WebCore::TextFieldInputType::sanitizeValue): Use isHTMLLineBreak instead of isASCIILineBreak. (WebCore::TextFieldInputType::handleBeforeTextInsertedEvent): Ditto. * platform/LocalizedStrings.cpp: Use auto a lot more rather than writing out RetainPtr. (WebCore::truncatedStringForLookupMenuItem): Removed unneeded special case for empty strings. Removed unneeded string with the ellipsis character in it, since the makeString function already knows how to append a character to a string. * rendering/RenderText.cpp: (WebCore::mapLineBreakToIteratorMode): Updated for change to LineBreakIteratorMode. * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition): Ditto. 2016-11-21 Sergio Villar Senin <svillar@igalia.com> [css-grid] Isolate size of internal representation from actual grid size https://bugs.webkit.org/show_bug.cgi?id=165006 Reviewed by Manuel Rego Casasnovas. RenderGrid has an internal representation of a grid used to place grid items, compute grid positions, run the track sizing algorithm etc. That data structure normally has exactly the same size as the actual grid specified using the grid-template-xxx properties (or any other shorthand). But in some cases, like for example when the grid is empty, the internal data structure does not really match the actual grid. In the particular case of empty grids no memory allocations are done to create a grid representation as it is not needed. From now on both gridColumnCount() and gridRowCount() will always return the size of the data structure representing the grid whereas the newly added numTracks() will always return the actual size of the grid. This is the first required step of the process of isolating the data used by the grid track sizing algorithm from the actual internal state of the LayoutGrid object. No new tests as this is just a code refactoring. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::gridColumnCount): Always return the number of columns of the internal data structure to represent the grid. (WebCore::RenderGrid::layoutBlock): (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use the actual size of the grid to create the GridSizingData structure. (WebCore::RenderGrid::placeItemsOnGrid): Use the actual size of the grid to create the GridSizingData structure. (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): (WebCore::RenderGrid::numTracks): New method which returns the actual size of the grid. * rendering/RenderGrid.h: 2016-11-21 Konstantin Tokarev <annulen@yandex.ru> Disable #line markers in bison output on Windows https://bugs.webkit.org/show_bug.cgi?id=164973 Reviewed by Darin Adler. New bison versions since 3.0 have bug that causes unescaped paths to be printed in #line directives. On Windows CMake passes absolute paths to bison that have backslashes in them, leading to compiler errors or warnings because of unrecognized escape sequences. No new tests needed. * css/makegrammar.pl: 2016-11-21 Olivier Blin <olivier.blin@softathome.com> [cmake][OpenWebRTC] Move SDPProcessorScriptResource rules to common WebCore https://bugs.webkit.org/show_bug.cgi?id=164937 Reviewed by Youenn Fablet. SDPProcessorScriptResource has been moved in common mediastream directory (bug 163940). Since it is not specific to the GTK port, the matching cmake rules should be moved out from PlatformGTK.cmake to the main WebCore CMakeLists.txt. This is needed to build OpenWebRTC support in other ports, WPE in my case, probably Mac, EFL and Qt as well. This also fixes the path in SDP scripts dependencies, the old openwebrtc subdir was still being used. No new tests, build fix only * CMakeLists.txt: * PlatformGTK.cmake: 2016-11-21 Carlos Garcia Campos <cgarcia@igalia.com> Add URL::hostAndPort() https://bugs.webkit.org/show_bug.cgi?id=164907 Reviewed by Alex Christensen. As a convenient way of getting the host and port (if any) as a string. * html/URLUtils.h: (WebCore::URLUtils<T>::host): Use URL::hostAndPort(). * page/Location.cpp: (WebCore::Location::host): Ditto. * platform/URL.cpp: (WebCore::URL::hostAndPort): Return host:port or just host if there isn't a port. * platform/URL.h: * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): Use URL::hostAndPort(). * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::host): Ditto. 2016-11-21 Philippe Normand <pnormand@igalia.com> [WebRTC][OpenWebRTC] parse turns urls https://bugs.webkit.org/show_bug.cgi?id=164587 Reviewed by Alejandro G. Castro. * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers): Hook turns servers between the RTCConfiguration and the underlying OpenWebRTC layer. 2016-11-21 Philippe Normand <pnormand@igalia.com> [Gstreamer] Add volume and mute support to the WebRTC mediaplayer https://bugs.webkit.org/show_bug.cgi?id=153828 Reviewed by Darin Adler. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::setVolume): New implementation setting the OWR source volume property. (WebCore::MediaPlayerPrivateGStreamerOwr::setMuted): New implementation setting the OWR source mute property. (WebCore::MediaPlayerPrivateGStreamerOwr::maybeHandleChangeMutedState): Also set audio OWR source mute state depending on the track enabled state. (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged): chain to maybeHandleChangeMuteState. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h: 2016-11-21 Alejandro G. Castro <alex@igalia.com> and Philippe Normand <pnormand@igalia.com> [WebRTC][OpenWebRTC] RTP bundling support https://bugs.webkit.org/show_bug.cgi?id=162333 Reviewed by Alejandro G. Castro. Configure the OpenWebRTC transport agent bundle policy according to the RTCConfiguration and pass the receive SSRCs over to OpenWebRTC as well. Those are needed so the agent is aware of the bundle layout. * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::updateReceiveConfiguration): (WebCore::MediaEndpointOwr::updateSendConfiguration): (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers): 2016-11-20 Zan Dobersek <zdobersek@igalia.com> [EncryptedMedia] Make EME API runtime-enabled https://bugs.webkit.org/show_bug.cgi?id=164927 Reviewed by Jer Noble. Update the EME API IDL definitions to use the EnabledAtRuntime attribute on the relevant interfaces, attributes and operations. EncryptedMediaAPI is used as the attribute value. The corresponding getter, setter and member boolean are added to the RuntimeEnabledFeatures class. * Modules/encryptedmedia/MediaKeyMessageEvent.idl: * Modules/encryptedmedia/MediaKeySession.idl: * Modules/encryptedmedia/MediaKeyStatusMap.idl: * Modules/encryptedmedia/MediaKeySystemAccess.idl: * Modules/encryptedmedia/MediaKeys.idl: * Modules/encryptedmedia/NavigatorEME.idl: * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setEncryptedMediaAPIEnabled): (WebCore::RuntimeEnabledFeatures::encryptedMediaAPIEnabled): * html/HTMLMediaElement.idl: * html/MediaEncryptedEvent.idl: 2016-11-20 Eric Carlson <eric.carlson@apple.com> REGRESSION (r208606?): LayoutTest fast/mediastream/enumerating-crash.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=164715 <rdar://problem/29277180> Reviewed by Alexey Proskuryakov. No new tests, fixes an existing test crash. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::contextDestroyed): Call base class method before clearing m_controller because it nullifies the security context. 2016-11-19 Chris Dumez <cdumez@apple.com> Update HTML form validation messages https://bugs.webkit.org/show_bug.cgi?id=164957 <rdar://problem/29338669> Reviewed by Darin Adler. Update HTML form validation messages as per recent feedback: - Drop the "Please". - Drop the period at the end. - Drop the "if you want to proceed" that was used only for the checkbox. No new tests, rebaselined existing tests. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::validationMessageValueMissingText): (WebCore::validationMessageValueMissingForCheckboxText): (WebCore::validationMessageValueMissingForFileText): (WebCore::validationMessageValueMissingForRadioText): (WebCore::validationMessageValueMissingForSelectText): (WebCore::validationMessageTypeMismatchText): (WebCore::validationMessageTypeMismatchForEmailText): (WebCore::validationMessageTypeMismatchForURLText): (WebCore::validationMessagePatternMismatchText): (WebCore::validationMessageTooShortText): (WebCore::validationMessageTooLongText): (WebCore::validationMessageRangeUnderflowText): (WebCore::validationMessageRangeOverflowText): (WebCore::validationMessageStepMismatchText): (WebCore::validationMessageBadInputForNumberText): 2016-11-19 Joanmarie Diggs <jdiggs@igalia.com> AX: [ATK] Implement selection interface and states for elements supporting aria-selected and for menu roles https://bugs.webkit.org/show_bug.cgi?id=164865 Reviewed by Chris Fleizach. Implement AtkSelection and support ATK_STATE_SELECTABLE and ATK_STATE_SELECTED for elements supporting aria-selected and for menu-related roles. Also enable the equivalent support for the Mac because NSAccessibilitySelectedChildrenAttribute is included as supported on the same roles. In addition, fix several bugs discovered along the way: Call isSelected() on role tab, because tab supports aria-selected; not aria-checked. Correct ATK mapping of ListBoxRole and ListBoxOptionRole for combobox descendants. Always defer to WebCore for inclusion/exclusion decisions related to elements with an explicit ARIA role. Tests: accessibility/aria-combobox-hierarchy.html accessibility/aria-selected-menu-items.html accessibility/aria-selected.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::selectedTabItem): (WebCore::AccessibilityNodeObject::canSetSelectedAttribute): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isDescendantOfRole): * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::canHaveSelectedChildren): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::isSelected): (WebCore::AccessibilityRenderObject::canHaveSelectedChildren): (WebCore::AccessibilityRenderObject::selectedChildren): * accessibility/AccessibilityRenderObject.h: * accessibility/atk/AccessibilityObjectAtk.cpp: (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (webkitAccessibleSelectionGetSelectionCount): * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (atkRole): (getInterfaceMaskFromObject): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2016-11-19 Simon Fraser <simon.fraser@apple.com> [iOS WK2] When zoomed in and panning on pages with fixed bars, parts of the bars are sometimes missing https://bugs.webkit.org/show_bug.cgi?id=164855 Reviewed by Sam Weinig. During UI-process panning and zooming, we send visible rect updates to the web process with inStableState=false, and don't update GraphicsLayers until we get into a stable state. This causes a problem where the web process has a stale notion of where the GraphicsLayers for position:fixed elements are, but is then told to update tiling coverage with an up-to-date visible rect. The existing "sync layer positions" path isn't useful to fix this, because it breaks the relationship between the GraphicsLayer positions and their FixedPositionViewportConstraints in the scrolling tree. To address this, add the notion of an Optional<> approximatePosition on GraphicsLayers. This is used only by the coverageRect computation code path, and is cleared by a setPosition(). ApproximatePositions are pushed onto GraphicsLayers via the syncViewportConstrainedLayerPositions() code path (renamed to reconcileViewportConstrainedLayerPositions). This allows us to remmove "viewportIsStable" from GraphicsLayer flushing, and FrameView. SetOrSyncScrollingLayerPosition is made into an enum class. Tested by scrollingcoordinator/ios/non-stable-viewport-scroll.html * page/FrameView.cpp: (WebCore::FrameView::reset): * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): (WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate): * page/scrolling/ScrollingCoordinator.cpp: (WebCore::operator<<): * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::reconcileScrollingState): (WebCore::ScrollingCoordinator::reconcileViewportConstrainedLayerPositions): (WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions): Deleted. * page/scrolling/ScrollingStateFixedNode.cpp: (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): (WebCore::ScrollingStateFixedNode::syncLayerPositionForViewportRect): Deleted. * page/scrolling/ScrollingStateFixedNode.h: * page/scrolling/ScrollingStateNode.h: (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): (WebCore::ScrollingStateNode::syncLayerPositionForViewportRect): Deleted. * page/scrolling/ScrollingStateStickyNode.cpp: (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): (WebCore::ScrollingStateStickyNode::syncLayerPositionForViewportRect): Deleted. * page/scrolling/ScrollingStateStickyNode.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): * page/scrolling/ios/ScrollingTreeIOS.cpp: (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll): * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpProperties): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::setPosition): (WebCore::GraphicsLayer::approximatePosition): (WebCore::GraphicsLayer::setApproximatePosition): (WebCore::GraphicsLayer::flushCompositingState): (WebCore::GraphicsLayer::flushCompositingStateForThisLayerOnly): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::flushCompositingState): (WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly): (WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect): (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): No longer bail for viewportConstained layers when the viewport is unstable. (WebCore::GraphicsLayerCA::recursiveCommitChanges): * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::CommitState::CommitState): Deleted. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::flushCompositingState): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::flushCompositingState): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): 2016-11-19 Joanmarie Diggs <jdiggs@igalia.com> AX: [ATK] Expose aria-busy via ATK_STATE_BUSY https://bugs.webkit.org/show_bug.cgi?id=164909 Reviewed by Chris Fleizach. Expose aria-busy via ATK_STATE_BUSY. Also rename ariaLiveRegionBusy() to isBusy() because in ARIA 1.1 aria-busy is no longer limited to live regions. Test: accessibility/aria-busy.html * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isBusy): (WebCore::AccessibilityObject::ariaLiveRegionBusy): Deleted. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::isBusy): (WebCore::AccessibilityRenderObject::ariaLiveRegionBusy): Deleted. * accessibility/AccessibilityRenderObject.h: * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (setAtkStateSetFromCoreObject): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityARIAIsBusy]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): 2016-11-19 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r200964): Tab focus navigation is broken on results.en.voyages-sncf.com https://bugs.webkit.org/show_bug.cgi?id=164888 Reviewed by Antti Koivisto. The bug was caused by FocusNavigationScope::parentInScope incorrectly returning nullptr when moving out of a user agent shadow tree of a SVG use element. Fixed the bug by explicitly checking against the focus scope's root node or its slot element. Also removed a superfluous early return when the parent node is a focus scope. Tests: fast/shadow-dom/focus-navigation-out-of-slot.html fast/shadow-dom/focus-navigation-passes-shadow-host.html fast/shadow-dom/focus-navigation-passes-svg-use-element.html * page/FocusController.cpp: (WebCore::FocusNavigationScope::parentInScope): 2016-11-18 Simon Fraser <simon.fraser@apple.com> [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override https://bugs.webkit.org/show_bug.cgi?id=164980 Reviewed by Chris Dumez. WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser" flag that impacts tile coverage. During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare(). Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior. Tests: fast/scrolling/ios/scroll-events-default.html fast/scrolling/ios/scroll-events-responsive.html fast/scrolling/ios/scroll-events-unresponsive.html * page/Page.h: (WebCore::Page::eventThrottlingBehaviorOverride): (WebCore::Page::setEventThrottlingBehaviorOverride): * testing/Internals.cpp: (WebCore::Internals::setEventThrottlingBehaviorOverride): (WebCore::Internals::eventThrottlingBehaviorOverride): * testing/Internals.h: * testing/Internals.idl: 2016-11-18 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix the build after r208917. * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): 2016-11-18 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix the build after r208917. * dom/CustomElementReactionQueue.cpp: 2016-11-18 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::decrypt to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164739 <rdar://problem/29257848> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::decrypt method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-decrypt. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-decrypt. 2. It implements decrypt operations of the following algorithms: AES-CBC, RSAES-PKCS1-V1_5, and RSA-OAEP. Tests: crypto/subtle/aes-cbc-decrypt-malformed-parameters.html crypto/subtle/aes-cbc-generate-key-encrypt-decrypt.html crypto/subtle/aes-cbc-import-key-decrypt.html crypto/subtle/decrypt-malformed-parameters.html crypto/subtle/rsa-oaep-decrypt-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label.html crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html crypto/subtle/rsa-oaep-import-key-decrypt-label.html crypto/subtle/rsa-oaep-import-key-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html crypto/workers/subtle/aes-cbc-import-key-decrypt.html crypto/workers/subtle/rsa-oaep-import-key-decrypt.html crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::toCryptoKey): (WebCore::toVector): (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::jsSubtleCryptoFunctionDecryptPromise): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::JSSubtleCrypto::decrypt): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::decrypt): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::decryptRSAES_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::decryptRSA_OAEP): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): 2016-11-18 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r208837. The bots did not show a progression Reverted changeset: "REGRESSION(r208082): 1% Speedometer regression on iOS" https://bugs.webkit.org/show_bug.cgi?id=164852 http://trac.webkit.org/changeset/208837 2016-11-18 Simon Fraser <simon.fraser@apple.com> Remove use of std::chrono in WebPage and entrained code https://bugs.webkit.org/show_bug.cgi?id=164967 Reviewed by Tim Horton. Replace std::chrono with Seconds and Monotonic Time. Use more C++11 initialization for WebPage data members. * page/ChromeClient.h: * page/FrameView.cpp: (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::setScrollVelocity): * page/FrameView.h: * platform/Timer.h: (WebCore::TimerBase::startRepeating): (WebCore::TimerBase::startOneShot): (WebCore::TimerBase::augmentFireInterval): (WebCore::TimerBase::augmentRepeatInterval): * platform/graphics/TiledBacking.h: (WebCore::VelocityData::VelocityData): * platform/graphics/ca/TileController.cpp: (WebCore::TileController::adjustTileCoverageRect): 2016-11-18 Dean Jackson <dino@apple.com> AX: "(inverted-colors)" media query only matches on page reload; should match on change https://bugs.webkit.org/show_bug.cgi?id=163564 <rdar://problem/28807350> Reviewed by Simon Fraser. Mark some media queries as responding to notifications that system accessibility settings have changed. When Page gets told that has happened, check if any of the results have changed. Tests: fast/media/mq-inverted-colors-live-update.html fast/media/mq-monochrome-live-update.html fast/media/mq-prefers-reduced-motion-live-update.html * css/MediaQueryEvaluator.cpp: (WebCore::isAccessibilitySettingsDependent): (WebCore::MediaQueryEvaluator::evaluate): * css/StyleResolver.cpp: (WebCore::StyleResolver::addAccessibilitySettingsDependentMediaQueryResult): (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange): * css/StyleResolver.h: (WebCore::StyleResolver::hasAccessibilitySettingsDependentMediaQueries): * page/Page.cpp: (WebCore::Page::accessibilitySettingsDidChange): * page/Page.h: 2016-11-18 Anders Carlsson <andersca@apple.com> Rename the 'other' Apple Pay Button type to 'donate' https://bugs.webkit.org/show_bug.cgi?id=164978 Reviewed by Dean Jackson. * DerivedSources.make: * WebCorePrefix.h: * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType): * css/CSSValueKeywords.in: * css/parser/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: 2016-11-18 Myles C. Maxfield <mmaxfield@apple.com> [WebGL2] Implement texStorage2D() https://bugs.webkit.org/show_bug.cgi?id=164493 Reviewed by Dean Jackson. Create a new validation function which only accepts sized internalFormats. After running texStorage2D(), we also texSubImage2D() to zero-fill it. This is to compensate for potentially buggy drivers. Because glTexStorage2D() was only added to OpenGL in version 4.2, not all OpenGL 3.2+ contexts can implement this command. However, according to https://developer.apple.com/opengl/capabilities/ all Apple GPUs have the GL_ARB_texture_storage which implements this call. In the future, we could implement texStorage2D() on top of texImage2D() if there are any ports which want WebGL2 but don't have 4.2 and don't have the extension. Also, when calling texStorage2D, callers specify an internalFormat but not a type/format pair. This means that storing the texture's type is only valid for WebGL 1 contexts. This patch surrounds all calls to reading the texture type with guards and adds an ASSERT() at the read site to make sure the right thing is happening. Test: fast/canvas/webgl/webgl2-texStorage.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateTexStorageFuncParameters): (WebCore::WebGL2RenderingContext::texStorage2D): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): (WebCore::WebGLRenderingContextBase::validateTexFunc): (WebCore::WebGLRenderingContextBase::validateTexFuncData): (WebCore::WebGLRenderingContextBase::texImage2D): * html/canvas/WebGLTexture.cpp: (WebCore::WebGLTexture::WebGLTexture): (WebCore::WebGLTexture::getType): (WebCore::WebGLTexture::needToUseBlackTexture): (WebCore::WebGLTexture::canGenerateMipmaps): (WebCore::internalFormatIsFloatType): (WebCore::internalFormatIsHalfFloatType): (WebCore::WebGLTexture::update): * html/canvas/WebGLTexture.h: * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::texImage2DResourceSafe): (WebCore::GraphicsContext3D::packImageData): (WebCore::GraphicsContext3D::extractImageData): * platform/graphics/GraphicsContext3D.h: * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::texStorage2D): (WebCore::GraphicsContext3D::texStorage3D): 2016-11-18 Alex Christensen <achristensen@webkit.org> TextDecoder constructor should not accept replacement encodings https://bugs.webkit.org/show_bug.cgi?id=164903 Reviewed by Chris Dumez. Covered by newly passing web platform tests. * dom/TextDecoder.cpp: (WebCore::TextDecoder::create): https://encoding.spec.whatwg.org/#textdecoder says about the constructor: "If label is either not a label or is a label for replacement, throws a RangeError." See https://bugs.webkit.org/show_bug.cgi?id=159180 for the mapping of the replacement codec names to "replacement". 2016-11-18 Chris Dumez <cdumez@apple.com> Assertion failures in ActiveDOMObject::~ActiveDOMObject under Database destructor https://bugs.webkit.org/show_bug.cgi?id=164955 <rdar://problem/29336715> Reviewed by Brady Eidson. Make sure the Database's DatabaseContext object is destroyed on the context thread given that DatabaseContext is an ActiveDOMObject and there is an assertion in the ActiveDOMObject destructor that it should be destroyed on on the context thread. No new tests, already covered by existing tests. * Modules/webdatabase/Database.cpp: (WebCore::Database::~Database): 2016-11-18 Enrica Casucci <enrica@apple.com> Refactor drag and drop for WebKit2 to encode DragData message exchange. https://bugs.webkit.org/show_bug.cgi?id=164945 Reviewed by Tim Horton. No new tests. No change in functionality. * loader/EmptyClients.h: * page/DragClient.h: * page/DragController.cpp: (WebCore::createMouseEvent): (WebCore::documentFragmentFromDragData): (WebCore::DragController::dragIsMove): (WebCore::DragController::dragEntered): (WebCore::DragController::dragExited): (WebCore::DragController::dragUpdated): (WebCore::DragController::performDragOperation): (WebCore::DragController::dragEnteredOrUpdated): (WebCore::DragController::tryDocumentDrag): (WebCore::DragController::operationForLoad): (WebCore::DragController::dispatchTextInputEventFor): (WebCore::DragController::concludeEditDrag): (WebCore::DragController::canProcessDrag): (WebCore::DragController::tryDHTMLDrag): * page/DragController.h: * page/efl/DragControllerEfl.cpp: (WebCore::DragController::isCopyKeyDown): (WebCore::DragController::dragOperation): * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::isCopyKeyDown): (WebCore::DragController::dragOperation): * page/mac/DragControllerMac.mm: (WebCore::DragController::isCopyKeyDown): (WebCore::DragController::dragOperation): * page/win/DragControllerWin.cpp: (WebCore::DragController::dragOperation): (WebCore::DragController::isCopyKeyDown): * platform/DragData.h: (WebCore::DragData::DragData): 2016-11-18 Jeremy Jones <jeremyj@apple.com> Add runtime flag to enable pointer lock. Enable pointer lock feature for mac. https://bugs.webkit.org/show_bug.cgi?id=163801 Reviewed by Simon Fraser. These tests now pass with DumpRenderTree. LayoutTests/pointer-lock/lock-already-locked.html LayoutTests/pointer-lock/lock-element-not-in-dom.html LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html LayoutTests/pointer-lock/mouse-event-api.html PointerLockController::requestPointerLock now protects against synchronous callback to allowPointerLock(). Add pointerLockEnabled setting. * Configurations/FeatureDefines.xcconfig: * dom/Document.cpp: (WebCore::Document::exitPointerLock): Fix existing typo. (WebCore::Document::pointerLockElement): * features.json: * page/EventHandler.cpp: * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): (WebCore::PointerLockController::requestPointerUnlock): * page/Settings.in: 2016-11-17 Alex Christensen <achristensen@webkit.org> Support IDN2008 with UTS #46 instead of IDN2003 https://bugs.webkit.org/show_bug.cgi?id=144194 Reviewed by Darin Adler. Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII. It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46. This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing to prevent homograph attacks on german domain names with "ß" and "ss" in them. These are now treated as separate domains. Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing, but https://github.com/whatwg/url/issues/110 might change the spec. In addition, http://unicode.org/reports/tr46/ says: "implementations are encouraged to apply the Bidi and ContextJ validity criteria" Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain. Chrome and Firefox do this. ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name. Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it. ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB, which looks somewhat like a dot. We can investigate enabling these checks later. Covered by new API tests and rebased LayoutTests. The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::internationalDomainNameTranscoder): * platform/URLParser.h: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNameWithRange): 2016-11-18 Dean Jackson <dino@apple.com> Better testing for accessibility media queries https://bugs.webkit.org/show_bug.cgi?id=164954 <rdar://problem/29338292> Reviewed by Myles Maxfield. Provide an override mode for the accessibility media queries that rely on system settings. This way we can test that they are least responding to something. Tests: fast/media/mq-inverted-colors-forced-value.html fast/media/mq-monochrome-forced-value.html * css/MediaQueryEvaluator.cpp: Query the Settings to see if we're forcing a value. (WebCore::monochromeEvaluate): (WebCore::invertedColorsEvaluate): (WebCore::prefersReducedMotionEvaluate): * page/Settings.h: * testing/InternalSettings.cpp: Add new forcing values for inverted-colors and monochrome. (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::settingsToInternalSettingsValue): (WebCore::internalSettingsToSettingsValue): (WebCore::InternalSettings::forcedColorsAreInvertedAccessibilityValue): (WebCore::InternalSettings::setForcedColorsAreInvertedAccessibilityValue): (WebCore::InternalSettings::forcedDisplayIsMonochromeAccessibilityValue): (WebCore::InternalSettings::setForcedDisplayIsMonochromeAccessibilityValue): (WebCore::InternalSettings::forcedPrefersReducedMotionAccessibilityValue): (WebCore::InternalSettings::setForcedPrefersReducedMotionAccessibilityValue): (WebCore::InternalSettings::forcedPrefersReducedMotionValue): Deleted. (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): Deleted. * testing/InternalSettings.h: * testing/InternalSettings.idl: 2016-11-18 Myles C. Maxfield <mmaxfield@apple.com> Unsupported emoji are invisible https://bugs.webkit.org/show_bug.cgi?id=164944 <rdar://problem/28591608> Reviewed by Dean Jackson. In WidthIterator, we explicitly skip characters which the OS has no font to render with. However, for emoji, we should draw something to show that there is missing content. Because we have nothing to draw, we can draw the .notdef glyph (empty box, or "tofu"). Test: fast/text/emoji-draws.html * platform/graphics/WidthIterator.cpp: (WebCore::characterMustDrawSomething): (WebCore::WidthIterator::advanceInternal): 2016-11-18 Sam Weinig <sam@webkit.org> [WebIDL] Add support for record types https://bugs.webkit.org/show_bug.cgi?id=164935 Reviewed by Tim Horton. Add support for WebIDLs record types. We map them to HashMap<String, {OtherType}>. * bindings/generic/IDLTypes.h: - Add IDLRecord type and helper predicate. - Remove IDLRegExp which is no longer in WebIDL and we never supported. * bindings/js/JSDOMBinding.cpp: (WebCore::stringToByteString): (WebCore::identifierToByteString): (WebCore::valueToByteString): (WebCore::hasUnpairedSurrogate): (WebCore::stringToUSVString): (WebCore::identifierToUSVString): (WebCore::valueToUSVString): * bindings/js/JSDOMBinding.h: Refactor ByteString and USVString conversion to support converting from either a JSValue or Identifier. * bindings/js/JSDOMConvert.h: (WebCore::DetailConverter<IDLRecord<K, V>>): (WebCore::JSConverter<IDLRecord<K, V>>): Add conversion support for record types. Use Detail::IdentifierConverter helper to convert identifiers to strings using the correct conversion rules. (WebCore::Converter<IDLUnion<T...>>::convert): Update comments in union conversion to match current spec. Remove check for regular expressions and add support for record types. * bindings/scripts/CodeGenerator.pm: (IsRefPtrType): Add record and union types to the list of things that aren't RefPtrs. (IsRecordType): Add predicate for testing if a type is a record. (IsWrapperType): Remove check for union. This is now handled in the IsRefPtrType check. (SkipIncludeHeader): Deleted. (GetSequenceInnerType): Deleted. (GetFrozenArrayInnerType): Deleted. (GetSequenceOrFrozenArrayInnerType): Deleted. Remove no longer necessary functions. * bindings/scripts/CodeGeneratorJS.pm: (AddIncludesForImplementationType): Remove check for includes to skip. This is now only called for interfaces, which should be included unconditionally. (AddToIncludesForIDLType): Add includes and recursive includes for record types. (GenerateOverloadedFunctionOrConstructor): Update to account for records. (GetGnuVTableRefForInterface): (GetGnuVTableNameForInterface): (GetGnuMangledNameForInterface): (GetWinVTableNameForInterface): (GetWinMangledNameForInterface): Strength-reduce GetNativeTypeForConversions and GetNamespaceForInterface into their callers. (GetBaseIDLType): Add support for IDLRecord. Remove call to GetIDLInterfaceName now that is simply the type name. (GetNativeType): Simplify sequence/FrozenArray support and add record support. (GetNativeInnerType): Generalize GetNativeVectorInnerType to work for record types as well. (ShouldPassWrapperByReference): Moved so native type accessors can be together. (NativeToJSValueDOMConvertNeedsState): (NativeToJSValueDOMConvertNeedsGlobalObject): Add record support. (GetNativeTypeForConversions): Deleted. (GetNamespaceForInterface): Deleted. (GetNativeVectorType): Deleted. (GetIDLInterfaceName): Deleted. (GetNativeVectorInnerType): Deleted. Remove unneeded functions. * bindings/scripts/IDLParser.pm: (typeDescription): Add helper useful for debugging, that constructs the string form of a type. (typeByApplyingTypedefs): Add missing call to typeByApplyingTypedefs (this is noted by a fix in JSTestCallbackFunctionWithTypedefs.h) (parseNonAnyType): Remove unused $subtypeName variables and add support for parsing record types. * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/TestObj.idl: Add tests for records and update results. * testing/TypeConversions.h: (WebCore::TypeConversions::testLongRecord): (WebCore::TypeConversions::setTestLongRecord): (WebCore::TypeConversions::testNodeRecord): (WebCore::TypeConversions::setTestNodeRecord): (WebCore::TypeConversions::testSequenceRecord): (WebCore::TypeConversions::setTestSequenceRecord): * testing/TypeConversions.idl: Add record types so it can be tested from layout tests. 2016-11-18 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support font-variation-settings https://bugs.webkit.org/show_bug.cgi?id=164947 Reviewed by Myles Maxfield. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontVariationTag): (WebCore::consumeFontVariationSettings): (WebCore::CSSPropertyParser::parseSingleValue): 2016-11-17 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::encrypt to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164738 <rdar://problem/29257812> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::encrypt method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-encrypt. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-encrypt. 2. It implements encrypt operations of the following algorithms: AES-CBC, RSAES-PKCS1-V1_5, and RSA-OAEP. 3. It addes ASSERT(parameters) for every method that accepts a std::unique_ptr<CryptoAlgorithmParameters>&& type parameter. 4. It changes RefPtr<CryptoKey>&& to Ref<CryptoKey>&& for every method that accepts a CryptoKey. Tests: crypto/subtle/aes-cbc-encrypt-malformed-parameters.html crypto/subtle/aes-cbc-import-key-encrypt.html crypto/subtle/encrypt-malformed-parameters.html crypto/subtle/rsa-oaep-encrypt-malformed-parameters.html crypto/subtle/rsa-oaep-import-key-encrypt-label.html crypto/subtle/rsa-oaep-import-key-encrypt.html crypto/subtle/rsaes-pkcs1-v1_5-import-key-encrypt.html crypto/workers/subtle/aes-cbc-import-key-encrypt.html crypto/workers/subtle/rsa-oaep-import-key-encrypt.html crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-encrypt.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/BufferSource.h: (WebCore::BufferSource::BufferSource): Add a default constructor for initializing an empty BufferSource object. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::JSSubtleCrypto::encrypt): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::encrypt): (WebCore::CryptoAlgorithm::exportKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: * crypto/CryptoKey.h: * crypto/SubtleCrypto.cpp: (WebCore::SubtleCrypto::SubtleCrypto): * crypto/SubtleCrypto.h: (WebCore::SubtleCrypto::workQueue): * crypto/SubtleCrypto.idl: * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::generateKey): (WebCore::CryptoAlgorithmAES_CBC::importKey): (WebCore::CryptoAlgorithmAES_CBC::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): (WebCore::CryptoAlgorithmAES_KW::importKey): (WebCore::CryptoAlgorithmAES_KW::exportKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): (WebCore::CryptoAlgorithmHMAC::importKey): (WebCore::CryptoAlgorithmHMAC::exportKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::encrypt): (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): (WebCore::CryptoAlgorithmRSA_OAEP::importKey): (WebCore::CryptoAlgorithmRSA_OAEP::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::transformAES_CBC): (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::encryptRSAES_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::encryptRSA_OAEP): (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/parameters/AesCbcParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCbcParams.h: Added. * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added. * crypto/parameters/RsaOaepParams.idl: Added. 2016-11-18 Ryan Haddad <ryanhaddad@apple.com> Attempt to fix iOS build again. <rdar://problem/29312689> Unreviewed build fix. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack): (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack): 2016-11-18 Myles C. Maxfield <mmaxfield@apple.com> [CSS Font Loading] FontFaceSet.load() promises don't always fire https://bugs.webkit.org/show_bug.cgi?id=164902 Reviewed by David Hyatt. Test: fast/text/fontfaceset-rebuild-during-loading.html We currently handle web fonts in two phases. The first phase is building up StyleRuleFontFace objects which reflect the style on the page. The second is creating CSSFontFace objects from those StyleRuleFontFace objects. When script modifies the style on the page, we can often update the CSSFontFace objects, but there are some modifications which we don't know how to model. For these operations, we destroy the CSSFontFace objects and rebuild them from the newly modified StyleRuleFontFace objects. Normally, this is fine. However, with the CSS font loading API, the CSSFontFaces back Javascript objects which will persist across the rebuilding step mentioned above. This means that the FontFace objects need to adopt the new CSSFontFace objects and forget the old CSSFontFace objects. There was one bit of state which I forgot to update during this rebuilding phase. The FontFaceSet object contains an internal HashMap where a reference to a CSSFontFace is used as a key. After the rebuilding phase, this reference wasn't updated to point to the new CSSFontFace. The solution is to instead use a reference to the higher-level FontFace as the key to the HashMap. This object is persistent across the rebuilding phase (and it adopts the new CSSFontFaces). There is not a lifetime problem because the FontFace holds a strong reference to its backing CSSFontFace object. This bug didn't cause a memory problem because the HashMap was keeping the old CSSFontFace alive because the key was a strong reference. This patch also adds a lengthy comment explaining how the migration works. * css/CSSFontFace.cpp: (WebCore::CSSFontFace::initializeWrapper): This is another bit of state which didn't survive the rebuilding phase. Moving it here causes it to survive. (WebCore::CSSFontFace::wrapper): * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::addFontFaceRule): * css/FontFaceSet.cpp: (WebCore::FontFaceSet::load): (WebCore::FontFaceSet::faceFinished): * css/FontFaceSet.h: 2016-11-18 Myles C. Maxfield <mmaxfield@apple.com> [SVG -> OTF Font Converter] Fonts advances are not internally consistent inside the generated font file https://bugs.webkit.org/show_bug.cgi?id=164846 <rdar://problem/29031509> Reviewed by Darin Adler. The fonts I'm generating in the SVG -> OTF converter have fractional FUnit values for their advances. The CFF table can encode that, but hmtx can't, which means the font isn't internally consistent. Covered by existing tests. * svg/SVGToOTFFontConversion.cpp: 2016-11-18 Ryan Haddad <ryanhaddad@apple.com> Attempt to fix iOS build. <rdar://problem/29312689> Unreviewed build fix. * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: (WebCore::MediaSelectionGroupAVFObjC::updateOptions): 2016-11-18 Dave Hyatt <hyatt@apple.com> [CSS Parser] Hook up InspectorStyleSheet to the new CSS parser. https://bugs.webkit.org/show_bug.cgi?id=164886 Reviewed by Dean Jackson. * css/CSSGrammar.y.in: Get rid of the CSSRuleSourceData type enum, since StyleRule's type enum is exactly the same. * css/CSSPropertySourceData.cpp: (WebCore::CSSPropertySourceData::CSSPropertySourceData): * css/CSSPropertySourceData.h: Add a concept of disabled to CSSPropertySourceData. This is used for commented out properties. (WebCore::CSSRuleSourceData::create): (WebCore::CSSRuleSourceData::createUnknown): (WebCore::CSSRuleSourceData::CSSRuleSourceData): Get rid of the CSSRuleSourceData type enum, since StyleRule's type enum is exactly the same. * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::CSSParser::parseSheetForInspector): (WebCore::CSSParser::parseDeclarationForInspector): (WebCore::CSSParser::markSupportsRuleHeaderStart): (WebCore::CSSParser::markRuleHeaderStart): (WebCore::CSSParser::markPropertyEnd): * css/parser/CSSParser.h: Add functions that represent the new API for inspector sheet and declaration parsing. Patch the old parse code to use StyleRule::Type now that the CSSRuleSourceData type is gone. * css/parser/CSSParserObserver.h: Tweak the API for our memory management. * inspector/InspectorStyleSheet.cpp: (flattenSourceData): (WebCore::parserContextForDocument): (WebCore::StyleSheetHandler::StyleSheetHandler): (WebCore::StyleSheetHandler::startRuleHeader): (WebCore::StyleSheetHandler::setRuleHeaderEnd): (WebCore::StyleSheetHandler::endRuleHeader): (WebCore::StyleSheetHandler::observeSelector): (WebCore::StyleSheetHandler::startRuleBody): (WebCore::StyleSheetHandler::endRuleBody): (WebCore::StyleSheetHandler::popRuleData): (WebCore::fixUnparsedProperties): (WebCore::StyleSheetHandler::fixUnparsedPropertyRanges): (WebCore::StyleSheetHandler::observeProperty): (WebCore::StyleSheetHandler::observeComment): (WebCore::InspectorStyle::populateAllProperties): (WebCore::isValidSelectorListString): (WebCore::InspectorStyleSheet::ensureSourceData): (WebCore::InspectorStyleSheetForInlineStyle::ensureParsedDataReady): (WebCore::InspectorStyleSheetForInlineStyle::ruleSourceData): (WebCore::createCSSParser): Deleted. (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges): Deleted. * inspector/InspectorStyleSheet.h: (WebCore::InspectorStyleProperty::setRawTextFromStyleDeclaration): Add the new implementation. This involves duplicating most of the old parser code for this into a new class, StyleSheetHandler, that implements the observer interface and builds up the same data structures as the old parser did in response to the callbacks. 2016-11-18 Dan Bernstein <mitz@apple.com> Tried to fix some non-macOS builds. <rdar://problems/29331425&29331438&29331722> * platform/mac/WebPlaybackControlsManager.h: 2016-11-18 Per Arne Vollan <pvollan@apple.com> [Win32] Start releasing memory earlier when memory is running low. https://bugs.webkit.org/show_bug.cgi?id=164862 Reviewed by Brent Fulgham. On Windows, 32-bit processes have 2GB of memory available, where some is used by the system. Debugging has shown that allocations might fail and cause crashes when memory usage is > ~1GB. We should start releasing memory before we reach 1GB. * platform/win/MemoryPressureHandlerWin.cpp: (WebCore::CheckMemoryTimer::fired): 2016-11-17 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r208511): ImageDecoders: Crash decoding GIF images since r208511 https://bugs.webkit.org/show_bug.cgi?id=164864 Reviewed by Simon Fraser. This happens sometimes since r208511 because the same decoder is used by more than one thread at the same time and the decoders are not thread-safe. Several methods in ImageDecoder need to decode partially the image, so it's possible that one method calls frameBufferAtIndex at the same times as createFrameImageAtIndex that now can be called from the image decoder thread. Use a Lock in ImageDecoder to protect calls to frameBufferAtIndex. * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::frameIsCompleteAtIndex): (WebCore::ImageDecoder::frameDurationAtIndex): (WebCore::ImageDecoder::createFrameImageAtIndex): * platform/image-decoders/ImageDecoder.h: 2016-11-17 Ryosuke Niwa <rniwa@webkit.org> Add an experimental API to find elements across shadow boundaries https://bugs.webkit.org/show_bug.cgi?id=164851 <rdar://problem/28220092> Reviewed by Sam Weinig. Add window.collectMatchingElementsInFlatTree(Node node, DOMString selectors) as an experimental API which finds a list of elements that matches the given CSS selectors and expose it to a JSWorld on which WKBundleScriptWorldMakeAllShadowRootsOpen was called. No new tests. More test cases are added to WebKit2.InjectedBundleMakeAllShadowRootsOpen. * bindings/scripts/CodeGeneratorJS.pm: (NeedsRuntimeCheck): Added. Abstracts checks for EnabledAtRuntime and EnabledForWorld. (OperationShouldBeOnInstance): (GeneratePropertiesHashTable): (GetRuntimeEnableFunctionName): Use worldForDOMObject(this).condition() for EnabledForWorld. Also split the line for EnabledAtRuntime and EnabledAtRuntime for a better readability. (GenerateImplementation): (addIterableProperties): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/preprocess-idls.pl: (GenerateConstructorAttribute): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::JSTestGlobalObject::finishCreation): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld): (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjPrototype::finishCreation): (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethod): (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodCaller): * bindings/scripts/test/TestGlobalObject.idl: Added a test case. * bindings/scripts/test/TestObj.idl: Ditto. * page/DOMWindow.cpp: (WebCore::DOMWindow::collectMatchingElementsInFlatTree): Added. Implements the feature by calling SelectorQuery's matches on a node yielded by ComposedTreeIterator. * page/DOMWindow.h: * page/DOMWindow.idl: 2016-11-17 Sam Weinig <sam@webkit.org> [WebIDL] Add support for ByteString https://bugs.webkit.org/show_bug.cgi?id=164901 Reviewed by Darin Adler. * bindings/generic/IDLTypes.h: Make IDLByteString a IDLString. * bindings/js/JSDOMBinding.cpp: (WebCore::valueToByteString): (WebCore::valueToUSVString): * bindings/js/JSDOMBinding.h: Add conversion function for ByteString and fix valueToUSVString to take an ExecState reference. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLByteString>::convert): (WebCore::JSConverter<IDLByteString>::convert): Add conversion functions for ByteString, using valueToByteString. (WebCore::Converter<IDLUSVString>::convert): Update to pass the ExecState by reference. * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): Update to pass the ExecState by reference. * bindings/js/JSWorkerGlobalScopeCustom.cpp: (WebCore::JSWorkerGlobalScope::importScripts): Update to pass the ExecState by reference. * bindings/scripts/CodeGenerator.pm: Add ByteString as a string type. * testing/TypeConversions.h: (WebCore::TypeConversions::testByteString): (WebCore::TypeConversions::setTestByteString): * testing/TypeConversions.idl: Add a testByteString attribute for testing. 2016-11-17 Ryosuke Niwa <rniwa@webkit.org> WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled should keep text replacement enabled https://bugs.webkit.org/show_bug.cgi?id=164857 <rdar://problem/27721742> Reviewed by Wenson Hsieh. It turns out that some users want text replacement to be always enabled so change the semantics of WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled to only disable everything else. Instead of completely disabling spellchecking, remove all text checking options but text replacement when the user types into an input element on which this API is used to disable spellchecking. No new tests since we don't have a good facility to test text replacement. * dom/Element.h: (WebCore::Element::isSpellCheckingEnabled): Made this non-virtual now that there is no override. * editing/Editor.cpp: (WebCore::Editor::replaceSelectionWithFragment): (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Don't call resolveTextCheckingTypeMask twice. (WebCore::Editor::resolveTextCheckingTypeMask): Filter out the text checking options if the root editable element is inside an input element on which isSpellcheckDisabledExceptTextReplacement is set to true. * editing/Editor.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::HTMLInputElement): (WebCore::HTMLInputElement::isSpellCheckingEnabled): Deleted. * html/HTMLInputElement.h: (WebCore::HTMLInputElement::setSpellcheckDisabledExceptTextReplacement): Renamed from setSpellcheckEnabled to reflect the new semantics. (WebCore::HTMLInputElement::isSpellcheckDisabledExceptTextReplacement): Ditto. 2016-11-17 John Wilander <wilander@apple.com> Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed https://bugs.webkit.org/show_bug.cgi?id=164659 Reviewed by Andy Estes. No new tests. This feature is behind a flag and off by default. Tests require real domain names. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logFrameNavigation): (WebCore::ResourceLoadObserver::logSubresourceLoading): (WebCore::ResourceLoadObserver::logWebSocketLoading): All three functions are now more conservative in calls to m_store->fireDataModificationHandler(). They only fire when an important statistic has changed or data records have previously been removed for the domain in question. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::encode): Added the dataRecordsRemoved statistic. (WebCore::ResourceLoadStatistics::decode): Now takes a version parameter to control which keys to expect. Added the dataRecordsRemoved statistic. (WebCore::appendHashCountedSet): Removed stray linefeed. (WebCore::ResourceLoadStatistics::toString): Added the dataRecordsRemoved statistic. (WebCore::ResourceLoadStatistics::merge): Added the dataRecordsRemoved statistic. * loader/ResourceLoadStatistics.h: Added the dataRecordsRemoved statistic. * loader/ResourceLoadStatisticsStore.cpp: (WebCore::ResourceLoadStatisticsStore::createEncoderFromData): Now encodes a version number for the statistics model. (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder): Now tries to decode a version number and passes it on to statistics decoding. (WebCore::ResourceLoadStatisticsStore::processStatistics): No longer gates processing on the number of data captured. (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords): Update function for the new dataRecordsRemoved statistic. (WebCore::ResourceLoadStatisticsStore::hasEnoughDataForStatisticsProcessing): Deleted. No longer needed since we no longer gate processing on the number of data captured. * loader/ResourceLoadStatisticsStore.h: 2016-11-17 Alex Christensen <achristensen@webkit.org> Fix WinCairo build after r208740 https://bugs.webkit.org/show_bug.cgi?id=164749 * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: (WebCore::GraphicsContext3D::reshapeFBOs): (WebCore::GraphicsContext3D::validateAttributes): (WebCore::GraphicsContext3D::getExtensions): Use more references instead of pointers, like Myles did in r208740 2016-11-17 Alex Christensen <achristensen@webkit.org> Implement TextDecoder and TextEncoder https://bugs.webkit.org/show_bug.cgi?id=163771 Reviewed by Sam Weinig. This API is already implemented by Chrome and Firefox as specified in https://encoding.spec.whatwg.org/ Covered by newly passing web platform tests. * features.json: * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/TextDecoder.cpp: Added. (WebCore::isEncodingWhitespace): (WebCore::TextDecoder::create): (WebCore::TextDecoder::TextDecoder): (WebCore::TextDecoder::ignoreBOMIfNecessary): (WebCore::TextDecoder::prependBOMIfNecessary): (WebCore::codeUnitByteSize): (WebCore::TextDecoder::decode): (WebCore::TextDecoder::encoding): * dom/TextDecoder.h: Added. (WebCore::TextDecoder::fatal): (WebCore::TextDecoder::ignoreBOM): * dom/TextDecoder.idl: Added. * dom/TextEncoder.cpp: Added. (WebCore::TextEncoder::TextEncoder): (WebCore::TextEncoder::encoding): (WebCore::TextEncoder::encode): * dom/TextEncoder.h: Added. (WebCore::TextEncoder::create): * dom/TextEncoder.idl: Added. 2016-11-17 Sam Weinig <sam@webkit.org> Try to fix the windows build again. * svg/SVGStringList.h: * svg/properties/SVGStaticListPropertyTearOff.h: (WebCore::SVGStaticListPropertyTearOff::SVGStaticListPropertyTearOff): 2016-11-17 Sam Weinig <sam@webkit.org> Try to fix the windows build. * svg/SVGStringList.h: Remove unnecessary using declarations. 2016-11-17 Chris Dumez <cdumez@apple.com> Regression(r208672?): ASSERTION FAILED: isMainThread() in WebCore::Node::ref() https://bugs.webkit.org/show_bug.cgi?id=164887 <rdar://problem/29319497> Reviewed by Brady Eidson. Restore pre-r208672 behavior where we do not ref the script execution context in the background thread since this is unsafe. We use WTFMove(m_scriptExecutionContext) instead of m_scriptExecutionContext.copyRef(). Before r208672, it was calling m_scriptExecutionContext.releaseNonNull() because m_scriptExecutionContext was a RefPtr instead of a Ref. Note that copyRef() causes 2 issues here: 1. It refs the scriptExecutionContext in a non-main thread which is unsafe and asserts. 2. The point of this postTask in the destructor is to make sure the scriptExecutionContext gets destroyed in the main thread so we definitely want to *transfer* ownership of m_scriptExecutionContext to the main thread, not ref it to pass it to the main thread. No new tests, already covered by storage/websql/multiple-transactions-on-different-handles.html. * Modules/webdatabase/Database.cpp: (WebCore::Database::~Database): 2016-11-17 Brady Eidson <beidson@apple.com> Add _WKIconLoadingDelegate SPI. https://bugs.webkit.org/show_bug.cgi?id=164894 Reviewed by Alex Christensen. No new tests (Manual testing possible in MiniBrowser now, WKTR tests coming soon in https://bugs.webkit.org/show_bug.cgi?id=164895). With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>. WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load. For icons the app decides to load, WebKit will pass the data to the app without storing locally. * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::implicitClose): * html/LinkIconCollector.cpp: (WebCore::iconSize): (WebCore::compareIcons): * html/LinkIconCollector.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startIconLoading): (WebCore::DocumentLoader::didGetLoadDecisionForIcon): (WebCore::DocumentLoader::finishedLoadingIcon): * loader/DocumentLoader.h: * loader/FrameLoaderClient.h: * loader/icon/IconLoader.cpp: (WebCore::IconLoader::IconLoader): (WebCore::IconLoader::startLoading): (WebCore::IconLoader::notifyFinished): * loader/icon/IconLoader.h: * platform/LinkIcon.h: Copied from Source/WebCore/html/LinkIconCollector.h. (WebCore::LinkIcon::encode): (WebCore::LinkIcon::decode): 2016-11-15 Sam Weinig <sam@webkit.org> [SVG] Moving more special casing of SVG out of the bindings - SVG lists https://bugs.webkit.org/show_bug.cgi?id=164790 Reviewed by Alex Christensen. - Make SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGPathSegList and SVGTransformList real classes and stop special casing them in the bindings generator. This removes the remaining SVG specializations for tear offs from the bindings generator. - Renamed existing SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGPathSegList, SVGPathSegList and SVGTransformList to SVG<Type>ListValues, to make way for the new classes. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * svg/SVGAllInOne.cpp: Add new files. * bindings/scripts/CodeGenerator.pm: * bindings/scripts/CodeGeneratorJS.pm: Remove SVG tear off specific code! * rendering/svg/RenderSVGShape.cpp: * rendering/svg/RenderSVGText.cpp: * rendering/svg/RenderSVGTextPath.cpp: * rendering/svg/SVGRenderTreeAsText.cpp: * svg/SVGAnimateMotionElement.cpp: * svg/SVGClipPathElement.cpp: * svg/SVGLinearGradientElement.cpp: * svg/SVGRadialGradientElement.cpp: Remove unnecessary #includes. * rendering/svg/SVGPathData.cpp: (WebCore::updatePathFromPolygonElement): (WebCore::updatePathFromPolylineElement): * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: (WebCore::updateCharacterData): (WebCore::SVGTextLayoutAttributesBuilder::fillCharacterDataMap): * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::constructFromString): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthListAnimator::calculateDistance): * svg/SVGAnimatedLengthList.h: * svg/SVGAnimatedNumberList.cpp: (WebCore::SVGAnimatedNumberListAnimator::constructFromString): (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedNumberListAnimator::calculateDistance): * svg/SVGAnimatedNumberList.h: * svg/SVGAnimatedPath.cpp: (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal): * svg/SVGAnimatedPointList.cpp: (WebCore::SVGAnimatedPointListAnimator::constructFromString): (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedPointListAnimator::calculateDistance): * svg/SVGAnimatedPointList.h: * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::constructFromString): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): * svg/SVGAnimatedTransformList.h: * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLengthList): (WebCore::SVGAnimatedType::createNumberList): (WebCore::SVGAnimatedType::createPointList): (WebCore::SVGAnimatedType::createTransformList): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::lengthList): (WebCore::SVGAnimatedType::numberList): (WebCore::SVGAnimatedType::pointList): (WebCore::SVGAnimatedType::transformList): * svg/SVGComponentTransferFunctionElement.cpp: (WebCore::SVGComponentTransferFunctionElement::parseAttribute): * svg/SVGFEColorMatrixElement.cpp: (WebCore::SVGFEColorMatrixElement::parseAttribute): * svg/SVGFEConvolveMatrixElement.cpp: (WebCore::SVGFEConvolveMatrixElement::parseAttribute): (WebCore::SVGFEConvolveMatrixElement::build): * svg/SVGParserUtilities.cpp: (WebCore::pointsListFromSVGData): * svg/SVGParserUtilities.h: * svg/SVGPathElement.cpp: * svg/SVGPathElement.h: * svg/SVGPathSegListBuilder.cpp: * svg/SVGPathSegListBuilder.h: * svg/SVGPathSegListSource.cpp: * svg/SVGPathSegListSource.h: * svg/SVGPathUtilities.cpp: (WebCore::buildSVGPathByteStreamFromSVGPathSegListValues): (WebCore::appendSVGPathByteStreamFromSVGPathSeg): (WebCore::buildSVGPathSegListValuesFromByteStream): (WebCore::buildStringFromSVGPathSegListValues): (WebCore::buildSVGPathByteStreamFromSVGPathSegList): Deleted. (WebCore::buildSVGPathSegListFromByteStream): Deleted. (WebCore::buildStringFromSVGPathSegList): Deleted. * svg/SVGPathUtilities.h: * svg/SVGPolyElement.cpp: (WebCore::SVGPolyElement::parseAttribute): (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper): (WebCore::SVGPolyElement::points): (WebCore::SVGPolyElement::animatedPoints): * svg/SVGPolyElement.h: (WebCore::SVGPolyElement::pointList): * svg/SVGTextPositioningElement.cpp: (WebCore::SVGTextPositioningElement::parseAttribute): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGViewElement.cpp: (WebCore::SVGViewElement::viewTarget): (WebCore::SVGViewElement::parseAttribute): * svg/SVGViewElement.h: * svg/SVGViewElement.idl: * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::transformString): (WebCore::SVGViewSpec::transform): (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): (WebCore::SVGViewSpec::reset): * svg/SVGViewSpec.h: Update for name changes. * svg/SVGAngle.h: (WebCore::SVGAngle::create): (WebCore::SVGAngle::SVGAngle): * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::SVGLength): * svg/SVGMatrix.h: (WebCore::SVGMatrix::create): (WebCore::SVGMatrix::SVGMatrix): * svg/SVGNumber.h: (WebCore::SVGNumber::create): (WebCore::SVGNumber::SVGNumber): * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::SVGPoint): * svg/SVGPreserveAspectRatio.h: (WebCore::SVGPreserveAspectRatio::create): (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::SVGRect): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::SVGTransform): * svg/properties/SVGPropertyTearOff.h: (WebCore::SVGPropertyTearOff::create): Pass the SVGAnimatedProperty parameter by reference. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::requiredFeatures): (WebCore::SVGAnimationElement::requiredExtensions): (WebCore::SVGAnimationElement::systemLanguage): * svg/SVGAnimationElement.h: * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::requiredFeatures): (WebCore::SVGCursorElement::requiredExtensions): (WebCore::SVGCursorElement::systemLanguage): * svg/SVGCursorElement.h: * svg/SVGGradientElement.cpp: * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::requiredFeatures): (WebCore::SVGGraphicsElement::requiredExtensions): (WebCore::SVGGraphicsElement::systemLanguage): * svg/SVGGraphicsElement.h: * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::requiredFeatures): (WebCore::SVGMaskElement::requiredExtensions): (WebCore::SVGMaskElement::systemLanguage): * svg/SVGMaskElement.h: * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): (WebCore::SVGPatternElement::requiredFeatures): (WebCore::SVGPatternElement::requiredExtensions): (WebCore::SVGPatternElement::systemLanguage): * svg/SVGPatternElement.h: * svg/SVGTests.cpp: (WebCore::SVGTests::synchronizeAttribute): (WebCore::SVGTests::synchronizeRequiredFeatures): (WebCore::SVGTests::synchronizeRequiredExtensions): (WebCore::SVGTests::synchronizeSystemLanguage): (WebCore::SVGTests::requiredFeatures): (WebCore::SVGTests::requiredExtensions): (WebCore::SVGTests::systemLanguage): * svg/SVGTests.h: * svg/SVGTests.idl: Make SVGTests SVGStringLists work by adding implementations of functions on the SVGElements that implement SVGTests, passing *this down to SVGTests. * svg/SVGLengthList.cpp: Removed. * svg/SVGLengthList.h: * svg/SVGLengthList.idl: * svg/SVGLengthListValues.cpp: Copied from svg/SVGLengthList.cpp. * svg/SVGLengthListValues.h: Copied from svg/SVGLengthList.h. Rename SVGLengthList to SVGLengthListValues and add an explicit implementation of the SVGLengthList interface inheriting from SVGListPropertyTearOff<SVGLengthListValues>. * svg/SVGNumberList.cpp: Removed. * svg/SVGNumberList.h: * svg/SVGNumberListValues.cpp: Copied from svg/SVGNumberList.cpp. * svg/SVGNumberListValues.h: Copied from svg/SVGNumberList.h. Rename SVGNumberList to SVGNumberListValues and add an explicit implementation of the SVGNumberList interface inheriting from SVGListPropertyTearOff<SVGNumberListValues>. * svg/SVGPathSegList.cpp: * svg/SVGPathSegList.h: * svg/SVGPathSegListValues.cpp: Copied from svg/SVGPathSegList.cpp. * svg/SVGPathSegListValues.h: Copied from svg/SVGPathSegList.h. * svg/properties/SVGPathSegListPropertyTearOff.cpp: Removed. * svg/properties/SVGPathSegListPropertyTearOff.h: Removed. Rename SVGPathSegList to SVGPathSegListValues and add an explicit implementation of the SVGPathSegList interface inheriting from SVGListProperty<SVGPathSegListValues>. * svg/SVGPointList.cpp: Removed. * svg/SVGPointList.h: * svg/SVGPointListValues.cpp: Copied from svg/SVGPointList.cpp. * svg/SVGPointListValues.h: Copied from svg/SVGPointList.h. Rename SVGPointList to SVGPointListValues and add an explicit implementation of the SVGPointList interface inheriting from SVGListPropertyTearOff<SVGPointListValues>. * svg/SVGStringList.cpp: Removed. * svg/SVGStringList.h: * svg/SVGStringListValues.cpp: Copied from svg/SVGStringList.cpp. * svg/SVGStringListValues.h: Copied from svg/SVGStringList.h. Rename SVGStringList to SVGStringListValues and add an explicit implementation of the SVGStringList interface inheriting from SVGStaticListPropertyTearOff<SVGStringListValues>. * svg/SVGTransformList.cpp: Removed. * svg/SVGTransformList.h: * svg/SVGTransformListValues.cpp: Copied from svg/SVGTransformList.cpp. * svg/SVGTransformListValues.h: Copied from svg/SVGTransformList.h. * svg/properties/SVGTransformListPropertyTearOff.h: Removed. Rename SVGTransformList to SVGTransformListValues and add an explicit implementation of the SVGTransformList interface inheriting from SVGListPropertyTearOff<SVGTransformListValues>. * svg/properties/SVGAnimatedListPropertyTearOff.h: * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h: * svg/properties/SVGAnimatedPropertyTearOff.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: Convert to return fully specialized types for baseVal and animVal, removing many unnecessary casts around the codebase. Also add some uses of Ref. * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::removeItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::create): (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff): (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Store the AnimatedListPropertyTearOff as a Ref, and pass it around by reference. * svg/properties/SVGStaticPropertyTearOff.h: Update to take the ContextElement by reference. 2016-11-17 Brent Fulgham <bfulgham@apple.com> Improve URL length handling https://bugs.webkit.org/show_bug.cgi?id=164884 <rdar://problem/5909143> Reviewed by David Kilzer. Make sure the result of re-encoding and other fix-up stays within expected parameters. No new tests. No change in behavior. * platform/URL.cpp: (WebCore::URL::parse): 2016-11-17 Zalan Bujtas <zalan@apple.com> Render tree should be all clean by the end of FrameView::layout(). https://bugs.webkit.org/show_bug.cgi?id=162834 Reviewed by Simon Fraser. This is a preventive patch to ensure we don't introduce new bugs through dirty renderers. There are still 3 failing cases and they are skipped for now (debug only). * page/FrameView.cpp: (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker): 2016-11-17 Brent Fulgham <bfulgham@apple.com> keygen element should not support < 2048 RSA key lengths https://bugs.webkit.org/show_bug.cgi?id=164874 <rdar://problem/22618141> Reviewed by Dean Jackson. Remove the two insecure RSA choices (512-bit and 1024-bit) so that users do not accidentally select a bad key length. Tested by fast/html/keygen.html * platform/LocalizedStrings.cpp: (WebCore::keygenMenuItem512): Deleted. (WebCore::keygenMenuItem1024): Deleted. * platform/LocalizedStrings.h: * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): ASSERT on bad key size. (WebCore::getSupportedKeySizes): Remove bad key sizes. (WebCore::signedPublicKeyAndChallengeString): Ditto. * platform/win/SSLKeyGeneratorWin.cpp: (WebCore::WebCore::getSupportedKeySizes): Ditto. 2016-11-17 Eric Carlson <eric.carlson@apple.com> [MediaStream][Mac] Use AVCapturePreview object for camera/microphone rendering https://bugs.webkit.org/show_bug.cgi?id=164837 <rdar://problem/29297727> Reviewed by Jer Noble. No new tests, the real capture devices can not be used in layout tests. * WebCore.xcodeproj/project.pbxproj: Drive-by fix: clear m_settingMediaStreamSrcObject when the media player is destroyed unless that happens as a side effect of setting video.srcObject. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setSrcObject): (WebCore::HTMLMediaElement::clearMediaPlayer): * html/HTMLMediaElement.h: Add support for realtime media source that vend a preview interface, while keeping support for those that do not (e.g. the mock capture devices). * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::platformLayer): Deleted, no longer used. * platform/mediastream/MediaStreamPrivate.h: Enable/disable the preview when available. * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::setEnabled): (WebCore::MediaStreamTrackPrivate::endTrack): (WebCore::MediaStreamTrackPrivate::preview): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeMediaSource.h: (WebCore::RealtimeMediaSource::preview): (WebCore::RealtimeMediaSource::createWeakPtr): (WebCore::RealtimeMediaSource::platformLayer): Deleted. Define a realtime media source preview interface. * platform/mediastream/RealtimeMediaSourcePreview.h: Added. (WebCore::RealtimeMediaSourcePreview::~RealtimeMediaSourcePreview): (WebCore::RealtimeMediaSourcePreview::invalidate): (WebCore::RealtimeMediaSourcePreview::createWeakPtr): (WebCore::RealtimeMediaSourcePreview::RealtimeMediaSourcePreview): Implement the preview interface. * platform/mediastream/mac/AVAudioCaptureSource.h: * platform/mediastream/mac/AVAudioCaptureSource.mm: (WebCore::AVAudioSourcePreview::create): (WebCore::AVAudioSourcePreview::AVAudioSourcePreview): (WebCore::AVAudioSourcePreview::invalidate): (WebCore::AVAudioSourcePreview::play): (WebCore::AVAudioSourcePreview::pause): (WebCore::AVAudioSourcePreview::setEnabled): (WebCore::AVAudioSourcePreview::setVolume): (WebCore::AVAudioSourcePreview::updateState): (WebCore::AVAudioCaptureSource::createPreview): * platform/mediastream/mac/AVMediaCaptureSource.h: (WebCore::AVMediaCaptureSource::createWeakPtr): * platform/mediastream/mac/AVMediaCaptureSource.mm: (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): (WebCore::AVMediaCaptureSource::reset): (WebCore::AVMediaCaptureSource::preview): (WebCore::AVMediaCaptureSource::removePreview): (WebCore::AVMediaSourcePreview::AVMediaSourcePreview): (WebCore::AVMediaSourcePreview::~AVMediaSourcePreview): (WebCore::AVMediaSourcePreview::invalidate): * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoSourcePreview::create): (WebCore::AVVideoSourcePreview::AVVideoSourcePreview): (WebCore::AVVideoSourcePreview::invalidate): (WebCore::AVVideoSourcePreview::play): (WebCore::AVVideoSourcePreview::pause): (WebCore::AVVideoSourcePreview::setPaused): (WebCore::AVVideoSourcePreview::setEnabled): (WebCore::AVVideoCaptureSource::shutdownCaptureSession): (WebCore::AVVideoCaptureSource::processNewFrame): (WebCore::AVVideoCaptureSource::createPreview): (WebCore::AVVideoCaptureSource::platformLayer): Deleted. * platform/mediastream/mac/MockRealtimeVideoSourceMac.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::platformLayer): Deleted. (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer): Deleted. * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::applyFrameRate): (WebCore::MockRealtimeVideoSource::applySize): (WebCore::MockRealtimeVideoSource::generateFrame): * platform/mock/MockRealtimeVideoSource.h: (WebCore::MockRealtimeVideoSource::updatePlatformLayer): Deleted. 2016-11-17 Chris Dumez <cdumez@apple.com> Unreviewed, fix build after r208839. * dom/Node.h: (WebCore::Node::isDescendantOf): 2016-11-16 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add @supports, @keyframe and media query parsing options https://bugs.webkit.org/show_bug.cgi?id=164821 Reviewed by Sam Weinig and Zalan Bujtas. * css/CSSKeyframeRule.cpp: (WebCore::StyleKeyframe::setKeyText): * css/CSSKeyframeRule.h: * css/CSSKeyframesRule.cpp: (WebCore::StyleRuleKeyframes::findKeyframeIndex): Changed to call into CSSParserImpls implementation. The new parser is now always used when parsing the key list. * css/MediaList.cpp: (WebCore::MediaQuerySet::create): (WebCore::MediaQuerySet::MediaQuerySet): (WebCore::MediaQuerySet::set): (WebCore::MediaQuerySet::add): (WebCore::MediaQuerySet::remove): (WebCore::MediaList::setMediaText): (WebCore::parseMediaDescriptor): Deleted. (WebCore::MediaQuerySet::internalParse): Deleted. (WebCore::MediaQuerySet::parse): Deleted. * css/MediaList.h: Rewritten to remove fallback descriptor support/parsing, since no other browser supports it, and this was part of our initial 2005 landing that nobody else appears to use. Media queries now call into the new parser always. * css/MediaQueryExp.cpp: (WebCore::featureWithValidDensity): (WebCore::featureWithPositiveNumber): (WebCore::MediaQueryExpression::MediaQueryExpression): Make sure to support transform2d, animation and transition. * css/StyleMedia.cpp: (WebCore::StyleMedia::matchMedium): Call the normal create now that fallback descriptor syntax is gone. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseKeyframeRule): (WebCore::CSSParser::parseSupportsCondition): (WebCore::CSSParser::parseInlineStyleDeclaration): (WebCore::CSSParser::parseDeclarationDeprecated): (WebCore::CSSParser::parseDeclaration): (WebCore::CSSParser::parseKeyframeKeyList): (WebCore::CSSParser::parseMediaQuery): Deleted. (WebCore::CSSParser::parseKeyframeSelector): Deleted. * css/parser/CSSParser.h: Patched the old parser to have flags to call into the new parser for supports conditions and keyframes. Rename the parseDeclaration that is only used by the old parser to have the word Deprecated in it. Removed the media query and key list parsing functions, since the new parser now does it always. * css/parser/CSSParserIdioms.cpp: (WebCore::convertToASCIILowercaseInPlace): Deleted. * css/parser/CSSParserIdioms.h: * css/parser/CSSParserToken.cpp: (WebCore::convertToASCIILowercaseInPlace): (WebCore::CSSParserToken::convertToASCIILowercaseInPlace): * css/parser/CSSParserToken.h: (WebCore::CSSParserToken::value): (WebCore::CSSParserToken::initValueFromStringView): * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeAttr): * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeId): (WebCore::CSSSelectorParser::consumeClass): (WebCore::CSSSelectorParser::consumePseudo): Moving convertToASCIILowercase to be a CSSParserToken member function instead of operating on StringView. This saves an extra step, since the token itself already had all the correct members. Note that converting in-place is bad, and we'll be removing it once the new parser turns on. * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::readMediaType): (WebCore::MediaQueryParser::readFeature): (WebCore::MediaQueryParser::readFeatureEnd): Require the closing ")" on features. Fix the in-place lowercasing to only be done for features, not for types. This matches the old parser. * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createCSSStyleSheet): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::initializeStyleSheet): * html/HTMLSourceElement.cpp: (WebCore::HTMLSourceElement::parseAttribute): * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::parseAttribute): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * html/parser/HTMLResourcePreloader.cpp: (WebCore::mediaAttributeMatches): Patched to call the normal MediaQuerySet::create and not the one that had fallback descriptor support. 2016-11-17 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, attempt to fix link error after r208841 part2 Use static_cast to avoid referencing static storage. * storage/StorageMap.cpp: (WebCore::StorageMap::setItemIgnoringQuota): 2016-11-17 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, attempt to fix link error after r208841 * storage/StorageMap.h: 2016-11-17 Saam Barati <sbarati@apple.com> Remove async/await compile time flag and enable tests https://bugs.webkit.org/show_bug.cgi?id=164828 <rdar://problem/28639334> Reviewed by Yusuke Suzuki. * Configurations/FeatureDefines.xcconfig: 2016-11-17 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] WTF::TemporaryChange with WTF::SetForScope https://bugs.webkit.org/show_bug.cgi?id=164761 Reviewed by Saam Barati. No behavior change. * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateModule): * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules): * css/StyleResolver.cpp: * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseFillShorthand): (WebCore::CSSParser::parseShorthand): (WebCore::CSSParser::parse4Values): (WebCore::CSSParser::parseBorderRadius): * css/parser/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGValue): * dom/CustomElementRegistry.h: * dom/Document.cpp: (WebCore::Document::recalcStyle): (WebCore::Document::styleForElementIgnoringPendingStylesheets): (WebCore::Document::destroyRenderTree): * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): * dom/Microtasks.cpp: (WebCore::MicrotaskQueue::performMicrotaskCheckpoint): * history/PageCache.cpp: (WebCore::PageCache::pruneToSizeNow): * html/DOMTokenList.cpp: (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): * html/parser/CSSPreloadScanner.cpp: (WebCore::CSSPreloadScanner::scan): * html/parser/HTMLConstructionSite.h: * loader/ContentFilter.cpp: (WebCore::ContentFilter::handleProvisionalLoadFailure): * loader/SubresourceLoader.cpp: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::pruneLiveResourcesToSize): (WebCore::MemoryCache::pruneDeadResourcesToSize): * page/Chrome.cpp: (WebCore::Chrome::runModal): * page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::applyRecursivelyWithVisibleRect): (WebCore::FrameView::autoSizeIfEnabled): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::didReceiveHeaders): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): (WebCore::GraphicsLayerCA::commitLayerChangesAfterSublayers): * platform/graphics/opengl/TemporaryOpenGLSetting.h: * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawTexture): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::purgeBackingStores): * platform/graphics/win/GraphicsLayerDirect2D.cpp: * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::writeClipboardContents): * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::paint): * rendering/RenderBlock.cpp: * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::pushMappingsToAncestor): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPositions): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): * rendering/RenderView.cpp: (WebCore::RenderView::hitTest): * replay/EventLoopInputDispatcher.cpp: (WebCore::EventLoopInputDispatcher::dispatchInput): * storage/StorageMap.cpp: (WebCore::StorageMap::setItemIgnoringQuota): * svg/SVGPathBlender.cpp: (WebCore::SVGPathBlender::addAnimatedPath): 2016-11-16 Yusuke Suzuki <utatane.tea@gmail.com> [WebCore] Clean up script loading code in XML https://bugs.webkit.org/show_bug.cgi?id=161651 Reviewed by Ryosuke Niwa. This patch cleans up XML document script handling by using PendingScript. Previously, we directly used CachedScript. But it is not good since we have PendingScript wrapper. We also disable ES6 modules for non HTML document. While ES6 modules tag requires "defer" semantics, "defer" semantics is not implemented in non HTML documents. And ES6 module tag is only specified in whatwg HTML spec. * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::execute): * dom/ScriptElement.cpp: (WebCore::ScriptElement::determineScriptType): (WebCore::ScriptElement::prepareScript): (WebCore::ScriptElement::executeClassicScript): (WebCore::ScriptElement::executePendingScript): (WebCore::ScriptElement::executeScript): Deleted. (WebCore::ScriptElement::executeScriptForScriptRunner): Deleted. * dom/ScriptElement.h: * dom/ScriptRunner.cpp: (WebCore::ScriptRunner::timerFired): * html/parser/HTMLDocumentParser.cpp: * html/parser/HTMLScriptRunner.cpp: (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): (WebCore::HTMLScriptRunner::runScript): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::notifyFinished): * xml/parser/XMLDocumentParser.h: * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::XMLDocumentParser): (WebCore::XMLDocumentParser::~XMLDocumentParser): (WebCore::XMLDocumentParser::endElementNs): 2016-11-16 Chris Dumez <cdumez@apple.com> Add Node::isDescendantOf() overload that takes in a reference https://bugs.webkit.org/show_bug.cgi?id=164854 Reviewed by Ryosuke Niwa. Add Node::isDescendantOf() overload that takes in a reference as a lot of call sites have a reference or a pointer they know is not null. No new tests, no Web-exposed behavior change. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::press): * dom/Document.cpp: (WebCore::isNodeInSubtree): (WebCore::Document::removeFullScreenElementOfSubtree): (WebCore::Document::setAnimatingFullScreen): * dom/Node.cpp: (WebCore::Node::isDescendantOf): (WebCore::Node::isDescendantOrShadowDescendantOf): (WebCore::Node::contains): * dom/Node.h: (WebCore::Node::isDescendantOf): * dom/NodeIterator.cpp: (WebCore::NodeIterator::updateForNodeRemoval): * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::executeFastPathForIdSelector): (WebCore::filterRootById): * dom/TypedElementDescendantIterator.h: (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::beginAt): (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::from): (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt): (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::from): * editing/ApplyStyleCommand.cpp: (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange): * editing/BreakBlockquoteCommand.cpp: (WebCore::BreakBlockquoteCommand::doApply): * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement): * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::handleGeneralDelete): (WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows): (WebCore::DeleteSelectionCommand::doApply): * editing/EditingStyle.cpp: (WebCore::EditingStyle::textDirectionForSelection): * editing/FormatBlockCommand.cpp: (WebCore::FormatBlockCommand::formatRange): * editing/TextIterator.cpp: (WebCore::TextIterator::advance): * editing/VisiblePosition.cpp: (WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore): (WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter): * editing/htmlediting.cpp: (WebCore::firstEditablePositionAfterPositionInRoot): (WebCore::lastEditablePositionBeforePositionInRoot): (WebCore::selectionForParagraphIteration): * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): * html/CachedHTMLCollection.h: (WebCore::traversalType>::namedItem): * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::formElementIndex): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): * page/EventHandler.cpp: (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::getElementById): 2016-11-16 Ryosuke Niwa <rniwa@webkit.org> Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled https://bugs.webkit.org/show_bug.cgi?id=164845 Reviewed by Dan Bernstein. Revert r208833 and fix the build by declaring AVFunctionBarMediaSelectionOption and AVThumbnail in AVKitSPI.h * platform/mac/WebPlaybackControlsManager.h: * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]): * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged): (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager): * platform/spi/cocoa/AVKitSPI.h: 2016-11-16 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r208082): 1% Speedometer regression on iOS https://bugs.webkit.org/show_bug.cgi?id=164852 Reviewed by Chris Dumez. Temporarily disable CEReactions entirely to recover the regression in Speedometer since reverting r208082 wouldn't remove CEReactions from other DOM APIs and if r208082 was a regression, then they're likely causing a regression on Speedometer as well. * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionStack::ElementQueue::add): Removed the release assert added in r208785 since reactions can be inserted into the backup queue while the queue is running. (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): Ditto. * dom/CustomElementReactionQueue.h: (WebCore::CustomElementReactionStack::CustomElementReactionStack): Removed all the code so that this constructor would be optimized away by clang. (WebCore::CustomElementReactionStack::~CustomElementReactionStack): Ditto. 2016-11-16 Ryosuke Niwa <rniwa@webkit.org> Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled https://bugs.webkit.org/show_bug.cgi?id=164845 Reviewed by Wenson Hsieh. Fix builds after r208802 by wrapping code inside USE(APPLE_INTERNAL_SDK). * platform/mac/WebPlaybackControlsManager.h: * platform/mac/WebPlaybackControlsManager.mm: * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged): (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager): 2016-11-16 Chris Dumez <cdumez@apple.com> ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary https://bugs.webkit.org/show_bug.cgi?id=164812 <rdar://problem/29148465> Reviewed by Geoffrey Garen. ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary, meaning when there is not already one pending. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): (WebCore::ScriptExecutionContext::dispatchMessagePortEvents): * dom/ScriptExecutionContext.h: 2016-11-16 Chris Dumez <cdumez@apple.com> Use more references in TreeScope / TreeScopeAdopter https://bugs.webkit.org/show_bug.cgi?id=164836 Reviewed by Ryosuke Niwa. Use more references in TreeScope / TreeScopeAdopter and avoid some unnecessary null checks. No new tests, no Web-exposed behavior change. * dom/ContainerNode.cpp: (WebCore::ContainerNode::takeAllChildrenFrom): (WebCore::ContainerNode::insertBefore): (WebCore::ContainerNode::replaceChild): (WebCore::ContainerNode::removeBetween): (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): (WebCore::ContainerNode::parserAppendChild): * dom/ContainerNodeAlgorithms.cpp: (WebCore::addChildNodesToDeletionQueue): * dom/Document.cpp: (WebCore::Document::adoptNode): (WebCore::Document::moveNodeIteratorsToNewDocument): * dom/Document.h: * dom/Element.cpp: (WebCore::Element::didMoveToNewDocument): (WebCore::Element::addShadowRoot): (WebCore::Element::removeShadowRoot): (WebCore::Element::setAttributeNode): (WebCore::Element::setAttributeNodeNS): (WebCore::Element::ensureAttr): * dom/Element.h: * dom/Node.cpp: (WebCore::Node::didMoveToNewDocument): * dom/Node.h: * dom/NodeRareData.h: (WebCore::NodeListsNodeData::adoptDocument): * dom/TreeScope.cpp: (WebCore::TreeScope::TreeScope): (WebCore::TreeScope::setParentTreeScope): (WebCore::TreeScope::adoptIfNeeded): * dom/TreeScope.h: (WebCore::TreeScope::documentScope): (WebCore::TreeScope::setDocumentScope): * dom/TreeScopeAdopter.cpp: (WebCore::TreeScopeAdopter::moveTreeToNewScope): (WebCore::TreeScopeAdopter::moveShadowTreeToNewDocument): (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled): (WebCore::TreeScopeAdopter::updateTreeScope): (WebCore::TreeScopeAdopter::moveNodeToNewDocument): * dom/TreeScopeAdopter.h: (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled): (WebCore::TreeScopeAdopter::TreeScopeAdopter): * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::didMoveToNewDocument): * html/FormAssociatedElement.h: * html/HTMLFieldSetElement.cpp: (WebCore::HTMLFieldSetElement::didMoveToNewDocument): * html/HTMLFieldSetElement.h: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::didMoveToNewDocument): * html/HTMLFormControlElement.h: * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::didMoveToNewDocument): * html/HTMLFormElement.h: * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::didMoveToNewDocument): * html/HTMLImageElement.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::didMoveToNewDocument): * html/HTMLInputElement.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didMoveToNewDocument): * html/HTMLMediaElement.h: * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::didMoveToNewDocument): * html/HTMLObjectElement.h: * html/HTMLPictureElement.cpp: (WebCore::HTMLPictureElement::didMoveToNewDocument): * html/HTMLPictureElement.h: * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::didMoveToNewDocument): * html/HTMLPlugInImageElement.h: * html/HTMLTemplateElement.cpp: (WebCore::HTMLTemplateElement::didMoveToNewDocument): * html/HTMLTemplateElement.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::didMoveToNewDocument): * html/HTMLVideoElement.h: * html/ImageDocument.cpp: (WebCore::ImageDocumentElement::didMoveToNewDocument): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::didMoveToNewDocument): * svg/SVGImageElement.h: * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::didMoveToNewDocument): * svg/SVGSVGElement.h: 2016-11-16 Jon Davis <jond@apple.com> Added Web App Manifest to the Feature Status page. https://bugs.webkit.org/show_bug.cgi?id=162675 Reviewed by Timothy Hatcher. * features.json: 2016-11-16 Chris Dumez <cdumez@apple.com> Use more references for Document::removeFocusedNodeOfSubtree() https://bugs.webkit.org/show_bug.cgi?id=164839 Reviewed by Andreas Kling. Use more references for Document::removeFocusedNodeOfSubtree(). No new tests, no Web-exposed behavior change. * dom/Document.cpp: (WebCore::isNodeInSubtree): (WebCore::Document::removeFocusedNodeOfSubtree): (WebCore::Document::nodeChildrenWillBeRemoved): (WebCore::Document::nodeWillBeRemoved): (WebCore::Document::removeFocusNavigationNodeOfSubtree): (WebCore::Document::removeFullScreenElementOfSubtree): * dom/Document.h: * dom/Element.cpp: (WebCore::Element::removeShadowRoot): * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): 2016-11-16 Brent Fulgham <bfulgham@apple.com> Clear track client when removing a track https://bugs.webkit.org/show_bug.cgi?id=164842 <rdar://problem/29213621> Reviewed by Eric Carlson. Call 'clearClient' when removing a track from an HTMLMediaElement. Test: media/track/audio-track-add-remove.html media/track/video-track-add-remove.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removeAudioTrack): Call 'clearClient' (WebCore::HTMLMediaElement::removeVideoTrack): Ditto. 2016-11-16 Yusuke Suzuki <utatane.tea@gmail.com> [ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag https://bugs.webkit.org/show_bug.cgi?id=164827 Reviewed by Ryosuke Niwa. Use Settings.in. And intentionally do not use RuntimeEnabledFeatures. According to the pointer lock's issue[1], we should use Settings. [1]: https://bugs.webkit.org/show_bug.cgi?id=163801 * Configurations/FeatureDefines.xcconfig: * dom/ScriptElement.cpp: (WebCore::ScriptElement::determineScriptType): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * page/Settings.in: A bit unfortunate thing is that the setter is named `setEs6ModulesEnabled` if we use `es6ModulesEnabled` here. 2016-11-16 Chris Dumez <cdumez@apple.com> Unreviewed, remove outdated comment about using PassRefPtr. * dom/ContainerNode.cpp: (WebCore::ContainerNode::parserAppendChild): 2016-11-16 Ryosuke Niwa <rniwa@webkit.org> slotchange event should bubble and dispatched once https://bugs.webkit.org/show_bug.cgi?id=164770 Reviewed by Antti Koivisto. Updated our implementation of slotchange event to match the latest specification after: https://github.com/w3c/webcomponents/issues/571 https://dom.spec.whatwg.org/#signal-a-slot-change The new behavior matches that of Google Chrome Canary. In the latest specification, we no longer dispatch a separate event on ancestor slots. Instead, we fire a single slotchange event to which a new node is assigned or from which an existing assigned node is removed. This patch mostly removes the code that existed to locate ancestor slot elements, and makes the event bubble up by changing a single line in HTMLSlotElement::dispatchSlotChangeEvent. Test: fast/shadow-dom/slotchange-event-bubbling.html * dom/ShadowRoot.h: * dom/SlotAssignment.cpp: (WebCore::recursivelyFireSlotChangeEvent): Deleted. (WebCore::SlotAssignment::didChangeSlot): Removed ChangeType from the arguments since we no longer notify the ancestor slot elements. (WebCore::SlotAssignment::hostChildElementDidChange): * dom/SlotAssignment.h: (WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost): (WebCore::ShadowRoot::didChangeDefaultSlot): (WebCore::ShadowRoot::hostChildElementDidChangeSlotAttribute): (WebCore::ShadowRoot::innerSlotDidChange): Deleted. * html/HTMLDetailsElement.cpp: (WebCore::DetailsSlotAssignment::hostChildElementDidChange): * html/HTMLSlotElement.cpp: (WebCore::HTMLSlotElement::dispatchSlotChangeEvent): Make slotchange event bubble. 2016-11-16 Alex Christensen <achristensen@webkit.org> REGRESSION (r207162): [debug] loader/stateobjects LayoutTests timing out https://bugs.webkit.org/show_bug.cgi?id=163307 Reviewed by Alexey Proskuryakov. * platform/URLParser.cpp: Removed some unnecessary and redundant assertions in iterators, which are inside inner loops. (WebCore::URLParser::parsedDataView): (WebCore::URLParser::parse): Add a parsedDataView that just returns a UChar instead of a StringView for 1-length views. This speeds up debug builds considerably, which spent most of the time parsing the path making and destroying these 1-length StringViews. It can't hurt release builds. * platform/URLParser.h: 2016-11-16 Chris Dumez <cdumez@apple.com> Micro-optimize ContainerNode::removeBetween() https://bugs.webkit.org/show_bug.cgi?id=164832 Reviewed by Sam Weinig. Micro-optimize ContainerNode::removeBetween() by updating pointers only when strictly needed and reducing branching. No new tests, no Web-exposed behavior change. * dom/ContainerNode.cpp: (WebCore::ContainerNode::removeBetween): 2016-11-16 Chris Dumez <cdumez@apple.com> Micro-optimize AtomicHTMLToken::initializeAttributes() https://bugs.webkit.org/show_bug.cgi?id=164826 Reviewed by Sam Weinig. Micro-optimize AtomicHTMLToken::initializeAttributes(): - Use uncheckedAppend() instead of append() since we reserve capacity before the loop. - Use a more efficient findAttribute() that only checks the local names since this function only adds attributes that have to namespace or prefix. No new tests, no Web-exposed behavior change. * html/parser/AtomicHTMLToken.h: (WebCore::hasAttribute): (WebCore::AtomicHTMLToken::initializeAttributes): 2016-11-16 Beth Dakin <bdakin@apple.com> Another build fix. * platform/mac/WebPlaybackSessionInterfaceMac.mm: 2016-11-16 Beth Dakin <bdakin@apple.com> Attempted build fix. * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::durationChanged): (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged): (WebCore::WebPlaybackSessionInterfaceMac::rateChanged): (WebCore::WebPlaybackSessionInterfaceMac::beginScrubbing): (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged): (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::ensureControlsManager): 2016-11-16 Brady Eidson <beidson@apple.com> Re-indent some old headers. Rubberstamped by Alex Christensen No new tests (No behavior change). (Also #pragma once a few of them) * loader/DocumentLoader.h: * loader/FrameLoaderClient.h: * page/Frame.h: * page/FrameTree.h: * page/PageGroup.h: * platform/Cursor.h: 2016-11-16 Darin Adler <darin@apple.com> REGRESSION (r208672): Crash in com.apple.WebCore: WebCore::DatabaseContext::stopDatabases + 34 https://bugs.webkit.org/show_bug.cgi?id=164820 Reviewed by Sam Weinig. Crash seen in existing regression tests; reliably reproducible in some test configurations. * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::contextDestroyed): Call through to base class before calling stopDatabases, since that might cause this object to be deallocated. (WebCore::DatabaseContext::stopDatabases): Be sure not to clear the possibly-last reference to this database context until after all code that accesses data members, since it might cause this object to be deallocated. 2016-11-16 Beth Dakin <bdakin@apple.com> Implement WebPlaybackControlsManager https://bugs.webkit.org/show_bug.cgi?id=164789 -and corresponding- rdar://problem/29275082 Reviewed by Dan Bernstein. * platform/mac/WebPlaybackControlsManager.h: * platform/mac/WebPlaybackControlsManager.mm: (-[WebPlaybackControlsManager dealloc]): (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]): (-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]): (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]): (-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]): (-[WebPlaybackControlsManager beginFunctionBarScrubbing]): (-[WebPlaybackControlsManager endFunctionBarScrubbing]): (-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]): (-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]): (-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]): (-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]): (-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]): (-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]): (-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]): (-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]): (mediaSelectionOptions): (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]): (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]): (-[WebPlaybackControlsManager webPlaybackSessionInterfaceMac]): (-[WebPlaybackControlsManager setWebPlaybackSessionInterfaceMac:]): (-[WebPlaybackControlsManager togglePlayback]): (-[WebPlaybackControlsManager setPlaying:]): (-[WebPlaybackControlsManager isPlaying]): * platform/mac/WebPlaybackSessionInterfaceMac.h: * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::durationChanged): (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged): (WebCore::WebPlaybackSessionInterfaceMac::rateChanged): (WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager): 2016-11-16 Jiewen Tan <jiewen_tan@apple.com> Add more tests for SubtleCrypto::importKey and SubtleCrypto::exportKey https://bugs.webkit.org/show_bug.cgi?id=164815 <rdar://problem/29281660> Reviewed by Brent Fulgham. Tests: crypto/subtle/aes-import-jwk-key-export-jwk-key.html crypto/subtle/aes-import-jwk-key-export-raw-key.html crypto/subtle/aes-import-raw-key-export-jwk-key.html crypto/subtle/aes-import-raw-key-export-raw-key.html crypto/subtle/hmac-import-jwk-key-export-jwk-key.html crypto/subtle/hmac-import-jwk-key-export-raw-key.html crypto/subtle/hmac-import-raw-key-export-jwk-key.html crypto/subtle/hmac-import-raw-key-export-raw-key.html crypto/subtle/rsa-import-jwk-key-export-jwk-key-private.html crypto/subtle/rsa-import-jwk-key-export-jwk-key-public.html * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::create): Add a comment. 2016-11-16 Antti Koivisto <antti@apple.com> Remove getMutableCachedPseudoStyle https://bugs.webkit.org/show_bug.cgi?id=164819 Reviewed by Zalan Bujtas. It is only used by styleForFirstLetter. * rendering/RenderBlock.cpp: (WebCore::styleForFirstLetter): Clone the original style before mutations. (WebCore::RenderBlock::updateFirstLetterStyle): (WebCore::RenderBlock::createFirstLetterRenderer): Since we have a clone already just move it in place. * rendering/RenderElement.cpp: (WebCore::RenderElement::getMutableCachedPseudoStyle): Deleted. * rendering/RenderElement.h: 2016-11-16 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Implement ReadableByteStreamController close() https://bugs.webkit.org/show_bug.cgi?id=164413 Reviewed by Darin Adler. Implemented close() method of ReadableByteStreamController. Updated test expectations for close() tests and added tests to ensure errors are thrown in various cases defined by spec. * Modules/streams/ReadableByteStreamController.js: (close): Added. * Modules/streams/ReadableByteStreamInternals.js: (readableByteStreamControllerClose): Added. * bindings/js/WebCoreBuiltinNames.h: Added bytesFilled. 2016-11-16 Philippe Normand <pnormand@igalia.com> [GStreamer][GL] build broken when using gst-plugins-bad from git https://bugs.webkit.org/show_bug.cgi?id=164776 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): The GStreamer GL context GType was renamed, add an ifdef taking this into account. 2016-11-16 Yusuke Suzuki <utatane.tea@gmail.com> [ES6] Integrate ES6 Modules into WebCore https://bugs.webkit.org/show_bug.cgi?id=148897 Reviewed by Ryosuke Niwa. This patch introduces ES6 Modules into WebCore. We integrate JSC's JSModuleLoader into WebCore. JSC constructs the module loader pipeline by the chains of the promises. To handle this, the following components are added. 1. CachedModuleScript CachedModuleScript wraps the promise based JSModuleLoader pipeline and offers similar APIs to CachedScript. ScriptElement and PendingScript interact with CachedModuleScript when the script tag is the module tag instead of CachedScript. ScriptElement and PendingScript will receive the notification from CachedModuleScript by implementing CachedModuleScriptClient. 2. ScriptModuleLoader This is the module loader instantiated per document. It manages fetching and offers the callbacks for the JSC's JSModuleLoader implementation. ScriptModuleLoader will fetch the resource by creating CachedModuleScriptLoader per resource. ScriptModuleLoader will receive the notification by implementing CachedModuleScriptLoaderClient. When the resource is fetched, the module loader will drive the promise resolve/reject chain. 3. CachedModuleScriptLoader This fetches the resource by using CachedScript. Using CachedScript means that it automatically reports the resource to the inspector. CachedModuleScriptLoader notify to ScriptModuleLoader when the resource is fetched. One tricky point is that the fetch requests issued from one module-graph should share the same nonce, crossorigin attributes etc. Here, we wrote the module graph like `A -> B (A depends on B)`. <script tag> -> A -> B -> C -> D When fetching A, B, C, and D modules, we need to set the same nonce, crossorigin etc. configuration derived from the original script tag. So per module-graph information should be shared throughout the module loader pipeline. To do so, JSC's module loader implementation can take the value called `initiator`. Since the loader will propagate & share this `initiator` throughout the pipeline, we can transfer and share some metadata. Currently, we pass the JSWrapper of the script tag as the initiator. Each fetch request is created by using this initiator script element. More integration into the inspector should be done in the subsequent patch. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScript.cpp: Added. CachedModuleScript offers similar interface to CachedScript to make ScriptElement things easier. It encapsulates the detail of the JSC JSModuleLoader that this module loader is driven by the chain of the promises. CachedModuleScript's callbacks are called from the promise's handlers configured in ScriptController::loadModuleScript. (WebCore::CachedModuleScript::create): (WebCore::CachedModuleScript::CachedModuleScript): (WebCore::CachedModuleScript::load): (WebCore::CachedModuleScript::notifyLoadCompleted): (WebCore::CachedModuleScript::notifyLoadFailed): (WebCore::CachedModuleScript::notifyLoadWasCanceled): (WebCore::CachedModuleScript::notifyClientFinished): (WebCore::CachedModuleScript::addClient): (WebCore::CachedModuleScript::removeClient): * bindings/js/CachedModuleScript.h: Added. (WebCore::CachedModuleScript::moduleKey): (WebCore::CachedModuleScript::error): (WebCore::CachedModuleScript::wasCanceled): (WebCore::CachedModuleScript::isLoaded): (WebCore::CachedModuleScript::nonce): (WebCore::CachedModuleScript::crossOriginMode): Save nonce and crossorigin attributes when we start ScriptElement::prepareScript. * bindings/js/CachedModuleScriptClient.h: Copied from Source/WebCore/dom/LoadableScript.h. (WebCore::CachedModuleScriptClient::~CachedModuleScriptClient): * bindings/js/CachedModuleScriptLoader.cpp: Added. CachedModuleScriptLoader is responsible to fetching the resource for the module script. It uses propagated `initiator` to create the request. This initiator is the JS wrapper of the script element issuing this fetching request. The name `initiator` is derived from the request.setInitiator(). Once the resource is fetched, the fetcher will notify to the client. Currently, ScriptModuleLoader implements this client interface. (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::~CachedModuleScriptLoader): (WebCore::CachedModuleScriptLoader::load): Create the request. We call ScriptElement::requestCachedScript to initiate a new fetching request. At that time, nonce and crossorigin (and charset) attributes of this element are applied to the new request. (WebCore::CachedModuleScriptLoader::notifyFinished): * bindings/js/CachedModuleScriptLoader.h: Copied from Source/WebCore/bindings/js/ScriptModuleLoader.h. * bindings/js/CachedModuleScriptLoaderClient.h: Copied from Source/WebCore/dom/LoadableScript.h. (WebCore::CachedModuleScriptLoaderClient::~CachedModuleScriptLoaderClient): * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::create): (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): (WebCore::makeSource): * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMBinding.cpp: (WebCore::retrieveErrorMessage): (WebCore::reportException): * bindings/js/JSDOMBinding.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): (WebCore::JSMainThreadExecState::linkAndEvaluateModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): This just performs loading and not executing the module graph. Once the module graph is loaded, it is notified to the given CachedModuleScript. (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld): (WebCore::ScriptController::linkAndEvaluateModuleScript): This executes the linking and evaluation of the already instantiated module graph. After loading the module graph, we call this function for the module to evaluate it. This is called from ScriptElement::executeModuleScript. (WebCore::ScriptController::evaluateModule): Every time we evaluate the module, the ScriptModuleLoader::evaluate hook is called. So the loader calls this function to actually evaluate the module. (WebCore::jsValueToModuleKey): (WebCore::ScriptController::setupModuleScriptHandlers): The JSC's module loader is driven by the chain of the promise. So here, we convert this to CachedModuleScript / CachedModuleScriptClient style and encapsulate the details. This encapsulation makes CachedModuleScript similar to CachedScript and it makes things simple in the rest of WebCore. If the propagated error is already reported to the inspector, we receive moduleLoaderAlreadyReportedErrorSymbol as the error value. So at that case, we don't report it twice. If the rejection is caused due to the canceled fetching, moduleLoaderFetchingIsCanceledSymbol appears as the error value. In that case, we will call CachedModuleScript::notifyLoadWasCanceled. (WebCore::ScriptController::executeScript): * bindings/js/ScriptController.h: (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol): (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol): * bindings/js/ScriptModuleLoader.cpp: We use DeferredWrapper to resolve promises used for the module pipeline. Thus, once the active DOM objects are suspended, the module loader propagation stops. (WebCore::ScriptModuleLoader::~ScriptModuleLoader): Clear the clients of the fetchers issued from this loader. (WebCore::isRootModule): (WebCore::ScriptModuleLoader::resolve): Resolve the module specifier (that is written in `import from "XXX"`) to the unique module key. We use URL string as module key. The edge case is that the module is inlined one. In that case, we don't have any URL for that. Instead of URL, we use symbol at that time. (WebCore::ScriptModuleLoader::fetch): Start fetching for the requested module. It returns the promise that is resolved when the fetching is done. The loader creates the fetcher, and the fetcher start loading the resource. Once the fetcher loads the resource, it notify to the loader through CachedModuleScriptLoaderClient interface. Since we pass the original script element as the `initiator` here, the fetcher can use this initiator to create the request. While the result of CachedResource has 3 variations (loaded, canceled, error occurred), Promise only tells us whether it is resolved or rejected. When CachedModuleScript gets the result from the promise chain, it needs to know which the result is. To transfer the canceled information, we reject the promise with the special symbol `moduleLoaderAlreadyReportedErrorSymbol`. This offers the way to distinguish the canceled error from the other errors. (WebCore::ScriptModuleLoader::evaluate): This is the hook function that is called when JSC's JSModuleLoader attempts to execute each module. (WebCore::ScriptModuleLoader::notifyFinished): This function is called when the fetcher completes. We will resolve the promise with the result of the fetching. The module loader pipeline is constructed as a chain of promises. Rejecting a promise when some error occurs is important because the execution flow of the promise chain is driven by "rejected" or "fulfilled" events. If the promise is not rejected while error occurs, reject handler won't be executed and all the subsequent promise chain will wait the result forever. As a result, even if the error is already reported to the inspector elsewhere, it should be propagated in the pipeline. For example, the error of loading CachedResource is already reported to the inspector by the loader. But we still need to reject the promise to propagate this error to the script element. At that time, we don't want to report the same error twice. When we propagate the error that is already reported to the inspector, we throw moduleLoaderAlreadyReportedErrorSymbol symbol instead. By comparing the thrown error with this symbol, we can distinguish errors raised when checking syntax of a module script from errors reported already. In the reject handler of the promise, we only report a error that is not this symbol. And mime type checking is done here since the module script always require this check. * bindings/js/ScriptModuleLoader.h: (WebCore::ScriptModuleLoader::document): Deleted. * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * dom/CurrentScriptIncrementer.h: (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer): * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::error): (WebCore::LoadableClassicScript::execute): (WebCore::LoadableClassicScript::wasErrored): Deleted. * dom/LoadableClassicScript.h: * dom/LoadableModuleScript.cpp: Copied from Source/WebCore/dom/LoadableScript.h. This is the derived class from LoadableScript. It is used for the script module graphs. (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::~LoadableModuleScript): (WebCore::LoadableModuleScript::isLoaded): (WebCore::LoadableModuleScript::error): (WebCore::LoadableModuleScript::wasCanceled): (WebCore::LoadableModuleScript::notifyFinished): (WebCore::LoadableModuleScript::execute): * dom/LoadableModuleScript.h: Copied from Source/WebCore/dom/LoadableScript.h. (isType): * dom/LoadableScript.h: (WebCore::LoadableScript::isModuleScript): (WebCore::LoadableScript::isModuleGraph): Deleted. * dom/PendingScript.cpp: (WebCore::PendingScript::error): (WebCore::PendingScript::wasErrored): Deleted. * dom/PendingScript.h: * dom/ScriptElement.cpp: (WebCore::ScriptElement::ScriptElement): (WebCore::ScriptElement::determineScriptType): (WebCore::ScriptElement::prepareScript): prepareScript is aligned to whatwg spec: the last sequence to setup flags has one-on-one correspondence to the spec now. And prepareScript recognizes the type="module" case and call the requestModuleScript to setup the CachedModuleScript. (WebCore::ScriptElement::requestClassicScript): (WebCore::ScriptElement::requestModuleScript): We use the nonce and crossorigin attributes at the time of preparing the script tag. To do so, we store the above values in CachedModuleScript. Since inlined module scripts does not have "src" attribute, it is also affected by Content Security Policy's inline script rules. (WebCore::ScriptElement::requestScriptWithCacheForModuleScript): The module loader will construct the fetching request by calling this function. This should be here since we would like to set this Element to the initiator of the request. And nonce and crossorigin attributes of this script tag will be used. (WebCore::ScriptElement::requestScriptWithCache): (WebCore::ScriptElement::executeScript): (WebCore::ScriptElement::executeModuleScript): The entry point to execute the module graph. Since the module graph is beyond the multiple CachedScript code, we have the different entry point from ScriptElement::executeScript. (WebCore::ScriptElement::executeScriptAndDispatchEvent): (WebCore::ScriptElement::executeScriptForScriptRunner): * dom/ScriptElement.h: (WebCore::ScriptElement::scriptType): * html/parser/CSSPreloadScanner.cpp: (WebCore::CSSPreloadScanner::emitRule): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): According to the spec, the module tag ignores the "charset" attribute as the same to the worker's importScript. But WebKit supports the "charset" for importScript intentionally. So to be consistent, even for the module tags, we handle the "charset" attribute. We explicitly note about it in the preloader. (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * html/parser/HTMLResourcePreloader.h: (WebCore::PreloadRequest::PreloadRequest): * html/parser/HTMLScriptRunner.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::notifyFinished): 2016-11-15 Alejandro G. Castro <alex@igalia.com> Warning added in r208542 https://bugs.webkit.org/show_bug.cgi?id=164636 Reviewed by Eric Carlson. Deleted the copy constructor, we now explicitly copy the object in the clone method. * platform/mediastream/MediaStreamTrackPrivate.cpp: Delete the copy constructor. (WebCore::MediaStreamTrackPrivate::clone): Copy the relevant information for the clone operation in the API. * platform/mediastream/MediaStreamTrackPrivate.h: Delete the copy constructor. 2016-11-15 Ryosuke Niwa <rniwa@webkit.org> Add more assertions to ElementQueue diagnose a bug https://bugs.webkit.org/show_bug.cgi?id=164814 Reviewed by Yusuke Suzuki. Add more assertions to check the sanity of the element queue. Also made them all release assertions so that we can catch them better. * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionStack::ElementQueue::add): (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): 2016-11-15 Chris Dumez <cdumez@apple.com> Simplify Element::stripScriptingAttributes() https://bugs.webkit.org/show_bug.cgi?id=164785 Reviewed by Ryosuke Niwa. Simplify Element::stripScriptingAttributes() by leveraging Vector::removeAllMatching(). No new tests, no Web-exposed behavior change. * dom/Element.cpp: (WebCore::Element::stripScriptingAttributes): 2016-11-15 Jon Lee <jonlee@apple.com> Report active video and audio capture devices separately https://bugs.webkit.org/show_bug.cgi?id=164769 Reviewed by Eric Carlson. For UI purposes, separate the notion of any active capture device to an active audio and video capture device. * page/MediaProducer.h: Replace HasActiveMediaCaptureDevice with HasActiveAudioCaptureDevice and HasActiveVideoCaptureDevice. * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::mediaState): Update the logic for mediaState(). Since it is possible to arbitrarily add tracks from various sources, check specifically for a local AV source (meaning a capture device) that is producing data. * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::hasLocalVideoSource): Iterate over the tracks and look for video sources that are not remote. (WebCore::MediaStreamPrivate::hasLocalAudioSource): Ditto for audio. * platform/mediastream/MediaStreamPrivate.h: * testing/Internals.cpp: (WebCore::Internals::pageMediaState): Update internals reporting. 2016-11-15 Chris Dumez <cdumez@apple.com> Avoid copying vector of attributes as much as possible in the HTML parser https://bugs.webkit.org/show_bug.cgi?id=164778 Reviewed by Ryosuke Niwa. Avoid copying vector of attributes as much as possible in the HTML parser by moving AtomicHTMLToken around and making it obvious it is safe to move its attributes vector as well. No new tests, no Web-exposed behavior change. * html/parser/AtomicHTMLToken.h: (WebCore::AtomicHTMLToken::AtomicHTMLToken): (WebCore::findAttribute): * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML): (WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement): (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody): (WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody): (WebCore::HTMLConstructionSite::insertDoctype): (WebCore::HTMLConstructionSite::insertComment): (WebCore::HTMLConstructionSite::insertCommentOnDocument): (WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement): (WebCore::HTMLConstructionSite::insertHTMLHeadElement): (WebCore::HTMLConstructionSite::insertHTMLBodyElement): (WebCore::HTMLConstructionSite::insertHTMLFormElement): (WebCore::HTMLConstructionSite::insertHTMLElement): (WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface): (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement): (WebCore::HTMLConstructionSite::insertFormattingElement): (WebCore::HTMLConstructionSite::insertScriptElement): (WebCore::HTMLConstructionSite::insertForeignElement): (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): (WebCore::HTMLConstructionSite::createElementFromSavedToken): * html/parser/HTMLConstructionSite.h: * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::constructTreeFromHTMLToken): * html/parser/HTMLStackItem.h: (WebCore::HTMLStackItem::HTMLStackItem): (WebCore::HTMLStackItem::create): * html/parser/HTMLTreeBuilder.cpp: (WebCore::CustomElementConstructionData::CustomElementConstructionData): (WebCore::HTMLTreeBuilder::constructTree): (WebCore::HTMLTreeBuilder::processToken): (WebCore::HTMLTreeBuilder::processDoctypeToken): (WebCore::HTMLTreeBuilder::processFakeStartTag): (WebCore::HTMLTreeBuilder::processFakeEndTag): (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope): (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): (WebCore::HTMLTreeBuilder::processStartTagForInBody): (WebCore::HTMLTreeBuilder::insertGenericHTMLElement): (WebCore::HTMLTreeBuilder::processTemplateStartTag): (WebCore::HTMLTreeBuilder::processTemplateEndTag): (WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents): (WebCore::HTMLTreeBuilder::processStartTagForInTable): (WebCore::HTMLTreeBuilder::processStartTag): (WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody): (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody): (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody): (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): (WebCore::HTMLTreeBuilder::processEndTagForInTableBody): (WebCore::HTMLTreeBuilder::processEndTagForInRow): (WebCore::HTMLTreeBuilder::processEndTagForInCell): (WebCore::HTMLTreeBuilder::processEndTagForInBody): (WebCore::HTMLTreeBuilder::processEndTagForInTable): (WebCore::HTMLTreeBuilder::processEndTag): (WebCore::HTMLTreeBuilder::processComment): (WebCore::HTMLTreeBuilder::processCharacter): (WebCore::HTMLTreeBuilder::processEndOfFile): (WebCore::HTMLTreeBuilder::defaultForBeforeHTML): (WebCore::HTMLTreeBuilder::defaultForBeforeHead): (WebCore::HTMLTreeBuilder::defaultForInHead): (WebCore::HTMLTreeBuilder::defaultForInHeadNoscript): (WebCore::HTMLTreeBuilder::defaultForAfterHead): (WebCore::HTMLTreeBuilder::processStartTagForInHead): (WebCore::HTMLTreeBuilder::processGenericRCDATAStartTag): (WebCore::HTMLTreeBuilder::processGenericRawTextStartTag): (WebCore::HTMLTreeBuilder::processScriptStartTag): (WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): (WebCore::hasAttribute): (WebCore::HTMLTreeBuilder::processTokenInForeignContent): (WebCore::HTMLTreeBuilder::parseError): * html/parser/HTMLTreeBuilder.h: * html/parser/TextDocumentParser.cpp: (WebCore::TextDocumentParser::insertFakePreElement): 2016-11-15 Alex Christensen <achristensen@webkit.org> Fix iOS API test assertion after r208534 https://bugs.webkit.org/show_bug.cgi?id=164751 Reviewed by Geoffrey Garen. This removes a firing assertion in the WebKit1.AudioSessionCategoryIOS API test on the iOS simulator. * platform/MemoryPressureHandler.h: (WebCore::MemoryPressureHandler::setLowMemoryHandler): This assertion is no longer valid because we are using m_installed to determine if m_lowMemoryHandler xor m_releaseMemoryBlock is set, and we should be setting both right now on iOS and they are both useful in freeing memory. These should be united. 2016-11-15 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Key collation during SQLite lookups is insanely slow. https://bugs.webkit.org/show_bug.cgi?id=164754 Reviewed by Alex Christensen. No new tests (Covered by *all* existing tests, and unskips a previously-too-slow test) The new serialization format is straight forward enough to get back with minimal documentation in a comment with the code itself being the rest of the documentation. It handles all current IDB key types and leaves room for future key types. * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::setBinaryValue): * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::binary): * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::serializedTypeForKeyType): (WebCore::writeLittleEndian): (WebCore::readLittleEndian): (WebCore::writeDouble): (WebCore::readDouble): (WebCore::encodeKey): (WebCore::serializeIDBKeyData): (WebCore::decodeKey): (WebCore::deserializeIDBKeyData): * Modules/indexeddb/server/IDBSerialization.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey): Verify that Type == Invalid keys don't get into the database. This was happening before and the previous serialization supported it, but there's clearly no point in supporting it with the new serialization. 2016-11-15 Brent Fulgham <bfulgham@apple.com> Ensure sufficient buffer for worst-case URL encoding https://bugs.webkit.org/show_bug.cgi?id=164794 <rdar://problem/5905510> Reviewed by David Kilzer. Slightly increase the default allocation size for URL parsing to account for the worst-case parsing case. Under these assumptions, we might need three times the byte length of the URL, plus nine bytes for fix-up characters. In short, increase the default buffer size by 9 bytes. No new tests. No change in behavior. * platform/URL.cpp: (WebCore::URL::parse): Slightly increase the default buffer size. 2016-11-15 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Remove unused and untested Page.setTouchEmulationEnabled command https://bugs.webkit.org/show_bug.cgi?id=164793 Reviewed by Matt Baker. * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend): (WebCore::InspectorPageAgent::updateTouchEventEmulationInPage): Deleted. (WebCore::InspectorPageAgent::setTouchEmulationEnabled): Deleted. * inspector/InspectorPageAgent.h: 2016-11-15 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, quick fix for r208751 * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::jsSubtleCryptoFunctionExportKeyPromise): 2016-11-15 Chris Dumez <cdumez@apple.com> Unreviewed, fix build after r208710. Inline functions should not be marked as WEBCORE_EXPORT. * dom/QualifiedName.h: 2016-11-15 Brent Fulgham <bfulgham@apple.com> strncpy may leave unterminated string in WebCore::URL::init https://bugs.webkit.org/show_bug.cgi?id=74473 <rdar://problem/10576626> Reviewed by David Kilzer. Reviving an old patch by David Kilzer! This should have been integrated years ago. No new tests. No change in behavior. * platform/URL.cpp: (WebCore::URL::init): Make sure we always enter 'parse' with a null-terminated string. 2016-11-15 Jiewen Tan <jiewen_tan@apple.com> Followup patch for r208737 Reviewed by Yusuke Suzuki. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::jsSubtleCryptoFunctionExportKeyPromise): 2016-11-14 Simon Fraser <simon.fraser@apple.com> [iOS WK2] Implement support for visual viewports https://bugs.webkit.org/show_bug.cgi?id=164765 Reviewed by Tim Horton. Adopt the visual viewport scrolling model in iOS WK2. This is more complex than the Mac implementation for two primary reasons. First, WKWebView needs to to able to control the rectangle used for fixed position layout to get the correct behavior when zooming all the way out, and because iOS displays pages scaled down, exposing document overflow such that the layout viewport rectangle has to get larger than the initial containing block size (which does not happen on Mac). This is achieved by pushing a "layoutViewportOverrideRect" down onto FrameView, in a similar way to the customFixedPositionRect that's used now. We share that name for now in code that is agnostic to its use (e.g. VisibleContentRectUpdateInfo). I tried so hard to write tests, but ran into various problems (webkit.org/b/164762, webkit.org/b/164764). Will add tests via webkit.org/b/164764. * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): layoutViewportOrigin() was removed. (WebCore::FrameView::setBaseLayoutViewportOrigin): Rename with "base" to make it clearer that it can be overridden. (WebCore::FrameView::setLayoutViewportOverrideRect): (WebCore::FrameView::baseLayoutViewportSize): Renamed. (WebCore::FrameView::updateLayoutViewport): Logging. (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): During page transitions on iOS, it was possible for unscaledDocumentRect to be empty, but visibleSize() to be non-empty, leading to odd negative max scroll offsets, so clamp to 0,0. (WebCore::FrameView::setLayoutViewportOrigin): Deleted. * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): scrollPositionForFixedPosition() already does the visualViewportEnabled() check. * page/scrolling/mac/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): * platform/graphics/FloatSize.cpp: (WebCore::FloatSize::constrainedBetween): Added for consistency with the other geometry types. * platform/graphics/FloatSize.h: * platform/graphics/LayoutSize.cpp: (WebCore::LayoutSize::constrainedBetween): Ditto. * platform/graphics/LayoutSize.h: * rendering/RenderView.cpp: (WebCore::RenderView::clientLogicalWidthForFixedPosition): If we have an override layout viewport, its size might be different from the RenderView's size (the initial containing block), so we need to use the layoutViewportRect here. (WebCore::RenderView::clientLogicalHeightForFixedPosition): 2016-11-15 Myles C. Maxfield <mmaxfield@apple.com> [WebGL] Remove unused Chromium-specific OpenGL extensions https://bugs.webkit.org/show_bug.cgi?id=164782 Reviewed by Dean Jackson. No new tests because there is no behavior change. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::copyBufferSubData): (WebCore::WebGL2RenderingContext::clear): (WebCore::WebGL2RenderingContext::getExtension): * html/canvas/WebGLCompressedTextureS3TC.cpp: (WebCore::WebGLCompressedTextureS3TC::supported): * html/canvas/WebGLDepthTexture.cpp: (WebCore::WebGLDepthTexture::supported): * html/canvas/WebGLDrawBuffers.cpp: (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements): * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::onAccess): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::clear): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::setupFlags): (WebCore::WebGLRenderingContextBase::bufferData): (WebCore::WebGLRenderingContextBase::bufferSubData): (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): (WebCore::WebGLRenderingContextBase::validateDrawArrays): (WebCore::WebGLRenderingContextBase::validateDrawElements): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::texImage2DBase): (WebCore::WebGLRenderingContextBase::copyTexImage2D): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::isGLES2NPOTStrict): (WebCore::WebGLRenderingContextBase::isErrorGeneratedOnOutOfBoundsAccesses): Deleted. (WebCore::WebGLRenderingContextBase::isResourceSafe): Deleted. * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::texImage2DResourceSafe): * platform/graphics/GraphicsContext3D.h: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::isResourceSafe): Deleted. 2016-11-14 Brent Fulgham <bfulgham@apple.com> Correct handling of changing input type https://bugs.webkit.org/show_bug.cgi?id=164759 <rdar://problem/29211174> Reviewed by Darin Adler. Test: fast/forms/search-cancel-button-change-input.html It is possible for JavaScript to change the type property of an input field. WebKit needs to gracefully handle this case. Add a type traits specialization so we can properly downcast InputType elements. Use this to only call search functions on actual search input types. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::onSearch): Only perform search functions if the input type is actually a search field. * html/InputType.h: Add type traits specialization for 'downcast' template. * html/SearchInputType.h: Ditto. 2016-11-15 Zalan Bujtas <zalan@apple.com> CounterNode::insertAfter and ::removeChild should take references. https://bugs.webkit.org/show_bug.cgi?id=164780 Reviewed by Simon Fraser. No change in functionality. * rendering/CounterNode.cpp: (WebCore::CounterNode::insertAfter): (WebCore::CounterNode::removeChild): * rendering/CounterNode.h: * rendering/RenderCounter.cpp: (WebCore::makeCounterNode): (WebCore::destroyCounterNodeWithoutMapRemoval): (WebCore::updateCounters): 2016-11-15 Antti Koivisto <antti@apple.com> slot doesn't work as a flex container https://bugs.webkit.org/show_bug.cgi?id=160740 <rdar://problem/28605080> Reviewed by Ryosuke Niwa. Test: fast/shadow-dom/css-scoping-slot-flex.html The style adjustment for flex children needs to be based on their parent box style rather than the composed tree parent. This can be different when display:contents is involved. * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::documentElementUserAgentStyle): * css/StyleMedia.cpp: (WebCore::StyleMedia::matchMedium): * css/StyleResolver.cpp: (WebCore::StyleResolver::StyleResolver): (WebCore::StyleResolver::styleForElement): Optionally provide parent box style so we can do adjustments based on it when computing style for rendering. (WebCore::StyleResolver::styleForKeyframe): (WebCore::StyleResolver::pseudoStyleForElement): (WebCore::equivalentBlockDisplay): Avoid boolean parameters. (WebCore::StyleResolver::adjustRenderStyle): Do the display:contents adjustment first and treat 'content' like 'none' later'. We never want to override 'contents' with adjustments. Use parent box style for flex/grid adjustments instead of the DOM parent style. * css/StyleResolver.h: * rendering/RenderNamedFlowFragment.cpp: (WebCore::RenderNamedFlowFragment::computeStyleInRegion): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::styleForElement): Call with parent box style. (WebCore::Style::TreeResolver::parentBoxStyle): Find the parent box style if any. * style/StyleTreeResolver.h: * svg/SVGElementRareData.h: (WebCore::SVGElementRareData::overrideComputedStyle): 2016-11-15 Joseph Pecoraro <pecoraro@apple.com> Misc Inspector backend cleanup https://bugs.webkit.org/show_bug.cgi?id=164768 Reviewed by Brian Burg. * inspector/DOMPatchSupport.cpp: * inspector/InspectorApplicationCacheAgent.cpp: * inspector/InspectorApplicationCacheAgent.h: * inspector/InspectorCSSAgent.cpp: * inspector/InspectorCSSAgent.h: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): * inspector/InspectorDOMAgent.h: * inspector/InspectorDOMDebuggerAgent.h: * inspector/InspectorDOMStorageAgent.cpp: * inspector/InspectorDOMStorageAgent.h: * inspector/InspectorDatabaseAgent.cpp: * inspector/InspectorDatabaseAgent.h: * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::frontendLoaded): * inspector/InspectorIndexedDBAgent.cpp: (WebCore::ClearObjectStoreListener::create): Deleted. (WebCore::ClearObjectStoreListener::~ClearObjectStoreListener): Deleted. (WebCore::ClearObjectStoreListener::ClearObjectStoreListener): Deleted. (WebCore::ClearObjectStore::create): Deleted. (WebCore::ClearObjectStore::ClearObjectStore): Deleted. * inspector/InspectorLayerTreeAgent.cpp: * inspector/InspectorLayerTreeAgent.h: * inspector/InspectorNetworkAgent.h: * inspector/InspectorPageAgent.cpp: * inspector/InspectorPageAgent.h: * inspector/InspectorReplayAgent.cpp: * inspector/InspectorReplayAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::stopFromConsole): * inspector/InspectorTimelineAgent.h: * inspector/PageRuntimeAgent.h: 2016-11-14 Myles C. Maxfield <mmaxfield@apple.com> [WebGL] Migrate construction functions from pointers to references https://bugs.webkit.org/show_bug.cgi?id=164749 Reviewed by Zalan Bujtas. Mechanical find/replace. No new tests because there is no behavior change. * html/canvas/ANGLEInstancedArrays.cpp: (WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays): (WebCore::ANGLEInstancedArrays::supported): (WebCore::ANGLEInstancedArrays::drawArraysInstancedANGLE): (WebCore::ANGLEInstancedArrays::drawElementsInstancedANGLE): (WebCore::ANGLEInstancedArrays::vertexAttribDivisorANGLE): * html/canvas/ANGLEInstancedArrays.h: * html/canvas/EXTBlendMinMax.cpp: (WebCore::EXTBlendMinMax::EXTBlendMinMax): * html/canvas/EXTBlendMinMax.h: * html/canvas/EXTFragDepth.cpp: (WebCore::EXTFragDepth::EXTFragDepth): * html/canvas/EXTFragDepth.h: * html/canvas/EXTShaderTextureLOD.cpp: (WebCore::EXTShaderTextureLOD::EXTShaderTextureLOD): * html/canvas/EXTShaderTextureLOD.h: * html/canvas/EXTTextureFilterAnisotropic.cpp: (WebCore::EXTTextureFilterAnisotropic::EXTTextureFilterAnisotropic): * html/canvas/EXTTextureFilterAnisotropic.h: * html/canvas/EXTsRGB.cpp: (WebCore::EXTsRGB::EXTsRGB): * html/canvas/EXTsRGB.h: * html/canvas/OESElementIndexUint.cpp: (WebCore::OESElementIndexUint::OESElementIndexUint): * html/canvas/OESElementIndexUint.h: * html/canvas/OESStandardDerivatives.cpp: (WebCore::OESStandardDerivatives::OESStandardDerivatives): * html/canvas/OESStandardDerivatives.h: * html/canvas/OESTextureFloat.cpp: (WebCore::OESTextureFloat::OESTextureFloat): * html/canvas/OESTextureFloat.h: * html/canvas/OESTextureFloatLinear.cpp: (WebCore::OESTextureFloatLinear::OESTextureFloatLinear): * html/canvas/OESTextureFloatLinear.h: * html/canvas/OESTextureHalfFloat.cpp: (WebCore::OESTextureHalfFloat::OESTextureHalfFloat): * html/canvas/OESTextureHalfFloat.h: * html/canvas/OESTextureHalfFloatLinear.cpp: (WebCore::OESTextureHalfFloatLinear::OESTextureHalfFloatLinear): * html/canvas/OESTextureHalfFloatLinear.h: * html/canvas/OESVertexArrayObject.cpp: (WebCore::OESVertexArrayObject::OESVertexArrayObject): (WebCore::OESVertexArrayObject::createVertexArrayOES): (WebCore::OESVertexArrayObject::deleteVertexArrayOES): (WebCore::OESVertexArrayObject::isVertexArrayOES): (WebCore::OESVertexArrayObject::bindVertexArrayOES): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects): (WebCore::WebGL2RenderingContext::initializeShaderExtensions): (WebCore::WebGL2RenderingContext::drawBuffers): (WebCore::WebGL2RenderingContext::createVertexArray): (WebCore::WebGL2RenderingContext::isVertexArray): (WebCore::WebGL2RenderingContext::bindVertexArray): (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::create): (WebCore::WebGLBuffer::WebGLBuffer): * html/canvas/WebGLBuffer.h: * html/canvas/WebGLCompressedTextureATC.cpp: (WebCore::WebGLCompressedTextureATC::WebGLCompressedTextureATC): (WebCore::WebGLCompressedTextureATC::supported): * html/canvas/WebGLCompressedTextureATC.h: * html/canvas/WebGLCompressedTexturePVRTC.cpp: (WebCore::WebGLCompressedTexturePVRTC::WebGLCompressedTexturePVRTC): (WebCore::WebGLCompressedTexturePVRTC::supported): * html/canvas/WebGLCompressedTexturePVRTC.h: * html/canvas/WebGLCompressedTextureS3TC.cpp: (WebCore::WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC): (WebCore::WebGLCompressedTextureS3TC::supported): * html/canvas/WebGLCompressedTextureS3TC.h: * html/canvas/WebGLContextObject.cpp: (WebCore::WebGLContextObject::WebGLContextObject): * html/canvas/WebGLContextObject.h: * html/canvas/WebGLDebugRendererInfo.cpp: (WebCore::WebGLDebugRendererInfo::WebGLDebugRendererInfo): * html/canvas/WebGLDebugRendererInfo.h: * html/canvas/WebGLDebugShaders.cpp: (WebCore::WebGLDebugShaders::WebGLDebugShaders): (WebCore::WebGLDebugShaders::getTranslatedShaderSource): * html/canvas/WebGLDebugShaders.h: * html/canvas/WebGLDepthTexture.cpp: (WebCore::WebGLDepthTexture::WebGLDepthTexture): (WebCore::WebGLDepthTexture::supported): * html/canvas/WebGLDepthTexture.h: * html/canvas/WebGLDrawBuffers.cpp: (WebCore::WebGLDrawBuffers::WebGLDrawBuffers): (WebCore::WebGLDrawBuffers::supported): (WebCore::WebGLDrawBuffers::drawBuffersWEBGL): (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements): * html/canvas/WebGLDrawBuffers.h: * html/canvas/WebGLExtension.cpp: (WebCore::WebGLExtension::WebGLExtension): * html/canvas/WebGLExtension.h: (WebCore::WebGLExtension::ref): (WebCore::WebGLExtension::deref): (WebCore::WebGLExtension::context): * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::create): (WebCore::WebGLFramebuffer::WebGLFramebuffer): (WebCore::WebGLFramebuffer::drawBuffersIfNecessary): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLLoseContext.cpp: (WebCore::WebGLLoseContext::WebGLLoseContext): (WebCore::WebGLLoseContext::loseContext): (WebCore::WebGLLoseContext::restoreContext): * html/canvas/WebGLLoseContext.h: * html/canvas/WebGLObject.cpp: (WebCore::WebGLObject::WebGLObject): * html/canvas/WebGLObject.h: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::create): (WebCore::WebGLProgram::WebGLProgram): * html/canvas/WebGLProgram.h: * html/canvas/WebGLQuery.cpp: (WebCore::WebGLQuery::create): (WebCore::WebGLQuery::WebGLQuery): * html/canvas/WebGLQuery.h: * html/canvas/WebGLRenderbuffer.cpp: (WebCore::WebGLRenderbuffer::create): (WebCore::WebGLRenderbuffer::WebGLRenderbuffer): * html/canvas/WebGLRenderbuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::initializeVertexArrayObjects): (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::setupFlags): (WebCore::WebGLRenderingContextBase::checkObjectToBeBound): (WebCore::WebGLRenderingContextBase::createBuffer): (WebCore::WebGLRenderingContextBase::createFramebuffer): (WebCore::WebGLRenderingContextBase::createTexture): (WebCore::WebGLRenderingContextBase::createProgram): (WebCore::WebGLRenderingContextBase::createRenderbuffer): (WebCore::WebGLRenderingContextBase::createShader): (WebCore::WebGLRenderingContextBase::deleteObject): (WebCore::WebGLRenderingContextBase::validateWebGLObject): (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer): (WebCore::WebGLRenderingContextBase::framebufferTexture2D): (WebCore::WebGLRenderingContextBase::getUniform): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::loseContextImpl): (WebCore::WebGLRenderingContextBase::maybeRestoreContext): (WebCore::WebGLRenderingContextBase::supportsDrawBuffers): * html/canvas/WebGLSampler.cpp: (WebCore::WebGLSampler::create): (WebCore::WebGLSampler::WebGLSampler): * html/canvas/WebGLSampler.h: * html/canvas/WebGLShader.cpp: (WebCore::WebGLShader::create): (WebCore::WebGLShader::WebGLShader): * html/canvas/WebGLShader.h: * html/canvas/WebGLSharedObject.cpp: (WebCore::WebGLSharedObject::WebGLSharedObject): * html/canvas/WebGLSharedObject.h: * html/canvas/WebGLSync.cpp: (WebCore::WebGLSync::create): (WebCore::WebGLSync::WebGLSync): * html/canvas/WebGLSync.h: * html/canvas/WebGLTexture.cpp: (WebCore::WebGLTexture::create): (WebCore::WebGLTexture::WebGLTexture): * html/canvas/WebGLTexture.h: * html/canvas/WebGLTransformFeedback.cpp: (WebCore::WebGLTransformFeedback::create): (WebCore::WebGLTransformFeedback::WebGLTransformFeedback): * html/canvas/WebGLTransformFeedback.h: * html/canvas/WebGLVertexArrayObject.cpp: (WebCore::WebGLVertexArrayObject::create): (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject): * html/canvas/WebGLVertexArrayObject.h: * html/canvas/WebGLVertexArrayObjectBase.cpp: (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase): * html/canvas/WebGLVertexArrayObjectBase.h: * html/canvas/WebGLVertexArrayObjectOES.cpp: (WebCore::WebGLVertexArrayObjectOES::create): (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES): (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl): * html/canvas/WebGLVertexArrayObjectOES.h: * platform/graphics/GraphicsContext3D.h: * platform/graphics/gpu/Texture.cpp: (WebCore::convertFormat): * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary): (WebCore::GraphicsContext3D::reshapeFBOs): (WebCore::GraphicsContext3D::getIntegerv): (WebCore::GraphicsContext3D::getExtensions): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::validateDepthStencil): (WebCore::GraphicsContext3D::drawArraysInstanced): (WebCore::GraphicsContext3D::drawElementsInstanced): (WebCore::GraphicsContext3D::vertexAttribDivisor): 2016-11-15 Joanmarie Diggs <jdiggs@igalia.com> AX: Need to update implicit/default values for aria-valuemin, aria-valuenow, and aria-valuemax https://bugs.webkit.org/show_bug.cgi?id=164773 Reviewed by Chris Fleizach. Return the values stated in the ARIA 1.1 spec, namely: - aria-valuemin is 0 for roles other than spinbutton - aria-valuemax is 100 for roles other than spinbutton - aria-valuenow is half way between aria-valuemax and aria-valuemin for roles other than spinbutton, and 0 for spinbutton For spinbutton, the spec states that "there is no minimum/maximum value." But at least in the case of ATK/AT-SPI2, the accessible value interface is expected to provide a number. Therefore, expose the values we use to constrain input type="number": -std::numeric_limits<float>::max() and std::numeric_limits<float>::max(). Test: accessibility/spinbutton-implicit-values.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::valueForRange): (WebCore::AccessibilityNodeObject::maxValueForRange): (WebCore::AccessibilityNodeObject::minValueForRange): 2016-11-14 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::exportKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164722 <rdar://problem/29251740> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::exportKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-exportKey. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-exportKey. 2. It implements exportKey operations of the following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It also fixes the following bugs: https://bugs.webkit.org/show_bug.cgi?id=156114, <rdar://problem/21773066>. Note: We currently only support Raw and Jwk key format. Tests: crypto/subtle/aes-cbc-generate-export-key-jwk-length-128.html crypto/subtle/aes-cbc-generate-export-key-jwk-length-192.html crypto/subtle/aes-cbc-generate-export-key-jwk-length-256.html crypto/subtle/aes-cbc-generate-export-key-raw.html crypto/subtle/aes-export-key-malformed-parameters.html crypto/subtle/aes-kw-generate-export-key-jwk-length-128.html crypto/subtle/aes-kw-generate-export-key-jwk-length-192.html crypto/subtle/aes-kw-generate-export-key-jwk-length-256.html crypto/subtle/aes-kw-generate-export-raw-key.html crypto/subtle/export-key-malformed-parameters.html crypto/subtle/hmac-export-key-malformed-parameters.html crypto/subtle/hmac-generate-export-key-jwk-sha1.html crypto/subtle/hmac-generate-export-key-jwk-sha224.html crypto/subtle/hmac-generate-export-key-jwk-sha256.html crypto/subtle/hmac-generate-export-key-jwk-sha384.html crypto/subtle/hmac-generate-export-key-jwk-sha512.html crypto/subtle/hmac-generate-export-raw-key.html crypto/subtle/hmac-import-key-malformed-parameters.html crypto/subtle/rsa-export-key-malformed-parameters.html crypto/subtle/rsa-oaep-generate-export-key-jwk-sha1.html crypto/subtle/rsa-oaep-generate-export-key-jwk-sha224.html crypto/subtle/rsa-oaep-generate-export-key-jwk-sha256.html crypto/subtle/rsa-oaep-generate-export-key-jwk-sha384.html crypto/subtle/rsa-oaep-generate-export-key-jwk-sha512.html crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-jwk.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha1.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha224.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha256.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha384.html crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha512.html crypto/workers/subtle/aes-generate-export-key-jwk.html crypto/workers/subtle/aes-generate-export-key-raw.html crypto/workers/subtle/hmac-generate-export-key-jwk.html crypto/workers/subtle/hmac-generate-export-key-raw.html crypto/workers/subtle/rsa-generate-export-key-jwk.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::toJSValueFromJsonWebKey): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::JSSubtleCrypto::exportKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::exportKey): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): (WebCore::CryptoAlgorithmAES_CBC::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::importKey): (WebCore::CryptoAlgorithmAES_KW::exportKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): (WebCore::CryptoAlgorithmHMAC::exportKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): (WebCore::CryptoAlgorithmRSA_OAEP::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::exportJwk): * crypto/keys/CryptoKeyAES.h: * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::exportJwk): * crypto/keys/CryptoKeyHMAC.h: * crypto/keys/CryptoKeyRSA.cpp: (WebCore::CryptoKeyRSA::exportJwk): * crypto/keys/CryptoKeyRSA.h: 2016-11-15 Jon Lee <jonlee@apple.com> Remove HasMediaCaptureDevice https://bugs.webkit.org/show_bug.cgi?id=164767 <rdar://problem/29263696> Reviewed by Eric Carlson. * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::mediaState): Remove HasMediaCaptureDevice in state. * page/MediaProducer.h: * testing/Internals.cpp: (WebCore::Internals::pageMediaState): Remove it in the media string. 2016-11-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix font-synthesis and text-decoration-skip parsing https://bugs.webkit.org/show_bug.cgi?id=164736 Reviewed by Dean Jackson. Fix the properties to not allow duplicate values, to reject when garbage values are included, to require that none be a singleton, and to preserve the declaration order of the properties. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertTextDecorationSkip): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseFontSynthesis): (WebCore::CSSParser::parseTextDecorationSkip): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontSynthesis): (WebCore::consumeTextDecorationSkip): (WebCore::CSSPropertyParser::parseSingleValue): 2016-11-15 Daniel Bates <dabates@apple.com> Disallow loads using HTTP 0.9 at the ResourceHandle/NetworkDataTask level https://bugs.webkit.org/show_bug.cgi?id=164662 <rdar://problem/29268514> Reviewed by Reviewed by Alex Christensen and Brady Eidson. Currently we disallow non-default HTTP 0.9 loads at the ResourceLoader level and disallow subresource loads using HTTP 0.9 on a default port when the embedding page loads using a different HTTP version. However loads can still be initiated from other loaders (e.g. FrameLoader) with regards to the first issue. The latter issue does not afford much protection and increases code complexity. Instead we should simplify our policy and move our code to the lowest networking abstraction level, ResourceHandle/NetworkDataTask, so that we disallow all non-default port loads using HTTP 0.9 regardless of the loader used. Tests: http/tests/security/http-0.9/image-default-port-allowed.html http/tests/security/http-0.9/xhr-blocked.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): Remove logic to cancel an HTTP 0.9 load from here. We will cancel the HTTP 0.9 load at the ResourceHandle/NetworkDataTask level. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): Ditto. * platform/URL.h: Export stringCenterEllipsizedToLength() so that we can use it in WebKit2. * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Modified to call ResourceHandle::didReceiveResponse(). (WebCore::BlobResourceHandle::notifyResponseOnError): Ditto. * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): Added. Fail the load if it is using HTTP 0.9. Otherwise notify the client that we received a response. (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): Added. Perform any additional platform-specific logic after notifying the resource handle client of the received response. Only the libsoup backend overwrites this member function to do something meaningful. * platform/network/ResourceHandle.h: * platform/network/ResourceResponseBase.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): Modified to call ResourceHandle::didReceiveResponse(). * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): Ditto. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::nextMultipartResponsePartCallback): Ditto. (WebCore::sendRequestCallback): Ditto. (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): Added. Turns around and calls continueAfterDidReceiveResponse(). 2016-11-15 Zalan Bujtas <zalan@apple.com> [MultiCol] Render tree should be all clean by the end of FrameView::layout(). https://bugs.webkit.org/show_bug.cgi?id=162833 Reviewed by Simon Fraser. This is a temporary workaround until after we addressed render tree mutation during layout (webkit.org/b/163849). Test: fast/inline/out-of-flow-quotation-text-with-multicolumn.html * page/FrameView.cpp: (WebCore::FrameView::layout): * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::RenderMultiColumnFlowThread::populate): (WebCore::RenderMultiColumnFlowThread::evacuateAndDestroy): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::attachQuote): Populating/evacuating the flow should not trigger quotation text changes. (WebCore::RenderQuote::detachQuote): * rendering/RenderView.h: (WebCore::RenderTreeInternalMutationScope::RenderTreeInternalMutationScope): (WebCore::RenderTreeInternalMutationScope::~RenderTreeInternalMutationScope): 2016-11-15 Eric Carlson <eric.carlson@apple.com> REGRESSION (r208606?): LayoutTest fast/mediastream/enumerating-crash.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=164715 Reviewed by Jon Lee. No new tests, fixes a crash in an existing test. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::document): Return nullptr when the script execution context has been cleared. * Modules/mediastream/UserMediaRequest.h: (WebCore::UserMediaRequest::document): Deleted. 2016-11-15 Alejandro G. Castro <alex@igalia.com> WebRTC: update MediaStream-MediaElement-srcObject.html test and unskip it https://bugs.webkit.org/show_bug.cgi?id=159343 Reviewed by Philippe Normand. Test updated. We can not initialize the srcObject attribute when creating the mediaplayer or we would be removing the srcObject we are going to use. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::createMediaPlayer): 2016-11-14 Alex Christensen <achristensen@webkit.org> Move SecurityOrigin::createFromDatabaseIdentifier to SecurityOriginData https://bugs.webkit.org/show_bug.cgi?id=164720 Reviewed by Brady Eidson. This is adding to r208558 where we moved databaseIdentifier to SecurityOriginData so we don't have to use SecurityOrigin in the DatabaseProcess. This is a step towards only using SecurityOrigin (and the SchemeRegistry) in the WebProcess. SecurityOriginData is for other processes and IPC. There should be no change in behaviour. * Modules/webdatabase/Database.cpp: (WebCore::Database::Database): (WebCore::Database::securityOrigin): * Modules/webdatabase/Database.h: * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::securityOrigin): * Modules/webdatabase/DatabaseContext.h: * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::tryToOpenDatabaseBackend): (WebCore::DatabaseManager::fullPathForDatabase): (WebCore::DatabaseManager::detailsForNameAndOrigin): * Modules/webdatabase/DatabaseManager.h: * Modules/webdatabase/DatabaseManagerClient.h: (WebCore::DatabaseManagerClient::dispatchDidAddNewOrigin): * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::hasAdequateQuotaForOrigin): (WebCore::DatabaseTracker::canEstablishDatabase): (WebCore::DatabaseTracker::retryCanEstablishDatabase): (WebCore::DatabaseTracker::hasEntryForOriginNoLock): (WebCore::DatabaseTracker::hasEntryForDatabase): (WebCore::DatabaseTracker::maximumSize): (WebCore::DatabaseTracker::originPath): (WebCore::DatabaseTracker::fullPathForDatabaseNoLock): (WebCore::DatabaseTracker::fullPathForDatabase): (WebCore::DatabaseTracker::origins): (WebCore::DatabaseTracker::databaseNamesNoLock): (WebCore::DatabaseTracker::databaseNames): (WebCore::DatabaseTracker::detailsForNameAndOrigin): (WebCore::DatabaseTracker::setDatabaseDetails): (WebCore::DatabaseTracker::addOpenDatabase): (WebCore::DatabaseTracker::removeOpenDatabase): (WebCore::DatabaseTracker::originLockFor): (WebCore::DatabaseTracker::deleteOriginLockFor): (WebCore::DatabaseTracker::usage): (WebCore::DatabaseTracker::quotaNoLock): (WebCore::DatabaseTracker::quota): (WebCore::DatabaseTracker::setQuota): (WebCore::DatabaseTracker::addDatabase): (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): (WebCore::DatabaseTracker::deleteOrigin): (WebCore::DatabaseTracker::isDeletingDatabaseOrOriginFor): (WebCore::DatabaseTracker::recordCreatingDatabase): (WebCore::DatabaseTracker::doneCreatingDatabase): (WebCore::DatabaseTracker::creatingDatabase): (WebCore::DatabaseTracker::canDeleteDatabase): (WebCore::DatabaseTracker::recordDeletingDatabase): (WebCore::DatabaseTracker::doneDeletingDatabase): (WebCore::DatabaseTracker::isDeletingDatabase): (WebCore::DatabaseTracker::canDeleteOrigin): (WebCore::DatabaseTracker::isDeletingOrigin): (WebCore::DatabaseTracker::recordDeletingOrigin): (WebCore::DatabaseTracker::doneDeletingOrigin): (WebCore::DatabaseTracker::deleteDatabase): (WebCore::DatabaseTracker::deleteDatabaseFile): (WebCore::DatabaseTracker::removeDeletedOpenedDatabases): (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged): * Modules/webdatabase/DatabaseTracker.h: * Modules/webdatabase/SQLTransactionCoordinator.cpp: (WebCore::getDatabaseIdentifier): * inspector/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::findStorageArea): * loader/EmptyClients.cpp: * page/DOMWindow.cpp: (WebCore::DOMWindow::sessionStorage): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier): Deleted. (WebCore::SecurityOrigin::createFromDatabaseIdentifier): Deleted. * page/SecurityOrigin.h: * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::fromDatabaseIdentifier): * page/SecurityOriginData.h: (WebCore::SecurityOriginData::SecurityOriginData): * storage/StorageArea.h: * storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents): (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents): (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames): (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames): * storage/StorageEventDispatcher.h: * storage/StorageNamespace.h: * storage/StorageNamespaceProvider.cpp: (WebCore::StorageNamespaceProvider::localStorageArea): 2016-11-14 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Worker debugging should pause all targets and view call frames in all targets https://bugs.webkit.org/show_bug.cgi?id=164305 <rdar://problem/29056192> Reviewed by Timothy Hatcher. Tests: inspector/debugger/continueUntilNextRunLoop inspector/worker/debugger-multiple-targets-pause * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::postMessageToPageInspector): Switch from postTask (callOnMainThread) to RunLoop::main().dispatch so that a paused Worker can send Inspector protocol messages responses back through the Main Page's InspectorWorkerAgent even if the Page itself is paused and MainThread callbacks are paused. * workers/WorkerRunLoop.h: (WebCore::WorkerRunLoop::isNested): * workers/WorkerRunLoop.cpp: (WebCore::WorkerRunLoop::runInMode): When running a nested WorkerRunLoop, running inspector debugger commands, we should not fire timers on the Worker. Timers would then be happening out of order and would not be debuggable. * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): * inspector/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): (WebCore::InspectorDOMDebuggerAgent::clear): (WebCore::InspectorDOMDebuggerAgent::didPause): Deleted. * inspector/InspectorDOMDebuggerAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::willHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didHandleEventImpl): Deleted. (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): Deleted. Remove unnecessary code where WebCore is trying to keep track of pause on next statement but that state is already more accurately provided by InspectorDebuggerAgent. 2016-11-14 Myles C. Maxfield <mmaxfield@apple.com> [WebGL2] Teach WebGLRenderingContextBase about new texture internal formats https://bugs.webkit.org/show_bug.cgi?id=164525 Reviewed by Dean Jackson. Test: fast/canvas/webgl/webgl2-texture-upload-enums.html This patch migrates the existing WebGL calls texImage2D(), texSubImage2D(), and readPixels() to understand the new WebGL 2 texture types. In WebGL1, the format and the internalFormat were required to be the same, and we had this assumption baked into many places in these functions. In WebGL 2, those two values are often different, which means I had to fix all of these assumptions in our code. Also, rather than have two completely separate parallel implementations of these functions, a more forward-looking approach is to have one implementation which has a few checks to isWebGL1() in strategic places. (This way, bugs only have to be fixed in a single place). Therefore, this patch deletes the WebGL 2 versions of these functions. * html/canvas/WebGL2RenderingContext.cpp: These functions are moved to WebGLRenderingContextBase. (WebCore::WebGL2RenderingContext::isIntegerFormat): (WebCore::WebGL2RenderingContext::copyTexImage2D): Deleted. (WebCore::WebGL2RenderingContext::texSubImage2DBase): Deleted. (WebCore::WebGL2RenderingContext::texSubImage2DImpl): Deleted. (WebCore::WebGL2RenderingContext::texSubImage2D): Deleted. (WebCore::WebGL2RenderingContext::validateTexFuncParameters): Deleted. (WebCore::WebGL2RenderingContext::validateTexFuncFormatAndType): Deleted. (WebCore::WebGL2RenderingContext::validateTexFuncData): Deleted. * html/canvas/WebGL2RenderingContext.h: Moved function implementations to WebGLRenderingContextBase. * html/canvas/WebGLRenderingContext.cpp: Ditto. (WebCore::WebGLRenderingContext::copyTexImage2D): Deleted. (WebCore::WebGLRenderingContext::texSubImage2DBase): Deleted. (WebCore::WebGLRenderingContext::texSubImage2DImpl): Deleted. (WebCore::WebGLRenderingContext::texSubImage2D): Deleted. (WebCore::WebGLRenderingContext::validateTexFuncParameters): Deleted. (WebCore::WebGLRenderingContext::validateTexFuncFormatAndType): Deleted. (WebCore::WebGLRenderingContext::validateTexFuncData): Deleted. * html/canvas/WebGLRenderingContext.h: Moved function implementations to WebGLRenderingContextBase. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateSettableTexInternalFormat): Teach about new depth texture formats. (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): Rename "internalformat" to "internalFormat". Teach about the distinction between format and internalFormat. When pre-filling textures with 0s to work around buggy drivers, we need a new way of knowing which format/type arguments to pass to texSubImage2D() which are compatible with the texture's internal format. The implementation of this function was added to GraphicsContext3D and is called here. (WebCore::WebGLRenderingContextBase::generateMipmap): Teach about the distinction between format and internalFormat. (WebCore::internalFormatTheme): This is used so readPixels() knows what kind of format/type arguments are compatible with the texture's internal format. (WebCore::numberOfComponentsForFormat): Ditto. (WebCore::numberOfComponentsForInternalFormat): Ditto. (WebCore::WebGLRenderingContextBase::readPixels): Many more format/type combinations are required in order to test the various new kinds of textures. (WebCore::WebGLRenderingContextBase::texImage2DBase): Rename internalformat to internalFormat, and teach about the distinction between format and internalFormat. (WebCore::WebGLRenderingContextBase::validateTexFunc): Ditto. (WebCore::WebGLRenderingContextBase::texImage2D): Ditto. (WebCore::WebGLRenderingContextBase::texSubImage2DImpl): Moved from WebGLRenderingContext. (WebCore::WebGLRenderingContextBase::texSubImage2D): Ditto. (WebCore::WebGLRenderingContextBase::validateArrayBufferType): Ditto. (WebCore::WebGLRenderingContextBase::validateTexFuncData): Ditto. (WebCore::WebGLRenderingContextBase::validateTexFuncParameters): Ditto. (WebCore::WebGLRenderingContextBase::validateTexFuncFormatAndType): Ditto. This is the main function where the new internalFormats are dealt with. The OpenGL ES spec lists a table of all the internalFormats and all their compatible format/type values. This table is entered into this function to check that the combinations are correct. (WebCore::WebGLRenderingContextBase::texSubImage2DBase): Moved from WebGLRenderingContext. (WebCore::WebGLRenderingContextBase::copyTexImage2D): Ditto. (WebCore::WebGLRenderingContextBase::validateSettableTexFormat): Deleted. * html/canvas/WebGLRenderingContextBase.h: No longer overrides virtual functions. * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::computeFormatAndTypeParameters): Because this is inside GraphicsContext3D, it doesn't need any isWebGL1() checks. Teach about new enums. (WebCore::GraphicsContext3D::possibleFormatAndTypeForInternalFormat): Ditto. (WebCore::GraphicsContext3D::packImageData): (WebCore::GraphicsContext3D::packPixels): It is possible to try to copy data from a video into one of these new formats. Currently, we implement this by swizzling on the CPU. Rather than implementing all the swizzling functions in this patch (which would make this patch much larger), simply bail in this case. We will implement this later. (WebCore::GraphicsContext3D::getClearBitsByFormat): Update. * platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::hasAlpha): Ditto. (WebCore::GraphicsContext3D::hasColor): Ditto. 2016-11-14 Simon Fraser <simon.fraser@apple.com> Scrolling when zoomed doesn't always use the correct layout viewport https://bugs.webkit.org/show_bug.cgi?id=164756 Reviewed by Dean Jackson. The scrolling thread was always using the layout viewport rect pushed onto it and never computing a new one, so when scrolling around after zooming position:fixed elements would not get the expected visual viewport behavior. Fix by having ScrollingTreeFrameScrollingNode updating its notion of the layout viewport on scrolls. Not testable because we can't dump the scrolling tree on Mac (yet). * page/scrolling/ScrollingTreeFrameScrollingNode.h: (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): 2016-11-14 Ryosuke Niwa <rniwa@webkit.org> document.createElementNS doesn't construct a custom element https://bugs.webkit.org/show_bug.cgi?id=164700 Reviewed by Darin Adler. Fixed the bug that document.createElementNS doesn't create a custom element or enqueue it to upgrade. Also made constructCustomElementSynchronously not call the custom element constructors with the element's local name as the first argument, which was a non-standard behavior added during prototyping. Test: fast/custom-elements/DOMImplementation-createDocument.html fast/custom-elements/document-createElementNS.html * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::constructElementWithFallback): Added a variant that takes QualifiedName instead of AtomicString. (WebCore::constructCustomElementSynchronously): Don't add the local name as an argument. * bindings/js/JSCustomElementInterface.h: * dom/CustomElementRegistry.cpp: (WebCore::CustomElementRegistry::findInterface): Just find the interface based on the local name after checking the namespace URI to be that of the XHTML. We need to ignore the prefix for the purpose of looking up the custom element definition as specified in the latest HTML specification: https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-element-definition * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): Added an assertion to make sure we don't invoke scripts while constructing the document element. * dom/Document.cpp: (WebCore::createUpgradeCandidateElement): Made this function create a HTMLUnknownElement instead of returning nullptr to share more code. Also added a variant which takes QualifiedName. (WebCore::isValidHTMLElementName): Added; helpers for createHTMLElementWithNameValidation to call isValidName on Document with the right argument. (WebCore::createHTMLElementWithNameValidation): Templatized the function to be called with either AtomicString or QualifiedName for the name. (WebCore::createFallbackHTMLElement): (WebCore::Document::createElementNS): Call createHTMLElementWithNameValidation to create a custom element if possible. This function ends up re-validating the element name before creating a HTMLUnknownElement but that shouldn't be a common scenario to matter. In fact, createElementNS is a rarely used API. 2016-11-14 Chris Dumez <cdumez@apple.com> Avoid copying attributes vector when constructing a CustomElement in HTMLTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=164734 Reviewed by Ryosuke Niwa. Avoid copying attributes vector when constructing a CustomElement in HTMLTreeBuilder. * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::insertCustomElement): * html/parser/HTMLConstructionSite.h: * html/parser/HTMLStackItem.h: (WebCore::HTMLStackItem::HTMLStackItem): (WebCore::HTMLStackItem::create): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): 2016-11-14 Chris Dumez <cdumez@apple.com> Inline QualifiedName::toString() method https://bugs.webkit.org/show_bug.cgi?id=164726 Reviewed by Ryosuke Niwa. Inline QualifiedName::toString() method to limit performance impact of r208674. * dom/QualifiedName.cpp: (WebCore::QualifiedName::toString): Deleted. * dom/QualifiedName.h: (WebCore::QualifiedName::toString): 2016-11-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the font-synthesis property https://bugs.webkit.org/show_bug.cgi?id=164728 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontSynthesis): (WebCore::CSSPropertyParser::parseSingleValue): 2016-11-12 Sam Weinig <sam@webkit.org> [SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix https://bugs.webkit.org/show_bug.cgi?id=164696 Reviewed by Darin Adler. - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix real classes and stop special casing them in the bindings generator. This removes the remaining non-list SVG specializations from the bindings generator. - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue and SVGRectValue classes, as float, FloatPoint and FloatRect can be used directly. Going forward, we can get rid of SVGMatrixValue as well, and just use AffineTransform, but that will be done in a separate change. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: Add new files. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Deleted. (WebCore::JSSVGLength::setValue): Deleted. (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted. Removed. This can now be generated completely. * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): Remove special casing of SVGNumber. A header for it now exists. (GetSVGWrappedTypeNeedingTearOff): Remove special casing SVGPropertyTearOffs. None remain. (ShouldPassWrapperByReference): Allow all tear off types to be passed by reference. (IsSVGTypeWithWritablePropertiesNeedingTearOff): Remove now unused function. * bindings/scripts/CodeGeneratorJS.pm: (GetImplClassName): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GetSVGPropertyTypes): (NativeToJSValue): (GenerateConstructorDefinition): Remove non-property tear off specific code. (IsNativeType): Remove unused function. * css/CSSPropertyNames.in: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::strokeDashArrayToCSSValueList): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSVGLengthValue): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::strokeDashArray): (WebCore::RenderStyle::setStrokeDashArray): (WebCore::RenderStyle::baselineShiftValue): (WebCore::RenderStyle::setBaselineShiftValue): (WebCore::RenderStyle::kerning): (WebCore::RenderStyle::setKerning): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialStrokeDashArray): (WebCore::SVGRenderStyle::initialBaselineShiftValue): (WebCore::SVGRenderStyle::initialKerning): (WebCore::SVGRenderStyle::setStrokeDashArray): (WebCore::SVGRenderStyle::setKerning): (WebCore::SVGRenderStyle::setBaselineShiftValue): (WebCore::SVGRenderStyle::strokeDashArray): (WebCore::SVGRenderStyle::kerning): (WebCore::SVGRenderStyle::baselineShiftValue): * rendering/style/SVGRenderStyleDefs.h: Update for name change of SVGLength to SVGLengthValue. * rendering/svg/RenderSVGImage.cpp: Remove unused include. * html/canvas/DOMPath.h: Add an overload that takes a DOMMatrix, now that it is distinct from AffineTransform. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform): Update for name change of SVGPoint to FloatPoint. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift): * rendering/svg/SVGTextLayoutEngineSpacing.cpp: (WebCore::SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing): Update for name change of SVGLength to SVGLengthValue. * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::startPositionOfCharacter): (WebCore::SVGTextQuery::endPositionOfCharacter): (WebCore::SVGTextQuery::characterNumberAtPosition): * rendering/svg/SVGTextQuery.h: Update for name change of SVGPoint to FloatPoint. * svg/LinearGradientAttributes.h: * svg/PatternAttributes.h: * svg/RadialGradientAttributes.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAllInOne.cpp: Remove SVGLength.cpp * svg/SVGAngle.h: Add missing newline. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::SVGAnimateTransformElement): (WebCore::SVGAnimateTransformElement::parseAttribute): * svg/SVGAnimateTransformElement.h: Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator): (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::parseLengthFromString): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedLengthAnimator::calculateDistance): * svg/SVGAnimatedLength.h: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::parseLengthListFromString): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): * svg/SVGAnimatedLengthList.h: Update for name change of SVGLength to SVGLengthValue. * svg/SVGAnimatedNumberList.h: Include the new SVGNumber.h and switch typedef to type alias. * svg/SVGAnimatedPointList.cpp: Add now necessary include of SVGPoint.h * svg/SVGAnimatedRect.h: Update for name change of SVGPropertyTearOff<FloatRect> to SVGRect. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createLength): (WebCore::SVGAnimatedType::setValueAsString): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::length): * svg/SVGCircleElement.cpp: (WebCore::SVGCircleElement::parseAttribute): * svg/SVGCursorElement.cpp: (WebCore::SVGCursorElement::parseAttribute): * svg/SVGDocument.cpp: (WebCore::SVGDocument::startPan): * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::parseAttribute): * svg/SVGFilterElement.cpp: (WebCore::SVGFilterElement::parseAttribute): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): * svg/SVGForeignObjectElement.cpp: (WebCore::SVGForeignObjectElement::parseAttribute): * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::parseAttribute): * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::resolveRectangle): (WebCore::SVGLengthContext::resolvePoint): (WebCore::SVGLengthContext::resolveLength): * svg/SVGLengthContext.h: * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): * svg/SVGLengthList.h: (WebCore::SVGPropertyTraits<SVGLengthList>::initialValue): * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::parseAttribute): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::parseAttribute): * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): * svg/SVGMaskElement.cpp: (WebCore::SVGMaskElement::parseAttribute): * svg/SVGPatternElement.cpp: (WebCore::SVGPatternElement::parseAttribute): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::parseAttribute): * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::parseAttribute): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::parseAttribute): Update for name change of SVGLength to SVGLengthValue. * svg/SVGLength.cpp: Removed. * svg/SVGLength.h: (WebCore::SVGLength::create): (WebCore::SVGLength::unitType): (WebCore::SVGLength::valueForBindings): (WebCore::SVGLength::setValueForBindings): (WebCore::SVGLength::valueInSpecifiedUnits): (WebCore::SVGLength::setValueInSpecifiedUnits): (WebCore::SVGLength::valueAsString): (WebCore::SVGLength::setValueAsString): (WebCore::SVGLength::newValueSpecifiedUnits): (WebCore::SVGLength::convertToSpecifiedUnits): (WebCore::SVGLength::SVGLength): Implement the SVGLength interface as a tear off. * svg/SVGLength.idl: Add annotations for exceptions, custom naming, and remove now unnecessary custom binding annotation. * svg/SVGLengthValue.cpp: Copied from Source/WebCore/svg/SVGLength.cpp. * svg/SVGLengthValue.h: Copied from Source/WebCore/svg/SVGLength.h. * svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::getCTMForBindings): (WebCore::SVGGraphicsElement::getScreenCTMForBindings): (WebCore::SVGGraphicsElement::getBBoxForBindings): * svg/SVGGraphicsElement.h: Add bindings specific versions of transformation access functions that return tear offs. * svg/SVGGraphicsElement.idl: Annotate tear off returning functions with NewObject and ImplementedAs as necessary. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGLocatable.h: Change getTransformToElement to return a Ref<SVGMatrix> as that is what the binding wants. * svg/SVGMatrix.h: Implement the SVGMatrix interface as a tear off. * svg/SVGMatrix.idl: Add annotations for exceptions. Remove meaningless Immutable annotation. * svg/SVGMatrixValue.h: Copied from Source/WebCore/svg/SVGMatrix.h. * svg/SVGNumber.h: Added. (WebCore::SVGNumber::create): (WebCore::SVGNumber::valueForBindings): (WebCore::SVGNumber::setValueForBindings): (WebCore::SVGNumber::SVGNumber): Implement the SVGNumber interface as a tear off. * svg/SVGNumber.idl: Add exception annotation and custom naming annotations. * svg/SVGNumberList.h: Update for name change of SVGPropertyTearOff<float> to SVGNumber. * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getPointAtLength): * svg/SVGPathElement.h: Make getPointAtLength return a Ref<SVGPoint> to match the bindings. * svg/SVGPathElement.idl: Annotate getPointAtLength with [NewObject]. * svg/SVGPathTraversalStateBuilder.cpp: (WebCore::SVGPathTraversalStateBuilder::currentPoint): * svg/SVGPathTraversalStateBuilder.h: * svg/SVGPathUtilities.cpp: (WebCore::getPointAtLengthOfSVGPathByteStream): * svg/SVGPathUtilities.h: * svg/SVGPointList.cpp: (WebCore::SVGPointList::valueAsString): * svg/SVGPointList.h: * svg/SVGPolyElement.cpp: Update for name change of SVGPoint to FloatPoint. * svg/SVGPoint.h: (WebCore::SVGPoint::create): (WebCore::SVGPoint::x): (WebCore::SVGPoint::setX): (WebCore::SVGPoint::y): (WebCore::SVGPoint::setY): (WebCore::SVGPoint::matrixTransform): (WebCore::SVGPoint::SVGPoint): Implement the SVGPoint interface as a tear off. Remove typedef of FloatPoint to SVGPoint. * svg/SVGPoint.idl: Add exception and NewObject annotations. * svg/SVGRect.h: (WebCore::SVGRect::create): (WebCore::SVGRect::x): (WebCore::SVGRect::setX): (WebCore::SVGRect::y): (WebCore::SVGRect::setY): (WebCore::SVGRect::width): (WebCore::SVGRect::setWidth): (WebCore::SVGRect::height): (WebCore::SVGRect::setHeight): Implement the SVGRect interface as a tear off. FloatRect SVGPropertyTraits have been moved to SVGRectTraits.h. * svg/SVGRect.idl: Add exception annotations. * svg/SVGRectTraits.h: Copied from Source/WebCore/svg/SVGRect.cpp. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::viewport): (WebCore::SVGSVGElement::currentTranslate): (WebCore::SVGSVGElement::parseAttribute): (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList): (WebCore::SVGSVGElement::getIntersectionList): (WebCore::SVGSVGElement::getEnclosureList): (WebCore::SVGSVGElement::checkIntersection): (WebCore::SVGSVGElement::checkEnclosure): (WebCore::SVGSVGElement::createSVGNumber): (WebCore::SVGSVGElement::createSVGLength): (WebCore::SVGSVGElement::createSVGPoint): (WebCore::SVGSVGElement::createSVGMatrix): (WebCore::SVGSVGElement::createSVGRect): (WebCore::SVGSVGElement::createSVGTransform): (WebCore::SVGSVGElement::createSVGTransformFromMatrix): * svg/SVGSVGElement.h: (WebCore::SVGSVGElement::currentTranslateValue): (WebCore::SVGSVGElement::currentTranslate): Deleted. (WebCore::SVGSVGElement::createSVGNumber): Deleted. Update functions taking tear off values to take the wrappers, and update the factory functions returning tear offs, to return the wrappers. * svg/SVGSVGElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::synchronizeTextLength): (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): (WebCore::SVGTextContentElement::textLengthAnimated): (WebCore::SVGTextContentElement::getStartPositionOfChar): (WebCore::SVGTextContentElement::getEndPositionOfChar): (WebCore::SVGTextContentElement::getExtentOfChar): (WebCore::SVGTextContentElement::getCharNumAtPosition): (WebCore::SVGTextContentElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGTextContentElement::specifiedTextLength): Update functions returning tear off values to return the wrappers and ones taking the values to take the wrappers. * svg/SVGTextContentElement.idl: Annotate functions/properties returning tear offs with [NewObject]. * svg/SVGTransform.cpp: (WebCore::SVGTransform::matrix): * svg/SVGTransform.h: (WebCore::SVGTransform::create): (WebCore::SVGTransform::type): (WebCore::SVGTransform::angle): (WebCore::SVGTransform::setMatrix): (WebCore::SVGTransform::setTranslate): (WebCore::SVGTransform::setScale): (WebCore::SVGTransform::setRotate): (WebCore::SVGTransform::setSkewX): (WebCore::SVGTransform::setSkewY): Implement the SVGTransform interface as a tear off. * svg/SVGTransform.idl: Add ConstantsScope annotation to allow the constants to be defined on SVGTransformValue. Add exception and NewObject annotations. * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform): (WebCore::SVGTransformDistance::distance): * svg/SVGTransformDistance.h: * svg/SVGTransformList.cpp: (WebCore::SVGTransformList::createSVGTransformFromMatrix): (WebCore::SVGTransformList::consolidate): * svg/SVGTransformList.h: (WebCore::SVGPropertyTraits<SVGTransformList>::initialValue): * svg/SVGTransformable.cpp: (WebCore::SVGTransformable::parseTransformValue): (WebCore::parseAndSkipType): (WebCore::SVGTransformable::parseTransformType): (WebCore::SVGTransformable::parseTransformAttribute): * svg/SVGTransformable.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::parseAttribute): Update for name change of SVGTransform to SVGTransformValue. * svg/SVGTransformList.idl: Annotate functions returning tear offs with NewObject. * svg/SVGTransformValue.cpp: Copied from Source/WebCore/svg/SVGTransform.cpp. * svg/SVGTransformValue.h: Copied from Source/WebCore/svg/SVGTransform.h. * svg/SVGZoomEvent.cpp: (WebCore::SVGZoomEvent::zoomRectScreen): (WebCore::SVGZoomEvent::previousTranslate): (WebCore::SVGZoomEvent::newTranslate): * svg/SVGZoomEvent.h: Update for change to SVGPoint/SVGRect. SVGPoint values become FloatPoints. Functions returning SVGPoint/SVGRect now return Ref<SVGPoint>/Ref<SVGRect>. * svg/SVGZoomEvent.idl: Annotate function returning tear off with NewObject. * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::findItem): Switch typedefs to type aliases. Define ListItemTearOff using SVGPropertyTraits to get the correct tear off type (as we do for the other list property tear off classes.) * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::clearValues): (WebCore::SVGListProperty::clearValuesAndWrappers): (WebCore::SVGListProperty::initializeValues): (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValues): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValues): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::canReplaceItem): (WebCore::SVGListProperty::replaceItemValues): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::canRemoveItem): (WebCore::SVGListProperty::removeItemValues): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValues): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::initialize): (WebCore::SVGListPropertyTearOff::getItem): (WebCore::SVGListPropertyTearOff::insertItemBefore): (WebCore::SVGListPropertyTearOff::replaceItem): (WebCore::SVGListPropertyTearOff::removeItem): (WebCore::SVGListPropertyTearOff::appendItem): * svg/properties/SVGPathSegListPropertyTearOff.h: * svg/properties/SVGStaticListPropertyTearOff.h: * svg/properties/SVGTransformListPropertyTearOff.h: Change functions returning PtrListItemTearOff, to instead return Ref<ListItemTearOff>. To accomplish this, remove unreachable conditions that were returning nullptr, and replace them with a assertions (these were cases where a function like canGetItem() was called, and it only did one of two things, returning an exception, or returned true). * svg/properties/SVGMatrixTearOff.h: Update for SVGMatrix's addition, this can now inherit from SVGMatrix. Remove incorrect comment and update some SVGMatrix types to SVGMatrixValues. * svg/properties/SVGStaticPropertyTearOff.h: Require the use of SVGStaticPropertyTearOff to pass in the tear off type, rather than the value type, so it can be directly inherited from. This allow the one user of this class, SVGSVGElement::currentTranslate, to specialize on SVGPoint directly. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results now that svg property tear offs are not handled specially. 2016-11-14 Youenn Fablet <youenn@apple.com> Move updateSignalingState to PeerConnectionBackend https://bugs.webkit.org/show_bug.cgi?id=164719 Reviewed by Eric Carlson. No change of behavior. Refactoring MediaEndpointPeerConnection signaling state update to PeerConnectionBackend. It is not specific to MediaEndpointPeerConnection and can be reused for other backends. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::updateSignalingState): * Modules/mediastream/PeerConnectionBackend.h: 2016-11-14 Dean Jackson <dino@apple.com> Handle filter() image type in new CSS Parser https://bugs.webkit.org/show_bug.cgi?id=164673 <rdar://problems/29231376> Reviewed by Darin Adler. Add support for the <image> type filter() to the new CSS Parser. This involved moving some functions from CSSPropertyParser into CSSPropertyParserHelpers. Covered by fast/filter-image tests. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeShadow): (WebCore::parseSingleShadow): Deleted. (WebCore::consumeFilterFunction): Deleted. (WebCore::consumeFilter): Deleted. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeFilterImage): (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage): (WebCore::CSSPropertyParserHelpers::isGeneratedImage): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilter): (WebCore::CSSPropertyParserHelpers::consumeSingleShadow): * css/parser/CSSPropertyParserHelpers.h: 2016-11-14 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support percentages in word-spacing https://bugs.webkit.org/show_bug.cgi?id=164721 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeLetterSpacing): (WebCore::consumeWordSpacing): (WebCore::consumeSpacing): Deleted. 2016-11-14 Joanmarie Diggs <jdiggs@igalia.com> AX: In ARIA 1.1, the implicit value for aria-level on headings is 2 https://bugs.webkit.org/show_bug.cgi?id=164714 Reviewed by Chris Fleizach. Return 2 rather than 0 if there is not a valid author-provided value for aria-level on an ARIA heading. No new tests required as we have sufficient coverage. Added one new test case to heading-level.html and updated expectations for it and for xml-roles-exposed.html. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::headingLevel): 2016-11-14 Youenn Fablet <youenn@apple.com> Refresh RTCDataChannel abstract infrastructure https://bugs.webkit.org/show_bug.cgi?id=164680 Reviewed by Darin Adler. No real changes, except that a mock data channel is now returned for layout test. Covered by activated and rebased test. Adding support for mock data channel. Updating data channel creation by using dictionary binding infrastructure. Storing of options directly in RTCDataChannel to reduce the use of the data channel handler. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::createDataChannelHandler): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::create): (WebCore::RTCDataChannel::RTCDataChannel): (WebCore::RTCDataChannel::bufferedAmount): (WebCore::RTCDataChannel::~RTCDataChannel): Deleted. (WebCore::RTCDataChannel::label): Deleted. (WebCore::RTCDataChannel::ordered): Deleted. (WebCore::RTCDataChannel::maxRetransmitTime): Deleted. (WebCore::RTCDataChannel::maxRetransmits): Deleted. (WebCore::RTCDataChannel::protocol): Deleted. (WebCore::RTCDataChannel::negotiated): Deleted. (WebCore::RTCDataChannel::id): Deleted. * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::~RTCDataChannelEvent): Deleted. * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::createDataChannel): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * platform/mediastream/MediaEndpoint.cpp: (WebCore::EmptyMediaEndpoint::EmptyMediaEndpoint): Deleted. * platform/mediastream/MediaEndpoint.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCPeerConnectionHandler.h: (WebCore::RTCDataChannelInit::RTCDataChannelInit): Deleted. * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::createDataChannelHandler): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::createDataChannelHandler): * platform/mock/MockMediaEndpoint.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::RTCDataChannelHandlerMock): * platform/mock/RTCDataChannelHandlerMock.h: 2016-11-14 David Kilzer <ddkilzer@apple.com> Bug 164702: WebContent crash due to checked unsigned overflow in WebCore: WebCore::RenderLayerCompositor::requiresCompositingLayer const + 1104 <https://webkit.org/b/164702> <rdar://problem/29236368> Reviewed by Darin Adler. Test: inspector/layers/layers-compositing-reasons.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForCanvas): Don't composite if the canvas area overflows. 2016-11-14 Chris Dumez <cdumez@apple.com> Fix the !ENABLE(FETCH_API) build after r208613 https://bugs.webkit.org/show_bug.cgi?id=164713 Reviewed by Youenn Fablet. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): 2016-11-13 Darin Adler <darin@apple.com> Remove many includes of ExceptionCode.h https://bugs.webkit.org/show_bug.cgi?id=164706 Reviewed by Alex Christensen. * Modules/encryptedmedia/CDMPrivateClearKey.cpp: Removed include of ExceptionCode.h. * Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp: Ditto. * Modules/fetch/FetchBodyOwner.cpp: Ditto. * Modules/indexeddb/IDBDatabase.cpp: Added include of ExceptionCode.h. * Modules/indexeddb/IDBDatabase.h: Removed include of ExceptionCode.h. * Modules/indexeddb/IDBDatabaseException.cpp: Ditto. * Modules/indexeddb/IDBIndex.cpp: Added include of ExceptionCode.h. * Modules/indexeddb/IDBObjectStore.cpp: Ditto. * Modules/mediastream/MediaConstraintsImpl.cpp: Removed include of ExceptionCode.h. * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: Ditto. * Modules/mediastream/MediaDevicesRequest.cpp: Ditto. * Modules/mediastream/MediaStream.cpp: Ditto. * Modules/mediastream/MediaStreamTrack.cpp: Ditto. * Modules/mediastream/RTCDTMFSender.cpp: Ditto. * Modules/mediastream/RTCDataChannel.cpp: Ditto. * Modules/mediastream/RTCPeerConnection.cpp: Ditto. * Modules/notifications/Notification.h: Removed definition of ExceptionCode. * Modules/streams/ReadableStreamSource.h: Ditto. * Modules/webaudio/BiquadFilterNode.cpp: Ditto. * Modules/webaudio/PannerNode.cpp: Removed inclde of ExceptionCode.h. * Modules/webaudio/WaveShaperNode.cpp: Ditto. * Modules/webdatabase/Database.cpp: (WebCore::guidForOriginAndName): Reimplemented using HashMap::ensure. * Modules/webdatabase/Database.h: Renamed DatabaseGuid to DatabaseGUID and defined it here instead of a in DatabaseBasicTypes.h; removed that include. * Modules/webdatabase/DatabaseBasicTypes.h: Removed. * Modules/webdatabase/DatabaseManager.h: Removed include of DatabaseBasicTypes.h. * Modules/webdatabase/DatabaseTask.h: Ditto. * Modules/webdatabase/SQLTransactionBackend.cpp: Removed include of ExceptionCode.h. * Modules/webdatabase/SQLTransactionBackend.h: Removed include of DatabaseBasicTypes.h. * WebCore.xcodeproj/project.pbxproj: Removed DatabaseBasicTypes.h, also let Xcode edit the file. * bindings/js/ScriptModuleLoader.cpp: Removed include of ExceptionCode.h. * bindings/js/SerializedScriptValue.cpp: Ditto. * bindings/js/StructuredClone.cpp: Ditto. * bindings/scripts/CodeGeneratorJS.pm: (GenerateParametersCheck): Removed unnecessary include of ExceptionCode.h. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Updated. * css/CSSMediaRule.cpp: Removed include of ExceptionCode.h. * css/CSSSupportsRule.cpp: Ditto. * dom/ClientRectList.cpp: Ditto. * dom/DOMCoreException.cpp: Added include of ExceptionCode.h. * dom/DOMImplementation.cpp: Removed include of ExceptionCode.h. * dom/ExceptionBase.h: Ditto. * dom/Node.cpp: Added include of ExceptionCode.h. * dom/NodeIterator.cpp: Removed include of ExceptionCode.h. (WebCore::NodeIterator::NodePointer::NodePointer): Marked this inline. (WebCore::NodeIterator::NodePointer::clear): Ditto. (WebCore::NodeIterator::NodePointer::moveToNext): Ditto. (WebCore::NodeIterator::NodePointer::moveToPrevious): Ditto. (WebCore::NodeIterator::NodeIterator): Ditto. (WebCore::NodeIterator::create): Moved this here from the header. Now the constructor is inlined instead of this function. (WebCore::NodeIterator::detach): Deleted. Moved to header. * dom/NodeIterator.h: Removed definition of ExceptionCode, fixed indentation of this file and made a few changes as mentioned above. * dom/ProcessingInstruction.cpp: Removed include of ExceptionCode.h. * dom/Text.cpp: Added include of ExceptionCode.h. * dom/TreeWalker.cpp: Removed include of ExceptionCode.h. * editing/FrameSelection.cpp: Ditto. * fileapi/WebKitBlobBuilder.cpp: Ditto. * history/CachedFrame.cpp: Ditto. * html/HTMLDocument.cpp: Ditto. * html/HTMLMeterElement.cpp: Ditto. * html/HTMLObjectElement.cpp: Ditto. * html/HTMLOptionElement.cpp: Ditto. * html/HTMLOptionsCollection.cpp: Removed include of ExceptionCode.h. (WebCore::HTMLOptionsCollection::add): Changed argument to const& to avoid a little bit of reference count churn. * html/HTMLOptionsCollection.h: Updated for above. * html/HTMLProgressElement.cpp: Removed include of ExceptionCode.h. * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::add): Changed argument to const& to avoid a little bit of reference count churn. * html/HTMLSelectElement.h: Updated for above. * html/HTMLTextAreaElement.cpp: Removed include of ExceptionCode.h. * html/canvas/CanvasPattern.cpp: Ditto. * html/canvas/WebGLContextGroup.h: Removed definition of ExceptionCode. * html/track/AudioTrack.h: Removed include of ExceptionCode.h. * html/track/TextTrack.h: Ditto. * html/track/VTTCue.cpp: Added include of ExceptionCode.h. * html/track/VTTRegion.cpp: Ditto. * html/track/VideoTrack.h: Removed include of ExceptionCode.h. * inspector/DOMEditor.cpp: Ditto. * inspector/InspectorDatabaseAgent.cpp: Removed include of ExceptionCode.h. Tweaked the code in the file a bit, marking more things final and making them private. ALso simplified a couple of the functions a bit. (WebCore::InspectorDatabaseAgent::didOpenDatabase): (WebCore::InspectorDatabaseAgent::getDatabaseTableNames): (WebCore::InspectorDatabaseAgent::executeSQL): (WebCore::InspectorDatabaseAgent::databaseForId): * inspector/InspectorIndexedDBAgent.cpp: Removed include of ExceptionCode.h. * inspector/InspectorStyleSheet.cpp: Added include of ExceptionCode.h. * page/FocusController.cpp: Removed include of ExceptionCode.h. * page/Location.h: Removed definition of ExceptionCode. * page/Page.cpp: Removed include of ExceptionCode.h. * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: Ditto. * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: Ditto. * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: Ditto. * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: Ditto. * storage/StorageArea.h: Removed definition of ExceptionCode. * svg/SVGCircleElement.cpp: Removed include of ExceptionCode.h. * svg/SVGColor.cpp: Added include of ExceptionCode.h. * svg/SVGPaint.cpp: Ditto. * svg/SVGStyleElement.cpp: Removed include of ExceptionCode.h. * svg/properties/SVGListProperty.h: Added include of ExceptionCode.h. * workers/Worker.cpp: Removed include of ExceptionCode.h. * workers/WorkerMessagingProxy.cpp: Ditto. * xml/XMLSerializer.cpp: Removed unneeded includes. (WebCore::XMLSerializer::serializeToString): Use nullptr. * xml/XMLSerializer.h: Removed definition of ExceptionCode, fixed indentation of this file, and made a couple tweaks. 2016-11-14 Youenn Fablet <youenn@apple.com> MediaStreamPrivate::create should take vectors of Ref https://bugs.webkit.org/show_bug.cgi?id=164670 Reviewed by Sam Weinig. No change of behavior. * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::create): * platform/mediastream/MediaStreamPrivate.h: * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: (WebCore::RealtimeMediaSourceCenterMac::createMediaStream): * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): 2016-11-14 Joanmarie Diggs <jdiggs@igalia.com> AX: [ATK] Expose STATE_SINGLE_LINE and STATE_MULTI_LINE for ARIA searchbox role https://bugs.webkit.org/show_bug.cgi?id=164712 Reviewed by Chris Fleizach. Include SearchFieldRole when adding STATE_SINGLE_LINE and STATE_MULTI_LINE to AtkStateSet. Test: accessibility/gtk/singleline-and-multiline.html * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (setAtkStateSetFromCoreObject): 2016-11-14 Youenn Fablet <youennf@gmail.com> RTCRtpTransceiver should have Ref of sender and receiver https://bugs.webkit.org/show_bug.cgi?id=164665 Reviewed by Darin Adler. No change of behavior. Making RTCRptTransceiver have Ref<RTCRtpSender> and Ref<RTCRtpReceiver>. Transforming transceiver set list of senders and receivers as vectors of references to reduce count churning. Also making RTCRptTransceiver have a Ref<RTCIceTransport> instead of a RefPtr. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::createOfferTask): (WebCore::MediaEndpointPeerConnection::createAnswerTask): (WebCore::createSourceMap): (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): (WebCore::MediaEndpointPeerConnection::createReceiver): (WebCore::MediaEndpointPeerConnection::replaceTrack): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::addTrack): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::close): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCRtpTransceiver.cpp: (WebCore::RTCRtpTransceiver::RTCRtpTransceiver): * Modules/mediastream/RTCRtpTransceiver.h: (WebCore::RTCRtpTransceiver::create): (WebCore::RTCRtpTransceiver::sender): (WebCore::RTCRtpTransceiver::receiver): (WebCore::RTCRtpTransceiver::iceTransport): (WebCore::RtpTransceiverSet::senders): (WebCore::RtpTransceiverSet::receivers): 2016-11-14 Csaba Osztrogonác <ossy@webkit.org> Fix various --minimal build issue https://bugs.webkit.org/show_bug.cgi?id=164479 Reviewed by Darin Adler. * dom/Node.cpp: * platform/audio/PlatformMediaSessionManager.cpp: * testing/Internals.cpp: (WebCore::Internals::captionsStyleSheetOverride): 2016-11-14 Csaba Osztrogonác <ossy@webkit.org> Fix the !ENABLE(VIDEO_TRACK) build https://bugs.webkit.org/show_bug.cgi?id=164476 Reviewed by Darin Adler. * css/RuleSet.cpp: (WebCore::RuleSet::addRule): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching): * css/parser/CSSSelectorParser.cpp: (WebCore::isPseudoElementFunction): (WebCore::CSSSelectorParser::consumePseudo): 2016-11-14 Miguel Gomez <magomez@igalia.com> [GTK] Do not use gstreamer-gl when accelerated compositing is disabled https://bugs.webkit.org/show_bug.cgi?id=164481 Reviewed by Žan Doberšek. Check whether accelerated compositing is enabled before creating the gstreamer-gl video sink. No new tests (Covered by existing tests). * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): 2016-11-14 Csaba Osztrogonác <ossy@webkit.org> Fix the !ENABLE(CSS_BOX_DECORATION_BREAK) build https://bugs.webkit.org/show_bug.cgi?id=164478 Reviewed by Darin Adler. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-11-14 Csaba Osztrogonác <ossy@webkit.org> Fix the !ENABLE(CSS_GRID_LAYOUT) build https://bugs.webkit.org/show_bug.cgi?id=164477 Reviewed by Darin Adler. * css/parser/CSSParserFastPaths.cpp: (WebCore::isSimpleLengthPropertyID): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseShorthand): 2016-11-14 Csaba Osztrogonác <ossy@webkit.org> [EFL] Suppress build warning in generated Geoclue2Interface.c https://bugs.webkit.org/show_bug.cgi?id=164475 Reviewed by Darin Adler. * PlatformEfl.cmake: 2016-11-10 Philippe Normand <pnormand@igalia.com> [GStreamer][OWR] poor video rendering in apprtc https://bugs.webkit.org/show_bug.cgi?id=164585 Reviewed by Xabier Rodriguez-Calvar. The apprtc service uses 3 video elements in total, one for local, one for remote and one called preview. During a call only remote and preview are displayed, preview being linked to the same mediastream as local. The consequence is that 2 OWR video renderers of the same source are created. When gst-gl is enabled this isn't a problem but when it is disabled a performance issue appears and the webkit video sink starts dropping frames. The solution is to have the video renderer shared between the 2 media players in this scenario. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: (WebCore::MediaPlayerPrivateGStreamerBase::videoSink): Add video sink getter. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::load): Make sure the m_streamPrivate is set before creating the video sink. (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink): Re-use video renderer and sink if they have previously been created for another media player. * platform/mediastream/MediaStreamPrivate.h: Store GStreamer sink and renderer so they can be potentially used by multiple media players. (WebCore::MediaStreamPrivate::setVideoRenderer): (WebCore::MediaStreamPrivate::getVideoSinkElement): (WebCore::MediaStreamPrivate::getVideoRenderer): 2016-11-13 Fujii Hironori <Hironori.Fujii@sony.com> [HarfBuzz] HarfBuzzShaper should not assume numGlyphs is greater than 0 https://bugs.webkit.org/show_bug.cgi?id=164500 Reviewed by Myles C. Maxfield. Test: fast/text/international/harfbuzz-runs-with-no-glyph.html HarfBuzzShaper assumes numGlyphs of HarfBuzzRun is greater than zero. But this is not necessarily true. If a font does not have a glyph of SPACE (U+0020), HarfBuzz removes ignorable glyphs. In this case, HarfBuzzRun can have no glyphs. * platform/graphics/harfbuzz/HarfBuzzShaper.cpp: (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Resize m_offsets to one if m_numGlyphs is zero. * platform/graphics/harfbuzz/HarfBuzzShaper.h: (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Use Vector::data() instread of operator[0]. (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto. (WebCore::HarfBuzzShaper::HarfBuzzRun::offsets): Ditto. (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphToCharacterIndexes): Ditto. 2016-11-13 Chris Dumez <cdumez@apple.com> REGRESSION (204441): newsplex.com map does not load https://bugs.webkit.org/show_bug.cgi?id=164705 <rdar://problem/28753438> Reviewed by Darin Adler. Update getElementsByTagName(qualifiedName) implementation to match more closely the specification at: - https://dom.spec.whatwg.org/#dom-document-getelementsbytagname - https://dom.spec.whatwg.org/#concept-getelementsbytagname - https://dom.spec.whatwg.org/#concept-element-qualified-name In particular, we no longer split the input qualifiedName into a prefix and a localName in order to compare those to element.prefix() / element.localName(). Instead, we keep the input qualifiedName as is and compare it to the element's qualifiedName. This matters for HTML elements inside an HTML document that have a semicolon in their localname (e.g. 'wx:map'). For this example, the element's localName and its qualified name are both 'wx:map'. Calling getElementsByTagName('wx:map') should return it. However, if you split the input qualifiedName into a prefix and a localName, you end up checking: 'wx' == null && 'map' == 'wx:map' which does not match. Test: fast/dom/getElementsByTagName-HTMLElement-prefix.html * dom/TagCollection.cpp: (WebCore::TagCollection::TagCollection): (WebCore::TagCollection::~TagCollection): (WebCore::HTMLTagCollection::HTMLTagCollection): (WebCore::HTMLTagCollection::~HTMLTagCollection): (WebCore::makeQualifiedName): Deleted. (WebCore::splitQualifiedName): Deleted. * dom/TagCollection.h: (WebCore::TagCollection::elementMatches): (WebCore::HTMLTagCollection::elementMatches): 2016-11-13 Darin Adler <darin@apple.com> Remove ExceptionCodePlaceholder https://bugs.webkit.org/show_bug.cgi?id=164703 Reviewed by Sam Weinig. * CMakeLists.txt: Removed ExceptionCodePlaceholder.cpp. * WebCore.xcodeproj/project.pbxproj: Removed ExceptionCodePlaceholder.h/cpp. Also let Xcode make a change to the file, I think removing an unreferenced dead entry for a file that is already listed under a different ID. * dom/DOMAllInOne.cpp: Removed ExceptionCodePlaceholder.cpp. * dom/ExceptionCodePlaceholder.cpp: Removed. * dom/ExceptionCodePlaceholder.h: Removed. * inspector/InspectorDatabaseAgent.cpp: Removed include of ExceptionCodePlaceholder.h. 2016-11-13 Darin Adler <darin@apple.com> Fix exception handling in SQL database code, streamline and update code https://bugs.webkit.org/show_bug.cgi?id=164685 Reviewed by Sam Weinig. Removed some old abstraction layers that were no longer in use. For example, i n many cases, calls were going through DatabaseManager, which called through an abstract class AbstractDatabaseServer to a concrete class DatabaseServer, which then called through to DatabaseTracker. Clients now mostly just call DatabaseTracker directly. * CMakeLists.txt: Removed DatabaseServer.cpp and SQLTransactionClient.cpp. * Modules/webdatabase/AbstractDatabaseServer.h: Removed. * Modules/webdatabase/DOMWindowWebDatabase.cpp: (WebCore::DOMWindowWebDatabase::openDatabase): Use ExceptionOr instead of DatabaseError to communicate DOM exceptions from DatabaseManager. * Modules/webdatabase/Database.cpp: (WebCore::Database::Database): Use a reference instead of a RefPtr&& for database context. Use unsigned instead of unsigned long. Modernize code to use more initialization rather than assignment, to initialize scalar data members in the class definition, and to use HashMap::ensure. (WebCore::Database::databaseThread): Added. This class asserts that there is a thread in the constructor, and so it is useful to have a helper for all the other functions that assumes the thread is present and returns a reference rather than a pointer. (WebCore::Database::~Database): Updated since m_scriptExecutionContext is now a Ref instead of a RefPtr. (WebCore::Database::openAndVerifyVersion): Use ExceptionOr and databaseThread. (WebCore::Database::close): Use databaseThread. (WebCore::Database::performClose): Ditto. (WebCore::DoneCreatingDatabaseOnExitCaller::DoneCreatingDatabaseOnExitCaller): Use a reference. Removed unused m_openSuccceeded. (WebCore::DoneCreatingDatabaseOnExitCaller::~DoneCreatingDatabaseOnExitCaller): Use DatabaseTracker::singleton by its new name. (WebCore::DoneCreatingDatabaseOnExitCaller::setOpenSucceeded): Deleted. (WebCore::Database::performOpenAndVerify): Use ExceptionOr and update for above. (WebCore::Database::closeDatabase): Updated for name change. (WebCore::Database::scheduleTransaction): Updated for above, simplified and streamlined. (WebCore::Database::scheduleTransactionStep): Use databaseThread. (WebCore::Database::transactionClient): Deleted. This object is no longer needed. (WebCore::Database::transactionCoordinator): Use databaseThread. (WebCore::Database::markAsDeletedAndClose): Removed unnecessary null check for databaseThread, which can never be null. (WebCore::Database::estimatedSize): Use unsigned, not unsigned long. (WebCore::Database::disableAuthorizer): Removed assertion about RefPtr that is now a Ref and never could have been null. (WebCore::Database::enableAuthorizer): Ditto. (WebCore::Database::setAuthorizerPermissions): Ditto. (WebCore::Database::lastActionChangedDatabase): Ditto. (WebCore::Database::lastActionWasInsert): Ditto. (WebCore::Database::resetDeletes): Ditto. (WebCore::Database::hadDeletes): Ditto. (WebCore::Database::resetAuthorizer): Removed null check for a RefPtr that is now a Ref and never could have been null. (WebCore::Database::runTransaction): Simplified a bit. (WebCore::Database::tableNames): Use databaseThread. (WebCore::Database::securityOrigin): Changed to return a reference instead of a pointer because all the callers need it to do that. If called on the wrong thread, this will now do a RELEASE_ASSERT_NOT_REACHED. In the old code it would return a null pointer and then the caller would dereference it a moment later, so it would still be a crash. (WebCore::Database::maximumSize): Removed const since it's not really needed and the DatabaseTracker wants a non-const reference to this database. (WebCore::Database::didCommitWriteTransaction): Added. Moved this code here from SQLTransactionClient. There is no abstraction layer, so no reason to not have this code, quite comparable to the rest of the code in the class, here. I am assuming this served some more useful purpose back when we had a different back end for Chromium? (WebCore::Database::didExceedQuota): Ditto. * Modules/webdatabase/Database.h: Updated for above changes. Made some functions return references instead of pointers. Use Ref instead of RefPtr for some things that can never be null. * Modules/webdatabase/Database.idl: Added ImplementationLacksVTable because the Database class is not polymorphic. * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::DatabaseContext): Take a reference instead of a pointer. Moved data member initialization into class definition. Remove code that tries to do debug accounting and databasecontext registration and instead just make sure to keep the ScriptExecutionContext pointing at the DatabaseContext. (WebCore::DatabaseContext::~DatabaseContext): Ditto. (WebCore::DatabaseContext::stopDatabases): Ditto. * Modules/webdatabase/DatabaseContext.h: Updated for the above. Also used the scriptExecutionContext function inherited from the base class intead of adding our own, and added a existingDatabaseThread() function, letting us get at the database thread efficiently without creating a new one. * Modules/webdatabase/DatabaseError.h: Removed. We now use DOM exceptions directly instead of our own error enumeration that has to be translated to a DOM exception. * Modules/webdatabase/DatabaseManager.cpp: Moved the ProposedDatabase class here from the header file, and had it use references instead of pointers. (WebCore::DatabaseManager::DatabaseManager): Deleted. There was nothing left to initialize once the refactoring was done. (WebCore::DatabaseManager::initialize): Call DatabaseTracker directly instead of calling through m_server. (WebCore::DatabaseManager::setClient): Ditto. (WebCore::DatabaseManager::databaseDirectoryPath): Deleted. Callers will use the function in DatabaseTracker directly. (WebCore::DatabaseManager::setDatabaseDirectoryPath): Ditto. (WebCore::DatabaseManager::existingDatabaseContextFor): Deleted. Callers will use the ScriptExecutionContext::databaseContext function instead. (WebCore::DatabaseManager::databaseContext): Renamed from databaseContextFor. (WebCore::DatabaseManager::registerDatabaseContext): Deleted. (WebCore::DatabaseManager::unregisterDatabaseContext): Deleted. (WebCore::DatabaseManager::didConstructDatabaseContext): Deleted. (WebCore::DatabaseManager::didDestructDatabaseContext): Deleted. (WebCore::DatabaseManager::exceptionCodeForDatabaseError): Deleted. (WebCore::logOpenDatabaseError): Tweaked conditionals a bit. (WebCore::DatabaseManager::openDatabaseBackend): Use ExceptionOr. Changed to call tryToOpenDatabaseBackend function here in this class rather than using m_server. (WebCore::DatabaseManager::tryToOpenDatabaseBackend): Added. Moved here from the DatabaseServer class. (WebCore::DatabaseManager::addProposedDatabase): Take a reference. (WebCore::DatabaseManager::removeProposedDatabase): Ditto. (WebCore::DatabaseManager::openDatabase): Use ExceptionOr. (WebCore::DatabaseManager::hasOpenDatabases): Use ScriptContext::databaseContext directly instead of using helper functions in this class. (WebCore::DatabaseManager::stopDatabases): Ditto. (WebCore::DatabaseManager::fullPathForDatabase): Take a reference and also call DatabaseTracker directly instead of calling through m_server. (WebCore::DatabaseManager::hasEntryForOrigin): Deleted. Callers will use the function in DatabaseTracker directly. (WebCore::DatabaseManager::origins): Ditto. (WebCore::DatabaseManager::databaseNamesForOrigin): Ditto. (WebCore::DatabaseManager::detailsForNameAndOrigin): Call DatabaseTracker directly instead of calling through m_server. (WebCore::DatabaseManager::usageForOrigin): Deleted. Callers will use the function in DatabaseTracker directly. (WebCore::DatabaseManager::quotaForOrigin): Ditto. (WebCore::DatabaseManager::setQuota): Ditto. (WebCore::DatabaseManager::deleteAllDatabasesImmediately): Ditto. (WebCore::DatabaseManager::deleteOrigin): Ditto. (WebCore::DatabaseManager::deleteDatabase): Ditto. (WebCore::DatabaseManager::closeAllDatabases): Ditto. (WebCore::DatabaseManager::logErrorMessage): Take a reference. * Modules/webdatabase/DatabaseManager.h: Updated for changes above. * Modules/webdatabase/DatabaseManagerClient.h: Use references for security origins. Also changed #if for iOS so that other platforms can call the iOS-specific functions and they have inline empty bodies; lets us clean up call sites to not need conditionals. * Modules/webdatabase/DatabaseServer.cpp: Removed. * Modules/webdatabase/DatabaseServer.h: Removed. * Modules/webdatabase/DatabaseTask.cpp: (WebCore::isolatedCopy): Added. Helper functions for making isolated copies of exceptions, which can contain strings. (WebCore::DatabaseOpenTask::DatabaseOpenTask): Use ExceptionOr<void> instead of a DatabaseError, a String, and a success boolean. (WebCore::DatabaseOpenTask::doPerformTask): Updated to use ExceptoinOr. (WebCore::DatabaseTableNamesTask::DatabaseTableNamesTask): Renamed. (WebCore::DatabaseTableNamesTask::doPerformTask): Added a comment. * Modules/webdatabase/DatabaseTask.h: Updated for above changes. * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::DatabaseThread): Initialized data members in the class definition. Removed m_transactionClient. (WebCore::DatabaseThread::recordDatabaseOpen): Take a reference. (WebCore::DatabaseThread::recordDatabaseClosed): Ditto. (WebCore::DatabaseThread::scheduleTask): Use an rvalue reference. (WebCore::DatabaseThread::scheduleImmediateTask): Ditto. (WebCore::DatabaseThread::unscheduleDatabaseTasks): Use a lambda instead of a class for the same-database predicate. * Modules/webdatabase/DatabaseThread.h: Updated for above. * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::isolatedCopy): Added. Helper for making an isolated copy of a vector of strings. (WebCore::DatabaseTracker::singleton): Renamed from tracker. (WebCore::DatabaseTracker::DatabaseTracker): Moved the code from setDatabaseDirectoryPath in here. (WebCore::DatabaseTracker::setDatabaseDirectoryPath): Deleted. (WebCore::DatabaseTracker::databaseDirectoryPath): Deleted. (WebCore::DatabaseTracker::hasAdequateQuotaForOrigin): Use ExceptionOr. (WebCore::DatabaseTracker::canEstablishDatabase): Ditto. (WebCore::DatabaseTracker::retryCanEstablishDatabase): Ditto. (WebCore::DatabaseTracker::hasEntryForOriginNoLock): Take a reference. (WebCore::DatabaseTracker::hasEntryForOrigin): Deleted. (WebCore::DatabaseTracker::hasEntryForDatabase): Take a reference. (WebCore::DatabaseTracker::maximumSize): Renamed from getMaxSizeForDatabase and changed to take a reference. (WebCore::DatabaseTracker::originPath): Take a reference. (WebCore::DatabaseTracker::fullPathForDatabaseNoLock): Ditto. (WebCore::DatabaseTracker::fullPathForDatabase): Ditto. (WebCore::DatabaseTracker::origins): Changed to use a return value instead of using an out argument. (WebCore::DatabaseTracker::databaseNamesNoLock): Ditto. Also renamed from databaseNamesForOriginNoLock. (WebCore::DatabaseTracker::databaseNames): Ditto. Also renamed from databaseNamesForOrigin. (WebCore::DatabaseTracker::detailsForNameAndOrigin): Take a reference. (WebCore::DatabaseTracker::setDatabaseDetails): Ditto. (WebCore::DatabaseTracker::doneCreatingDatabase): Ditto. (WebCore::DatabaseTracker::addOpenDatabase): Ditto. (WebCore::DatabaseTracker::removeOpenDatabase): Ditto. (WebCore::DatabaseTracker::getOpenDatabases): Deleted. (WebCore::DatabaseTracker::originLockFor): Take a reference. (WebCore::DatabaseTracker::deleteOriginLockFor): Take a reference. (WebCore::DatabaseTracker::usage): Renamed from usageForOrigin. Take a reference. (WebCore::DatabaseTracker::quotaNoLock): Renamed from quotaForOriginNoLock. Take a reference. (WebCore::DatabaseTracker::quota): Renamed from quatoForOrigin. Take a reference. (WebCore::DatabaseTracker::setQuota): Take a reference. (WebCore::DatabaseTracker::addDatabase): Ditto. (WebCore::DatabaseTracker::deleteAllDatabasesImmediately): Updated now that origins has a return value. (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): Ditto. (WebCore::DatabaseTracker::deleteOrigin): Take a reference. (WebCore::DatabaseTracker::isDeletingDatabaseOrOriginFor): Ditto. (WebCore::DatabaseTracker::recordCreatingDatabase): Updated to take a reference, use unique_ptr, and use HashCountedSet. (WebCore::DatabaseTracker::doneCreatingDatabase): Ditto. (WebCore::DatabaseTracker::creatingDatabase): Ditto. (WebCore::DatabaseTracker::canDeleteDatabase): Take a reference. (WebCore::DatabaseTracker::recordDeletingDatabase): Updated to take a reference, and use unique_ptr. (WebCore::DatabaseTracker::doneDeletingDatabase): Ditto. (WebCore::DatabaseTracker::isDeletingDatabase): Ditto. (WebCore::DatabaseTracker::canDeleteOrigin): Take a reference. (WebCore::DatabaseTracker::isDeletingOrigin): Ditto. (WebCore::DatabaseTracker::recordDeletingOrigin): Ditto. (WebCore::DatabaseTracker::doneDeletingOrigin): Ditto. (WebCore::DatabaseTracker::deleteDatabase): Ditto. (WebCore::DatabaseTracker::deleteDatabaseFile): Ditto. (WebCore::DatabaseTracker::removeDeletedOpenedDatabases): Ditto. (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged): Ditto. (WebCore::DatabaseTracker::notifyDatabasesChanged): Ditto. * Modules/webdatabase/DatabaseTracker.h: Updated for above changes. * Modules/webdatabase/SQLStatement.cpp: (WebCore::SQLStatement::SQLStatement): Updated since Database::scriptExecutionContext now returns a reference. * Modules/webdatabase/SQLTransaction.cpp: (WebCore::SQLTransaction::SQLTransaction): Moved data member initialization to the calss definition. Also updated since Database::scriptExecutionContext now returns a reference. (WebCore::SQLTransaction::executeSQL): Use ExceptionOr. (WebCore::SQLTransaction::checkAndHandleClosedDatabase): Updated since databaseContext now returns a reference. (WebCore::SQLTransaction::deliverQuotaIncreaseCallback): Updated to call didExceedQuota on the database instead of the transaction client. (WebCore::SQLTransaction::postflightAndCommit): Updated to call didCommitWriteTransaction on the database instead of the transaction client. (WebCore::SQLTransaction::acquireOriginLock): Updated for name change of DatabaseTracker::tracker to DatbaseTracker::singleton. * Modules/webdatabase/SQLTransaction.h: Updated for above. * Modules/webdatabase/SQLTransaction.idl: Added MayThrowException to executeSql. Not technically needed since it's a custom binding. * Modules/webdatabase/SQLTransactionBackend.cpp: (WebCore::SQLTransactionBackend::doCleanup): Updated assertion to use Database::databaseThread. (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown): Ditto. * Modules/webdatabase/SQLTransactionClient.cpp: Removed. * Modules/webdatabase/SQLTransactionClient.h: Removed. * Modules/webdatabase/SQLTransactionCoordinator.cpp: (WebCore::getDatabaseIdentifier): Updated to pass a reference. * WebCore.xcodeproj/project.pbxproj: Removed various deleted files. Also let Xcode change the whitespace on some lines. * bindings/js/JSSQLTransactionCustom.cpp: (WebCore::JSSQLTransaction::executeSql): Use ExceptionOr, specifically by using the propagateException function. * dom/ScriptExecutionContext.h: Added databaseContext function. Before, we had setDatabaseContext, but no way to inspect the pointer that was stored. * inspector/InspectorDatabaseAgent.cpp: Removed IGNORE_EXCEPTION in a call to executeSQL, which no longer has an ExceptionCode out argument. * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): Pass a reference in the call to DatabaseManager::stopDatabases. 2016-11-13 Dan Bernstein <mitz@apple.com> Try to fix building with newer versions of clang. * page/FrameView.h: Don’t export an inline function. 2016-11-13 Darin Adler <darin@apple.com> Move crypto code from ExceptionCode to ExceptionOr https://bugs.webkit.org/show_bug.cgi?id=164698 Reviewed by Sam Weinig. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): Use the new identifier function instead of getIdentifierForName. * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): Ditto. (WebCore::toCryptoKeyUsageBitmap): Removed a stray meaningless const. (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Pass ScriptExecutionContext as a reference instead of a pointer. * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::createAlgorithmFromJSValue): Use the more efficient version of setDOMException that uses scope. (WebCore::JSWebKitSubtleCrypto::encrypt): Ditto. Also updated to use ExceptionOr instead of ExceptionCode. (WebCore::JSWebKitSubtleCrypto::decrypt): Ditto. (WebCore::JSWebKitSubtleCrypto::sign): Ditto. (WebCore::JSWebKitSubtleCrypto::verify): Ditto. (WebCore::JSWebKitSubtleCrypto::digest): Ditto. (WebCore::JSWebKitSubtleCrypto::generateKey): Ditto. (WebCore::importKey): Ditto. (WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto. (WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto. * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::CryptoAlgorithm): Deleted. (WebCore::CryptoAlgorithm::~CryptoAlgorithm): Deleted. (WebCore::CryptoAlgorithm::generateKey): Use ExceptionOr. (WebCore::CryptoAlgorithm::encrypt): Ditto. (WebCore::CryptoAlgorithm::decrypt): Ditto. (WebCore::CryptoAlgorithm::sign): Ditto. (WebCore::CryptoAlgorithm::verify): Ditto. (WebCore::CryptoAlgorithm::digest): Ditto. (WebCore::CryptoAlgorithm::deriveKey): Ditto. (WebCore::CryptoAlgorithm::deriveBits): Ditto. (WebCore::CryptoAlgorithm::importKey): Ditto. (WebCore::CryptoAlgorithm::encryptForWrapKey): Ditto. (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Ditto. * crypto/CryptoAlgorithm.h: Use ExceptionOr. Moved the destructor into the header since it's more efficient for derived classes to have it inlined. Removed the protected constructor because since there are pure virtual functions in the class, there is no risk of anyone misusing the public constructor. * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::identifier): Renamed from getIdentifierForName and changed to use an Optional rather than using a boolean plus an out argument. (WebCore::CryptoAlgorithmRegistry::name): Renamed to name from nameForIdentifier. Also updated to share a single map containing both names and constructors. (WebCore::CryptoAlgorithmRegistry::create): Share single map as above. (WebCore::CryptoAlgorithmRegistry::registerAlgorithm): Updated assertions to a mroe straightforward style. Share single map for names and constructors. * crypto/CryptoAlgorithmRegistry.h: Updated for above. * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC): Deleted. (WebCore::CryptoAlgorithmAES_CBC::~CryptoAlgorithmAES_CBC): Deleted. (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches): Use references, ExceptionOr. (WebCore::CryptoAlgorithmAES_CBC::generateKey): Ditto. (WebCore::CryptoAlgorithmAES_CBC::encrypt): Ditto. (WebCore::CryptoAlgorithmAES_CBC::decrypt): Ditto. (WebCore::CryptoAlgorithmAES_CBC::importKey): Ditto. * crypto/algorithms/CryptoAlgorithmAES_CBC.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::CryptoAlgorithmAES_KW): Deleted. (WebCore::CryptoAlgorithmAES_KW::~CryptoAlgorithmAES_KW): Deleted. (WebCore::CryptoAlgorithmAES_KW::keyAlgorithmMatches): Use references, ExceptionOr. (WebCore::CryptoAlgorithmAES_KW::generateKey): Ditto. (WebCore::CryptoAlgorithmAES_KW::importKey): Ditto. (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Ditto. (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Ditto. * crypto/algorithms/CryptoAlgorithmAES_KW.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::CryptoAlgorithmHMAC): Deleted. (WebCore::CryptoAlgorithmHMAC::~CryptoAlgorithmHMAC): Deleted. (WebCore::CryptoAlgorithmHMAC::generateKey): Use references, ExceptionOr. (WebCore::CryptoAlgorithmHMAC::sign): Ditto. (WebCore::CryptoAlgorithmHMAC::verify): Ditto. (WebCore::CryptoAlgorithmHMAC::importKey): Ditto. * crypto/algorithms/CryptoAlgorithmHMAC.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): Use references, ExceptionOr. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): Ditto. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): Ditto. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): Ditto. * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::~CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): Use references, ExceptionOr. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): Ditto. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Ditto. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): Ditto. * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::CryptoAlgorithmRSA_OAEP): Deleted. (WebCore::CryptoAlgorithmRSA_OAEP::~CryptoAlgorithmRSA_OAEP): Deleted. (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): Use references, ExceptionOr. (WebCore::CryptoAlgorithmRSA_OAEP::encrypt): Ditto. (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): Ditto. (WebCore::CryptoAlgorithmRSA_OAEP::importKey): Ditto. * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::CryptoAlgorithmSHA1): Deleted. (WebCore::CryptoAlgorithmSHA1::~CryptoAlgorithmSHA1): Deleted. (WebCore::CryptoAlgorithmSHA1::digest): Use ExceptionOr. * crypto/algorithms/CryptoAlgorithmSHA1.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmSHA224.cpp: (WebCore::CryptoAlgorithmSHA224::CryptoAlgorithmSHA224): Deleted. (WebCore::CryptoAlgorithmSHA224::~CryptoAlgorithmSHA224): Deleted. (WebCore::CryptoAlgorithmSHA224::digest): Use ExceptionOr. * crypto/algorithms/CryptoAlgorithmSHA224.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmSHA256.cpp: (WebCore::CryptoAlgorithmSHA256::CryptoAlgorithmSHA256): Deleted. (WebCore::CryptoAlgorithmSHA256::~CryptoAlgorithmSHA256): Deleted. (WebCore::CryptoAlgorithmSHA256::digest): Use ExceptionOr. * crypto/algorithms/CryptoAlgorithmSHA256.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmSHA384.cpp: (WebCore::CryptoAlgorithmSHA384::CryptoAlgorithmSHA384): Deleted. (WebCore::CryptoAlgorithmSHA384::~CryptoAlgorithmSHA384): Deleted. (WebCore::CryptoAlgorithmSHA384::digest): Use ExceptionOr. * crypto/algorithms/CryptoAlgorithmSHA384.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/algorithms/CryptoAlgorithmSHA512.cpp: (WebCore::CryptoAlgorithmSHA512::CryptoAlgorithmSHA512): Deleted. (WebCore::CryptoAlgorithmSHA512::~CryptoAlgorithmSHA512): Deleted. (WebCore::CryptoAlgorithmSHA512::digest): Use ExceptionOr. * crypto/algorithms/CryptoAlgorithmSHA512.h: Updated for above. Also use constexpr for s_name and s_identifier. * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: (WebCore::calculateSignature): Use Optional instead of a boolean return value and an out argument. (WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr. (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto. * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto. * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto. * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: (WebCore::CryptoAlgorithmHMAC::platformSign): Ditto. (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto. * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto. * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Ditto. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto. * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto. * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::buildAlgorithm): Updated to use name instead of nameForIdentifier. * crypto/keys/CryptoKeyHMAC.cpp: Ditto. (WebCore::CryptoKeyHMAC::buildAlgorithm): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Use ExceptionOr. (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto. * crypto/mac/CryptoAlgorithmAES_KWMac.cpp: (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto. * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::commonCryptoHMACAlgorithm): Renamed from getCommonCryptoHMACAlgorithm and changed to use Optional instead of a boolean return value and an out argument. (WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr. (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto. * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto. * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::cryptoDigestAlgorithm): Renamed from getCryptoDigestAlgorithm and changed to use Optional instead of a boolean return value and an out argument. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Use ExceptionOr. (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto. * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto. (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto. * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::buildAlgorithm): Updated to use name instead of nameForIdentifier. 2016-11-13 Joseph Pecoraro <pecoraro@apple.com> Use #pragma once in WebCore https://bugs.webkit.org/show_bug.cgi?id=164686 Reviewed by Michael Catanzaro. * css/*.h: * plugins/*.h: * rendering/*.h: * style/*.h: * svg/*.h: * testing/*.h: 2016-11-12 Dan Bernstein <mitz@apple.com> Tried to fix the iOS build after r208666. * platform/SuddenTermination.h: 2016-11-12 Simon Fraser <simon.fraser@apple.com> 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. 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): 2016-11-12 Darin Adler <darin@apple.com> 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. 2016-11-12 Simon Fraser <simon.fraser@apple.com> [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. 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): 2016-11-12 Zalan Bujtas <zalan@apple.com> 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: 2016-11-12 Ryosuke Niwa <rniwa@webkit.org> 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. 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. 2016-11-12 Darin Adler <darin@apple.com> Remove a few assorted uses of ExceptionCode https://bugs.webkit.org/show_bug.cgi?id=164683 Reviewed by Chris Dumez. * 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. 2016-11-11 Darin Adler <darin@apple.com> 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. 2016-11-12 Dan Bernstein <mitz@apple.com> 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. 2016-11-12 Wenson Hsieh <wenson_hsieh@apple.com> 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. 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): 2016-11-12 Chris Dumez <cdumez@apple.com> 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: 2016-11-12 Dan Bernstein <mitz@apple.com> Tried to fix the 32-bit build. * platform/mac/WebPlaybackControlsManager.mm: 2016-11-12 Dan Bernstein <mitz@apple.com> Tried to fix the 32-bit build. * platform/mac/WebPlaybackControlsManager.h: 2016-11-12 Dan Bernstein <mitz@apple.com> 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. 2016-11-12 Dan Bernstein <mitz@apple.com> Tried to fix the build. * platform/spi/cocoa/NSTouchBarSPI.h: Removed duplicate @interface declarations. 2016-11-12 Frederic Wang <fwang@igalia.com> Ensure MathML render tree are clean by the end of FrameView::layout(). https://bugs.webkit.org/show_bug.cgi?id=162824 Reviewed by Darin Adler. 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. 2016-11-12 Frederic Wang <fwang@igalia.com> Remove RenderMathMLOperator::shouldAllowStretching https://bugs.webkit.org/show_bug.cgi?id=164313 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. 2016-11-12 Joseph Pecoraro <pecoraro@apple.com> Use #pragma once in WebCore https://bugs.webkit.org/show_bug.cgi?id=164373 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. 2016-11-12 Wenson Hsieh <wenson_hsieh@apple.com> 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: 2016-11-11 Wenson Hsieh <wenson_hsieh@apple.com> 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. 2016-11-11 Ryosuke Niwa <rniwa@webkit.org> event.composedPath() does not include window https://bugs.webkit.org/show_bug.cgi?id=164609 <rdar://problem/29210383> Reviewed by Antti Koivisto. 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. 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Alex Christensen <achristensen@webkit.org> Use SecurityOriginData as keys in StorageManager https://bugs.webkit.org/show_bug.cgi?id=159834 <rdar://problem/27346948> Reviewed by Brady Eidson. 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. 2016-11-11 Ryosuke Niwa <rniwa@webkit.org> 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. 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): 2016-11-11 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r208628 * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): Cast pointer arithmetic to uint32_t to avoid warning. 2016-11-11 Brent Fulgham <bfulgham@apple.com> Neutered ArrayBuffers are not properly serialized https://bugs.webkit.org/show_bug.cgi?id=164647 <rdar://problem/29213490> Reviewed by David Kilzer. Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers. Test: fast/canvas/neutered-imagedata.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): 2016-11-11 Wenson Hsieh <wenson_hsieh@apple.com> [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. 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: 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Antti Koivisto <antti@apple.com> 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. 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). 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Chris Dumez <cdumez@apple.com> 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. 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: 2016-11-11 Antti Koivisto <antti@apple.com> 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. 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. 2016-11-11 Brady Eidson <beidson@apple.com> 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. 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: 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Keith Rollin <krollin@apple.com> 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): 2016-11-11 Eric Carlson <eric.carlson@apple.com> [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. 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: 2016-11-11 Zalan Bujtas <zalan@apple.com> 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): 2016-11-11 Darin Adler <darin@apple.com> Move Node from ExceptionCode to ExceptionOr https://bugs.webkit.org/show_bug.cgi?id=164515 Reviewed by Sam Weinig. * 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. 2016-11-10 Jiewen Tan <jiewen_tan@apple.com> 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. 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: 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Zalan Bujtas <zalan@apple.com> 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: 2016-11-11 Megan Gardner <megan_gardner@apple.com> [Cocoa] Support wide gamut for Drag Image UI https://bugs.webkit.org/show_bug.cgi?id=164490 Reviewed by Tim Horton. 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): 2016-11-11 Beth Dakin <bdakin@apple.com> Get touch bar code building for open source builds https://bugs.webkit.org/show_bug.cgi?id=164610 Reviewed by Wenson Hsieh. * config.h: 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-10 Wenson Hsieh <wenson_hsieh@apple.com> 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. 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): 2016-11-11 Dave Hyatt <hyatt@apple.com> [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): 2016-11-11 Alejandro G. Castro <alex@igalia.com> [WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process https://bugs.webkit.org/show_bug.cgi?id=164010 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. 2016-11-11 Manuel Rego Casasnovas <rego@igalia.com> [css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount https://bugs.webkit.org/show_bug.cgi?id=163450 Reviewed by Darin Adler. 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. 2016-11-11 Antoine Quint <graouts@apple.com> [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: 2016-11-10 Yusuke Suzuki <utatane.tea@gmail.com> [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: 2016-11-10 Sam Weinig <sam@webkit.org> [SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio https://bugs.webkit.org/show_bug.cgi?id=164622 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. 2016-11-10 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Document#body should have DOMJIT patchpoint https://bugs.webkit.org/show_bug.cgi?id=164627 Reviewed by Darin Adler. 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): 2016-11-10 John Wilander <wilander@apple.com> 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. 2016-11-10 Chris Dumez <cdumez@apple.com> 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: 2016-11-10 John Wilander <wilander@apple.com> 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. 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. 2016-11-10 Said Abou-Hallawa <sabouhallawa@apple.com> 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 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. 2016-11-10 Brent Fulgham <bfulgham@apple.com> [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. 2016-11-10 Dean Jackson <dino@apple.com> Add CSS Color Level 4 to features. * features.json: 2016-11-10 Zalan Bujtas <zalan@apple.com> 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): 2016-11-10 Joseph Pecoraro <pecoraro@apple.com> After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource https://bugs.webkit.org/show_bug.cgi?id=164621 Reviewed by Youenn Fablet. * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::cachedResource): CachedResourceLoader expects a sanitized URL. 2016-11-10 Brady Eidson <beidson@apple.com> IndexedDB 2.0 Support the IDBDatabase.onclose event. https://bugs.webkit.org/show_bug.cgi?id=164602 Reviewed by Alex Christensen. No new tests (Covered by existing tests). * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror" * Modules/indexeddb/IDBDatabase.idl: 2016-11-10 Ryosuke Niwa <rniwa@webkit.org> Copied text would contain text inside CDATA sections and comments https://bugs.webkit.org/show_bug.cgi?id=164578 <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): 2016-11-10 Eric Carlson <eric.carlson@apple.com> [MediaStream] apply constraints passed to getUserMedia() https://bugs.webkit.org/show_bug.cgi?id=164561 Reviewed by Youenn Fablet. <rdar://problem/29191384> No new tests, updated existing tests. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::allow): Pass constraints into createMediaStream instead of applying them after the stream has been created. * WebCore.xcodeproj/project.pbxproj: Remove MediaConstraintsMock.cpp/.h. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Remove a bogus assert. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Drive-by fix: a stream that is receiving media data is as ready as it will ever be so it's readyState should be at HAVE_ENOUGH_DATA. Simplify CaptureDeviceManager by removing all code for constraint validation because some constraints can't be validated without a live capture device. Ports that are able to resolve constraints without creating a live source can do so in a derived capture device class. * platform/mediastream/CaptureDeviceManager.cpp: (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Return a list of UIDs, not a list of live sources, because that is all the caller will use. This will allows ports to avoid source creation in some cases. (CaptureDeviceManager::sourceWithUID): Add parameters for new source constraints and invalid constraint. (CaptureDeviceManager::verifyConstraintsForMediaType): Deleted. (CaptureDeviceManager::bestDeviceForFacingMode): Deleted. (facingModeFromString): Deleted. (CaptureDeviceManager::sessionSupportsConstraint): Deleted. (CaptureDeviceManager::isSupportedFrameRate): Deleted. * platform/mediastream/CaptureDeviceManager.h: (WebCore::CaptureDeviceManager::defaultCaptureSession): Deleted. * platform/mediastream/MediaConstraints.cpp: (WebCore::FlattenedConstraint::find): New, make it possible to examine resolved constraints. * platform/mediastream/MediaConstraints.h: (WebCore::NumericConstraint::fitnessDistance): Reject invalid constraints. (WebCore::NumericConstraint::valueForCapabilityRange): New, resolve a constraint for a capability range. (WebCore::MediaTrackConstraintSetMap::width): Expose constraints held in the map. (WebCore::MediaTrackConstraintSetMap::height): (WebCore::MediaTrackConstraintSetMap::sampleRate): (WebCore::MediaTrackConstraintSetMap::sampleSize): (WebCore::MediaTrackConstraintSetMap::aspectRatio): (WebCore::MediaTrackConstraintSetMap::frameRate): (WebCore::MediaTrackConstraintSetMap::volume): (WebCore::MediaTrackConstraintSetMap::echoCancellation): (WebCore::MediaTrackConstraintSetMap::facingMode): (WebCore::MediaTrackConstraintSetMap::deviceId): (WebCore::MediaTrackConstraintSetMap::groupId): Resolve and apply width, height, and frameRate all at once because the ability to support one may depend on the value of another. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): (WebCore::applyNumericConstraint): Move the guts of the logic into valueForCapabilityRange. (WebCore::RealtimeMediaSource::applySizeAndFrameRate): (WebCore::RealtimeMediaSource::selectSettings): (WebCore::RealtimeMediaSource::supportsConstraints): (WebCore::RealtimeMediaSource::applyConstraints): Support null success/failure lambdas. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeMediaSourceCenter.h: * platform/mediastream/mac/AVAudioCaptureSource.h: * platform/mediastream/mac/AVAudioCaptureSource.mm: (WebCore::AVAudioCaptureSource::create): Add parameter for creation constraints. (WebCore::AVAudioCaptureSource::AVAudioCaptureSource): Ditto. Remove all constraint validation code, it is done by the audio and video capture sources. Add support for stream creation constraints. * platform/mediastream/mac/AVCaptureDeviceManager.h: * platform/mediastream/mac/AVCaptureDeviceManager.mm: (WebCore::AVCaptureDeviceManager::captureDeviceList): (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints): (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted. (WebCore::AVCaptureDeviceManager::sourceWithUID): Deleted. (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Deleted. (WebCore::AVCaptureDeviceManager::defaultCaptureSession): Deleted. (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Deleted. (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Deleted. (WebCore::AVCaptureDeviceManager::supportedConstraints): Deleted. * platform/mediastream/mac/AVMediaCaptureSource.h: (WebCore::AVMediaCaptureSource::constraints): Deleted. * platform/mediastream/mac/AVMediaCaptureSource.mm: (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource): (WebCore::AVMediaCaptureSource::startProducingData): (WebCore::AVMediaCaptureSource::stopProducingData): (WebCore::AVMediaCaptureSource::beginConfiguration): (WebCore::AVMediaCaptureSource::commitConfiguration): (WebCore::AVMediaCaptureSource::capabilities): (WebCore::AVMediaCaptureSource::setupSession): (WebCore::AVMediaCaptureSource::reset): Validate and apply constraints, support source creation constraints, initialize capabilities and supported constraints by examining device capabilities. * platform/mediastream/mac/AVVideoCaptureSource.h: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::create): (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): (WebCore::updateSizeMinMax): (WebCore::updateAspectRatioMinMax): (WebCore::AVVideoCaptureSource::initializeCapabilities): (WebCore::AVVideoCaptureSource::initializeSupportedConstraints): (WebCore::AVVideoCaptureSource::applySize): (WebCore::AVVideoCaptureSource::setPreset): (WebCore::AVVideoCaptureSource::applyFrameRate): (WebCore::AVVideoCaptureSource::applySizeAndFrameRate): (WebCore::AVVideoCaptureSource::setupCaptureSession): (WebCore::AVVideoCaptureSource::currentFrameCGImage): (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate): * platform/mediastream/mac/MockRealtimeVideoSourceMac.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSource::create): Apply creation constraints, return null if they can not be applied successfully. (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac): (WebCore::MockRealtimeVideoSource::createMuted): Update RealtimeMediaSourceCenters for API changes. * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints): (WebCore::RealtimeMediaSourceCenterMac::createMediaStream): * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints): (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h: Mock media sources support constraint validation and application directly so "mock constraints" are no longer necessary. * platform/mock/MediaConstraintsMock.cpp: Removed. * platform/mock/MediaConstraintsMock.h: Removed. * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::create): (WebCore::MockRealtimeAudioSource::createMuted): (WebCore::MockRealtimeAudioSource::updateSettings): (WebCore::MockRealtimeAudioSource::initializeCapabilities): (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints): * platform/mock/MockRealtimeAudioSource.h: * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints): (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): * platform/mock/MockRealtimeMediaSourceCenter.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::create): (WebCore::MockRealtimeVideoSource::createMuted): * platform/mock/MockRealtimeVideoSource.h: * platform/mock/RTCPeerConnectionHandlerMock.cpp: 2016-11-10 Alex Christensen <achristensen@webkit.org> Move SecurityOrigin::databaseIdentifier() to SecurityOriginData https://bugs.webkit.org/show_bug.cgi?id=164573 Reviewed by Brady Eidson. No change in behavior. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): * Modules/indexeddb/IDBDatabaseIdentifier.cpp: (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot): * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins): * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::hasEntryForOriginNoLock): (WebCore::DatabaseTracker::hasEntryForDatabase): (WebCore::DatabaseTracker::originPath): (WebCore::DatabaseTracker::fullPathForDatabaseNoLock): (WebCore::DatabaseTracker::databaseNamesForOriginNoLock): (WebCore::DatabaseTracker::detailsForNameAndOrigin): (WebCore::DatabaseTracker::setDatabaseDetails): (WebCore::DatabaseTracker::originLockFor): (WebCore::DatabaseTracker::deleteOriginLockFor): (WebCore::DatabaseTracker::quotaForOriginNoLock): (WebCore::DatabaseTracker::setQuota): (WebCore::DatabaseTracker::addDatabase): (WebCore::DatabaseTracker::deleteOrigin): (WebCore::DatabaseTracker::deleteDatabase): (WebCore::DatabaseTracker::removeDeletedOpenedDatabases): * Modules/webdatabase/SQLTransactionCoordinator.cpp: (WebCore::getDatabaseIdentifier): * dom/Document.cpp: (WebCore::Document::origin): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory): * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): (WebCore::ApplicationCacheStorage::calculateUsageForOrigin): (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): (WebCore::ApplicationCacheStorage::store): (WebCore::ApplicationCacheStorage::ensureOriginRecord): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::databaseIdentifier): Deleted. * page/SecurityOrigin.h: * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::databaseIdentifier): * page/SecurityOriginData.h: 2016-11-10 Zalan Bujtas <zalan@apple.com> RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be on RenderBlock. https://bugs.webkit.org/show_bug.cgi?id=164601 Reviewed by Simon Fraser. FlowThread containing blocks are cached at RenderBlocks. It makes no sense to call the invalidate function on a RenderElement. Move invalidateFlowThreadContainingBlockIncludingDescendants to RenderBlock. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants): * rendering/RenderBlock.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted. * rendering/RenderElement.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::splitInlines): 2016-11-10 Brent Fulgham <bfulgham@apple.com> Local file restrictions should not block sessionStorage access. https://bugs.webkit.org/show_bug.cgi?id=155609 <rdar://problem/25229461> Reviewed by Andy Estes. Re-landing this fix that was lost when the localStorage change was rolled out. Use of 'sessionStorage' is governed by SecurityOrigin with third party access set to 'ShouldAllowFromThirdParty::AlwaysAllowFromThirdParty'. We should not reject local files for this combination of arguments. Tested by storage/domstorage/sessionstorage/blocked-file-access.html. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canAccessStorage): For the case of sessionStorage, allow local file access. 2016-11-10 Daniel Bates <dabates@apple.com> REGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent process after receiving HTTP 0.9 response https://bugs.webkit.org/show_bug.cgi?id=164387 <rdar://problem/28987537> Reviewed by Brent Fulgham. Fixes an issue where the HTTP 0.9 sandbox persisted across subsequent loads in the same WebContent process. Currently when an HTTP 0.9 response is received for a request made to a default port (e.g. 80) we apply a sandbox policy on the FrameLoader for the main resource that disallows scripts and plugins. A FrameLoader may be re-used for navigations. Therefore, the sandbox policy applied to one site may be applied to another site. Moreover the sandbox policy was applied to the FrameLoader of the main resource regardless of whether the HTTP response was for a subresource. Instead we should apply the sandbox on a per- Document basis and only if we receive an HTTP 0.9 response for the document when the corresponding HTTP request was made to a default port. As a side benefit of this change, we emit exactly one console message to Web Inspector when the HTTP 0.9 sandbox is applied to a document as opposed to three console messages. Moreover, we only emit this console message when the document load is not blocked. Test: http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html * dom/Document.cpp: (WebCore::Document::initSecurityContext): Disallow scripts and plugins if an HTTP 0.9 response was received for this document. Note that if this function is called for a document associated with an HTTP 0.9 response then the corresponding HTTP request was made to a default port. DocumentLoader::responseReceived() blocks the load for a document with an HTTP 0.9 response corresponding to an HTTP request made to a non-default port. This invariant is covered by the tests LayoutTests/http/tests/security/http-0.9/default-port-{plugin, script}-blocked.html. (WebCore::Document::shouldEnforceHTTP0_9Sandbox): Added. Returns whether an HTTP 0.9 response was received for this document. * dom/Document.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): Remove logic to apply sandbox policy to the FrameLoader associated with the main resource. We will apply the sandbox during initialization of the document. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): Ditto. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): Ditto. 2016-11-04 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::importKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164446 <rdar://problem/29123621> Reviewed by Brent Fulgham. This patch does following few things: 1. It updates the SubtleCrypto::importKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey. 2. It implements importKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It fixes some minor problems of SubtleCrypto::generateKey. 4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and CryptoKeyDataRSAComponents. 5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both HmacKeyGenParams and HmacImportParams which are essentially the same. 6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8. 7. It also fixes the following bugs: https://bugs.webkit.org/show_bug.cgi?id=126033, https://bugs.webkit.org/show_bug.cgi?id=126034, https://bugs.webkit.org/show_bug.cgi?id=151308. P.S. We currently only support Raw and Jwk key format. Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html crypto/subtle/aes-cbc-import-jwk-key-length-192.html crypto/subtle/aes-cbc-import-jwk-key-length-256.html crypto/subtle/aes-cbc-import-jwk-key-minimum.html crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html crypto/subtle/aes-cbc-import-raw-key-length-128.html crypto/subtle/aes-cbc-import-raw-key-length-192.html crypto/subtle/aes-cbc-import-raw-key-length-256.html crypto/subtle/aes-import-key-malformed-parameters.html crypto/subtle/aes-kw-import-jwk-key-length-128.html crypto/subtle/aes-kw-import-jwk-key-length-192.html crypto/subtle/aes-kw-import-jwk-key-length-256.html crypto/subtle/aes-kw-import-raw-key.html crypto/subtle/generate-key-malformed-parameters.html crypto/subtle/hmac-import-jwk-key-minimum.html crypto/subtle/hmac-import-jwk-key-non-extractable.html crypto/subtle/hmac-import-jwk-key-sha1.html crypto/subtle/hmac-import-jwk-key-sha224.html crypto/subtle/hmac-import-jwk-key-sha256.html crypto/subtle/hmac-import-jwk-key-sha384.html crypto/subtle/hmac-import-jwk-key-sha512.html crypto/subtle/hmac-import-malformed-parameters.html crypto/subtle/hmac-import-raw-key-customized-length.html crypto/subtle/hmac-import-raw-key.html crypto/subtle/import-key-malformed-parameters.html crypto/subtle/rsa-import-key-malformed-parameters.html crypto/subtle/rsa-oaep-import-jwk-private-key.html crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html crypto/workers/subtle/aes-import-jwk-key.html crypto/workers/subtle/aes-import-raw-key.html crypto/workers/subtle/hmac-import-jwk-key.html crypto/workers/subtle/hmac-import-raw-key.html crypto/workers/subtle/rsa-import-jwk-private-key.html crypto/workers/subtle/rsa-import-jwk-public-key.html * CMakeLists.txt: * DerivedSources.make: * PlatformEfl.cmake: * PlatformGTK.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::cryptoKeyUsageFromString): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::toKeyData): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::jsSubtleCryptoFunctionImportKeyPromise): (WebCore::JSSubtleCrypto::importKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::importKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: * crypto/JsonWebKey.h: Added. * crypto/JsonWebKey.idl: Added. * crypto/RsaOtherPrimesInfo.h: Added. * crypto/RsaOtherPrimesInfo.idl: Added. * crypto/SubtleCrypto.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): (WebCore::CryptoAlgorithmAES_CBC::importKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): (WebCore::CryptoAlgorithmAES_KW::importKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): (WebCore::CryptoAlgorithmHMAC::importKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::CryptoKeyAES): (WebCore::CryptoKeyAES::generate): (WebCore::CryptoKeyAES::importRaw): (WebCore::CryptoKeyAES::importJwk): * crypto/keys/CryptoKeyAES.h: * crypto/keys/CryptoKeyDataRSAComponents.cpp: (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): * crypto/keys/CryptoKeyDataRSAComponents.h: * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::CryptoKeyHMAC): (WebCore::CryptoKeyHMAC::generate): (WebCore::CryptoKeyHMAC::importRaw): (WebCore::CryptoKeyHMAC::importJwk): (WebCore::CryptoKeyHMAC::buildAlgorithm): * crypto/keys/CryptoKeyHMAC.h: * crypto/keys/CryptoKeyRSA.cpp: Added. (WebCore::CryptoKeyRSA::importJwk): * crypto/keys/CryptoKeyRSA.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h. * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added. * crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl. * crypto/parameters/RsaHashedImportParams.idl: Added. 2016-11-10 Brady Eidson <beidson@apple.com> IndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code. https://bugs.webkit.org/show_bug.cgi?id=164596 Reviewed by Eric Carlson. No new tests (Covered by existing tests). We can't just WTFMove the pointers from the deleted-IDBObject maps... We need to remove the entries, too. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::internalAbort): 2016-11-10 Youenn Fablet <youennf@gmail.com> MediaStreamTrack should use more Ref<> and less RefPtr<> https://bugs.webkit.org/show_bug.cgi?id=164560 Reviewed by Eric Carlson. No change of behavior. Make MediaStreamTrack take a Ref<>& instead of a reference. Using Ref<>&& instead of RefPtr<>&& in MediaStreamTrackPrivate. Updating constness of some methods accordingly. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::createReceiver): * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::create): (WebCore::MediaStreamTrack::MediaStreamTrack): (WebCore::MediaStreamTrack::clone): * Modules/mediastream/MediaStreamTrack.h: * Modules/webaudio/MediaStreamAudioSource.cpp: (WebCore::MediaStreamAudioSource::capabilities): (WebCore::MediaStreamAudioSource::settings): * Modules/webaudio/MediaStreamAudioSource.h: * platform/mediastream/MediaEndpoint.cpp: * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::create): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::create): (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate): (WebCore::MediaStreamTrackPrivate::clone): * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::setMuted): (WebCore::MediaStreamTrackPrivate::source): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVMediaCaptureSource.h: * platform/mediastream/mac/AVMediaCaptureSource.mm: (WebCore::AVMediaCaptureSource::initializeSettings): (WebCore::AVMediaCaptureSource::settings): (WebCore::AVMediaCaptureSource::initializeCapabilities): (WebCore::AVMediaCaptureSource::capabilities): * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: (WebCore::RealtimeMediaSourceOwr::capabilities): (WebCore::RealtimeMediaSourceOwr::settings): * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::MockRealtimeMediaSource::initializeCapabilities): (WebCore::MockRealtimeMediaSource::capabilities): (WebCore::MockRealtimeMediaSource::initializeSettings): (WebCore::MockRealtimeMediaSource::settings): * platform/mock/MockRealtimeMediaSource.h: 2016-11-10 Per Arne Vollan <pvollan@apple.com> [Win32] Crash in layout tests. https://bugs.webkit.org/show_bug.cgi?id=164411 Reviewed by Mark Lam. Use the calling convention expected by the callers of the generated functions. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute): (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem): (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute): (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById): (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName): 2016-11-10 Aaron Chu <aaron_chu@apple.com> Web Inspector: AXI: clarify button roles (e.g. toggle or popup button) https://bugs.webkit.org/show_bug.cgi?id=130726 <rdar://problem/16420420> Reviewed by Brian Burg. Test: accessibility/ax-differentiate-button-types.html Added special case logic to make sure PopUpButtonRole and ToggleButtonRole to user ButtonRole as role. Added an "isPopUpButton" property to be exposed to the Inspector's use. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::computedRoleString): * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): 2016-11-10 Zan Dobersek <zdobersek@igalia.com> [EME] Add no-op Web-facing APIs https://bugs.webkit.org/show_bug.cgi?id=164028 Reviewed by Jer Noble. Add no-op implementation of the Web-facing APIs as defined in the EME specification. This will be the basis for implementing the various algorithms the same specification defines, and for implementing the relevant platform abstractions. Dictionaries and enumerations defined by the specification are defined in separate headers, and not in the implementation files for the class where they are used. This will ease their use across different implementation files. BufferSource now exposes the Variant object it holds. This is needed to support the iterable property on the MediaKeyStatusMap class. CodeGeneratorJS is fixed to support JS-to-native conversion of sequences of dictionaries. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * Modules/encryptedmedia/MediaKeyMessageEvent.cpp: Added. (WebCore::MediaKeyMessageEvent::MediaKeyMessageEvent): (WebCore::MediaKeyMessageEvent::eventInterface): * Modules/encryptedmedia/MediaKeyMessageEvent.h: Added. * Modules/encryptedmedia/MediaKeyMessageEvent.idl: Added. * Modules/encryptedmedia/MediaKeyMessageEventInit.h: Added. (WebCore::MediaKeyMessageEventInit::MediaKeyMessageEventInit): * Modules/encryptedmedia/MediaKeyMessageType.h: Added. * Modules/encryptedmedia/MediaKeySession.cpp: Added. (WebCore::MediaKeySession::create): (WebCore::MediaKeySession::MediaKeySession): (WebCore::MediaKeySession::sessionId): (WebCore::MediaKeySession::expiration): (WebCore::MediaKeySession::keyStatuses): (WebCore::MediaKeySession::generateRequest): (WebCore::MediaKeySession::load): (WebCore::MediaKeySession::update): (WebCore::MediaKeySession::close): (WebCore::MediaKeySession::remove): (WebCore::MediaKeySession::hasPendingActivity): (WebCore::MediaKeySession::activeDOMObjectName): (WebCore::MediaKeySession::canSuspendForDocumentSuspension): (WebCore::MediaKeySession::stop): * Modules/encryptedmedia/MediaKeySession.h: Added. * Modules/encryptedmedia/MediaKeySession.idl: Added. * Modules/encryptedmedia/MediaKeySessionType.h: Added. * Modules/encryptedmedia/MediaKeyStatus.h: Added. * Modules/encryptedmedia/MediaKeyStatusMap.cpp: Added. (WebCore::MediaKeyStatusMap::size): (WebCore::MediaKeyStatusMap::has): (WebCore::MediaKeyStatusMap::get): (WebCore::MediaKeyStatusMap::Iterator::Iterator): (WebCore::MediaKeyStatusMap::Iterator::next): * Modules/encryptedmedia/MediaKeyStatusMap.h: Added. (WebCore::MediaKeyStatusMap::create): (WebCore::MediaKeyStatusMap::createIterator): * Modules/encryptedmedia/MediaKeyStatusMap.idl: Added. * Modules/encryptedmedia/MediaKeySystemAccess.cpp: Added. (WebCore::MediaKeySystemAccess::keySystem): (WebCore::MediaKeySystemAccess::getConfiguration): (WebCore::MediaKeySystemAccess::createMediaKeys): * Modules/encryptedmedia/MediaKeySystemAccess.h: Added. (WebCore::MediaKeySystemAccess::create): * Modules/encryptedmedia/MediaKeySystemAccess.idl: Added. * Modules/encryptedmedia/MediaKeySystemConfiguration.h: Added. * Modules/encryptedmedia/MediaKeySystemConfiguration.idl: Added. * Modules/encryptedmedia/MediaKeySystemMediaCapability.h: Added. * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: Added. * Modules/encryptedmedia/MediaKeys.cpp: Added. (WebCore::MediaKeys::createSession): (WebCore::MediaKeys::setServerCertificate): * Modules/encryptedmedia/MediaKeys.h: Added. (WebCore::MediaKeys::create): * Modules/encryptedmedia/MediaKeys.idl: Added. * Modules/encryptedmedia/MediaKeysRequirement.h: Added. * Modules/encryptedmedia/NavigatorEME.cpp: Added. (WebCore::NavigatorEME::requestMediaKeySystemAccess): * Modules/encryptedmedia/NavigatorEME.h: Added. * Modules/encryptedmedia/NavigatorEME.idl: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/BufferSource.h: (WebCore::BufferSource::BufferSource): (WebCore::BufferSource::variant): * bindings/js/JSMediaKeySessionCustom.cpp: Added. (WebCore::JSMediaKeySession::closed): * bindings/js/JSMediaKeySystemAccessCustom.cpp: Added. (WebCore::JSMediaKeySystemAccess::getConfiguration): * bindings/scripts/CodeGeneratorJS.pm: (GetNativeVectorInnerType): * dom/EventNames.h: * dom/EventNames.in: * dom/EventTargetFactory.in: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaKeys): (WebCore::HTMLMediaElement::setMediaKeys): * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: * html/MediaEncryptedEvent.cpp: Added. (WebCore::MediaEncryptedEvent::MediaEncryptedEvent): (WebCore::MediaEncryptedEvent::eventInterface): (WebCore::MediaEncryptedEvent::initDataType): (WebCore::MediaEncryptedEvent::initData): * html/MediaEncryptedEvent.h: Added. * html/MediaEncryptedEvent.idl: Added. * html/MediaEncryptedEventInit.h: Added. (WebCore::MediaEncryptedEventInit::MediaEncryptedEventInit): 2016-11-10 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS https://bugs.webkit.org/show_bug.cgi?id=164554 <rdar://problem/29183439> Reviewed by Dean Jackson. When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls. To facilitate this, support objects are created and destroyed when changing the controls in order for the right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport subclasses can be overridden to remove event listeners added by support objects in their constructor. Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html * Modules/modern-media-controls/media/fullscreen-support.js: (FullscreenSupport.prototype.destroy): * Modules/modern-media-controls/media/media-controller-support.js: (MediaControllerSupport.prototype.destroy): * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype.get layoutTraits): (MediaController.prototype.handleEvent): (MediaController.prototype._updateControlsIfNeeded): (MediaController.prototype._controlsClass): 2016-11-10 Carlos Garcia Campos <cgarcia@igalia.com> [Linux] Memory values shown by memory pressure handler logger are not useful https://bugs.webkit.org/show_bug.cgi?id=164589 Reviewed by Michael Catanzaro. We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the time we see that there's no changes in memory usage in the logs. We should use the actual memory used by the process, memory that the process can release and then it's relevant for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS - (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main different is that statm provides both resident and shared memory directly, but in number of pages, so we need to multiply by the size of the page. This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux memory sampler that is incorrectly parsing /proc/self/statm. * platform/Linux.cmake: Add new files to compilation. * platform/linux/CurrentProcessMemoryStatus.cpp: Added. (WebCore::systemPageSize): Return the page size. (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus. * platform/linux/CurrentProcessMemoryStatus.h: Added. * platform/linux/MemoryPressureHandlerLinux.cpp: (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process in bytes. (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage(). 2016-10-14 Carlos Garcia Campos <cgarcia@igalia.com> MemoryPressureHandler shouldn't know how to release WebCore memory https://bugs.webkit.org/show_bug.cgi?id=160497 Reviewed by Michael Catanzaro. All processes should set their own low memory handler, instead of leaving the web process using the default one that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer. * CMakeLists.txt: Add new files to compilation. * PlatformMac.cmake: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation(). * page/MemoryRelease.cpp: Added. (WebCore::releaseNoncriticalMemory): (WebCore::releaseCriticalMemory): (WebCore::releaseMemory): (WebCore::platformReleaseMemory): (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation): (WebCore::registerMemoryReleaseNotifyCallbacks): * page/MemoryRelease.h: Added. * page/cocoa/MemoryReleaseCocoa.mm: Added. (WebCore::platformReleaseMemory): (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation): (WebCore::registerMemoryReleaseNotifyCallbacks): * platform/MemoryPressureHandler.cpp: (WebCore::MemoryPressureHandler::MemoryPressureHandler): (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure): (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set. (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted. * platform/MemoryPressureHandler.h: (WebCore::MemoryPressureHandler::setLowMemoryHandler): (WebCore::MemoryPressureHandler::m_releaseMemoryBlock): * platform/cocoa/MemoryPressureHandlerCocoa.mm: (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly. (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted. * platform/linux/MemoryPressureHandlerLinux.cpp: * platform/win/MemoryPressureHandlerWin.cpp: (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly. 2016-11-08 Sergio Villar Senin <svillar@igalia.com> [css-grid] Fix fr tracks sizing under min|max-size constraints https://bugs.webkit.org/show_bug.cgi?id=150674 Reviewed by Darin Adler. The min|max-sizes must be used to compute the flex fraction for indefinite free spaces. According to the spec "If using this flex fraction would cause the grid to be smaller than the grid container’s min-width/height (or larger than the grid container’s max-width/height), then redo this step, treating the free space as definite and the available grid space as equal to the grid container’s content box size when it’s sized to its min-width/height (max-width/height)." This only affects indefinite heights because during layout both definite sizes and any kind of widths are properly constrained by min|max-width restrictions. Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html fast/css-grid-layout/flex-sizing-rows-min-max-height.html * rendering/RenderGrid.cpp: (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): (WebCore::RenderGrid::computeFlexSizedTracksGrowth): * rendering/RenderGrid.h: 2016-11-10 Alejandro G. Castro <alex@igalia.com> [WebRTC] [OpenWebRTC] RTX default parameters broken after r207952 https://bugs.webkit.org/show_bug.cgi?id=164541 Reviewed by Philippe Normand. Fixed typo in refactoring. * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::getDefaultVideoPayloads): 2016-11-08 Philippe Normand <pnormand@igalia.com> [WebRTC] white-list turns urls from the RTCConfiguration https://bugs.webkit.org/show_bug.cgi?id=164506 Reviewed by Alejandro G. Castro. * Modules/mediastream/RTCConfiguration.cpp: (WebCore::validateIceServerURL): Add the turns URL scheme to the list of supported relay and signaling server protocols. 2016-11-09 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness https://bugs.webkit.org/show_bug.cgi?id=161951 <rdar://problem/28295767> Reviewed by Brian Burg. Covered by existing tests that would ASSERT otherwise. * inspector/InspectorClient.cpp: (WebCore::InspectorClient::doDispatchMessageOnFrontendPage): When paused on an exception in the inspected page and evaluating commands in the inspector frontend page (which evaluates JavaScript) we ASSERT when entering the Global DOM VM with an existing exception. This makes it so when we evaluate JavaScript in the frontend we suspend / ignore the state of the VM for the inspected page, and restore it when we return from the inspector. 2016-11-09 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Associate Worker Resources with the Worker and not the Page https://bugs.webkit.org/show_bug.cgi?id=164342 <rdar://problem/29075775> Reviewed by Timothy Hatcher. Test: inspector/worker/resources-in-worker.html Provide a way to associate an initiator identifier with a ResourceRequest. This will allow Web Inspector to identify who started particular resource loads. This is important to associate Worker(...), importScript(...), and XMLHttpRequest / Fetch loads with that specific Worker. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setAsIsolatedCopy): * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::initiatorIdentifier): (WebCore::ResourceRequestBase::setInitiatorIdentifier): Optional initiator identifier. Currently used only be Web Inspector. * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::resourceRequestIdentifier): Non-page execution contexts, like WorkerGlobalScope, should provide a unique identifier that may be used to distinguish loads initiated from within that context. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): XHR / Fetch loads should include the ScriptExecutionContext's initiator identifier. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::WorkerScriptLoader): (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::createResourceRequest): * workers/WorkerScriptLoader.h: Provide a way to provide initiator identifier information for Worker script loads. Currently this is `new Worker(...)` and `importScripts(...)` resource loads. * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::create): * workers/Worker.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerGlobalScope.h: Give Worker itself the unique identifier, because `new Worker(...)` loads happen before the WorkerGlobalScript (ScriptExecutionContext) is actually created, but we want to associate it with this Worker. * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::create): (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope): * workers/DedicatedWorkerGlobalScope.h: * workers/DedicatedWorkerThread.cpp: (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): * workers/DedicatedWorkerThread.h: * workers/WorkerInspectorProxy.cpp: (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): * workers/WorkerInspectorProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerThread.cpp: (WebCore::WorkerThreadStartupData::WorkerThreadStartupData): (WebCore::WorkerThread::WorkerThread): (WebCore::WorkerThread::workerThread): * workers/WorkerThread.h: Pass the MainThread's Worker identifier through to the WorkerGlobalScope created on the WorkerThread. They should be the same identifier. * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::willSendRequest): * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::buildObjectForFrameTree): Pass the initiator identifier data to the frontend. This identifier is equivalent to a "target identifier" in the frontend. Currently the only non-Page targets are Workers. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache): When using the memory cache we create a new resource request. Be sure to copy over useful inspector data, like the initiator identifier, from the original request. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): When rebuilding a ResourceRequest from NSURLRequest, copy over the initiator identifier property that wouldn't otherwise have survived the transition. 2016-11-09 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Clean up some exception ordering. https://bugs.webkit.org/show_bug.cgi?id=164566 Reviewed by Alex Christensen. No new tests (Covered by existing tests). * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::advance): (WebCore::IDBCursor::continueFunction): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): 2016-11-09 Alex Christensen <achristensen@webkit.org> Unreviewed, rolling out r208438. crashes Reverted changeset: "[WK2][NETWORK_SESSION] Add support for downloading file backed blobs" https://bugs.webkit.org/show_bug.cgi?id=164458 http://trac.webkit.org/changeset/208438 2016-11-09 Said Abou-Hallawa <sabouhallawa@apple.com> Change the decoding for some animated images to be asynchronous https://bugs.webkit.org/show_bug.cgi?id=161566 Reviewed by Simon Fraser. Tests: fast/images/slower-animation-than-decoding-image.html fast/images/slower-decoding-than-animation-image.html fast/images/stopped-animation-deleted-image.html Request the next frame before firing the animation timer. The asynchronous image decoding work queue notifies the BitmapImage when the frame finishes decoding. If the timer fires before the frame is decoded, no repaint will be requested. Only when the image frame is ready, the animation will be advanced and the image will be repainted. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::load): Cache the image settings in CachedImage. (WebCore::CachedImage::createImage): No need to pass allowSubsampling to BitmapImage. It can be retrieved through Image::imageObserver(). (WebCore::CachedImage::changedInRect): Change the parameter to notifyObservers() to be a pointer. * loader/cache/CachedImage.h: Cache the settings: allowSubsampling, allowAsyncImageDecoding and showDebugBackground through m_loader. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::dataChanged): Fix a logging message. (WebCore::BitmapImage::draw): Store the current SubsamplingLevel to be used when requesting decoding the image of the next frame. Draw a debug rectangle if the next frame is missed because it is being decoded and the setting showDebugBackground is on. (WebCore::BitmapImage::startAnimation): Deleted. Moved to the header file. (WebCore::BitmapImage::internalStartAnimation): Added. Request asynchronous image decoding for the next frame if required. Return the result of starting the animation. (WebCore::BitmapImage::advanceAnimation): Call internalAdvanceAnimation() if the frame image is not being decoded. If it is being decoded and the setting showDebugBackground is on, force repaint so the debug rectangle is drawn. (WebCore::BitmapImage::internalAdvanceAnimation): This is the old body of advanceAnimation(). (WebCore::BitmapImage::stopAnimation): Stop the asynchronous image decoding if it is started. (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): This function is called from the async image decoding work queue when finishing decoding a native image frame. * platform/graphics/BitmapImage.h: (WebCore::BitmapImage::startAnimation): Added. It is now calls internalStartAnimation(). * platform/graphics/Color.h: Define a constant for the yellow color. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::clearMetadata): Delete unreferenced member. (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Return true if the frame is requested for async decoding. * platform/graphics/ImageFrameCache.h: * platform/graphics/ImageObserver.h: Add virtual functions for allowSubsampling, allowAsyncImageDecoding and showDebugBackground. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::maximumSubsamplingLevel): Move checking allowSubsampling() to the caller BitmapImage::draw(). * platform/graphics/ImageSource.h: Remove the setting allowSubsampling(); it can be retrieved from imageObserver(). (WebCore::ImageSource::setAllowSubsampling): Deleted. * rendering/RenderImageResource.cpp: (WebCore::RenderImageResource::shutdown): Stop the animation of an image when shutting down the resource. * rendering/RenderImageResourceStyleImage.cpp: (WebCore::RenderImageResourceStyleImage::shutdown): Ditto. svg/graphics/SVGImageClients.h: Change the parameter to ImageObserver::changedInRect() to be a pointer. (WebCore::SVGImageChromeClient::invalidateContentsAndRootView): * testing/Internals.cpp: (WebCore::Internals::setImageFrameDecodingDuration): Sets a fixed frame decoding duration for testing. * testing/Internals.h: * testing/Internals.idl: Adds an internal option for ImageFrameDecodingDuration. 2016-11-04 Brent Fulgham <bfulgham@apple.com> Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked https://bugs.webkit.org/show_bug.cgi?id=155185 <rdar://problem/11101440> Reviewed by Brady Eidson. Add a new quirk for localStorage that defaults to 'on'. When active, this quirk says that localStorage access should be granted, without needing to grant universal file access. If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly grants universal file access. Tests: storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html storage/domstorage/localstorage/blocked-file-access.html * dom/Document.cpp: (WebCore::Document::initSecurityContext): Set localStorage quirk mode based on settings. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): Use more C++11 initializers. (WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we are NOT in localStorage quirks mode, and we have not been granted universal file access, prevent access to DOM localStorage. (WebCore::SecurityOrigin::setNeedsLocalStorageQuirk): Added. * page/SecurityOrigin.h: (WebCore::SecurityOrigin::needsLocalStorageQuirk): Added. * page/Settings.in: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): Make sure Workers know what the localStorage quirks mode is set to. 2016-11-09 Alex Christensen <achristensen@webkit.org> URLParser should not consider path of URLs with no host to start at the first slash after the colon https://bugs.webkit.org/show_bug.cgi?id=164555 Reviewed by Tim Horton. When we see a url that is only scheme:// we treated the // as the path. Firefox did this with unrecognized schemes, but based on https://github.com/whatwg/url/issues/148 they seem willing to change. We had added similar behavior to URL::parse, and I added this to URLParser in r206783 which this effectively reverts. Covered by API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): Don't move m_userStart to m_pathStart back by two when we see an empty host. 2016-11-09 Alex Christensen <achristensen@webkit.org> Simplify logic of SecurityOrigin::databaseIdentifier https://bugs.webkit.org/show_bug.cgi?id=164565 Reviewed by Brady Eidson. No change in behavior. SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage. Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when making the database identifier, just determine whether we need this quirk when making the database identifier. I'm planning to move this logic to SecurityOriginData in another patch. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: 2016-11-09 Jaehun Lim <ljaehun.lim@samsung.com> Unreviewed, build fix after r208460 isValidColorString() was renamed isValidSimpleColorString(). * html/ColorInputType.cpp: (WebCore::ColorInputType::suggestions): 2016-11-09 Anders Carlsson <andersca@apple.com> Fix STP build. * WebCorePrefix.h: 2016-11-09 Simon Fraser <simon.fraser@apple.com> Implement visual-viewport based position:fixed handling for Mac async scrolling https://bugs.webkit.org/show_bug.cgi?id=164495 Reviewed by Tim Horton. Educate the scrolling tree about visual and layout viewports. This is runtime-switchable, so we push the enable flag to via the root state node, then push the layout viewport, and the min/max scroll position that contstrain it, through frame state nodes. When a scroll happens, we compute a new layout viewport when the visual viewport hits an edge, and push that down through setScrollLayerPosition() since it's used to position fixed and sticky layers. When the main thread gets notified about an async scroll, we set the new layout viewport on the FrameView, but do so in such a way that does not trigger layout. This is OK because we do a RenderLayer update which udpates all the layoutViewport-dependent state, and is necessary to avoid repaints every main thread update. The iOS code is made to compile, but not work yet. Tests: compositing/tiling/visiblerect-accumulated-offset.html fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up.html fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down.html fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html * page/FrameView.cpp: (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::scrollPositionChanged): * page/FrameView.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::visualViewportEnabled): * page/scrolling/AsyncScrollingCoordinator.h: (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate): * page/scrolling/ScrollingStateFrameScrollingNode.cpp: (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode): (WebCore::ScrollingStateFrameScrollingNode::setLayoutViewport): (WebCore::ScrollingStateFrameScrollingNode::setMinLayoutViewportOrigin): (WebCore::ScrollingStateFrameScrollingNode::setMaxLayoutViewportOrigin): (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): (WebCore::ScrollingStateFrameScrollingNode::dumpProperties): * page/scrolling/ScrollingStateFrameScrollingNode.h: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): (WebCore::ScrollingTree::commitTreeState): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::visualViewportEnabled): (WebCore::ScrollingTree::setVisualViewportEnabled): * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): * page/scrolling/ScrollingTreeFrameScrollingNode.h: (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport): (WebCore::ScrollingTreeFrameScrollingNode::minLayoutViewportOrigin): (WebCore::ScrollingTreeFrameScrollingNode::maxLayoutViewportOrigin): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition): * page/scrolling/ios/ScrollingTreeIOS.cpp: (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll): * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): 2016-11-09 Brady Eidson <beidson@apple.com> IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails. https://bugs.webkit.org/show_bug.cgi?id=164528 Reviewed by Alex Christensen. No new tests (Covered by existing test). * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::transaction): De-dupe the input names. 2016-11-09 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function. https://bugs.webkit.org/show_bug.cgi?id=164404 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/idbcursor-continue-primary-key-1-private.html storage/indexeddb/modern/idbcursor-continue-primary-key-1.html Also covered by existing tests. * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::continuePrimaryKey): (WebCore::IDBCursor::uncheckedIterateCursor): * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBCursor.idl: * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::operator>): (WebCore::IDBKeyData::operator<=): (WebCore::IDBKeyData::operator>=): * Modules/indexeddb/server/MemoryCursor.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor): * Modules/indexeddb/server/MemoryIndexCursor.cpp: (WebCore::IDBServer::MemoryIndexCursor::iterate): * Modules/indexeddb/server/MemoryIndexCursor.h: * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp: (WebCore::IDBServer::MemoryObjectStoreCursor::iterate): * Modules/indexeddb/server/MemoryObjectStoreCursor.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor): * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::iterate): * Modules/indexeddb/server/SQLiteIDBCursor.h: * Modules/indexeddb/shared/IDBIterateCursorData.cpp: (WebCore::IDBIterateCursorData::isolatedCopy): * Modules/indexeddb/shared/IDBIterateCursorData.h: (WebCore::IDBIterateCursorData::encode): (WebCore::IDBIterateCursorData::decode): 2016-11-09 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: set status label according to media state https://bugs.webkit.org/show_bug.cgi?id=164557 <rdar://problem/29184097> Reviewed by Dean Jackson. Correctly set the StatusLabel text based on the media loading and network state. Tests: http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html http/tests/media/modern-media-controls/status-support/status-support-loading.html media/modern-media-controls/status-support/status-support-error.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/status-support.js: Added. (StatusSupport.prototype.get control): (StatusSupport.prototype.get mediaEvents): (StatusSupport.prototype.syncControl): (StatusSupport): * WebCore.xcodeproj/project.pbxproj: 2016-11-09 Zalan Bujtas <zalan@apple.com> No need to set setFlowThreadState on RenderText in createTextRenderer. https://bugs.webkit.org/show_bug.cgi?id=164559 Reviewed by Antti Koivisto. setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to styleWillChange/styleDidChange through initializeStyle, the state is already set. However since RenderText does not have its own style, it's sufficient to have the flow state set through the normal RenderElement::insertChildInternal code path. No change in functionality. * style/RenderTreeUpdater.cpp: (WebCore::createTextRenderer): 2016-11-09 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion. https://bugs.webkit.org/show_bug.cgi?id=164504 Reviewed by Darin Adler. No new tests (Refactor, no behavior change). This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct. That struct will then be easily expandable in the future (e.g. bug 164404). * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::uncheckedIterateCursor): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::iterateCursor): (WebCore::IDBTransaction::iterateCursorOnServer): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::iterateCursor): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::iterateCursor): * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::iterateCursor): * Modules/indexeddb/server/IDBServer.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor): (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): * Modules/indexeddb/server/UniqueIDBDatabase.h: * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor): * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: * Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added. (WebCore::IDBIterateCursorData::isolatedCopy): * Modules/indexeddb/shared/IDBIterateCursorData.h: Added. (WebCore::IDBIterateCursorData::encode): (WebCore::IDBIterateCursorData::decode): * Modules/indexeddb/shared/InProcessIDBServer.cpp: (WebCore::InProcessIDBServer::iterateCursor): * Modules/indexeddb/shared/InProcessIDBServer.h: * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: 2016-11-09 Ryosuke Niwa <rniwa@webkit.org> StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change https://bugs.webkit.org/show_bug.cgi?id=129476 Reviewed by Andreas Kling. Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty when the attribute value didn't change as in r164856. * dom/StyledElement.cpp: (WebCore::StyledElement::attributeChanged): 2016-11-09 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Implement Node::ownerDocument https://bugs.webkit.org/show_bug.cgi?id=164004 Reviewed by Darin Adler. Test: js/dom/domjit-accessor-owner-document.html Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address. This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation, if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that document() won't return nullptr and access the member of it. This patch aligns the DOMJIT implementation strictly to the C++ one. * dom/Node.idl: * domjit/JSNodeDOMJIT.cpp: (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): 2016-11-09 Sam Weinig <sam@webkit.org> [SVG] Start moving special casing of SVG out of the bindings - SVGAngle https://bugs.webkit.org/show_bug.cgi?id=164496 Reviewed by Darin Adler. There is quite a bit of special casing of SVG types in the bindings that adds a lot of complexity and is relatively fragile, as it is based on type naming. Instead of keeping the complexity in the bindings, I am going to move it into the implementation, where it has also longed to be. Starting small, with just SVGAngle. It has been split in two, with the existing SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from SVGPropertyTearOff<SVGAngleValue>). * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: Add SVGAngleValue.cpp * bindings/scripts/CodeGenerator.pm: Remove SVGAngle as a special case. * svg/SVGAngle.cpp: Removed. * svg/SVGAngle.h: Added. Implements the SVGAngle interface explicitly, getting to the SVGAngleValue through propertyReference(). * svg/SVGAngle.idl: * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp. * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h. Move old SVGAngle implementation to SVGAngleValue. * svg/SVGAnimatedAngle.cpp: Replace SVGAngle usage with SVGAngleValue. * svg/SVGAnimatedAngle.h: Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle> as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter. * svg/SVGAnimatedLength.h: * svg/SVGAnimatedPreserveAspectRatio.h: * svg/SVGAnimatedRect.h: Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::createAngleAndEnumeration): * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::angleAndEnumeration): Use SVGAngleValue. * svg/SVGComponentTransferFunctionElement.h: Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff). * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::parseAttribute): (WebCore::SVGMarkerElement::setOrient): Switch to take an SVGAngleValue. (WebCore::SVGMarkerElement::setOrientToAngle): Update to pull the value out via propertyReference(). * svg/SVGMarkerElement.h: Switch to take an SVGAngleValue. * svg/SVGLengthList.h: * svg/SVGNumberList.h: * svg/SVGPathSegList.h: * svg/SVGPointList.h: * svg/SVGStringList.h: * svg/SVGTransformList.h: Switch to using type aliases in SVGPropertyTraits and add an alias for ListItemTearOff. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::createSVGAngle): * svg/SVGSVGElement.h: Change createSVGAngle to return a Ref<SVGAngle> and create one. * svg/SVGSVGElement.idl: Annotate IDL to indicate that a new value is being returned. * svg/SVGTransform.cpp: Remove unnecessary include of SVGAngle.h. * svg/SVGViewSpec.cpp: Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff). * svg/properties/SVGAnimatedPropertyTearOff.h: Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the Property type from the TearOffType. * svg/properties/SVGListProperty.h: * svg/properties/SVGListPropertyTearOff.h: Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits. * svg/properties/SVGPropertyTearOff.h: Make the PropertyType available by exposing it as a type alias. 2016-11-09 Darin Adler <darin@apple.com> Move Range from ExceptionCode to ExceptionOr https://bugs.webkit.org/show_bug.cgi?id=164457 Reviewed by Alex Christensen. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr, keeping behavior the same. (WebCore::characterOffsetsInOrder): Ditto. (WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a reference instead of a pointer. Use a boolean return value to indicate success rather than an exception, since the callers don't need to know which exception it is. (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for the above. (WebCore::AXObjectCache::nextBoundary): Ditto. (WebCore::AXObjectCache::previousBoundary): Ditto. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection): Update to use ExceptionOr, keeping behavior the same. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto. * accessibility/atk/WebKitAccessibleUtil.cpp: (selectionBelongsToObject): Ditto. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto. * dom/Node.cpp: (WebCore::Node::textRects): Ditto. * dom/Range.cpp: (WebCore::Range::~Range): Remove old comment that no longer makes sense now that the detach function no longer does anything. (WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr, keeping behavior the same. (WebCore::Range::setStart): Ditto. (WebCore::Range::setEnd): Ditto. (WebCore::Range::isPointInRange): Ditto. (WebCore::Range::comparePoint): Ditto. (WebCore::Range::compareNode): Ditto. (WebCore::top): Added helper function so that compareBoundaryPoints doesn't need to have two identical loops in it. (WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr, keeping behavior the same. (WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch instead of relying on the order of the values to check for unsupported values. (WebCore::Range::boundaryPointsValid): Ditto. (WebCore::Range::deleteContents): Ditto. (WebCore::Range::intersectsNode): Ditto. (WebCore::Range::processContents): Ditto. (WebCore::deleteCharacterData): Ditto. (WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a non-member function and private to this file instead of in the class. (WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr since the code relies on using it after mutating the DOM. (WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type to use ExceptionOr so the caller doesn't have to check the exception first. (WebCore::Range::extractContents): Ditto. (WebCore::Range::cloneContents): Ditto. (WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once instead of three times. (WebCore::Range::toString): Ditto. Also fixed to call nodeType only once per node instead of twice, to use downcast instead of static_cast, and to use the word "node" instead of "n" for the local variable name. (WebCore::Range::createContextualFragment): Ditto. (WebCore::Range::checkNodeWOffset): Ditto. (WebCore::Range::setStartAfter): Ditto. (WebCore::Range::setEndBefore): Ditto. (WebCore::Range::setEndAfter): Ditto. (WebCore::Range::selectNode): Ditto. (WebCore::Range::selectNodeContents): Ditto. (WebCore::Range::surroundContents): Ditto. (WebCore::Range::setStartBefore): Ditto. (WebCore::Range::contains): Ditto. Except added code to handle exception case to return false without asserting because I saw at least one crash that seemed to imply this behavior was needed. (WebCore::rangesOverlap): Ditto. (WebCore::rangeOfContents): Ditto. (WebCore::Range::expand): Ditto. (WebCore::Range::getClientRects): Ditto. (WebCore::Range::getBoundingClientRect): Ditto. (WebCore::Range::borderAndTextQuads): Changed to use return value instead of out argument, since it's a private function used only within this class so it was easy to update all call sites. (WebCore::Range::boundingRect): Updated for above. Also renamed since there was no need for the name "internal" in this. (WebCore::Range::absoluteBoundingRect): Ditto. * dom/Range.h: Updated for above. * dom/Range.idl: Use non-legacy exceptions. Also changed the default value of the string argument to the expand function to the empty string rather than "undefined", because the function silently does nothing when passed any unrecognized string, and so this leaves behavior unchanged. I removed the comment saying that the "undefined" default is wrong. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated to use ExceptionOr but behave the same. * editing/Editor.cpp: (WebCore::Editor::advanceToNextMisspelling): Ditto. (WebCore::Editor::markAndReplaceFor): Ditto. (WebCore::isFrameInRange): Ditto. Also made a few style tweaks. (WebCore::Editor::countMatchesForText): Ditto. * editing/EditorCommand.cpp: (WebCore::unionDOMRanges): Ditto. * editing/FrameSelection.cpp: (WebCore::FrameSelection::respondToNodeModification): Ditto. * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto. * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::offsetTo): Ditto. * editing/TextCheckingHelper.h: Updated for above and also deleted unneeded private function checkingRange, which just churned the reference count unnecessarily; instead use m_checkingRange directly. * editing/TextIterator.cpp: (WebCore::TextIterator::getLocationAndLengthFromRange): Ditto. * editing/VisiblePosition.cpp: (WebCore::setStart): Ditto. (WebCore::setEnd): Ditto. * editing/VisibleSelection.cpp: (WebCore::makeSearchRange): Ditto. * editing/VisibleUnits.cpp: (WebCore::suffixLengthForRange): Changed argument from RefPtr to a reference. (WebCore::prefixLengthForRange): Ditto. (WebCore::previousBoundary): Updated for ExceptionOr and the change above. (WebCore::nextBoundary): Ditto. * editing/VisibleUnits.h: Updated for above. * editing/htmlediting.cpp: (WebCore::comparePositions): Updated to use ExceptionOr but behave the same. (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto. (WebCore::isNodeVisiblyContainedWithin): Ditto. * editing/ios/EditorIOS.mm: (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto. (WebCore::Editor::setTextAsChildOfElement): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::adjustedSelectionRange): Ditto. * editing/markup.cpp: (WebCore::createMarkupInternal): Ditto. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Ditto. * page/DOMSelection.cpp: (WebCore::DOMSelection::addRange): Ditto. (WebCore::DOMSelection::deleteFromDocument): Ditto. (WebCore::DOMSelection::containsNode): Ditto. * page/EventHandler.cpp: (WebCore::EventHandler::dispatchMouseEvent): Updated for change to use ExceptionOr in Ragne::compareNode. Also refactored the function to make the logic a little mroe straightforward and nest less of it inside a loop. * page/Page.cpp: (WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr without changing behavior. * page/TextIndicator.cpp: (WebCore::hasNonInlineOrReplacedElements): Ditto. * rendering/RenderNamedFlowThread.cpp: (WebCore::RenderNamedFlowThread::getRanges): Ditto. 2016-11-09 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix grid layout parsing https://bugs.webkit.org/show_bug.cgi?id=164489 Reviewed by Dean Jackson. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFitContent): (WebCore::isGridTrackFixedSized): (WebCore::consumeGridTrackSize): (WebCore::consumeGridTrackRepeatFunction): (WebCore::consumeGridTrackList): (WebCore::isCustomIdentValue): (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand): (WebCore::CSSPropertyParser::consumeGridAreaShorthand): (WebCore::consumeImplicitGridAutoFlow): (WebCore::CSSPropertyParser::consumeGridShorthand): 2016-11-09 Darin Adler <darin@apple.com> Move EventTarget from ExceptionCode to ExceptionOr https://bugs.webkit.org/show_bug.cgi?id=164465 Reviewed by Youenn Fablet. * Modules/indexeddb/IDBRequest.h: Added now-needed forward class declarations. * Modules/webaudio/AudioContext.h: Ditto. * bindings/js/JSEventListener.cpp: (WebCore::eventHandlerAttribute): Updated for name change of the attributeEventListener function. (WebCore::documentEventHandlerAttribute): Ditto. * dom/Document.cpp: (WebCore::Document::getWindowAttributeEventListener): Ditto. * dom/EventTarget.cpp: (WebCore::EventTarget::setAttributeEventListener): Updated for name change. (WebCore::EventTarget::attributeEventListener): Ditto. (WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr. (WebCore::legacyType): Use null instead of empty for no type, since it's more efficient to check for null. (WebCore::EventTarget::fireEventListeners): Check for null. Also streamlined logic a little bit and removed a very old comment. (WebCore::EventTarget::eventListeners): Renamed from getEventListeners. * dom/EventTarget.h: Removed lots of unneeded declarations. Renamed some functions to remove get prefix. Updated for above changes. Moved one inline function out of the class header. Made the destructor for EventTarget be inline to make the destructors for derived classes slightly more efficient. * dom/EventTarget.idl: Use non-legacy exception. * dom/Node.cpp: (WebCore::Node::didMoveToNewDocument): Updated for name change. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplacementFragment::ReplacementFragment): Ditto. * inspector/InspectorCSSAgent.h: Added now-needed forward declaration. * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListeners): Updated for name change. * inspector/InspectorInstrumentation.h: Added now-needed forward declaration. * page/DOMWindow.h: Ditto. * xml/XMLHttpRequest.h: Ditto. 2016-11-09 Daniel Bates <dabates@apple.com> Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery https://bugs.webkit.org/show_bug.cgi?id=164389 <rdar://problem/29101072> Reviewed by Alex Christensen. Add test infrastructure to support registering an arbitrary port as the default port for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery, can be effected by whether the resource request was made using the default port for the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow a test to override the default port associated with a protocol so as to support testing these code paths using the existing port 8000 server started by run-webkit-httpd. Without window.internals.registerDefaultPortForProtocol() we would need to teach run-webkit-httpd to run a web server on port 80, which requires superuser privileges (since it is a privileged port number) and is more likely to interfere with an existing web server setup. Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html http/tests/security/http-0.9/default-port-script-blocked.html http/tests/security/http-0.9/iframe-blocked.html http/tests/security/http-0.9/image-blocked.html http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html http/tests/security/http-0.9/worker-connect-src-blocked.html http/tests/security/http-0.9/worker-importScripts-blocked.html http/tests/security/http-0.9/xhr-asynchronous-blocked.html * platform/URL.cpp: (WebCore::defaultPortForProtocolMapForTesting): Added. (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the mapping used for testing. (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map. We call this function from Internals::resetToConsistentState() so that the mapping is cleared between test runs. (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing before consulting URLParser::defaultPortForProtocol(). * platform/URL.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing. (WebCore::Internals::registerDefaultPortForProtocol): Added. * testing/Internals.h: * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol(). 2016-11-09 Sam Weinig <sam@webkit.org> [WebIDL] Add proper parsing for Promises https://bugs.webkit.org/show_bug.cgi?id=164497 Reviewed by Tim Horton. * bindings/scripts/IDLParser.pm: (parseNonAnyType): (parseStringType): Require Promise types to declare the type they resolve to. * bindings/js/JSDOMPromise.h: Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded overload of resolve that takes no arguments when in a DOMPromise<void>. * Modules/applepay/ApplePaySession.idl: * Modules/fetch/DOMWindowFetch.idl: * Modules/fetch/FetchBody.idl: * Modules/fetch/FetchResponse.idl: * Modules/fetch/WorkerGlobalScopeFetch.idl: * Modules/mediastream/MediaDevices.idl: * Modules/mediastream/MediaStreamTrack.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCStatsReport.idl: * Modules/streams/ReadableStream.idl: * Modules/streams/ReadableStreamDefaultReader.idl: * Modules/streams/ReadableStreamSource.idl: * Modules/streams/WritableStream.idl: * Modules/webaudio/AudioContext.idl: * bindings/scripts/test/TestNode.idl: * bindings/scripts/test/TestObj.idl: * crypto/SubtleCrypto.idl: * crypto/WebKitSubtleCrypto.idl: * css/FontFace.idl: * css/FontFaceSet.idl: * dom/CustomElementRegistry.idl: * html/HTMLMediaElement.idl: Update IDLs to specify the resolve type of promise types. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::replaceTrack): (WebCore::MediaEndpointPeerConnection::replaceTrackTask): * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::applyConstraints): * Modules/mediastream/MediaStreamTrack.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded): (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded): (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): * Modules/mediastream/PeerConnectionBackend.h: * Modules/streams/ReadableStreamSource.h: (WebCore::ReadableStreamSource::start): (WebCore::ReadableStreamSource::pull): (WebCore::ReadableStreamSource::startFinished): (WebCore::ReadableStreamSource::pullFinished): * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::addReaction): (WebCore::AudioContext::setState): (WebCore::AudioContext::suspend): (WebCore::AudioContext::resume): (WebCore::AudioContext::close): * Modules/webaudio/AudioContext.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::rejectPendingPlayPromises): (WebCore::HTMLMediaElement::resolvePendingPlayPromises): (WebCore::HTMLMediaElement::play): * html/HTMLMediaElement.h: Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t> and use the new resolve() overload. 2016-11-07 Brady Eidson <beidson@apple.com> Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction& Rubberstamped by Alex Christensen. No new tests (No behavior change). * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::IDBObjectStore): (WebCore::IDBObjectStore::~IDBObjectStore): (WebCore::IDBObjectStore::hasPendingActivity): (WebCore::IDBObjectStore::name): (WebCore::IDBObjectStore::setName): (WebCore::IDBObjectStore::keyPath): (WebCore::IDBObjectStore::indexNames): (WebCore::IDBObjectStore::transaction): (WebCore::IDBObjectStore::autoIncrement): (WebCore::IDBObjectStore::openCursor): (WebCore::IDBObjectStore::openKeyCursor): (WebCore::IDBObjectStore::get): (WebCore::IDBObjectStore::putOrAdd): (WebCore::IDBObjectStore::doDelete): (WebCore::IDBObjectStore::clear): (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::doCount): (WebCore::IDBObjectStore::getAll): (WebCore::IDBObjectStore::getAllKeys): (WebCore::IDBObjectStore::markAsDeleted): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::ref): (WebCore::IDBObjectStore::deref): * Modules/indexeddb/IDBObjectStore.h: 2016-11-09 Zalan Bujtas <zalan@apple.com> Move RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater. https://bugs.webkit.org/show_bug.cgi?id=164503 Reviewed by Antti Koivisto. When we insert a renderer into the render tree, we need to know both its parent and its next sibling. Normally the parent and the sibling are based on the DOM, but when this renderer is part of a flow thread, its insertion sibling is not necessarily the DOM sibling. To find the correct sibling, we call RenderNamedFlowThread's nextRendererForElement(). RenderNamedFlowThread keeps track of its children so that it can compute the next sibling for the insertion point. This patch eliminates the need for keeping track of the child renderers of each flow by moving the 'next sibling' logic to RenderTreePosition. No change in functionality. * rendering/RenderElement.cpp: (WebCore::RenderElement::insertedIntoTree): (WebCore::RenderElement::willBeDestroyed): (WebCore::RenderElement::removeFromRenderFlowThread): (WebCore::RenderElement::renderNamedFlowThreadWrapper): Deleted. * rendering/RenderElement.h: * rendering/RenderNamedFlowThread.cpp: (WebCore::RenderNamedFlowThread::nextRendererForElement): Deleted. (WebCore::RenderNamedFlowThread::addFlowChild): Deleted. (WebCore::RenderNamedFlowThread::removeFlowChild): Deleted. * rendering/RenderNamedFlowThread.h: * style/RenderTreePosition.cpp: (WebCore::RenderTreePosition::previousSiblingRenderer): (WebCore::RenderTreePosition::flowThreadInsertionContext): * style/RenderTreePosition.h: (WebCore::RenderTreePosition::RenderTreePosition): (WebCore::RenderTreePosition::parent): * style/RenderTreeUpdater.cpp: (WebCore::registerElementForFlowThreadIfNeeded): We need to registed the element even when it does not create renderer (display: none). (WebCore::RenderTreeUpdater::createRenderer): (WebCore::moveToFlowThreadIfNeeded): Deleted. 2016-11-09 Per Arne Vollan <pvollan@apple.com> [Win][Direct2D] Incomplete image decoding. https://bugs.webkit.org/show_bug.cgi?id=164511 Reviewed by Darin Adler. Create native decoder when all image data has been received. * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::setData): 2016-11-09 Beth Dakin <bdakin@apple.com> Attempted build fix. * platform/spi/cocoa/AVKitSPI.h: 2016-11-09 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index/ObjectStore lifetime. https://bugs.webkit.org/show_bug.cgi?id=164466 Reviewed by Alex Christensen. No new tests (Covered by existing tests that now pass). Previously, IDBIndex ref/deref didn't track a traditional ref count but instead kept the owning object store alive. Now, IDBObjectStore ref/deref do the same thing for the owning transaction. Now when a version change transaction is rolled back, some object stores and indexes get pulled out of the "deleted" set and get promoted back up into the "referenced" set. Now deleted object stores/indexes are considered opaque roots, as live objects in the deleted state *can* get back to the owning objects. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::IDBObjectStore): (WebCore::IDBObjectStore::indexNames): (WebCore::IDBObjectStore::transaction): (WebCore::IDBObjectStore::openCursor): (WebCore::IDBObjectStore::openKeyCursor): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes): (WebCore::IDBObjectStore::ref): (WebCore::IDBObjectStore::deref): (WebCore::IDBObjectStore::create): Deleted. * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::transitionedToFinishing): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/IDBTransaction.idl: * bindings/js/JSIDBTransactionCustom.cpp: Added. (WebCore::JSIDBTransaction::visitAdditionalChildren): 2016-11-09 Simon Fraser <simon.fraser@apple.com> Allow customization of TextStream-based logging for geometry types https://bugs.webkit.org/show_bug.cgi?id=164460 Reviewed by Zalan Bujtas. TextStream-based logging was constrained by the requirement to maintain compatibility with DRT-style output, which includes cumbersome rect logging ("at (5,0) size 40x40") and dumping LayoutRects as IntRects. Add some formatting flags so that other TextStream clients (e.g. logging) can have more readable output, and opt into automatic FormatNumberRespectingIntegers behavior. TextStreams whose output appears in test results are given flags to avoid behavior changes, but in the longer term test results should be updated. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::replayDisplayListAsText): * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::scrollingStateTreeAsText): * platform/graphics/FloatPoint.cpp: (WebCore::operator<<): * platform/graphics/FloatRect.cpp: (WebCore::operator<<): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::layerTreeAsText): * platform/graphics/IntRect.cpp: (WebCore::operator<<): * platform/graphics/LayoutPoint.cpp: (WebCore::operator<<): * platform/graphics/LayoutRect.cpp: (WebCore::operator<<): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::replayDisplayListAsText): * platform/graphics/displaylists/DisplayList.cpp: (WebCore::DisplayList::DisplayList::asText): * platform/text/TextStream.cpp: (WebCore::TextStream::operator<<): * platform/text/TextStream.h: (WebCore::TextStream::TextStream): (WebCore::TextStream::formattingFlags): (WebCore::TextStream::setFormattingFlags): (WebCore::TextStream::hasFormattingFlag): (WebCore::TextStream::increaseIndent): (WebCore::TextStream::decreaseIndent): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): (WebCore::counterValueForElement): 2016-11-09 Zalan Bujtas <zalan@apple.com> RenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead of RenderObject* https://bugs.webkit.org/show_bug.cgi?id=164543 Reviewed by Simon Fraser. No change in functionality. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::removeChild): * rendering/RenderFlowThread.h: * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval): (WebCore::RenderMultiColumnFlowThread::flowThreadRelativeWillBeRemoved): * rendering/RenderMultiColumnFlowThread.h: 2016-11-09 Jer Noble <jer.noble@apple.com> REGRESSION (r208149): Media scrubber is not displayed in media controls https://bugs.webkit.org/show_bug.cgi?id=164514 Reviewed by Darin Adler. Fixes broken Media Controls API tests. Added a new PlatformMediaSessionType; need to add that same type to the TYPE_TRAITS section of MediaElementSession.h so that is<> and downcast<> work correctly. * html/MediaElementSession.h: (isType): 2016-11-09 Wenson Hsieh <wenson_hsieh@apple.com> When editing IME, `compositionend` events should fire after input events https://bugs.webkit.org/show_bug.cgi?id=164324 <rdar://problem/29050438> Reviewed by Darin Adler. Moves where we dispatch `compositionend` events to after applying editing commands that fire `beforeinput` or `input` events. Also augments existing layout tests to verify the change. * editing/Editor.cpp: (WebCore::Editor::setComposition): 2016-11-09 Wenson Hsieh <wenson_hsieh@apple.com> Setting foreground color when text is selected should fire an input event with color data https://bugs.webkit.org/show_bug.cgi?id=164241 <rdar://problem/29032759> Reviewed by Darin Adler. Refactors Editor::applyStyle and Editor::applyParagraphStyle to handle beforeinput and input event dispatch. Instead of going through the ApplyStyleCommand to dispatch input events, override shouldDispatchInputEvents to return false. This strategy also has the effect of unifying the way input events are dispatched in applyStyle, in both codepaths where we computeAndSetTypingStyle and where we create and then apply a style command. Test: fast/events/input-events-selection-forecolor-data.html * editing/ApplyStyleCommand.h: * editing/Editor.cpp: (WebCore::inputEventDataForEditingStyleAndAction): (WebCore::Editor::applyStyle): (WebCore::Editor::applyParagraphStyle): (WebCore::Editor::computeAndSetTypingStyle): 2016-11-08 Dean Jackson <dino@apple.com> Rendering support for ExtendedColors https://bugs.webkit.org/show_bug.cgi?id=164443 <rdar://problems/29123243> Reviewed by Simon Fraser and Darin Adler. Add support for rendering the new color() syntax, which ends up as an ExtendedColor. In order to make rendering code a little more readable, I changed Color::hasAlpha to Color::isOpaque (since an alpha of 100% is still an alpha), and added a Color::isVisible helper (the color isn't completely transparent). These new helpers support ExtendedColor forms. Support for painting gradients and blending between colors is still to come. I also added some FIXME comments to show other places that don't handle ExtendedColors yet. Tests: css3/color/backgrounds-and-borders.html css3/color/box-shadows.html css3/color/canvas.html css3/color/composited-solid-backgrounds.html css3/color/text.html * css/CSSGradientValue.cpp: Add some notes that this is broken. (WebCore::interpolate): (WebCore::CSSGradientValue::knownToBeOpaque): * editing/EditingStyle.cpp: Use new Color helpers. (WebCore::isTransparentColorValue): * editing/mac/EditorMac.mm: Use new Color helpers. (WebCore::Editor::fontAttributesForSelectionStart): * html/ColorInputType.cpp: No need to use the Color class at all here. (WebCore::isValidSimpleColorString): Renamed from isValidColorString. (WebCore::ColorInputType::sanitizeValue): (WebCore::ColorInputType::typeMismatchFor): (WebCore::isValidColorString): Deleted. * html/canvas/CanvasRenderingContext2D.cpp: New helpers. (WebCore::CanvasRenderingContext2D::shouldDrawShadows): (WebCore::CanvasRenderingContext2D::didDraw): * page/FrameView.cpp: Ditto. (WebCore::FrameView::recalculateScrollbarOverlayStyle): (WebCore::FrameView::hasOpaqueBackground): (WebCore::FrameView::setBaseBackgroundColor): * platform/graphics/Color.cpp: (WebCore::differenceSquared): Support ExtendedColor, but also add a note to indicate that this method and its call sites should use floats. (WebCore::Color::serialized): New helper. (WebCore::Color::cssText): Ditto. (WebCore::Color::blend): Ditto. (WebCore::Color::blendWithWhite): (WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function. (WebCore::Color::colorWithAlpha): Ditto. (WebCore::Color::opaqueColor): New method to return an opaque version of the given color. (WebCore::blend): * platform/graphics/Color.h: (WebCore::Color::isOpaque): New helper that is !hasAlpha(). (WebCore::Color::isVisible): New helper. (WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces a bunch of places that were calculating it manually each time. Meanwhile, we might consider always exposing the primaries as floats... or at least have that option. (WebCore::isBlackColor): New helper - it was used in a couple of places. (WebCore::isWhiteColor): Ditto. (WebCore::Color::hasAlpha): Deleted. * platform/graphics/Gradient.cpp: Add FIXME. (WebCore::Gradient::addColorStop): * platform/graphics/Gradient.h: * platform/graphics/GraphicsContext.cpp: Use new helpers. (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::hasVisibleShadow): * platform/graphics/Image.cpp: Ditto. (WebCore::Image::fillWithSolidColor): * platform/graphics/ShadowBlur.cpp: Ditto. (WebCore::ShadowBlur::updateShadowBlurValues): * platform/graphics/ca/GraphicsLayerCA.cpp: Ditto. (WebCore::GraphicsLayerCA::setContentsToSolidColor): * platform/graphics/cg/GradientCG.cpp: (WebCore::Gradient::platformGradient): Add a FIXME to note that we can add ExtendedColor support simply by using CGColors, rather than fetching the components ourselves. * platform/graphics/cg/GraphicsContextCG.cpp: New helpers. (WebCore::calculateDrawingMode): * platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers. (WebCore::FontCascade::drawGlyphs): * platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash(). (WebCore::nsColor): * platform/graphics/texmap/TextureMapperGL.cpp: New helpers. (WebCore::TextureMapperGL::drawBorder): * rendering/BorderEdge.cpp: Ditto. (WebCore::BorderEdge::obscuresBackgroundEdge): (WebCore::BorderEdge::obscuresBackground): * rendering/RenderBox.cpp: Ditto. (WebCore::RenderBox::getBackgroundPaintedExtent): (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): (WebCore::RenderBox::backgroundHasOpaqueTopLayer): * rendering/RenderBoxModelObject.cpp: Ditto. (WebCore::RenderBoxModelObject::paintFillLayerExtended): (WebCore::colorNeedsAntiAliasAtCorner): (WebCore::willBeOverdrawn): (WebCore::RenderBoxModelObject::paintTranslucentBorderSides): (WebCore::RenderBoxModelObject::paintBorder): (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): (WebCore::RenderBoxModelObject::paintBoxShadow): * rendering/RenderElement.cpp: (WebCore::RenderElement::paintOutline): * rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutline): * rendering/RenderLayerBacking.cpp: (WebCore::canCreateTiledImage): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::viewHasTransparentBackground): * rendering/RenderMenuList.cpp: (RenderMenuList::getItemBackgroundColor): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor): * rendering/RenderView.cpp: (WebCore::RenderView::paintBoxDecorations): * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::paintTextDecoration): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextWithShadows): * rendering/style/BorderValue.h: (WebCore::BorderValue::isTransparent): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::visitedDependentColor): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasBackground): * rendering/svg/RenderSVGResource.cpp: (WebCore::requestPaintingResource): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paintSelectionBackground): * svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken. (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): 2016-11-09 Antoine Quint <graouts@apple.com> [Modern Media Controls] UI Library: StatusLabel https://bugs.webkit.org/show_bug.cgi?id=164544 <rdar://problem/29179541> Reviewed by Dean Jackson. We add a new StatusLabel class to display a string of text in place of the TimeControl. A followup patch will add the logic to display "Error", "Loading" and "Live Broadcast" test under the right media state. Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-status-label.html media/modern-media-controls/status-label/status-label.html * Modules/modern-media-controls/controls/macos-inline-media-controls.css: (.media-controls.mac.inline .time-label,): (.media-controls.mac.inline .time-label): Deleted. * Modules/modern-media-controls/controls/macos-inline-media-controls.js: (MacOSInlineMediaControls.prototype.layout): * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.): * Modules/modern-media-controls/controls/status-label.css: Added. (.status-label): * Modules/modern-media-controls/controls/status-label.js: Added. (StatusLabel.prototype.get text): (StatusLabel.prototype.set text): (StatusLabel.prototype.commitProperty): * Modules/modern-media-controls/js-files: * WebCore.xcodeproj/project.pbxproj: 2016-11-09 Chris Dumez <cdumez@apple.com> [Mac] Stop using deprecated AppKit enumeration values https://bugs.webkit.org/show_bug.cgi?id=164494 Reviewed by Darin Adler. Stop using deprecated AppKit enumeration values. * editing/cocoa/HTMLConverter.mm: (HTMLConverter::computedAttributesForElement): (HTMLConverter::_processElement): (HTMLConverter::_addMarkersToList): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::keyEvent): (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::passSubframeEventToSubframe): (WebCore::EventHandler::widgetDidHandleWheelEvent): (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * page/mac/TextIndicatorWindow.mm: (WebCore::TextIndicatorWindow::setTextIndicator): * platform/graphics/mac/IconMac.mm: (WebCore::Icon::paint): * platform/mac/CursorMac.mm: (WebCore::createCustomCursor): * platform/mac/DragImageMac.mm: (WebCore::dissolveDragImageToFraction): (WebCore::createDragImageFromImage): * platform/mac/EventLoopMac.mm: (WebCore::EventLoop::cycle): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::setDragImage): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::globalPointForEvent): (WebCore::pointForEvent): (WebCore::mouseButtonForEvent): (WebCore::mouseEventTypeForEvent): (WebCore::clickCountForEvent): (WebCore::isKeypadEvent): (WebCore::windowsKeyCodeForKeyEvent): (WebCore::isKeyUpEvent): (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): * platform/mac/ScrollbarThemeMac.mm: (WebCore::scrollbarControlSizeToNSControlSize): * platform/mac/ThemeMac.mm: (-[WebCoreThemeView window]): (WebCore::controlSizeForFont): (WebCore::controlSizeFromPixelSize): (WebCore::setUpButtonCell): (WebCore::stepperControlSizeForFont): (WebCore::paintStepper): (WebCore::ThemeMac::minimumControlSize): * platform/mac/WebVideoFullscreenHUDWindowController.mm: (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]): (-[WebVideoFullscreenHUDWindow performKeyEquivalent:]): (-[WebVideoFullscreenHUDWindowController init]): (-[WebVideoFullscreenHUDWindowController keyDown:]): (-[WebVideoFullscreenHUDWindowController windowDidLoad]): * platform/mac/WebWindowAnimation.mm: (WebWindowAnimationDurationFromDuration): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::updateCachedSystemFontDescription): (WebCore::RenderThemeMac::controlSizeForFont): (WebCore::RenderThemeMac::controlSizeForCell): (WebCore::RenderThemeMac::controlSizeForSystemFont): (WebCore::RenderThemeMac::paintProgressBar): (WebCore::RenderThemeMac::popupMenuSize): (WebCore::RenderThemeMac::sliderThumbHorizontal): (WebCore::RenderThemeMac::sliderThumbVertical): 2016-11-08 Antoine Quint <graouts@apple.com> [Modern Media Controls] UI Library: iOS inline controls https://bugs.webkit.org/show_bug.cgi?id=164513 <rdar://problem/27989475> Reviewed by Dean Jackson. We introduce a new IOSInlineMediaControls class which can be used to instantiate media controls for inline playback on iOS. Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-constructor.html media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-layout.html media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-time-control-styles.html media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html * Modules/modern-media-controls/controls/ios-inline-media-controls.css: Added. (.media-controls.ios.inline > .controls-bar): (.media-controls.ios.inline .time-control): (.media-controls.ios.inline button): (.media-controls.ios.inline button:active): (.media-controls.ios.inline > .controls-bar button): (.media-controls.ios.inline .buttons-container.right): (.media-controls.ios.inline button.play-pause): (.media-controls.ios.inline button.skip-back): (.media-controls.ios.inline .scrubber.slider): (.media-controls.ios.inline button.airplay): (.media-controls.ios.inline button.pip): (.media-controls.ios.inline button.fullscreen): (.media-controls.ios.inline .time-label): (.media-controls.ios.inline .scrubber.slider > .fill): (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb): * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Added. (IOSInlineMediaControls.prototype.layout): (IOSInlineMediaControls): * Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Added. * Modules/modern-media-controls/js-files: * WebCore.xcodeproj/project.pbxproj: 2016-11-09 Beth Dakin <bdakin@apple.com> Support TouchBar in WebKit https://bugs.webkit.org/show_bug.cgi?id=164437 -and corresponding- rdar://problem/28876524 Reviewed by Darin Adler. * WebCore.xcodeproj/project.pbxproj: * platform/spi/cocoa/AVKitSPI.h: * platform/spi/cocoa/NSTouchBarSPI.h: Added. * platform/spi/mac/NSSpellCheckerSPI.h: 2016-11-09 Chris Dumez <cdumez@apple.com> Use Blob URL instead of webkit-fake-url when pasting an image https://bugs.webkit.org/show_bug.cgi?id=49141 Reviewed by Darin Adler. Use Blob URL instead of webkit-fake-url when pasting an image. Tests: editing/pasteboard/paste-image-as-blob-url.html editing/pasteboard/paste-image-using-image-data.html * editing/Editor.h: * editing/mac/EditorMac.mm: (WebCore::Editor::WebContentReader::readImage): (WebCore::Editor::createFragmentForImageAndURL): 2016-11-09 Michael Catanzaro <mcatanzaro@igalia.com> Fix error message when SQLite initialization fails https://bugs.webkit.org/show_bug.cgi?id=164462 Reviewed by Darin Adler. * platform/sql/SQLiteDatabase.cpp: (WebCore::initializeSQLiteIfNecessary): 2016-11-08 Antoine Quint <graouts@apple.com> [Modern Media Controls] UI Library: macOS fullscreen controls https://bugs.webkit.org/show_bug.cgi?id=164414 <rdar://problem/27989474> Reviewed by Dean Jackson. We introduce a new MacOSFullscreenMediaControls class which can be used to instantiate media controls for fullscreen playback on macOS. These controls can be dragged by the user. Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-right-container-margin.html media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-styles.html * Modules/modern-media-controls/controls/button.js: (Button.prototype.set enabled): Correctly notify the layoutDelegate when the enabled property changes, regardless of whether the flag is on. * Modules/modern-media-controls/controls/icon-button.js: (IconButton.prototype._updateImage): (IconButton): Correctly notify the layout delegate when the image metrics have changed so that it may perform a layout. This issues became apparent with the new tests on Yosemite and caused some flakyness. * Modules/modern-media-controls/controls/icon-service.js: (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits): (const.iconService.new.IconService): Fix a typo. * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: Added. (.media-controls.mac.fullscreen > .controls-bar): (.media-controls.mac.fullscreen .volume.slider): (.media-controls.mac.fullscreen .buttons-container): (.media-controls.mac.fullscreen .buttons-container.center): (.media-controls.mac.fullscreen > .controls-bar button): (.media-controls.mac.fullscreen button.rewind): (.media-controls.mac.fullscreen button.play-pause): (.media-controls.mac.fullscreen button.forward): (.media-controls.mac.fullscreen .buttons-container.right): (.media-controls.mac.fullscreen button.airplay): (.media-controls.mac.fullscreen button.aspect-ratio): (.media-controls.mac.fullscreen button.pip): (.media-controls.mac.fullscreen button.tracks): (.media-controls.mac.fullscreen button.fullscreen): (.media-controls.mac.fullscreen .time-control): (.media-controls.mac.fullscreen .time-label): (.media-controls.mac.fullscreen .scrubber): * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Added. (MacOSFullscreenMediaControls.prototype.layout): (MacOSFullscreenMediaControls): * Modules/modern-media-controls/controls/macos-media-controls.js: (MacOSMediaControls): Allow the layoutTraits property to be set to something other than just LayoutTraits.macOS so that MacOSFullscreenMediaControls may set the LayoutTraits.Fullscreen bit. * Modules/modern-media-controls/js-files: Add a reference to the new macos-fullscreen-media-controls.js file. * WebCore.xcodeproj/project.pbxproj: Add references to the new macos-fullscreen-media-controls.js and macos-fullscreen-media-controls.css files. 2016-11-09 Chris Dumez <cdumez@apple.com> Shave 16 bytes off HTMLInputElement https://bugs.webkit.org/show_bug.cgi?id=164488 Reviewed by Sam Weinig. Shave 16 bytes off HTMLInputElement (232 -> 216) by packing data members better. * html/HTMLFormControlElement.h: * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement): * html/HTMLTextFormControlElement.h: 2016-11-09 Youenn Fablet <youenn@apple.com> [WebRTC] Introduce asynchronous backend for other RTCPeerConnection API https://bugs.webkit.org/show_bug.cgi?id=164409 Reviewed by Eric Carlson. Covered by existing tests. Following on createOffer changes, applying the same changes to createAnswer, setLocalDescription, setRemoteDescription and addIceCandidate. Also refactored ICE candidate event generation (done at PeerConnectionBackend). Updated stop implementation to clean any promise that may be stored in PeerConnectionBackend. The goal of this is to be more aligned with https://www.w3.org/TR/webrtc/. Implementation of the various functions such as //www.w3.org/TR/webrtc/#set-description would be done in PeerConnectionBackend. This will require additional code moved from MediaEndpointPeerConnection up to PeerConnectionBackend. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::createOfferTask): (WebCore::MediaEndpointPeerConnection::doCreateAnswer): (WebCore::MediaEndpointPeerConnection::createAnswerTask): (WebCore::MediaEndpointPeerConnection::doSetLocalDescription): (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): (WebCore::MediaEndpointPeerConnection::doSetRemoteDescription): (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): (WebCore::MediaEndpointPeerConnection::doAddIceCandidate): (WebCore::MediaEndpointPeerConnection::addIceCandidateTask): (WebCore::MediaEndpointPeerConnection::doStop): (WebCore::MediaEndpointPeerConnection::gotIceCandidate): (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates): (WebCore::MediaEndpointPeerConnection::createAnswer): Deleted. (WebCore::MediaEndpointPeerConnection::setLocalDescription): Deleted. (WebCore::MediaEndpointPeerConnection::setRemoteDescription): Deleted. (WebCore::MediaEndpointPeerConnection::addIceCandidate): Deleted. (WebCore::MediaEndpointPeerConnection::stop): Deleted. (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): Deleted. (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): Deleted. * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOffer): (WebCore::PeerConnectionBackend::createOfferFailed): (WebCore::PeerConnectionBackend::createAnswer): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::createAnswerFailed): (WebCore::isLocalDescriptionTypeValidForState): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded): (WebCore::PeerConnectionBackend::setLocalDescriptionFailed): (WebCore::isRemoteDescriptionTypeValidForState): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded): (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed): (WebCore::PeerConnectionBackend::addIceCandidate): (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): (WebCore::PeerConnectionBackend::addIceCandidateFailed): (WebCore::PeerConnectionBackend::fireICECandidateEvent): (WebCore::PeerConnectionBackend::doneGatheringCandidates): (WebCore::PeerConnectionBackend::stop): * Modules/mediastream/PeerConnectionBackend.h: 2016-11-09 Eric Carlson <eric.carlson@apple.com> [MediaStream][Mac] Mark captured video frames as ready for display immediately https://bugs.webkit.org/show_bug.cgi?id=164482 <rdar://problem/29139073> Reviewed by Jer Noble. * platform/cf/CoreMediaSoftLink.cpp: Add new constant. * platform/cf/CoreMediaSoftLink.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData): New, ask register for a callback when the sample buffer display layer is ready for more media data. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Don't change the sample timestamps, assume the caller has configured the sample correctly. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Don't drop frames when the display layer isn't ready. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Call stopRequestingMediaData. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Deleted. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::setupCaptureSession): Tell the video output to always discard late video frames, we don't need them. (WebCore::AVVideoCaptureSource::processNewFrame): Add a kCMSampleAttachmentKey_DisplayImmediately attachment. 2016-11-09 Joanmarie Diggs <jdiggs@igalia.com> AX: [ATK] Wrong selected element at a given index in a list box (redux) https://bugs.webkit.org/show_bug.cgi?id=164430 Reviewed by Darin Adler. This essentially undoes the implementation change resulting from r164577. As stated in the ATK documentation, atk_selection_ref_selection() takes "a gint specifying the index in the selection set. (e.g. the ith selection as opposed to the ith child)." r164577 deliberately modified that, causing atk_selection_ref_selection() to treat the index as if it were the position with respect to all of the children. There is different API in ATK, namely atk_object_ref_accessible_child(), when the ith child from the set of all children is sought. Tests: accessibility/aria-listbox-no-selection.html accessibility/native-listbox-no-selection.html * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (optionFromSelection): 2016-11-09 Gyuyoung Kim <gyuyoung.kim@webkit.org> [EFL] Use libgcrypt instead of GnuTLS for CryptoDigest https://bugs.webkit.org/show_bug.cgi?id=164461 Reviewed by Michael Catanzaro. As GTK port in r208297, EFL port starts to use libgcrypt instead of GnuTLS as well. No new tests, no behavior change. * PlatformEfl.cmake: 2016-11-09 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208422. Roll r208382 back in since it was not responsible for the API test failures seen on macOS. Reverted changeset: "Unreviewed, rolling out r208382." https://bugs.webkit.org/show_bug.cgi?id=164319 http://trac.webkit.org/changeset/208422 2016-11-09 Csaba Osztrogonác <ossy@webkit.org> One more URTBF after r208361. * PlatformMac.cmake: 2016-11-09 Csaba Osztrogonác <ossy@webkit.org> Typo fix after r162782 https://bugs.webkit.org/show_bug.cgi?id=164473 Unreviewed trivial fix. * platform/ThreadGlobalData.cpp: 2016-11-07 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208382. This change appears to have caused 3 SerializedCryptoKeyWrapTest API tests to fail on macOS. Reverted changeset: "[Readable Streams API] Implement ByteStreamController error()" https://bugs.webkit.org/show_bug.cgi?id=164319 http://trac.webkit.org/changeset/208382 2016-11-04 Filip Pizlo <fpizlo@apple.com> WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows https://bugs.webkit.org/show_bug.cgi?id=152045 Reviewed by Andy Estes. No new layout tests because no new behavior. The new WTF time classes have some unit tests in TestWebKitAPI. * fileapi/ThreadableBlobRegistry.cpp: (WebCore::ThreadableBlobRegistry::blobSize): * platform/MainThreadSharedTimer.h: * platform/SharedTimer.h: * platform/ThreadTimers.cpp: (WebCore::ThreadTimers::updateSharedTimer): * platform/cf/MainThreadSharedTimerCF.cpp: (WebCore::MainThreadSharedTimer::setFireInterval): * platform/efl/MainThreadSharedTimerEfl.cpp: (WebCore::MainThreadSharedTimer::setFireInterval): * platform/glib/MainThreadSharedTimerGLib.cpp: (WebCore::MainThreadSharedTimer::setFireInterval): * platform/win/MainThreadSharedTimerWin.cpp: (WebCore::MainThreadSharedTimer::setFireInterval): * workers/WorkerRunLoop.cpp: (WebCore::WorkerRunLoop::runInMode): 2016-11-04 Zalan Bujtas <zalan@apple.com> RenderFlowThread state reset cleanup. https://bugs.webkit.org/show_bug.cgi?id=164426 Reviewed by Simon Fraser. RenderFlowThread state reset is spread across several functions. This patch groups them together in RenderObject::resetFlowThreadState(). No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::removeLeftoverAnonymousBlock): (WebCore::RenderBlock::dropAnonymousBoxChild): This is now part of resetFlowThreadState() since resetFlowThreadState gets called even when NotifyChildren is false. * rendering/RenderElement.cpp: (WebCore::RenderElement::insertChildInternal): Initialize the thread state before we notify the child. (WebCore::RenderElement::removeChildInternal): Reset the state even when NotifyChildren is false. (WebCore::RenderElement::willBeRemovedFromTree): This code is moved to removeFromRenderFlowThread(). (WebCore::RenderElement::removeFromRenderFlowThread): * rendering/RenderObject.cpp: (WebCore::RenderObject::initializeFlowThreadState): This is in transition for webkit.org/b/164428 (RenderFlowThread state initialization cleanup.) (WebCore::RenderObject::resetFlowThreadState): (WebCore::RenderObject::setParent): This was seemingly a random place to put flow state initialization. (WebCore::RenderObject::willBeRemovedFromTree): resetFlowThreadState() takes care of it now. * rendering/RenderObject.h: 2016-11-04 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Add DOMJIT::Signature annotation to Document::getElementById https://bugs.webkit.org/show_bug.cgi?id=164356 Reviewed by Filip Pizlo. This patch implements DOMJIT::Signature annotation for getElementById. Since getElementById is also implemented in DocumentFragment, we implement the branchIfDocumentFragment/branchIfNotDocumentFragment for that. In dromaeo, we have a test like this. test( "getElementById", function(){ for ( var i = 0; i < num * 30; i++ ) { ret = document.getElementById("testA" + num).nodeType; ret = document.getElementById("testB" + num).nodeType; ret = document.getElementById("testC" + num).nodeType; ret = document.getElementById("testD" + num).nodeType; ret = document.getElementById("testE" + num).nodeType; ret = document.getElementById("testF" + num).nodeType; } }); In the above test, JSC already knows the following things. 1. Since nodeType is now handled as CallDOMGetter, we know that it is pure. 2. getElementById look up becomes PureGetById since document is impure object. But it is kept as PureGetById. So it does not write DOMState. 3. `"testA" + num` will be converted to constant string. 4. CallDOM for getElementById said it just reads(DOMState:DOM). And it saids that it returns the same value as long as DOMState is not clobbered. 5. CheckCell leading CallDOM ensures the inlined getElementById node. (CallDOM node). The key thing is that no node clobbers DOMState during the loop. So CallDOM & CallDOMGetter can be hoisted. This improves dom-query significantly. Dromaeo dom-query getElementById becomes 40x faster (247796 v.s. 6197). Dromaeo dom-query getElementById (not in document) becomes 89x faster (630317.8 v.s. 7066.). Tests: js/dom/domjit-function-get-element-by-id-changed.html js/dom/domjit-function-get-element-by-id-licm.html js/dom/domjit-function-get-element-by-id.html * dom/NonElementParentNode.idl: * domjit/DOMJITCheckDOM.h: (WebCore::DOMJIT::TypeChecker<DocumentFragment>::branchIfFail): * domjit/DOMJITHelpers.h: (WebCore::DOMJIT::branchIfDocumentFragment): (WebCore::DOMJIT::branchIfNotDocumentFragment): 2016-11-04 Simon Fraser <simon.fraser@apple.com> Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity https://bugs.webkit.org/show_bug.cgi?id=164438 Reviewed by Tim Horton. unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source of confusion. Functions with "VisibleContent" in the name are usually expected to return document coordinates (affected by zooming), so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of "unscaled" vs "visibleContent", and "unobscured" vs "visible". So rename: unscaledUnobscuredVisibleContentSize -> sizeForUnobscuredContent unscaledVisibleContentSizeIncludingObscuredArea -> sizeForVisibleContent sizeForUnobscuredContent() can also be private to ScrollView. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::update): * platform/ScrollView.cpp: (WebCore::ScrollView::unobscuredContentRectInternal): (WebCore::ScrollView::sizeForVisibleContent): (WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea before testing whether we have a platform widget. (WebCore::ScrollView::layoutSize): (WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted. (WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted. * platform/ScrollView.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::flushPendingLayerChanges): (WebCore::RenderLayerCompositor::frameViewDidChangeSize): (WebCore::RenderLayerCompositor::updateRootLayerPosition): (WebCore::RenderLayerCompositor::ensureRootLayer): 2016-11-04 Simon Fraser <simon.fraser@apple.com> Layout viewport wrong with RTL documents https://bugs.webkit.org/show_bug.cgi?id=164434 Reviewed by Tim Horton. The layoutViewportRect was computed incorrectly in RTL documents, because FrameView::unscaledMaximumScrollPosition() was wrong; it erroneously mapped what it thought was a scrollOffset to a scrollPosition. Unscaled scroll positions are in the same coordinate space as unscaledDocumentRect, so we should not call scrollPositionFromOffset() in FrameView::unscaledMaximumScrollPosition(). Changed FrameView::unscaledMinimumScrollPosition() to also just grab the location of unscaledDocumentRect, for symmetry. Finally fixed the tiled scrolling indicator's viewport rect for zoomed RTL documents by using the unscaled scroll origin. Tests: fast/visual-viewport/rtl-nonzoomed-rects.html fast/visual-viewport/rtl-zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::unscaledScrollOrigin): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): * page/FrameView.h: 2016-11-04 Sam Weinig <sam@webkit.org> [WebIDL] Add support for modern callback syntax https://bugs.webkit.org/show_bug.cgi?id=164435 Reviewed by Chris Dumez. Support new callback syntax: callback Function = void (DOMString arg1, long arg2); This replaces "callback interface" types with a Callback=FunctionOnly extended attribute. * Modules/geolocation/PositionCallback.idl: * Modules/geolocation/PositionErrorCallback.idl: * Modules/notifications/NotificationPermissionCallback.idl: * Modules/quota/StorageErrorCallback.idl: * Modules/quota/StorageQuotaCallback.idl: * Modules/quota/StorageUsageCallback.idl: * Modules/webaudio/AudioBufferCallback.idl: * Modules/webdatabase/DatabaseCallback.idl: * Modules/webdatabase/SQLStatementCallback.idl: * Modules/webdatabase/SQLStatementErrorCallback.idl: * Modules/webdatabase/SQLTransactionCallback.idl: * Modules/webdatabase/SQLTransactionErrorCallback.idl: * dom/RequestAnimationFrameCallback.idl: * dom/StringCallback.idl: * html/VoidCallback.idl: * page/IntersectionObserverCallback.idl: * css/MediaQueryListListener.idl: Update to new syntax. * css/MediaQueryListListener.h: * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::styleResolverChanged): Switch to using the now required 'handleEvent' name. This is an implementation detail that we should change. * bindings/scripts/CodeGenerator.pm: Update document processing to allow a callback only file. Update callback type checks to look for a regex that matches in the new format. * bindings/scripts/CodeGeneratorJS.pm: (AddToImplIncludesForIDLType): (AddToIncludesForIDLType): (AddToImplIncludes): (AddToIncludes): Abstract includes functions to allow passing in an include hash. (GenerateCallbackFunctionHeader): (GenerateCallbackFunctionImplementation): (GenerateCallbackInterfaceHeader): (GenerateCallbackInterfaceImplementation): (GenerateCallbackHeaderContent): (GenerateCallbackImplementationContent): Refactor callback generation code into GenerateCallbackHeaderContent and GenerateCallbackImplementationContent to allow using it for both the new callbacks as well as the old callback interfaces. * bindings/scripts/IDLParser.pm: (Parse): (applyTypedefs): (applyTypedefsToOperation): (parseCallbackRest): Parse callbacks into the new IDLCallbackFunction type. Ensure that typedefs are applied as well. * bindings/scripts/IDLAttributes.txt: Remove support for Callback=FunctionOnly. * bindings/scripts/test/JS/JSTestCallback.cpp: Removed. * bindings/scripts/test/JS/JSTestCallback.h: Removed. * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: * bindings/scripts/test/JS/JSTestCallbackFunction.h: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: Added. * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: Added. * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp. * bindings/scripts/test/JS/JSTestCallbackInterface.h: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/TestCallback.idl: Removed. * bindings/scripts/test/TestCallbackFunction.idl: * bindings/scripts/test/TestCallbackFunctionWithTypedefs.idl: Added. * bindings/scripts/test/TestCallbackInterface.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallback.idl. * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestTypedefs.idl: Update existing tests and add new ones to test callback functions specifically. 2016-11-04 Alex Christensen <achristensen@webkit.org> Move isDefaultPortForProtocol from URLParser.cpp back to URL.cpp https://bugs.webkit.org/show_bug.cgi?id=164439 Reviewed by Daniel Bates. No change in behaviour. * platform/URL.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): * platform/URLParser.cpp: (WebCore::URLParser::defaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URLParser.h: 2016-11-04 Wenson Hsieh <wenson_hsieh@apple.com> Safari does not emit composition end if blurred for dead key / Japanese IME https://bugs.webkit.org/show_bug.cgi?id=164369 <rdar://problem/29050439> Reviewed by Ryosuke Niwa. On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early. This is because the focused element may have changed after performing the selection change, so we would otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead of the element with the composition. Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process that discards the marked text, and then updates the editor state. This patch splits this into two separate steps -- see the WebKit2 ChangeLog for more details. Test: fast/events/ime-compositionend-on-selection-change.html * editing/Editor.cpp: (WebCore::Editor::selectionWillChange): * editing/Editor.h: * editing/FrameSelection.cpp: (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): * editing/mac/EditorMac.mm: (WebCore::Editor::selectionWillChange): * loader/EmptyClients.h: * page/EditorClient.h: 2016-11-04 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore. https://bugs.webkit.org/show_bug.cgi?id=164424 Reviewed by Alex Christensen. No new tests (Covered by existing tests). This patch actually turns a handful of PASS to FAIL in the imported tests, but those are parts of the spec in flux/under discussion. We'll update either source or the tests as things are resolved. * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::get): (WebCore::IDBObjectStore::putOrAdd): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): 2016-11-04 Ryosuke Niwa <rniwa@webkit.org> Load stylesheets in link elements inside a connected shadow tree https://bugs.webkit.org/show_bug.cgi?id=160683 <rdar://problem/29040652> Reviewed by Antti Koivisto. Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement when it's connected to a document instead of always talking to document's style scope. Tests: fast/shadow-dom/link-element-in-shadow-tree.html fast/shadow-dom/selected-stylesheet-in-shadow-tree.html * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::HTMLLinkElement): (WebCore::HTMLLinkElement::~HTMLLinkElement): (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits early when inDocument() is false. (WebCore::HTMLLinkElement::parseAttribute): (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree. (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to a document instead of whenever its self-inclusive ancestor is inserted into a container. (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after calling removePendingSheet since the latter depends on m_styleScope being not null. (WebCore::HTMLLinkElement::addPendingSheet): (WebCore::HTMLLinkElement::removePendingSheet): * html/HTMLLinkElement.h: * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this element has just become connected to a document. (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal. * style/StyleScope.h: * svg/SVGStyleElement.cpp: (WebCore::SVGStyleElement::insertedInto): Ditto. (WebCore::SVGStyleElement::removedFrom): Ditto for the removal. 2016-11-04 Said Abou-Hallawa <sabouhallawa@apple.com> Add a setting and preferences to enable/disable async image decoding https://bugs.webkit.org/show_bug.cgi?id=164417 Reviewed by Simon Fraser. Add an asyncImageDecodingEnabled setting. This setting controls whether an image "can" be asynchronously decoded on a separate thread or not. The function ImageSource::isAsyncDecodingRequired() will be used in conjunction with this setting to decide whether an image "should" be asynchronously decoded or not. * page/Settings.in: 2016-11-04 Tim Horton <timothy_horton@apple.com> Apply post-landing review comments for r208347 * dom/Element.cpp: (WebCore::Element::findAnchorElementForLink): Use attributeWithoutSynchronization. * page/PrintContext.cpp: (WebCore::PrintContext::spoolPage): (WebCore::PrintContext::spoolRect): (WebCore::PrintContext::collectLinkedDestinations): (WebCore::PrintContext::outputLinkedDestinations): * page/PrintContext.h: Pass Document by reference instead of Node by pointer, use ElementTraversal instead of NodeTraversal to avoid having to locally check the type, and null-check renderers. 2016-11-04 Myles C. Maxfield <mmaxfield@apple.com> Implement WebGL2RenderingContext::copyBufferSubData() https://bugs.webkit.org/show_bug.cgi?id=164008 Reviewed by Dean Jackson. Similar to previous work regarding WebGL 2 buffers, this method implements the ability to copy from one buffer to another without the data leaving the GPU. Test: fast/canvas/webgl/copyBufferSubData.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::copyBufferSubData): * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::associateCopyBufferSubData): * html/canvas/WebGLBuffer.h: * platform/graphics/GraphicsContext3D.h: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::copyBufferSubData): 2016-11-04 Simon Fraser <simon.fraser@apple.com> Rename some ScrollingTree/Node-related functions to reduce the number of uses of "update" https://bugs.webkit.org/show_bug.cgi?id=164420 Reviewed by Tim Horton. Rename: commitNewTreeState -> commitTreeState ("new" was redundant) updateBeforeChildren -> commitStateBeforeChildren updateAfterChildren -> commitStateAfterChildren * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::updateTreeFromStateNode): (WebCore::ScrollingTree::commitNewTreeState): Deleted. * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNode::updateBeforeChildren): Deleted. * page/scrolling/ScrollingTreeFrameScrollingNode.h: * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::commitStateAfterChildren): (WebCore::ScrollingTreeNode::updateAfterChildren): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren): (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren): Deleted. (WebCore::ScrollingTreeScrollingNode::updateAfterChildren): Deleted. * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::commitTreeState): (WebCore::ThreadedScrollingTree::commitNewTreeState): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateAfterChildren): (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateBeforeChildren): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateAfterChildren): Deleted. * page/scrolling/ios/ScrollingTreeIOS.cpp: (WebCore::ScrollingTreeIOS::commitNewTreeState): Deleted. * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::commitTreeState): * page/scrolling/mac/ScrollingTreeFixedNode.h: * page/scrolling/mac/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren): (WebCore::ScrollingTreeFixedNode::updateBeforeChildren): Deleted. * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren): (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren): Deleted. (WebCore::ScrollingTreeFrameScrollingNodeMac::updateAfterChildren): Deleted. * page/scrolling/mac/ScrollingTreeStickyNode.h: * page/scrolling/mac/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren): (WebCore::ScrollingTreeStickyNode::updateBeforeChildren): Deleted. 2016-11-03 Anders Carlsson <andersca@apple.com> Add new 'other' Apple Pay button style https://bugs.webkit.org/show_bug.cgi?id=164384 rdar://problem/28302528 Reviewed by Dean Jackson. * DerivedSources.make: * WebCorePrefix.h: Add extension points. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add ApplePayButtonType::Other. (WebCore::CSSPrimitiveValue::operator ApplePayButtonType): Add CSSValueOther. * css/CSSValueKeywords.in: Add other. * css/parser/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): Add CSSValueOther. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): Add CSSValueOther. * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): Handle ApplePayButtonType::Other. * rendering/style/RenderStyleConstants.h: Add ApplePayButtonType::Other. 2016-11-04 Antti Koivisto <antti@apple.com> slotted() pseudo does not work with ID selector https://bugs.webkit.org/show_bug.cgi?id=160538 <rdar://problem/28534529> Reviewed by Andreas Kling. When we saw an id selector while addin rules we immediately threw it into the m_idRules optimization bucket and bailed out. However selectors containing ::slotted must always end up in m_slottedPseudoElementRules list no matter what else is there. Fix by treating id like other selectors and only choosing the bucket after analysing all the selector components. Test: fast/shadow-dom/css-scoping-slot-with-id.html * css/RuleSet.cpp: (WebCore::RuleSet::addRule): Also made this use switch instead of a series of ifs. 2016-11-04 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts. https://bugs.webkit.org/show_bug.cgi?id=164416 Reviewed by Beth Dakin. No new tests (Covered by existing tests). * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): 2016-11-04 Keith Rollin <krollin@apple.com> NetworkSession: Add NetworkDataTask implementation for blobs https://bugs.webkit.org/show_bug.cgi?id=163939 Reviewed by Alex Christensen. * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private. * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class. * platform/network/BlobData.h: Add WEBCORE_EXPORT to length(). * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange(). * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField(). 2016-11-04 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used. https://bugs.webkit.org/show_bug.cgi?id=164406 Reviewed by Alex Christensen. No new tests (Covered by existing tests). * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::setName): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::setName): 2016-11-04 Joanmarie Diggs <jdiggs@igalia.com> AX: [ATK] Attempting to clear selection on ARIA listboxes results in crash https://bugs.webkit.org/show_bug.cgi?id=164331 Reviewed by Chris Fleizach. The ATK code is using is<AccessibilityListBox>() to identify native listboxes. But is<AccessibilityListBox>() returns the value of isListBox() which returns true both for AccessibilityListBox instances as well as for AccessibilityObject instances which have an AccessibilityRole value of ListBoxRole. Because only native listboxes should be AccessibilityListBoxes, add isNativeListBox() so that we can distinguish native and ARIA listboxes. Tests: accessibility/aria-listbox-clear-selection-crash.html accessibility/listbox-clear-selection.html * accessibility/AccessibilityListBox.h: * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isNativeListBox): (WebCore::AccessibilityObject::isListBox): 2016-11-04 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Throw the correct exceptions during IDBObjectStore/IDBIndex renaming. https://bugs.webkit.org/show_bug.cgi?id=164405 Reviewed by Alex Christensen. No new tests (Covered by existing tests). * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::setName): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::setName): 2016-11-04 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Implement ByteStreamController error() https://bugs.webkit.org/show_bug.cgi?id=164319 Reviewed by Youenn Fablet. Implemented error() method of ReadableByteStreamController. Updated test expectations for error() and added IDL-related tests. * Modules/streams/ReadableByteStreamController.js: (error): Implemented. * Modules/streams/ReadableByteStreamInternals.js: (privateInitializeReadableByteStreamController): (isReadableByteStreamController): Added. (readableByteStreamControllerError): Added. (readableByteStreamControllerClearPendingPullIntos): Added. * Modules/streams/ReadableStream.js: (initializeReadableStream): More detailed error message. * Modules/streams/ReadableStreamDefaultController.js: (error): Removed unnecessary variable declaration. * bindings/js/WebCoreBuiltinNames.h: Added totalQueuedBytes. 2016-11-03 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts. https://bugs.webkit.org/show_bug.cgi?id=164403 Reviewed by Alex Christensen. No new tests (Covered by existing test). * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index already existed before this version change transaction. 2016-11-03 Youenn Fablet <youenn@apple.com> [WebRTC] Introduce asynchronous backend createOffer API https://bugs.webkit.org/show_bug.cgi?id=164365 Reviewed by Sam Weinig. Covered by existing tests. Removing PeerEndpointBackendClient as it is only RTCPeerConnection. This allows removing virtual for some functions. Moving MediaEndpointPeerClient::m_client to PeerEndpointBackendClient::m_peerConnection and making it a reference. Implementing createOffer at PeerConnectionBackend by splitting it in four sub-functions: - main createOffer, implemented at PeerConnectionBackend. - doCreateOffer implemented by subclasses (MediaEndpointPeerConnection). - createOfferSucceeded/createOfferFailed implemented by PeerConnectionBackend. * CMakeLists.txt: * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::createMediaEndpointPeerConnection): (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection): (WebCore::MediaEndpointPeerConnection::doCreateOffer): (WebCore::MediaEndpointPeerConnection::createOfferTask): (WebCore::MediaEndpointPeerConnection::createAnswerTask): (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): (WebCore::MediaEndpointPeerConnection::addIceCandidateTask): (WebCore::MediaEndpointPeerConnection::createReceiver): (WebCore::MediaEndpointPeerConnection::replaceTrack): (WebCore::MediaEndpointPeerConnection::replaceTrackTask): (WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation): (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): (WebCore::MediaEndpointPeerConnection::gotIceCandidate): (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates): (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): (WebCore::MediaEndpointPeerConnection::createOffer): Deleted. * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOffer): (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createOfferFailed): (WebCore::createPeerConnectionBackend): Deleted. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::PeerConnectionBackend): (WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient): Deleted. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::RTCPeerConnection): * Modules/mediastream/RTCPeerConnection.h: * WebCore.xcodeproj/project.pbxproj: 2016-11-03 Antti Koivisto <antti@apple.com> REGRESSION (r207717): DumpRenderTree crashed in com.apple.WebCore: WebCore::Style::Scope::flushPendingUpdate + 16 https://bugs.webkit.org/show_bug.cgi?id=164397 <rdar://problem/29100135> Reviewed by Ryosuke Niwa. The problem here was that we were leaving stale pointers to Document::m_inDocumentShadowRoots set when using fast-path document teardown. (Patch and stories mostly by rniwa). * dom/Document.cpp: (WebCore::Document::~Document): (WebCore::Document::didInsertInDocumentShadowRoot): (WebCore::Document::didRemoveInDocumentShadowRoot): Improve asserts. * dom/Element.cpp: (WebCore::Element::removeShadowRoot): Remove the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer() since the latter function tears down nodes via the deletion queue during a document destruction and use notifyChildNodeRemoved() on nodes that outlive the shadow root. * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::~ShadowRoot): Take care to clean up inDocumentShadowRoots for fast-pathed destruction too. (WebCore::ShadowRoot::insertedInto): (WebCore::ShadowRoot::removedFrom): Improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from m_inDocumentShadowRoots when the connected-ness changes. 2016-11-03 Simon Fraser <simon.fraser@apple.com> Give all the geometry classes a single-argument scale() function for consistency https://bugs.webkit.org/show_bug.cgi?id=164400 Reviewed by Zalan Bujtas. Add single-argument scale() to FloatPoint, FloatQuad, FloatSize and LayoutPoint, as well as adding one to GraphicsContext. Switch callers who passed the same value for sx and sy to the new functions. * dom/Document.cpp: (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale): * dom/MouseRelatedEvent.cpp: (WebCore::MouseRelatedEvent::init): (WebCore::MouseRelatedEvent::computeRelativePosition): * dom/TreeScope.cpp: (WebCore::TreeScope::nodeFromPoint): * page/PrintContext.cpp: (WebCore::PrintContext::spoolPage): * platform/cocoa/ThemeCocoa.mm: (WebCore::fitContextToBox): * platform/graphics/FloatPoint.h: (WebCore::FloatPoint::scale): * platform/graphics/FloatQuad.h: (WebCore::FloatQuad::scale): * platform/graphics/FloatSize.h: (WebCore::FloatSize::scale): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::applyDeviceScaleFactor): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::scale): * platform/graphics/LayoutPoint.h: (WebCore::LayoutPoint::scale): * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::platformCALayerPaintContents): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::drawConsuming): (WebCore::ImageBuffer::draw): (WebCore::ImageBuffer::drawPattern): * platform/mac/ThemeMac.mm: (WebCore::paintToggleButton): (WebCore::paintButton): (WebCore::paintStepper): * rendering/RenderImage.cpp: (WebCore::RenderImage::nodeAtPoint): * rendering/RenderMediaControls.cpp: (WebCore::getUnzoomedRectAndAdjustCurrentContext): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMenuList): (WebCore::RenderThemeMac::paintSliderThumb): (WebCore::RenderThemeMac::paintSearchField): (WebCore::RenderThemeMac::paintSearchFieldCancelButton): (WebCore::RenderThemeMac::paintSearchFieldResultsButton): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::selectionRectForTextFragment): (WebCore::SVGInlineTextBox::paintDecorationWithStyle): (WebCore::SVGInlineTextBox::paintTextWithShadows): * svg/SVGPathBlender.cpp: (WebCore::SVGPathBlender::blendAnimatedFloatPoint): (WebCore::SVGPathBlender::blendArcToSegment): * svg/SVGPathParser.cpp: (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment): (WebCore::SVGPathParser::parseCurveToQuadraticSegment): (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment): (WebCore::SVGPathParser::decomposeArcToCubic): * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::localCoordinateSpaceTransform): 2016-11-03 Antti Koivisto <antti@apple.com> REGRESSION (r207669): Crash under media controls shadow root construction https://bugs.webkit.org/show_bug.cgi?id=164381 <rdar://problem/28935401> Reviewed by Simon Fraser. The problem is that we are running a script for media control UA shadow tree in HTMLMediaElement::insertedInto. It is not safe to run scripts in insertedInto as the tree is in inconsistent state. Instead finishedInsertingSubtree callback should be used. Test: media/media-controls-shadow-construction-crash.html Seen on https://www.theguardian.com/artanddesign/video/2013/oct/14/banksy-central-park-new-york-video * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::insertedInto): (WebCore::HTMLMediaElement::finishedInsertingSubtree): Move configureMediaControls() to finishedInsertingSubtree(). * html/HTMLMediaElement.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveComposedTree): Add an assert to make the bad state easier to hit in tests. 2016-11-03 Ryosuke Niwa <rniwa@webkit.org> Add an assertion to diagnose stress GC bots test failures https://bugs.webkit.org/show_bug.cgi?id=164396 Reviewed by Antti Koivisto. Added an assertion for calling ElementQueue::add while ElementQueue::invokeAll is in progress. This should never happen as long as all DOM API has an appropriate CEReactions IDL attribute. * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionStack::ElementQueue::add): (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): * dom/CustomElementReactionQueue.h: 2016-11-03 Said Abou-Hallawa <sabouhallawa@apple.com> Add the asynchronous image decoding mode https://bugs.webkit.org/show_bug.cgi?id=155546 Reviewed by Simon Fraser. The asynchronous image decoding feature targets enhancing the rendering in two scenarios: the animated images and scrolling a page which large images. Enabling this feature for these two scenarios will be landed separately. The goal of the asynchronous image decoding is to have the decoded image frame ready before it has to be drawn. Drawing an image does not have to wait the image frame to be decoded. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::frameImageAtIndex): Use the negation of frameHasValidNativeImageAtIndex(). * platform/graphics/BitmapImage.h: (WebCore::BitmapImage::frameIsBeingDecodedAtIndex): Answers whether a frame is being decoded. (WebCore::BitmapImage::frameHasValidNativeImageAtIndex): Checks the validity of a frame. (WebCore::BitmapImage::frameHasInvalidNativeImageAtIndex): Deleted. * platform/graphics/Image.h: (WebCore::Image::newFrameNativeImageAvailableAtIndex): Notifies the image with the availability of a frame NativeImage. * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::isBeingDecoded): Answers whether the frame is being decoded. (WebCore::ImageFrame::hasValidNativeImage): Checks the validity of the frame. (WebCore::ImageFrame::hasInvalidNativeImage): Deleted. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::~ImageFrameCache): Asserts the decoding loop was ended before deleting the ImageFrameCache. (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Rename this function to matches the other which take the frame index. (WebCore::ImageFrameCache::setFrameMetadataAtIndex): Ditto. (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): It setts the ImageFrame's members and updates the decoded size. (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Replaces the frame NativeImage and notifies the Image with the new frame. (WebCore::ImageFrameCache::decodingQueue): Ensures the decoding WorkQueue is created and returns it. (WebCore::ImageFrameCache::startAsyncDecodingQueue): Starts a decoding WorkQueue which loops until m_frameRequestQueue is closed. (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Allows ImageSource to send a request to start asynchronous frame image decoding. (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Stops the decoding WorkQueue by closing m_frameRequestQueue. (WebCore::ImageFrameCache::frameAtIndex): Call replaceFrameNativeImageAtIndex(). (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Returns true if a request for the image frame is issued but not finished yet. (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Checks the validity of a frame. (WebCore::ImageFrameCache::setFrameNativeImage): Deleted. Was renamed to be setFrameNativeImageAtIndex. (WebCore::ImageFrameCache::setFrameMetadata): Deleted. Was renamed to be setFrameMetadataAtIndex (WebCore::ImageFrameCache::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex. * platform/graphics/ImageFrameCache.h: (WebCore::ImageFrameCache::create): The decoding queue needs to hold a reference to this class so it can stop decoding safely without blocking. (WebCore::ImageFrameCache::hasDecodingQueue): Returns true if a decoding queue has started. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ImageSource): Call ImageFrameCache::create(). (WebCore::ImageSource::clear): Deleting the decoder is unnecessary for asynchronous decoding because ImageFrameCache manages all the memory. (WebCore::ImageSource::destroyDecodedData): (WebCore::ImageSource::destroyDecodedDataIfNecessary): (WebCore::ImageSource::ensureDecoderAvailable): (WebCore::ImageSource::dataChanged): (WebCore::ImageSource::isAllDataReceived): (WebCore::ImageSource::isAsyncDecodingRequired): Answers the question whether the async image decoding is required for this ImageSource. (WebCore::ImageSource::frameImageAtIndex): * platform/graphics/ImageSource.h: (WebCore::ImageSource::decodedSize): (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): (WebCore::ImageSource::stopAsyncDecodingQueue): (WebCore::ImageSource::isSizeAvailable): (WebCore::ImageSource::frameCount): (WebCore::ImageSource::repetitionCount): (WebCore::ImageSource::filenameExtension): (WebCore::ImageSource::hotSpot): (WebCore::ImageSource::size): (WebCore::ImageSource::sizeRespectingOrientation): (WebCore::ImageSource::singlePixelSolidColor): (WebCore::ImageSource::frameIsBeingDecodedAtIndex): (WebCore::ImageSource::frameIsCompleteAtIndex): (WebCore::ImageSource::frameHasAlphaAtIndex): (WebCore::ImageSource::frameHasImageAtIndex): (WebCore::ImageSource::frameSubsamplingLevelAtIndex): (WebCore::ImageSource::frameSizeAtIndex): (WebCore::ImageSource::frameBytesAtIndex): (WebCore::ImageSource::frameDurationAtIndex): (WebCore::ImageSource::frameOrientationAtIndex): Make m_frameCache a type Ref<ImageFrameCache>. Use '->' instead of '.' when accessing its members. (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Checks the validity of a frame. (WebCore::ImageSource::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex. 2016-11-03 Myles C. Maxfield <mmaxfield@apple.com> [WebGL2] Implement getBufferSubData() https://bugs.webkit.org/show_bug.cgi?id=164111 Reviewed by Dean Jackson. The call exists in OpenGL 3.2 but in order to have parity with OpenGL ES 3 we back it with glMapBufferRange() instead. This patch simply adds surface area to GraphicsContext3D until we can get an ANGLE implementation of it. When testing this patch I discovered that r207649 incorrectly interpreted arguments to bufferData() and bufferSubData() as byte offsets. Instead, they should be element indices. This patch fixes those functions to work correctly so that getBufferSubData() can be tested correctly. Tests: fast/canvas/webgl/webgl2-buffers.html fast/canvas/webgl/getBufferSubData-webgl1.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::arrayBufferViewElementSize): (WebCore::WebGL2RenderingContext::bufferData): (WebCore::WebGL2RenderingContext::bufferSubData): (WebCore::WebGL2RenderingContext::getBufferSubData): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGL2RenderingContext.idl: * platform/graphics/GraphicsContext3D.h: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::getBufferSubData): (WebCore::GraphicsContext3D::mapBufferRange): (WebCore::GraphicsContext3D::unmapBuffer): 2016-11-03 Chris Dumez <cdumez@apple.com> Unreviewed, mark support for the 'download' attribute as 'Done'. * features.json: 2016-11-03 Chris Dumez <cdumez@apple.com> [WK2][Cocoa] Implement user interface for HTML form validation https://bugs.webkit.org/show_bug.cgi?id=164143 <rdar://problem/28944652> Reviewed by Simon Fraser. Add ValidationBubble class to show HTML form validation messages using native dialogs. It currently has an implementation for both Mac and iOS. It is in WebCore under platform/ so that it can be used by both WebKit1 and WebKit2. Update ownership of ValidationMessageClient so that is is owned by the Page using a unique_ptr<>, which seems to be the modern way of handling lifetime for page clients. Test: fast/forms/validation-messages.html * WebCore.xcodeproj/project.pbxproj: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): * html/ValidationMessage.cpp: (WebCore::ValidationMessage::updateValidationMessage): * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::~Page): * page/Page.h: (WebCore::Page::validationMessageClient): * page/PageConfiguration.cpp: * page/PageConfiguration.h: * platform/ValidationBubble.h: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm. (WebCore::ValidationBubble::message): * platform/ios/ValidationBubbleIOS.mm: Added. (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]): (WebCore::ValidationBubble::ValidationBubble): (WebCore::ValidationBubble::~ValidationBubble): (WebCore::ValidationBubble::show): (WebCore::ValidationBubble::setAnchorRect): * platform/mac/ValidationBubbleMac.mm: Added. (WebCore::ValidationBubble::ValidationBubble): (WebCore::ValidationBubble::~ValidationBubble): (WebCore::ValidationBubble::showRelativeTo): 2016-11-03 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Rename IDBKeyRange.contains to IDBKeyRange.includes. https://bugs.webkit.org/show_bug.cgi?id=164383 Reviewed by Beth Dakin. No new tests (Updated existing tests). * Modules/indexeddb/IDBKeyRange.cpp: (WebCore::IDBKeyRange::includes): (WebCore::IDBKeyRange::contains): Deleted. * Modules/indexeddb/IDBKeyRange.h: * Modules/indexeddb/IDBKeyRange.idl: 2016-11-03 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208302. This change causes LayoutTest crashes under GuardMalloc. Reverted changeset: "Load stylesheets in link elements inside a connected shadow tree" https://bugs.webkit.org/show_bug.cgi?id=160683 http://trac.webkit.org/changeset/208302 2016-11-03 Chris Dumez <cdumez@apple.com> Unreviewed, add HTML5 specification for HTML Interactive Form Validation feature. * features.json: 2016-11-03 Chris Dumez <cdumez@apple.com> Unreviewed, add HTML Interactive Form Validation to features.json * features.json: 2016-11-03 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, rolling out due to crash in Amazon web site https://bugs.webkit.org/show_bug.cgi?id=164380 <rdar://problem/29094221> * dom/Node.idl: * domjit/JSNodeDOMJIT.cpp: (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted. (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): Deleted. 2016-11-03 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support binary keys. <rdar://problem/28806927> and https://bugs.webkit.org/show_bug.cgi?id=164359 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/binary-keys-1-private.html storage/indexeddb/modern/binary-keys-1.html Changes to other existing tests. * Modules/indexeddb/IDBKey.cpp: (WebCore::IDBKey::createBinary): (WebCore::IDBKey::IDBKey): (WebCore::IDBKey::compare): * Modules/indexeddb/IDBKey.h: (WebCore::IDBKey::binary): (WebCore::compareBinaryKeyData): * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::IDBKeyData): (WebCore::IDBKeyData::maybeCreateIDBKey): (WebCore::IDBKeyData::isolatedCopy): (WebCore::IDBKeyData::encode): (WebCore::IDBKeyData::decode): (WebCore::IDBKeyData::compare): (WebCore::IDBKeyData::loggingString): (WebCore::IDBKeyData::operator==): * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::hash): (WebCore::IDBKeyData::encode): (WebCore::IDBKeyData::decode): * Modules/indexeddb/IndexedDB.h: Add new enum for the new key type. * bindings/js/IDBBindingUtilities.cpp: (WebCore::toJS): (WebCore::createIDBKeyFromValue): * platform/ThreadSafeDataBuffer.h: (WebCore::ThreadSafeDataBufferImpl::ThreadSafeDataBufferImpl): (WebCore::ThreadSafeDataBuffer::copyData): (WebCore::ThreadSafeDataBuffer::size): (WebCore::ThreadSafeDataBuffer::operator==): (WebCore::ThreadSafeDataBuffer::ThreadSafeDataBuffer): 2016-11-03 Tim Horton <timothy_horton@apple.com> Printing to PDF should produce internal links when HTML has internal links https://bugs.webkit.org/show_bug.cgi?id=112081 <rdar://problem/5955705> Reviewed by Simon Fraser. Patch originally by David Lattimore. No new tests, as it's unclear how to test PDF output. * dom/Element.cpp: (WebCore::Element::findAnchorElementForLink): * dom/Element.h: Add findAnchorElementForLink, which looks up the anchor element corresponding to the current element's href, and also returns the fragment name as an out parameter. * page/PrintContext.cpp: (WebCore::PrintContext::PrintContext): (WebCore::PrintContext::spoolPage): (WebCore::PrintContext::spoolRect): (WebCore::PrintContext::end): (WebCore::PrintContext::collectLinkedDestinations): (WebCore::PrintContext::outputLinkedDestinations): * rendering/RenderObject.cpp: (WebCore::RenderObject::addPDFURLRect): Plumb internal links (fragment links) through to GraphicsContext, using the fragment name from the page. * page/PrintContext.h: * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::supportsInternalLinks): (WebCore::GraphicsContext::setDestinationForRect): (WebCore::GraphicsContext::addDestinationAtPoint): * platform/graphics/GraphicsContext.h: * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::supportsInternalLinks): (WebCore::GraphicsContext::setDestinationForRect): (WebCore::GraphicsContext::addDestinationAtPoint): Plumb internal links through to the CGContext. Apply the CTM, because these functions expect positions in global coordinates. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::setURLForRect): * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::setURLForRect): Adjust setURLForRect to take a FloatRect, like everything else, and stop rounding. 2016-11-03 Alex Christensen <achristensen@webkit.org> Unreviewed, rolling out r208298. https://bugs.webkit.org/show_bug.cgi?id=163939 caused asan crashes Reverted changeset: "NetworkSession: Add NetworkDataTask implementation for blobs" https://bugs.webkit.org/show_bug.cgi?id=163939 http://trac.webkit.org/changeset/208298 2016-11-03 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Native Windows widgets are drawn upside-down https://bugs.webkit.org/show_bug.cgi?id=164370 Reviewed by Alex Christensen. When we return from drawing in GDI code, we need to flip the resulting bitmap so that it draws in the proper orientation in Direct2D. Tested by existing widget tests. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::releaseWindowsContext): Flip before drawing to our Direct2D context. 2016-11-01 Gavin Barraclough <barraclough@apple.com> Remove PageThrottler & all related code https://bugs.webkit.org/show_bug.cgi?id=164302 Reviewed by Ryosuke Niwa. All relevant information now available from the ActivityState. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setMuted): (WebCore::HTMLMediaElement::updateVolume): (WebCore::HTMLMediaElement::updatePlayState): (WebCore::HTMLMediaElement::updateAudioAssertionState): Deleted. * html/HTMLMediaElement.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::completed): (WebCore::FrameLoader::started): * loader/FrameLoader.h: * page/ChromeClient.h: * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::pageActivityStateChanged): Deleted. (WebCore::Page::pageThrottler): Deleted. * page/PageThrottler.cpp: Removed. * page/PageThrottler.h: Removed. 2016-11-03 Dan Bernstein <mitz@apple.com> REGRESSION (r206247): Painting milestones can be delayed until the next layer flush https://bugs.webkit.org/show_bug.cgi?id=164340 <rdar://problem/29074344> Reviewed by Tim Horton. To give WebKit a chance to deliver the painting milestones to its client after the commit, we must tell it about them before or during the commit. To that end, we should not defer the call to firePaintRelatedMilestonesIfNeeded until after the commit. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::RenderLayerCompositor): Removed m_paintRelatedMilestonesTimer initializer. (WebCore::RenderLayerCompositor::didPaintBacking): Call FrameView::firePaintRelatedMilestonesIfNeeded directly from here. (WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired): Deleted. * rendering/RenderLayerCompositor.h: 2016-11-03 Antti Koivisto <antti@apple.com> imported/mozilla/svg/paint-order-01.svg and imported/mozilla/svg/paint-order-02.svg are flaky failures https://bugs.webkit.org/show_bug.cgi?id=164355 Reviewed by Ryosuke Niwa. Revert one change from https://trac.webkit.org/changeset/207669 to see if it is causing flakiness in some XML based tests. * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::end): 2016-11-02 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, fix CLoop build after r208320. https://bugs.webkit.org/show_bug.cgi?id=162980 Guard with ENABLE(JIT). * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: 2016-11-02 Brady Eidson <beidson@apple.com> Expand upon IndexedDB status in features.json. * features.json: 2016-11-02 Myles C. Maxfield <mmaxfield@apple.com> CSS.supports("font-variation-settings", "'wght' 500") erroneously returns false https://bugs.webkit.org/show_bug.cgi?id=164244 Reviewed by Michael Catanzaro. Because we weren't passing a Document into CSSParserContext's constructor, there was no way for our parser to know whether the runtime switch was on or not. Instead, we can use the CallWith attribute in the IDL file to pass in a Document. Test: fast/text/variations/css-supports-runtime-switch.html * css/DOMCSSNamespace.cpp: (WebCore::DOMCSSNamespace::supports): * css/DOMCSSNamespace.h: * css/DOMCSSNamespace.idl: 2016-11-02 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Add DOMJIT::Signature https://bugs.webkit.org/show_bug.cgi?id=162980 Reviewed by Saam Barati and Sam Weinig. We introduce DOMJIT::Signature. This signature object is automatically generated by IDL code generator. It holds (1) types, (2) pointer to the unsafe function (the function without checks), and (3) the effect of the function. We use constexpr to initialize DOMJIT::Signature without invoking global constructors. Thus the content is embedded into the binary as the constant values. We also clean up the IDL code generator related to DOMJIT part. Instead of switching things inside IDL code generator, we use C++ template to dispatch things at compile time. This template meta programming is highly utilized in IDL these days. To make DOMJIT::Signature constexpr, we also need to define DOMJIT abstract heap things in the build time. To do so, we introduce a tiny Ruby script to calculate the range of abstract heaps. We can offer the abstract heap tree as YAML format and the script will produce a C++ header holding the calculated abstract heap ranges * CMakeLists.txt: * DerivedSources.make: * ForwardingHeaders/bytecode/SpeculatedType.h: Renamed from Source/WebCore/domjit/DOMJITAbstractHeapRepository.h. * ForwardingHeaders/domjit/DOMJITSignature.h: Renamed from Source/WebCore/domjit/DOMJITAbstractHeapRepository.cpp. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePropertiesHashTable): (GetUnsafeArgumentType): (GetArgumentTypeFilter): (GetResultTypeFilter): (GenerateImplementation): (UnsafeToNative): (GenerateHashTableValueArray): (ComputeFunctionSpecial): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::BindingCaller<JSTestDOMJIT>::castForOperation): (WebCore::TestDOMJITAnyAttrDOMJIT::TestDOMJITAnyAttrDOMJIT): (WebCore::TestDOMJITBooleanAttrDOMJIT::TestDOMJITBooleanAttrDOMJIT): (WebCore::TestDOMJITByteAttrDOMJIT::TestDOMJITByteAttrDOMJIT): (WebCore::TestDOMJITOctetAttrDOMJIT::TestDOMJITOctetAttrDOMJIT): (WebCore::TestDOMJITShortAttrDOMJIT::TestDOMJITShortAttrDOMJIT): (WebCore::TestDOMJITUnsignedShortAttrDOMJIT::TestDOMJITUnsignedShortAttrDOMJIT): (WebCore::TestDOMJITLongAttrDOMJIT::TestDOMJITLongAttrDOMJIT): (WebCore::TestDOMJITUnsignedLongAttrDOMJIT::TestDOMJITUnsignedLongAttrDOMJIT): (WebCore::TestDOMJITLongLongAttrDOMJIT::TestDOMJITLongLongAttrDOMJIT): (WebCore::TestDOMJITUnsignedLongLongAttrDOMJIT::TestDOMJITUnsignedLongLongAttrDOMJIT): (WebCore::TestDOMJITFloatAttrDOMJIT::TestDOMJITFloatAttrDOMJIT): (WebCore::TestDOMJITUnrestrictedFloatAttrDOMJIT::TestDOMJITUnrestrictedFloatAttrDOMJIT): (WebCore::TestDOMJITDoubleAttrDOMJIT::TestDOMJITDoubleAttrDOMJIT): (WebCore::TestDOMJITUnrestrictedDoubleAttrDOMJIT::TestDOMJITUnrestrictedDoubleAttrDOMJIT): (WebCore::TestDOMJITDomStringAttrDOMJIT::TestDOMJITDomStringAttrDOMJIT): (WebCore::TestDOMJITByteStringAttrDOMJIT::TestDOMJITByteStringAttrDOMJIT): (WebCore::TestDOMJITUsvStringAttrDOMJIT::TestDOMJITUsvStringAttrDOMJIT): (WebCore::TestDOMJITNodeAttrDOMJIT::TestDOMJITNodeAttrDOMJIT): (WebCore::TestDOMJITBooleanNullableAttrDOMJIT::TestDOMJITBooleanNullableAttrDOMJIT): (WebCore::TestDOMJITByteNullableAttrDOMJIT::TestDOMJITByteNullableAttrDOMJIT): (WebCore::TestDOMJITOctetNullableAttrDOMJIT::TestDOMJITOctetNullableAttrDOMJIT): (WebCore::TestDOMJITShortNullableAttrDOMJIT::TestDOMJITShortNullableAttrDOMJIT): (WebCore::TestDOMJITUnsignedShortNullableAttrDOMJIT::TestDOMJITUnsignedShortNullableAttrDOMJIT): (WebCore::TestDOMJITLongNullableAttrDOMJIT::TestDOMJITLongNullableAttrDOMJIT): (WebCore::TestDOMJITUnsignedLongNullableAttrDOMJIT::TestDOMJITUnsignedLongNullableAttrDOMJIT): (WebCore::TestDOMJITLongLongNullableAttrDOMJIT::TestDOMJITLongLongNullableAttrDOMJIT): (WebCore::TestDOMJITUnsignedLongLongNullableAttrDOMJIT::TestDOMJITUnsignedLongLongNullableAttrDOMJIT): (WebCore::TestDOMJITFloatNullableAttrDOMJIT::TestDOMJITFloatNullableAttrDOMJIT): (WebCore::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT): (WebCore::TestDOMJITDoubleNullableAttrDOMJIT::TestDOMJITDoubleNullableAttrDOMJIT): (WebCore::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT): (WebCore::TestDOMJITDomStringNullableAttrDOMJIT::TestDOMJITDomStringNullableAttrDOMJIT): (WebCore::TestDOMJITByteStringNullableAttrDOMJIT::TestDOMJITByteStringNullableAttrDOMJIT): (WebCore::TestDOMJITUsvStringNullableAttrDOMJIT::TestDOMJITUsvStringNullableAttrDOMJIT): (WebCore::TestDOMJITNodeNullableAttrDOMJIT::TestDOMJITNodeNullableAttrDOMJIT): (WebCore::jsTestDOMJITPrototypeFunctionGetAttribute): (WebCore::jsTestDOMJITPrototypeFunctionGetAttributeCaller): (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute): (WebCore::jsTestDOMJITPrototypeFunctionItem): (WebCore::jsTestDOMJITPrototypeFunctionItemCaller): (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem): (WebCore::jsTestDOMJITPrototypeFunctionHasAttribute): (WebCore::jsTestDOMJITPrototypeFunctionHasAttributeCaller): (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute): (WebCore::jsTestDOMJITPrototypeFunctionGetElementById): (WebCore::jsTestDOMJITPrototypeFunctionGetElementByIdCaller): (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById): (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByName): (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByNameCaller): (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName): * bindings/scripts/test/TestDOMJIT.idl: * dom/Element.idl: * domjit/DOMJITAbstractHeapRepository.yaml: Added. * domjit/DOMJITIDLConvert.h: Added. (WebCore::DOMJIT::DirectConverter<IDLDOMString>::directConvert<StringConversionConfiguration::Normal>): * domjit/DOMJITIDLType.h: Added. * domjit/DOMJITIDLTypeFilter.h: Added. * domjit/JSDocumentDOMJIT.cpp: (WebCore::DocumentDocumentElementDOMJIT::callDOMGetter): * domjit/JSNodeDOMJIT.cpp: (WebCore::NodeFirstChildDOMJIT::callDOMGetter): (WebCore::NodeLastChildDOMJIT::callDOMGetter): (WebCore::NodeNextSiblingDOMJIT::callDOMGetter): (WebCore::NodePreviousSiblingDOMJIT::callDOMGetter): (WebCore::NodeParentNodeDOMJIT::callDOMGetter): (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): * domjit/generate-abstract-heap.rb: Added. 2016-11-02 Simon Fraser <simon.fraser@apple.com> Followup after r208314. The style created for reflections contains transforms and a mask, so needs to get explicit z-index on it. This doesn't change rendering, since this layer has no children. Fixes assertions in various reflection tests. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): 2016-11-02 Simon Fraser <simon.fraser@apple.com> REGRESSION (r208025) GraphicsContext state stack assertions loading webkit.org https://bugs.webkit.org/show_bug.cgi?id=164350 rdar://problem/29053414 Reviewed by Dean Jackson. After r208025 it as possible for KeyframeAnimation::animate() to produce a RenderStyle with a non-1 opacity, but without the explicit z-index that triggers stacking context. This confused the RenderLayer paintWithTransparency code, triggering mismsatched GraphicsContext save/restores. This occurred when the runningOrFillingForwards state was mis-computed. keyframeAnim->animate() can spit out a new style when in the StartWaitTimer sometimes, so "!keyframeAnim->waitingToStart() && !keyframeAnim->postActive()" gave the wrong answser. Rather than depend on the super-confusing animation state, use a bool out param from animate() to say when it actually produced a new style, and when true, do the setZIndex(0). Test: animations/stacking-during-opacity-animation.html * page/animation/AnimationBase.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimation::blendProperties): Log after blending so the log shows the blended style. * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::animate): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::animate): * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): * page/animation/KeyframeAnimation.h: * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::restore): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayer::drawLayerContents): No functional change, but created scope for the GraphicsContext so that it didn't outlive the CGContextRestoreGState(context). * rendering/RenderLayer.cpp: (WebCore::RenderLayer::beginTransparencyLayers): New assertion that catches the problem earlier. 2016-11-02 Myles C. Maxfield <mmaxfield@apple.com> [iOS] [WebGL] Multisample resolve step may operate on stale data https://bugs.webkit.org/show_bug.cgi?id=164347 Reviewed by Dean Jackson. When antialiasing is enabled, WebKit internally creates a multisampled FBO and uses that as the target of all the drawing commands. Then, just before we actually put the image on the glass, we perform a “resolve” step which averages all the samples to create the final image. However, it appears that this resolve step only waits for commands to complete which were already submitted to the hardware. OpenGL is allowed (indeed, expected) to batch up drawing commands in main memory so it can submit them to the hardware in fewer batches, but this means that the hardware may not know about all the commands that the application submitted. Because of this, the data the resolve step saw is the result of only some of the previous draw calls - not all of them. This doesn’t occur on macOS because we have a different code path there for performing the resolve step. On iOS 9 and below, WebKit didn’t implement multisampling in WebGL at all, which explains why this only occurs on iOS 10. Luckily, the OpenGL command glFlush() is exactly designed to submit any pending commands to the hardware. Test: fast/canvas/webgl/multisample-resolve-consistency.html * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary): 2016-11-02 Brady Eidson <beidson@apple.com> Give IDBKey(Data) a WTF::Variant overhaul. https://bugs.webkit.org/show_bug.cgi?id=164332 Reviewed by Alex Christensen and Andy Estes. No new tests (Refactor, no behavior change). * Modules/indexeddb/IDBKey.cpp: (WebCore::IDBKey::IDBKey): (WebCore::IDBKey::isValid): (WebCore::IDBKey::compare): * Modules/indexeddb/IDBKey.h: (WebCore::IDBKey::array): (WebCore::IDBKey::string): (WebCore::IDBKey::date): (WebCore::IDBKey::number): (WebCore::IDBKey::IDBKey): Deleted. * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::IDBKeyData): (WebCore::IDBKeyData::maybeCreateIDBKey): (WebCore::IDBKeyData::isolatedCopy): (WebCore::IDBKeyData::encode): (WebCore::IDBKeyData::decode): (WebCore::IDBKeyData::compare): (WebCore::IDBKeyData::loggingString): (WebCore::IDBKeyData::setArrayValue): (WebCore::IDBKeyData::setStringValue): (WebCore::IDBKeyData::setDateValue): (WebCore::IDBKeyData::setNumberValue): (WebCore::IDBKeyData::operator==): * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::hash): (WebCore::IDBKeyData::string): (WebCore::IDBKeyData::date): (WebCore::IDBKeyData::number): (WebCore::IDBKeyData::array): (WebCore::IDBKeyData::encode): (WebCore::IDBKeyData::decode): 2016-11-01 Sam Weinig <sam@webkit.org> [WebIDL] Move interfaces and typed arrays over to JSDOMConvert https://bugs.webkit.org/show_bug.cgi?id=164256 Reviewed by Alex Christensen. - Add the ability to pass an "exception thrower" functor to the convert functions. This is only implemented for convert<IDLInterface<T>> and convert<IDLNullable<IDLInterface<T>>> for now, but can be extended for more types as necessary to improve exception messages. - Add support for using toJSNewlyCreated in JSDOMConvert. * bindings/generic/IDLTypes.h: (WebCore::IDLString::extractValueFromNullable): Use forwarding to simplify extraction function. (WebCore::IDLInterface::nullValue): Update nullValue to work for both RefPtr<T> and T*. (WebCore::IDLInterface::extractValueFromNullable): Use forwarding to simplify extraction function. * bindings/js/JSDOMConvert.h: (WebCore::DefaultExceptionThrower::operator()): Add a default "exception thrower" which throws a normal type error. (WebCore::convert): Add an overload of convert which takes an "exception thrower". (WebCore::toJSNewlyCreated): Add new overloaded function toJSNewlyCreated, matching the toJS overload set, which will return "newly created" values. This only works for types that implement a toJSNewlyCreated function for themselves. (WebCore::Converter<IDLNullable<T>>::convert): Fix the return type of Converter<IDLNullable<T>> to be specialized when T is an IDLInterface. In that case, we want to match the return type of inner converter. Also add implementation of convert overload that takes an "exception thrower". (WebCore::JSConverter<IDLNullable<T>>::convert): (WebCore::JSConverter<IDLNullable<T>>::convertNewlyCreated): Reimplement conversion to use forwarding of the value. (WebCore::Converter<IDLInterface<T>>::convert): Add support for an "exception thrower". (WebCore::Detail::getPtrOrRef): Add helper functions that extract either a pointer or reference, depending on the type, and const_casts it allowing the value to be used with toJS functions. (WebCore::JSConverter<IDLInterface<T>>::convert): Re-implement to support more varied input values. (WebCore::JSConverter<IDLInterface<T>>::convertNewlyCreated): Added. Forwards to overloaded toJSNewlyCreated functions. * bindings/scripts/CodeGeneratorJS.pm: (AddToImplIncludesForIDLType): Add support for adding the right includes for SerializedScriptValue and Dictionary. (GetArgumentExceptionThrower): (GetAttributeExceptionThrower): Add helpers to generate "exception thrower" lambdas for wrappers and typed arrays being passed to setters and functions. (GenerateParametersCheck): Move around special cases so it is clear that it's not wrappers and typed arrays that need specialization here, it is now just EventListener and XPathNSResolver. (GetIDLInterfaceName): Add helper to get the InterfaceName for use in IDLInterface template. (GetBaseIDLType): Use new GetIDLInterfaceName helper. (IsValidContextForJSValueToNative): Remove IDLOperation as a valid context. It is not. (JSValueToNative): Move JSDOMConvert based conversion to the bottom, to show that everything above it is a special case that should be fixed. I have used explicit c-style if-statements to make it clear what the types of the exceptional cases are. (NativeToJSValueDOMConvertNeedsState): (NativeToJSValueDOMConvertNeedsGlobalObject): Add wrapper types and typed arrays to the list needing state and globalObject. (NativeToJSValue): Move JSDOMConvert based conversion to the bottom, to show that everything above it is a special case that should be fixed. I have used explicit c-style if-statements to make it clear what the types of the exceptional cases are. (JSValueToNativeIsHandledByDOMConvert): Deleted. (NativeToJSValueIsHandledByDOMConvert): Deleted. Remove predicates protecting use of JSDOMConvert now that it is the default. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCallback.cpp: * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results. 2016-11-02 David Kilzer <ddkilzer@apple.com> Bug 164333: Add logging for "WebKit encountered an internal error" messages due to Network process crashes <https://webkit.org/b/164333> <rdar://problem/29072727> Reviewed by Alex Christensen. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::networkProcessCrashedKey): - Add implementation for new key method. * page/DiagnosticLoggingKeys.h: (WebCore::DiagnosticLoggingKeys::networkProcessCrashedKey): - Add declaration for new key method. 2016-11-02 Filip Pizlo <fpizlo@apple.com> The GC should be in a thread https://bugs.webkit.org/show_bug.cgi?id=163562 Reviewed by Geoffrey Garen and Andreas Kling. No new tests because existing tests cover this. We now need to be more careful about using JSLock. This fixes some places that were not holding it. New assertions in the GC are more likely to catch this than before. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): 2016-11-02 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Include DebuggerAgent in Workers - see, pause, and step through scripts https://bugs.webkit.org/show_bug.cgi?id=164136 <rdar://problem/29028462> Reviewed by Brian Burg. Tests: inspector/worker/debugger-pause.html inspector/worker/debugger-scripts.html * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: New file. * inspector/PageDebuggerAgent.h: * inspector/WorkerDebuggerAgent.cpp: Added. (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::~WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/WorkerDebuggerAgent.h: Added. DebuggerAgent customizations for Workers. * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): Add the new agent. * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): Implement the nested run loop for Workers. 2016-11-02 Simon Fraser <simon.fraser@apple.com> Add Battery Status to features.json, marked as "Removed". * features.json: 2016-11-02 Ryosuke Niwa <rniwa@webkit.org> Load stylesheets in link elements inside a connected shadow tree https://bugs.webkit.org/show_bug.cgi?id=160683 <rdar://problem/29040652> Reviewed by Antti Koivisto. Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement when it's connected to a document instead of always talking to document's style scope. Also improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from m_inDocumentShadowRoots when the connected-ness changes. This patch also removes the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer() since the latter function tears down nodes via the deletion queue during a document destruction and use notifyChildNodeRemoved() on nodes that outlive the shadow root. Tests: fast/shadow-dom/link-element-in-shadow-tree.html fast/shadow-dom/selected-stylesheet-in-shadow-tree.html * dom/Document.cpp: (WebCore::Document::didInsertInDocumentShadowRoot): Assert that the shadow root is not in the set. (WebCore::Document::didRemoveInDocumentShadowRoot): Assert that the shadow root is not in the document as this function is now called after Node::removedFrom in ShadowRoot::removedFrom. * dom/Element.cpp: (WebCore::Element::removeShadowRoot): See the description above. * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::insertedInto): Only call didInsertInDocumentShadowRoot when the this shadow root is newly connected to a document so we can add assertions in didInsertInDocumentShadowRoot. (WebCore::ShadowRoot::removedFrom): Ditto for the removal. * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::HTMLLinkElement): (WebCore::HTMLLinkElement::~HTMLLinkElement): (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits early when inDocument() is false. (WebCore::HTMLLinkElement::parseAttribute): (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree. (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to a document instead of whenever its self-inclusive ancestor is inserted into a container. (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after calling removePendingSheet since the latter depends on m_styleScope being not null. (WebCore::HTMLLinkElement::addPendingSheet): (WebCore::HTMLLinkElement::removePendingSheet): * html/HTMLLinkElement.h: * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this element has just become connected to a document. (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal. * style/StyleScope.h: * svg/SVGStyleElement.cpp: (WebCore::SVGStyleElement::insertedInto): Ditto. (WebCore::SVGStyleElement::removedFrom): Ditto for the removal. 2016-11-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Clean up new parser's grid layout ifdefs/runtime checking https://bugs.webkit.org/show_bug.cgi?id=164341 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeGridTrackRepeatFunction): (WebCore::consumeGridTrackList): (WebCore::CSSPropertyParser::parseSingleValue): 2016-11-02 Alex Christensen <achristensen@webkit.org> Remove Battery Status API from the tree https://bugs.webkit.org/show_bug.cgi?id=164213 Reviewed by Sam Weinig. * CMakeLists.txt: * DerivedSources.cpp: * Modules/battery: Removed. * Modules/battery/BatteryClient.h: Removed. * Modules/battery/BatteryController.cpp: Removed. * Modules/battery/BatteryController.h: Removed. * Modules/battery/BatteryManager.cpp: Removed. * Modules/battery/BatteryManager.h: Removed. * Modules/battery/BatteryManager.idl: Removed. * Modules/battery/BatteryStatus.cpp: Removed. * Modules/battery/BatteryStatus.h: Removed. * Modules/battery/NavigatorBattery.cpp: Removed. * Modules/battery/NavigatorBattery.h: Removed. * Modules/battery/NavigatorBattery.idl: Removed. * PlatformEfl.cmake: * dom/EventTargetFactory.in: * platform/efl/BatteryProviderEfl.cpp: Removed. * platform/efl/BatteryProviderEfl.h: Removed. * platform/efl/BatteryProviderEflClient.h: Removed. * platform/glib/BatteryProviderUPower.cpp: Removed. * platform/glib/BatteryProviderUPower.h: Removed. * platform/glib/BatteryProviderUPowerClient.h: Removed. * testing/Internals.cpp: (WebCore::Internals::setBatteryStatus): Deleted. * testing/Internals.h: * testing/Internals.idl: 2016-11-02 Keith Rollin <krollin@apple.com> NetworkSession: Add NetworkDataTask implementation for blobs https://bugs.webkit.org/show_bug.cgi?id=163939 Reviewed by Alex Christensen. * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private. * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class. * platform/network/BlobData.h: Add WEBCORE_EXPORT to length(). * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange(). * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField(). 2016-11-02 Olivier Blin <olivier.blin@softathome.com> [GTK] Use libgcrypt instead of GnuTLS for CryptoDigest and SubtleCrypto HMAC implementation https://bugs.webkit.org/show_bug.cgi?id=163125 Reviewed by Michael Catanzaro. No new tests, already covered by existing SubtleCrypto tests. * PlatformGTK.cmake: Use libgcrypt instead of gnutls. * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: Added. Adapted from the GnuTLS backend. (WebCore::getGCryptDigestAlgorithm): (WebCore::calculateSignature): (WebCore::CryptoAlgorithmHMAC::platformSign): (WebCore::CryptoAlgorithmHMAC::platformVerify): * platform/crypto/gcrypt/CryptoDigestGCrypt.cpp: Added. Adapted from the GnuTLS backend. (WebCore::CryptoDigest::CryptoDigest): (WebCore::CryptoDigest::~CryptoDigest): (WebCore::CryptoDigest::create): (WebCore::CryptoDigest::addBytes): (WebCore::CryptoDigest::computeHash): 2016-11-02 Brent Fulgham <bfulgham@apple.com> REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page https://bugs.webkit.org/show_bug.cgi?id=162933 <rdar://problem/28570590> Reviewed by Dean Jackson. A debug assertion is triggered when an empty <mo> tag is used with a "stretchy" flag. We shouldn't be trying to apply stretch operations on an empty MathML element. Create a helper function (isStretchy) to encapsulate the fact that only non-empty elements with the 'MathMLOperatorDictionary::Stretchy' operator flag should have stretching applied. Test: mathml/empty-mo.html * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::stretchTo): Revise assertion to use new 'isStretchy' predicate. * rendering/mathml/RenderMathMLOperator.h: (WebCore::RenderMathMLOperator::isStretchy): Added. * rendering/mathml/RenderMathMLRow.cpp: (WebCore::RenderMathMLRow::computeLineVerticalStretch): Use new 'isStretchy' predicate. (WebCore::RenderMathMLRow::layoutRowItems): Ditto. * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Ditto. (WebCore::RenderMathMLUnderOver::verticalParameters): Ditto. 2016-11-01 Dean Jackson <dino@apple.com> Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail https://bugs.webkit.org/show_bug.cgi?id=164310 Reviewed by Sam Weinig. When bringing up the new CSS parser, I discovered that our old parser was not conforming to the specification. Covered by existing tests. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseBuiltinFilterArguments): For these functions, clamp to 100% rather than fail. 2016-11-02 Brent Fulgham <bfulgham@apple.com> WebKit nullptr dereference Archive Subframe https://bugs.webkit.org/show_bug.cgi?id=164281 <rdar://problem/28943006> Reviewed by Andy Estes. If the page is torn down during a load, we can attempt to use a deallocated (and nulled) document loader. Most places that use the "active document loader" null-check it before using, but there was one place that did not. This patch fixes that oversight. Test: fast/dom/crash-with-bad-url.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): Check that the active document loader is non-null before using. 2016-11-02 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support scroll-snap-* properties https://bugs.webkit.org/show_bug.cgi?id=164321 Reviewed by Simon Fraser. * css/CSSPrimitiveValue.h: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertScrollSnapPoints): (WebCore::StyleBuilderConverter::convertSnapCoordinatePair): (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates): * css/parser/CSSPropertyParser.cpp: (WebCore::consumePositionLonghand): (WebCore::consumePositionX): (WebCore::consumePositionY): (WebCore::consumePositionList): (WebCore::consumeScrollSnapDestination): (WebCore::consumeScrollSnapPoints): (WebCore::CSSPropertyParser::parseSingleValue): 2016-11-02 David Kilzer <ddkilzer@apple.com> Add logging for "WebKit encountered an internal error" messages <https://webkit.org/b/164272> <rdar://problem/28546064> Reviewed by Alex Christensen. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::internalErrorKey): (WebCore::DiagnosticLoggingKeys::invalidSessionIDKey): (WebCore::DiagnosticLoggingKeys::createSharedBufferFailedKey): (WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey): - Add implementations for new key methods. * page/DiagnosticLoggingKeys.h: (WebCore::DiagnosticLoggingKeys::internalErrorKey): (WebCore::DiagnosticLoggingKeys::invalidSessionIDKey): (WebCore::DiagnosticLoggingKeys::createSharedBufferFailedKey): (WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey): - Add declarations for new key methods. 2016-11-02 Zalan Bujtas <zalan@apple.com> [Tables] Simplified layout skips captions. https://bugs.webkit.org/show_bug.cgi?id=164284 Reviewed by David Hyatt. This patch ensures that we take care of simplified normalflow captions during layout. Covered by fast/regions/table-caption-as-region.html * rendering/RenderTable.cpp: (WebCore::RenderTable::layoutCaption): (WebCore::RenderTable::layoutCaptions): _caption_side is 2bits, can't use bitmask. (WebCore::RenderTable::simplifiedNormalFlowLayout): (WebCore::RenderTable::layout): * rendering/RenderTable.h: 2016-11-02 Youenn Fablet <youenn@apple.com> REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache() https://bugs.webkit.org/show_bug.cgi?id=163905 Reviewed by Antti Koivisto. Covered by existing tests and http/tests/security/cached-cross-origin-shared-css-stylesheet.html Small refactoring to do more member fields initialization in StyleSheetContents header. Refactored StyleSheetContents::m_isInMemoryCache to be a counter instead of a boolean. This allows StyleSheetContents to be linked to several CachedCSSStyleSheets. * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::StyleSheetContents): (WebCore::StyleSheetContents::addedToMemoryCache): (WebCore::StyleSheetContents::removedFromMemoryCache): * css/StyleSheetContents.h: * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Making reuse of saveParsedStyleSheet to handle update of StyleSheetContents cache count. 2016-11-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Remove FileSystem::filenameToString() and use FileSystem::stringFromFileSystemRepresentation() everywhere instead https://bugs.webkit.org/show_bug.cgi?id=164315 Reviewed by Michael Catanzaro. * platform/FileSystem.h: * platform/glib/FileSystemGlib.cpp: (WebCore::stringFromFileSystemRepresentation): (WebCore::homeDirectoryPath): (WebCore::listDirectory): (WebCore::filenameToString): Deleted. 2016-11-02 Manuel Rego Casasnovas <rego@igalia.com> [css-grid] mimax(auto, <flex>) should be serialized as <flex> https://bugs.webkit.org/show_bug.cgi?id=164316 Reviewed by Sergio Villar Senin. * css/CSSComputedStyleDeclaration.cpp: (WebCore::specifiedValueForGridTrackSize): Add a simple if to serialize properly this case. * rendering/style/GridLength.h: (WebCore::GridLength::isAuto): Add new function to check if GridLength is or not "auto". 2016-11-02 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Enable creation of ReadableByteStreamController https://bugs.webkit.org/show_bug.cgi?id=164014 Reviewed by Youenn Fablet. Added support for creating ReadableByteStreamController. IDL is mostly implemented but methods return TypeError. Tests have been added to ensure behaviour. This part of Readable Streams API is associated to a flag (READABLE_BYTE_STREAM_API). Test: streams/readable-byte-stream-controller.html * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.cpp: * DerivedSources.make: * Modules/streams/ReadableByteStreamController.idl: Added. * Modules/streams/ReadableByteStreamController.js: Added. (enqueue): Empty method for the moment, throws TypeError. (error): Empty method for the moment, throws TypeError. (close): Empty method for the moment, throws TypeError. (byobRequest): Empty method for the moment, throws TypeError. (desiredSize): Empty method for the moment, throws TypeError. * Modules/streams/ReadableByteStreamInternals.js: Added. (privateInitializeReadableByteStreamController): * Modules/streams/ReadableStream.js: (initializeReadableStream): * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::addBuiltinGlobals): * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::constructJSReadableByteStreamController): (WebCore::constructJSReadableStreamDefaultReader): (WebCore::JSBuiltinReadableByteStreamControllerPrivateConstructor::initializeExecutable): (WebCore::createReadableByteStreamControllerPrivateConstructor): * bindings/js/JSReadableStreamPrivateConstructors.h: * bindings/js/WebCoreBuiltinNames.h: 2016-11-02 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: fullscreen toggle support https://bugs.webkit.org/show_bug.cgi?id=163728 <rdar://problem/27989486> Reviewed by Darin Adler. We introduce the FullscreenSupport class which brings support for entering and exiting fullscreen by clicking on the fullscreen button in the media controls and correctly reflecting the media's fullscreen state should it be changed via the media API. Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-click.html media/modern-media-controls/fullscreen-support/fullscreen-support-enabled.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/fullscreen-support.js: Added. (FullscreenSupport): (FullscreenSupport.prototype.get control): (FullscreenSupport.prototype.get mediaEvents): (FullscreenSupport.prototype.buttonWasClicked): (FullscreenSupport.prototype.syncControl): * Modules/modern-media-controls/media/media-controller.js: (MediaController): * WebCore.xcodeproj/project.pbxproj: 2016-11-02 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: PiP support https://bugs.webkit.org/show_bug.cgi?id=163730 <rdar://problem/27989485> Reviewed by Dean Jackson. We introduce the PiPSupport class which brings support for entering picture-in-picture by clicking on the PiP button in the media controls and enabling the button only when picture-in-picture mode is available. Tests: media/modern-media-controls/pip-support/pip-support-click.html media/modern-media-controls/pip-support/pip-support-enabled.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/pip-support.js: Added. (PiPSupport.prototype.get control): (PiPSupport.prototype.get mediaEvents): (PiPSupport.prototype.buttonWasClicked): (PiPSupport.prototype.syncControl): (PiPSupport): * WebCore.xcodeproj/project.pbxproj: 2016-11-01 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the shadow DOM https://bugs.webkit.org/show_bug.cgi?id=164240 Reviewed by Dean Jackson. * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. * css/SelectorFilter.cpp: (WebCore::SelectorFilter::collectIdentifierHashes): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. * css/SelectorPseudoElementTypeMap.in: Add support for slotted. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::appendTagHistory): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. Take :slotted out of needsImplicitShadowCombinatorForMatching(), since our code doesn't do this for :slotted. * css/parser/CSSSelectorParser.cpp: (WebCore::isPseudoClassFunction): :host can be both an id and a function, so don't restrict it. (WebCore::CSSSelectorParser::consumePseudo): Put in a hack for :host (inside the hack we already plan on removing once we turn on). (WebCore::CSSSelectorParser::consumeCombinator): Remove deep shadow combinator support, as we don't support matching on it. (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded): (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator): Make the split use our combinator, ShadowDescendant, and no longer do anything special with :slotted. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. 2016-11-01 Wenson Hsieh <wenson_hsieh@apple.com> Turn the Input Events runtime flag on by default https://bugs.webkit.org/show_bug.cgi?id=164297 Reviewed by Ryosuke Niwa. Set the initial value of inputEventsEnabled in Settings to true. * page/Settings.in: 2016-11-01 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support IDBIndex getAll/getAllKeys. <rdar://problem/28806933> and https://bugs.webkit.org/show_bug.cgi?id=164294 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/idbindex-getall-1-private.html storage/indexeddb/modern/idbindex-getall-1.html storage/indexeddb/modern/idbindex-getallkeys-1-private.html storage/indexeddb/modern/idbindex-getallkeys-1.html Existing imported W3C tests. * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::getAll): (WebCore::IDBIndex::getAllKeys): * Modules/indexeddb/IDBIndex.h: * Modules/indexeddb/IDBIndex.idl: * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::create): (WebCore::IDBRequest::createIndexGet): (WebCore::IDBRequest::createCount): Deleted. (WebCore::IDBRequest::createGet): Deleted. * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::requestGetAllIndexRecords): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::requestCount): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/server/IndexValueStore.cpp: (WebCore::IDBServer::IndexValueStore::allValuesForKey): * Modules/indexeddb/server/IndexValueStore.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords): * Modules/indexeddb/server/MemoryIndex.cpp: (WebCore::IDBServer::MemoryIndex::getAllRecords): * Modules/indexeddb/server/MemoryIndex.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords): (WebCore::IDBServer::queryForGetAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords): (WebCore::IDBServer::queryForGetAllRecords): Deleted. * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 2016-11-01 Ryosuke Niwa <rniwa@webkit.org> Remove CUSTOM_ELEMENTS build flag https://bugs.webkit.org/show_bug.cgi?id=164267 Reviewed by Antti Koivisto. Removed the build flag. Also rebaselined the bindings tests. * Configurations/FeatureDefines.xcconfig: * DerivedSources.cpp: * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::customElementsEnabled): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::putDelegate): * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementInterface.h: * bindings/js/JSCustomElementRegistryCustom.cpp: * bindings/js/JSDOMStringMapCustom.cpp: (WebCore::JSDOMStringMap::deleteProperty): (WebCore::JSDOMStringMap::putDelegate): * bindings/js/JSElementCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): * bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::setLength): (WebCore::JSHTMLOptionsCollection::indexSetter): * bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::JSHTMLSelectElement::indexSetter): * bindings/js/JSMainThreadExecState.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::setJSTestCEReactionsAttributeWithCEReactionsFunction): (WebCore::setJSTestCEReactionsReflectAttributeWithCEReactionsFunction): (WebCore::setJSTestCEReactionsStringifierAttributeFunction): (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactions): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::setJSTestCEReactionsStringifierValueFunction): * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: * css/PropertySetCSSStyleDeclaration.cpp: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorCheckerTestFunctions.h: (WebCore::isDefinedElement): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): * dom/CustomElementReactionQueue.cpp: * dom/CustomElementReactionQueue.h: * dom/CustomElementRegistry.cpp: * dom/CustomElementRegistry.h: * dom/CustomElementRegistry.idl: * dom/Document.cpp: (WebCore::createHTMLElementWithNameValidation): (WebCore::createFallbackHTMLElement): * dom/Element.cpp: (WebCore::Element::attributeChanged): (WebCore::Element::didMoveToNewDocument): (WebCore::Element::insertedInto): (WebCore::Element::removedFrom): * dom/Element.h: * dom/ElementRareData.cpp: * dom/ElementRareData.h: (WebCore::ElementRareData::setCustomElementReactionQueue): * dom/Node.h: (WebCore::Node::isFailedCustomElement): * dom/make_names.pl: (printWrapperFactoryCppFile): * html/HTMLElement.idl: * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): * html/parser/HTMLConstructionSite.h: * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::insertGenericHTMLElement): (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): * html/parser/HTMLTreeBuilder.h: (WebCore::HTMLTreeBuilder::hasParserBlockingScriptWork): * page/DOMWindow.cpp: * page/DOMWindow.h: * page/DOMWindow.idl: 2016-11-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: Airplay support https://bugs.webkit.org/show_bug.cgi?id=163729 <rdar://problem/27989484> Reviewed by Dean Jackson. We introduce the AirplaySupport class which brings support for playing the media via Airplay by clicking on the Airplay button in the media controls and correctly reflecting when the media is played through Airplay via the media API. The enabled state of the Airplay button is also tied to Airplay sources being available. Test: media/modern-media-controls/airplay-support/airplay-support.html * Modules/modern-media-controls/controls/airplay-button.js: (AirplayButton.prototype.get on): * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/airplay-support.js: Added. (AirplaySupport.prototype.get control): (AirplaySupport.prototype.get mediaEvents): (AirplaySupport.prototype.buttonWasClicked): (AirplaySupport.prototype.handleEvent): (AirplaySupport.prototype.syncControl): (AirplaySupport): * Modules/modern-media-controls/media/media-controller.js: (MediaController): * WebCore.xcodeproj/project.pbxproj: 2016-11-01 Dean Jackson <dino@apple.com> Remove WebKitCSSFilterValue to make Hyatt happy https://bugs.webkit.org/show_bug.cgi?id=164289 <rdar://problems/29050973> Reviewed by Simon Fraser. The new CSS parser should not use WebKitCSSFilterValue. It's non-standard, very likely only used in our tests, doesn't provide much benefit, and will be covered by the new CSSOM function interface. Covered by modifying existing tests. * DerivedSources.make: Remove WebKitCSSFilterValue.idl. * WebCore.xcodeproj/project.pbxproj: Make CSSFunctionValue.h private so API testing can see it. * bindings/js/JSCSSValueCustom.cpp: (WebCore::toJSNewlyCreated): No WebKitCSSFilterValue. * css/CSSComputedStyleDeclaration.cpp: Use CSSFunctionValue or CSSPrimitiveValue to build up the computed style. (WebCore::ComputedStyleExtractor::valueForFilter): * css/CSSValue.cpp: No WebKitCSSFilterValue. (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): (WebCore::CSSValue::cloneForCSSOM): * css/CSSValue.h: (WebCore::CSSValue::isFilterImageValue): (WebCore::CSSValue::isWebKitCSSFilterValue): Deleted. * css/StyleResolver.cpp: Resolve against CSSFunctionValues with CSSValueIDs as name, rather than WebKitCSSFilterValue. (WebCore::filterOperationForType): (WebCore::StyleResolver::createFilterOperations): * css/StyleResolver.h: * css/WebKitCSSFilterValue.cpp: Removed. * css/WebKitCSSFilterValue.h: Removed. * css/WebKitCSSFilterValue.idl: Removed. * css/parser/CSSParser.cpp: Parse into CSSPrimitiveValue and CSSFunctionValue. (WebCore::isValidPrimitiveFilterFunction): (WebCore::CSSParser::parseBuiltinFilterArguments): (WebCore::cssValueKeywordIDForFunctionName): (WebCore::CSSParser::parseFilter): (WebCore::filterInfoForName): Deleted. * css/parser/CSSParser.h: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFilterFunction): 2016-11-01 Simon Fraser <simon.fraser@apple.com> Add ViewportAPI to features.json * features.json: 2016-11-01 Joseph Pecoraro <pecoraro@apple.com> Unreviewed build fix for r208240. * inspector/InspectorInstrumentation.h: Don't export an inlined function. 2016-11-01 Eric Carlson <eric.carlson@apple.com> [MediaStream] restrict media capture secure connections https://bugs.webkit.org/show_bug.cgi?id=164234 <rdar://problem/28944906> Reviewed by Alex Christensen. Tests: http/tests/ssl/media-stream/get-user-media-different-host.html http/tests/ssl/media-stream/get-user-media-nested.html http/tests/ssl/media-stream/get-user-media-secure-connection.html * Modules/mediastream/UserMediaRequest.cpp: (WebCore::isSecure): New. (WebCore::canCallGetUserMedia): New. (WebCore::UserMediaRequest::start): When the setting says the require secure a secure connection, fail immediately if the page or one of its ancestors is not secure. * page/Settings.cpp: (WebCore::Settings::mediaCaptureRequiresSecureConnection): New. (WebCore::Settings::setMediaCaptureRequiresSecureConnection): New. * page/Settings.h: * testing/InternalSettings.cpp: (WebCore::InternalSettings::InternalSettings): Do not require a secure connection for media capture during tests. (WebCore::InternalSettings::resetToConsistentState): (WebCore::InternalSettings::setMediaCaptureRequiresSecureConnection): * testing/InternalSettings.h: * testing/InternalSettings.idl: * testing/Internals.cpp: (WebCore::Internals::Internals): 2016-11-01 Gavin Barraclough <barraclough@apple.com> Port Page timer throttling to use ActivityState instead of PageThrottler https://bugs.webkit.org/show_bug.cgi?id=164291 Reviewed by Geoff Garen & Antti Koivisto. ActivityState now conveys this information; after this change PageThrottler is redundant and can be removed. * page/Page.cpp: (WebCore::Page::updateTimerThrottlingState): - determine page throttling mode based on IsAudible/IsLoading in ActivityState. (WebCore::Page::setActivityState): - call updateTimerThrottlingState if IsAudible/IsLoading change. * page/Page.h: (WebCore::Page::pageActivityStateChanged): - no need to listen for PageActivityState changes from the PageThrottler. 2016-11-01 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: Placard support https://bugs.webkit.org/show_bug.cgi?id=163731 <rdar://problem/28869598> Reviewed by Dean Jackson. We introduce the PlacardSupport class which brings support for showing the appropriate placard when the media is played via AirPlay or in picture-in-picture. Tests: media/modern-media-controls/placard-support/placard-support-airplay.html media/modern-media-controls/placard-support/placard-support-pip.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/placard-support.js: Added. (PlacardSupport): (PlacardSupport.prototype.get mediaEvents): (PlacardSupport.prototype.handleEvent): (PlacardSupport.prototype._updatePlacard): * WebCore.xcodeproj/project.pbxproj: 2016-11-01 Zalan Bujtas <zalan@apple.com> ShowRenderTree: Add information about the type of the needsLayout bit. https://bugs.webkit.org/show_bug.cgi?id=164287 Reviewed by Simon Fraser. Currently showRenderTree only tells you whether a renderer's "needs layout bit" is set or not. With certain type of layout bugs, it's essential to know the kind of layout a particular renderer needs. This patch extends the renderer output by listing all the layout bits set. B------- -+ BODY RenderBody (0.00, 0.00) (0.00, 0.00) renderer->(0x) node->(0x) layout->[self][normal child] Not testable. * rendering/RenderObject.cpp: (WebCore::RenderObject::showRenderObject): 2016-11-01 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Use more references in inspector code https://bugs.webkit.org/show_bug.cgi?id=164283 Reviewed by Timothy Hatcher. (WebCore::frameForScriptExecutionContext): (WebCore::InspectorInstrumentation::didInstallTimerImpl): (WebCore::InspectorInstrumentation::didRemoveTimerImpl): (WebCore::InspectorInstrumentation::willFireTimerImpl): (WebCore::InspectorInstrumentation::didLayoutImpl): (WebCore::InspectorInstrumentation::willPaintImpl): (WebCore::InspectorInstrumentation::didPaintImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::continueAfterPingLoader): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Convert to references where possible. * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getMatchedStylesForNode): (WebCore::InspectorCSSAgent::buildObjectForRule): (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): * inspector/InspectorCSSAgent.h: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::frameDocumentUpdated): * inspector/InspectorDOMAgent.h: * inspector/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent): * inspector/InspectorDOMStorageAgent.h: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::frameNavigated): (WebCore::InspectorPageAgent::didPaint): * inspector/InspectorPageAgent.h: * inspector/InspectorReplayAgent.cpp: (WebCore::InspectorReplayAgent::frameNavigated): * inspector/InspectorReplayAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::didLayout): (WebCore::InspectorTimelineAgent::didPaint): * inspector/InspectorTimelineAgent.h: Pass references through InspectorInstrumentation to the Agents. * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): * page/DOMTimer.cpp: (WebCore::DOMTimer::install): (WebCore::DOMTimer::removeById): (WebCore::DOMTimer::fired): * page/DOMWindow.cpp: (WebCore::DOMWindow::willDetachPage): * page/Frame.cpp: (WebCore::Frame::setDocument): * page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::willPaintContents): (WebCore::FrameView::didPaintContents): * page/Page.cpp: (WebCore::networkStateChanged): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintContents): * replay/ReplayController.cpp: (WebCore::ReplayController::frameNavigated): * replay/ReplayController.h: * storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames): (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames): * workers/Worker.cpp: (WebCore::Worker::notifyFinished): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::importScripts): (WebCore::WorkerGlobalScope::addConsoleMessage): (WebCore::WorkerGlobalScope::addMessage): * workers/WorkerInspectorProxy.cpp: (WebCore::WorkerInspectorProxy::workerStartMode): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): * workers/WorkerInspectorProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Pass references to InspectorInstrumentation. 2016-11-01 Alex Christensen <achristensen@webkit.org> Percent-encode non-ASCII code points in hosts of URLs with unrecognized schemes https://bugs.webkit.org/show_bug.cgi?id=164290 Reviewed by Tim Horton. NSURL fails to parse these URLs, WebKit used to punycode encode them, but now we match Chrome and Firefox, as well as what will likely become the standard once https://github.com/whatwg/url/issues/148 is resolved. We continue to parse IPv6 address hosts because otherwise we wouldn't be able to tell where a port starts in a URL with colons in the IPv6 address and before the port like "a://[b::c]:4" Covered by new API tests and updated LayoutTests. * platform/URLParser.cpp: (WebCore::URLParser::domainToASCII): (WebCore::URLParser::parseHostAndPort): 2016-11-01 Gavin Barraclough <barraclough@apple.com> Add IsAudible, IsLoading to ActivityState https://bugs.webkit.org/show_bug.cgi?id=164286 Reviewed by Geoff Garen. By computing these values in the UIProcess and passing them to WebContent we can more closely unify iOS & macOS throttling, and remove the PageThrottler class. * page/ActivityState.h: - added IsAudible, IsLoading 2016-10-31 Gavin Barraclough <barraclough@apple.com> Rename ViewState to ActivityState https://bugs.webkit.org/show_bug.cgi?id=164254 Reviewed by Andreas Kling. We plan to add a couple more flags to ViewState that aren't directly related to the view itself - whether there is an ongoing page load, and whether whether there is audio playback. This will allow viewState (now activityState) to fully drive throttling decisions. Renaming this bitfield accordingly. * Modules/geolocation/GeolocationController.cpp: (WebCore::GeolocationController::GeolocationController): (WebCore::GeolocationController::~GeolocationController): (WebCore::GeolocationController::activityStateDidChange): (WebCore::GeolocationController::viewStateDidChange): Deleted. * Modules/geolocation/GeolocationController.h: * WebCore.xcodeproj/project.pbxproj: * page/ActivityState.h: Copied from Source/WebCore/page/ViewState.h. * page/ActivityStateChangeObserver.h: Copied from Source/WebCore/page/ViewStateChangeObserver.h. (WebCore::ActivityStateChangeObserver::~ActivityStateChangeObserver): (WebCore::ViewStateChangeObserver::~ViewStateChangeObserver): Deleted. * page/FocusController.cpp: (WebCore::FocusController::FocusController): (WebCore::FocusController::setFocused): (WebCore::FocusController::setActivityState): (WebCore::FocusController::setActive): (WebCore::FocusController::setViewState): Deleted. * page/FocusController.h: (WebCore::FocusController::isActive): (WebCore::FocusController::isFocused): (WebCore::FocusController::contentIsVisible): * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::setIsInWindow): (WebCore::Page::addActivityStateChangeObserver): (WebCore::Page::removeActivityStateChangeObserver): (WebCore::Page::updateTimerThrottlingState): (WebCore::Page::setActivityState): (WebCore::Page::isVisibleAndActive): (WebCore::Page::setIsVisible): (WebCore::Page::addViewStateChangeObserver): Deleted. (WebCore::Page::removeViewStateChangeObserver): Deleted. (WebCore::Page::setViewState): Deleted. * page/Page.h: (WebCore::Page::isVisible): (WebCore::Page::isInWindow): * page/PageThrottler.h: * page/ViewState.h: Removed. * page/ViewStateChangeObserver.h: Removed. 2016-11-01 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208100. This change caused LayoutTest crashes under GuardMalloc. Reverted changeset: "MediaEndpoint::generateDtlsInfo is not needed" https://bugs.webkit.org/show_bug.cgi?id=164130 http://trac.webkit.org/changeset/208100 2016-11-01 Claudio Saavedra <csaavedra@igalia.com> Add missing inline include to JSDeviceMotionEventCustom https://bugs.webkit.org/show_bug.cgi?id=164269 Reviewed by Michael Catanzaro. Inlined JSObject functions are used through JSObject::get() get here, so this fixes the build with -fvisibility-inlines-hidden. * bindings/js/JSDeviceMotionEventCustom.cpp: Include JSObjectInlines.h 2016-11-01 Fujii Hironori <Hironori.Fujii@sony.com> [CMake] generate-bindings-all.pl uses USES_TERMINAL which leaves a noisy line in interactive Ninja build https://bugs.webkit.org/show_bug.cgi?id=163868 Reviewed by Michael Catanzaro. It takes long time for generate-bindings-all.pl to generate all bindings. So, it shows the progress while running and USES_TERMINAL option of add_custom_target have been used to invoke the command. However, USES_TERMINAL leaves a noisy line in Ninja's neat build log of interactive build. A new CMake option SHOW_BINDINGS_GENERATION_PROGRESS is added to stop using USES_TERMINAL only in case of interactive Ninja build. * bindings/scripts/generate-bindings-all.pl: Added a new switch --showProgress. Removed $terminalWidth and getTerminalWidth which are mainly for interactive Ninja build. Added printProgress. 2016-11-01 Ryosuke Niwa <rniwa@webkit.org> Web Inspector: Add the support for custom elements https://bugs.webkit.org/show_bug.cgi?id=164266 <rdar://problem/29038883> Reviewed by Joseph Pecoraro. Set "customElementState" property on each DOMNode object when building a protocol object for the node. Also added InspectorInstrumentation::didChangeCustomElementState to track the changes to custom element states. Tests: inspector/dom/customElementState.html * dom/Element.cpp: (WebCore::Element::setIsDefinedCustomElement): Invoke didChangeCustomElementState to update the state. (WebCore::Element::setIsFailedCustomElement): Ditto. (WebCore::Element::setIsCustomElementUpgradeCandidate): Ditto. (WebCore::Element::enqueueToUpgrade): Ditto. * inspector/InspectorDOMAgent.cpp: (WebCore::customElementState): Added. (WebCore::InspectorDOMAgent::buildObjectForNode): Set the custom element state. (WebCore::InspectorDOMAgent::didChangeCustomElementState): Invoke customElementStateChanged. * inspector/InspectorDOMAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didChangeCustomElementStateImpl): Added. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didChangeCustomElementState): Added. 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> Add StaticPasteboard.cpp to the cmake after r207841. * CMakeLists.txt: 2016-10-31 Zalan Bujtas <zalan@apple.com> Simple line layout: Clear needs layout flag even when only overflow is getting recomputed. https://bugs.webkit.org/show_bug.cgi?id=164253 Reviewed by Antti Koivisto. When a style change triggers visual overflow re-computation, we set StyleDifferenceLayout style diff but in practice we don't actually make changes to the simple line structure. We just re-compute the visual overflow later. This patch moves the 'clean the renderes' logic back to RenderBlockFlow::layoutSimpleLines so that we set the needs layout bit to false regardless of whether we preformed layout. Covered by fast/events/tabindex-focus-blur-all.html * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutSimpleLines): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::create): 2016-10-31 Simon Fraser <simon.fraser@apple.com> Add basic visual/layout viewport support for fixed position layout https://bugs.webkit.org/show_bug.cgi?id=164261 Reviewed by Dean Jackson. This patch adds a new behavior for position:fixed objects on zooming. Instead of interpolating between two implicit viewports as we do now, have explicit and distinct layout and visual viewports. The layout viewport is always the size of the initial containing block (i.e. the RenderView). Position:fixed and sticky elements are laid out relative to the layout viewport. The visual viewport is the visible part of the view, in content coordinates. When the user pans and zooms, the visual viewport changes. If it hits the edge of the layout viepwort, it pushes the layout viewport in that direction; it's as if the user is dragging the layout viewport around. The layout viewport is maintained on FrameView, and has to be recomputed when the scroll position changes, when the view size changes, and when the content size (which affets min/max scroll position) changes. Layout viewport size and position are computed in unzoomed coordinates, requiring some new functions on FrameView to return these. Updated the TileCoverageMap to show the layout viewport visually. Subsequent patches will plumb the layout and visual viewports through the scrolling tree. Tests: fast/visual-viewport/nonzoomed-rects.html fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html fast/visual-viewport/zoomed-fixed.html fast/visual-viewport/zoomed-rects.html * page/FrameView.cpp: (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): (WebCore::FrameView::scrollPositionRespectingCustomFixedPosition): (WebCore::FrameView::computeLayoutViewportOrigin): (WebCore::FrameView::setLayoutViewportOrigin): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::minStableLayoutViewportOrigin): (WebCore::FrameView::maxStableLayoutViewportOrigin): (WebCore::FrameView::layoutViewportRect): (WebCore::FrameView::visualViewportRect): (WebCore::FrameView::viewportConstrainedVisibleContentRect): (WebCore::FrameView::rectForFixedPositionLayout): (WebCore::FrameView::scrollPositionForFixedPosition): (WebCore::FrameView::unscaledMinimumScrollPosition): (WebCore::FrameView::unscaledMaximumScrollPosition): (WebCore::FrameView::scrollPositionChanged): (WebCore::FrameView::availableContentSizeChanged): (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::scrollTo): (WebCore::FrameView::useCustomFixedPositionLayoutRect): * page/FrameView.h: * page/Settings.in: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * platform/graphics/TiledBacking.h: * platform/graphics/ca/TileController.cpp: (WebCore::TileController::setLayoutViewportRect): * platform/graphics/ca/TileController.h: * platform/graphics/ca/TileCoverageMap.cpp: (WebCore::TileCoverageMap::TileCoverageMap): (WebCore::TileCoverageMap::update): * platform/graphics/ca/TileCoverageMap.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateCompositedBounds): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): (WebCore::RenderLayerCompositor::computeFixedViewportConstraints): * rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation): Logging here is useful when debugging tests. * testing/Internals.cpp: (WebCore::Internals::layoutViewportRect): Expose these rects so tests can dump them. (WebCore::Internals::visualViewportRect): * testing/Internals.h: * testing/Internals.idl: 2016-10-31 Simon Fraser <simon.fraser@apple.com> Fix bindings tests after r208209. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::setJSTestObjTypedArrayAttrFunction): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::constructJSTestOverloadedConstructors1): (WebCore::constructJSTestOverloadedConstructors2): 2016-10-31 Joseph Pecoraro <pecoraro@apple.com> Warning: Multiple build commands for output file RenderThemeCocoa.h https://bugs.webkit.org/show_bug.cgi?id=164265 Reviewed by Ryosuke Niwa. * WebCore.xcodeproj/project.pbxproj: 2016-10-29 Filip Pizlo <fpizlo@apple.com> JSC should support SharedArrayBuffer https://bugs.webkit.org/show_bug.cgi?id=163986 Reviewed by Keith Miller. New tests added in the LayoutTests/workers/sab directory. This teaches WebCore that a typed array could be shared or not. By default, WebCore will reject shared typed arrays as if they were not typed arrays. This ensures that we don't get race conditions in code that can't handle it. If you postMessage a SharedArrayBuffer or something that wraps it, you will send the shared memory to the other worker. * Modules/encryptedmedia/CDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::cachedKeyForKeyID): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::getChannelData): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::send): * bindings/js/JSBlobCustom.cpp: (WebCore::constructJSBlob): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createRsaKeyGenParams): * bindings/js/JSCryptoCustom.cpp: (WebCore::JSCrypto::getRandomValues): * bindings/js/JSCryptoOperationData.cpp: (WebCore::cryptoOperationDataFromJSValue): * bindings/js/JSDOMBinding.h: (WebCore::toJS): (WebCore::toPossiblySharedArrayBufferView): (WebCore::toUnsharedArrayBufferView): (WebCore::toPossiblySharedInt8Array): (WebCore::toPossiblySharedInt16Array): (WebCore::toPossiblySharedInt32Array): (WebCore::toPossiblySharedUint8Array): (WebCore::toPossiblySharedUint8ClampedArray): (WebCore::toPossiblySharedUint16Array): (WebCore::toPossiblySharedUint32Array): (WebCore::toPossiblySharedFloat32Array): (WebCore::toPossiblySharedFloat64Array): (WebCore::toUnsharedInt8Array): (WebCore::toUnsharedInt16Array): (WebCore::toUnsharedInt32Array): (WebCore::toUnsharedUint8Array): (WebCore::toUnsharedUint8ClampedArray): (WebCore::toUnsharedUint16Array): (WebCore::toUnsharedUint32Array): (WebCore::toUnsharedFloat32Array): (WebCore::toUnsharedFloat64Array): (WebCore::toArrayBufferView): Deleted. (WebCore::toInt8Array): Deleted. (WebCore::toInt16Array): Deleted. (WebCore::toInt32Array): Deleted. (WebCore::toUint8Array): Deleted. (WebCore::toUint8ClampedArray): Deleted. (WebCore::toUint16Array): Deleted. (WebCore::toUint32Array): Deleted. (WebCore::toFloat32Array): Deleted. (WebCore::toFloat64Array): Deleted. * bindings/js/JSDataCueCustom.cpp: (WebCore::constructJSDataCue): * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): * bindings/js/JSFileCustom.cpp: (WebCore::constructJSFile): * bindings/js/JSMessagePortCustom.cpp: (WebCore::extractTransferables): * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: (WebCore::dataFunctionf): (WebCore::dataFunctioni): (WebCore::dataFunctionMatrix): * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::send): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpArrayBufferView): (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneDeserializer::readArrayBufferView): (WebCore::CloneDeserializer::readTerminal): (WebCore::SerializedScriptValue::transferArrayBuffers): * bindings/js/StructuredClone.cpp: (WebCore::structuredCloneArrayBuffer): (WebCore::structuredCloneArrayBufferView): * bindings/scripts/CodeGeneratorJS.pm: (JSValueToNative): * css/FontFace.cpp: (WebCore::FontFace::create): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::bufferData): (WebCore::WebGL2RenderingContext::bufferSubData): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData): 2016-10-31 Simon Fraser <simon.fraser@apple.com> Make UIScriptController::zoomToScale() work on Mac WK1 and WK2 https://bugs.webkit.org/show_bug.cgi?id=164238 Reviewed by Dean Jackson. Test: fast/zooming/uiscript-zooming.html Expose pageScaleFactor() for tests. * testing/Internals.cpp: (WebCore::Internals::pageScaleFactor): * testing/Internals.h: * testing/Internals.idl: 2016-10-31 Myles C. Maxfield <mmaxfield@apple.com> Migrate CanvasRenderingContext's internal canvas pointer to a reference https://bugs.webkit.org/show_bug.cgi?id=164259 Reviewed by Dean Jackson. It is never nullptr. No new tests because there is no behavior change. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::getContext): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::CanvasRenderingContext): (WebCore::CanvasRenderingContext::wouldTaintOrigin): (WebCore::CanvasRenderingContext::checkOrigin): * html/canvas/CanvasRenderingContext.h: (WebCore::CanvasRenderingContext::ref): (WebCore::CanvasRenderingContext::deref): (WebCore::CanvasRenderingContext::canvas): (WebCore::CanvasRenderingContext::checkOrigin): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D): (WebCore::CanvasRenderingContext2D::unwindStateStack): (WebCore::CanvasRenderingContext2D::isAccelerated): (WebCore::CanvasRenderingContext2D::realizeSaves): (WebCore::CanvasRenderingContext2D::setStrokeStyle): (WebCore::CanvasRenderingContext2D::setFillStyle): (WebCore::CanvasRenderingContext2D::setShadowColor): (WebCore::CanvasRenderingContext2D::resetTransform): (WebCore::CanvasRenderingContext2D::setStrokeColor): (WebCore::CanvasRenderingContext2D::setFillColor): (WebCore::CanvasRenderingContext2D::setShadow): (WebCore::CanvasRenderingContext2D::clearCanvas): (WebCore::CanvasRenderingContext2D::transformAreaToDevice): (WebCore::CanvasRenderingContext2D::rectContainsCanvas): (WebCore::CanvasRenderingContext2D::calculateCompositingBufferRect): (WebCore::CanvasRenderingContext2D::compositeBuffer): (WebCore::CanvasRenderingContext2D::createPattern): (WebCore::CanvasRenderingContext2D::didDrawEntireCanvas): (WebCore::CanvasRenderingContext2D::didDraw): (WebCore::CanvasRenderingContext2D::paintRenderingResultsToCanvas): (WebCore::CanvasRenderingContext2D::drawingContext): (WebCore::CanvasRenderingContext2D::getImageData): (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): (WebCore::CanvasRenderingContext2D::putImageData): (WebCore::CanvasRenderingContext2D::setFont): (WebCore::CanvasRenderingContext2D::toTextDirection): (WebCore::CanvasRenderingContext2D::direction): (WebCore::CanvasRenderingContext2D::platformLayer): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::WebGLRenderingContext): * html/canvas/WebGLRenderingContext.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): (WebCore::WebGLRenderingContextBase::setupFlags): (WebCore::WebGLRenderingContextBase::markContextChanged): (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas): (WebCore::WebGLRenderingContextBase::reshape): (WebCore::WebGLRenderingContextBase::isContextLostOrPending): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::loseContextImpl): (WebCore::WebGLRenderingContextBase::printWarningToConsole): (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent): (WebCore::WebGLRenderingContextBase::maybeRestoreContext): (WebCore::WebGLRenderingContextBase::clampedCanvasSize): * html/canvas/WebGLRenderingContextBase.h: 2016-10-31 Brady Eidson <beidson@apple.com> Address style feedback in https://bugs.webkit.org/show_bug.cgi?id=164097 https://bugs.webkit.org/show_bug.cgi?id=164248 Unreviewed. Addressing review feedback (and then some) from Darin Adler on earlier patch. No new tests (No behavior change). * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::commit): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::createIndex): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::requestOpenCursor): (WebCore::IDBTransaction::doRequestOpenCursor): (WebCore::IDBTransaction::iterateCursor): (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): (WebCore::IDBTransaction::requestGetRecord): (WebCore::IDBTransaction::requestGetValue): (WebCore::IDBTransaction::requestGetKey): (WebCore::IDBTransaction::requestIndexRecord): (WebCore::IDBTransaction::requestCount): (WebCore::IDBTransaction::requestDeleteRecord): (WebCore::IDBTransaction::requestClearObjectStore): (WebCore::IDBTransaction::requestPutOrAdd): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::deleteIndex): * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::createObjectStore): (WebCore::IDBClient::IDBConnectionProxy::renameObjectStore): (WebCore::IDBClient::IDBConnectionProxy::renameIndex): (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore): (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore): (WebCore::IDBClient::IDBConnectionProxy::createIndex): (WebCore::IDBClient::IDBConnectionProxy::deleteIndex): (WebCore::IDBClient::IDBConnectionProxy::putOrAdd): (WebCore::IDBClient::IDBConnectionProxy::getRecord): (WebCore::IDBClient::IDBConnectionProxy::getAllRecords): (WebCore::IDBClient::IDBConnectionProxy::getCount): (WebCore::IDBClient::IDBConnectionProxy::deleteRecord): (WebCore::IDBClient::IDBConnectionProxy::openCursor): (WebCore::IDBClient::IDBConnectionProxy::iterateCursor): * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction): (WebCore::IDBServer::MemoryIDBBackingStore::abortTransaction): (WebCore::IDBServer::MemoryIDBBackingStore::commitTransaction): (WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore): (WebCore::IDBServer::MemoryIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore): (WebCore::IDBServer::MemoryIDBBackingStore::clearObjectStore): (WebCore::IDBServer::MemoryIDBBackingStore::createIndex): (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex): (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex): (WebCore::IDBServer::MemoryIDBBackingStore::keyExistsInObjectStore): (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange): (WebCore::IDBServer::MemoryIDBBackingStore::addRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords): (WebCore::IDBServer::MemoryIDBBackingStore::getIndexRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getCount): (WebCore::IDBServer::MemoryIDBBackingStore::generateKeyNumber): (WebCore::IDBServer::MemoryIDBBackingStore::openCursor): (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor): * Modules/indexeddb/shared/IDBResultData.cpp: (WebCore::IDBResultData::error): (WebCore::IDBResultData::openDatabaseSuccess): (WebCore::IDBResultData::openDatabaseUpgradeNeeded): (WebCore::IDBResultData::deleteDatabaseSuccess): (WebCore::IDBResultData::putOrAddSuccess): (WebCore::IDBResultData::getRecordSuccess): (WebCore::IDBResultData::getAllRecordsSuccess): (WebCore::IDBResultData::getCountSuccess): (WebCore::IDBResultData::openCursorSuccess): (WebCore::IDBResultData::iterateCursorSuccess): 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> Enable custom elements by default everywhere https://bugs.webkit.org/show_bug.cgi?id=164242 Reviewed by Antti Koivisto. Set the status of Custom Elements API to "Done". * features.json: 2016-10-31 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r207967. This change seems to be the cause of at least one LayoutTest becoming flaky. Reverted changeset: "REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()" https://bugs.webkit.org/show_bug.cgi?id=163905 http://trac.webkit.org/changeset/207967 2016-10-31 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Shadow DOM scoped styles are missing https://bugs.webkit.org/show_bug.cgi?id=164247 <rdar://problem/29035061> Reviewed by Antti Koivisto. Test: inspector/css/shadow-scoped-style.html * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::matchAuthorRules): Only match :host pseudo class for NOPSEUDO. It doesn't make sense with a pseudo element request (:host::before does not make sense). * css/InspectorCSSOMWrappers.h: * css/InspectorCSSOMWrappers.cpp: (WebCore::InspectorCSSOMWrappers::collectFromStyleSheetContents): (WebCore::InspectorCSSOMWrappers::collectDocumentWrappers): (WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets): Simplify existing "once per document" wrapper collection. (WebCore::InspectorCSSOMWrappers::maybeCollectFromStyleSheets): (WebCore::InspectorCSSOMWrappers::collectScopeWrappers): Include a path to add style sheets that weren't already collected. This will be useful when trying the StyleScope stylesheets which are different for different nodes. * inspector/InspectorCSSAgent.cpp: (WebCore::containingStyleScopeForElement): (WebCore::InspectorCSSAgent::buildObjectForRule): Collect rules for document and StyleScope sheets separately. For elements with a shadow root, add the root's sheets as well in case there are :host rules that affect the element. 2016-10-31 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208180. This change caused fast/shadow-dom/slotted-pseudo-element-css- text.html to crash on macOS and iOS on every test run. Reverted changeset: "[CSS Parser] Support the shadow DOM" https://bugs.webkit.org/show_bug.cgi?id=164240 http://trac.webkit.org/changeset/208180 2016-10-31 Nan Wang <n_wang@apple.com> AX: aria-sort is not exposed on iOS https://bugs.webkit.org/show_bug.cgi?id=164245 Reviewed by Chris Fleizach. Exposed the aria-sort attribute value in accessibilitySortDirection. Test: accessibility/ios-simulator/aria-sort-ios.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilitySortDirection]): 2016-10-31 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208178. The test added with this change fails or times out on macOS and iOS. Reverted changeset: "[Modern Media Controls] Media Controller: Airplay support" https://bugs.webkit.org/show_bug.cgi?id=163729 http://trac.webkit.org/changeset/208178 2016-10-31 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r208182. Both of the tests added with this change time out on macOS Release. Reverted changeset: "[Modern Media Controls] Media Controller: Placard support" https://bugs.webkit.org/show_bug.cgi?id=163731 http://trac.webkit.org/changeset/208182 2016-10-31 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support IDBObjectStore getAll/getAllKeys. <rdar://problem/28806934> and https://bugs.webkit.org/show_bug.cgi?id=164097 Reviewed by Darin Adler. Tests: storage/indexeddb/modern/idbobjectstore-getall-1-private.html storage/indexeddb/modern/idbobjectstore-getall-1.html storage/indexeddb/modern/idbobjectstore-getallkeys-1-private.html storage/indexeddb/modern/idbobjectstore-getallkeys-1.html Existing imported W3C tests. - Add new objects for "IDBGetAllRequestData" and "IDBGetAllResult" to represent these new requests and responses. - Add lots of boilerplate code to move these new objects around in the IDB machinery. - Update "GetRecord" code to be shared with "GetAll" code where necessary. - Other tweaks here and there. * WebCore.xcodeproj/project.pbxproj: * CMakeLists.txt: * Modules/indexeddb/IDBGetAllResult.cpp: Added. (WebCore::isolatedCopyOfVariant): (WebCore::IDBGetAllResult::isolatedCopy): (WebCore::IDBGetAllResult::addKey): (WebCore::IDBGetAllResult::addValue): (WebCore::IDBGetAllResult::keys): (WebCore::IDBGetAllResult::values): (WebCore::IDBGetAllResult::allBlobFilePaths): * Modules/indexeddb/IDBGetAllResult.h: Added. (WebCore::IDBGetAllResult::IDBGetAllResult): (WebCore::IDBGetAllResult::type): (WebCore::IDBGetAllResult::encode): (WebCore::IDBGetAllResult::decode): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::getAll): (WebCore::IDBObjectStore::getAllKeys): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBObjectStore.idl: * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::setResult): * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): (WebCore::IDBTransaction::getAllRecordsOnServer): (WebCore::IDBTransaction::didGetAllRecordsOnServer): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/IndexedDB.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::getAllRecords): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::getAllRecords): (WebCore::IDBClient::IDBConnectionToServer::didGetAllRecords): * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::didGetAllRecords): * Modules/indexeddb/server/IDBConnectionToClient.h: * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::getAllRecords): * Modules/indexeddb/server/IDBServer.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/MemoryObjectStore.cpp: (WebCore::IDBServer::MemoryObjectStore::getAllRecords): * Modules/indexeddb/server/MemoryObjectStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::queryForGetAllRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::hasAnyPendingCallbacks): (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError): (WebCore::IDBServer::UniqueIDBDatabase::getAllRecords): (WebCore::IDBServer::UniqueIDBDatabase::performGetAllRecords): (WebCore::IDBServer::UniqueIDBDatabase::didPerformGetAllRecords): (WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback): * Modules/indexeddb/server/UniqueIDBDatabase.h: * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getAllRecords): * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp: Added. (WebCore::IDBGetAllRecordsData::isolatedCopy): * Modules/indexeddb/shared/IDBGetAllRecordsData.h: Added. (WebCore::IDBGetAllRecordsData::encode): (WebCore::IDBGetAllRecordsData::decode): * Modules/indexeddb/shared/IDBResultData.cpp: (WebCore::IDBResultData::IDBResultData): (WebCore::IDBResultData::getAllRecordsSuccess): (WebCore::IDBResultData::getAllResult): * Modules/indexeddb/shared/IDBResultData.h: (WebCore::IDBResultData::encode): (WebCore::IDBResultData::decode): * Modules/indexeddb/shared/InProcessIDBServer.cpp: (WebCore::InProcessIDBServer::didGetAllRecords): (WebCore::InProcessIDBServer::getAllRecords): * Modules/indexeddb/shared/InProcessIDBServer.h: * bindings/js/IDBBindingUtilities.cpp: (WebCore::deserializeIDBValueToJSValue): (WebCore::toJS): * bindings/js/IDBBindingUtilities.h: 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> GTK+ and EFL build fixes after r208176. * css/PropertySetCSSStyleDeclaration.cpp: 2016-10-31 Simon Fraser <simon.fraser@apple.com> Fix #include case. * page/IntersectionObserverEntry.h: 2016-10-31 Wenson Hsieh <wenson_hsieh@apple.com> [WK1] Candidate visibility should not update as a result of selection during a dictionary lookup https://bugs.webkit.org/show_bug.cgi?id=164236 <rdar://problem/28747712> Reviewed by Beth Dakin. Moves state that keeps track of whether or not a dictionary lookup is active from the WebPage to the Editor, so that when clicking a text field or contenteditable in WK1 or WK2, we are able to avoid notifying the WebEditorClient of the selection change. Changes to WK2 are covered by existing unit tests in WKWebViewCandidateTests which verify that clicking does not thrash candidate list visibility. A similar test will be added in the future for the WK1 case in CandidateTests. * editing/Editor.h: (WebCore::Editor::setIsGettingDictionaryPopupInfo): (WebCore::Editor::isGettingDictionaryPopupInfo): 2016-10-31 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: Placard support https://bugs.webkit.org/show_bug.cgi?id=163731 <rdar://problem/28869598> Reviewed by Dean Jackson. We introduce the PlacardSupport class which brings support for showing the appropriate placard when the media is played via AirPlay or in picture-in-picture. Tests: media/modern-media-controls/placard-support/placard-support-airplay.html media/modern-media-controls/placard-support/placard-support-pip.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/placard-support.js: Added. (PlacardSupport): (PlacardSupport.prototype.get mediaEvents): (PlacardSupport.prototype.handleEvent): (PlacardSupport.prototype._updatePlacard): * WebCore.xcodeproj/project.pbxproj: 2016-10-31 Simon Fraser <simon.fraser@apple.com> Implement IntersectionObserver https://bugs.webkit.org/show_bug.cgi?id=159475 Reviewed by Ryosuke Niwa. Add bindings support for Intersection Observer <https://wicg.github.io/IntersectionObserver/> Code is wrapped in ENABLE(INTERSECTION_OBSERVER), and controlled by a runtime Setting (off by default for now). A minor bindings change was required to fix the callback code. IntersectionObserver is just a shell for now. Tests: intersection-observer/intersection-observer-entry-interface.html intersection-observer/intersection-observer-interface.html * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGeneratorJS.pm: (ShouldPassWrapperByReference): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::construct): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefsConstructor::construct): * page/IntersectionObserver.cpp: Added. (WebCore::IntersectionObserver::IntersectionObserver): (WebCore::IntersectionObserver::observe): (WebCore::IntersectionObserver::unobserve): (WebCore::IntersectionObserver::disconnect): (WebCore::IntersectionObserver::takeRecords): * page/IntersectionObserver.h: Added. (WebCore::IntersectionObserver::create): (WebCore::IntersectionObserver::root): (WebCore::IntersectionObserver::rootMargin): (WebCore::IntersectionObserver::thresholds): * page/IntersectionObserver.idl: Added. * page/IntersectionObserverCallback.h: Added. (WebCore::IntersectionObserverCallback::~IntersectionObserverCallback): * page/IntersectionObserverCallback.idl: Added. * page/IntersectionObserverEntry.cpp: Added. (WebCore::IntersectionObserverEntry::IntersectionObserverEntry): * page/IntersectionObserverEntry.h: Added. (WebCore::IntersectionObserverEntry::create): (WebCore::IntersectionObserverEntry::time): (WebCore::IntersectionObserverEntry::rootBounds): (WebCore::IntersectionObserverEntry::boundingClientRect): (WebCore::IntersectionObserverEntry::intersectionRect): (WebCore::IntersectionObserverEntry::target): (WebCore::IntersectionObserverEntry::intersectionRatio): * page/IntersectionObserverEntry.idl: Added. * page/Settings.in: 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the shadow DOM https://bugs.webkit.org/show_bug.cgi?id=164240 Reviewed by Dean Jackson. * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. * css/SelectorFilter.cpp: (WebCore::SelectorFilter::collectIdentifierHashes): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. * css/SelectorPseudoElementTypeMap.in: Add support for slotted. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::appendTagHistory): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. Take :slotted out of needsImplicitShadowCombinatorForMatching(), since our code doesn't do this for :slotted. * css/parser/CSSSelectorParser.cpp: (WebCore::isPseudoClassFunction): :host can be both an id and a function, so don't restrict it. (WebCore::CSSSelectorParser::consumePseudo): Put in a hack for :host (inside the hack we already plan on removing once we turn on). (WebCore::CSSSelectorParser::consumeCombinator): Remove deep shadow combinator support, as we don't support matching on it. (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded): (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator): Make the split use our combinator, ShadowDescendant, and no longer do anything special with :slotted. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our ShadowDescendant combinator. 2016-10-31 Joseph Pecoraro <pecoraro@apple.com> Use #pragma once in WebCore https://bugs.webkit.org/show_bug.cgi?id=164194 Rubber-stamped by Sam Weinig. * accessibility/*.h: * bindings/*.h: * contentextensions/*.h: * dom/*.h: * html/*.h: * page/*.h: Use #pragma once in headers. * html/parser/ParsingUtilities.h: Add missing namespace. * html/track/VTTScanner.h: (WebCore::VTTScanner::skipWhile): (WebCore::VTTScanner::skipUntil): (WebCore::VTTScanner::collectWhile): (WebCore::VTTScanner::collectUntil): Include namespace. 2016-10-31 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: Airplay support https://bugs.webkit.org/show_bug.cgi?id=163729 Reviewed by Dean Jackson. We introduce the AirplaySupport class which brings support for playing the media via Airplay by clicking on the Airplay button in the media controls and correctly reflecting when the media is played through Airplay via the media API. The enabled state of the Airplay button is also tied to Airplay sources being available. Test: media/modern-media-controls/airplay-support/airplay-support.html * Modules/modern-media-controls/controls/airplay-button.js: (AirplayButton.prototype.get on): * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/airplay-support.js: Added. (AirplaySupport.prototype.get control): (AirplaySupport.prototype.get mediaEvents): (AirplaySupport.prototype.buttonWasClicked): (AirplaySupport.prototype.handleEvent): (AirplaySupport.prototype.syncControl): (AirplaySupport): * Modules/modern-media-controls/media/media-controller.js: (MediaController): * WebCore.xcodeproj/project.pbxproj: 2016-10-31 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Provide an opportunity to clear ScriptValues associated with debugged target https://bugs.webkit.org/show_bug.cgi?id=164167 <rdar://problem/29010148> Reviewed by Mark Lam. * inspector/InspectorController.cpp: (WebCore::InspectorController::inspectedPageDestroyed): Page is going away, discard values. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::workerTerminating): Worker is going away, discard values. 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> CSSStyleDeclaration should be annotated with CEReactions https://bugs.webkit.org/show_bug.cgi?id=163968 Reviewed by Antti Koivisto. Added CEReactions to CSSStyleDeclaration.idl. Test: fast/custom-elements/reactions/CSSStyleDeclaration.html * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::putDelegate): * css/CSSStyleDeclaration.idl: * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::StyleAttributeMutationScope::StyleAttributeMutationScope): Remember the old value when this is an inline style declaration for a custom element. Also store m_oldValue and m_customElement instead of a mutation record so that we don't create a superfluous mutation record for custom elements. (WebCore::StyleAttributeMutationScope::~StyleAttributeMutationScope): Enqueue attributeChangedCallback when m_customElement is not null. * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionQueue::observesStyleAttribute): * dom/CustomElementReactionQueue.h: 2016-10-31 Jer Noble <jer.noble@apple.com> Unreviewed build fix for the build fix; AVStreamDataParser not defined on iOS. * platform/spi/mac/AVFoundationSPI.h: 2016-10-31 Zalan Bujtas <zalan@apple.com> LayoutTests/fast/frames/invalid-frameset.html is not clean by the end of FrameView::layout(). https://bugs.webkit.org/show_bug.cgi?id=164230 Reviewed by Simon Fraser. When a <frameset> has invalid children, in addition to clear the needs layout flag on the children we also need to do clear the descendants too. Covered by LayoutTests/fast/frames/invalid-frameset.html. * rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::positionFrames): 2016-10-31 Jer Noble <jer.noble@apple.com> Unreviewed build fix after r208151; outputMIMECodecParameterForInputMIMECodecParameter not defined pre-Sierra. * platform/spi/mac/AVFoundationSPI.h: 2016-10-31 Zalan Bujtas <zalan@apple.com> ASSERTION FAILED: !m_trailingWhitespaceWidth in WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace https://bugs.webkit.org/show_bug.cgi?id=164076 Reviewed by Antti Koivisto. FontCascade's text measure methods return NaN for zero sized fonts. We could actually early return and not measure text with zero font size at all. Test: fast/text/simple-line-layout-with-zero-sized-font.html * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth): (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth): 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-named-image https://bugs.webkit.org/show_bug.cgi?id=164235 Reviewed by Dean Jackson. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeWebkitNamedImage): (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage): (WebCore::CSSPropertyParserHelpers::isGeneratedImage): 2016-10-28 Brent Fulgham <bfulgham@apple.com> Do a better job of protecting Frame objects in the context of JavaScript calls https://bugs.webkit.org/show_bug.cgi?id=164163 <rdar://problem/28955249> Reviewed by Darin Adler. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Protected the Frame. * editing/Editor.cpp: (WebCore::Editor::setTextAsChildOfElement): Ditto. * editing/EditorCommand.cpp: (WebCore::executeSwapWithMark): Ditto. * editing/TypingCommand.cpp: (WebCore::TypingCommand::deleteKeyPressed): Ditto. (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::replaceNodeFromPasteboard): Ditto. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Ditto. * page/DOMSelection.cpp: (WebCore::DOMSelection::collapse): Ditto. (WebCore::DOMSelection::collapseToEnd): Ditto. (WebCore::DOMSelection::collapseToStart): Ditto. (WebCore::DOMSelection::setBaseAndExtent): Ditto. (WebCore::DOMSelection::setPosition): Ditto. (WebCore::DOMSelection::modify): Ditto. (WebCore::DOMSelection::extend): Ditto. (WebCore::DOMSelection::addRange): Ditto. (WebCore::DOMSelection::deleteFromDocument): Ditto. * page/DragController.cpp: (WebCore::setSelectionToDragCaret): Ditto. (WebCore::DragController::startDrag): Ditto. * page/Frame.cpp: (WebCore::Frame::checkOverflowScroll): Ditto. * page/TextIndicator.cpp: (WebCore::TextIndicator::createWithRange): Ditto. 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure to fail on :role(a,b) and :dir(a,b) https://bugs.webkit.org/show_bug.cgi?id=164233 Reviewed by Dean Jackson. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Allow unitless values on background-size in quirks mode https://bugs.webkit.org/show_bug.cgi?id=164232 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBackgroundSize): 2016-10-31 Jer Noble <jer.noble@apple.com> Unreviewed build fix after r208151; _setPreventsSleepDuringVideoPlayback: only defined in non-simulator SDKs. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): * platform/spi/mac/AVFoundationSPI.h: 2016-10-31 Nan Wang <n_wang@apple.com> AX: iOS Voiceover does not announce previously selected value from input type="date" form field https://bugs.webkit.org/show_bug.cgi?id=164176 Reviewed by Chris Fleizach. Input type date is a popup button on iOS and its value was not exposed in stringValue() since it's not considered a text control. Instead, the value was exposed in AXTitle. Fixed this by adding the case in stringValue() and removing the AXTitle exposure. Changes are covered in modified test. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::stringValue): * accessibility/ios/AccessibilityObjectIOS.mm: (WebCore::AccessibilityObject::isInputTypePopupButton): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityLabel]): 2016-10-31 Simon Fraser <simon.fraser@apple.com> Add requestIdleCallback to features.json. * features.json: 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fully support prefixed background-size and box-shadows https://bugs.webkit.org/show_bug.cgi?id=164228 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Get rid of CSSCustomIdentValue::creates https://bugs.webkit.org/show_bug.cgi?id=164225 Reviewed by Zalan Bujtas. Get rid of all instances of CSSCustomIdent::create, since our style resolution code isn't prepared to handle that value type yet. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeAnimationName): (WebCore::consumeTransitionProperty): (WebCore::consumeAttr): 2016-10-31 Jer Noble <jer.noble@apple.com> Opt-out of AVPlayer automatic sleep disabling https://bugs.webkit.org/show_bug.cgi?id=163983 Reviewed by Eric Carlson. In addition to the DisplaySleepDisabler, notify the MediaPlayerPrivateAVFoundationObjC object whether it should disable display sleep. Provide all the necessary boilerplate to allow the media player private to query the HTMLMediaPlayer so that the correct value can be set on AVPlayer upon creation. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updateSleepDisabling): * html/HTMLMediaElement.h: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::setShouldDisableSleep): (WebCore::MediaPlayer::shouldDisableSleep): * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerShouldDisableSleep): * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::setShouldDisableSleep): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Drive-by fix: Re-organize the contents of AVFoundationSPI.h so that there's a single top-level #if USE(APPLE_INTERNAL_SDK) statement, rather than that conditional being sprinkled about the file. * platform/spi/mac/AVFoundationSPI.h: 2016-10-31 Jer Noble <jer.noble@apple.com> REGRESSION (r206300): LayoutTest media/media-source/media-source-duplicate-seeked.html timing out https://bugs.webkit.org/show_bug.cgi?id=162496 Reviewed by Darin Adler. The change to MockMediaSourcePrivate in r206300 revealed a true bug: seeks to the MediaSource's duration will always fail. We should discard out of hand seeks which are greater than the duration, but allow seeks directly to the duration. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::hasBufferedTime): 2016-10-31 Jer Noble <jer.noble@apple.com> Allow multiple playing videos on a page with 'autoplay' and 'playsinline' attributes https://bugs.webkit.org/show_bug.cgi?id=162366 <rdar://problem/28639600> Reviewed by Eric Carlson. Tests: media/video-concurrent-visible-playback.html media/video-multiple-concurrent-playback.html Separate out the concept of "video-only" from "video-with-audio" in PlatformMediaSession::MediaType, and only set the ConcurrentPlaybackNotPermitted restriction for "video-with-audio". This allows multiple silent video elements to play back simultaneously. However, the bug in question also shows bad behavior when both concurrent playback and invisible playback are not allowed. Namely, an invisible element will attempt to autoplay, interrupt visible elements, and then fail to play due to it's non-visibility. Add an extra check to canTransitionFromAutoplayToPlay() which asks the session if autoplay is allowed (which will return false if the element is not visible). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay): (WebCore::HTMLMediaElement::mediaType): (WebCore::HTMLMediaElement::presentationType): (WebCore::HTMLMediaElement::updateShouldAutoplay): (WebCore::mediaElementIsAllowedToAutoplay): Deleted. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::autoplayPermitted): * html/MediaElementSession.h: * platform/audio/PlatformMediaSession.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): * testing/Internals.cpp: (WebCore::Internals::setMediaSessionRestrictions): 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support unprefixed cross-fade https://bugs.webkit.org/show_bug.cgi?id=164224 Reviewed by Zalan Bujtas. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeCrossFade): (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage): 2016-10-31 Dave Hyatt <hyatt@apple.com> [CSS Parser] Simplify background-position-x/y style mapping https://bugs.webkit.org/show_bug.cgi?id=164223 Reviewed by Zalan Bujtas. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapFillXPosition): (WebCore::CSSToStyleMap::mapFillYPosition): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertFontSynthesis): 2016-10-31 Darin Adler <darin@apple.com> Move ChildNode and ParentNode from ExceptionCode to Exception, add support for ExceptionOr<T&> https://bugs.webkit.org/show_bug.cgi?id=164214 Reviewed by Alex Christensen. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeOptions): Use FetchHeaders& instead of Ref<FetchHeaders> for return value. (WebCore::FetchRequest::initializeWith): Ditto. * Modules/fetch/FetchRequest.h: Updated for above. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::addSourceBuffer): Use SourceBuffer& instead of SourceBuffer* for return value. * Modules/mediasource/MediaSource.h: Updated for above. * bindings/js/JSDOMBinding.h: Added overloads of checkSecurityForNode so it works with a function returning a reference. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::getCounterValue): Use Counter& instead of Counter* for return value. (WebCore::CSSPrimitiveValue::getRectValue): Use Rect& instead of Rect* for return value. * css/CSSPrimitiveValue.h: Updated for above. * dom/ChildNode.idl: Use non-legacy exceptions. * dom/ContainerNode.cpp: (WebCore::ContainerNode::querySelector): Use ExceptionOr. (WebCore::ContainerNode::querySelectorAll): Ditto. (WebCore::ContainerNode::append): Ditto. (WebCore::ContainerNode::prepend): Ditto. * dom/ContainerNode.h: Updated for above. * dom/Document.cpp: (WebCore::Document::selectorQueryForString): Use ExceptionOr. * dom/Document.h: Updated for above. * dom/Element.cpp: (WebCore::Element::attachShadow): Return ShadowRoot& instead of Ref<ShadowRoot> since the shadow root is owned by the element, not the caller. (WebCore::Element::matches): Updated for change to make the selectorQueryForString function use ExceptionOr. (WebCore::Element::closest): Ditto. (WebCore::contextNodeForInsertion): Return ContainerNode& instead of ContainerNode*. (WebCore::contextElementForInsertion): Updated for above. * dom/Element.h: Updated for above. * dom/Element.idl: Changed return type for closest and for insertAdjacentElement to be nullable since both can return null. * dom/ExceptionOr.h: Added a specialization for ExceptionOr<T&>. * dom/Node.cpp: (WebCore::Node::convertNodesOrStringsIntoNode): Use ExceptionOr. (WebCore::Node::before): Ditto. (WebCore::Node::after): Ditto. (WebCore::Node::replaceWith): Ditto. * dom/Node.h: Updated for above changes. * dom/ParentNode.idl: Use non-legacy exceptions. * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::queryAll): Changed return type to Ref. (WebCore::SelectorQueryCache::add): Use ExceptionOr. * dom/SelectorQuery.h: Updated for above changes. * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::getSVGDocument): Return Document& instead of Document*. * html/HTMLFrameOwnerElement.h: Updated for above change. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::addTextTrack): Return TextTrack& instead of Ref<TextTrack>. * html/HTMLMediaElement.h: Updated for above. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay): Updated for new exceptions. * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::querySelector): Ditto. (WebCore::InspectorDOMAgent::querySelectorAll): Ditto. (WebCore::InspectorDOMAgent::performSearch): Ditto. (WebCore::InspectorDOMAgent::highlightSelector): Ditto. * inspector/InspectorNodeFinder.cpp: (WebCore::InspectorNodeFinder::performSearch): Put a null check here so callers don't have to do it. Pass references to the individual functions since the pointer can't be null. (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): Updated to use reference and streamlined code a bit, using containsIgnoringASCIICase instead of findIgnoringCase. (WebCore::InspectorNodeFinder::matchesAttribute): Ditto. (WebCore::InspectorNodeFinder::matchesElement): Ditto. (WebCore::InspectorNodeFinder::searchUsingXPath): Ditto. (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): Ditto. Also updated for new exceptions in querySelectorAll. * inspector/InspectorNodeFinder.h: Updated for above. * page/Crypto.cpp: (WebCore::Crypto::webkitSubtle): Return WebKitSubtleCrypto& insetad of WebKitSubtleCrypto*. * page/Crypto.h: Updated for above. * testing/Internals.h: Removed declarations for functions already removed: ensureShadowRoot and createShadowRoot. 2016-10-31 Darin Adler <darin@apple.com> Convert Document from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=164212 Reviewed by Alex Christensen. * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::processBuffer): Removed IGNORE_EXCEPTION. * dom/ContainerNode.cpp: (WebCore::ContainerNode::takeAllChildrenFrom): Use releaseReturnValue instead of ASSERT_NO_EXCEPTION. (WebCore::ContainerNode::parserInsertBefore): Removed ASSERT_NO_EXCEPTION. (WebCore::ContainerNode::parserAppendChild): Ditto. * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocumentType): Updated for new exception handling. (WebCore::DOMImplementation::createDocument): Ditto. * dom/Document.cpp: (WebCore::createHTMLElementWithNameValidation): Return ExceptionOr. (WebCore::Document::createElementForBindings): Ditto. (WebCore::Document::createCDATASection): Ditto. (WebCore::Document::createProcessingInstruction): Ditto. (WebCore::Document::importNode): Ditto. (WebCore::Document::adoptNode): Ditto. (WebCore::Document::createElementNS): Ditto. (WebCore::Document::setXMLVersion): Ditto. (WebCore::Document::setBodyOrFrameset): Ditto. (WebCore::Document::processHttpEquiv): Ditto. (WebCore::Document::createEvent): Ditto. (WebCore::Document::cookie): Ditto. (WebCore::Document::setCookie): Ditto. (WebCore::Document::setDomain): Ditto. (WebCore::Document::parseQualifiedName): Ditto. Also added an overload that constructs a QualifiedName directly that most call sites can use. (WebCore::Document::createAttribute): Return ExceptionOr. (WebCore::Document::createAttributeNS): Ditto. (WebCore::Document::createTouch): Removed unneeded ExceptionCode&. * dom/Document.h: Updated for above. * dom/Document.idl: Use non-legacy exceptions. Removed exception entirely from createTouch. * dom/Element.cpp: (WebCore::Element::parseAttributeName): Updated to use the new Document::parseQualifiedName. * editing/EditorCommand.cpp: (WebCore::executeFormatBlock): Ditto. * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::setNodeName): Updated for the new exception handling. * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::getCookies): Ditto. * page/ios/FrameIOS.mm: (WebCore::Frame::initWithSimpleHTMLDocument): Use the HTMLHtmlElement::create and HTMLBodyElement::create instead of using createElementNS to make the simple document. * svg/animation/SVGSMILElement.cpp: (WebCore::SVGSMILElement::constructAttributeName): Renamed, made this a member function, updated to use the new Document::parseQualifiedName, and also moved the code to get the attribute in here. (WebCore::SVGSMILElement::constructAttributeName): Added. Helper function for the two places we update the attribute name from attributeNameAttr. (WebCore::SVGSMILElement::insertedInto): Use updateAttributeName. (WebCore::SVGSMILElement::svgAttributeChanged): Ditto. * svg/animation/SVGSMILElement.h: Updated for the above. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::processingInstruction): Updated to understand ExceptionOr rather than an out argument. (WebCore::XMLDocumentParser::startDocument): Removed ASSERT_NO_EXCEPTION. 2016-10-31 Wenson Hsieh <wenson_hsieh@apple.com> Holding down a key to choose an accented character should fire "insertReplacementText" input events https://bugs.webkit.org/show_bug.cgi?id=164209 <rdar://problem/29019305> Reviewed by Darin Adler. For TypingCommands that correspond to "insertReplacementText" inputTypes, vend dataTransfers for resulting beforeinput and input events if the edited area is not an input field or textarea. To do this, convert the plain text representation of the content to be inserted to HTML text using a helper function, MarkupAccumulator::appendCharactersReplacingEntities, that is used when creating markup for Text nodes. Tests: fast/events/before-input-prevent-insert-replacement.html fast/events/input-event-insert-replacement.html * editing/TypingCommand.cpp: (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::inputEventDataTransfer): * editing/TypingCommand.h: 2016-10-30 Dave Hyatt <hyatt@apple.com> [CSS Parser] Miscellaneous bug fixes https://bugs.webkit.org/show_bug.cgi?id=164211 Reviewed by Darin Adler. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeTransformOrigin): Make sure to properly reject invalid transform-origin-z values. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeAttribute): Make attribute selector parsing strict about requiring a ] to end the selector. (WebCore::CSSSelectorParser::consumePseudo): Force the nth-child "of" syntax to have whitespace after "of" but before the selector. It is unclear if this should be a requirement or not (spec is ambiguous), but for now we match the old parser. (WebCore::CSSSelectorParser::consumeCombinator): Fix a bug that caused the double child combinator to match even when there was whitespace between the two > symbols. 2016-10-31 Youenn Fablet <youenn@apple.com> RTCOfferAnswerOptions does not need to be refcounted https://bugs.webkit.org/show_bug.cgi?id=164216 Reviewed by Darin Adler. Covered by existing tests. Making RTCOffer/Answer options dictionaries as per specification. Removing code that handles RTCOffer/Answer options dictionary since this is done by the binding generator. Updated users of the options accordingly. * CMakeLists.txt: * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::createOffer): (WebCore::MediaEndpointPeerConnection::createOfferTask): (WebCore::MediaEndpointPeerConnection::createAnswer): (WebCore::MediaEndpointPeerConnection::createAnswerTask): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCOfferAnswerOptions.cpp: Removed. * Modules/mediastream/RTCOfferAnswerOptions.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::queuedCreateOffer): (WebCore::RTCPeerConnection::queuedCreateAnswer): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * WebCore.xcodeproj/project.pbxproj: 2016-10-31 Youenn Fablet <youenn@apple.com> fast/mediastream/RTCPeerConnection-* tests crashing under ASan https://bugs.webkit.org/show_bug.cgi?id=164215 Reviewed by Philippe Normand. Covered by ASAN bot tests. * platform/mediastream/SDPProcessorScriptResource.cpp: (WebCore::SDPProcessorScriptResource::scriptString): 2016-10-28 Philippe Normand <pnormand@igalia.com> [OpenWebRTC] Initialize library one time only https://bugs.webkit.org/show_bug.cgi?id=164118 Reviewed by Darin Adler. * platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp: (WebCore::initializeOpenWebRTC): Prevent multiple initialisations of the library. 2016-10-30 Brent Fulgham <bfulgham@apple.com> Unreviewed fix: Correct ChangeLog after my bad merge. * ChangeLog 2016-10-30 Darin Adler <darin@apple.com> Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=164206 Reviewed by Chris Dumez. * bindings/js/JSDOMStringMapCustom.cpp: (WebCore::JSDOMStringMap::getOwnPropertyNames): Use modern for loop, and updates since the names function now returns a vector. (WebCore::JSDOMStringMap::putDelegate): Use propagateException. Also return true any time an exception is raised. Since true tells the caller to return without doing any work, we always want to return that on an exception. * dom/DatasetDOMStringMap.cpp: (WebCore::DatasetDOMStringMap::names): Renamed from getNames and made this return a Vector instead of populating a passed-in vector. (WebCore::DatasetDOMStringMap::setItem): Use ExceptionOr. * dom/DatasetDOMStringMap.h: Updated for above. * dom/Document.cpp: (WebCore::Document::adoptNode): Updated to use ExceptionOr for removeAttributeNode. Changed to use remove rather than removeChild for better clarity. * dom/Element.cpp: (WebCore::Element::setAttribute): Use ExceptionOr. (WebCore::Element::createShadowRoot): Deleted. Unused. (WebCore::Element::attachShadow): Use ExceptionOr. (WebCore::Element::shadowRootForBindings): Tweaked a bit. (WebCore::Element::userAgentShadowRoot): Removed unneeded if statemment. (WebCore::Element::ensureUserAgentShadowRoot): Tweaked a bit. (WebCore::Element::setAttributeNode): Use ExceptionOr. (WebCore::Element::setAttributeNodeNS): Ditto. (WebCore::Element::removeAttributeNode): Ditto. (WebCore::Element::parseAttributeName): Ditto. Also changed return result to be a QualifiedName instead of using an out argument. (WebCore::Element::setAttributeNS): Ditto. (WebCore::Element::mergeWithNextTextNode): Ditto. (WebCore::Element::setOuterHTML): Ditto. (WebCore::Element::setInnerHTML): Ditto. (WebCore::Element::matches): Ditto. (WebCore::Element::closest): Ditto. (WebCore::Element::insertAdjacent): Ditto. (WebCore::Element::insertAdjacentElement): Ditto. (WebCore::contextNodeForInsertion): Ditto. (WebCore::contextElementForInsertion): Added. Helper for the insertAdjacentHTML function to eliminate a local variable. (WebCore::Element::insertAdjacentHTML): Use ExceptionOr. (WebCore::Element::insertAdjacentText): Ditto. * dom/Element.h: Updated for above. * dom/Element.idl: Use non-legacy exceptions. * dom/NamedNodeMap.cpp: (WebCore::NamedNodeMap::removeNamedItem): Use ExceptionOr. (WebCore::NamedNodeMap::supportedPropertyNames): Updated to check which strings should be removed without copying the strings. (WebCore::NamedNodeMap::removeNamedItemNS): Use ExceptionOr. (WebCore::NamedNodeMap::setNamedItem): Ditto. Removed overload for legacy bindings; move that to the bindings themselves. * dom/NamedNodeMap.h: Updated for above. * dom/NamedNodeMap.idl: Use non-legacy exceptions. * html/HTMLElement.cpp: (WebCore::HTMLElement::setOuterText): Updated since mergeWithNextTextNode now uses ExceptionOr. * inspector/DOMEditor.cpp: Updated to use ExceptionOr. * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::toErrorString): Added an overload for Exception. (WebCore::InspectorDOMAgent::setAttributesAsText): Updated to use ExceptionOr. * inspector/InspectorDOMAgent.h: Updated for above. * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Updated to use the correct version of setAttribute; there was never a risk that there would be an exception, but now that's clearer. * testing/Internals.cpp: (WebCore::Internals::ensureShadowRoot): Deleted. Was unused. (WebCore::Internals::createShadowRoot): Ditto. * testing/Internals.idl: Updated for above. * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::handleNamespaceAttributes): Use updated parseAttributeName, which uses ExceptionOr and a return value instead of an out argument. (WebCore::handleElementAttributes): Ditto. 2016-10-30 Sam Weinig <sam@webkit.org> [WebIDL] Restructure IDLParser structs to better match modern WebIDL concepts https://bugs.webkit.org/show_bug.cgi?id=164208 Reviewed by Darin Adler. Restructure IDLParsers structs to match modern WebIDL conventions: - Rename structs to have more WebCore like naming, consistently using the prefix IDL. - Remove domSignature. Sinking it's properties into the structs that contained it. - Add IDLArgument, replacing the use of domSignatures for arguments. IDLArgument is the subset of domSignatures needed for arguments. - Rename domFunction to IDLOperation (matching WebILD nomenclature), replace signature with its own name, type (for returnType), specials, and extended attributes properties. - Give IDLAttribute it's own name, type and extended attributes properties. - Add IDLDictionaryMember, replacing the use of domSignature as the type of members in IDLDictionary. Give it name, type, isRequired, default and extendedAttributes properties. - Renamed Typedef to be IDLTypedef. Remove the extended attributes property as those are not allowed in typedefs per-PebIDL. Also fix some parsing issues: - Stop parsing 'in' directives in function arguments. - Stop parsing extended attributes in typedefs. - Support applying typedefs to types deep in aggregate types (e.g. (sequence<(LONG or STRING)> or DOMString)?). * bindings/scripts/CodeGenerator.pm: * bindings/scripts/IDLParser.pm: * bindings/scripts/generate-bindings.pl: Update for new struct types. * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/TestTypedefs.idl: Remove test which tested extended attributes in typedefs, and add a test which tests typedefs used in deep type structures. * page/make_settings.pl: Don't generate the 'in' prefix for arguments in IDL files. 2016-10-30 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix nth-child serialization https://bugs.webkit.org/show_bug.cgi?id=164210 Reviewed by Darin Adler. Our nth-child serialization preserves what the author originally typed. Even though this is not spec-compliant (the latest CSS Syntax spec has a dumbed down serialization process that doesn't preserve what the author originally typed), I think it's better behavior to preserve this text. * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::serialize): Fix a bug in the serialization of number tokens that started with a plus sign. Make sure the plus sign is preserved. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): Grab the range of tokens from after the ( and up to the ) or the "of" and then serialize them. Strip whitepsace from the ends and set that as the selector argument. 2016-10-30 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Correct bookkeeping for begin/end draw pairs https://bugs.webkit.org/show_bug.cgi?id=163898 Reviewed by Darin Adler. Simon pointed out that GraphicsContext objects are generally only created at the time we intend to do drawing, so calling 'BeginDraw' as part of object construction, and 'EndDraw' at time of destruction should be sufficient. As usual, he was correct. This patch gets rid of unneeded code and greatly simplifies the Direct2D drawing path. Tested by existing layout tests. * platform/graphics/GraphicsContext.h: * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill):Remove unneeded use of 'RenderTargetScopedDrawing.h'. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::releaseWindowsContext): Remove unneeded use of RenderTargetScopedDrawing class. (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): Enter the 'BeginDraw' state at object creation. (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): End draw state at object destruction. (WebCore::GraphicsContextPlatformPrivate::clip): Remove unneeded call to 'beginDraw'. (WebCore::GraphicsContextPlatformPrivate::beginDraw): Renamed from 'beginDrawIfNeeded'. (WebCore::GraphicsContextPlatformPrivate::endDraw): Get rid of draw state flags. (WebCore::GraphicsContext::beginDraw): Renamed from 'beginDrawIfNeeded'. (WebCore::GraphicsContext::flush): Added. (WebCore::GraphicsContext::drawWithoutShadow): Remove unneeded use of RenderTargetScopedDrawing class. (WebCore::GraphicsContext::drawWithShadow): Ditto. (WebCore::GraphicsContext::platformFillRoundedRect): Ditto. (WebCore::GraphicsContext::fillRectWithRoundedHole): Ditto. (WebCore::GraphicsContext::didBeginDraw): Deleted. (WebCore::GraphicsContextPlatformPrivate::beginDrawIfNeeded): Deleted. (WebCore::GraphicsContext::beginDrawIfNeeded): Deleted. * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: (WebCore::GraphicsContextPlatformPrivate::didBeginDraw): Deleted. * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::getData): Remove unneeded use of RenderTargetScopedDrawing class. (WebCore::ImageBufferData::putData): * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::flushContext): Call new GraphicsContext 'flush' command. (WebCore::ImageBuffer::draw): Remove unneeded use of RenderTargetScopedDrawing class. * platform/graphics/win/NativeImageDirect2D.cpp: Ditto. * platform/graphics/win/RenderTargetScopedDrawing.h: Removed. * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): Remove unneeded use of RenderTargetScopedDrawing class. 2016-10-30 Dave Hyatt <hyatt@apple.com> [CSS Parser] Clean up the two types of descendant relations in CSSSelector https://bugs.webkit.org/show_bug.cgi?id=164203 Reviewed by Zalan Bujtas. This patch gets rid of the separate boolean for double child and allows it to be a unique relation type. Rename Descendant to DescendantSpace and name the new relation DescendantDoubleChild. * css/CSSSelector.cpp: (WebCore::CSSSelector::CSSSelector): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::hasDescendantRelation): (WebCore::CSSSelector::hasDescendantOrChildRelation): (WebCore::CSSSelector::CSSSelector): (WebCore::CSSSelector::setDescendantUseDoubleChildSyntax): Deleted. * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): (WebCore::SelectorChecker::determineLinkMatchType): * css/SelectorFilter.cpp: (WebCore::SelectorFilter::collectIdentifierHashes): * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::appendTagHistory): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::setDescendantUseDoubleChildSyntax): Deleted. * css/parser/CSSSelectorParser.cpp: (WebCore::isDescendantCombinator): (WebCore::CSSSelectorParser::consumeComplexSelector): (WebCore::CSSSelectorParser::consumeCombinator): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): 2016-10-30 Frederic Wang <fwang@igalia.com> Unreviewed gardening Fix build error on WinCairo. * platform/graphics/opentype/OpenTypeMathData.cpp: 2016-10-30 Frederic Wang <fwang@igalia.com> Use HarfBuzz ot-math API to parse the OpenType MATH table https://bugs.webkit.org/show_bug.cgi?id=162671 Reviewed by Michael Catanzaro. No new tests, already covered by existing tests. * platform/graphics/opentype/OpenTypeMathData.cpp: Add alternative implementation relying on HarfBuzz's new OpenType MATH API. * platform/graphics/opentype/OpenTypeMathData.h: Ditto. (WebCore::OpenTypeMathData::hasMathData): (WebCore::OpenTypeMathData::HbFontDeleter::operator()): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support unprefixed image-sets https://bugs.webkit.org/show_bug.cgi?id=164198 Reviewed by Dean Jackson. * css/CSSValueKeywords.in: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeImage): 2016-10-30 Yusuke Suzuki <utatane.tea@gmail.com> [DOM] Introduce WebCore::jsDynamicDowncast https://bugs.webkit.org/show_bug.cgi?id=164137 Reviewed by Darin Adler. In WebCore, we have several extended JSTypes, like JSElementType. For these types, WebCore offers the faster casting function compared to JSC::jsDynamicCast. For example, for JSElementType, we have jsElementCast. The problem is that we may fall into the slow code if we choose JSC::jsDynamicCast by accident. Selecting the appropriate function requires special care in the IDL code generator when we would like to use faster casting functions. This patch implements a new casting function, WebCore::jsDynamicDowncast. It is a thin wrapper to the JSC::jsDynamicCast. But it selects the faster casting functions correctly by template specialization. We do not choose the way specializing JSC::jsDynamicCast directly. If we forget to include the header that specializes JSC::jsDyanmicCast, it does not cause any compile errors, but it causes performance regression. This bug is hard to figure out. To avoid this problem, we add a new function. Outside JSC, only Tools' DumpRenderTree uses JSC::jsDynamicCast. This code has FIXME that we should use JSC APIs instead of directly calling JSC thingy. So this should be solved in the layer of JSC APIs and changing this jsDynamicCast to WebCore's jsDynamicDowncast and exposing WebCore's thingy are not good change. So we leave the code as is. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSApplePaySessionCustom.cpp: (WebCore::JSApplePaySession::completeShippingMethodSelection): (WebCore::JSApplePaySession::completeShippingContactSelection): (WebCore::JSApplePaySession::completePaymentMethodSelection): * bindings/js/JSDOMBinding.cpp: (WebCore::reportException): * bindings/js/JSDOMBinding.h: (WebCore::castThisValue): (WebCore::toArrayBufferView): * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::next): * bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::toWrapped): * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): * bindings/js/JSDocumentCustom.h: (WebCore::jsDocumentCast): * bindings/js/JSDynamicDowncast.h: Added. (WebCore::JSDynamicCastTrait::cast): (WebCore::JSDynamicCastTrait<JSNode>::cast): (WebCore::JSDynamicCastTrait<JSElement>::cast): (WebCore::JSDynamicCastTrait<JSDocument>::cast): (WebCore::JSDynamicCastTrait<JSEvent>::cast): (WebCore::jsDynamicDowncast): * bindings/js/JSElementCustom.h: (WebCore::jsElementCast): * bindings/js/JSEventCustom.h: (WebCore::jsEventCast): * bindings/js/JSEventListener.cpp: (WebCore::setDocumentEventHandlerAttribute): * bindings/js/JSEventTargetCustom.cpp: (WebCore::jsEventTargetCast): * bindings/js/JSMediaStreamTrackCustom.cpp: (WebCore::JSMediaStreamTrack::getSettings): (WebCore::JSMediaStreamTrack::getCapabilities): * bindings/js/JSNodeCustom.h: (WebCore::jsNodeCast): * bindings/js/JSPluginElementFunctions.cpp: (WebCore::pluginElementPropertyGetter): * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::constructJSReadableStreamDefaultReader): * bindings/js/JSReadableStreamSourceCustom.cpp: (WebCore::startReadableStream): (WebCore::JSReadableStreamSource::start): (WebCore::pullReadableStream): * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::toJSDedicatedWorkerGlobalScope): * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::evaluate): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): * bindings/js/StructuredClone.cpp: (WebCore::structuredCloneArrayBufferView): * bindings/scripts/CodeGeneratorJS.pm: (GetCastingHelperForThisObject): (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::jsInterfaceNameConstructor): (WebCore::setJSInterfaceNameConstructor): (WebCore::JSInterfaceName::toWrapped): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::BindingCaller<JSTestActiveDOMObject>::castForAttribute): (WebCore::BindingCaller<JSTestActiveDOMObject>::castForOperation): (WebCore::jsTestActiveDOMObjectConstructor): (WebCore::setJSTestActiveDOMObjectConstructor): (WebCore::JSTestActiveDOMObject::toWrapped): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::BindingCaller<JSTestCEReactions>::castForAttribute): (WebCore::BindingCaller<JSTestCEReactions>::castForOperation): (WebCore::jsTestCEReactionsConstructor): (WebCore::setJSTestCEReactionsConstructor): (WebCore::JSTestCEReactions::toWrapped): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForAttribute): (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForOperation): (WebCore::jsTestCEReactionsStringifierConstructor): (WebCore::setJSTestCEReactionsStringifierConstructor): (WebCore::JSTestCEReactionsStringifier::toWrapped): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::jsTestClassWithJSBuiltinConstructorConstructor): (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor): (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor): (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor): (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped): * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: (WebCore::BindingCaller<JSTestCustomNamedGetter>::castForOperation): (WebCore::jsTestCustomNamedGetterConstructor): (WebCore::setJSTestCustomNamedGetterConstructor): (WebCore::JSTestCustomNamedGetter::toWrapped): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute): (WebCore::jsTestDOMJITConstructor): (WebCore::setJSTestDOMJITConstructor): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::BindingCaller<JSTestEventConstructor>::castForAttribute): (WebCore::jsTestEventConstructorConstructor): (WebCore::setJSTestEventConstructorConstructor): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::BindingCaller<JSTestEventTarget>::castForOperation): (WebCore::jsTestEventTargetConstructor): (WebCore::setJSTestEventTargetConstructor): (WebCore::JSTestEventTarget::toWrapped): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::BindingCaller<JSTestException>::castForAttribute): (WebCore::jsTestExceptionConstructor): (WebCore::setJSTestExceptionConstructor): (WebCore::JSTestException::toWrapped): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::jsTestGenerateIsReachableConstructor): (WebCore::setJSTestGenerateIsReachableConstructor): (WebCore::JSTestGenerateIsReachable::toWrapped): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::BindingCaller<JSTestGlobalObject>::castForAttribute): (WebCore::BindingCaller<JSTestGlobalObject>::castForOperation): (WebCore::jsTestGlobalObjectConstructor): (WebCore::setJSTestGlobalObjectConstructor): (WebCore::JSTestGlobalObject::toWrapped): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::BindingCaller<JSTestInterface>::castForAttribute): (WebCore::BindingCaller<JSTestInterface>::castForOperation): (WebCore::jsTestInterfaceConstructor): (WebCore::setJSTestInterfaceConstructor): (WebCore::JSTestInterface::toWrapped): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute): (WebCore::jsTestInterfaceLeadingUnderscoreConstructor): (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor): (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::BindingCaller<JSTestIterable>::castForOperation): (WebCore::jsTestIterableConstructor): (WebCore::setJSTestIterableConstructor): (WebCore::JSTestIterable::toWrapped): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForAttribute): (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForOperation): (WebCore::jsTestJSBuiltinConstructorConstructor): (WebCore::setJSTestJSBuiltinConstructorConstructor): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::BindingCaller<JSTestMediaQueryListListener>::castForOperation): (WebCore::jsTestMediaQueryListListenerConstructor): (WebCore::setJSTestMediaQueryListListenerConstructor): (WebCore::JSTestMediaQueryListListener::toWrapped): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::jsTestNamedConstructorConstructor): (WebCore::setJSTestNamedConstructorConstructor): (WebCore::JSTestNamedConstructor::toWrapped): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::BindingCaller<JSTestNode>::castForAttribute): (WebCore::BindingCaller<JSTestNode>::castForOperation): (WebCore::jsTestNodeConstructor): (WebCore::setJSTestNodeConstructor): * bindings/scripts/test/JS/JSTestNondeterministic.cpp: (WebCore::BindingCaller<JSTestNondeterministic>::castForAttribute): (WebCore::BindingCaller<JSTestNondeterministic>::castForOperation): (WebCore::jsTestNondeterministicConstructor): (WebCore::setJSTestNondeterministicConstructor): (WebCore::JSTestNondeterministic::toWrapped): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::BindingCaller<JSTestObj>::castForAttribute): (WebCore::BindingCaller<JSTestObj>::castForOperation): (WebCore::jsTestObjConstructor): (WebCore::setJSTestObjConstructor): (WebCore::JSTestObj::toWrapped): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::jsTestOverloadedConstructorsConstructor): (WebCore::setJSTestOverloadedConstructorsConstructor): (WebCore::JSTestOverloadedConstructors::toWrapped): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor): (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor): (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::BindingCaller<JSTestOverrideBuiltins>::castForOperation): (WebCore::jsTestOverrideBuiltinsConstructor): (WebCore::setJSTestOverrideBuiltinsConstructor): (WebCore::JSTestOverrideBuiltins::toWrapped): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::BindingCaller<JSTestSerialization>::castForAttribute): (WebCore::BindingCaller<JSTestSerialization>::castForOperation): (WebCore::jsTestSerializationConstructor): (WebCore::setJSTestSerializationConstructor): (WebCore::JSTestSerialization::toWrapped): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForAttribute): (WebCore::jsTestSerializedScriptValueInterfaceConstructor): (WebCore::setJSTestSerializedScriptValueInterfaceConstructor): (WebCore::JSTestSerializedScriptValueInterface::toWrapped): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::BindingCaller<JSTestTypedefs>::castForAttribute): (WebCore::BindingCaller<JSTestTypedefs>::castForOperation): (WebCore::jsTestTypedefsConstructor): (WebCore::setJSTestTypedefsConstructor): (WebCore::JSTestTypedefs::toWrapped): * bridge/objc/WebScriptObject.mm: (-[WebScriptObject setValue:forKey:]): * bridge/runtime_array.cpp: (JSC::RuntimeArray::lengthGetter): * bridge/runtime_method.cpp: (JSC::RuntimeMethod::lengthGetter): * html/HTMLMediaElement.cpp: (WebCore::controllerJSValue): (WebCore::HTMLMediaElement::updateCaptionContainer): (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot): * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForEventListener): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add font-variant-* keyword property support https://bugs.webkit.org/show_bug.cgi?id=164195 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix text-emphasis-position parsing https://bugs.webkit.org/show_bug.cgi?id=164197 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTextEmphasisPosition): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-29 Darin Adler <darin@apple.com> Convert more of DOM from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=164173 Reviewed by Ryosuke Niwa. * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::getUserMedia): Use ExceptionOr. (WebCore::MediaDevices::enumerateDevices): Ditto. * Modules/mediastream/MediaDevices.h: Updated for above. * Modules/mediastream/MediaDevices.idl: Use non-legacy exceptions. * Modules/mediastream/MediaEndpointSessionDescription.cpp: Added now-needed include of ExceptionCode.h. * Modules/mediastream/RTCConfiguration.cpp: (WebCore::parseIceServer): Use ExceptionOr. (WebCore::RTCConfiguration::create): Ditto. (WebCore::RTCConfiguration::initialize): Ditto. * Modules/mediastream/RTCConfiguration.h: Updated for above. * Modules/mediastream/RTCConfiguration.idl: Use non-legacy exceptions. * Modules/mediastream/RTCDTMFSender.cpp: (WebCore::RTCDTMFSender::create): Use ExceptionOr. (WebCore::RTCDTMFSender::insertDTMF): Ditto. * Modules/mediastream/RTCDTMFSender.h: Updated for above. * Modules/mediastream/RTCDTMFSender.idl: Use non-legacy exceptions. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::create): Use ExceptionOr. (WebCore::RTCDataChannel::setBinaryType): Ditto. (WebCore::RTCDataChannel::send): Ditto. (WebCore::RTCDataChannel::didReceiveRawData): Ditto. * Modules/mediastream/RTCDataChannel.h: Updated for above. Also changed return values to use const AtomicString& and unsigned instead of unsigned long. Also made more private. Also changed BinaryType into an enum class. * Modules/mediastream/RTCDataChannel.idl: Use non-legacy exceptions. * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): Use ExceptionOr. * Modules/mediastream/RTCIceCandidate.h: Updated for above. * Modules/mediastream/RTCIceCandidate.idl: Use non-legacy exception. * Modules/mediastream/RTCOfferAnswerOptions.cpp: (WebCore::RTCOfferOptions::create): Use ExceptionOr. (WebCore::RTCAnswerOptions::create): Ditto. * Modules/mediastream/RTCOfferAnswerOptions.h: Updated for above. Also removed all virtual functions since nothing here is polymorphic and initalized data members in the header. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::initializeWith): Use ExceptionOr. (WebCore::RTCPeerConnection::addTrack): Ditto. (WebCore::RTCPeerConnection::removeTrack): Ditto. (WebCore::RTCPeerConnection::addTransceiver): Ditto. (WebCore::RTCPeerConnection::completeAddTransceiver): Ditto. (WebCore::RTCPeerConnection::queuedCreateOffer): Ditto. (WebCore::RTCPeerConnection::queuedCreateAnswer): Ditto. (WebCore::RTCPeerConnection::setConfiguration): Ditto. (WebCore::RTCPeerConnection::createDataChannel): Ditto. * Modules/mediastream/RTCPeerConnection.h: Updated for above. * Modules/mediastream/RTCPeerConnection.idl: Use non-legacy exceptions. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::replaceTrack): Use ExceptionOr. * Modules/mediastream/RTCRtpSender.h: Updated for above. * Modules/mediastream/RTCRtpSender.idl: Use non-legacy exception. * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::RTCSessionDescription::create): Use ExceptoinOr. * Modules/mediastream/RTCSessionDescription.h: Updated for above. (WebCore::RTCSessionDescription::~RTCSessionDescription): * Modules/mediastream/RTCSessionDescription.idl: Use non-legacy exceptions. * Modules/navigatorcontentutils/NavigatorContentUtils.cpp: (WebCore::verifyCustomHandlerURL): Just return a boolean, no exception. (WebCore::verifyProtocolHandlerScheme): Ditto. (WebCore::NavigatorContentUtils::registerProtocolHandler): Use ExceptionOr. (WebCore::NavigatorContentUtils::isProtocolHandlerRegistered): Ditto. (WebCore::NavigatorContentUtils::unregisterProtocolHandler): Ditto. * Modules/navigatorcontentutils/NavigatorContentUtils.h: Updated for above. * Modules/navigatorcontentutils/NavigatorContentUtils.idl: Use non-legacy exceptions. * bindings/js/JSMediaDevicesCustom.cpp: (WebCore::JSMediaDevicesGetUserMediaPromiseFunction): Use propagateException. * bindings/scripts/CodeGeneratorJS.pm: (NeedsExplicitPropagateExceptionCall): Added. Helper function to decide whether we need to call propagateException explicitly, if return value processing is not going to propagate the exception for us. (GenerateParametersCheck): Moved the code from GenerateReturnParameters inline because it's almost as short as the function call. Use the newly created NeedsExplicitPropagateExceptionCall function, which properly handles the case where the return value is a promise. (GenerateReturnParameters): Deleted. * dom/CharacterData.cpp: (WebCore::CharacterData::substringData): Use ExceptionOr. (WebCore::CharacterData::insertData): Ditto. (WebCore::CharacterData::deleteData): Ditto. (WebCore::CharacterData::replaceData): Ditto. * dom/CharacterData.h: Updated for above. * dom/CharacterData.idl: Use non-legacy exceptions. * dom/DataTransferItemList.h: Tried to use ExceptionOr, but this seems like dead code that doesn't compile. * dom/DataTransferItemList.idl: Use non-legacy exceptions. * dom/MessagePort.idl: Use non-legacy exceptions, except this has already been converted and was a custom binding. * dom/MutationObserver.cpp: (WebCore::MutationObserver::observe): Use ExceptionOr. * dom/MutationObserver.h: Updated for above. * dom/MutationObserver.idl: Use non-legacy exception. * dom/Range.cpp: (WebCore::deleteCharacterData): Updated use of calls that now use ExceptionOr. (WebCore::Range::processContentsBetweenOffsets): Ditto. (WebCore::Range::insertNode): Ditto. * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::setInnerHTML): Use ExceptionOr. * dom/ShadowRoot.h: Updated for above. * dom/ShadowRoot.idl: Use non-legacy exception. * dom/Text.cpp: (WebCore::Text::splitText): Use ExceptionOr. (WebCore::Text::replaceWholeText): Removed unused ExceptionCode&. * dom/Text.h: Updated for above. * dom/Text.idl: Use non-legacy exception. * editing/ApplyBlockElementCommand.cpp: (WebCore::isNewLineAtPosition): Rewrote to use data rather than substringData; more efficient. * editing/DeleteFromTextNodeCommand.cpp: (WebCore::DeleteFromTextNodeCommand::doApply): Updated to work with functions that return ExceptionOr. (WebCore::DeleteFromTextNodeCommand::doUnapply): Removed IGNORE_EXCEPTION. * editing/InsertIntoTextNodeCommand.cpp: (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand): Use WTFMove to avoid a little bit of reference count churn. (WebCore::InsertIntoTextNodeCommand::doApply): Removed IGNORE_EXCEPTION. (WebCore::InsertIntoTextNodeCommand::doReapply): Removed ExceptionCode. (WebCore::InsertIntoTextNodeCommand::doUnapply): Removed IGNORE_EXCEPTION. * editing/SplitTextNodeCommand.cpp: (WebCore::SplitTextNodeCommand::doApply): Updated to work with functions that return ExceptionCode. (WebCore::SplitTextNodeCommand::doUnapply): Removed ASSERT_NO_EXCEPTION. (WebCore::SplitTextNodeCommand::insertText1AndTrimText2): Updated to work with functions that return ExceptionCode. * html/HTMLTextFormControlElement.cpp: Added now-needed include of ExceptionCode.h. * inspector/DOMEditor.cpp: Removed ExceptionCode out argument from calls to replaceWholeText, which never throws an exception. 2016-10-29 Dean Jackson <dino@apple.com> Parse color() function https://bugs.webkit.org/show_bug.cgi?id=164146 <rdar://problems/29007218> Reviewed by Darin Adler. Support the new CSS color() function: https://drafts.csswg.org/css-color/#color-function There are separate code paths for the old and new CSS parser. Tests: css3/color/color-function-computed-style.html css3/color/color-function-parsing.html * css/CSSComputedStyleDeclaration.cpp: Use Color directly, not via rgb(). (WebCore::ComputedStyleExtractor::currentColorOrValidColor): (WebCore::ComputedStyleExtractor::valueForShadow): (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSValueKeywords.in: Note that there is a color function, but the keyword is already defined. Also add keywords for the color spaces. * css/SVGCSSValueKeywords.in: sRGB is used outside of SVG now. * css/parser/CSSParser.cpp: Old CSS parser code to handle color(). (WebCore::isPercent): Helper to tell if a ValueWithCalculation is a percentage or not. (WebCore::CSSParser::parseColorInt): Renamed. (WebCore::CSSParser::parseColorDouble): Helper to get a Number/Percentage into a double (WebCore::CSSParser::parseRGBParameters): (WebCore::CSSParser::parseColorFunctionParameters): (WebCore::CSSParser::parseHSLParameters): (WebCore::CSSParser::parseColorFromValue): (WebCore::CSSParser::colorIntFromValue): Deleted. * css/parser/CSSParser.h: * css/parser/CSSPropertyParserHelpers.cpp: New CSS parser code to handle color(). (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters): (WebCore::CSSPropertyParserHelpers::parseColorFunction): * platform/graphics/Color.h: (WebCore::Color::isValid): An extended color is valid. (WebCore::Color::rgb): Move the code to a standalone inline so that I could add a longer comment. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText): Alpha output is only needed if != 1. * platform/graphics/cg/ColorCG.cpp: Handle ExtendedColor -> CGColor. (WebCore::leakCGColor): (WebCore::cachedCGColor): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Disable -webkit-text-size-adjust when the context says to. https://bugs.webkit.org/show_bug.cgi?id=164191 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Match old parser's image-rendering values https://bugs.webkit.org/show_bug.cgi?id=164190 Reviewed by Dean Jackson. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-text value for background-clip and -webkit-background-clip https://bugs.webkit.org/show_bug.cgi?id=164189 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBackgroundBox): (WebCore::consumePrefixedBackgroundBox): 2016-10-29 Joseph Pecoraro <pecoraro@apple.com> Remove some unnecessary includes https://bugs.webkit.org/show_bug.cgi?id=164174 Reviewed by Darin Adler. 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-aspect-ratio https://bugs.webkit.org/show_bug.cgi?id=164187 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWebkitAspectRatio): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the caps lock indicator appearance https://bugs.webkit.org/show_bug.cgi?id=164186 Reviewed by Simon Fraser. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the alt property https://bugs.webkit.org/show_bug.cgi?id=164184 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeAlt): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add support for -webkit-hyphenate-limit-* properties https://bugs.webkit.org/show_bug.cgi?id=164183 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeHyphenateLimit): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix transform-origin and perspective-origin to parse as shorthands https://bugs.webkit.org/show_bug.cgi?id=164178 Reviewed by Zalan Bujtas. * css/CSSPropertyNames.in: Patch the transform-origin-x/y and perspective-origin-x/y properties to use new converters that can handle keywords. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertPositionComponentX): (WebCore::StyleBuilderConverter::convertPositionComponentY): Add the new converters. They just call convertPositionComponent method that we already use for object-position and background-position. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeTransformOrigin): (WebCore::CSSPropertyParser::consumePerspectiveOrigin): Changed to treat the properties as shorthands and add the longhand properties once parsed. (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseShorthand): * css/parser/CSSPropertyParser.h: Move the parsing into the shorthand method, since we're still treating these properties as shorthands. 2016-10-29 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-background-composite https://bugs.webkit.org/show_bug.cgi?id=164179 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBackgroundComponent): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-29 Youenn Fablet <youenn@apple.com> REGRESSION (r207754): LayoutTest http/tests/security/svg-image-with-css-cross-domain.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=163922 Reviewed by Alex Christensen. Test: http/tests/security/cached-svg-image-with-css-cross-domain.html Raw data was not copied in cloned CachedCSSStyleSheet while it is used by some of its clients. Updated CachedCSSStyleSheet and CachedImage cloning to copy its raw data. * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::setBodyDataFrom): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::setBodyDataFrom): * loader/cache/CachedResource.h: (WebCore::CachedResource::mayTryReplaceEncodedData): 2016-10-29 Youenn Fablet <youenn@apple.com> REGRESSION (Safari 10 / r189445): WKWebView and WebView no longer allow async XMLHttpRequest timeout to exceed 60 seconds https://bugs.webkit.org/show_bug.cgi?id=163814 <rdar://problem/28917420> Reviewed by Darin Adler. Tests: http/tests/xmlhttprequest/resetting-timeout-to-zero.html http/tests/xmlhttprequest/timeout-greater-than-default-network-timeout.html * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::setTimeout): If the XHR timeout is active, resetting the timeout to zero should lead to using the default network timeout. Since it is difficult to update the timeout once the request is sent, we mimic the default network timeout with a 60 seconds XHR timeout. (WebCore::XMLHttpRequest::createRequest): Setting network timeout to infinity if the XHR timeout is active. 2016-10-29 Youenn Fablet <youenn@apple.com> MediaEndpoint::generateDtlsInfo is not needed https://bugs.webkit.org/show_bug.cgi?id=164130 Reviewed by Eric Carlson. No change of behavior. Removing MediaEndpoint::generateDtlsInfo as it can be called directly from createMediaEndpointOwr. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection): * platform/mediastream/MediaEndpoint.cpp: * platform/mediastream/MediaEndpoint.h: * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::createMediaEndpointOwr): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::MockMediaEndpoint): (WebCore::MockMediaEndpoint::generateDtlsInfo): Deleted. * platform/mock/MockMediaEndpoint.h: 2016-10-28 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, add Input Events to the features list. * features.json: 2016-10-28 Darin Adler <darin@apple.com> Fix mismerge that broke a CEReactions test. * html/HTMLOptionsCollection.idl: Add back CEReactions to the remove function. 2016-10-28 Darin Adler <darin@apple.com> Move all classes in the HTML directory from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163876 Reviewed by Sam Weinig. * bindings/js/JSDOMBinding.cpp: (WebCore::shouldAllowAccessToNode): Deleted. (WebCore::BindingSecurity::shouldAllowAccessToFrame): Moved function into the BindingSecurity namespace. Also changed arguments to references. (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow): Ditto. (WebCore::BindingSecurity::shouldAllowAccessToNode): Changed argument type from pointer to reference. * bindings/js/JSDOMBinding.h: Removed top level shouldAllowAccessTo functions, moving all of them into the BindingSecurity namespace. Changed BindingSecurity from a class into a namespace. Added new checkSecurityForNode functions that can be used directly to implement CheckSecurityForNode; they turn the node into a null, which is no change in behavior from what bindings already did. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): Changed argument type for passed-in string to const String& instead of String&. (WebCore::JSDOMWindow::getOwnPropertySlot): Updated for BindingSecurity changes. (WebCore::JSDOMWindow::getOwnPropertySlotByIndex): Ditto. (WebCore::JSDOMWindow::put): Ditto. * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::attributesFor3DContext): Renamed from get3DContextAttributes and changed to use a return value instead of an out argument. (WebCore::JSHTMLCanvasElement::getContext): Updated for the above. (WebCore::JSHTMLCanvasElement::toDataURL): Rewrote to handle ExceptionOr and also to use Optional<double> instead of const double*. * bindings/js/JSHTMLFrameElementCustom.cpp: (WebCore::JSHTMLFrameElement::setLocation): Moved the logic from allowSettingJavascriptURL in here and updated for BindingSecurity changes. * bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::setLength): Use propagateException. Also streamlined the code a bit. (WebCore::JSHTMLOptionsCollection::indexSetter): Updated for new name and argument types for selectElementIndexSetter. * bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::selectElementIndexSetter): Updated name and argument types and to use propagateException. (WebCore::JSHTMLSelectElement::indexSetter): Updated for above. * bindings/js/JSHTMLSelectElementCustom.h: Ditto. * bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::getOwnPropertySlotDelegate): Updated for changes to BindingSecurity. (WebCore::JSLocation::putDelegate): Ditto. Also rearranged logic a bit. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::canAccessFromCurrentOrigin): Updated for changes to BindingSecurity. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Removed old support for CheckSecurityForNode. (NativeToJSValue): Added new support for CheckSecurityForNode, which uses the new checkSecurityForNode function, and works properly with ExceptionOr. * bindings/scripts/test/JS/JSTestObj.cpp: Updated for change below. * dom/ChildNode.idl: Move the remove function to non-legacy exception. Needed now because this needs to match the one in HTMLSelectElement. * dom/Element.cpp: (WebCore::Element::dispatchMouseForceWillBegin): Refactored a little bit. (WebCore::Element::mergeWithNextTextNode): Support ExceptionOr for remove. (WebCore::Element::setOuterHTML): Support ExceptionOr for createFragmentForInnerOuterHTML. (WebCore::Element::setInnerHTML): Ditto. (WebCore::Element::insertAdjacentHTML): Ditto. * dom/Node.cpp: (WebCore::Node::remove): Use ExceptionOr. (WebCore::Node::normalize): Remove use of IGNORE_EXCEPTION. * dom/Node.h: Use ExceptionOr for remove. * dom/Range.cpp: (WebCore::Range::insertNode): Updated for change to remove. (WebCore::Range::createContextualFragment): Updated for change to WebCore::createContextualFragment. * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::setInnerHTML): Use ExceptionOr for createFragmentForInnerOuterHTML and replaceChildrenWithFragment. * editing/AppendNodeCommand.cpp: (WebCore::AppendNodeCommand::doUnapply): Remove IGNORE_EXCEPTION. * editing/InsertNodeBeforeCommand.cpp: (WebCore::InsertNodeBeforeCommand::doUnapply): Ditto. * editing/MergeIdenticalElementsCommand.cpp: (WebCore::MergeIdenticalElementsCommand::doApply): Ditto. * editing/RemoveNodeCommand.cpp: (WebCore::RemoveNodeCommand::doApply): Ditto. * editing/SplitElementCommand.cpp: (WebCore::SplitElementCommand::doUnapply): Ditto. * editing/SplitTextNodeCommand.cpp: (WebCore::SplitTextNodeCommand::doUnapply): Ditto. * editing/WrapContentsInDummySpanCommand.cpp: (WebCore::WrapContentsInDummySpanCommand::doUnapply): Ditto. * editing/Editor.cpp: (WebCore::Editor::insertDictationPhrases): Deleted. Moved this iOS-specific function to EditorIOS.mm. (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto. (WebCore::Editor::confirmMarkedText): Ditto. (WebCore::Editor::setTextAsChildOfElement): Ditto. (WebCore::Editor::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping): Ditto. * editing/ios/EditorIOS.mm: (WebCore::Editor::fontForSelection): Remove ASSERT_NO_EXCEPTION. (WebCore::Editor::fontAttributesForSelectionStart): Ditto. (WebCore::Editor::insertDictationPhrases): Moved here from Editor.cpp. (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto. Also updated code that used remove to not pass an ExceptionCode. (WebCore::Editor::confirmMarkedText): Ditto. (WebCore::Editor::setTextAsChildOfElement): Ditto. (WebCore::Editor::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::fontForSelection): Remove ASSERT_NO_EXCEPTION. (WebCore::Editor::fontAttributesForSelectionStart): Ditto. * editing/markup.cpp: (WebCore::createFragmentForInnerOuterHTML): Use ExceptionOr. (WebCore::createContextualFragment): Ditto. (WebCore::replaceChildrenWithFragment): Ditto. (WebCore::replaceChildrenWithText): Ditto. * editing/markup.h: Updated for above changes. * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance): Removed ASSERT_NO_EXCEPTION. * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::setValueAsDate): Use ExceptionOr. (WebCore::BaseDateAndTimeInputType::setValueAsDecimal): Ditto. * html/BaseDateAndTimeInputType.h: Updated for above changes. * html/DateTimeLocalInputType.cpp: (WebCore::DateTimeLocalInputType::setValueAsDate): Use ExceptionOr. * html/DateTimeLocalInputType.h: Updated for above changes. * html/DOMTokenList.cpp: (WebCore::DOMTokenList::validateToken): Use ExceptionOr. (WebCore::DOMTokenList::validateTokens): Ditto. (WebCore::DOMTokenList::addInternal): Ditto. (WebCore::DOMTokenList::add): Ditto. (WebCore::DOMTokenList::removeInternal): Ditto. (WebCore::DOMTokenList::remove): Ditto. (WebCore::DOMTokenList::toggle): Ditto. (WebCore::DOMTokenList::replace): Ditto. (WebCore::DOMTokenList::supports): Ditto. * html/DOMTokenList.h: Updated for above changes. * html/DOMTokenList.idl: Use non-legacy exceptions. * html/DOMURL.cpp: (WebCore::DOMURL::DOMURL): Just take the two URL objects and let the create functions do all the processing. (WebCore::DOMURL::create): Use ExceptionOr, and move the processing of the URLs here out of the constructors. (WebCore::DOMURL::setHref): Use ExceptionOr. * html/DOMURL.h: Updated for above changes. * html/DOMURL.idl: Use non-legacy exceptions. * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocumentParser::appendEntry): Remove IGNORE_EXCEPTION and use releaseReturnValue(). * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toDataURL): Use ExceptionOr. * html/HTMLCanvasElement.h: Updated for above changes. * html/HTMLCanvasElement.idl: Use non-legacy exception. * html/HTMLElement.cpp: (WebCore::HTMLElement::textToFragment): Use ExceptionOr. (WebCore::HTMLElement::setInnerText): Ditto. (WebCore::HTMLElement::setOuterText): Ditto. (WebCore::HTMLElement::setContentEditable): Ditto. (WebCore::HTMLElement::translateAttributeMode): Deleted. (WebCore::HTMLElement::translate): Moved the logic from the translateAttributeMode function in here. * html/HTMLElement.h: Updated for above changes. * html/HTMLElement.idl: Use non-legacy exceptions. * html/HTMLEmbedElement.idl: Use non-legacy exception. * html/HTMLFrameElement.idl: Ditto. * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::getSVGDocument): Use ExceptionOr. * html/HTMLFrameOwnerElement.h: Updated for above. * html/HTMLIFrameElement.idl: Use non-legacy exception. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::stepUp): Use ExceptionOr. (WebCore::HTMLInputElement::stepDown): Ditto. (WebCore::HTMLInputElement::setValue): Ditto. (WebCore::HTMLInputElement::setValueAsDate): Ditto. (WebCore::HTMLInputElement::setValueAsNumber): Ditto. (WebCore::HTMLInputElement::setSize): Ditto. (WebCore::HTMLInputElement::maxLengthAttributeChanged): Use the new internalSetMaxLength function; old code relied on a setMaxLength that was different from the one exposed to bindings. (WebCore::HTMLInputElement::minLengthAttributeChanged): Ditto. (WebCore::HTMLInputElement::setRangeText): Use ExceptionOr. * html/HTMLInputElement.h: Updated for above changes. Also use data member initialization for InputElementClickState instead of a constructor. * html/HTMLInputElement.idl: Use non-legacy exception. * html/HTMLMarqueeElement.cpp: (WebCore::HTMLMarqueeElement::setLoop): Use ExceptionOr. (WebCore::HTMLMarqueeElement::renderMarquee): Tweaked. * html/HTMLMarqueeElement.h: Updated for above changes. * html/HTMLMarqueeElement.idl: Ditto. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::TrackGroup::TrackGroup): Initialize most data members in class definition rather than the constructor. (WebCore::HTMLMediaElement::HTMLMediaElement): Ditto. (WebCore::HTMLMediaElement::~HTMLMediaElement): Updated since removeMediaElement now takes a reference. (WebCore::HTMLMediaElement::updateActiveTextTrackCues): Use a modern for loop to streamline code. (WebCore::HTMLMediaElement::textTrackModeChanged): Updated since track now returns a reference. (WebCore::HTMLMediaElement::setCurrentTimeForBindings): Renamed to prevent ambiguity with the other version that has slightly different semantics and overloading and changed to use ExceptionOr. (WebCore::HTMLMediaElement::playInternal): Updated to use reference. (WebCore::HTMLMediaElement::setVolume): Use ExceptionOr. (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Take a reference instead of a PassRefPtr. (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Ditto. (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Ditto. (WebCore::HTMLMediaElement::mediaPlayerDidRemoveAudioTrack): Ditto. (WebCore::HTMLMediaElement::mediaPlayerDidRemoveTextTrack): Ditto. (WebCore::HTMLMediaElement::mediaPlayerDidRemoveVideoTrack): Ditto. (WebCore::HTMLMediaElement::addTextTrack): Use ExceptionOr. (WebCore::HTMLMediaElement::didAddTextTrack): Use a reference. (WebCore::HTMLMediaElement::didRemoveTextTrack): Ditto. (WebCore::HTMLMediaElement::maxBufferedTime): Update to use different interface to time ranges that does not need to deal with exceptions. (WebCore::HTMLMediaElement::setController): Pass references. (WebCore::HTMLMediaElement::outOfBandTrackSources): Use reference. * html/HTMLMediaElement.h: Updated for above. * html/HTMLMediaElement.idl: Use non-legacy exceptions. * html/HTMLObjectElement.idl: Use non-legacy exception. * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::createForJSConstructor): Use ExceptionOr. * html/HTMLOptionElement.h: Updated for above change. * html/HTMLOptionElement.idl: Use non-legacy exception. * html/HTMLOptionsCollection.cpp: (WebCore::HTMLOptionsCollection::setLength): Use ExceptionOr. * html/HTMLOptionsCollection.h: Updated for above change. * html/HTMLOptionsCollection.idl: Use non-legacy exception. * html/HTMLProgressElement.cpp: (WebCore::HTMLProgressElement::setValue): Removed non-finite handling because that is now handled by the bindings. (WebCore::HTMLProgressElement::setMax): Ditto. * html/HTMLProgressElement.h: Updated for above. * html/HTMLProgressElement.idl: Changed attributes to be double instead of unrestricted double, and this was able to remove exceptions. * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::removeByIndex): Drop IGNORE_EXCEPTION. (WebCore::HTMLSelectElement::remove): Use ExceptionOr. (WebCore::HTMLSelectElement::setOption): Ditto. (WebCore::HTMLSelectElement::setLength): Ditto. * html/HTMLSelectElement.h: Updated for above changes. * html/HTMLSelectElement.idl: Use non-legacy exceptions. * html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::setCaption): Use ExceptionOr. (WebCore::HTMLTableElement::setTHead): Ditto. (WebCore::HTMLTableElement::setTFoot): Ditto. (WebCore::HTMLTableElement::createTHead): Streamline a bit. (WebCore::HTMLTableElement::deleteTHead): Ditto. (WebCore::HTMLTableElement::createTFoot): Ditto. (WebCore::HTMLTableElement::deleteTFoot): Ditto. (WebCore::HTMLTableElement::createTBody): Ditto. (WebCore::HTMLTableElement::createCaption): Ditto. (WebCore::HTMLTableElement::insertRow): Use ExceptionOr. (WebCore::HTMLTableElement::deleteRow): Ditto. * html/HTMLTableElement.h: Updated for above changes. * html/HTMLTableElement.idl: Use non-legacy exceptions. * html/HTMLTableRowElement.cpp: (WebCore::findTable): Added. (WebCore::HTMLTableRowElement::rowIndex): Streamline a bit using the findTable function above. (WebCore::findRows): Added. (WebCore::HTMLTableRowElement::sectionRowIndex): Streamline a bit using the findRows function above. (WebCore::HTMLTableRowElement::insertCell): Use ExceptionOr. (WebCore::HTMLTableRowElement::deleteCell): Ditto. (WebCore::HTMLTableRowElement::setCells): Deleted. * html/HTMLTableRowElement.h: Updated for the above. The setCells function was dead code. * html/HTMLTableRowElement.idl: Use non-legacy exceptions. * html/HTMLTableSectionElement.cpp: (WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle): Tweaked a bit to use early return. (WebCore::HTMLTableSectionElement::insertRow): Use ExceptionOr. (WebCore::HTMLTableSectionElement::deleteRow): Ditto. (WebCore::HTMLTableSectionElement::numRows): Use childrenOfType. (WebCore::HTMLTableSectionElement::align): Deleted. (WebCore::HTMLTableSectionElement::setAlign): Deleted. (WebCore::HTMLTableSectionElement::ch): Deleted. (WebCore::HTMLTableSectionElement::setCh): Deleted. (WebCore::HTMLTableSectionElement::chOff): Deleted. (WebCore::HTMLTableSectionElement::setChOff): Deleted. (WebCore::HTMLTableSectionElement::vAlign): Deleted. (WebCore::HTMLTableSectionElement::setVAlign): Deleted. * html/HTMLTableSectionElement.h: Updated for the above. * html/HTMLTableSectionElement.idl: Use non-legacy exception. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged): Use the new internalSetMaxLength function; old code relied on a setMaxLength that was different from the one exposed to bindings. (WebCore::HTMLTextAreaElement::minLengthAttributeChanged): Ditto. (WebCore::HTMLTextAreaElement::updatePlaceholderText): Removed ASSERT_NO_EXCEPTION. * html/HTMLTextAreaElement.idl: Use non-legacy exceptions. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setRangeText): Use ExceptionOr. (WebCore::HTMLTextFormControlElement::setInnerTextValue): Ditto. (WebCore::HTMLTextFormControlElement::setMaxLength): Ditto. (WebCore::HTMLTextFormControlElement::setMinLength): Ditto. * html/HTMLTextFormControlElement.h: Updated for above changes. Also renamed the setMin/MaxLength function overloads for internal use to internSetMin/MaxLength and made them protected. * html/HTMLTrackElement.cpp: (WebCore::HTMLTrackElement::~HTMLTrackElement): Call clearElement on the track to break the connection. Before this was done as a side effect of clearClient, but that is called in other cases where we do not want to clear the link back to the track element. (WebCore::HTMLTrackElement::insertedInto): Removed code that uses the track function for its side effect of creating a track; no longer needed. Rewrote this so it's more symmetric with removedFrom. (WebCore::HTMLTrackElement::removedFrom): Pass reference. Also reordered and removed an unnecessary check for null parent. (WebCore::HTMLTrackElement::parseAttribute): Use track. (WebCore::HTMLTrackElement::kind): Ditto. (WebCore::HTMLTrackElement::track): Renamed ensureTrack to this. Also removed the redundant code to call setTrackElement; we no longer change the track element on a track until the track element is destroyed. (WebCore::HTMLTrackElement::scheduleLoad): Use track. (WebCore::HTMLTrackElement::loadTimerFired): Ditto. (WebCore::HTMLTrackElement::setReadyState): Ditto. (WebCore::HTMLTrackElement::readyState): Ditto. (WebCore::HTMLTrackElement::mediaElement): Rearranged to use early return. * html/HTMLTrackElement.h: Updated for above changes. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitEnterFullscreen): Use ExceptionOr. * html/HTMLVideoElement.h: Removed the functions used just for capitalization reasons; that's now handled in the bindings. * html/HTMLVideoElement.idl: Use non-legacy bindings and ImplementedAs. * html/ImageData.cpp: (WebCore::ImageData::create): Return ExceptionOr. * html/ImageData.h: Updated for above changes. * html/ImageData.idl: Use non-legacy exceptions. * html/InputType.cpp: (WebCore::InputType::setValueAsDate): Use ExceptionOr. (WebCore::InputType::setValueAsDouble): Ditto. (WebCore::InputType::setValueAsDecimal): Ditto. (WebCore::InputType::applyStep): Ditto. (WebCore::InputType::stepUp): Ditto. (WebCore::InputType::stepUpFromRenderer): Removed IGNORE_EXCEPTION. * html/InputType.h: Updated for the above. * html/MediaController.cpp: (MediaController::addMediaElement): Take a reference instead of a pointer. (MediaController::removeMediaElement): Ditto. (MediaController::containsMediaElement): Ditto. (MediaController::setVolume): Use ExceptionOr. (MediaController::bringElementUpToSpeed): Take a reference. * html/MediaController.h: Updated for above changes. Also made lots of function overrides private. * html/MediaController.idl: Use non-legacy exception. * html/MediaControllerInterface.h: Use ExceptionOr for setVolume. * html/NumberInputType.cpp: (WebCore::RealNumberRenderSize::max): Use aggregate initialization instead of a constructor. (WebCore::calculateRenderSize): Ditto. (WebCore::NumberInputType::setValueAsDouble): Use ExceptionOr. (WebCore::NumberInputType::setValueAsDecimal): Ditto. * html/NumberInputType.h: Updated for above changes. * html/RangeInputType.cpp: (WebCore::RangeInputType::RangeInputType): Initialize scalar data member in class definition instead of here. (WebCore::RangeInputType::setValueAsDecimal): Use ExceptionOr. (WebCore::RangeInputType::handleKeydownEvent): Removed IGNORE_EXCEPTION. * html/RangeInputType.h: Updated for above changes. * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::updatePlaceholderText): Removed ASSERT_NO_EXCEPTION. * html/TimeRanges.cpp: (WebCore::TimeRanges::start): Use ExceptionOr. (WebCore::TimeRanges::end): Ditto. * html/TimeRanges.h: Updated for the above. * html/TimeRanges.idl: Use non-legacy exceptions. * html/URLUtils.idl: Use non-legacy exception. * html/ValidationMessage.cpp: (WebCore::ValidationMessage::setMessageDOMAndStartTimer): Removed ASSERT_NO_EXCEPTION, IGNORE_EXCEPTION, and other exception-ignoring idioms. * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto. * html/shadow/MediaControlElementTypes.cpp: (WebCore::MediaControlVolumeSliderElement::defaultEventHandler): Ditto. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlPanelElement::setPosition): Ditto. (WebCore::MediaControlPanelElement::resetPosition): Ditto. (WebCore::MediaControlStatusDisplayElement::update): Ditto. (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Ditto. (WebCore::MediaControlFullscreenVolumeMinButtonElement::defaultEventHandler): Ditto. (WebCore::MediaControlFullscreenVolumeMaxButtonElement::defaultEventHandler): Ditto. * html/shadow/MediaControls.cpp: (WebCore::MediaControls::updateCurrentTimeDisplay): Ditto. * html/shadow/MediaControlsApple.cpp: (WebCore::MediaControlsApple::updateCurrentTimeDisplay): Ditto. * html/track/LoadableTextTrack.cpp: (WebCore::LoadableTextTrack::LoadableTextTrack): Take reference. (WebCore::LoadableTextTrack::~LoadableTextTrack): Deleted. (WebCore::LoadableTextTrack::clearClient): Deleted override. We no longer want to clear m_trackElement when clearing the client. (WebCore::LoadableTextTrack::setTrackElement): Deleted. (WebCore::LoadableTextTrack::id): Changed to use attributeWithoutSynchronization for better performance and idAttr instead of a string constant. * html/track/LoadableTextTrack.h: Updated for above changes. Added a new clearElement function. Made the element and isDefault functions private. * html/track/VTTCue.cpp: (WebCore::VTTCue::~VTTCue): Removed ASSERT_NO_EXCEPTION, IGNORE_EXCEPTION, and other exception-ignoring idioms. (WebCore::VTTCue::removeDisplayTree): Ditto. * html/track/VTTRegion.cpp: (WebCore::VTTRegion::displayLastTextTrackCueBox): Ditto. (WebCore::VTTRegion::willRemoveTextTrackCueBox): Ditto. * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::pushNodeByBackendIdToFrontend): Rewrote to avoid multiplehash table lookups and added a FIXME about the peculiar code here. (WebCore::InspectorDOMAgent::resolveNode): Streamlined. (WebCore::InspectorDOMAgent::nodeAsScriptValue): Use the new checkSecurityForNode instead of the old shouldAllowAccessToNode. * platform/graphics/ImageBuffer.h: Take Optional<double> instead of const double* in toDataURL. Renamed ImageDataToDataURL to just dataURL. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::addAudioTrack): Take a reference instead of PassRefPtr. (WebCore::MediaPlayer::removeAudioTrack): Ditto. (WebCore::MediaPlayer::addTextTrack): Ditto. (WebCore::MediaPlayer::removeTextTrack): Ditto. (WebCore::MediaPlayer::addVideoTrack): Ditto. (WebCore::MediaPlayer::removeVideoTrack): Ditto. * platform/graphics/MediaPlayer.h: Updated for the above. * platform/graphics/PlatformTimeRanges.h: Exported a couple of functions that are now used in WebKit. * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::clearTextTracks): Use a modern for loop. (WebCore::MediaPlayerPrivateAVFoundation::processNewAndRemovedTextTracks): Fixed a bug that would cause this function to fail to process half the tracks. Also updated for the change from PassRefPtr to references. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::determineChangedTracksFromNewTracksAndOldItems): Pass references. (WebCore::MediaPlayerPrivateAVFoundationObjC::audioSourceProvider): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::processMetadataTrack): Ditto. (WebCore::assetMetadataKeyNames): Tweaked formatting. (WebCore::itemKVOProperties): Ditto. (WebCore::playerKVOProperties): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::updateTracksOfType): Pass references. * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::toDataURL): Use Optional<double> * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::createBitmapImageAfterScalingIfNeeded): Use auto. (WebCore::encodeImage): Ditto. Also renamed from CGImageEncodeToData. (WebCore::dataURL): Ditto. Also renamed from CGImageToDataURL and from ImageDataToDataURL. (WebCore::ImageBuffer::toDataURL): Ditto. * platform/graphics/efl/ImageBufferEfl.cpp: (WebCore::encodeImageJPEG): Use Optional<double> (WebCore::ImageBuffer::toDataURL): Ditto. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Pass a reference instead of pointer. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto. (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection): Ditto. (WebCore::MediaPlayerPrivateGStreamer::processTableOfContents): Ditto. * platform/graphics/gtk/ImageBufferGtk.cpp: (WebCore::encodeImage): Use Optional<double> (WebCore::ImageBuffer::toDataURL): Ditto. 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Allow @font-face src descriptor's format function to contain identifiers https://bugs.webkit.org/show_bug.cgi?id=164169 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFontFaceSrcURI): 2016-10-28 Jer Noble <jer.noble@apple.com> WebAudio does not resume when moving from background to foreground tab. https://bugs.webkit.org/show_bug.cgi?id=164043 Reviewed by Darin Adler. Test: webaudio/page-canstartmedia.html * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::mediaCanStart): 2016-10-28 Wenson Hsieh <wenson_hsieh@apple.com> iOS autocorrection does not trigger an input event of inputType "insertReplacementText" https://bugs.webkit.org/show_bug.cgi?id=164077 <rdar://problem/28987810> Reviewed by Simon Fraser. Fixes candidate insertion on iOS, so that it fires input events of type "insertReplacementText" and adds two iOS unit tests covering this change as well as the test infrastructure needed to support these tests. See comments below for more details. Tests: fast/events/ios/before-input-events-prevent-candidate-insertion.html fast/events/ios/input-events-insert-replacement-text.html * dom/TextEvent.h: Adds isAutocompletion() to TextEvent, as well as the TextEventInputAutocompletion text input type. When the Editor handles this TextEvent, it will use this information when creating or modifying the corresponding typing command. * dom/TextEventInputType.h: * editing/Editor.cpp: (WebCore::Editor::insertText): (WebCore::Editor::insertTextWithoutSendingTextEvent): * editing/Editor.h: * editing/TypingCommand.cpp: (WebCore::editActionForTypingCommand): Now takes whether the command is autocorrection into account. If so, the corresponding edit action should be EditActionInsertReplacement rather than EditActionTypingInsertText. (WebCore::TypingCommand::TypingCommand): (WebCore::TypingCommand::deleteSelection): (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::forwardDeleteKeyPressed): (WebCore::TypingCommand::insertText): (WebCore::TypingCommand::insertLineBreak): (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent): (WebCore::TypingCommand::insertParagraphSeparator): (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::willAddTypingToOpenCommand): * editing/TypingCommand.h: Adds a new TypingCommand option, IsAutocompletion. 2016-10-28 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r207700. https://bugs.webkit.org/show_bug.cgi?id=164168 We are ready after r208086 (Requested by alexchristensen on #webkit). Reverted changeset: "Unreviewed, rolling out r207582." https://bugs.webkit.org/show_bug.cgi?id=163819 http://trac.webkit.org/changeset/207700 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Allow unknown properties in will-change https://bugs.webkit.org/show_bug.cgi?id=164165 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWillChange): 2016-10-28 Alex Christensen <achristensen@webkit.org> Partially revert 207805 after resolution in URL spec issue 87 https://bugs.webkit.org/show_bug.cgi?id=164142 Reviewed by Andy Estes. Covered by updated layout tests and API tests. * platform/URLParser.cpp: (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): Treat %2e%2e as .. and %2e as . but only if it is entirety of the path segment. There are tests for URLs like http://host/abc%2edef which have not changed because the %2e is not the entirety of the path segment. 2016-10-28 Alex Christensen <achristensen@webkit.org> URLParser should not try to interpret host of URLs with unrecognized schemes as IPv4 address https://bugs.webkit.org/show_bug.cgi?id=164154 Reviewed by Andy Estes. This is needed to match behavior of all browsers. This is being discussed in the spec at https://github.com/whatwg/url/issues/148 Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseHostAndPort): Only try to parse and canonicalize the host as an IPv4 address if the scheme is special (http, wss, etc.) 2016-10-28 Chris Dumez <cdumez@apple.com> DOMStringMap reports properties as non-enumerable https://bugs.webkit.org/show_bug.cgi?id=164114 Reviewed by Sam Weinig. DOMStringMap's named properties should be configurable, enumerable and writable as per: - https://heycam.github.io/webidl/#getownproperty-guts (2.7-9) - https://html.spec.whatwg.org/multipage/dom.html#domstringmap Firefox and Chrome agree with the specification. However, WebKit was doing the complete opposite. No new tests, updated existing test. * bindings/js/JSDOMStringMapCustom.cpp: (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate): 2016-10-28 Ryosuke Niwa <rniwa@webkit.org> Add CEReactions to the remaining HTML DOM APIs https://bugs.webkit.org/show_bug.cgi?id=163969 Reviewed by Chris Dumez. Added CEReactions to the remaining DOM and HTML APIs as needed. Tests: fast/custom-elements/reactions-for-indieui.html fast/custom-elements/reactions/Document.html fast/custom-elements/reactions/HTMLAnchorElement.html fast/custom-elements/reactions/HTMLOptionElement.html fast/custom-elements/reactions/HTMLOptionsCollection.html fast/custom-elements/reactions/HTMLOutputElement.html fast/custom-elements/reactions/HTMLSelectElement.html fast/custom-elements/reactions/HTMLTableElement.html fast/custom-elements/reactions/HTMLTableRowElement.html fast/custom-elements/reactions/HTMLTableSectionElement.html fast/custom-elements/reactions/HTMLTitleElement.html fast/custom-elements/reactions/ShadowRoot.html * bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::setLength): (WebCore::JSHTMLOptionsCollection::indexSetter): * bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::JSHTMLSelectElement::indexSetter): * dom/CharacterData.idl: * dom/Document.idl: * dom/Element.idl: * dom/ShadowRoot.idl: * html/HTMLAnchorElement.idl: * html/HTMLDocument.idl: * html/HTMLOptionElement.idl: * html/HTMLOptionsCollection.idl: * html/HTMLOutputElement.idl: * html/HTMLSelectElement.idl: * html/HTMLTableElement.idl: * html/HTMLTableRowElement.idl: * html/HTMLTableSectionElement.idl: * html/HTMLTitleElement.idl: 2016-10-28 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: volume control support https://bugs.webkit.org/show_bug.cgi?id=163727 Reviewed by Dean Jackson. We introduce the VolumeSupport class which brings support for modifying the media volume by interacting with the mute volume slider in the media controls and correctly reflecting the media's volume should it be changed via the media API. Tests: media/modern-media-controls/volume-support/volume-support-click.html media/modern-media-controls/volume-support/volume-support-drag.html media/modern-media-controls/volume-support/volume-support-media-api-mute.html media/modern-media-controls/volume-support/volume-support-media-api.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/volume-support.js: Added. (VolumeSupport.prototype.get control): (VolumeSupport.prototype.get mediaEvents): (VolumeSupport.prototype.controlValueWillStartChanging): (VolumeSupport.prototype.controlValueDidChange): (VolumeSupport.prototype.syncControl): (VolumeSupport): * WebCore.xcodeproj/project.pbxproj: 2016-10-28 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Rename CallDOM to CallDOMGetter https://bugs.webkit.org/show_bug.cgi?id=164157 Reviewed by Keith Miller. No behavior change. * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): * bindings/scripts/test/JS/JSTestDOMJIT.h: * domjit/JSDocumentDOMJIT.cpp: (WebCore::DocumentDocumentElementDOMJIT::callDOMGetter): (WebCore::DocumentDocumentElementDOMJIT::callDOM): Deleted. * domjit/JSNodeDOMJIT.cpp: (WebCore::createCallDOMGetterForOffsetAccess): (WebCore::NodeFirstChildDOMJIT::callDOMGetter): (WebCore::NodeLastChildDOMJIT::callDOMGetter): (WebCore::NodeNextSiblingDOMJIT::callDOMGetter): (WebCore::NodePreviousSiblingDOMJIT::callDOMGetter): (WebCore::NodeParentNodeDOMJIT::callDOMGetter): (WebCore::NodeNodeTypeDOMJIT::callDOMGetter): (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): (WebCore::createCallDOMForOffsetAccess): Deleted. (WebCore::NodeFirstChildDOMJIT::callDOM): Deleted. (WebCore::NodeLastChildDOMJIT::callDOM): Deleted. (WebCore::NodeNextSiblingDOMJIT::callDOM): Deleted. (WebCore::NodePreviousSiblingDOMJIT::callDOM): Deleted. (WebCore::NodeParentNodeDOMJIT::callDOM): Deleted. (WebCore::NodeNodeTypeDOMJIT::callDOM): Deleted. (WebCore::NodeOwnerDocumentDOMJIT::callDOM): Deleted. 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix font-family parsing inside @font-face https://bugs.webkit.org/show_bug.cgi?id=164155 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseFontFaceDescriptor): Use the full font-family parsing that returns a CSSValueList, since we can handle multiple families. 2016-10-28 Per Arne Vollan <pvollan@apple.com> [Win][Direct2D] Implement ImageBufferData::putData. https://bugs.webkit.org/show_bug.cgi?id=164151 Reviewed by Brent Fulgham. * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::getData): (WebCore::ImageBufferData::putData): 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support hanging-punctuation https://bugs.webkit.org/show_bug.cgi?id=164153 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeHangingPunctuation): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-28 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Implement Document::documentElement https://bugs.webkit.org/show_bug.cgi?id=164113 Reviewed by Sam Weinig. Test: js/dom/domjit-accessor-document-element.html This patch implements document.documentElement DOMJIT accessor. Similar to ownerDocument accessor, the way to access to document.documentElement from JIT code is already prepared for CSSJIT. DOMJIT just utilizes the existing functionality: using documentElementMemoryOffset(). document.documentElement is frequently called in jQuery. Especially, every time we call jQuery.attr(), this is called. To implement Document accessor, we clean up some code in DOMJITHelpers. We create the cpp file for DOMJITHelpers and move some helpers to it. And we also implement DOMJIT::checkDOM<DOMInterface> for convenience. It returns appropriate CheckDOM patchpoint implementation. This patch improves Dromaeo jslib-attr-jquery.html 10% (481.64 v.s. 532.54). * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsScopeRoot): * dom/Document.idl: * domjit/DOMJITAbstractHeapRepository.h: * domjit/DOMJITCheckDOM.h: Copied from Source/WebCore/domjit/DOMJITAbstractHeapRepository.h. (WebCore::DOMJIT::TypeChecker<Node>::branchIfFail): (WebCore::DOMJIT::TypeChecker<Document>::branchIfFail): (WebCore::DOMJIT::TypeChecker<Event>::branchIfFail): (WebCore::DOMJIT::TypeChecker<Element>::branchIfFail): (WebCore::DOMJIT::checkDOM): * domjit/DOMJITHelpers.cpp: Copied from Source/WebCore/domjit/DOMJITAbstractHeapRepository.h. (WebCore::DOMJIT::loadDocument): (WebCore::DOMJIT::loadDocumentElement): * domjit/DOMJITHelpers.h: (WebCore::DOMJIT::toWrapperSlow): (WebCore::DOMJIT::loadDocument): Deleted. * domjit/JSDocumentDOMJIT.cpp: Added. (WebCore::DocumentDocumentElementDOMJIT::checkDOM): (WebCore::DocumentDocumentElementDOMJIT::callDOM): * domjit/JSNodeDOMJIT.cpp: (WebCore::createCallDOMForOffsetAccess): (WebCore::NodeFirstChildDOMJIT::checkDOM): (WebCore::NodeLastChildDOMJIT::checkDOM): (WebCore::NodeNextSiblingDOMJIT::checkDOM): (WebCore::NodePreviousSiblingDOMJIT::checkDOM): (WebCore::NodeParentNodeDOMJIT::checkDOM): (WebCore::NodeNodeTypeDOMJIT::checkDOM): (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): (WebCore::NodeOwnerDocumentDOMJIT::callDOM): (WebCore::toWrapperSlow): Deleted. (WebCore::checkNode): Deleted. 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support initial-letter https://bugs.webkit.org/show_bug.cgi?id=164150 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeInitialLetter): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-28 Simon Fraser <simon.fraser@apple.com> Remove some unused code in RenderLayerCompositor::computeExtent() https://bugs.webkit.org/show_bug.cgi?id=163934 Reviewed by Zalan Bujtas. viewportRect was never used. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeExtent): 2016-10-28 Sam Weinig <sam@webkit.org> [WebIDL] Update parser and code generators to only access type information through the type property https://bugs.webkit.org/show_bug.cgi?id=164141 Reviewed by Anders Carlsson. Update IDLParser structs: - domSignature: Rename idlType to type. Specify that type is a domType. - domInterface: Remove name and parent. Specify that type and parentType are a domTypes. - domFunction: Specify that signature is a domSignature. - domAttribute: Remove unused type. Specify that signature is a domSignature. - domIterable: Remove idlKeyType and valueKeyType. Specify that keyType and valueType are a domTypes - domConstant: Specify that type is a domType. - domEnum: Specify that type is a domType. - domDictionary: Remove name and parent. Specify that type and parentType are a domTypes. - Typedef: Rename idlType to type and specify that it is a domType. * bindings/scripts/IDLParser.pm: Remove redundant properties and specify type info in structs where possible. * bindings/scripts/CodeGenerator.pm: (IsSVGTypeNeedingTearOffForType): Renamed to remove ForType suffix. (IsSVGTypeWithWritablePropertiesNeedingTearOffForType): Renamed to remove ForType suffix. (GetSVGTypeNeedingTearOffForType): Renamed to remove ForType suffix. (GetSVGWrappedTypeNeedingTearOffForType): Renamed to remove ForType suffix. Update to always access type information through type accessors. Remove use of removed properties. * bindings/scripts/CodeGeneratorJS.pm: (IsNullableType): Deleted. (StripNullable): Deleted. Remove unused functions. Update to always access type information through type accessors. Remove use of removed properties. * bindings/scripts/generate-bindings.pl: Update to always access type information through type accessors. Remove use of removed properties. 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support bopomofo Ruby https://bugs.webkit.org/show_bug.cgi?id=164148 Reviewed by Simon Fraser. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add support for -webkit-canvas images https://bugs.webkit.org/show_bug.cgi?id=164144 Reviewed by Simon Fraser. * css/CSSValueKeywords.in: * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeWebkitCanvas): (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage): (WebCore::CSSPropertyParserHelpers::isGeneratedImage): 2016-10-27 Geoffrey Garen <ggaren@apple.com> One file per class for Executable.h/.cpp https://bugs.webkit.org/show_bug.cgi?id=164099 Reviewed by Saam Barati. * ForwardingHeaders/runtime/Executable.h: Removed. * ForwardingHeaders/runtime/FunctionExecutable.h: Copied from Source/WebCore/ForwardingHeaders/runtime/Executable.h. * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSMainThreadExecStateInstrumentation.h: 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Clean up gradient parsing https://bugs.webkit.org/show_bug.cgi?id=164139 Reviewed by Dean Jackson. * css/CSSGradientValue.cpp: (WebCore::positionFromValue): (WebCore::CSSGradientValue::computeEndPoint): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient): (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops): (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient): (WebCore::CSSPropertyParserHelpers::consumeRadialGradient): (WebCore::CSSPropertyParserHelpers::consumeLinearGradient): 2016-10-28 Dean Jackson <dino@apple.com> New CSS Parser should use Colors not RGBA32s https://bugs.webkit.org/show_bug.cgi?id=164124 <rdar://problem/29000373> Reviewed by Darin Adler. The old parser has moved from using RGBA32 values to using Colors directly. This was so we could support ExtendedColors via the new color() syntax. Update the new CSS parser to do the same. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseRGBParameters): (WebCore::CSSPropertyParserHelpers::parseHSLParameters): (WebCore::CSSPropertyParserHelpers::parseHexColor): (WebCore::CSSPropertyParserHelpers::parseColorFunction): (WebCore::CSSPropertyParserHelpers::consumeColor): 2016-10-28 Dean Jackson <dino@apple.com> Allow new CSS parser to handle insertRule, etc via parseRule https://bugs.webkit.org/show_bug.cgi?id=164122 <rdar://problem/29000101> Reviewed by Darin Adler. Call the new CSS parser from CSSParser::parseRule if enabled. This allows style added via the CSSOM insertRule to go through the parser. I tested this across our layout tests that use insertRule. It works fine, but does cause some filter tests to fail. This is because the new parser does not generate WebKitCSSFilterValues, but I think the CSSFunctionValue is good enough. I'll remove WebKitCSSFilterValue separately. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseRule): Call CSSParserImpl::parseRule. 2016-10-28 Simon Fraser <simon.fraser@apple.com> Wrong blur radius for filter: drop-shadow() https://bugs.webkit.org/show_bug.cgi?id=163667 Reviewed by Darin Adler. The "stdDev" parameter to <feDropShadow> and <feGaussianBlur> represents the standard deviation (σ) of the Gaussian blur function. CSS filters drop-shadow() and blur() follow this with their radius parameter. However, CSS box-shadow and text-shadow use 2σ to describe the blur radius, since this is conveniently close to the number of pixels the effect of the blur extends out. feDropShadow, which is used by non-accelerated filter: drop-shadow(), was using the wrong blur radius because it passed its stdDev directly to ShadowBlur. ShadowBlur was written for CSS box-shadow, so expected its input "blur radius" to be twice the stdDev. Tests: css3/filters/drop-shadow-blur-radius.html svg/filters/feDropShadow-blur-radius.html * platform/graphics/filters/FEDropShadow.cpp: (WebCore::FEDropShadow::platformApplySoftware): 2016-10-28 Youenn Fablet <youenn@apple.com> Expose RTCPeerConnection unprefixed https://bugs.webkit.org/show_bug.cgi?id=164060 Reviewed by Darin Adler. Covered by rebased and activated tests. * Modules/mediastream/RTCPeerConnection.idl: 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support the marquee properties https://bugs.webkit.org/show_bug.cgi?id=164132 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWebkitMarqueeIncrement): (WebCore::consumeWebkitMarqueeRepetition): (WebCore::consumeWebkitMarqueeSpeed): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseShorthand): 2016-10-28 Dave Hyatt <hyatt@apple.com> [CSS Parser] Miscellaneous bug fixes https://bugs.webkit.org/show_bug.cgi?id=164131 Reviewed by Zalan Bujtas. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSPropertyNames.in: The prefix was incorrectly dropped from -webkit-column-progression. Put it back. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertPositionComponent): (WebCore::StyleBuilderConverter::convertObjectPosition): Fix object-position parsing so that the position components can be ids. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueContent): The new parser doesn't make a list for content:none, since none can't be a component of a list anyway. Add code to handle this case in the apply function. * css/parser/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): Put the prefix back on -webkit-column-progression. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): Same. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parsePageSelector): Make sure match type is checked, since our code asserts if it isn't. * css/parser/CSSPropertyParser.cpp: (WebCore::validWidthOrHeightKeyword): (WebCore::consumeLineGrid): (WebCore::CSSPropertyParser::parseSingleValue): Add support for the line-grid properties and for -webkit-nbsp-mode. 2016-10-28 Antti Koivisto <antti@apple.com> Always use iOS preload behavior https://bugs.webkit.org/show_bug.cgi?id=164127 Reviewed by Andreas Kling. On non-iOS platforms we were delaying issuing lower priority preload (images mostly) until document has body. This should be unnecessary as networking layer prioritization should ensure higher priority resources are loaded earlier. Testing on iOS has showed that more aggressive behavior is a win. This patch switches to iOS behavior on all platforms (and simplified the logic). * html/parser/HTMLResourcePreloader.cpp: (WebCore::HTMLResourcePreloader::preload): * loader/LinkLoader.cpp: (WebCore::LinkLoader::preloadIfNeeded): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::performPostLoadActions): (WebCore::CachedResourceLoader::preload): (WebCore::CachedResourceLoader::isPreloaded): (WebCore::CachedResourceLoader::checkForPendingPreloads): Deleted. (WebCore::CachedResourceLoader::requestPreload): Deleted. (WebCore::CachedResourceLoader::clearPendingPreloads): Deleted. * loader/cache/CachedResourceLoader.h: 2016-10-28 Youenn Fablet <youenn@apple.com> [Fetch] Ensure redirection count is no more than 20 in case of cross origin requests https://bugs.webkit.org/show_bug.cgi?id=164117 Reviewed by Sam Weinig. Tests: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin-worker.html imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin.html Introducing a ResourceLoaderOptions that defines the maximum redirection count. By default, it is set to 20 as per fetch specification. This option is used by SubresourceLoader to cancel load if its redirection count is above that maximum. DocumentThreadableLoader stopping redirections to make preflight if needed, it now uses the maxRedirectCount loader option to ensure that the total number of redirections is 20. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): * loader/ResourceLoaderOptions.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * loader/SubresourceLoader.h: 2016-10-28 Fujii Hironori <Hironori.Fujii@sony.com> generate-bindings-all.pl should recompile supplemented IDL if its supplemental IDL are added or removed https://bugs.webkit.org/show_bug.cgi?id=164054 Reviewed by Michael Catanzaro. generate-bindings-all.pl determines which IDL to recompile by comparing timestamps of generated files, source IDL and its dependencies. But this is not enough. If a new supplemental IDL is added, its supplemented IDL needs to be recompiled even though the timestamp of the supplemental IDL is older than the generated files. * bindings/scripts/generate-bindings-all.pl: Read supplemental dependency file both before and after invoking preprocess-idls.pl. Recompile IDL files if its supplemental dependencies are added or removed. 2016-10-28 Youenn Fablet <youenn@apple.com> PeerMediaDescription does not need to be refcounted https://bugs.webkit.org/show_bug.cgi?id=164059 Reviewed by Darin Adler. No change of behavior. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::createOfferTask): (WebCore::MediaEndpointPeerConnection::createAnswerTask): (WebCore::createSourceMap): (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): (WebCore::MediaEndpointPeerConnection::addIceCandidateTask): (WebCore::MediaEndpointPeerConnection::gotIceCandidate): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/SDPProcessor.cpp: (WebCore::configurationFromJSON): (WebCore::configurationToJSON): (WebCore::SDPProcessor::generateCandidateLine): (WebCore::SDPProcessor::parseCandidateLine): * platform/mediastream/IceCandidate.h: * platform/mediastream/MediaEndpointSessionConfiguration.h: (WebCore::MediaEndpointSessionConfiguration::mediaDescriptions): (WebCore::MediaEndpointSessionConfiguration::addMediaDescription): (WebCore::MediaEndpointSessionConfiguration::clone): * platform/mediastream/PeerMediaDescription.h: (WebCore::PeerMediaDescription::addPayload): (WebCore::PeerMediaDescription::addSsrc): (WebCore::PeerMediaDescription::clearSsrcs): (WebCore::PeerMediaDescription::addIceCandidate): (WebCore::PeerMediaDescription::create): Deleted. (WebCore::PeerMediaDescription::~PeerMediaDescription): Deleted. (WebCore::PeerMediaDescription::type): Deleted. (WebCore::PeerMediaDescription::setType): Deleted. (WebCore::PeerMediaDescription::port): Deleted. (WebCore::PeerMediaDescription::setPort): Deleted. (WebCore::PeerMediaDescription::address): Deleted. (WebCore::PeerMediaDescription::setAddress): Deleted. (WebCore::PeerMediaDescription::mode): Deleted. (WebCore::PeerMediaDescription::setMode): Deleted. (WebCore::PeerMediaDescription::mid): Deleted. (WebCore::PeerMediaDescription::setMid): Deleted. (WebCore::PeerMediaDescription::payloads): Deleted. (WebCore::PeerMediaDescription::setPayloads): Deleted. (WebCore::PeerMediaDescription::rtcpMux): Deleted. (WebCore::PeerMediaDescription::setRtcpMux): Deleted. (WebCore::PeerMediaDescription::rtcpAddress): Deleted. (WebCore::PeerMediaDescription::setRtcpAddress): Deleted. (WebCore::PeerMediaDescription::rtcpPort): Deleted. (WebCore::PeerMediaDescription::setRtcpPort): Deleted. (WebCore::PeerMediaDescription::mediaStreamId): Deleted. (WebCore::PeerMediaDescription::setMediaStreamId): Deleted. (WebCore::PeerMediaDescription::mediaStreamTrackId): Deleted. (WebCore::PeerMediaDescription::setMediaStreamTrackId): Deleted. (WebCore::PeerMediaDescription::dtlsSetup): Deleted. (WebCore::PeerMediaDescription::setDtlsSetup): Deleted. (WebCore::PeerMediaDescription::dtlsFingerprintHashFunction): Deleted. (WebCore::PeerMediaDescription::setDtlsFingerprintHashFunction): Deleted. (WebCore::PeerMediaDescription::dtlsFingerprint): Deleted. (WebCore::PeerMediaDescription::setDtlsFingerprint): Deleted. (WebCore::PeerMediaDescription::cname): Deleted. (WebCore::PeerMediaDescription::setCname): Deleted. (WebCore::PeerMediaDescription::ssrcs): Deleted. (WebCore::PeerMediaDescription::iceUfrag): Deleted. (WebCore::PeerMediaDescription::setIceUfrag): Deleted. (WebCore::PeerMediaDescription::icePassword): Deleted. (WebCore::PeerMediaDescription::setIcePassword): Deleted. (WebCore::PeerMediaDescription::iceCandidates): Deleted. (WebCore::PeerMediaDescription::clone): Deleted. (WebCore::PeerMediaDescription::PeerMediaDescription): Deleted. * platform/mediastream/mac/MediaEndpointMac.cpp: (WebCore::MediaEndpointMac::addRemoteCandidate): (WebCore::MediaEndpointMac::OnIceCandidate): * platform/mediastream/mac/MediaEndpointMac.h: * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::updateSendConfiguration): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::updateConfigurationMids): 2016-10-28 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: scrubbing support https://bugs.webkit.org/show_bug.cgi?id=163726 <rdar://problem/27989481> Reviewed by Dean Jackson. We introduce the ScrubberSupport class which brings support for scrubbing the media by interacting with the scrubber in the media controls and correctly reflecting the media's current time as set via the media API. Tests: media/modern-media-controls/scrubber-support/scrubber-support-click.html media/modern-media-controls/scrubber-support/scrubber-support-drag.html media/modern-media-controls/scrubber-support/scrubber-support-media-api.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/scrubbing-support.js: Added. (ScrubbingSupport.prototype.get control): (ScrubbingSupport.prototype.get mediaEvents): (ScrubbingSupport.prototype.controlValueWillStartChanging): (ScrubbingSupport.prototype.controlValueDidChange): (ScrubbingSupport.prototype.controlValueDidStopChanging): (ScrubbingSupport.prototype.syncControl): (ScrubbingSupport): * WebCore.xcodeproj/project.pbxproj: 2016-10-28 Alex Christensen <achristensen@webkit.org> Fix Windows WebGL build after r208022 https://bugs.webkit.org/show_bug.cgi?id=164091 * platform/graphics/opengl/Extensions3DOpenGLCommon.h: * platform/graphics/opengl/Extensions3DOpenGLES.cpp: (WebCore::Extensions3DOpenGLES::Extensions3DOpenGLES): * platform/graphics/opengl/Extensions3DOpenGLES.h: * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: (WebCore::GraphicsContext3D::getExtensions): 2016-10-27 Youenn Fablet <youenn@apple.com> [Fetch API] Fetch ReadableStream should only clone the second branch https://bugs.webkit.org/show_bug.cgi?id=164058 Reviewed by Darin Adler. Covered by rebased tests. * Modules/streams/ReadableStreamInternals.js: (readableStreamTeePullFunction): 2016-10-27 Alex Christensen <achristensen@webkit.org> Update ANGLE https://bugs.webkit.org/show_bug.cgi?id=164101 Reviewed by Darin Adler. ShCheckVariablesWithinPackingLimits has changed signatures from taking a ShVariableInfo* and length to taking a std::vector<sh::ShaderVariable> which requires more information about the shader variables than we kept in GraphicsContext3D::SymbolInfo. I removed the SymbolInfo class because it was redundant with ANGLE's sh::ShaderVariable and now unused. Covered by existing WebGL tests. * CMakeLists.txt: * PlatformMac.cmake: * PlatformWin.cmake: * platform/graphics/ANGLEWebKitBridge.cpp: (WebCore::appendSymbol): (WebCore::getStructInfo): (WebCore::getSymbolInfo): (WebCore::ANGLEWebKitBridge::compileShaderSource): * platform/graphics/ANGLEWebKitBridge.h: (WebCore::ANGLEShaderSymbol::isSampler): Deleted. * platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo): Deleted. (WebCore::GraphicsContext3D::SymbolInfo::operator==): Deleted. * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::checkVaryingsPacking): (WebCore::GraphicsContext3D::precisionsMatch): (WebCore::GraphicsContext3D::mappedSymbolName): (WebCore::GraphicsContext3D::originalSymbolName): 2016-10-27 Simon Fraser <simon.fraser@apple.com> Remove RenderStyle::isRunningAcceleratedAnimation() https://bugs.webkit.org/show_bug.cgi?id=164109 Reviewed by David Hyatt. RenderStyle::isRunningAcceleratedAnimation() was added in r40876 to handle interrupted accelerated transitions, and to allow RenderLayer::currentTransform() to know when it has to manually get the animated style. The latter can now use isRunningAcceleratedAnimationOnRenderer(), and interrupting accelerated transitions seems to work fine without it, so remove it. * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::animate): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::currentTransform): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::isRunningAcceleratedAnimation): Deleted. (WebCore::RenderStyle::setIsRunningAcceleratedAnimation): Deleted. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator==): * rendering/style/StyleRareNonInheritedData.h: 2016-10-27 Myles C. Maxfield <mmaxfield@apple.com> Teach WebGL code about new buffer targets in WebGL2 https://bugs.webkit.org/show_bug.cgi?id=163924 Reviewed by Dean Jackson. WebGL 2 adds new buffer targets. Instead of completely reimplementing the functions again for WebGL 2, we can simply check if we are using a new kind of context to conditionally enable support. Test: fast/canvas/webgl/webgl2-buffer-targets.html * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGL2RenderingContext.idl: * html/canvas/WebGLBuffer.cpp: (WebCore::WebGLBuffer::associateBufferDataImpl): (WebCore::WebGLBuffer::associateBufferSubDataImpl): (WebCore::WebGLBuffer::setTarget): * html/canvas/WebGLBuffer.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::bindBuffer): (WebCore::WebGLRenderingContextBase::getBufferParameter): (WebCore::WebGLRenderingContextBase::validateBufferDataParameters): * html/canvas/WebGLRenderingContextBase.h: 2016-10-27 Dave Hyatt <hyatt@apple.com> [CSS Parser] Enhance grid-auto-flow parsing to allow dense first. https://bugs.webkit.org/show_bug.cgi?id=164110 Reviewed by Simon Fraser. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertGridAutoFlow): 2016-10-27 Simon Fraser <simon.fraser@apple.com> constify the CSSValue arguments to StyleBuilderConverter functions https://bugs.webkit.org/show_bug.cgi?id=164106 Reviewed by Zalan Bujtas. Make almost all the CSSValue& arguments const (this makes it clear that they are in params, not out params). Only a few that are CSSImageValues are non-const, because they fall into a non-const code path. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertLengthOrAuto): (WebCore::StyleBuilderConverter::convertLengthSizing): (WebCore::StyleBuilderConverter::convertLengthMaxSizing): (WebCore::StyleBuilderConverter::convertComputedLength): (WebCore::StyleBuilderConverter::convertLineWidth): (WebCore::StyleBuilderConverter::convertSpacing): (WebCore::StyleBuilderConverter::convertToRadiusLength): (WebCore::StyleBuilderConverter::convertRadius): (WebCore::StyleBuilderConverter::convertObjectPosition): (WebCore::StyleBuilderConverter::convertTextDecoration): (WebCore::StyleBuilderConverter::convertNumber): (WebCore::StyleBuilderConverter::convertNumberOrAuto): (WebCore::StyleBuilderConverter::convertWebkitHyphenateLimitLines): (WebCore::StyleBuilderConverter::convertTransform): (WebCore::StyleBuilderConverter::convertString): (WebCore::StyleBuilderConverter::convertStringOrAuto): (WebCore::StyleBuilderConverter::convertStringOrNone): (WebCore::StyleBuilderConverter::valueToEmphasisPosition): (WebCore::StyleBuilderConverter::convertTextEmphasisPosition): (WebCore::StyleBuilderConverter::convertTextAlign): (WebCore::StyleBuilderConverter::convertClipPath): (WebCore::StyleBuilderConverter::convertResize): (WebCore::StyleBuilderConverter::convertMarqueeRepetition): (WebCore::StyleBuilderConverter::convertMarqueeSpeed): (WebCore::StyleBuilderConverter::convertQuotes): (WebCore::StyleBuilderConverter::convertTextUnderlinePosition): (WebCore::StyleBuilderConverter::convertReflection): (WebCore::StyleBuilderConverter::convertInitialLetter): (WebCore::StyleBuilderConverter::convertTextStrokeWidth): (WebCore::StyleBuilderConverter::convertLineBoxContain): (WebCore::StyleBuilderConverter::convertTextDecorationSkip): (WebCore::StyleBuilderConverter::convertScrollSnapPoints): (WebCore::StyleBuilderConverter::convertSnapCoordinatePair): (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates): (WebCore::StyleBuilderConverter::createGridTrackBreadth): (WebCore::StyleBuilderConverter::createGridTrackSize): (WebCore::StyleBuilderConverter::createGridTrackList): (WebCore::StyleBuilderConverter::createGridPosition): (WebCore::StyleBuilderConverter::convertGridTrackSizeList): (WebCore::StyleBuilderConverter::convertGridTrackSize): (WebCore::StyleBuilderConverter::convertGridPosition): (WebCore::StyleBuilderConverter::convertGridAutoFlow): (WebCore::StyleBuilderConverter::convertWordSpacing): (WebCore::StyleBuilderConverter::convertPerspective): (WebCore::StyleBuilderConverter::convertMarqueeIncrement): (WebCore::StyleBuilderConverter::convertFilterOperations): (WebCore::StyleBuilderConverter::convertFontFeatureSettings): (WebCore::StyleBuilderConverter::convertFontVariationSettings): (WebCore::StyleBuilderConverter::convertTouchCallout): (WebCore::StyleBuilderConverter::convertTapHighlightColor): (WebCore::StyleBuilderConverter::convertOverflowScrolling): (WebCore::StyleBuilderConverter::convertSVGLength): (WebCore::StyleBuilderConverter::convertSVGLengthVector): (WebCore::StyleBuilderConverter::convertStrokeDashArray): (WebCore::StyleBuilderConverter::convertPaintOrder): (WebCore::StyleBuilderConverter::convertOpacity): (WebCore::StyleBuilderConverter::convertSVGURIReference): (WebCore::StyleBuilderConverter::convertSVGColor): (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData): (WebCore::StyleBuilderConverter::convertContentAlignmentData): (WebCore::StyleBuilderConverter::convertGlyphOrientation): (WebCore::StyleBuilderConverter::convertGlyphOrientationOrAuto): (WebCore::StyleBuilderConverter::convertLineHeight): (WebCore::StyleBuilderConverter::convertFontSynthesis): (WebCore::StyleBuilderConverter::convertPageBreakBetween): (WebCore::StyleBuilderConverter::convertPageBreakInside): (WebCore::StyleBuilderConverter::convertColumnBreakBetween): (WebCore::StyleBuilderConverter::convertColumnBreakInside): (WebCore::StyleBuilderConverter::convertRegionBreakBetween): (WebCore::StyleBuilderConverter::convertRegionBreakInside): (WebCore::StyleBuilderConverter::convertHangingPunctuation): 2016-10-27 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add support for a reference box to -webkit-clip-path https://bugs.webkit.org/show_bug.cgi?id=164107 Reviewed by Simon Fraser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBasicShape): (WebCore::consumeBasicShapeOrBox): (WebCore::consumeWebkitClipPath): 2016-10-27 Yusuke Suzuki <utatane.tea@gmail.com> [DOM] Add JSEventType https://bugs.webkit.org/show_bug.cgi?id=164096 Reviewed by Darin Adler. Event is inherited by many Event classes. But, Event's accessors and interfaces are frequently called. For example, event.{type, target, srcElement} for accessors. And event.stopPropagation() and event.preventDefault() functions. However, since the user-visible event instance is typically the instance of the subclass, jsDynamicCast<JSEvent*>() walks several classes before it succeeds. It is costly. In this patch, we add a new WebCore JSType JSEventType for JSEvent and add a new function jsEventCast. That supports a super fast cast operation. And it paves the way for implementing DOM accessors of Event in DOMJIT. No behavior change. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMWrapper.h: * bindings/js/JSEventCustom.h: Added. (WebCore::jsEventCast): * bindings/scripts/CodeGeneratorJS.pm: (GetJSTypeForNode): (GenerateHeader): (GetCastingHelperForThisObject): * bindings/scripts/test/JS/JSTestEventConstructor.h: (WebCore::JSTestEventConstructor::createStructure): * dom/Event.idl: * domjit/DOMJITHelpers.h: (WebCore::DOMJIT::branchIfEvent): (WebCore::DOMJIT::branchIfNotEvent): 2016-10-27 Simon Fraser <simon.fraser@apple.com> Rename StyleRareNonInheritedData::opacity to m_opacity https://bugs.webkit.org/show_bug.cgi?id=164104 Reviewed by Dave Hyatt. Pure rename. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresLayerRepaint): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::opacity): (WebCore::RenderStyle::setOpacity): * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator==): * rendering/style/StyleRareNonInheritedData.h: (WebCore::StyleRareNonInheritedData::hasOpacity): 2016-10-27 Simon Fraser <simon.fraser@apple.com> If an animation's keyframes affect stacking context properties, create stacking context while the animation is running https://bugs.webkit.org/show_bug.cgi?id=164094 Reviewed by Dean Jackson. The CSS animations spec <https://drafts.csswg.org/css-animations-1/> now makes it clear that a keyframe animation animating properties which can affect stacking context should establish stacking context while it's running, or filling-forwards. This is part of the "the user agent must act as if the will-change property...includes all the properties animated by the animation" clause. Implement by having CompositeAnimation::animate() track whether running animations should create stacking context, replacing existing code in AnimationController::updateAnimations() which only looked at opacity and transform. Transitions are also checked to see if they need to trigger stacking context. This allows for the removal of a 0.9999 hack when blending opacity. Tests: animations/stacking-context-fill-forwards.html animations/stacking-context-not-fill-forwards.html animations/stacking-context-unchanged-while-running.html * page/animation/AnimationController.cpp: (WebCore::AnimationController::updateAnimations): * page/animation/CSSPropertyAnimation.cpp: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::animate): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::KeyframeAnimation): (WebCore::KeyframeAnimation::computeStackingContextImpact): (WebCore::KeyframeAnimation::animate): * page/animation/KeyframeAnimation.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::currentTransform): * rendering/style/WillChangeData.cpp: (WebCore::WillChangeData::propertyCreatesStackingContext): (WebCore::propertyCreatesStackingContext): Deleted. * rendering/style/WillChangeData.h: 2016-10-27 Sam Weinig <sam@webkit.org> [WebIDL] Move code generators off of domSignature::type and onto domSignature::idlType https://bugs.webkit.org/show_bug.cgi?id=164089 Reviewed by Alex Christensen. Make more IDLParser structures contain domTypes for type descriptions, rather than strings: - domInterface gains type and parentType. - domConstant gains type. - domEnum gains type. - domDictionary gains type and parentType. With these structs now containing domTypes, we can update the CodeGenerators to operate on domTypes exclusively, rather than types as strings. This allows us to consistently have access to information such as subtypes and nullability. * bindings/scripts/CodeGenerator.pm: Update helpers to operate of domTypes. The one exception is SkipIncludeHeader, which still operates on a type name, since it is called late in code generation on the textual form of type names in the include list. * bindings/scripts/CodeGeneratorJS.pm: Update to use domTypes. * bindings/scripts/IDLParser.pm: - Add domType accessors to domInterface, domConstant, domEnum, and domDictionary and populate them. - Remove type accessors from domSignature (domType is accessible from idlType). - Remove special cases for sequence and FrozenArray, now that they are always accessed as domTypes. * html/HTMLEmbedElement.idl: * html/HTMLFrameElement.idl: * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::getSVGDocument): * html/HTMLFrameOwnerElement.h: * html/HTMLIFrameElement.idl: * html/HTMLObjectElement.idl: Fix interfaces declaring getSVGDocument() to correctly have it return a Document, rather than an SVGDocument, which does exist anymore. To make the bindings happy, also change the signature of HTMLFrameOwnerElement::getSVGDocument to return a Document. * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results to remove some redundant headers (Already included JSFoo.h, so no need for Foo.h). 2016-10-27 Myles C. Maxfield <mmaxfield@apple.com> [macOS] [WebGL2] Temporarily upgrade WebGL 2's internal OpenGL context from version 2.1 to 3.2 https://bugs.webkit.org/show_bug.cgi?id=164091 Reviewed by Dean Jackson. In order to test WebGL2 correctly, I had to upgrade the macOS's OpenGL context to a 3.2-compatible context to make sure the new symbols are accepted. Eventually, this 3.2-compatible context will have to be reverted and replaced with an ANGLE context. The current 3.2-compatible context is just for testing. Test: fast/canvas/webgl/webgl2-context-creation.html * html/canvas/WebGLBuffer.cpp: Use "nullptr" instead of 0. (WebCore::WebGLBuffer::associateBufferData): * html/canvas/WebGLRenderingContextBase.cpp: Use make_unique() instead of the unique_ptr constructor. (WebCore::WebGLRenderingContextBase::create): * platform/graphics/GraphicsContext3D.h: GraphicsContext should know if it is using a 3.2-compatible context because some parts of 2.1 are removed in these contexts, and replaced with new things which aren't in 2.1. * platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::setPixelFormat): Use kCGLPFAOpenGLProfile to specify an OpenGL 3.2 context. (WebCore::GraphicsContext3D::GraphicsContext3D): GL_CLAMP is deprecated in OpenGL 3.2. Fortunately, GL_CLAMP_TO_EDGE isn't deprecated and does exactly what we want. In OpenGL3.2, point sprites are always enabled, so there's no need to enable them in those contexts. (WebCore::GraphicsContext3D::isGLES2Compliant): * platform/graphics/opengl/Extensions3DOpenGL.cpp: In OpenGL 3.2, glGetString() no longer accepts GL_EXTENSIONS. Instead, glGetStringi() is used instead. Unfortunately, glGetString() is not available in OpenGL 2.1 contexts, so we need to use one or the other based on the version of the context we're using. (WebCore::Extensions3DOpenGL::Extensions3DOpenGL): (WebCore::Extensions3DOpenGL::getExtensions): * platform/graphics/opengl/Extensions3DOpenGL.h: * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon): (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): Instead of modifying getExtensions() to use glGetStringi(), it makes better sense to modify this function because getExtensions() returns a string. Building up a string just to split it up again is silly, so modifying this function instead makes more sense. * platform/graphics/opengl/Extensions3DOpenGLCommon.h: * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::getIntegerv): GL_MAX_VARYING_FLOATS is removed in OpenGL 3.2 contexts. However, it is replaced by GL_MAX_VARYING_COMPONENTS, though this is deprecated but not removed. In the more recent OpenGL context versions, GL_MAX_VARYING_VECTORS is recommended instead, but that isn't available in OpenGL 3.2. (WebCore::GraphicsContext3D::getExtensions): 2016-10-27 Megan Gardner <megan_gardner@apple.com> Add support for wide gamut for ShareableBitmap for image popovers https://bugs.webkit.org/show_bug.cgi?id=164001 Reviewed by Simon Fraser. Add a function to return a CGColorSpaceRef for extended sRGB. This is currently untestable, so no tests added. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::extendedSRGBColorSpaceRef): 2016-10-25 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Create a RAII Helper Class for the Render Target https://bugs.webkit.org/show_bug.cgi?id=164005 Reviewed by Alex Christensen. Tested by existing SVG, image, and Canvas layout tests. * platform/graphics/GraphicsContext.h: * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill): Use new convenience helper class. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::didBeginDraw): (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): Add an assertion that we are in a valid state when cleaning up the graphics context. (WebCore::GraphicsContextPlatformPrivate::clip): Clipping can only happen in a Draw operation. Open a new BeginDraw if asked to Clip. The Begin must stay active when this method returns, as the Clip layer is only valid during a Draw operation. (WebCore::GraphicsContextPlatformPrivate::beginDraw): Added. (WebCore::GraphicsContextPlatformPrivate::endDraw): Added. (WebCore::GraphicsContext::beginDrawIfNeeded): Added. (WebCore::GraphicsContext::endDraw): Added. (WebCore::GraphicsContext::drawWithoutShadow): Revise to use new RenderTargetHelper class. (WebCore::GraphicsContext::drawWithShadow): Ditto. (WebCore::GraphicsContext::platformFillRoundedRect): Ditto. (WebCore::GraphicsContext::fillRectWithRoundedHole): Ditto. (WebCore::GraphicsContext::setDidBeginDraw): Deleted. * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: (WebCore::GraphicsContextPlatformPrivate::didBeginDraw): Revise to use count instead of a separate boolean. * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::getData): Revise to use new RenderTargetHelper class. * platform/graphics/win/NativeImageDirect2D.cpp: (WebCore::drawNativeImage): Ditto. * platform/graphics/win/RenderTargetHelper.h: Added. (WebCore::RenderTargetHelper::RenderTargetHelper): (WebCore::RenderTargetHelper::~RenderTargetHelper): (WebCore::RenderTargetHelper::endDraw): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): Revise to use new RenderTargetHelper class. 2016-10-27 Wenson Hsieh <wenson_hsieh@apple.com> Support "insertFromDrop" and "deleteByDrag" for the InputEvent spec https://bugs.webkit.org/show_bug.cgi?id=163948 <rdar://problem/28921433> Reviewed by Darin Adler. Implements support for "insertFromDrop" and "deleteByDrag" inputTypes. These are fired when dragging and dropping text in editable areas. To do this, we introduce EditActionInsertFromDrop and EditActionDeleteByDrag (renamed from EditActionDrag, which is no longer necessary after this patch). When moving text from an editable element to another, we will use a DeleteSelectionCommand to delete the text from the source element and a ReplaceSelectionCommand to insert the text into the destination element. This means that we currently fire two input events on the source and destination elements (i.e. given by the start and end selections) after both child editing commands of the MoveSelectionCommand have been applied. Instead, we need to fire events in this order: 1. beforeinput ("deleteByDrag") on the source 2. Update DOM 3. input ("deleteByDrag") on the source 4. beforeinput ("insertFromDrop") on the destination 5. Update DOM 6. input ("insertFromDrop") on the destination To accomplish this, we allow an edit command to defer dispatching input events to its child commands via CompositeEditCommand::shouldDispatchInputEvents, which the MoveSelectionCommand overrides. Additionally, when applying the MoveSelectionCommand, we now apply() the child DeleteSelectionCommand and ReplaceSelectionCommand instead of using doApply(). This allows these children to separately dispatch input events, and also handle preventDefault() separately. Tests: fast/events/before-input-events-prevent-drag-and-drop.html fast/events/input-events-drag-and-drop.html fast/events/input-events-insert-by-drop.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::apply): (WebCore::CompositeEditCommand::composition): Searches for the top-level command and returns its composition. Also ASSERTs that the m_command of all child commands along the way is null. In places where we used to ASSERT that command.composition() should be null, we now perform the assertion here instead. * editing/CompositeEditCommand.h: (WebCore::CompositeEditCommand::shouldDispatchInputEvents): This is true by default, which means that if apply() is called for a composite edit command that does not override this to return false, it will try to dispatch input events. In most cases, the parent command will call on the child command to doApply(), bypassing this check. (WebCore::CompositeEditCommand::composition): Deleted. * editing/EditAction.h: * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): (WebCore::EditCommand::isEditingTextAreaOrTextInput): (WebCore::EditCommand::setStartingSelection): (WebCore::EditCommand::setEndingSelection): (WebCore::EditCommand::setParent): * editing/Editor.cpp: (WebCore::Editor::willApplyEditing): (WebCore::Editor::appliedEditing): After applying editing, only adjust the current selection and notify clients of selection change if the applied command was a top-level command; otherwise, these actions should wait until all child commands of the top-level command have been applied. In particular, we should not register the applied command as an undo step. * editing/MoveSelectionCommand.cpp: (WebCore::MoveSelectionCommand::doApply): (WebCore::MoveSelectionCommand::editingAction): * editing/MoveSelectionCommand.h: * page/DragController.cpp: (WebCore::DragController::concludeEditDrag): For the cases where we're not deleting text from the drag source (i.e. we're just applying a ReplaceSelectionCommand) pass in EditActionInsertFromDrop as the EditAction when creating the command. 2016-10-27 Per Arne Vollan <pvollan@apple.com> [Win][Direct2D] Implement GraphicsContext::releaseWindowsContext. https://bugs.webkit.org/show_bug.cgi?id=163988 Reviewed by Brent Fulgham. This method is needed to draw native controls. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::releaseWindowsContext): 2016-10-27 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Worker should recover if Inspector is closed and never sent Worker.initialized command https://bugs.webkit.org/show_bug.cgi?id=164073 Reviewed by Brian Burg. Test: inspector/worker/worker-recover-if-inspector-close.html * workers/WorkerInspectorProxy.cpp: (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspectorController): Ensure we stop the debugger only task loop if needed when the last debugger message comes in. 2016-10-27 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Include ConsoleAgent in Workers - real console.log support https://bugs.webkit.org/show_bug.cgi?id=163844 <rdar://problem/28903328> Reviewed by Brian Burg. Test: inspector/worker/console-basic.html This introduces a real ConsoleAgent in the Worker InspectorController. We no longer need to pass partial ConsoleMessage objects to be logged through the Page, we can just send the full ConsoleMessages to a frontend once it connects to the Worker. In order to guarantee that the Worker InspectorController is properly all Workers will start paused if there is an Inspector attached to the Page. The frontend _must_ call the new Worker.initialized method after sending its setup commands to the Worker. This ensures we get handle all initialization commands (like Agent.enable(), and setting state like breakpoints) before any script executes in the Worker. This mirrors the Inspector.initialized method that does the same thing for JSContext auto-attach of the Main target. In the backend, the wait until initialized state is just running the WorkerThread's RunLoop in a special debugger mode to only process debugger commands until we are ready. This will effectively be the same as pausing so it is generalized into WorkerThread. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: New files. * inspector/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::initialized): (WebCore::InspectorWorkerAgent::shouldWaitForDebuggerOnStart): * inspector/InspectorWorkerAgent.h: Add the new initialized method. This just uses the proxy to send a message to be handled on the Worker Thread and unpause. * inspector/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): (WebCore::WorkerConsoleAgent::addInspectedNode): * inspector/WorkerConsoleAgent.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): Add a ConsoleAgent to WorkerInspectorController. * workers/WorkerInspectorProxy.h: * workers/WorkerInspectorProxy.cpp: (WebCore::WorkerInspectorProxy::workerStartMode): (WebCore::WorkerInspectorProxy::resumeWorkerIfPaused): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): Use the debugger mode when sending messages to the WorkerThread. * workers/Worker.cpp: (WebCore::Worker::notifyFinished): * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject): Deleted. * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::addConsoleMessage): (WebCore::WorkerGlobalScope::addMessage): * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: Remove legacy partial console support. * workers/WorkerRunLoop.h: * workers/WorkerRunLoop.cpp: (WebCore::WorkerRunLoop::debuggerMode): * workers/WorkerThread.h: * workers/WorkerThread.cpp: (WebCore::WorkerThread::workerThread): (WebCore::WorkerThread::startRunningDebuggerTasks): (WebCore::WorkerThread::stopRunningDebuggerTasks): General code for spinning the WorkerThread and only processing debugger (Inspector) commands. Use this when starting the thread to ensure the frontend initializes the Worker's Agents before any JavaScript executes. * page/PageConsoleClient.cpp: * workers/WorkerConsoleClient.cpp: (WebCore::WorkerConsoleClient::count): (WebCore::WorkerConsoleClient::time): (WebCore::WorkerConsoleClient::timeEnd): * inspector/InspectorConsoleInstrumentation.h: Removed. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::startConsoleTimingImpl): (WebCore::InspectorInstrumentation::stopConsoleTimingImpl): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStartImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): Implement a few more basic console APIs that required ConsoleAgent. 2016-10-27 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Include RuntimeAgent in Workers - evaluate in Worker context https://bugs.webkit.org/show_bug.cgi?id=163835 <rdar://problem/28901465> Reviewed by Brian Burg. Tests: inspector/unit-tests/target-manager.html inspector/worker/runtime-basic.html * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: New file. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): New agent context creation struct for Workers. * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): Create a RuntimeAgent for Workers. * inspector/WorkerRuntimeAgent.cpp: Added. (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::didCreateFrontendAndBackend): (WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/WorkerRuntimeAgent.h: Added. Workers currently only ever have a single execution context. 2016-10-27 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. 2016-10-27 Dave Hyatt <hyatt@apple.com> [CSS Parser] Implement CSS variables https://bugs.webkit.org/show_bug.cgi?id=164075 Reviewed by Dean Jackson. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: Add CSSCustomPropertyValue.cpp to the project. * css/CSSCustomPropertyValue.cpp: Added. (WebCore::CSSCustomPropertyValue::checkVariablesForCycles): (WebCore::CSSCustomPropertyValue::resolveVariableReferences): * css/CSSCustomPropertyValue.h: These functions abstract the old and new implementations of CSS variables so that the callers don't have to worry about it. * css/CSSValue.cpp: (WebCore::CSSValue::equals): Make sure CSSVariableReferenceValue and CSSPendingSubstitutionValue have equals implemented. (WebCore::CSSValue::isInvalidCustomPropertyValue): Deleted. This code was dead and never called. * css/CSSValue.h: (WebCore::CSSValue::isCustomPropertyValue): (WebCore::CSSValue::hasVariableReferences): Add a helper function for asking if a CSSValue has variable references. This abstracts the old and new implementations so that callers can ask if the value has variables without caring which implementation is being used. * css/CSSValueList.cpp: (WebCore::CSSValueList::checkVariablesForCycles): * css/CSSValueList.h: In order to abstract the old and new variables implementations, custom properties now store CSSCustomPropertyValue as their values instead of raw values. The old implementation needs to be patched to deal with this wrapper being present now. * css/CSSVariableData.cpp: (WebCore::CSSVariableData::checkVariablesForCycles): (WebCore::CSSVariableData::checkVariablesForCyclesWithRange): (WebCore::CSSVariableData::resolveVariableFallback): (WebCore::CSSVariableData::resolveVariableReference): (WebCore::CSSVariableData::resolveVariableReferences): (WebCore::CSSVariableData::resolveTokenRange): * css/CSSVariableData.h: Implementation of cycle checking and variable resolution. The logic of this implementation is the same as the old. It walks CSSParserTokens instead of the old CSSParser structures. * css/CSSVariableReferenceValue.cpp: (WebCore::CSSVariableReferenceValue::customCSSText): Add support for serialization caching, just like the old implementation had in CSSVariableDependentValue. (WebCore::CSSVariableReferenceValue::checkVariablesForCycles): * css/CSSVariableReferenceValue.h: Add cycle checking and variable resolution helper functions. * css/CSSVariableValue.cpp: (WebCore::CSSVariableValue::buildParserValueListSubstitutingVariables): Patched to account for the change in storage of custom properties to have custom property value wrappers. * css/StyleProperties.cpp: (WebCore::StyleProperties::getPropertyValue): (WebCore::StyleProperties::borderSpacingValue): (WebCore::StyleProperties::getLayeredShorthandValue): (WebCore::StyleProperties::getShorthandValue): (WebCore::StyleProperties::getCommonValue): (WebCore::StyleProperties::getPropertyCSSValue): (WebCore::StyleProperties::asText): Clean up the resolution of pending substitution values. Instead of hacking it into every possible StyleShorthandProperty crawling function, obtain the shorthand for the property up front, access the first longhand, and if we see a pending substitution value, perform the substitution. * css/StyleResolver.cpp: (WebCore::StyleResolver::MatchResult::addMatchedProperties): (WebCore::StyleResolver::applyProperty): (WebCore::StyleResolver::resolvedVariableValue): * css/StyleResolver.h: Add support for the new implementation in all the same places as the old. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseInlineStyleDeclaration): (WebCore::CSSParser::parseValueWithVariableReferences): (WebCore::CSSParser::parseVariableDependentValue): Deleted. * css/parser/CSSParser.h: Rename parseVariableDependentValue to parseValueWithVariableReferences, since it is operating on three distinct value types now. Turn on new parser support for parseInlineStyleDeclaration. * css/parser/CSSParserImpl.cpp: (WebCore::filterProperties): (WebCore::CSSParserImpl::parseVariableValue): Deleted. (WebCore::CSSParserImpl::parseCustomPropertySet): Deleted. * css/parser/CSSParserImpl.h: Remove parser functions that aren't relevant to our implementation of CSS variables. * css/parser/CSSVariableParser.cpp: (WebCore::classifyVariableRange): Add support for the CSS4 'revert' keyword to the new variable parser. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::checkVariablesInCustomProperties): Modified to store CSSCustomPropertyValues as the values always now and to use the method abstractions on CSSCustomPropertyValue to resolve cycles and perform substitutions. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setCustomPropertyValue): (WebCore::RenderStyle::getCustomPropertyValue): * rendering/style/StyleCustomPropertyData.h: (WebCore::StyleCustomPropertyData::operator==): (WebCore::StyleCustomPropertyData::setCustomPropertyValue): (WebCore::StyleCustomPropertyData::getCustomPropertyValue): Tighten up the map to store CSSCustomPropertyValue instead of just CSSValue. 2016-10-27 Zalan Bujtas <zalan@apple.com> RenderMultiColumnFlowThread::processPossibleSpannerDescendant should take RenderObject& instead of RenderObject* https://bugs.webkit.org/show_bug.cgi?id=164072 Reviewed by Simon Fraser. No change in functionality. * rendering/RenderFlowThread.h: * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::findSetRendering): (WebCore::isValidColumnSpanner): (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant): (WebCore::RenderMultiColumnFlowThread::flowThreadDescendantInserted): (WebCore::RenderMultiColumnFlowThread::findSetRendering): Deleted. * rendering/RenderMultiColumnFlowThread.h: * rendering/RenderMultiColumnSet.cpp: (WebCore::precedesRenderer): (WebCore::RenderMultiColumnSet::containsRendererInFlowThread): * rendering/RenderMultiColumnSet.h: * rendering/RenderMultiColumnSpannerPlaceholder.cpp: (WebCore::RenderMultiColumnSpannerPlaceholder::createAnonymous): (WebCore::RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder): * rendering/RenderMultiColumnSpannerPlaceholder.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::insertedIntoTree): 2016-10-27 Brent Fulgham <bfulgham@apple.com> Prevent hit tests from being performed on an invalid render tree https://bugs.webkit.org/show_bug.cgi?id=163877 <rdar://problem/28675761> Reviewed by Simon Fraser. Changeset r200971 added code to ensure that layout is up-to-date before hit testing, but did so only for the main frame. It was still possible to enter cross-frame hit testing with a subframe needing style recalc. In that situation, the subframe's updateLayout() would get called, which could trigger a compositing change that marked the parent frame as needing style recalc. A subsequent layout on the parent frame (for example by hit testing traversing into a second subframe) could then mutate the parent frame's layer tree while hit testing was traversing it. This patch modifies the hit test logic to ensure that a recursive layout is performed so that we always perform hit tests on a clean set of frames. It also adds some assertions to warn us if we encounter this invalid state. Tested by fast/layers/prevent-hit-test-during-layout.html. * dom/Document.cpp: (WebCore::Document::scheduleStyleRecalc): Assert that we are not hit testing during style recalculation. * page/EventHandler.cpp: (WebCore::EventHandler::hitTestResultAtPoint): Ensure that we have a clean render tree when hit testing. * page/FrameView.cpp: (WebCore::FrameView::setNeedsLayout): Assert that we are not in the process of hit testing when we schedule a layout. * rendering/RenderView.cpp: (WebCore::RenderView::hitTest): Mark RenderView as in an active hit test. * rendering/RenderView.h: 2016-10-27 Zan Dobersek <zdobersek@igalia.com> BufferSource should behave as an union https://bugs.webkit.org/show_bug.cgi?id=164056 Reviewed by Chris Dumez. WebIDL typedefs BufferSource as (ArrayBufferView or ArrayBuffer). To follow that definition, IDLBufferSource is now type-aliased to IDLUnion<IDLInterface<ArrayBufferView>, IDLInterface<ArrayBuffer>>. Converter<IDLBufferSource> template specialization can now be removed since the default specialization for IDLUnion will be used. C++ implementations still work through a BufferSource object. That class now has an implicit constructor that consumes the Variant object. The data() and length() methods on the class now iterate the variant to find an existing object that can provide a pointer to the data or the length of it. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::appendBuffer): * bindings/generic/IDLTypes.h: * bindings/js/BufferSource.h: (WebCore::BufferSource::BufferSource): (WebCore::BufferSource::data): (WebCore::BufferSource::length): * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLBufferSource>::convert): Deleted. 2016-10-27 Chris Dumez <cdumez@apple.com> Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations https://bugs.webkit.org/show_bug.cgi?id=164063 Reviewed by Sam Weinig. Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations now that we support having IDL string enumerations in their own IDL file. No new tests, no Web-exposed behavior change. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::collectMatchingRules): (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules): (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): * dom/CustomElementRegistry.cpp: (WebCore::enqueueUpgradeInShadowIncludingTreeOrder): * dom/Element.cpp: (WebCore::Element::bindingsOffsetParent): (WebCore::Element::addShadowRoot): (WebCore::Element::attachShadow): (WebCore::Element::shadowRootForBindings): (WebCore::Element::userAgentShadowRoot): (WebCore::Element::ensureUserAgentShadowRoot): * dom/Element.h: * dom/Element.idl: * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): * dom/Node.cpp: (WebCore::Node::isUnclosedNode): (WebCore::Node::assignedSlotForBindings): (WebCore::Node::isInUserAgentShadowTree): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::ShadowRoot): * dom/ShadowRoot.h: * dom/ShadowRoot.idl: * dom/ShadowRootMode.h: Added. * dom/ShadowRootMode.idl: Copied from Source/WebCore/dom/ShadowRoot.idl. * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::didChangeSlot): * html/HTMLSummaryElement.cpp: (WebCore::HTMLSummaryElement::create): * inspector/InspectorDOMAgent.cpp: (WebCore::shadowRootType): * rendering/HitTestResult.cpp: (WebCore::moveOutOfUserAgentShadowTree): * rendering/RenderElement.cpp: (WebCore::RenderElement::selectionPseudoStyle): * rendering/RenderLayer.cpp: (WebCore::rendererForScrollbar): * style/StyleScope.cpp: (WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver): (WebCore::Style::Scope::didChangeStyleSheetEnvironment): * svg/SVGElement.cpp: (WebCore::SVGElement::correspondingUseElement): * testing/Internals.cpp: (WebCore::Internals::shadowRootType): 2016-10-27 Chris Dumez <cdumez@apple.com> Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable https://bugs.webkit.org/show_bug.cgi?id=164062 Reviewed by Darin Adler. Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable: - https://html.spec.whatwg.org/#canvasuserinterface Firefox and Chrome agree with the specification. Test: fast/canvas/draw-focus-if-needed-null-element.html * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded): (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): * html/canvas/CanvasRenderingContext2D.h: * html/canvas/CanvasRenderingContext2D.idl: 2016-10-27 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT][CSSJIT] Share code with DOMJIT https://bugs.webkit.org/show_bug.cgi?id=164006 Reviewed by Mark Lam. Move CSSJIT's getDocument function to DOMJIT and share it with DOMJIT. And rename it to "loadDocument", it is closer name to the JSC's convention. No behavior change. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSpecialFailureInQuirksModeForActiveAndHoverIfNeeded): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsRoot): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsScopeRoot): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsTarget): (WebCore::SelectorCompiler::getDocument): Deleted. * domjit/DOMJITHelpers.h: (WebCore::DOMJIT::loadDocument): * domjit/JSNodeDOMJIT.cpp: (WebCore::NodeOwnerDocumentDOMJIT::callDOM): 2016-10-27 Youenn Fablet <youenn@apple.com> REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache() https://bugs.webkit.org/show_bug.cgi?id=163905 Reviewed by Antti Koivisto. Covered by existing tests and http/tests/security/cached-cross-origin-shared-css-stylesheet.html Small refactoring to do more member fields initialization in StyleSheetContents header. Refactored StyleSheetContents::m_isInMemoryCache to be a counter instead of a boolean. This allows StyleSheetContents to be linked to several CachedCSSStyleSheets. * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::StyleSheetContents): (WebCore::StyleSheetContents::addedToMemoryCache): (WebCore::StyleSheetContents::removedFromMemoryCache): * css/StyleSheetContents.h: * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Making reuse of saveParsedStyleSheet to handle update of StyleSheetContents cache count. 2016-10-27 Sergio Villar Senin <svillar@igalia.com> Unreviewed. Build fix for gcc. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable): 2016-10-27 Youenn Fablet <youenn@apple.com> MediaPayload does not need to be refcounted https://bugs.webkit.org/show_bug.cgi?id=164015 Reviewed by Eric Carlson. No change of behavior. Making MediaPayload a struct and no-longer ref-counted. Small performance improvements in MediaEndpointOwr. * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/SDPProcessor.cpp: (WebCore::configurationFromJSON): (WebCore::configurationToJSON): * platform/mediastream/MediaEndpoint.h: * platform/mediastream/MediaPayload.h: (WebCore::MediaPayload::addParameter): (WebCore::MediaPayload::create): Deleted. (WebCore::MediaPayload::~MediaPayload): Deleted. (WebCore::MediaPayload::type): Deleted. (WebCore::MediaPayload::setType): Deleted. (WebCore::MediaPayload::encodingName): Deleted. (WebCore::MediaPayload::setEncodingName): Deleted. (WebCore::MediaPayload::clockRate): Deleted. (WebCore::MediaPayload::setClockRate): Deleted. (WebCore::MediaPayload::channels): Deleted. (WebCore::MediaPayload::setChannels): Deleted. (WebCore::MediaPayload::ccmfir): Deleted. (WebCore::MediaPayload::setCcmfir): Deleted. (WebCore::MediaPayload::nackpli): Deleted. (WebCore::MediaPayload::setNackpli): Deleted. (WebCore::MediaPayload::nack): Deleted. (WebCore::MediaPayload::setNack): Deleted. (WebCore::MediaPayload::parameters): Deleted. (WebCore::MediaPayload::clone): Deleted. (WebCore::MediaPayload::MediaPayload): Deleted. * platform/mediastream/PeerMediaDescription.h: (WebCore::PeerMediaDescription::payloads): (WebCore::PeerMediaDescription::addPayload): (WebCore::PeerMediaDescription::setPayloads): (WebCore::PeerMediaDescription::clone): * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::getDefaultAudioPayloads): (WebCore::MediaEndpointOwr::getDefaultVideoPayloads): (WebCore::MediaEndpointOwr::filterPayloads): * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::getDefaultAudioPayloads): (WebCore::MockMediaEndpoint::getDefaultVideoPayloads): (WebCore::MockMediaEndpoint::filterPayloads): 2016-10-26 Dan Bernstein <mitz@apple.com> Improved the last build fix. Darin pointed out I could have kept the function inline and just removed the WEBCORE_EXPORT. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::document): Deleted. * Modules/mediastream/UserMediaRequest.h: (WebCore::UserMediaRequest::document): 2016-10-26 Chris Dumez <cdumez@apple.com> [Web IDL] Add support for having string enumerations in their own IDL file https://bugs.webkit.org/show_bug.cgi?id=164025 Reviewed by Darin Adler. Add support for having string enumerations in their own IDL file to facilitate sharing them. Use this new support to implement IDBTransactionMode enumeration for IndexedDB: - https://www.w3.org/TR/IndexedDB/#idl-def-IDBTransactionMode No new tests, rebaselined existing tests. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::transaction): (WebCore::IDBDatabase::startVersionChangeTransaction): * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBDatabase.idl: * Modules/indexeddb/IDBOpenDBRequest.cpp: (WebCore::IDBOpenDBRequest::onUpgradeNeeded): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::IDBTransaction): * Modules/indexeddb/IDBTransaction.h: (WebCore::IDBTransaction::mode): (WebCore::IDBTransaction::isVersionChange): (WebCore::IDBTransaction::isReadOnly): * Modules/indexeddb/IDBTransaction.idl: * Modules/indexeddb/IDBTransactionMode.h: Added. * Modules/indexeddb/IDBTransactionMode.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl. * Modules/indexeddb/IndexedDB.h: * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: (WebCore::IDBServer::MemoryBackingStoreTransaction::MemoryBackingStoreTransaction): (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed): (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed): (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): * Modules/indexeddb/server/MemoryBackingStoreTransaction.h: (WebCore::IDBServer::MemoryBackingStoreTransaction::isVersionChange): (WebCore::IDBServer::MemoryBackingStoreTransaction::isWriting): * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): * Modules/indexeddb/server/SQLiteIDBTransaction.cpp: (WebCore::IDBServer::SQLiteIDBTransaction::begin): * Modules/indexeddb/server/SQLiteIDBTransaction.h: (WebCore::IDBServer::SQLiteIDBTransaction::mode): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::enqueueTransaction): (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction): * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp: (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction): * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::originalDatabaseInfo): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isVersionChange): (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isReadOnly): * Modules/indexeddb/shared/IDBTransactionInfo.cpp: (WebCore::IDBTransactionInfo::clientTransaction): (WebCore::IDBTransactionInfo::versionChange): (WebCore::IDBTransactionInfo::loggingString): * Modules/indexeddb/shared/IDBTransactionInfo.h: (WebCore::IDBTransactionInfo::mode): * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGenerator.pm: (ProcessDocument): (IsEnumType): (GetEnumByName): (IsExternalEnumType): (ValidEnumValues): * bindings/scripts/CodeGeneratorJS.pm: (GenerateEnumeration): (AddToImplIncludesForIDLType): (GetEnumerationClassName): (GenerateEnumerationHeader): (GenerateEnumerationImplementation): (GenerateEnumerationImplementationContent): (GenerateEnumerationsImplementationContent): (GenerateEnumerationHeaderContent): (GenerateEnumerationsHeaderContent): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArgCaller): (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg): (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller): * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: Added. (WebCore::convertEnumerationToJS): (WebCore::parseEnumeration<TestStandaloneEnumeration>): (WebCore::convertEnumeration<TestStandaloneEnumeration>): (WebCore::expectedEnumerationValues<TestStandaloneEnumeration>): * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h: Added. * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestStandaloneEnumeration.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl. * inspector/InspectorIndexedDBAgent.cpp: 2016-10-26 Dan Bernstein <mitz@apple.com> Fixed the WebKit2 build. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::document): Moved the definition of this function to here from… * Modules/mediastream/UserMediaRequest.h: (WebCore::UserMediaRequest::document): …here, so that the WebKit2 build doesn’t encounter an exported inline function. 2016-10-26 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Implement Node::ownerDocument https://bugs.webkit.org/show_bug.cgi?id=164004 Reviewed by Darin Adler. Test: js/dom/domjit-accessor-owner-document.html Implement Node.ownerDocument DOMJIT accessor. According to the result of the profiler, jQuery's prop() function is frequently called in Ember.js SpeedoMeter. And this function calls jQuery.isXMLDoc(). And this isXMLDoc() function calls element.ownerDocument accessor. And our WebKit inspector also uses ownerDocument accessor frequently. Interesting thing is this ownerDocument functionality is used in CSSJIT, so CSSJIT has similar helper function to look up the owner document of the element. As a result, all the necessary functionality is already implemented, DOMJIT just utilizes it. For example, Node::treeScopeMemoryOffset() and TreeScope::documentScopeMemoryOffset() is implemented before this patch. In the future, we will convert CSSJIT's Assembler& to CCallHelpers& and share the code with DOMJIT[1]. [1]: https://bugs.webkit.org/show_bug.cgi?id=164006 * dom/Node.idl: * domjit/DOMJITAbstractHeapRepository.h: * domjit/JSNodeDOMJIT.cpp: (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): (WebCore::NodeOwnerDocumentDOMJIT::callDOM): 2016-10-26 Chris Dumez <cdumez@apple.com> Replace IDBKeyPath with a WTF::Variant https://bugs.webkit.org/show_bug.cgi?id=163909 Reviewed by Darin Adler. Replace IDBKeyPath class with the IDBKeyPathVariant type entirely and rename IDBKeyPathVariant to IDBKeyPath. Unfortunately, IDBKeyPath still needs some special handling when returned to the JavaScript because we do not have a toJS() accepting a WTF::Variant as input yet. There should be no significant behavior change except that IDBIndex.keyPath / IDBObjectStore.keyPath now returns an array of Strings instead of a DOMStringList object when the IDBKeyPath contains a vector. This is a progression and matches the specification: - https://www.w3.org/TR/IndexedDB/#widl-IDBIndex-keyPath - https://www.w3.org/TR/IndexedDB/#widl-IDBObjectStore-keyPath No new tests, rebaselined existing tests. * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::update): * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBGetResult.cpp: (WebCore::IDBGetResult::isolatedCopy): * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::isIDBKeyPathValid): (WebCore::IDBKeyPathIsolatedCopy): * Modules/indexeddb/IDBKeyPath.h: (WebCore::IDBKeyPathIsolatedCopy): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::keyPath): (WebCore::IDBObjectStore::putOrAdd): (WebCore::IDBObjectStore::createIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::serializeIDBKeyPath): (WebCore::deserializeIDBKeyPath): * Modules/indexeddb/server/IDBSerialization.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): * Modules/indexeddb/shared/IDBDatabaseInfo.cpp: (WebCore::IDBDatabaseInfo::createNewObjectStore): * Modules/indexeddb/shared/IDBDatabaseInfo.h: * Modules/indexeddb/shared/IDBIndexInfo.cpp: (WebCore::IDBIndexInfo::IDBIndexInfo): (WebCore::IDBIndexInfo::isolatedCopy): * Modules/indexeddb/shared/IDBIndexInfo.h: * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::IDBObjectStoreInfo): (WebCore::IDBObjectStoreInfo::createNewIndex): (WebCore::IDBObjectStoreInfo::isolatedCopy): * Modules/indexeddb/shared/IDBObjectStoreInfo.h: (WebCore::IDBObjectStoreInfo::keyPath): * bindings/js/IDBBindingUtilities.cpp: (WebCore::injectIDBKeyIntoScriptValue): (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath): (WebCore::canInjectIDBKeyIntoScriptValue): (WebCore::createKeyPathArray): (WebCore::toJS): * bindings/js/IDBBindingUtilities.h: * inspector/InspectorIndexedDBAgent.cpp: 2016-10-26 Zalan Bujtas <zalan@apple.com> Ignore out-of-flow siblings when searching for a spanner candidate. https://bugs.webkit.org/show_bug.cgi?id=164042. <rdar://problem/28758456> Reviewed by Simon Fraser. While searching for the spanner candidates in a flow thread, we have to take into account whether renderers are in- or out-of-flow. What it means is that while traversing the renderer tree to find the the candidate renderer (next sibling/ancestor's next child in pre-order traversal), we have to check if the candidate is in the same layout context too. Test: fast/multicol/crash-when-spanner-candidate-is-out-of-flow.html * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::spannerPlacehoderCandidate): (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant): 2016-10-26 Brian Burg <bburg@apple.com> Web Inspector: remove unused bool return value from FrontendChannel::sendMessageToFrontend https://bugs.webkit.org/show_bug.cgi?id=164046 Reviewed by Joseph Pecoraro. * inspector/InspectorClient.cpp: (WebCore::InspectorClient::doDispatchMessageOnFrontendPage): * inspector/InspectorClient.h: * testing/Internals.cpp: (WebCore::InspectorStubFrontend::sendMessageToFrontend): 2016-10-26 Chris Dumez <cdumez@apple.com> The URLSearchParams constructor should take a union in parameter https://bugs.webkit.org/show_bug.cgi?id=163906 Reviewed by Darin Adler. The URLSearchParams constructor should take a union in parameter: - https://url.spec.whatwg.org/#urlsearchparams No new tests, no web-exposed behavior change. * html/URLSearchParams.h: (WebCore::URLSearchParams::create): * html/URLSearchParams.idl: 2016-10-26 Sam Weinig <sam@webkit.org> [WebIDL] Move more string conversions over to JSDOMConvert https://bugs.webkit.org/show_bug.cgi?id=164021 Reviewed by Tim Horton. * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::putDelegate): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::open): (WebCore::JSDOMWindow::showModalDialog): (WebCore::handlePostMessage): * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::JSHTMLCanvasElement::toDataURL): * bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::pushState): (WebCore::JSHistory::replaceState): Switch to convert functions. * bindings/js/JSApplePaySessionCustom.cpp: (WebCore::JSApplePaySession::completeShippingMethodSelection): (WebCore::JSApplePaySession::completeShippingContactSelection): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesKeyGenParams): (WebCore::createRsaKeyGenParams): * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::getCSSCanvasContext): * bindings/js/JSMockContentFilterSettingsCustom.cpp: (WebCore::JSMockContentFilterSettings::setDecisionPoint): (WebCore::toDecision): * bindings/js/JSNodeFilterCustom.cpp: (WebCore::JSNodeFilter::acceptNode): * bindings/js/JSDOMBinding.cpp: (WebCore::toSmallerInt): (WebCore::toSmallerUInt): (WebCore::toInt8EnforceRange): (WebCore::toUInt8EnforceRange): (WebCore::toInt8Clamp): (WebCore::toUInt8Clamp): (WebCore::toInt8): (WebCore::toUInt8): (WebCore::toInt16EnforceRange): (WebCore::toUInt16EnforceRange): (WebCore::toInt16Clamp): (WebCore::toUInt16Clamp): (WebCore::toInt16): (WebCore::toUInt16): Use updated IntegerConversionConfiguration naming. (WebCore::valueToStringTreatingNullAsEmptyString): Deleted. (WebCore::valueToStringWithUndefinedOrNullCheck): Deleted. (WebCore::valueToUSVStringTreatingNullAsEmptyString): Deleted. (WebCore::valueToUSVStringWithUndefinedOrNullCheck): Deleted. * bindings/js/JSDOMBinding.h: Remove unused functions. * bindings/js/JSDOMConvert.h: (WebCore::convert): Add StringConversionConfiguration, to match IntegerConversionConfiguration which moved here, and make them both enum classes. Remove SFINAE based overloading of convert<>, which is not needed if we get rid of the default parameter, which we can, since the two parameter convert routes to the right place. (WebCore::Converter<IDLNullable<T>>::convert): Add overloads converts that take a Integer/String configuration. (WebCore::Converter<IDLByte>::convert): (WebCore::Converter<IDLOctet>::convert): (WebCore::Converter<IDLShort>::convert): (WebCore::Converter<IDLUnsignedShort>::convert): (WebCore::Converter<IDLLong>::convert): (WebCore::Converter<IDLUnsignedLong>::convert): (WebCore::Converter<IDLLongLong>::convert): (WebCore::Converter<IDLUnsignedLongLong>::convert): Use updated IntegerConversionConfiguration naming. (WebCore::Converter<IDLDOMString>::convert): (WebCore::Converter<IDLUSVString>::convert): Add a configuration parameter, similar to the one used for integers that changes the behavior of string conversions to return an empty string for null. * bindings/js/JSDOMIterator.h: (WebCore::iteratorCreate): (WebCore::IteratorTraits>::asJS): (WebCore::appendForEachArguments): Simplify a bit by extracting the SFINAE helpers into a EnableIfMap and EnableIfSet. * bindings/scripts/CodeGeneratorJS.pm: (GetIntegerConversionConfiguration): (GetStringConversionConfiguration): (JSValueToNativeIsHandledByDOMConvert): (JSValueToNative): Add support for converting more string types and passing the StringConversionConfiguration. 2016-10-26 Dan Bernstein <mitz@apple.com> When pasting web archive, width specifiers in srcset attribute change into density specifiers https://bugs.webkit.org/show_bug.cgi?id=164027 <rdar://problem/28964948> Reviewed by Tim Horton. Updated editing/pasteboard/img-srcset-copy-paste-canonicalization.html. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::completeURLsInAttributeValue): Use 'w' when writing out a width specifier. 2016-10-26 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: playback support https://bugs.webkit.org/show_bug.cgi?id=163678 <rdar://problem/27989479> Reviewed by Dean Jackson. We introduce the PlaybackSupport class which brings support for playing and pausing the media by clicking on the play/pause button in the media controls and correctly reflecting the media's playback state as the media is played or paused via the media API. * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/playback-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js. (PlaybackSupport.prototype.get control): (PlaybackSupport.prototype.get mediaEvents): (PlaybackSupport.prototype.buttonWasClicked): (PlaybackSupport.prototype.syncControl): (PlaybackSupport): * WebCore.xcodeproj/project.pbxproj: 2016-10-26 Chris Dumez <cdumez@apple.com> Regression(r203848): 百度糯米 app fails to load content due to a JavaScript error https://bugs.webkit.org/show_bug.cgi?id=163967 <rdar://problem/28707838> Reviewed by Ryosuke Niwa. Add quirk for 百度糯米 app making the 2 last parameters to Event.prototype.initEvent() optional. No new tests, change only impacts this specific application. * bindings/scripts/CodeGeneratorJS.pm: (GeneratePropertiesHashTable): * dom/Event.cpp: (WebCore::Event::initEventForBindings): * dom/Event.h: * dom/Event.idl: * platform/RuntimeApplicationChecks.h: * platform/RuntimeApplicationChecks.mm: (WebCore::IOSApplication::isBaiduNuomi): 2016-10-26 Chris Dumez <cdumez@apple.com> First parameter to TextTrack.addCue() / removeCue() should not be nullable https://bugs.webkit.org/show_bug.cgi?id=164020 Reviewed by Eric Carlson. First parameter to TextTrack.addCue() / removeCue() should not be nullable: - https://html.spec.whatwg.org/#texttrack Firefox and Chrome agree with the specification. Test: media/track/texttrack-addCue-null.html * html/track/InbandDataTextTrack.cpp: (WebCore::InbandDataTextTrack::removeDataCue): (WebCore::InbandDataTextTrack::removeCue): * html/track/InbandDataTextTrack.h: * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::addGenericCue): (WebCore::InbandGenericTextTrack::removeGenericCue): (WebCore::InbandGenericTextTrack::removeCue): * html/track/InbandGenericTextTrack.h: * html/track/TextTrack.cpp: (WebCore::TextTrack::addCue): (WebCore::TextTrack::removeCue): * html/track/TextTrack.h: * html/track/TextTrack.idl: 2016-10-26 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: elapsed and remaining time support https://bugs.webkit.org/show_bug.cgi?id=163679 <rdar://problem/28851675> Reviewed by Dean Jackson. We introduce the ElapsedTimeSupport and RemainingTimeSupport classes which bring support for displaying the elapsed and remaining time in the time control. Tests: media/modern-media-controls/elapsed-time-support/elapsed-time-support.html media/modern-media-controls/remaining-time-support/remaining-time-support.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/elapsed-time-support.js: Added. (ElapsedTimeSupport.prototype.get control): (ElapsedTimeSupport.prototype.get mediaEvents): (ElapsedTimeSupport.prototype.syncControl): (ElapsedTimeSupport): * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/remaining-time-support.js: Added. (RemainingTimeSupport.prototype.get control): (RemainingTimeSupport.prototype.get mediaEvents): (RemainingTimeSupport.prototype.syncControl): (RemainingTimeSupport): * WebCore.xcodeproj/project.pbxproj: 2016-10-26 Dave Hyatt <hyatt@apple.com> [CSS Parser] Unify CSSCustomPropertyValue and CSSCustomPropertyDeclaration https://bugs.webkit.org/show_bug.cgi?id=164019 Reviewed by Zalan Bujtas. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSCustomPropertyDeclaration.cpp: Removed. * css/CSSCustomPropertyDeclaration.h: Removed. Get rid of CSSCustomPropertyDeclaration. * css/CSSCustomPropertyValue.h: Add new constructors to handle the new variable data format (either a CSSValueId or a CSSVariableData object that holds parser tokens). * css/CSSValue.cpp: (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): * css/CSSValue.h: (WebCore::CSSValue::isCustomPropertyDeclaration): Deleted. Get rid of CSSCustomPropertyDeclaration cases. * css/CSSVariableData.h: Switch to CSSCustomPropertyValue. * css/StyleResolver.cpp: (WebCore::StyleResolver::applyProperty): We've renamed the old parser variable data to deprecatedValue to make it clear it's going to be removed eventually. * css/parser/CSSParserImpl.cpp: (WebCore::filterProperties): (WebCore::CSSParserImpl::consumeVariableValue): * css/parser/CSSVariableParser.cpp: (WebCore::CSSVariableParser::parseDeclarationValue): * css/parser/CSSVariableParser.h: Switch to CSSCustomPropertyValue. 2016-10-26 Youenn Fablet <youenn@apple.com> Enable SDPProcessor for Mac bots https://bugs.webkit.org/show_bug.cgi?id=163940 Reviewed by Eric Carlson. Covered by activated tests. Activating processing of SDPProcessor scripts for Mac bots. Moving platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp to platform/mediastream/SDPProcessorScriptResource.cpp. This file is not tied to openwebrtc and allows retrieving the SDPProcessor script resource file content. * DerivedSources.make: * PlatformGTK.cmake: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/SDPProcessorScriptResource.cpp: (WebCore::SDPProcessorScriptResource::scriptString): * platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp: Removed. 2016-10-26 Dave Hyatt <hyatt@apple.com> [CSS Parser] Get functional pseudos parsing https://bugs.webkit.org/show_bug.cgi?id=164018 Reviewed by Zalan Bujtas. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView): Remove the ( check so that we can parse strings that end in (. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): Put in a hack that adds a ( to the end of the string so that it will be found in the map. 2016-10-26 Zan Dobersek <zdobersek@igalia.com> Unreviewed. Fixing compiler warnings in PlaybackPipeline that are popping up in GTK+ builds. * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: (WebCore::PlaybackPipeline::addSourceBuffer): (WebCore::PlaybackPipeline::attachTrack): 2016-10-26 Youenn Fablet <youennf@gmail.com> IceCandidate does not need to be refcounted https://bugs.webkit.org/show_bug.cgi?id=163944 Reviewed by Eric Carlson. No change of behavior. Simplifying IceCandidate class into a simple structure, no longer refcounted. Updated call sites accordingly. Updated SDP parsing of candidates to return a Variant instead of having both a return and an out parameter. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::addIceCandidateTask): (WebCore::MediaEndpointPeerConnection::gotIceCandidate): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/SDPProcessor.cpp: (WebCore::createCandidateObject): (WebCore::createCandidate): (WebCore::iceCandidateFromJSON): (WebCore::configurationToJSON): (WebCore::SDPProcessor::parseCandidateLine): * Modules/mediastream/SDPProcessor.h: (WebCore::SDPProcessor::ParsingResult::parsingStatus): (WebCore::SDPProcessor::ParsingResult::candidate): * platform/mediastream/IceCandidate.h: * platform/mediastream/MediaEndpoint.cpp: * platform/mediastream/MediaEndpoint.h: * platform/mediastream/PeerMediaDescription.h: (WebCore::PeerMediaDescription::iceCandidates): (WebCore::PeerMediaDescription::addIceCandidate): (WebCore::PeerMediaDescription::clone): * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::updateSendConfiguration): (WebCore::MediaEndpointOwr::addRemoteCandidate): (WebCore::MediaEndpointOwr::dispatchNewIceCandidate): (WebCore::MediaEndpointOwr::internalAddRemoteCandidate): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::addRemoteCandidate): (WebCore::MockMediaEndpoint::dispatchFakeIceCandidates): * platform/mock/MockMediaEndpoint.h: 2016-10-26 Andreas Kling <akling@apple.com> Fix mach port leak in ResourceUsageThread. <https://webkit.org/b/164012> Reviewed by Antti Koivisto. The threads returned by task_threads() need to be deallocated. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::cpuUsage): 2016-10-26 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr> WebRTC: The RTCTrackEventInit dictionary needs required members https://bugs.webkit.org/show_bug.cgi?id=158536 Reviewed by Chris Dumez. Update RTCTrackEvent IDL as per specification. No additional test required, rebase existing tests. * Modules/mediastream/RTCTrackEvent.idl: 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][GTK+][MSE] Unreviewed debug build fix. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::resetPipeline): * platform/graphics/gstreamer/mse/AppendPipeline.h: 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [cmake][GStreamer][MSE][EME] Build MSE and EME code after refactoring https://bugs.webkit.org/show_bug.cgi?id=162928 Reviewed by Xabier Rodriguez-Calvar. Consolidate all the source file tree changes after refactoring. This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support). * platform/GStreamer.cmake: 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [MSE][GStreamer] Enable QUOTA_EXCEEDED_ERR support for GStreamer https://bugs.webkit.org/show_bug.cgi?id=162922 Reviewed by Xabier Rodriguez-Calvar. QUOTA_EXCEEDED_ERR should be reported by SourceBuffer when appropriate, at least on the GStreamer implementation. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::appendBufferInternal): 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [MSE] Expose additional MediaSource methods to MediaSourcePrivate https://bugs.webkit.org/show_bug.cgi?id=162920 Reviewed by Xabier Rodriguez-Calvar. The GStreamer MSE platform implementation needs to report duration changes and trigger monitorSourceBuffers() calls. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::durationChanged): * Modules/mediasource/MediaSource.h: * platform/graphics/MediaSourcePrivateClient.h: 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][EME] ClearKey decryption support https://bugs.webkit.org/show_bug.cgi?id=162918 Reviewed by Xabier Rodriguez-Calvar. This patch is authored by Philippe Normand <philn@igalia.com>. * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: Added. (webkit_media_clear_key_decrypt_class_init): (webkit_media_clear_key_decrypt_init): (webKitMediaClearKeyDecryptorFinalize): (webKitMediaClearKeyDecryptorRequestDecryptionKey): (webKitMediaClearKeyDecryptorHandleKeyResponse): (webKitMediaClearKeyDecryptorSetupCipher): (webKitMediaClearKeyDecryptorDecrypt): (webKitMediaClearKeyDecryptorReleaseCipher): * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h: Added. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][EME] Base class for decryption support https://bugs.webkit.org/show_bug.cgi?id=162915 Reviewed by Xabier Rodriguez-Calvar. Add common encryption base class. This patch is authored by Philippe Normand <philn@igalia.com>. * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: Added. (webkit_media_common_encryption_decrypt_class_init): (webkit_media_common_encryption_decrypt_init): (webKitMediaCommonEncryptionDecryptorFinalize): (webkitMediaCommonEncryptionDecryptTransformCaps): (webkitMediaCommonEncryptionDecryptTransformInPlace): (webkitMediaCommonEncryptionDecryptSinkEventHandler): (webKitMediaCommonEncryptionDecryptorChangeState): (webKitMediaCommonEncryptionDecryptDefaultSetupCipher): (webKitMediaCommonEncryptionDecryptDefaultReleaseCipher): * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: Added. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][EME] Utility function to create decryptor https://bugs.webkit.org/show_bug.cgi?id=162914 Reviewed by Xabier Rodriguez-Calvar. Add a utility function to find a suitable GStreamer decryptor element. This patch is authored by Philippe Normand <philn@igalia.com>. * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::createGstDecryptor): (WebCore::gstRegistryHasElementForMediaType): Deleted. * platform/graphics/gstreamer/GStreamerUtilities.h: 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE][EME] Remove MSE code from regular player and add EME support https://bugs.webkit.org/show_bug.cgi?id=162911 Now that the MSE responsibility has been refactored to the dedicated MediaPlayerPrivateGStreamerMSE subclass, the regular player no longer needs the MSE code, just to expose some more methods to the subclass. Float timestamps have been migrated to double. Also, small changes to accomodate the EME support are needed. This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support) and Žan Doberšek <zandobersek@gmail.com> (double timestamps). Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::busMessageCallback): (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine): (WebCore::initializeGStreamerAndRegisterWebKitElements): (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::load): (WebCore::MediaPlayerPrivateGStreamer::playbackPosition): (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime): (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime): (WebCore::MediaPlayerPrivateGStreamer::seek): (WebCore::MediaPlayerPrivateGStreamer::doSeek): (WebCore::MediaPlayerPrivateGStreamer::paused): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): (WebCore::MediaPlayerPrivateGStreamer::buffered): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection): (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): (WebCore::MediaPlayerPrivateGStreamer::maxTimeSeekable): (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded): (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress): (WebCore::MediaPlayerPrivateGStreamer::sourceChanged): (WebCore::MediaPlayerPrivateGStreamer::didEnd): (WebCore::MediaPlayerPrivateGStreamer::durationChanged): (WebCore::MediaPlayerPrivateGStreamer::supportsType): (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties): Deleted. (WebCore::MediaPlayerPrivateGStreamer::commitLoad): Deleted. (WebCore::MediaPlayerPrivateGStreamer::pause): Deleted. (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback): Deleted. (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback): Deleted. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideoCaps): Deleted. (WebCore::MediaPlayerPrivateGStreamer::setRate): Deleted. (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry): Deleted. (WebCore::MediaPlayerPrivateGStreamer::totalBytes): Deleted. (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): Deleted. (WebCore::MediaPlayerPrivateGStreamer::loadStateChanged): Deleted. (WebCore::MediaPlayerPrivateGStreamer::timeChanged): Deleted. (WebCore::mimeTypeSet): Deleted. (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: (WebCore::MediaPlayerPrivateGStreamer::configurePlaySink): (WebCore::MediaPlayerPrivateGStreamer::isMediaSource): (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Deleted. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][EME] Add EME support to base private player https://bugs.webkit.org/show_bug.cgi?id=162908 Reviewed by Xabier Rodriguez-Calvar. Add encryption key management support. This patch is authored by Philippe Normand <philn@igalia.com>. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::registerWebKitGStreamerElements): (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::needKey): (WebCore::MediaPlayerPrivateGStreamerBase::setCDMSession): (WebCore::MediaPlayerPrivateGStreamerBase::keyAdded): (WebCore::MediaPlayerPrivateGStreamerBase::createSession): (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey): (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem): (WebCore::MediaPlayerPrivateGStreamerBase::extendedSupportsType): (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Deleted. (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): Deleted. (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: (WebCore::MediaPlayerPrivateGStreamerBase::pipeline): 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] WebKitMediaSourceGStreamer refactoring https://bugs.webkit.org/show_bug.cgi?id=162902 Reviewed by Xabier Rodriguez-Calvar. Move WebKitMediaSourceGStreamer to the mse directory, split public and private header sections, manage stream data throttling and seek synchronization, audio/video/text stream counting, improve GStreamer duration query, stream initialization, remove MediaSourceClientGStreamer logic (factored out to its own class in another patch) and interaction with MediaPlayerPrivateGStreamerMSE, PlaybackPipeline and SourceBufferPrivateGStreamer. * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.cpp: Removed. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: Added. (disabledAppsrcNeedData): (disabledAppsrcEnoughData): (disabledAppsrcSeekData): (enabledAppsrcEnoughData): (enabledAppsrcSeekData): (getStreamByAppsrc): (webkit_media_src_init): (webKitMediaSrcFinalize): (webKitMediaSrcSetProperty): (webKitMediaSrcGetProperty): (webKitMediaSrcDoAsyncStart): (webKitMediaSrcDoAsyncDone): (webKitMediaSrcChangeState): (webKitMediaSrcGetSize): (webKitMediaSrcQueryWithParent): (webKitMediaSrcUpdatePresentationSize): (webKitMediaSrcLinkStreamToSrcPad): (webKitMediaSrcLinkParser): (webKitMediaSrcFreeStream): (webKitMediaSrcCheckAllTracksConfigured): (webKitMediaSrcUriGetType): (webKitMediaSrcGetProtocols): (webKitMediaSrcGetUri): (webKitMediaSrcSetUri): (webKitMediaSrcUriHandlerInit): (seekNeedsDataMainThread): (notifyReadyForMoreSamplesMainThread): (applicationMessageCallback): (webKitMediaSrcSetMediaPlayerPrivate): (webKitMediaSrcSetReadyForSamples): (webKitMediaSrcPrepareSeek): (WTF::adoptGRef): (WTF::refGPtr<WebKitMediaSrc>): (WTF::derefGPtr<WebKitMediaSrc>): * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h: Added. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] Playback pipeline https://bugs.webkit.org/show_bug.cgi?id=162901 Reviewed by Xabier Rodriguez-Calvar. Encapsulate the responsibility to interact with the GStreamer playback pipeline and the different streams managed by the WebKitMediaSrc element into a new PlaybackPipeline class. * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added. (getStreamByTrackId): (getStreamBySourceBufferPrivate): (pushSample): (WebCore::PlaybackPipeline::create): (WebCore::PlaybackPipeline::PlaybackPipeline): (WebCore::PlaybackPipeline::~PlaybackPipeline): (WebCore::PlaybackPipeline::setWebKitMediaSrc): (WebCore::PlaybackPipeline::webKitMediaSrc): (WebCore::PlaybackPipeline::addSourceBuffer): (WebCore::PlaybackPipeline::removeSourceBuffer): (WebCore::PlaybackPipeline::attachTrack): (WebCore::PlaybackPipeline::reattachTrack): (WebCore::PlaybackPipeline::notifyDurationChanged): (WebCore::PlaybackPipeline::markEndOfStream): (WebCore::PlaybackPipeline::flushAndEnqueueNonDisplayingSamples): (WebCore::PlaybackPipeline::enqueueSample): (WebCore::PlaybackPipeline::pipeline): * platform/graphics/gstreamer/mse/PlaybackPipeline.h: Added. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE][EME] MSE specialization of Media Player Private for GStreamer https://bugs.webkit.org/show_bug.cgi?id=162900 Reviewed by Xabier Rodriguez-Calvar. Refactor MSE-specific logic to its own GStreamer player. This new MSE player coordinates data appending, media playback and interaction with MediaSource by delegating to AppendPipeline (one instance per SourceBuffer), PlaybackPipeline and MediaSourceClientGStreamerMSE/MediaSourcePrivateClient respectively. This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support). * platform/graphics/MediaPlayer.cpp: (WebCore::buildMediaEnginesVector): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Added. (dumpReadyState): (WebCore::MediaPlayerPrivateGStreamerMSE::registerMediaEngine): (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): (WebCore::MediaPlayerPrivateGStreamerMSE::isAvailable): (WebCore::MediaPlayerPrivateGStreamerMSE::MediaPlayerPrivateGStreamerMSE): (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE): (WebCore::MediaPlayerPrivateGStreamerMSE::load): (WebCore::MediaPlayerPrivateGStreamerMSE::pause): (WebCore::MediaPlayerPrivateGStreamerMSE::durationMediaTime): (WebCore::MediaPlayerPrivateGStreamerMSE::seek): (WebCore::MediaPlayerPrivateGStreamerMSE::configurePlaySink): (WebCore::MediaPlayerPrivateGStreamerMSE::changePipelineState): (WebCore::MediaPlayerPrivateGStreamerMSE::notifySeekNeedsDataForTime): (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): (WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek): (WebCore::MediaPlayerPrivateGStreamerMSE::updatePlaybackRate): (WebCore::MediaPlayerPrivateGStreamerMSE::seeking): (WebCore::MediaPlayerPrivateGStreamerMSE::setReadyState): (WebCore::MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted): (WebCore::MediaPlayerPrivateGStreamerMSE::seekCompleted): (WebCore::MediaPlayerPrivateGStreamerMSE::setRate): (WebCore::MediaPlayerPrivateGStreamerMSE::buffered): (WebCore::MediaPlayerPrivateGStreamerMSE::sourceChanged): (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates): (WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone): (WebCore::MediaPlayerPrivateGStreamerMSE::isTimeBuffered): (WebCore::MediaPlayerPrivateGStreamerMSE::setMediaSourceClient): (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourceClient): (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): (WebCore::mimeTypeCache): (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes): (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey): (WebCore::MediaPlayerPrivateGStreamerMSE::markEndOfStream): (WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime): (WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: Added. (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourcePrivateClient): 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] MediaSourceGStreamer refactoring https://bugs.webkit.org/show_bug.cgi?id=162899 Reviewed by Žan Doberšek. Move MediaSourceGStreamer to the mse directory, manage SourceBufferPrivates and delegate WebKitMediaSrc operations to the MSE private player. * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp. (WebCore::MediaSourceGStreamer::open): (WebCore::MediaSourceGStreamer::MediaSourceGStreamer): (WebCore::MediaSourceGStreamer::~MediaSourceGStreamer): (WebCore::MediaSourceGStreamer::addSourceBuffer): (WebCore::MediaSourceGStreamer::removeSourceBuffer): (WebCore::MediaSourceGStreamer::durationChanged): (WebCore::MediaSourceGStreamer::markEndOfStream): (WebCore::MediaSourceGStreamer::unmarkEndOfStream): (WebCore::MediaSourceGStreamer::readyState): (WebCore::MediaSourceGStreamer::setReadyState): (WebCore::MediaSourceGStreamer::waitForSeekCompleted): (WebCore::MediaSourceGStreamer::seekCompleted): (WebCore::MediaSourceGStreamer::sourceBufferPrivateDidChangeActiveState): (WebCore::MediaSourceGStreamer::buffered): * platform/graphics/gstreamer/mse/MediaSourceGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.h. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] SourceBufferPrivateGStreamer refactoring https://bugs.webkit.org/show_bug.cgi?id=162898 Reviewed by Xabier Rodriguez-Calvar. Moved SourceBufferPrivateGStreamer to an mse directory and added unimplemented features (abort, enqueueing and sample flow control). * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp: Removed. * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: Added. (WebCore::SourceBufferPrivateGStreamer::create): (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer): (WebCore::SourceBufferPrivateGStreamer::~SourceBufferPrivateGStreamer): (WebCore::SourceBufferPrivateGStreamer::setClient): (WebCore::SourceBufferPrivateGStreamer::append): (WebCore::SourceBufferPrivateGStreamer::abort): (WebCore::SourceBufferPrivateGStreamer::resetParserState): (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource): (WebCore::SourceBufferPrivateGStreamer::readyState): (WebCore::SourceBufferPrivateGStreamer::setReadyState): (WebCore::SourceBufferPrivateGStreamer::flushAndEnqueueNonDisplayingSamples): (WebCore::SourceBufferPrivateGStreamer::enqueueSample): (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples): (WebCore::SourceBufferPrivateGStreamer::setReadyForMoreSamples): (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples): (WebCore::SourceBufferPrivateGStreamer::setActive): (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples): (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples): (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment): (WebCore::SourceBufferPrivateGStreamer::didReceiveSample): (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] MediaSourceClientGStreamerMSE https://bugs.webkit.org/show_bug.cgi?id=162896 Reviewed by Xabier Rodriguez-Calvar. This class encapsulates the MediaSource interaction responsibility for the GStreamer platform. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: Added. (WebCore::MediaSourceClientGStreamerMSE::create): (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE): (WebCore::MediaSourceClientGStreamerMSE::~MediaSourceClientGStreamerMSE): (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer): (WebCore::MediaSourceClientGStreamerMSE::duration): (WebCore::MediaSourceClientGStreamerMSE::durationChanged): (WebCore::MediaSourceClientGStreamerMSE::abort): (WebCore::MediaSourceClientGStreamerMSE::append): (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream): (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource): (WebCore::MediaSourceClientGStreamerMSE::flushAndEnqueueNonDisplayingSamples): (WebCore::MediaSourceClientGStreamerMSE::enqueueSample): (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc): (WebCore::MediaSourceClientGStreamerMSE::clearPlayerPrivate): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Added. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer] GStreamer Media Sample https://bugs.webkit.org/show_bug.cgi?id=162894 Reviewed by Xabier Rodriguez-Calvar. Implement the MediaSample interface for the GStreamer platform. * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp: Added. (WebCore::GStreamerMediaSample::GStreamerMediaSample): (WebCore::GStreamerMediaSample::create): (WebCore::GStreamerMediaSample::createFakeSample): (WebCore::GStreamerMediaSample::applyPtsOffset): (WebCore::GStreamerMediaSample::offsetTimestampsBy): (WebCore::GStreamerMediaSample::~GStreamerMediaSample): * platform/graphics/gstreamer/mse/GStreamerMediaSample.h: Added. (WebCore::GStreamerMediaSample::presentationTime): (WebCore::GStreamerMediaSample::decodeTime): (WebCore::GStreamerMediaSample::duration): (WebCore::GStreamerMediaSample::trackID): (WebCore::GStreamerMediaSample::setTrackID): (WebCore::GStreamerMediaSample::sizeInBytes): (WebCore::GStreamerMediaSample::sample): (WebCore::GStreamerMediaSample::presentationSize): (WebCore::GStreamerMediaSample::setTimestamps): (WebCore::GStreamerMediaSample::isDivisable): (WebCore::GStreamerMediaSample::divide): (WebCore::GStreamerMediaSample::flags): (WebCore::GStreamerMediaSample::platformSample): (WebCore::GStreamerMediaSample::dump): 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer] GStreamer Media Description https://bugs.webkit.org/show_bug.cgi?id=162893 Reviewed by Xabier Rodriguez-Calvar. Implement the MediaDescription interface for the GStreamer platform. * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp: Added. (WebCore::GStreamerMediaDescription::codec): (WebCore::GStreamerMediaDescription::isVideo): (WebCore::GStreamerMediaDescription::isAudio): (WebCore::GStreamerMediaDescription::isText): * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h: Added. (WebCore::GStreamerMediaDescription::create): (WebCore::GStreamerMediaDescription::~GStreamerMediaDescription): (WebCore::GStreamerMediaDescription::GStreamerMediaDescription): 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE][EME] Append Pipeline https://bugs.webkit.org/show_bug.cgi?id=162874 Reviewed by Žan Doberšek. This patch is co-authored with Xabier Rodriguez-Calvar <calvaris@igalia.com> (data starve and last sample detection, debug features) and Philippe Normand <philn@igalia.com> (EME support). * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added. (WebCore::dumpAppendState): (WebCore::appendPipelineElementMessageCallback): (WebCore::appendPipelineApplicationMessageCallback): (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::~AppendPipeline): (WebCore::AppendPipeline::clearPlayerPrivate): (WebCore::AppendPipeline::handleElementMessage): (WebCore::AppendPipeline::handleApplicationMessage): (WebCore::AppendPipeline::handleAppsrcNeedDataReceived): (WebCore::AppendPipeline::handleAppsrcAtLeastABufferLeft): (WebCore::AppendPipeline::id): (WebCore::AppendPipeline::setAppendState): (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): (WebCore::AppendPipeline::appsinkCapsChanged): (WebCore::AppendPipeline::checkEndOfAppend): (WebCore::AppendPipeline::appsinkNewSample): (WebCore::AppendPipeline::appsinkEOS): (WebCore::AppendPipeline::didReceiveInitializationSegment): (WebCore::AppendPipeline::trackId): (WebCore::AppendPipeline::resetPipeline): (WebCore::AppendPipeline::setAppsrcDataLeavingProbe): (WebCore::AppendPipeline::removeAppsrcDataLeavingProbe): (WebCore::AppendPipeline::abort): (WebCore::AppendPipeline::pushNewBuffer): (WebCore::AppendPipeline::reportAppsrcAtLeastABufferLeft): (WebCore::AppendPipeline::reportAppsrcNeedDataReceived): (WebCore::AppendPipeline::handleNewAppsinkSample): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread): (WebCore::appendPipelineAppsinkCapsChanged): (WebCore::appendPipelineAppsrcDataLeaving): (WebCore::appendPipelinePadProbeDebugInformation): (WebCore::appendPipelineAppsrcNeedData): (WebCore::appendPipelineDemuxerPadAdded): (WebCore::appendPipelineDemuxerPadRemoved): (WebCore::appendPipelineAppsinkNewSample): (WebCore::appendPipelineAppsinkEOS): * platform/graphics/gstreamer/mse/AppendPipeline.h: Added. (WebCore::AppendPipeline::appendState): (WebCore::AppendPipeline::mediaSourceClient): (WebCore::AppendPipeline::sourceBufferPrivate): (WebCore::AppendPipeline::bus): (WebCore::AppendPipeline::pipeline): (WebCore::AppendPipeline::appsrc): (WebCore::AppendPipeline::appsink): (WebCore::AppendPipeline::demuxerSrcPadCaps): (WebCore::AppendPipeline::appsinkCaps): (WebCore::AppendPipeline::track): (WebCore::AppendPipeline::streamType): 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer] Drain query support https://bugs.webkit.org/show_bug.cgi?id=162872 Reviewed by Žan Doberšek. Under some circumstances, GStreamer deadlocks completely during MSE seeks on OpenGL ES systems. This is because the video sink still holds samples. Proper DRAIN support fixes this issue and is also good for all the platforms, not only OpenGL ES. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::triggerDrain): (WebCore::MediaPlayerPrivateGStreamerBase::drainCallback): (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: (VideoRenderRequestScheduler::drain): (webkitVideoSinkQuery): (webkitVideoSinkEvent): (webkit_video_sink_class_init): (VideoRenderRequestScheduler::stop): Deleted. (webkitVideoSinkProposeAllocation): Deleted. 2016-10-26 Enrique Ocaña González <eocanha@igalia.com> [GStreamer] Track enhancements for MSE support https://bugs.webkit.org/show_bug.cgi?id=162869 Reviewed by Xabier Rodriguez-Calvar. Add 'id' field to Audio/VideoTrackPrivateGStreamer. Make TrackPrivateBaseGStreamer work anyway in cases where the demuxer isn't contained in a GstPlaybin. * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer): * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::tagsChanged): (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: 2016-10-26 Youenn Fablet <youenn@apple.com> Make CachedResourceLoader originsMatch check more efficient https://bugs.webkit.org/show_bug.cgi?id=163938 Reviewed by Darin Adler. No change of behavior. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): (WebCore::originsMatch): Moved to SecurityOrigin.cpp. * page/SecurityOrigin.cpp: (WebCore::areOriginsMatching): Helper routine to check whether origins are matching. (WebCore::originsMatch): Ensuring string comparison provides the same result as this function. * page/SecurityOrigin.h: (WebCore::SecurityOrigin::protocol): (WebCore::SecurityOrigin::host): (WebCore::SecurityOrigin::domain): 2016-10-25 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Tell IDL result type to DFG to drop type checks in AI https://bugs.webkit.org/show_bug.cgi?id=163900 Reviewed by Sam Weinig. Add TestDOMJIT.idl for bindings generation tests. * bindings/scripts/CodeGeneratorJS.pm: (GetResultTypeFilter): (GenerateImplementation): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: Added. (WebCore::JSTestDOMJITPrototype::create): (WebCore::JSTestDOMJITPrototype::createStructure): (WebCore::JSTestDOMJITPrototype::JSTestDOMJITPrototype): (WebCore::JSTestDOMJITConstructor::prototypeForStructure): (WebCore::JSTestDOMJITConstructor::initializeProperties): (WebCore::JSTestDOMJITPrototype::finishCreation): (WebCore::JSTestDOMJIT::JSTestDOMJIT): (WebCore::JSTestDOMJIT::createPrototype): (WebCore::JSTestDOMJIT::prototype): (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute): (WebCore::jsTestDOMJITAnyAttr): (WebCore::jsTestDOMJITAnyAttrGetter): (WebCore::TestDOMJITAnyAttrDOMJIT::TestDOMJITAnyAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITAnyAttr): (WebCore::jsTestDOMJITBooleanAttr): (WebCore::jsTestDOMJITBooleanAttrGetter): (WebCore::TestDOMJITBooleanAttrDOMJIT::TestDOMJITBooleanAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITBooleanAttr): (WebCore::jsTestDOMJITByteAttr): (WebCore::jsTestDOMJITByteAttrGetter): (WebCore::TestDOMJITByteAttrDOMJIT::TestDOMJITByteAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITByteAttr): (WebCore::jsTestDOMJITOctetAttr): (WebCore::jsTestDOMJITOctetAttrGetter): (WebCore::TestDOMJITOctetAttrDOMJIT::TestDOMJITOctetAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITOctetAttr): (WebCore::jsTestDOMJITShortAttr): (WebCore::jsTestDOMJITShortAttrGetter): (WebCore::TestDOMJITShortAttrDOMJIT::TestDOMJITShortAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITShortAttr): (WebCore::jsTestDOMJITUnsignedShortAttr): (WebCore::jsTestDOMJITUnsignedShortAttrGetter): (WebCore::TestDOMJITUnsignedShortAttrDOMJIT::TestDOMJITUnsignedShortAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnsignedShortAttr): (WebCore::jsTestDOMJITLongAttr): (WebCore::jsTestDOMJITLongAttrGetter): (WebCore::TestDOMJITLongAttrDOMJIT::TestDOMJITLongAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITLongAttr): (WebCore::jsTestDOMJITUnsignedLongAttr): (WebCore::jsTestDOMJITUnsignedLongAttrGetter): (WebCore::TestDOMJITUnsignedLongAttrDOMJIT::TestDOMJITUnsignedLongAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongAttr): (WebCore::jsTestDOMJITLongLongAttr): (WebCore::jsTestDOMJITLongLongAttrGetter): (WebCore::TestDOMJITLongLongAttrDOMJIT::TestDOMJITLongLongAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITLongLongAttr): (WebCore::jsTestDOMJITUnsignedLongLongAttr): (WebCore::jsTestDOMJITUnsignedLongLongAttrGetter): (WebCore::TestDOMJITUnsignedLongLongAttrDOMJIT::TestDOMJITUnsignedLongLongAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongLongAttr): (WebCore::jsTestDOMJITFloatAttr): (WebCore::jsTestDOMJITFloatAttrGetter): (WebCore::TestDOMJITFloatAttrDOMJIT::TestDOMJITFloatAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITFloatAttr): (WebCore::jsTestDOMJITUnrestrictedFloatAttr): (WebCore::jsTestDOMJITUnrestrictedFloatAttrGetter): (WebCore::TestDOMJITUnrestrictedFloatAttrDOMJIT::TestDOMJITUnrestrictedFloatAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedFloatAttr): (WebCore::jsTestDOMJITDoubleAttr): (WebCore::jsTestDOMJITDoubleAttrGetter): (WebCore::TestDOMJITDoubleAttrDOMJIT::TestDOMJITDoubleAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITDoubleAttr): (WebCore::jsTestDOMJITUnrestrictedDoubleAttr): (WebCore::jsTestDOMJITUnrestrictedDoubleAttrGetter): (WebCore::TestDOMJITUnrestrictedDoubleAttrDOMJIT::TestDOMJITUnrestrictedDoubleAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedDoubleAttr): (WebCore::jsTestDOMJITDomStringAttr): (WebCore::jsTestDOMJITDomStringAttrGetter): (WebCore::TestDOMJITDomStringAttrDOMJIT::TestDOMJITDomStringAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITDomStringAttr): (WebCore::jsTestDOMJITByteStringAttr): (WebCore::jsTestDOMJITByteStringAttrGetter): (WebCore::TestDOMJITByteStringAttrDOMJIT::TestDOMJITByteStringAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITByteStringAttr): (WebCore::jsTestDOMJITUsvStringAttr): (WebCore::jsTestDOMJITUsvStringAttrGetter): (WebCore::TestDOMJITUsvStringAttrDOMJIT::TestDOMJITUsvStringAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUsvStringAttr): (WebCore::jsTestDOMJITNodeAttr): (WebCore::jsTestDOMJITNodeAttrGetter): (WebCore::TestDOMJITNodeAttrDOMJIT::TestDOMJITNodeAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITNodeAttr): (WebCore::jsTestDOMJITBooleanNullableAttr): (WebCore::jsTestDOMJITBooleanNullableAttrGetter): (WebCore::TestDOMJITBooleanNullableAttrDOMJIT::TestDOMJITBooleanNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITBooleanNullableAttr): (WebCore::jsTestDOMJITByteNullableAttr): (WebCore::jsTestDOMJITByteNullableAttrGetter): (WebCore::TestDOMJITByteNullableAttrDOMJIT::TestDOMJITByteNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITByteNullableAttr): (WebCore::jsTestDOMJITOctetNullableAttr): (WebCore::jsTestDOMJITOctetNullableAttrGetter): (WebCore::TestDOMJITOctetNullableAttrDOMJIT::TestDOMJITOctetNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITOctetNullableAttr): (WebCore::jsTestDOMJITShortNullableAttr): (WebCore::jsTestDOMJITShortNullableAttrGetter): (WebCore::TestDOMJITShortNullableAttrDOMJIT::TestDOMJITShortNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITShortNullableAttr): (WebCore::jsTestDOMJITUnsignedShortNullableAttr): (WebCore::jsTestDOMJITUnsignedShortNullableAttrGetter): (WebCore::TestDOMJITUnsignedShortNullableAttrDOMJIT::TestDOMJITUnsignedShortNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnsignedShortNullableAttr): (WebCore::jsTestDOMJITLongNullableAttr): (WebCore::jsTestDOMJITLongNullableAttrGetter): (WebCore::TestDOMJITLongNullableAttrDOMJIT::TestDOMJITLongNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITLongNullableAttr): (WebCore::jsTestDOMJITUnsignedLongNullableAttr): (WebCore::jsTestDOMJITUnsignedLongNullableAttrGetter): (WebCore::TestDOMJITUnsignedLongNullableAttrDOMJIT::TestDOMJITUnsignedLongNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongNullableAttr): (WebCore::jsTestDOMJITLongLongNullableAttr): (WebCore::jsTestDOMJITLongLongNullableAttrGetter): (WebCore::TestDOMJITLongLongNullableAttrDOMJIT::TestDOMJITLongLongNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITLongLongNullableAttr): (WebCore::jsTestDOMJITUnsignedLongLongNullableAttr): (WebCore::jsTestDOMJITUnsignedLongLongNullableAttrGetter): (WebCore::TestDOMJITUnsignedLongLongNullableAttrDOMJIT::TestDOMJITUnsignedLongLongNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongLongNullableAttr): (WebCore::jsTestDOMJITFloatNullableAttr): (WebCore::jsTestDOMJITFloatNullableAttrGetter): (WebCore::TestDOMJITFloatNullableAttrDOMJIT::TestDOMJITFloatNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITFloatNullableAttr): (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttr): (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttrGetter): (WebCore::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedFloatNullableAttr): (WebCore::jsTestDOMJITDoubleNullableAttr): (WebCore::jsTestDOMJITDoubleNullableAttrGetter): (WebCore::TestDOMJITDoubleNullableAttrDOMJIT::TestDOMJITDoubleNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITDoubleNullableAttr): (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttr): (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttrGetter): (WebCore::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedDoubleNullableAttr): (WebCore::jsTestDOMJITDomStringNullableAttr): (WebCore::jsTestDOMJITDomStringNullableAttrGetter): (WebCore::TestDOMJITDomStringNullableAttrDOMJIT::TestDOMJITDomStringNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITDomStringNullableAttr): (WebCore::jsTestDOMJITByteStringNullableAttr): (WebCore::jsTestDOMJITByteStringNullableAttrGetter): (WebCore::TestDOMJITByteStringNullableAttrDOMJIT::TestDOMJITByteStringNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITByteStringNullableAttr): (WebCore::jsTestDOMJITUsvStringNullableAttr): (WebCore::jsTestDOMJITUsvStringNullableAttrGetter): (WebCore::TestDOMJITUsvStringNullableAttrDOMJIT::TestDOMJITUsvStringNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITUsvStringNullableAttr): (WebCore::jsTestDOMJITNodeNullableAttr): (WebCore::jsTestDOMJITNodeNullableAttrGetter): (WebCore::TestDOMJITNodeNullableAttrDOMJIT::TestDOMJITNodeNullableAttrDOMJIT): (WebCore::domJITGetterSetterForTestDOMJITNodeNullableAttr): (WebCore::jsTestDOMJITConstructor): (WebCore::setJSTestDOMJITConstructor): (WebCore::JSTestDOMJIT::getConstructor): (WebCore::JSTestDOMJIT::visitChildren): * bindings/scripts/test/JS/JSTestDOMJIT.h: Added. (WebCore::JSTestDOMJIT::create): (WebCore::JSTestDOMJIT::createStructure): (WebCore::JSTestDOMJIT::wrapped): (WebCore::JSTestDOMJIT::finishCreation): * bindings/scripts/test/TestDOMJIT.idl: Added. 2016-10-25 Brent Fulgham <bfulgham@apple.com> [Win] Unreviewed build fix. * platform/graphics/GraphicsContext.h: Add missing declaration. 2016-10-25 Ryosuke Niwa <rniwa@webkit.org> Updating attribute by textContent must create a single mutation record and custom element reaction https://bugs.webkit.org/show_bug.cgi?id=164003 Reviewed by Chris Dumez. The bug was caused by setTextContent not invoking setNodeValue for Attr nodes. Use setNodeValue to match the specification: https://dom.spec.whatwg.org/#dom-node-textcontent Test: fast/dom/MutationObserver/text-content-on-attr.html * dom/Node.cpp: (WebCore::Node::setTextContent): 2016-10-25 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Use smart pointers for Direct2D Path types https://bugs.webkit.org/show_bug.cgi?id=163994 Reviewed by Alex Christensen. Tested by existing path tests. * platform/graphics/Path.h: (WebCore::Path::platformPath): Use a COMPtr for m_path. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::systemFactory): Present better D2D debug output when running a debug build. (WebCore::GraphicsContext::platformInit): Initialize a D2D device from a native GDI device context. (WebCore::GraphicsContext::platformStrokeStyle): Added. (WebCore::GraphicsContext::clipBounds): Simplify clip boundary calculations and avoid doing math on infinities. * platform/graphics/win/PathDirect2D.cpp: (WebCore::scratchRenderTarget): Added. (WebCore::Path::~Path): Switch to COMPtr implementation. (WebCore::Path::ensurePlatformPath): Ditto. (WebCore::Path::appendGeometry): Ditto. (WebCore::Path::operator=): Ditto. (WebCore::Path::initializePathState): Ditto. (WebCore::Path::strokeContains): Provide an implementation. (WebCore::Path::transform): Ditto. (WebCore::Path::addEllipse): No need for explicit construction of the D2D1::Point2F object. (WebCore::Path::clear): Switch to COMPtr implementation. 2016-10-25 Nan Wang <n_wang@apple.com> LayoutTest accessibility/mac/meter-gauge-value-description.html failing https://bugs.webkit.org/show_bug.cgi?id=163997 <rdar://problem/28948637> Reviewed by Chris Fleizach. I hand-edited the Localizable.strings file in a previous patch and my changes were replaced by running update-webkit-localizable-strings script. Changed the key to be the same as the value to keep consistency with other entries. Re-enabled the failing test. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::AXMeterGaugeRegionOptimumText): (WebCore::AXMeterGaugeRegionSuboptimalText): (WebCore::AXMeterGaugeRegionLessGoodText): 2016-10-25 Filip Pizlo <fpizlo@apple.com> HeapTimer should not hardcode all of its subclasses and USE(CF) shouldn't be a bizarre special case https://bugs.webkit.org/show_bug.cgi?id=163947 Reviewed by Geoffrey Garen. No new tests because no new behavior. * platform/ios/WebSafeGCActivityCallbackIOS.h: * platform/ios/WebSafeIncrementalSweeperIOS.h: 2016-10-25 Dave Hyatt <hyatt@apple.com> [CSS Parser] Improvements to selector parsing https://bugs.webkit.org/show_bug.cgi?id=163964 Reviewed by Zalan Bujtas. * css/CSSSelector.cpp: (WebCore::CSSSelector::setAttribute): (WebCore::CSSSelector::setNth): * css/CSSSelector.h: (WebCore::CSSSelector::setAttributeValueMatchingIsCaseInsensitive): * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::StyleSheetContents): (WebCore::StyleSheetContents::parserAppendRule): (WebCore::StyleSheetContents::ruleAt): (WebCore::StyleSheetContents::ruleCount): (WebCore::StyleSheetContents::clearRules): (WebCore::StyleSheetContents::wrapperInsertRule): (WebCore::StyleSheetContents::wrapperDeleteRule): * css/StyleSheetContents.h: * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::CSSParser::parseSelector): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::setAttribute): (WebCore::CSSParserSelector::setArgument): (WebCore::CSSParserSelector::setNth): * css/parser/CSSSelectorParser.cpp: (WebCore::consumeLangArgumentList): (WebCore::CSSSelectorParser::consumeCompoundSelector): (WebCore::CSSSelectorParser::consumeAttribute): (WebCore::isPseudoClassFunction): (WebCore::isPseudoElementFunction): (WebCore::CSSSelectorParser::consumePseudo): (WebCore::CSSSelectorParser::consumeCombinator): 2016-10-25 Beth Dakin <bdakin@apple.com> Numbered list should be represented without ‘…’ https://bugs.webkit.org/show_bug.cgi?id=163992 -and corresponding- rdar://problem/28911337 Reviewed by Darin Adler. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::insertListTypeNumbered): 2016-10-25 Daniel Bates <dabates@apple.com> REGRESSION (r178265): XSS Auditor fails to block document.write() of incomplete tag https://bugs.webkit.org/show_bug.cgi?id=163978 <rdar://problem/25962131> Reviewed by Darin Adler. During the tokenization process of an HTML tag the start and end positions of each of its attributes is tracked so that the XSS Auditor can request a snippet around a suspected injected attribute. We need to take care to consider document.write() boundaries when tracking the start and end positions of each HTML tag and attribute so that the XSS Auditor receives the correct snippet. Following r178265 we no longer consider document.write() boundaries when tracking the start and end positions of attributes. So, the substring represented by the start and end positions of an attribute may correspond to some other attribute in the tag. Therefore the XSS Auditor may fail to block an injection because the snippet it requested may not be the snippet that it intended to request. Tests: http/tests/security/xssAuditor/dom-write-location-dom-write-open-img-onerror.html http/tests/security/xssAuditor/dom-write-location-open-img-onerror.html http/tests/security/xssAuditor/nested-dom-write-location-open-img-onerror.html * html/parser/HTMLSourceTracker.cpp: (WebCore::HTMLSourceTracker::startToken): Set the attribute base offset to be the token start position. (WebCore::HTMLSourceTracker::source): Use the specified attribute start position as-is. We no longer adjust it here because it was adjusted with respect to the attribute base offset, which takes into account document.write() boundaries. * html/parser/HTMLToken.h: (WebCore::HTMLToken::setAttributeBaseOffset): Added. (WebCore::HTMLToken::beginAttribute): Subtract attribute base offset from the specified offset. (WebCore::HTMLToken::endAttribute): Ditto. * html/parser/HTMLTokenizer.h: (WebCore::HTMLTokenizer::setTokenAttributeBaseOffset): Added. 2016-10-25 Chris Dumez <cdumez@apple.com> IDBDatabase.transaction() should take a union in parameter https://bugs.webkit.org/show_bug.cgi?id=163966 Reviewed by Sam Weinig. IDBDatabase.transaction() should take a union in parameter: - https://www.w3.org/TR/IndexedDB/#widl-IDBDatabase-transaction-IDBTransaction-DOMString-sequence-DOMString--storeNames-IDBTransactionMode-mode No new tests, no expected Web-exposed behavior change. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::transaction): * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBDatabase.idl: 2016-10-25 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support IDBObjectStore openKeyCursor. <rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954 Reviewed by Andy Estes. No new tests (Covered by changes to existing tests) * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::create): * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::openCursor): (WebCore::IDBObjectStore::openKeyCursor): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBObjectStore.idl: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::requestOpenCursor): * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp: (WebCore::IDBServer::MemoryObjectStoreCursor::currentData): Only grab the current value if the cursor is KeyAndValue. * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor): (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Only save off the data for an object store cursor if it's both KeyAndValue. * Modules/indexeddb/server/SQLiteIDBCursor.h: * Modules/indexeddb/shared/IDBCursorInfo.cpp: (WebCore::IDBCursorInfo::objectStoreCursor): Allow for a KeyOnly ObjectStoreCursor. * Modules/indexeddb/shared/IDBCursorInfo.h: 2016-10-25 Wenson Hsieh <wenson_hsieh@apple.com> Support InputEvent.dataTransfer for the InputEvent spec https://bugs.webkit.org/show_bug.cgi?id=163213 <rdar://problem/28700407> Reviewed by Ryosuke Niwa. Adds support for the dataTransfer attribute of InputEvent, which contains both HTML and plain text representations of inserted content corresponding to input types "insertFromPaste", "insertFromDrop" and "insertReplacementText". The specification calls for the data transfer's drag data item list to contain this information via two entries with type strings "text/html" and "text/plain". However, WebKit does not yet support the DataTransfer.items -- in lieu of this, we will provide this information for now via getData("text/plain") and getData("text/html"), respectively. To support this attribute, we need a special type of DataTransfer which is readonly and returns canned data given a type string. To implement this, we introduce StaticPasteboard, a type of Pasteboard which is initialized with a map of type string to data. When asked for its data via getData, the StaticPasteboard searches its map for the requested type and returns the result, if any. An editing command may now create a new DataTransfer via DataTransfer::createForInputEvent from HTML and plaintext strings, and then vend this information to its dispatched input events by overriding CompositeEditCommand::inputEventDataTransfer. Some further work will be needed to ensure that all information exposed via this DataTransfer does not contain hidden content. To do this, we should create a new Document, "paste" the contents of our copied HTML string into it, then simulate selecting the content and generating markup from the selection to create a sanitized DocumentFragment corresponding to the original copied HTML. This will be addressed in a future patch. Tests: fast/events/input-events-paste-rich-datatransfer.html fast/events/input-events-spell-checking-datatransfer.html * PlatformEfl.cmake: * PlatformGTK.cmake: * PlatformWin.cmake: Add StaticPasteboard.cpp. * WebCore.xcodeproj/project.pbxproj: * dom/DataTransfer.cpp: (WebCore::DataTransfer::DataTransfer): (WebCore::DataTransfer::createForInputEvent): Initializes a new DataTransfer for the purposes of input events. This takes a HTML and plain text representations of the data being inserted and creates a new readonly DataTransfer backed by a StaticPasteboard that only knows how to map the "text/plain" data type to the given plaintext string and "text/html" to the given HTML text. * dom/DataTransfer.h: * dom/InputEvent.cpp: (WebCore::InputEvent::create): (WebCore::InputEvent::InputEvent): (WebCore::InputEvent::dataTransfer): * dom/InputEvent.h: * dom/InputEvent.idl: Add the InputEvent.dataTransfer attribute. * dom/Node.cpp: * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::inputEventDataTransfer): Add a new hook for CompositeEditCommands to vend a DataTransfer for the purposes of input events. By default, this is null. * editing/CompositeEditCommand.h: * editing/Editor.cpp: (WebCore::dispatchBeforeInputEvent): (WebCore::dispatchInputEvent): (WebCore::dispatchBeforeInputEvents): (WebCore::dispatchInputEvents): (WebCore::Editor::willApplyEditing): (WebCore::Editor::appliedEditing): * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::willApplyCommand): (WebCore::ReplaceRangeWithTextCommand::doApply): (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer): * editing/ReplaceRangeWithTextCommand.h: * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::willApplyCommand): Initialize the ReplacementFragment here before applying the command, adjusting the DocumentFragment to be inserted in the process. (WebCore::ReplaceSelectionCommand::doApply): (WebCore::ReplaceSelectionCommand::inputEventDataTransfer): (WebCore::ReplaceSelectionCommand::ensureReplacementFragment): Returns the ReplacementFragment used to apply the command, initializing it if necessary and stripping extraneous nodes off of the document fragment in the process. Since ReplaceSelectionCommand may be used as a top-level editing command or a child of another CompositeEditCommand such as the ReplaceRangeWithTextCommand, the ReplacementFragment may be initialized either in willApplyCommand or in doApply. * editing/ReplaceSelectionCommand.h: * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::willApplyCommand): (WebCore::SpellingCorrectionCommand::doApply): (WebCore::SpellingCorrectionCommand::inputEventDataTransfer): * editing/SpellingCorrectionCommand.h: Using the replacement text fragment, create and return a DataTransfer for input events. * platform/Pasteboard.h: * platform/StaticPasteboard.cpp: Added. (WebCore::StaticPasteboard::create): (WebCore::StaticPasteboard::StaticPasteboard): (WebCore::StaticPasteboard::hasData): (WebCore::StaticPasteboard::types): (WebCore::StaticPasteboard::readString): * platform/StaticPasteboard.h: Copied from Source/WebCore/dom/InputEvent.cpp. * platform/efl/PasteboardEfl.cpp: (WebCore::Pasteboard::writeMarkup): (WebCore::Pasteboard::write): (WebCore::Pasteboard::read): * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::writeMarkup): * platform/ios/PasteboardIOS.mm: (WebCore::Pasteboard::writeMarkup): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::writeMarkup): * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::write): (WebCore::Pasteboard::read): To account for virtual methods on Pasteboard, add implementations for methods that were previously defined but unimplemented on these platforms. 2016-10-25 Andy Estes <aestes@apple.com> Implement rel=noopener https://bugs.webkit.org/show_bug.cgi?id=155166 <rdar://problem/25193787> Reviewed by Brent Fulgham. Added support for rel=noopener to a and area elements. Tests: fast/dom/Window/a-rel-noopener.html fast/dom/Window/area-rel-noopener.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::HTMLAnchorElement): Stopped initializing m_linkRelations to 0. (WebCore::HTMLAnchorElement::parseAttribute): Declared static AtomicStrings for "noreferrer" and "noopener", and created a SpaceSplitString from the rel attribute value to test for these two values. (WebCore::HTMLAnchorElement::hasRel): Updated to use OptionSet::contains(). (WebCore::HTMLAnchorElement::relList): Added a check for "noopener". (WebCore::HTMLAnchorElement::handleClick): Passed NewFrameOpenerPolicy::Suppress to FrameLoader::urlSelected() if rel=noopener was specified. * html/HTMLAnchorElement.h: Changed the Relation enum to an enum class, removed unused enum values, and changed m_linkRelations from a 30-bit unsigned integer to an OptionSet<Relation> (HTMLAnchorElement is still 128 bytes on 64-bit). * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): Changed to only compute a NewFrameOpenerPolicy from the referrer policy if an explicit NewFrameOpenerPolicy isn't specified. Removed the version of urlSelected() that did not take a downloadAttribute parameter. * loader/FrameLoader.h: Added an Optional<NewFrameOpenerPolicy> parameter to urlSelected(), and set a default argument for downloadAttribute instead of having a second version of urlSelected(). 2016-10-25 Eric Carlson <eric.carlson@apple.com> [MediaStream] Add "has capture device" bit to media state flags https://bugs.webkit.org/show_bug.cgi?id=163952 Reviewed by Jer Noble. No new tests, updated fast/mediastream/MediaStream-page-muted.html, media/muted-video-is-playing-audio.html, and webaudio/web-audio-is-playing.html. * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::mediaState): Set HasMediaCaptureDevice, only set HasActiveMediaCaptureDevice when actually producing data. * page/MediaProducer.h: Add HasMediaCaptureDevice bit. * testing/Internals.cpp: (WebCore::Internals::pageMediaState): Return a string representing MediaStateFlags. (WebCore::Internals::isPagePlayingAudio): Deleted. * testing/Internals.h: * testing/Internals.idl: 2016-10-25 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r207827 and r207828. https://bugs.webkit.org/show_bug.cgi?id=163965 Caused LayoutTest webaudio/web-audio-is-playing.html to time out on macOS. (Requested by ryanhaddad on #webkit). Reverted changesets: "[MediaStream] Add "has capture device" bit to media state flags" https://bugs.webkit.org/show_bug.cgi?id=163952 http://trac.webkit.org/changeset/207827 "[MediaStream] Add "has capture device" bit to media state flags" https://bugs.webkit.org/show_bug.cgi?id=163952 http://trac.webkit.org/changeset/207828 2016-10-25 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: skip back support https://bugs.webkit.org/show_bug.cgi?id=163725 <rdar://problem/27989480> Reviewed by Dean Jackson. We introduce the SkipBackSupport class which brings support for skipping back 30 seconds into the media by clicking on the skip back button in the media controls. Test: http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/skip-back-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js. (SkipBackSupport.prototype.get control): (SkipBackSupport.prototype.buttonWasClicked): (SkipBackSupport): * WebCore.xcodeproj/project.pbxproj: 2016-10-25 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r207578. https://bugs.webkit.org/show_bug.cgi?id=163962 Broke quip.com so that user can no longer type a space (Requested by rniwa on #webkit). Reverted changeset: "Add a plain space instead of between text nodes" https://bugs.webkit.org/show_bug.cgi?id=123163 http://trac.webkit.org/changeset/207578 2016-10-25 Chris Dumez <cdumez@apple.com> LOG_WITH_STREAM() macro should not have a semi colon at the end https://bugs.webkit.org/show_bug.cgi?id=163951 Reviewed by Simon Fraser. * platform/LogMacros.h: 2016-10-25 Chris Dumez <cdumez@apple.com> IDBObjectStore.createIndex() should take a union in parameter https://bugs.webkit.org/show_bug.cgi?id=163935 Reviewed by Darin Adler. IDBObjectStore.createIndex() should take a union in parameter: - https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStore No new tests, no expected Web-exposed behavior change. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::createObjectStore): * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::isIDBKeyPathValid): (WebCore::IDBKeyPath::isValid): Deleted. * Modules/indexeddb/IDBKeyPath.h: (WebCore::IDBKeyPath::isNull): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBObjectStore.idl: 2016-10-24 Sam Weinig <sam@webkit.org> [WebIDL] Move more types over to the new JSConverter based toJS functions https://bugs.webkit.org/show_bug.cgi?id=163920 Reviewed by Darin Adler. - Adds WebIDL-extension type IDLDate, and use it for Date conversions. - Move JSDOMIterator over to using IDLType based conversions. Make them more explicit by adding a traits template argument which describes the iterator. - Add correct parsing for WebIDL iterable, parsing the parameter types into domTypes. - Support non-Optional nullable types via trait-like functions on IDLTypes. * bindings/generic/IDLTypes.h: (WebCore::IDLType::isNullValue): (WebCore::IDLType::extractValueFromNullable): (WebCore::IDLString::isNullValue): (WebCore::IDLString::extractValueFromNullable): (WebCore::IDLInterface::isNullValue): (WebCore::IDLInterface::extractValueFromNullable): (WebCore::IDLDate::isNullValue): (WebCore::IDLDate::extractValueFromNullable): Add isNullValue and extractValueFromNullable functions to allow non-Optional based nullable types. * Modules/plugins/QuickTimePluginReplacement.mm: (WebCore::QuickTimePluginReplacement::installReplacement): * bindings/js/IDBBindingUtilities.cpp: (WebCore::toJS): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::stylePropertyGetter): * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::invokeAttributeChangedCallback): Switch to IDLType based toJS. * bindings/js/JSDOMBinding.cpp: (WebCore::jsStringOrNull): Deleted. (WebCore::jsDateOrNull): Deleted. * bindings/js/JSDOMBinding.h: (WebCore::jsPair): Deleted. (WebCore::toJSNullableString): Deleted. Remove now unusued toJS functions. * bindings/js/JSDOMConvert.h: (WebCore::JSConverter<IDLNullable<T>>::convert): Use new functions to detect and extract nullable values. (WebCore::Converter<IDLBufferSource>::convert): Moved to be with the other converters. (WebCore::Converter<IDLDate>::convert): (WebCore::JSConverter<IDLDate>::convert): Added. * bindings/js/JSDOMIterator.h: (WebCore::jsPair): (WebCore::iteratorCreate): (WebCore::IteratorTraits>::asJS): (WebCore::appendForEachArguments): (WebCore::iteratorForEach): (WebCore::IteratorTraits>::destroy): (WebCore::IteratorTraits>::next): (WebCore::IteratorTraits>::finishCreation): (WebCore::IteratorInspector::decltype): Deleted. (WebCore::IteratorInspector::test): Deleted. (WebCore::JSDOMIterator<JSWrapper>::asJS): Deleted. (WebCore::JSDOMIterator<JSWrapper>::destroy): Deleted. (WebCore::JSDOMIterator<JSWrapper>::next): Deleted. (WebCore::JSDOMIteratorPrototype<JSWrapper>::next): Deleted. (WebCore::JSDOMIteratorPrototype<JSWrapper>::finishCreation): Deleted. Switch to new Traits based model, and have the generated code pass in the type (map or set) and key/value types. With the explicit types known, we can use the new toJS functions. Also, moved the jsPair functions here from JSDOMBinding.h, since this was the only place it was used. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementationIterableFunctions): Add iterator trait definition and update for new parameters to JSDOMIterator and JSDOMIteratorPrototype. (GetBaseIDLType): Add IDLDate, and move IDLBufferSource up to the simple path. (JSValueToNativeIsHandledByDOMConvert): Allow Date. (JSValueToNative): Remove special case for Date. (NativeToJSValueIsHandledByDOMConvert): Allow Date and remove restriction of nullable string-like types. (NativeToJSValueDOMConvertNeedsState): Add Date to list of types needing state. (NativeToJSValue): Remove special cases for Date and nullable-strings. * bindings/scripts/IDLParser.pm: (parseOptionalIterableInterface): Add correct parsing of iterable. * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: Update test results. 2016-10-25 Eric Carlson <eric.carlson@apple.com> [MediaStream] Add "has capture device" bit to media state flags https://bugs.webkit.org/show_bug.cgi?id=163952 Reviewed by Jer Noble. No new tests, updated fast/mediastream/MediaStream-page-muted.html and media/muted-video-is-playing-audio.html. * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::mediaState): Set HasMediaCaptureDevice, only set HasActiveMediaCaptureDevice when actually producing data. * page/MediaProducer.h: Add HasMediaCaptureDevice bit. * testing/Internals.cpp: (WebCore::Internals::pageMediaState): Return a string representing MediaStateFlags. (WebCore::Internals::isPagePlayingAudio): Deleted. * testing/Internals.h: * testing/Internals.idl: 2016-10-25 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support new IDBTransaction interfaces. <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927 Reviewed by Sam Weinig. Tests: storage/indexeddb/modern/idbtransaction-objectstores-1-private.html storage/indexeddb/modern/idbtransaction-objectstores-1.html At least partially passing results on 5 previously failed W3C tests. The "new IDBTransaction interfaces" really just means adding the property IDBTransaction.objectStoreNames. * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStoreNames): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/IDBTransaction.idl: 2016-10-25 Youenn Fablet <youenn@apple.com> MediaEndpointConfiguration does not need to be refcounted https://bugs.webkit.org/show_bug.cgi?id=163888 Reviewed by Eric Carlson. No change of behavior. Updating MediaEndpoint to take a MediaEndpointConfiguration&& instead of a RefPtr<MediaEndpointConfiguration>&&. This allows ensuring that the configuration is not null and removes the need to ref-count it. Removing ref-counting from MediaEndpointConfiguration and its related IceServer that is now a struct. Updated MediaEndpointOwr and mock implementations accordingly. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setConfiguration): * platform/mediastream/MediaEndpoint.cpp: * platform/mediastream/MediaEndpoint.h: * platform/mediastream/MediaEndpointConfiguration.cpp: (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration): * platform/mediastream/MediaEndpointConfiguration.h: (WebCore::MediaEndpointConfiguration::iceServers): * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: (WebCore::MediaEndpointOwr::setConfiguration): (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: * platform/mock/MockMediaEndpoint.cpp: * platform/mock/MockMediaEndpoint.h: 2016-10-25 Youenn Fablet <youenn@apple.com> CachedResourceLoader should set headers of the HTTP request prior checking for the cache https://bugs.webkit.org/show_bug.cgi?id=163103 Reviewed by Darin Adler. No expected change of behavior. Moved referrer, user-agent, and origin headers setting to CachedResourceRequest/CachedResourceLoader before checking the cache. This allows simplifying vary header checks and is more inline with the fetch specification. To compute the referrer value, we need to know whether the request is cross-origin. A helper function isRequestCrossOrigin is added for that purpose and is also used in CachedResource to set its initial response tainting. We should disable setting user-agent and origin headers by FrameLoader for subresources since this is now done in CachedResourceLoader. This could be done as a follow-up patch. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::load): (WebCore::CachedResource::varyHeaderValuesMatch): (WebCore::addAdditionalRequestHeadersToRequest): Deleted. (WebCore::CachedResource::addAdditionalRequestHeaders): Deleted. * loader/cache/CachedResource.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::updateHTTPRequestHeaders): (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::determineRevalidationPolicy): * loader/cache/CachedResourceLoader.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateForAccessControl): (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders): (WebCore::isRequestCrossOrigin): * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::setOrigin): 2016-10-25 Andreas Kling <akling@apple.com> More PassRefPtr purging in WebCore. <https://webkit.org/b/163895> Reviewed by Antti Koivisto. Remove PassRefPtr usage in RenderStyle, RenderTheme and Scrollbar, then fix up all the fallout. * css/CSSComputedStyleDeclaration.cpp: (WebCore::contentToCSSValue): (WebCore::shapePropertyValue): (WebCore::ComputedStyleExtractor::propertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertQuotes): * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::usesMenuList): (WebCore::HTMLSelectElement::platformHandleKeydownEvent): (WebCore::HTMLSelectElement::menuListDefaultEventHandler): * html/InputType.cpp: (WebCore::InputType::themeSupportsDataListUI): * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::shouldHaveSpinButton): (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator): * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::loadPlugin): * page/FrameView.cpp: (WebCore::FrameView::createScrollbar): * page/FrameView.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::RefCountedPropertyWrapper::RefCountedPropertyWrapper): (WebCore::PropertyWrapperClipPath::PropertyWrapperClipPath): (WebCore::PropertyWrapperShape::PropertyWrapperShape): (WebCore::StyleImagePropertyWrapper::StyleImagePropertyWrapper): (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper): (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper): * platform/PopupMenuClient.h: * platform/ScrollView.cpp: (WebCore::ScrollView::createScrollbar): * platform/ScrollView.h: * platform/Scrollbar.cpp: (WebCore::Scrollbar::createNativeScrollbar): * platform/Scrollbar.h: * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::buildReferenceFilter): * rendering/FilterEffectRenderer.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): (WebCore::RenderLayer::createLocalTransformState): (WebCore::RenderLayer::hitTestLayerByApplyingTransform): * rendering/RenderLayer.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::createScrollbar): * rendering/RenderListBox.h: * rendering/RenderMenuList.cpp: (RenderMenuList::createScrollbar): * rendering/RenderMenuList.h: * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::createCustomScrollbar): * rendering/RenderScrollbar.h: * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::createScrollbar): * rendering/RenderSearchField.h: * rendering/RenderTheme.h: (WebCore::RenderTheme::defaultTheme): * rendering/RenderThemeEfl.cpp: (WebCore::RenderThemeEfl::create): (WebCore::RenderTheme::themeForPage): * rendering/RenderThemeEfl.h: * rendering/RenderThemeGtk.cpp: (WebCore::RenderTheme::themeForPage): * rendering/RenderThemeIOS.mm: (WebCore::RenderTheme::themeForPage): * rendering/RenderThemeMac.mm: (WebCore::RenderTheme::themeForPage): * rendering/RenderThemeWin.cpp: (WebCore::RenderTheme::themeForPage): * rendering/RenderWidget.cpp: (WebCore::RenderWidget::setWidget): * rendering/RenderWidget.h: * rendering/style/CursorData.h: (WebCore::CursorData::CursorData): (WebCore::CursorData::setImage): * rendering/style/FillLayer.h: (WebCore::FillLayer::setImage): * rendering/style/QuotesData.cpp: (WebCore::QuotesData::create): * rendering/style/QuotesData.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::addCursor): (WebCore::RenderStyle::setCursorList): (WebCore::RenderStyle::setQuotes): (WebCore::RenderStyle::setWillChange): (WebCore::RenderStyle::setContent): (WebCore::RenderStyle::setListStyleImage): (WebCore::RenderStyle::setBorderImageSource): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setMaskImage): (WebCore::RenderStyle::setMaskBoxImageSource): (WebCore::RenderStyle::setBoxReflect): (WebCore::RenderStyle::setShapeOutside): (WebCore::RenderStyle::setClipPath): * rendering/style/StyleCachedImage.cpp: (WebCore::StyleCachedImage::cssValue): * rendering/style/StyleCachedImage.h: * rendering/style/StyleGeneratedImage.cpp: (WebCore::StyleGeneratedImage::cssValue): * rendering/style/StyleGeneratedImage.h: * rendering/style/StyleImage.h: * rendering/style/StyleMultiColData.h: * rendering/style/StyleRareInheritedData.h: 2016-10-24 Ryosuke Niwa <rniwa@webkit.org> Custom elements reactions should have a queue per element https://bugs.webkit.org/show_bug.cgi?id=163878 Reviewed by Antti Koivisto. This patch splits the custom elements reaction queue into per element to match the latest HTML specifications: https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction-queue and introduces the backup element queue: https://html.spec.whatwg.org/multipage/scripting.html#backup-element-queue In terms of code changes, CustomElementReactionStack now holds onto ElementQueue, an ordered list of elements, and make each ElementRareData keep its own CustomElementReactionQueue. CustomElementReactionQueue is created for each custom element when it is synchronously constructed or enqueued to upgrade. Because each reaction queue is now specific to each element, CustomElementReactionQueue instead of CustomElementReactionQueueItem stores JSCustomElementInterface. The backup element queue is created as a singleton returned by CustomElementReactionStack's backupElementQueue, and ensureBackupQueue() schedules a new mirotask to process the backup queue when there isn't already one. ensureCurrentQueue() now returns a reference to CustomElementReactionQueue instead of a pointer since it can fallback to the backup queue when the stack is empty as specified: https://html.spec.whatwg.org/multipage/scripting.html#enqueue-an-element-on-the-appropriate-element-queue Note that ensureCurrentQueue() may insert the same element multiple times into the element queue for now since avoiding this duplication would require either doing O(n) iteration on m_elements or adding a HashSet. We can revisit this in the future if the reaction queue is found to grow beyond a few entries since elements in the element queue will have duplicates only when each reaction queue has more than one item. Tests: fast/custom-elements/backup-element-queue.html fast/custom-elements/custom-element-reaction-queue.html * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::upgradeElement): * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionQueueItem::CustomElementReactionQueueItem): (WebCore::CustomElementReactionQueueItem::invoke): Removed the check for isFailedCustomElement since the queue is explicitly cleared in Element::setIsFailedCustomElement. (WebCore::CustomElementReactionQueue::CustomElementReactionQueue): Now takes JSCustomElementInterface since each item in the queue no longer stores Element or JSCustomElementInterface. (WebCore::CustomElementReactionQueue::clear): (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): (WebCore::CustomElementReactionQueue::invokeAll): (WebCore::CustomElementReactionStack::ElementQueue::add): Added. (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): Added. (WebCore::CustomElementReactionStack::ensureCurrentQueue): (WebCore::BackupElementQueueMicrotask): Added. (WebCore::CustomElementReactionStack::ensureBackupQueue): Added. (WebCore::CustomElementReactionStack::processBackupQueue): Added. (WebCore::CustomElementReactionStack::backupElementQueue): Added. * dom/CustomElementReactionQueue.h: * dom/CustomElementRegistry.cpp: (WebCore::enqueueUpgradeInShadowIncludingTreeOrder): * dom/Document.cpp: (WebCore::createFallbackHTMLElement): * dom/Element.cpp: (WebCore::Element::setIsDefinedCustomElement): Create a new reaction queue if there isn't already one; when this element had been upgraded, the reaction queue have already been created in Element::enqueueToUpgrade. (WebCore::Element::setIsFailedCustomElement): Clear the reaction queue when the upgrading had failed. (WebCore::Element::enqueueToUpgrade): Added. (WebCore::Element::reactionQueue): Added. * dom/Element.h: * dom/ElementRareData.h: (WebCore::ElementRareData::customElementReactionQueue): Replaced customElementInterface. (WebCore::ElementRareData::setCustomElementReactionQueue): Replaced setCustomElementReactionQueue. 2016-10-24 Jiewen Tan <jiewen_tan@apple.com> Update SubtleCrypto::generateKey to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=163718 <rdar://problem/28864380> Reviewed by Chris Dumez. This patch does following few things: 1. It updates the SubtleCrypto::generateKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey. 2. It implements generateKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP. 3. It replaces SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS with SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS_DEPRECATED for deprecated params. 4. It fixes https://bugs.webkit.org/show_bug.cgi?id=129750 as well. Tests: crypto/subtle/aes-cbc-generate-key-length-128.html crypto/subtle/aes-cbc-generate-key-length-192.html crypto/subtle/aes-cbc-generate-key-length-256.html crypto/subtle/aes-generate-key-malformed-parameters.html crypto/subtle/aes-kw-generate-key.html crypto/subtle/generate-key-malformed-paramters.html crypto/subtle/hmac-generate-key-customized-length.html crypto/subtle/hmac-generate-key-hash-object.html crypto/subtle/hmac-generate-key-malformed-parameters.html crypto/subtle/hmac-generate-key-sha1.html crypto/subtle/hmac-generate-key-sha224.html crypto/subtle/hmac-generate-key-sha256.html crypto/subtle/hmac-generate-key-sha384.html crypto/subtle/hmac-generate-key-sha512.html crypto/subtle/rsa-generate-key-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html crypto/webkitSubtle/hmac-generate-key.html: crypto/workers/subtle/aes-generate-key.html crypto/workers/subtle/hmac-generate-key.html crypto/workers/subtle/rsa-generate-key.html * CMakeLists.txt: * DerivedSources.make: * Modules/encryptedmedia/CDMSessionClearKey.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: Added. (WebCore::toHashIdentifier): (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::createAlgorithm): (WebCore::rejectWithException): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::JSSubtleCrypto::generateKey): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::JSWebKitSubtleCrypto::generateKey): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::generateKey): * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParameters.h: Added. (WebCore::CryptoAlgorithmParameters::CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::~CryptoAlgorithmParameters): (WebCore::CryptoAlgorithmParameters::parametersClass): * crypto/CryptoAlgorithmParameters.idl: Added. * crypto/CryptoAlgorithmParametersDeprecated.h: * crypto/CryptoKey.cpp: (WebCore::CryptoKey::setUsagesBitmap): * crypto/CryptoKey.h: * crypto/CryptoKeyPair.idl: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::generateKey): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::generateKey): * crypto/algorithms/CryptoAlgorithmAES_KW.h: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::generateKey): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate): * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate): * crypto/keys/CryptoKeyRSA.h: * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/parameters/AesKeyGenParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: Added. * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added. (WebCore::CryptoAlgorithmRsaKeyGenParams::arrayToVector): * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: * crypto/parameters/HmacKeyGenParams.idl: Added. * crypto/parameters/RsaHashedKeyGenParams.idl: Added. * crypto/parameters/RsaKeyGenParams.idl: Added. 2016-10-24 Chris Dumez <cdumez@apple.com> IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter https://bugs.webkit.org/show_bug.cgi?id=163916 Reviewed by Darin Adler. IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter: - https://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabase - https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStoreParameters Align our IDL with the specification. No new tests, no expected Web-exposed behavior change. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::createObjectStore): * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBDatabase.idl: * Modules/indexeddb/IDBKeyPath.cpp: (WebCore::IDBKeyPath::IDBKeyPath): * Modules/indexeddb/IDBKeyPath.h: * WebCore.xcodeproj/project.pbxproj: * bindings/js/IDBBindingUtilities.cpp: (WebCore::idbKeyPathFromValue): Deleted. * bindings/js/IDBBindingUtilities.h: * bindings/js/JSIDBDatabaseCustom.cpp: Removed. * bindings/scripts/CodeGeneratorJS.pm: (GenerateParametersCheck): (GenerateConstructorDefinition): * dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): (WebCore::MessageEvent::create): * dom/MessageEvent.h: * testing/TypeConversions.h: (WebCore::TypeConversions::setTypeConversionsDictionary): 2016-10-24 Alex Christensen <achristensen@webkit.org> URLParser should match old URL::parse with %2E in path https://bugs.webkit.org/show_bug.cgi?id=163929 Reviewed by Alexey Proskuryakov. Covered by updated API tests, which show that URLParser now matches URL::parse in these cases. Also covered by newly failing web platform tests, which were failing before URLParser was enabled. If https://github.com/whatwg/url/issues/87 is resolved we can change behavior to match. * platform/URLParser.cpp: (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::parse): (WebCore::URLParser::isPercentEncodedDot): Deleted. 2016-10-24 Zalan Bujtas <zalan@apple.com> Do not update selection rect on dirty lineboxes. https://bugs.webkit.org/show_bug.cgi?id=163862 <rdar://problem/28813156> Reviewed by Simon Fraser. In certain cases RenderBlock::updateFirstLetter() triggers unwanted render tree mutation while the caller assumes intact renderers. This patch ensures that no renderers gets destroyed while computing the preferred widths when we are outside of layout context. Test: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::computePreferredLogicalWidths): (WebCore::RenderBlock::updateFirstLetter): * rendering/RenderBlock.h: * rendering/RenderListItem.cpp: (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::updateFirstLetter): * rendering/RenderRubyRun.h: * rendering/RenderTable.cpp: (WebCore::RenderTable::updateFirstLetter): * rendering/RenderTable.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::updateFirstLetter): * rendering/svg/RenderSVGText.h: 2016-10-24 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r207795. Introduced API test failures on iOS and macOS. Reverted changeset: "URLParser should match old URL::parse with %2E in path" https://bugs.webkit.org/show_bug.cgi?id=163929 http://trac.webkit.org/changeset/207795 2016-10-24 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, attempt to fix Windows build after r207787 https://bugs.webkit.org/show_bug.cgi?id=163657 Make the constructor public in DOMJIT::AbstractHeapRepository to make Windows bot green. It's a bit unfortunate that we need to introduce a workaround here. * domjit/DOMJITAbstractHeapRepository.h: 2016-10-24 Chris Dumez <cdumez@apple.com> event.(dataTransfer|clipboardData).getData('text/html') (onpaste, ondrop) https://bugs.webkit.org/show_bug.cgi?id=19893 <rdar://problem/6055546> Reviewed by Ryosuke Niwa. We now write selection as HTML as well to the pasteboard so that event.(dataTransfer|clipboardData).getData('text/html') now works. I have verified manually that it is still possible to copy text from Safari and paste it to Excel 2011 Mac after this change. The text is now pasted as HTML instead of text, which is fine because Excel can display HTML. No new tests, unskipped existing tests. * editing/Editor.h: * editing/mac/EditorMac.mm: (WebCore::Editor::selectionInHTMLFormat): (WebCore::Editor::writeSelectionToPasteboard): * platform/Pasteboard.h: * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::write): 2016-10-24 Alex Christensen <achristensen@webkit.org> URLParser should match old URL::parse with %2E in path https://bugs.webkit.org/show_bug.cgi?id=163929 Reviewed by Alexey Proskuryakov. Covered by updated API tests, which show that URLParser now matches URL::parse in these cases. Also covered by newly failing web platform tests, which were failing before URLParser was enabled. If https://github.com/whatwg/url/issues/87 is resolved we can change behavior to match. * platform/URLParser.cpp: (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::parse): (WebCore::URLParser::isPercentEncodedDot): Deleted. 2016-10-24 Per Arne Vollan <pvollan@apple.com> [Win] CMake build type is not set. https://bugs.webkit.org/show_bug.cgi?id=163917 Reviewed by Alex Christensen. The CMAKE_BUILD_TYPE variable should be set to Debug or Release. * WebCore.vcxproj/WebCore.proj: 2016-10-24 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, attempt to fix Windows build after r207787 https://bugs.webkit.org/show_bug.cgi?id=163657 According to the similar code in WebKit, I guess that Visual C++ requires friend class declaration is done in the private section to access private members. And I also changed ::instance to ::shared to align to the existing WebCore code. * domjit/DOMJITAbstractHeapRepository.cpp: (WebCore::DOMJIT::AbstractHeapRepository::shared): (WebCore::DOMJIT::AbstractHeapRepository::instance): Deleted. * domjit/DOMJITAbstractHeapRepository.h: * domjit/JSNodeDOMJIT.cpp: (WebCore::NodeFirstChildDOMJIT::callDOM): (WebCore::NodeLastChildDOMJIT::callDOM): (WebCore::NodeNextSiblingDOMJIT::callDOM): (WebCore::NodePreviousSiblingDOMJIT::callDOM): (WebCore::NodeParentNodeDOMJIT::callDOM): 2016-10-24 Simon Fraser <simon.fraser@apple.com> Fix the lifetime of strings used in LOG_WITH_STREAM https://bugs.webkit.org/show_bug.cgi?id=163923 Reviewed by Brent Fulgham. Make sure the const char* passed to WTFLog() outlives the call. Removed logFunctionResult which wasn't used anywhere else, and encourages this bad pattern. * platform/LogMacros.h: * platform/Logging.cpp: (WebCore::logFunctionResult): Deleted. 2016-10-24 Chris Dumez <cdumez@apple.com> Reduce special handling for typed arrays in JSDOMConvert.h https://bugs.webkit.org/show_bug.cgi?id=163907 Reviewed by Sam Weinig. Reduce special handling for typed arrays in JSDOMConvert.h by adding a toWrapped() static function on JSGenericTypedArrayView, similarly to other wrapper types. No new tests, no web-exposed behavior change. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLInterface<JSC::GenericTypedArrayView<Adaptor>>>::convert): Deleted. 2016-10-24 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r207783. This change appears to have caused fast/selectors/invalid- functional-pseudo-class.html to crash on iOS and macOS Reverted changeset: "[CSS Parser] Fix :lang argument parsing" https://bugs.webkit.org/show_bug.cgi?id=163913 http://trac.webkit.org/changeset/207783 2016-10-24 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support new IDBKeyRange interfaces. <rdar://problem/28806929> and https://bugs.webkit.org/show_bug.cgi?id=163910 Reviewed by Andy Estes. No new tests (Covered by additions to existing test) The "new IDBKeyRanges interfaces" really just means adding the instance method IDBKeyRange.contains. * Modules/indexeddb/IDBKeyRange.cpp: (WebCore::IDBKeyRange::contains): * Modules/indexeddb/IDBKeyRange.h: * Modules/indexeddb/IDBKeyRange.idl: 2016-10-23 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Add a way for DOMJIT::Patchpoint to express effects https://bugs.webkit.org/show_bug.cgi?id=163657 Reviewed by Saam Barati. CallDOMPatchpoint now has the way to tell its effects to DFG and FTL compilers. WebCore DOMJIT::AbstractHeapRepository will construct the hierarchy of the abstract heap. And then it encodes these information into the pairs of the integers. And this patch also changes the DOMJIT::PatchpointParams' parameter order. So we change them in all the DOMJIT::CallDOMPatchpoint sites. * CMakeLists.txt: * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h. * ForwardingHeaders/domjit/DOMJITEffect.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h. * ForwardingHeaders/domjit/DOMJITHeapRange.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h. * WebCore.xcodeproj/project.pbxproj: * domjit/DOMJITAbstractHeapRepository.cpp: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h. (WebCore::DOMJIT::AbstractHeapRepository::AbstractHeapRepository): (WebCore::DOMJIT::AbstractHeapRepository::instance): * domjit/DOMJITAbstractHeapRepository.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h. * domjit/DOMJITHelpers.h: (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal): Deleted. (WebCore::DOMJITHelpers::branchIfNotWeakIsLive): Deleted. (WebCore::DOMJITHelpers::tryLookUpWrapperCache): Deleted. (WebCore::DOMJITHelpers::toWrapper): Deleted. (WebCore::DOMJITHelpers::branchIfDOMWrapper): Deleted. (WebCore::DOMJITHelpers::branchIfNotDOMWrapper): Deleted. (WebCore::DOMJITHelpers::branchIfNode): Deleted. (WebCore::DOMJITHelpers::branchIfNotNode): Deleted. (WebCore::DOMJITHelpers::branchIfElement): Deleted. (WebCore::DOMJITHelpers::branchIfNotElement): Deleted. (WebCore::DOMJITHelpers::branchIfDocumentWrapper): Deleted. (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper): Deleted. * domjit/JSNodeDOMJIT.cpp: (WebCore::createCallDOMForOffsetAccess): (WebCore::checkNode): (WebCore::NodeFirstChildDOMJIT::checkDOM): (WebCore::NodeFirstChildDOMJIT::callDOM): (WebCore::NodeLastChildDOMJIT::checkDOM): (WebCore::NodeLastChildDOMJIT::callDOM): (WebCore::NodeNextSiblingDOMJIT::checkDOM): (WebCore::NodeNextSiblingDOMJIT::callDOM): (WebCore::NodePreviousSiblingDOMJIT::checkDOM): (WebCore::NodePreviousSiblingDOMJIT::callDOM): (WebCore::NodeParentNodeDOMJIT::checkDOM): (WebCore::NodeParentNodeDOMJIT::callDOM): (WebCore::NodeNodeTypeDOMJIT::checkDOM): (WebCore::NodeNodeTypeDOMJIT::callDOM): 2016-10-24 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix :lang argument parsing https://bugs.webkit.org/show_bug.cgi?id=163913 Reviewed by Zalan Bujtas. * css/SelectorPseudoClassAndCompatibilityElementMap.in: Modify the map to support versions of the function pseudos without the left paren included. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::setLangArgumentList): * css/parser/CSSParserValues.h: Add a helper to just directly pass an AtomicString Vector through. * css/parser/CSSSelectorParser.cpp: (WebCore::consumeLangArgumentList): (WebCore::CSSSelectorParser::consumePseudo): Add a new consumeLangArgumentList to collect the languages into an AtomicString Vector. 2016-10-24 Alex Christensen <achristensen@webkit.org> Fix AppleWin build after r207720. * html/canvas/OESVertexArrayObject.cpp: 2016-10-24 Alex Christensen <achristensen@webkit.org> Fix AppleWin build after r207720. * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: 2016-10-24 Alex Christensen <achristensen@webkit.org> Fix Windows build after r207767 and r207769 * css/CSSAllInOne.cpp: * platform/network/curl/ResourceHandleManager.cpp: (WebCore::getProtectionSpace): 2016-10-24 Per Arne Vollan <pvollan@apple.com> [Win] AVCF based media engine does not block cross-site/cross-domain loads. https://bugs.webkit.org/show_bug.cgi?id=163783 Reviewed by Brent Fulgham. Prevent cross-site/cross-domain loads by setting appropriate AVCF options. No new tests; covered by media/video-canvas-source.html. Media tests are currently skipped on Windows. * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURL): (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin): (WebCore::AVFWrapper::createAssetForURL): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h: 2016-10-24 Anders Carlsson <andersca@apple.com> Fix build with newer versions of clang https://bugs.webkit.org/show_bug.cgi?id=163908 rdar://problem/28852016 Reviewed by Tim Horton. Use the macros that names the soft-linked functions in such a way that they won't conflict with actual functions. * platform/ios/PlatformScreenIOS.mm: (WebCore::screenIsMonochrome): (WebCore::screenHasInvertedColors): (WebCore::screenSize): (WebCore::availableScreenSize): (WebCore::screenScaleFactor): 2016-10-24 Joseph Pecoraro <pecoraro@apple.com> Remove unnecessary unused variable stubs https://bugs.webkit.org/show_bug.cgi?id=163688 Reviewed by Simon Fraser. * Modules/applepay/cocoa/PaymentCocoa.mm: (WebCore::toDictionary): * Modules/applepay/cocoa/PaymentContactCocoa.mm: (WebCore::toDictionary): 2016-10-24 Alex Christensen <achristensen@webkit.org> Try to fix Windows build after r207767 https://bugs.webkit.org/show_bug.cgi?id=163891 * DerivedSources.cpp: 2016-10-24 Zan Dobersek <zdobersek@igalia.com> [CodeGenerator] Only allow a single interface or standalone dictionary per WebIDL file https://bugs.webkit.org/show_bug.cgi?id=163889 Reviewed by Chris Dumez. Assert that there's only one interface or standalone dictionary per WebIDL input file, and exit from the generator otherwise. This avoids potential linking issues where multiple enumeration and dictionary bindings code can be generated if the source WebIDL for them is specified in a file that contains multiple interfaces or standalone dictionaries. Additionally, the generator now also exits if it fails to generate code for any interface of standalone dictionary. This should avoid processing WebIDL files that are empty in substance. TestException.idl and TestInterface.idl files have their second interfaces removed. In place of those a new testing IDL file is added, TestInterfaceLeadingUnderscore.idl. Like the two removed interfaces, it tests that the leading underscode in the identifier is removed by the generator. * bindings/scripts/CodeGenerator.pm: (ProcessDocument): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: Added. (WebCore::JSTestInterfaceLeadingUnderscorePrototype::create): (WebCore::JSTestInterfaceLeadingUnderscorePrototype::createStructure): (WebCore::JSTestInterfaceLeadingUnderscorePrototype::JSTestInterfaceLeadingUnderscorePrototype): (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure): (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties): (WebCore::JSTestInterfaceLeadingUnderscorePrototype::finishCreation): (WebCore::JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore): (WebCore::JSTestInterfaceLeadingUnderscore::createPrototype): (WebCore::JSTestInterfaceLeadingUnderscore::prototype): (WebCore::JSTestInterfaceLeadingUnderscore::destroy): (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute): (WebCore::jsTestInterfaceLeadingUnderscoreReadonly): (WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter): (WebCore::jsTestInterfaceLeadingUnderscoreConstructor): (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor): (WebCore::JSTestInterfaceLeadingUnderscore::getConstructor): (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots): (WebCore::JSTestInterfaceLeadingUnderscoreOwner::finalize): (WebCore::toJSNewlyCreated): (WebCore::toJS): (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: Renamed from Source/WebCore/bindings/scripts/test/JS/JSreadonly.h. (WebCore::JSTestInterfaceLeadingUnderscore::create): (WebCore::JSTestInterfaceLeadingUnderscore::createStructure): (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation): (WebCore::wrapperOwner): (WebCore::wrapperKey): (WebCore::toJS): (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSattribute.cpp: Removed. * bindings/scripts/test/JS/JSattribute.h: Removed. * bindings/scripts/test/JS/JSreadonly.cpp: Removed. * bindings/scripts/test/TestException.idl: * bindings/scripts/test/TestInterface.idl: * bindings/scripts/test/TestInterfaceLeadingUnderscore.idl: Copied from Source/WebCore/bindings/scripts/test/TestException.idl. 2016-10-21 Alex Christensen <achristensen@webkit.org> URL::port should return Optional<uint16_t> https://bugs.webkit.org/show_bug.cgi?id=163806 Reviewed by Darin Adler. A URL without a port is different than a URL with port 0. This matches the spec, Chrome, and Firefox. Covered by newly-passing web platform tests. * Modules/indexeddb/IDBDatabaseIdentifier.h: (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue): (WebCore::IDBDatabaseIdentifier::hash): (WebCore::IDBDatabaseIdentifier::isValid): (WebCore::IDBDatabaseIdentifier::isEmpty): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): (WebCore::ContentExtensions::applyBlockedStatusToRequest): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/URLUtils.h: (WebCore::URLUtils<T>::protocol): (WebCore::URLUtils<T>::host): (WebCore::URLUtils<T>::port): * loader/CrossOriginAccessControl.cpp: (WebCore::isValidCrossOriginRedirectionURL): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::maybeLoadEmpty): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): (WebCore::CachedResource::freshnessLifetime): * page/Location.cpp: (WebCore::Location::protocol): (WebCore::Location::host): (WebCore::Location::port): * page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): * page/SecurityOrigin.cpp: (WebCore::shouldTreatAsUniqueOrigin): (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isSecure): (WebCore::SecurityOrigin::canDisplay): (WebCore::SecurityOrigin::toRawString): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::databaseIdentifier): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::port): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::debugString): * page/SecurityOriginData.h: (): Deleted. * page/SecurityOriginHash.h: (WebCore::SecurityOriginHash::hash): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowObjectFromSource): (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): (WebCore::ContentSecurityPolicy::allowResourceFromSource): (WebCore::ContentSecurityPolicy::allowConnectToSource): (WebCore::ContentSecurityPolicy::allowBaseURI): (WebCore::stripURLForUseInReport): (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): (WebCore::ContentSecurityPolicySource::portMatches): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::parseSource): (WebCore::ContentSecurityPolicySourceList::parsePort): * page/csp/ContentSecurityPolicySourceList.h: * platform/SchemeRegistry.h: * platform/URL.cpp: (WebCore::URL::protocol): (WebCore::URL::port): (WebCore::URL::serialize): (WebCore::portAllowed): (WebCore::defaultPortsMap): Deleted. (WebCore::defaultPortForProtocol): Deleted. (WebCore::isDefaultPortForProtocol): Deleted. * platform/URL.h: (WebCore::URL::hasPort): Deleted. * platform/URLParser.cpp: (WebCore::defaultPortForProtocol): (WebCore::isDefaultPortForProtocol): (WebCore::URLParser::parsePort): (WebCore::isDefaultPort): Deleted. * platform/network/CredentialStorage.cpp: (WebCore::originStringFromURL): * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::create): (WebCore::ResourceHandle::loadResourceSynchronously): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::port): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::protocol): (WebCore::WorkerLocation::host): (WebCore::WorkerLocation::port): 2016-10-24 Zan Dobersek <zdobersek@igalia.com> [CodeGeneratorJS] Support enums for standalone dictionaries https://bugs.webkit.org/show_bug.cgi?id=163885 Reviewed by Youenn Fablet. Add support for enumerations in WebIDL files that specify standalone dictionaries. Implementation of this is pretty straight-forward and mirrors interface and callback generators by calling GenerateEnumerations{Header,Implementation}Content() functions in GenerateDictionary{Header,Implementation}(). In GenerateEnumerationsImplementationContent(), the NeverDestroyed.h header is added to the implementation includes since that class is used to hold an array of possible enum values. A test enum is added to the TestStandaloneDictionary.idl file and the baselines are updated to reflect the new capability. * bindings/scripts/CodeGenerator.pm: (ProcessDocument): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionary): (GenerateEnumerationsImplementationContent): (GenerateDictionaryHeader): (GenerateDictionaryImplementation): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertEnumerationToJS): (WebCore::parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>): (WebCore::convertEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>): (WebCore::expectedEnumerationValues<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>): (WebCore::convertDictionary<DictionaryImplName>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: * bindings/scripts/test/TestStandaloneDictionary.idl: 2016-10-24 Dave Hyatt <hyatt@apple.com> Remove CSSCharsetRule from the CSS OM https://bugs.webkit.org/show_bug.cgi?id=163891 Reviewed by Darin Adler. Remove CSSCharsetRule from the CSS OM. All other browser engines have made this change. This eliminates the weird overloading of isCharsetRule to match both CSSCharsetRule and StyleRuleCharset (only used by the new parser). Fix the destroy() method in StyleRuleBase to clean up StyleRuleCharsets created by the new parser properly. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJSNewlyCreated): * css/CSSCharsetRule.cpp: Removed. * css/CSSCharsetRule.h: Removed. * css/CSSCharsetRule.idl: Removed. * css/CSSPropertySourceData.h: * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::item): (WebCore::CSSStyleSheet::rules): * css/CSSStyleSheet.h: * css/StyleRule.cpp: (WebCore::StyleRuleBase::destroy): * inspector/InspectorStyleSheet.cpp: (WebCore::asCSSRuleList): 2016-10-24 Zan Dobersek <zdobersek@igalia.com> [CodeGeneratorJS] Standalone dictionaries have misplaced build guards https://bugs.webkit.org/show_bug.cgi?id=163881 Reviewed by Chris Dumez. Build guards that are generated from the Conditional attribute on WebIDL dictionary declarations properly guard the relevant convertDictionary() functions for WebIDL files that also specify interfaces. But for standalone dictionaries these build guards should guard the complete header and implementation files, much like this is done for files that originate from interfaces or callbacks. Before this patch, guarding a standalone dictionary resulted in malformed output because GenerateHeaderContentHeader() and GenerateImplementationContentHeader() functions both generated the #if macro that would guard the whole file, but GenerateDictionary{Header,Implementation}() didn't generate the closing #endif. CodeGeneratorJS.pm now passes the conditional string, if any, to GenerateDictionary{Header,Implementation}Content() functions in case of a non-standalone dictionary. Otherwise, the conditional string, if any, is used to guard the complete header and implementation files. Generator tests are updated to cover various build guard combinations on dictionaries in TestObj.idl, and the standalone dictionary WebIDL file now has a Conditional attribute to check that the build guards cover complete generated header and implementation files. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryHeaderContent): (GenerateDictionariesHeaderContent): (GenerateDictionaryImplementationContent): (GenerateDictionariesImplementationContent): (GenerateDictionaryHeader): (GenerateDictionaryImplementation): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::ConditionalDictionaryA>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryB>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryC>): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestStandaloneDictionary.idl: 2016-10-24 Eric Carlson <eric.carlson@apple.com> [MediaStream] Separate media capture and audio playback muting https://bugs.webkit.org/show_bug.cgi?id=163855 <rdar://problem/28827186> Reviewed by Darin Adler. Test: fast/mediastream/MediaStream-page-muted.html Change page.muted from a bool to a bitfield so audio and media capture muted are independent. Fix a couple of bugs in the mock media capture device uncovered by new test case. * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::pageMutedStateDidChange): page.isMuted -> page.mutedState. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::pageMutedStateDidChange): Ditto. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updateVolume): Ditto. (WebCore::HTMLMediaElement::effectiveMuted): Ditto. * page/MediaProducer.h: Add MutedState enum. * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::setMuted): Take MutedStateFlags instead of bool. m_muted -> m_mutedState. * page/Page.h: * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::MockRealtimeMediaSource::startProducingData): Call setMuted. (WebCore::MockRealtimeMediaSource::stopProducingData): Ditto. * platform/mock/MockRealtimeMediaSource.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::stopProducingData): Call correct base class method. * testing/Internals.cpp: (WebCore::Internals::setPageMuted): Change parameter from a bool to a string. * testing/Internals.h: * testing/Internals.idl: 2016-10-24 Darin Adler <darin@apple.com> Try to fix Windows build. * bindings/js/JSWebGL2RenderingContextCustom.cpp: Rearranged includes so they are inside the conditional as they should be. 2016-10-24 Youenn Fablet <youenn@apple.com> Activate WEB_RTC compilation flags for Mac bots https://bugs.webkit.org/show_bug.cgi?id=163886 Reviewed by Eric Carlson. Covered by existing tests. Fixing compilation errors due to missing WEBCORE_EXPORT, missing method and missing override keywords. * Configurations/FeatureDefines.xcconfig: * DerivedSources.make: * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/SDPProcessor.cpp: (WebCore::SDPProcessor::generate): (WebCore::SDPProcessor::parse): * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSource::createMuted): 2016-10-24 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support IDBIndex name assignment. <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/index-rename-1-private.html storage/indexeddb/modern/index-rename-1.html Touches a *lot* of code sites, but none of them are particularly interesting. They are all just getting the new name spread out to all of the various objects that need it. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::renameIndex): * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::IDBIndex): (WebCore::IDBIndex::setName): (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): * Modules/indexeddb/IDBIndex.h: * Modules/indexeddb/IDBIndex.idl: * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::renameReferencedIndex): (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort): Deleted. * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::renameIndexOnServer): (WebCore::IDBTransaction::didRenameIndexOnServer): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::renameIndex): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::renameIndex): (WebCore::IDBClient::IDBConnectionToServer::didRenameIndex): * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: * Modules/indexeddb/client/TransactionOperation.h: (WebCore::IDBClient::createTransactionOperation): * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex): * Modules/indexeddb/server/IDBConnectionToClient.h: * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::renameIndex): * Modules/indexeddb/server/IDBServer.h: * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed): (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): * Modules/indexeddb/server/MemoryBackingStoreTransaction.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/MemoryIndex.h: (WebCore::IDBServer::MemoryIndex::rename): * Modules/indexeddb/server/MemoryObjectStore.cpp: (WebCore::IDBServer::MemoryObjectStore::renameIndex): * Modules/indexeddb/server/MemoryObjectStore.h: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::renameIndex): (WebCore::IDBServer::UniqueIDBDatabase::performRenameIndex): (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameIndex): * Modules/indexeddb/server/UniqueIDBDatabase.h: * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp: (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameIndex): * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h: * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameIndex): * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: * Modules/indexeddb/shared/IDBIndexInfo.h: (WebCore::IDBIndexInfo::rename): * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: (WebCore::IDBObjectStoreInfo::infoForExistingIndex): * Modules/indexeddb/shared/IDBObjectStoreInfo.h: * Modules/indexeddb/shared/IDBResultData.cpp: (WebCore::IDBResultData::renameIndexSuccess): * Modules/indexeddb/shared/IDBResultData.h: * Modules/indexeddb/shared/InProcessIDBServer.cpp: (WebCore::InProcessIDBServer::didRenameIndex): (WebCore::InProcessIDBServer::renameIndex): * Modules/indexeddb/shared/InProcessIDBServer.h: 2016-10-24 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix -webkit-box-reflect parsing https://bugs.webkit.org/show_bug.cgi?id=163890 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeReflect): Do a WTFMove on the mask instead of a .releaseNonNull(), since mask can be a nullptr. Exactly matches the old parser. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue): (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber): (WebCore::CSSPropertyParserHelpers::consumeInteger): (WebCore::CSSPropertyParserHelpers::consumeNumber): (WebCore::CSSPropertyParserHelpers::consumeLength): (WebCore::CSSPropertyParserHelpers::consumePercent): (WebCore::CSSPropertyParserHelpers::consumeAngle): (WebCore::CSSPropertyParserHelpers::consumeTime): (WebCore::CSSPropertyParserHelpers::consumeUrl): (WebCore::CSSPropertyParserHelpers::consumeColor): (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint): (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop): (WebCore::CSSPropertyParserHelpers::consumeCrossFade): (WebCore::CSSPropertyParserHelpers::consumeImageSet): Clean up all instances of CSSPrimitiveValue::create to use the CSSValuePool. 2016-10-21 Antoine Quint <graouts@apple.com> [Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS resources https://bugs.webkit.org/show_bug.cgi?id=163785 <rdar://problem/28890058> Reviewed by Darin Adler. Concatenate CSS and JS resources for modern media controls into single JS and CSS files during build and load these single resources alone at runtime. * Modules/modern-media-controls/js-files: Added. * WebCore.xcodeproj/project.pbxproj: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsStyleSheet): (WebCore::RenderThemeMac::mediaControlsScript): 2016-10-24 Dave Hyatt <hyatt@apple.com> [CSS Parser] Unprefix -webkit-writing-mode https://bugs.webkit.org/show_bug.cgi?id=163870 Reviewed by Zalan Bujtas. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): Change -webkit-writing mode to writing-mode. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator WritingMode): (WebCore::CSSPrimitiveValue::operator SVGWritingMode): Deleted. Eliminate the SVGWritingMode converters. Add support for the unique SVG-specific values to the WritingMode converters. * css/CSSPropertyNames.in: Alias -webkit-writing-mode to writing-mode. Move writing-mode up to be high priority like -webkit-writing mode was. Alias -epub-writing-mode to writing-mode instead of to -webkit-writing-mode. * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::svgPropertyValue): Remove writing-mode from SVG computed style, since the base CSSComputedStyleDeclaration handles it. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueWritingMode): (WebCore::StyleBuilderCustom::applyValueWebkitWritingMode): Deleted. Renamed applyValueWebkitWritingMode to applyValueWritingMode. Removed the SVG code, since the underlying converter for WritingMode now handles those values. * css/StyleResolver.cpp: (WebCore::extractDirectionAndWritingMode): Rename -webkit-writing-mode to writing-mode. * css/parser/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): Eliminate -webkit-writing-mode and make sure writing-mode handles both the SVG values and the normal values. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): Same deal here. * html/track/TextTrackCueGeneric.cpp: (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): * html/track/VTTCue.cpp: (WebCore::VTTCueBox::applyCSSProperties): Cue stuff was setting -webkit-writing-mode, so make it set writing-mode instead now. * rendering/RenderLineBreak.cpp: (WebCore::RenderLineBreak::collectSelectionRects): * rendering/RenderText.cpp: (WebCore::RenderText::collectSelectionRects): Switch the SVG-specific code here over to accessing the RenderStyle writing-mode and not the SVG-specific one. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::isVerticalWritingMode): Add a helper function for asking if something is vertical writing mode. * rendering/style/SVGRenderStyle.cpp: * rendering/style/SVGRenderStyle.h: * rendering/style/SVGRenderStyleDefs.h: (WebCore::SVGRenderStyle::diff): Remove the SVG writing mode code. * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle): Make sure to force SVG font descriptions to be horizontal, since SVG controls its own glyph orientation. * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeSVGInlineTextBox): * rendering/svg/SVGTextChunk.cpp: (WebCore::SVGTextChunk::SVGTextChunk): * rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::layoutInlineTextBox): * rendering/svg/SVGTextQuery.cpp: (WebCore::SVGTextQuery::executeQuery): Changed to access the RenderStyle writing mode instead of the SVG-specific one. 2016-10-23 Antti Koivisto <antti@apple.com> Avoid unnecessary full style resolution in getComputedStyle for non-inherited properties https://bugs.webkit.org/show_bug.cgi?id=163875 Reviewed by Andreas Kling. Test: fast/css/getComputedStyle/getComputedStyle-style-resolution.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::hasValidStyleForProperty): For non-inherited properties we don't need to update style even if some ancestor style is invalid as long as explicit 'inherit' is not being used. We still need to update if we find out that the whole subtree we are in is invalid. (WebCore::updateStyleIfNeededForProperty): Pass the property. (WebCore::ComputedStyleExtractor::customPropertyValue): (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::CSSComputedStyleDeclaration::length): (WebCore::elementOrItsAncestorNeedsStyleRecalc): Deleted. (WebCore::updateStyleIfNeededForElement): Deleted. * css/StyleResolver.cpp: (WebCore::StyleResolver::colorFromPrimitiveValue): Mark style as using explicit inheritance if 'currentcolor' value is used. 2016-10-24 Youenn Fablet <youenn@apple.com> ASSERTION FAILED: canvas()->securityOrigin()->toString() == cachedImage.origin()->toString() https://bugs.webkit.org/show_bug.cgi?id=163242 Reviewed by Darin Adler. Test: http/tests/security/cross-origin-cached-images-canvas.html We were previously on Origin HTTP header to check whether requests were made from different origins. This is fine for CORS enabled requests but not for GET no CORS requests since they will not have any Origin header. Now that CachedResource and CachedResourceRequest own their origin, it is best to use these directly. * loader/cache/CachedResourceLoader.cpp: (WebCore::isRequestMatchingResourceOrigin): (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): 2016-10-24 Youenn Fablet <youenn@apple.com> Remove CachedResource::passesSameOriginPolicyCheck https://bugs.webkit.org/show_bug.cgi?id=163593 Reviewed by Andreas Kling. No change of behavior. Removing no-longer used code. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::redirectReceived): (WebCore::CachedResource::passesAccessControlCheck): Deleted. (WebCore::CachedResource::passesSameOriginPolicyCheck): Deleted. (WebCore::CachedResource::responseForSameOriginPolicyChecks): Deleted. * loader/cache/CachedResource.h: (WebCore::CachedResource::response): 2016-10-24 Youenn Fablet <youenn@apple.com> Redirections should be upgraded if CSP policy says so https://bugs.webkit.org/show_bug.cgi?id=163544 Reviewed by Darin Adler. Test: http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-after-redirect.https.html Introducing CachedResourceLoader::updateRequestAfterRedirection to do the checks that CachedResourceLoader is doing to the initial request, but for redirection requests. Implemented URL upgrade according CSP policy, as specified by fetch algorithm. Minor refactoring in CachedResourceRequest to share some code. Fixing some constness issues. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): (WebCore::CachedResourceLoader::canRequestAfterRedirection): (WebCore::CachedResourceLoader::updateRequestAfterRedirection): * loader/cache/CachedResourceLoader.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::upgradeInsecureResourceRequestIfNeeded): (WebCore::CachedResourceRequest::upgradeInsecureRequestIfNeeded): * loader/cache/CachedResourceRequest.h: 2016-10-22 Sam Weinig <sam@webkit.org> [WebIDL] Add IDLType based toJS conversion https://bugs.webkit.org/show_bug.cgi?id=163861 Reviewed by Darin Adler. Adds toJS<IDLType>() functions to be the new way of converting from implementation types to JS types. These are implemented via a similar mechanism to the convert<IDL>() functions, though specializations of a JSConverter struct (rather than the Converter structs). This allows us to support arbitrarily complex aggregate types easily (e.g. sequence<(Node or DOMString?)>). * Modules/geolocation/Geoposition.idl: * dom/Event.idl: Add typedef for DOMTimeStamp. Eventually, our IDLParser should do this for us, but for now it allows us to simplify the type system. * bindings/js/JSDOMBinding.h: (WebCore::JSValueTraits::arrayJSValue): Deleted. (WebCore::JSValueTraits<String>::arrayJSValue): Deleted. (WebCore::JSValueTraits<double>::arrayJSValue): Deleted. (WebCore::JSValueTraits<float>::arrayJSValue): Deleted. (WebCore::jsArray): Deleted. (WebCore::jsFrozenArray): Deleted. (WebCore::NativeValueTraits<String>::nativeValue): Deleted. (WebCore::NativeValueTraits<unsigned>::nativeValue): Deleted. (WebCore::NativeValueTraits<float>::nativeValue): Deleted. (WebCore::NativeValueTraits<double>::nativeValue): Deleted. (WebCore::toNullableJSNumber): Deleted. (WebCore::toJSArray): Deleted. (WebCore::toJSBoolean): Deleted. (WebCore::toJSNumber): Deleted. (WebCore::toJSString): Deleted. Remove many now-unneeded conversion functions. * bindings/js/JSDOMConvert.h: (WebCore::toJS): Add 5 primary toJS functions which take combinations of the following arguments: ExecState, JSDOMGlobalObject, ThrowScope. All take the value to be converted as well, except in the case of the throwScope ones, where they take the value in an ExceptionOr<>. To simplify the implementations of the JSConverter specializations, avoiding the need for each one to implement their conversion up to 3 times (one for just the value, one for the value and the ExecState, and one for the value, the ExecState and the global object), each JSConverter instead specifies whether it's converter needs an ExecState or global object via a static constexpr. We then use the JSConverterOverloader template, to call the correct function. This can probably be improved in the future, by inferring the number of arguments needed via SFINAE, but this seemed like a more straightforward first cut. (WebCore::JSConverter<IDLNullable<T>>::convert): (WebCore::JSConverter<IDLBoolean>::convert): (WebCore::JSConverter<IDLInterface<T>>::convert): (WebCore::JSConverter<IDLAny>::convert): (WebCore::JSConverter<IDLByte>::convert): (WebCore::JSConverter<IDLOctet>::convert): (WebCore::JSConverter<IDLShort>::convert): (WebCore::JSConverter<IDLUnsignedShort>::convert): (WebCore::JSConverter<IDLLong>::convert): (WebCore::JSConverter<IDLUnsignedLong>::convert): (WebCore::JSConverter<IDLLongLong>::convert): (WebCore::JSConverter<IDLUnsignedLongLong>::convert): (WebCore::JSConverter<IDLFloat>::convert): (WebCore::JSConverter<IDLUnrestrictedFloat>::convert): (WebCore::JSConverter<IDLDouble>::convert): (WebCore::JSConverter<IDLUnrestrictedDouble>::convert): (WebCore::JSConverter<IDLDOMString>::convert): (WebCore::JSConverter<IDLUSVString>::convert): (WebCore::JSConverter<IDLSequence<T>>::convert): (WebCore::JSConverter<IDLFrozenArray<T>>::convert): (WebCore::JSConverter<IDLEnumeration<T>>::convert): (WebCore::JSConverter<IDLUnion<T...>>::convert): There is slightly more duplication than I would have liked, for instance we have a specialization for each numeric type, even though they are all the same, but that is something that can be improved going forward. (WebCore::Converter<IDLUnion<T...>>::convert) Fix the normal IDLUnion converter to work with boolean types. This was caught by the test case I added via TypeConversions.idl. * bindings/js/JSDOMStringMapCustom.cpp: (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setTimeout): (WebCore::JSDOMWindow::setInterval): * bindings/js/JSDataTransferCustom.cpp: (WebCore::JSDataTransfer::types): * bindings/js/JSMediaStreamTrackCustom.cpp: (WebCore::JSMediaStreamTrack::getCapabilities): * bindings/js/JSMutationCallback.cpp: (WebCore::JSMutationCallback::call): * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Switch to use new toJS<> functions. * bindings/scripts/CodeGeneratorJS.pm: (AddStringifierOperationIfNeeded): Fix stringifier function signature to contain an idlType. (GenerateEnumerationsHeaderContent): Remove now unnecessary JSValueTraits specializations. (JSValueToNativeIsHandledByDOMConvert): Renamed from IsHandledByDOMConvert, since that name is now ambiguous. (JSValueToNative): Update for new name of IsHandledByDOMConvert. (NativeToJSValueIsHandledByDOMConvert): Predicate guarding what types currently work with the new conversion system. (NativeToJSValueDOMConvertNeedsState): Predicate for determining if the ExecState is needed in the conversion function. (NativeToJSValueDOMConvertNeedsGlobalObject): Predicate for determining if the global object is needed in the conversion function. (NativeToJSValue): Move things around a little bit and start converting use the new toJS<> when possible. * bindings/scripts/IDLParser.pm: (parseAttributeOrOperationRest): Fix a missing place where were not setting the idlType. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallback.cpp: * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSattribute.cpp: Update test results. * testing/TypeConversions.h: (WebCore::TypeConversions::testUnion): (WebCore::TypeConversions::setTestUnion): (WebCore::TypeConversions::typeConversionsDictionarySequenceValue): (WebCore::TypeConversions::typeConversionsDictionaryUnionValue): * testing/TypeConversions.idl: Add a testUnion attribute, now that we can return unions to JS. 2016-10-23 Zalan Bujtas <zalan@apple.com> Unreviewed, rolling out r207727. broke 15 selection test cases. Reverted changeset: "Do not update selection rect on dirty lineboxes." https://bugs.webkit.org/show_bug.cgi?id=163862 http://trac.webkit.org/changeset/207727 2016-10-23 Chris Dumez <cdumez@apple.com> addEventListener() / removeEventListener() should use a union for last parameter https://bugs.webkit.org/show_bug.cgi?id=163863 Reviewed by Darin Adler. addEventListener() / removeEventListener() should use a union for last parameter: - https://dom.spec.whatwg.org/#eventtarget No new tests, no Web-exposed behavior change. * bindings/js/JSDOMConvert.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListenerForBindings): (WebCore::EventTarget::removeEventListenerForBindings): * dom/EventTarget.h: * dom/EventTarget.idl: 2016-10-23 Zalan Bujtas <zalan@apple.com> Do not update selection rect on dirty lineboxes. https://bugs.webkit.org/show_bug.cgi?id=163862 <rdar://problem/28813156> Reviewed by Simon Fraser. In addition to checking whether the renderer needs layout, we also need to check if its preferred width is clean and stop computing the selection rects, if needed (while adding a renderer to the tree, there's a transition phase where the parent's preferred width dirty bit is already set, but it does not yet need layout). Tests: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html * rendering/RenderObject.cpp: (WebCore::RenderObject::canUpdateSelectionOnRootLineBoxes): 2016-10-22 Myles C. Maxfield <mmaxfield@apple.com> ASSERTION FAILED: m_fonts in &WebCore::FontCascade::primaryFont https://bugs.webkit.org/show_bug.cgi?id=163459 Reviewed by Darin Adler. The CSS Units and Values spec states that font-relative units, when used in the font-size property, are resolved against the parent element. When calc() is specified, we were trying to resolve them against the current element, which is impossible because of the circular dependency. Instead, we should resolve against the parent style the same way as when calc() isn't specified. Test: fast/text/font-size-calc.html * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueFontSize): 2016-10-22 Chris Dumez <cdumez@apple.com> [Web IDL] Two types are distinguishable for overload resolution if at most one of the two includes a nullable type https://bugs.webkit.org/show_bug.cgi?id=163791 Reviewed by Sam Weinig. Update overload resolution in the bindings generator so that 2 nullable types are no longer considered as distinguishable, as per Web IDL: - https://heycam.github.io/webidl/#dfn-distinguishable * bindings/scripts/CodeGeneratorJS.pm: (AreTypesDistinguishableForOverloadResolution): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1Caller): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2Caller): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter): * bindings/scripts/test/TestObj.idl: 2016-10-22 Chris Dumez <cdumez@apple.com> WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading https://bugs.webkit.org/show_bug.cgi?id=163859 Reviewed by Darin Adler. WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading: - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 No new tests, no Web-exposed behavior change. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::texSubImage2D): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::texSubImage2D): * html/canvas/WebGLRenderingContext.h: * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2016-10-22 Dan Bernstein <mitz@apple.com> Dynamically-added backdrop filter to clip-path'd element with 3D transform renders incorrectly (without clip) https://bugs.webkit.org/show_bug.cgi?id=163497 Reviewed by Simon Fraser. Test: css3/filters/backdrop/dynamic-with-clip-path.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ensureStructuralLayer): Added MaskLayerChanged to structuralLayerChangeFlags to ensure that the mask layer is updated. 2016-10-22 Simon Fraser <simon.fraser@apple.com> Backdrop filter doesn't show if removed then re-added https://bugs.webkit.org/show_bug.cgi?id=163860 Reviewed by Dan Bernstein. When a backdrop filter is removed the re-added, updateBackdropFiltersRect() never runs the second time because m_backdropFiltersRect doesn't change. However, we need to run that code to size and position the newly re-created backdrop layer, so run it explicitly if we just created the backdrop layer. This is similar to how updateContentsImage() calls updateContentsRects(). Test: css3/filters/backdrop/add-remove-add-backdrop-filter.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setBackdropFilters): (WebCore::GraphicsLayerCA::updateBackdropFilters): 2016-10-22 Simon Fraser <simon.fraser@apple.com> Fix repainting of slow repaint objects in WK1 when page scale is applied https://bugs.webkit.org/show_bug.cgi?id=163854 Reviewed by Zalan Bujtas. RenderObject::repaintSlowRepaintObject() always set the repaint container to the RenderView if it was null. This is before the call to clippedOverflowRectForRepaint(). If that function is called with a null repaintContainer, it maps the rect up through the RenderView's transform (which represents page scale), which is what we want here. Passing the RenderView itself stops the transform from being applied, which led to the bug. WebKit2 doesn't suffer from this bug because containerForRepaint() always returns the composited RenderView. Test: fast/repaint/zoomed-fixed-background.html * rendering/RenderObject.cpp: (WebCore::RenderObject::repaintSlowRepaintObject): 2016-10-22 Darin Adler <darin@apple.com> Move HTML canvas and tracks from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163853 Reviewed by Chris Dumez. * WebCore.xcodeproj/project.pbxproj: Added CanvasPath.idl. * bindings/js/JSWebGL2RenderingContextCustom.cpp: Tweaked a bit. * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: (WebCore::JSWebGLRenderingContextBase::getExtension): Tweaked a bit. (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Removed unneeded exception handling. (WebCore::JSWebGLRenderingContextBase::getParameter): Ditto. (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Ditto. (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Ditto. (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Use a modern for loop. (WebCore::JSWebGLRenderingContextBase::getUniform): Removed unneeded exception handling. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::getContext): Pass a reference. (WebCore::HTMLCanvasElement::reset): Use is<CanvasRenderingContext2D>. (WebCore::HTMLCanvasElement::setUsesDisplayListDrawing): Ditto. (WebCore::HTMLCanvasElement::setTracksDisplayListReplay) Ditto.: (WebCore::HTMLCanvasElement::displayListAsText): Ditto. (WebCore::HTMLCanvasElement::replayDisplayListAsText): Ditto. (WebCore::HTMLCanvasElement::clearImageBuffer): Ditto. * html/canvas/CanvasGradient.cpp: (WebCore::CanvasGradient::CanvasGradient): Streamlined. (WebCore::CanvasGradient::addColorStop): Use ExceptionOr. * html/canvas/CanvasGradient.h: Updated for above changes. * html/canvas/CanvasGradient.idl: Use non-legacy exception. * html/canvas/CanvasPath.cpp: (WebCore::CanvasPath::arcTo): Use ExceptionOr. (WebCore::CanvasPath::arc): Ditto. (WebCore::CanvasPath::ellipse): Ditto. * html/canvas/CanvasPath.h: Updated for above changes. * html/canvas/CanvasPath.idl: Use non-legacy exceptions. * html/canvas/CanvasPattern.cpp: (WebCore::CanvasPattern::create): Use Ref&&. (WebCore::CanvasPattern::CanvasPattern): Ditto. (WebCore::CanvasPattern::parseRepetitionType): Return a boolean instead of using an ExceptionCode. * html/canvas/CanvasPattern.h: Updated for above changes. * html/canvas/CanvasRenderingContext.cpp: (CanvasRenderingContext::wouldTaintOrigin): Reordered function so that it's safe to call it on an image element without a cached image, or a cached image without an underlying image. * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D): Take a reference. (WebCore::CanvasRenderingContext2D::drawImage): Use ExceptionOr. (WebCore::CanvasRenderingContext2D::drawImageFromRect): Ditto. (WebCore::CanvasRenderingContext2D::createLinearGradient): Ditto. (WebCore::CanvasRenderingContext2D::createRadialGradient): Ditto. (WebCore::CanvasRenderingContext2D::createPattern): Ditto. (WebCore::CanvasRenderingContext2D::createImageData): Ditto. (WebCore::CanvasRenderingContext2D::getImageData): Ditto. (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD): Ditto. (WebCore::CanvasRenderingContext2D::putImageData): Removed unneeded ExceptionCode because this does not throw exceptions; the only one was for non-finite numeric values but this is now handled by bindings. (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Ditto. * html/canvas/CanvasRenderingContext2D.h: Updated for above. * html/canvas/CanvasRenderingContext2D.idl: Use non-legacy exceptions and removed exceptions entirely in other cases. * html/canvas/OESVertexArrayObject.cpp: (WebCore::OESVertexArrayObject::OESVertexArrayObject): Take a reference. (WebCore::OESVertexArrayObject::~OESVertexArrayObject): Deleted. (WebCore::OESVertexArrayObject::isVertexArrayOES): Use && instead of multiple return statements. (WebCore::OESVertexArrayObject::bindVertexArrayOES): Removed unneeded ExceptionCode since this does not throw an exception. * html/canvas/OESVertexArrayObject.h: Updated for above. * html/canvas/OESVertexArrayObject.idl: Removed unneeded exception. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter): Removed unneeded ExceptionCode since this does not throw an exception. (WebCore::WebGL2RenderingContext::texSubImage2DBase): Ditto. (WebCore::WebGL2RenderingContext::texSubImage2DImpl): Ditto. (WebCore::WebGL2RenderingContext::texSubImage2D): Removed unneeded ExceptionCode for some overloads, for the others, use ExceptionOr for the security exception. Moved security exception code here from the validate functions. (WebCore::WebGL2RenderingContext::validateTexFuncParameters): Removed unneeded ExceptionCode. (WebCore::WebGL2RenderingContext::getParameter): Ditto. * html/canvas/WebGL2RenderingContext.h: Updated for above. * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): Pass a reference. (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Remvoed unneeded ExceptionCode since this does not throw an exception. (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto. (WebCore::WebGLRenderingContext::texSubImage2DImpl): Ditto. (WebCore::WebGLRenderingContext::texSubImage2D): Removed unneeded ExceptionCode for some overloads, for the others, use ExceptionOr for the security exception. Moved security exception code here from the validate functions. (WebCore::WebGLRenderingContext::getParameter): Removed unneeded ExceptionCode. * html/canvas/WebGLRenderingContext.h: Updated for above changes. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImage2DBase): Remvoed unneeded ExceptionCode since this does not throw an exception. (WebCore::WebGLRenderingContextBase::texImage2DImpl): Ditto. (WebCore::WebGLRenderingContextBase::texImage2D): Removed unneeded ExceptionCode for some overloads, for the others, use ExceptionOr for the security exception. Moved security exception code here from the validate functions. (WebCore::WebGLRenderingContextBase::validateHTMLImageElement): Moved the security exception out of here to the call sites. (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement): Ditto. (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement): Ditto. * html/canvas/WebGLRenderingContextBase.h: Updated for above changes. * html/canvas/WebGLRenderingContextBase.idl: Use non-legacy exceptions in some cases and no exceptions at all in many others. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Use a reference instead of a pointer. * html/track/DataCue.h: Use pragma once. * html/track/DataCue.idl: Use non-legacy exception for constructor attribute, even though it is custom and so it has no effect. * html/track/InbandDataTextTrack.cpp: (WebCore::InbandDataTextTrack::create): Use RefPtr&&. (WebCore::InbandDataTextTrack::InbandDataTextTrack): Ditto. (WebCore::InbandDataTextTrack::addDataCue): Stop using ASSERT_NO_EXCEPTION. (WebCore::InbandDataTextTrack::removeDataCue): Stop using IGNORE_EXCEPTION. (WebCore::InbandDataTextTrack::removeCue): Use ExceptionOr. Also use remove instead of find/remove. * html/track/InbandDataTextTrack.h: Updated for above changes. * html/track/InbandGenericTextTrack.cpp: (WebCore::GenericTextTrackCueMap::GenericTextTrackCueMap): Deleted. (WebCore::GenericTextTrackCueMap::~GenericTextTrackCueMap): Deleted. (WebCore::GenericTextTrackCueMap::add): Take references intead of pointers. (WebCore::GenericTextTrackCueMap::find): Ditto. Also use get instead of find. (WebCore::GenericTextTrackCueMap::remove): Ditto. Also use take instead of double hashing to both find and remove. (WebCore::InbandGenericTextTrack::updateCueFromCueData): Stop using IGNORE_EXCEPTION. Also got rid of code that is converting a double to a long and then back to a double by using lround. Instead just use std::round, which keeps it a double. But also, why does this need to round?! (WebCore::InbandGenericTextTrack::addGenericCue): Updated to use reference to work with m_cueMap. (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto. (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto. (WebCore::InbandGenericTextTrack::removeCue): Use ExceptionOr. (WebCore::InbandGenericTextTrack::newCuesParsed): Removed ASSERT_NO_EXCEPTION. * html/track/InbandGenericTextTrack.h: Updated for above changes. * html/track/InbandWebVTTTextTrack.cpp: (WebCore::InbandWebVTTTextTrack::newCuesParsed): Removed ASSERT_NO_EXCEPTION. * html/track/TextTrack.cpp: (WebCore::TextTrack::addCue): Use ExcepctionOr. (WebCore::TextTrack::removeCue): Ditto. (WebCore::TextTrack::addRegion): Ditto. (WebCore::TextTrack::removeRegion): Ditto. * html/track/TextTrack.h: Updated for above changes. * html/track/TextTrack.idl: Ditto. * html/track/TextTrackCue.cpp: (WebCore::TextTrackCue::cueShadowPseudoId): Moved this here since it does not need to be inlined in the header. (WebCore::TextTrackCue::~TextTrackCue): Deleted. (WebCore::TextTrackCue::setStartTime): Removed ExceptionCode& since the exceptions were for non-finite values, but this is now handled by the bindings. (WebCore::TextTrackCue::setEndTime): Ditto. * html/track/TextTrackCue.h: Updated for the above. * html/track/TextTrackCue.idl: Removed SetterMayThrowLegacyException and made startTime and endTime be double rather than unrestricted double. * html/track/TextTrackCueGeneric.cpp: (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Use a reference instead of a pointer. (WebCore::TextTrackCueGeneric::TextTrackCueGeneric): Initialize m_defaultPosition in the class definition instead of here. (WebCore::TextTrackCueGeneric::createDisplayTree): Return a Ref. (WebCore::TextTrackCueGeneric::setLine): Use ExceptionOr. (WebCore::TextTrackCueGeneric::setPosition): Ditto. (WebCore::TextTrackCueGeneric::setFontSize): Updated since displayTreeInternal() now returns a reference. * html/track/TextTrackCueGeneric.h: Updated for above changes. Also fixed some arguument types and made some more things private. * html/track/VTTCue.cpp: (WebCore::VTTCue::createDisplayTree): Return a Ref. (WebCore::VTTCue::displayTreeInternal): Return a reference. (WebCore::VTTCue::setVertical): Use ExceptionOr. (WebCore::VTTCue::setLine): Ditto. (WebCore::VTTCue::setPosition): Ditto. (WebCore::VTTCue::setSize): Ditto. (WebCore::VTTCue::setAlign): Ditto. (WebCore::VTTCue::getDisplayTree): Return a reference. (WebCore::VTTCue::removeDisplayTree): Updated since displayTreeInternal returns a reference. (WebCore::VTTCue::setFontSize): Ditto. * html/track/VTTCue.h: Updated for the above. * html/track/VTTCue.idl: Use non-legacy exceptions and also restricted doubles. * html/track/VTTRegion.cpp: (WebCore::VTTRegion::VTTRegion): Moved default values all into the class definition. (WebCore::VTTRegion::setWidth): Removed the check for non-finite since the bindings now handle that. Use ExcpetionOr. (WebCore::VTTRegion::setHeight): Ditto. (WebCore::VTTRegion::setRegionAnchorX): Ditto. (WebCore::VTTRegion::setRegionAnchorY): Ditto. (WebCore::VTTRegion::setViewportAnchorX): Ditto. (WebCore::VTTRegion::setViewportAnchorY): Ditto. (WebCore::upKeyword): Added. Shared by the code below. (WebCore::VTTRegion::scroll): Rewrote to be simpler. (WebCore::VTTRegion::setScroll): Rewrote to be simpler. (WebCore::VTTRegion::updateParametersFromRegion): Read and write data members directly to avoid awkward code that is otherwise required just to copy from one object to the other. Also take a const& instead of a pointer for the thing to update from. (WebCore::VTTRegion::parseSettingValue): Use upKeyword. (WebCore::VTTRegion::appendTextTrackCueBox): Take a Ref&&. (WebCore::VTTRegion::getDisplayTree): Do the downcast to Document here instead of using the helper function. (WebCore::VTTRegion::prepareRegionDisplayTree): Ditto. * html/track/VTTRegion.h: Updated for the above. * html/track/VTTRegion.idl: Use non-legacy exceptions and also use restricted dobules, not unrestricted. 2016-10-22 Chris Dumez <cdumez@apple.com> WebGLRenderingContextBase.texImage2D() should use a union instead of overloading https://bugs.webkit.org/show_bug.cgi?id=163856 Reviewed by Darin Adler. WebGLRenderingContextBase.texImage2D() should use a union instead of overloading: - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImage2D): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2016-10-22 Antti Koivisto <antti@apple.com> REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20% https://bugs.webkit.org/show_bug.cgi?id=163851 Reviewed by Darin Adler. The test calls Scope::flushPendingUpdate a lot and nothing ever happens there. Add a separate invalidity bit for descendant scopes and inline the fast path. * style/StyleScope.cpp: (WebCore::Style::Scope::flushPendingSelfUpdate): (WebCore::Style::Scope::flushPendingDescendantUpdates): (WebCore::Style::Scope::scheduleUpdate): (WebCore::Style::Scope::flushPendingUpdate): Deleted. * style/StyleScope.h: (WebCore::Style::Scope::hasPendingUpdate): (WebCore::Style::Scope::flushPendingUpdate): 2016-10-22 Darin Adler <darin@apple.com> Move SVG from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163837 Reviewed by Chris Dumez. * WebCore.xcodeproj/project.pbxproj: Added SVGGraphicsElement.idl. * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): Use toJSNumber. (WebCore::JSSVGLength::setValue): Use propagateException. (WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Properly handle SetterMayThrowException in the special case for SVG setters. * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialBaselineShiftValue): Removed ASSERT_NO_EXCEPTION, no longer needed. (WebCore::SVGRenderStyle::initialKerning): Ditto. * svg/SVGAltGlyphElement.cpp: (WebCore::SVGAltGlyphElement::setGlyphRef): Use ExceptionOr. (WebCore::SVGAltGlyphElement::setFormat): Ditto. (WebCore::SVGAltGlyphElement::hasValidGlyphElements): Tweaked a bit. * svg/SVGAltGlyphElement.h: Updated for above changes. * svg/SVGAltGlyphElement.idl: Use non-legacy exceptions. * svg/SVGAngle.cpp: (WebCore::SVGAngle::valueAsString): Removed unneeded String globals. (WebCore::parseAngleType): Rewrote to be simpler and more direct. (WebCore::SVGAngle::setValueAsString): Use ExceptionOr. (WebCore::SVGAngle::newValueSpecifiedUnits): Ditto. (WebCore::SVGAngle::convertToSpecifiedUnits): Ditto. * svg/SVGAngle.h: Updated for above changes. Initialized data members here in the class definite and removed constructor; default now works. * svg/SVGAngle.idl: Use non-legacy exceptions. * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::calculateAnimatedValue): Update since CalcMode is now an enum class. * svg/SVGAnimateMotionElement.cpp: (WebCore::SVGAnimateMotionElement::SVGAnimateMotionElement): Ditto. * svg/SVGAnimateTransformElement.cpp: (WebCore::SVGAnimateTransformElement::hasValidAttributeType): Update since AttributeType is now an enum class. * svg/SVGAnimatedAngle.cpp: (WebCore::SVGAnimatedAngleAnimator::calculateDistance): Removed ASSERT_NO_EXCEPTION, no longer needed. * svg/SVGAnimatedBoolean.idl: Use non-legacy exception. * svg/SVGAnimatedEnumeration.idl: Ditto. * svg/SVGAnimatedInteger.idl: Ditto. * svg/SVGAnimatedLength.cpp: (WebCore::sharedSVGLength): Deleted. (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): Removed ASSERT_NO_EXCEPTION, no longer needed. (WebCore::parseLengthFromString): Ditto. Also rewrote to not use a shared SVGLength; no benefit to doing that. (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): Ditto. (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedNumber.idl: Use non-legacy exception. * svg/SVGAnimatedString.idl: Ditto. * svg/SVGAnimatedType.cpp: (WebCore::SVGAnimatedType::setValueAsString): Updated since setValueAsString now uses ExceptionOr. * svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::SVGAnimationElement): Initialized scalars in the class definition instead of here. (WebCore::SVGAnimationElement::getSimpleDuration): Removed uneeded ExceptionCode&. (WebCore::SVGAnimationElement::setCalcMode): Updated since CalcMode is now an enum class. (WebCore::SVGAnimationElement::setAttributeType): Updated since AttributeType is now an enum class. (WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto. (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced): Ditto. (WebCore::SVGAnimationElement::calculatePercentForSpline): Ditto. (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): Ditto. (WebCore::SVGAnimationElement::calculatePercentForFromTo): Ditto. (WebCore::SVGAnimationElement::currentValuesFromKeyPoints): Ditto. (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): Ditto. (WebCore::SVGAnimationElement::startedActiveInterval): Ditto. (WebCore::SVGAnimationElement::updateAnimation): Ditto. (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Ditto. * svg/SVGAnimationElement.h: Changed CalcMode into an enum class. Updated for above changes. * svg/SVGAnimationElement.idl: Removed MayThrowLegacyException from getSimpleDuration. * svg/SVGColor.cpp: (WebCore::SVGColor::SVGColor): Updated to take scalar in the straightforward manner instead of constt SVGColorType&. (WebCore::SVGColor::setRGBColor): Use ExceptionOr. (WebCore::SVGColor::setRGBColorICCColor): Ditto. (WebCore::SVGColor::setColor): Ditto. * svg/SVGColor.h: Updated for above changes. Removed unneeded destructor. * svg/SVGColor.idl: Use non-legacy exceptions. * svg/SVGGlyphRefElement.cpp: (WebCore::SVGGlyphRefElement::SVGGlyphRefElement): Initialize data members in class definition, not here. (WebCore::parseFloat): Added helper. Used in parseAttribute. (WebCore::SVGGlyphRefElement::parseAttribute): Updated to use parseFloat helper. (WebCore::SVGGlyphRefElement::glyphRef): Deleted. (WebCore::SVGGlyphRefElement::setGlyphRef): Deleted. (WebCore::SVGGlyphRefElement::setX): Removed unused Exception& argument. (WebCore::SVGGlyphRefElement::setY): Ditto. (WebCore::SVGGlyphRefElement::setDx): Ditto. (WebCore::SVGGlyphRefElement::setDy): Ditto. * svg/SVGGlyphRefElement.h: Updated for above changes. * svg/SVGGlyphRefElement.idl: Use Reflect on glyphRef. Removed incorrect SetterMayThrowLegacyException attributes for x, y, dx, and dy. Longer term it might be nice to use [Reflect] on these too. * svg/SVGGraphicsElement.idl: Use non-legacy exception. * svg/SVGLength.cpp: (WebCore::parseLengthType): Changed argument type since caller does not need to know how many characters are consumed. (WebCore::SVGLength::SVGLength): Removed IGNORE_EXCEPTION and ASSERT_NO_EXCEPTION. Also removed the copy constructor, letting the compiler generate the default. (WebCore::SVGLength::setValueAsString): Use ExceptionOr. (WebCore::SVGLength::construct): Updated since setValueAsString uses ExceptionOr. (WebCore::SVGLength::value): Ditto. (WebCore::SVGLength::valueForBindings): Use ExceptionOr. Also renamed to disambiguate with the version used outside of bindings. (WebCore::SVGLength::setValue): Use ExceptionOr. (WebCore::SVGLength::newValueSpecifiedUnits): Ditto. (WebCore::SVGLength::convertToSpecifiedUnits): Ditto. (WebCore::SVGLength::fromCSSPrimitiveValue): Updated since newValueSpecifiedUnits uses ExceptionOr. (WebCore::SVGLength::lengthModeForAnimatedLengthAttribute): Rewrote map generation code to be more efficient and not unrolled. Only do one hash table lookup. * svg/SVGLength.h: Updated for above changes. * svg/SVGLength.idl: Use non-legacy exceptions. * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::valueForLength): Update since function uses ExceptionOr. (WebCore::SVGLengthContext::convertValueToUserUnits): Use ExceptionOr. (WebCore::SVGLengthContext::convertValueFromUserUnits): Ditto. (WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage): Ditto. (WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits): Ditto. (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS): Ditto. (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits): Ditto. (WebCore::SVGLengthContext::convertValueFromUserUnitsToEXS): Ditto. (WebCore::SVGLengthContext::convertValueFromEXSToUserUnits): Ditto. * svg/SVGLengthContext.h: Updatedfor above changes. * svg/SVGLengthList.cpp: (WebCore::SVGLengthList::parse): Updated since setValueAsString uses ExceptionOr now. * svg/SVGLengthList.h: Removed unneeded constructor. * svg/SVGLengthList.idl: Use non-legacy exceptions. * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): Use ExceptionOr. * svg/SVGLocatable.h: Updated for above change. * svg/SVGMarkerElement.h: (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Updated since setValueAsString uses ExceptionOr now. * svg/SVGMatrix.h: Use ExceptionOr. * svg/SVGMatrix.idl: Use non-legacy exceptions. * svg/SVGNumberList.h: Removed unneeded constructor. * svg/SVGNumberList.idl: Use non-legacy exceptions. * svg/SVGPaint.cpp: (WebCore::SVGPaint::setPaint): Use ExceptionOr. * svg/SVGPaint.h: Updated for above chagne. * svg/SVGPaint.idl: Use non-legacy exception. * svg/SVGPathSegList.h: Tweaked a bit. * svg/SVGPathSegList.idl: Use non-legacy exceptions. * svg/SVGPointList.h: Removed unneeded constructor. * svg/SVGPointList.idl: Use non-legacy exceptions. * svg/SVGPreserveAspectRatio.cpp: (WebCore::SVGPreserveAspectRatio::setAlign): Use ExceptionOr. (WebCore::SVGPreserveAspectRatio::setMeetOrSlice): Ditto. * svg/SVGPreserveAspectRatio.h: Updated for above changes. * svg/SVGPreserveAspectRatio.idl: Use non-legacy exceptions. * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::currentView): Pass a reference. * svg/SVGStringList.h: Tweaked a bit. * svg/SVGStringList.idl: Use non-legacy exceptions. * svg/SVGStyleElement.cpp: (WebCore::SVGStyleElement::setType): Removed unneeded ExceptionCode&. (WebCore::SVGStyleElement::setMedia): Ditto. (WebCore::SVGStyleElement::setTitle): Deleted. * svg/SVGStyleElement.h: Updated for above changes, and made the title function override be private. * svg/SVGStyleElement.idl: Use Reflect for title. Removed unneeded SetterMayThrowLegacyException on all attributes. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::textLengthAnimated): Removed ASSERT_NO_EXCEPTION, won't work any more. (WebCore::SVGTextContentElement::getSubStringLength): Use ExceptionOr. Also remove redundant call to updateLayoutIgnorePendingStylesheets, called by getNumberOfChars. (WebCore::SVGTextContentElement::getStartPositionOfChar): Ditto. (WebCore::SVGTextContentElement::getEndPositionOfChar): Ditto. (WebCore::SVGTextContentElement::getExtentOfChar): Ditto. (WebCore::SVGTextContentElement::getRotationOfChar): Ditto. (WebCore::SVGTextContentElement::selectSubString): Ditto. * svg/SVGTextContentElement.h: Updated for above changes. * svg/SVGTextContentElement.idl: Use non-legacy exceptions. * svg/SVGTransformList.h: Removed unneeded constructor. * svg/SVGTransformList.idl: Use non-legacy exceptions. * svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::SVGViewSpec): Updated to take a reference. (WebCore::SVGViewSpec::setZoomAndPan): Use ExceptionOr. (WebCore::SVGViewSpec::setTransformString): Deleted. (WebCore::SVGViewSpec::viewBoxString): Use m_viewBox directly. (WebCore::SVGViewSpec::preserveAspectRatioString): Use m_preserveAspectRatio directly. (WebCore::SVGViewSpec::viewTarget): Use is<SVGElement>. (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Use m_contextElement directly. (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper): Ditto. (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Ditto. (WebCore::SVGViewSpec::parseViewSpec): Set m_viewTargetString directly. * svg/SVGViewSpec.h: Updated for above changes. Removed unneeded virtual destructor, unneeded using for ref/deref, unused functions including setTransformString, setViewTargetString, non-exception setZoomAndPan, contextElement, viewBoxBaseValue, and preserveAspectRatioBaseValue. * svg/SVGViewSpec.idl: Use non-legacy exceptions. Also specify ImplementationLacksVTable. * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h: Use ExceptionOr. * svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto. * svg/properties/SVGListProperty.h: Ditto. * svg/properties/SVGListPropertyTearOff.h: Ditto. * svg/properties/SVGPathSegListPropertyTearOff.cpp: (WebCore::SVGPathSegListPropertyTearOff::clear): Ditto. (WebCore::SVGPathSegListPropertyTearOff::getItem): Ditto. (WebCore::SVGPathSegListPropertyTearOff::replaceItem): Ditto. (WebCore::SVGPathSegListPropertyTearOff::removeItem): Ditto. * svg/properties/SVGPathSegListPropertyTearOff.h: Ditto. * svg/properties/SVGPropertyTearOff.h: Ditto. Also added an overload of create that knows how to deal with exceptions. * svg/properties/SVGStaticListPropertyTearOff.h: Ditto. * svg/properties/SVGTransformListPropertyTearOff.h: Ditto. 2016-10-22 Chris Dumez <cdumez@apple.com> WebGLRenderingContextBase.bufferData() should use a union instead of overloading https://bugs.webkit.org/show_bug.cgi?id=163795 Reviewed by Darin Adler. WebGLRenderingContextBase.bufferData() / bufferSubData() should use a union instead of overloading: - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 No new tests, no web-exposed behavior change. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLInterface<T>>::convert): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): * bindings/scripts/test/JS/JSInterfaceName.h: * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestCEReactions.h: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h: * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: * bindings/scripts/test/JS/JSTestEventConstructor.h: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestException.h: * bindings/scripts/test/JS/JSTestGenerateIsReachable.h: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestInterface.h: * bindings/scripts/test/JS/JSTestIterable.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.h: * bindings/scripts/test/JS/JSTestNamedConstructor.h: * bindings/scripts/test/JS/JSTestNode.h: * bindings/scripts/test/JS/JSTestNondeterministic.h: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverloadedConstructors.h: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestSerialization.h: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.h: * bindings/scripts/test/JS/JSattribute.h: * bindings/scripts/test/JS/JSreadonly.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::bufferData): (WebCore::WebGL2RenderingContext::bufferSubData): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::bufferData): (WebCore::WebGLRenderingContextBase::bufferSubData): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2016-10-22 Darin Adler <darin@apple.com> [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (seen in multiple apps using legacy WebKit) https://bugs.webkit.org/show_bug.cgi?id=163839 Reviewed by Dan Bernstein. * editing/cocoa/EditorCocoa.mm: Use the appropriate SOFT_LINK macros to find the WebKitLegacy platform in the correct location for iOS and macOS. 2016-10-22 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr> Bindings error message for missing required dictionary member should be more explicit https://bugs.webkit.org/show_bug.cgi?id=163665 Reviewed by Darin Adler. Add throwRequiredMemberTypeError function to throw a TypeError exception with an error message indicating the missing required member. No new test required, rebase existing tests. * bindings/js/JSDOMBinding.cpp: (WebCore::throwRequiredMemberTypeError): * bindings/js/JSDOMBinding.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): 2016-10-22 Ryosuke Niwa <rniwa@webkit.org> Upgrading custom element should enqueue attributeChanged and connected callbacks https://bugs.webkit.org/show_bug.cgi?id=163840 Reviewed by Darin Adler. When upgrading a custom element, enqueue attributeChanged and connectedCallbacks as needed as specified in step 3 and 4 of: https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element Test: fast/custom-elements/upgrading-enqueue-reactions.html * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::upgradeElement): Enqueue * dom/CustomElementReactionQueue.cpp: (WebCore::CustomElementReactionQueueItem::invoke): Don't invoke callbacks when the custom element had failed to upgrade. (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Added. (WebCore::CustomElementReactionQueue::invokeAll): Upgrading a custom element may enqueue more reactions. Keep invoking reactions until the queue becomes empty. * dom/CustomElementReactionQueue.h: * dom/Range.idl: Added a forgotten CEReactions here. 2016-10-21 David Kilzer <ddkilzer@apple.com> Bug 163762: IntSize::area() should used checked arithmetic <https://webkit.org/b/163762> Reviewed by Darin Adler. No new tests since no change in nominal behavior. * platform/graphics/IntSize.h: (WebCore::IntSize::area): Change to return a Checked<unsigned, T> value. Use WTF:: namespace to avoid including another header. * platform/graphics/IntRect.h: (WebCore::IntRect::area): Ditto. The remaining changes are to use the Checked<unsigned> return value of IntSize::area() and IntRect::area() correctly in context, in addition to items noted below. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::isTopLevelFullPagePlugin): Declare contentWidth and contentHeight as float values to prevent overflow when computing the area, and to make the inequality comparison in the return statement uses the same type for both sides. * html/ImageData.cpp: (WebCore::ImageData::ImageData): * html/MediaElementSession.cpp: (WebCore::isElementRectMostlyInMainFrame): * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::setSize): Restructure logic to compute area only once. (WebCore::ImageBackingStore::clear): * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::frameBytes): * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::maximumSubsamplingLevel): * platform/graphics/ca/LayerPool.cpp: (WebCore::LayerPool::backingStoreBytesForSize): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoder::frameBytesAtIndex): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::platformApplySoftware): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::getData): Update overflow check, rename local variable to numBytes, and compute numBytes once. * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::frameBytesAtIndex): * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::frameBytesAtIndex): * platform/ios/LegacyTileLayerPool.mm: (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForCanvas): * rendering/shapes/Shape.cpp: (WebCore::Shape::createRasterShape): 2016-10-21 Gavin Barraclough <barraclough@apple.com> WebPageProxy should not need PageActivityState https://bugs.webkit.org/show_bug.cgi?id=163821 Reviewed by Geoff Garen. The PageActivityState is currently plumbed back from WebCore up to the UI process, to determine whether to enabled process suppression. However the information it contains (whether a page load is ongoing, whether audio is playing) is already available via other means. Remove this use of PageActivityState. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaState): - Fix a bug in how we compute IsPlayingAudio - if the volume of the MediaElement is set to zero, then audio is not playing (we were already checking muted). * page/ChromeClient.h: - removed setPageActivityState * page/Page.cpp: (WebCore::Page::setPageActivityState): Deleted. - setPageActivityState -> pageActivityStateChanged, remove call to ChromeClient * page/Page.h: (WebCore::Page::pageActivityStateChanged): - setPageActivityState -> pageActivityStateChanged * page/PageThrottler.cpp: (WebCore::PageThrottler::setActivityFlag): - setPageActivityState -> pageActivityStateChanged 2016-10-21 Chris Dumez <cdumez@apple.com> [Web ID] Overload resolution is wrong if one of the types is a nullable union https://bugs.webkit.org/show_bug.cgi?id=163816 Reviewed by Alex Christensen. Overload resolution was wrong if one of the types was a nullable union. This is because we never considered the union type itself, only its subtypes. Therefore, we checked if any of the union's subtypes were nullable but we failed to check if the union itself was nullable. See: - https://heycam.github.io/webidl/#es-overloads (Step 11.3.) No new tests, extended bindings tests. * bindings/scripts/CodeGeneratorJS.pm: (GetOverloadThatMatchesIgnoringUnionSubtypes): (GenerateOverloadedFunctionOrConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1Caller): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2Caller): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Caller): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2Caller): (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion): * bindings/scripts/test/TestObj.idl: 2016-10-21 Eric Carlson <eric.carlson@apple.com> [MediaStream] Dynamically generate media capture sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=154861 <rdar://problem/24909411> Reviewed by Tim Horton. No new tests, some of these changes are covered by existing tests and some can only be tested with physical capture devices. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: AVSampleBufferAudioRenderer and AVSampleBufferRenderSynchronizer are now declared in AVFoundationSPI.h. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Initialize AVSampleBufferRenderSynchronizer. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Fail if AVSampleBufferRenderSynchronizer isn't available. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Take a MediaSample& instead of a PlatformSample&. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Add the sample buffer display later to the synchronizer. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Remove the sample buffer display later from the synchronizer. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start the synchronizer. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Stash the current clock time in m_pausedTime, but leave the clock running. Pause the synchronizer. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime): Return the clock time when playing, m_pausedTime time when paused because we leave the clock running forever. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: AVSampleBufferAudioRenderer is now declared in AVFoundationSPI.h. * platform/spi/mac/AVFoundationSPI.h: Add AVSampleBufferAudioRenderer and AVSampleBufferRenderSynchronizer. 2016-10-21 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r207582. https://bugs.webkit.org/show_bug.cgi?id=163819 Not quite ready rdar://problem/28897179 (Requested by alexchristensen on #webkit). Reverted changeset: "Re-enable URLParser for non-Safari Cocoa apps after r207321" https://bugs.webkit.org/show_bug.cgi?id=163690 http://trac.webkit.org/changeset/207582 2016-10-21 Gavin Barraclough <barraclough@apple.com> WebPage should take UserActivity directly for user input https://bugs.webkit.org/show_bug.cgi?id=163813 Reviewed by Anders Carlsson. When we receive mouse/keyboard events in a page, we want to prevent AppNap. We currently do so via the PageThrottler. This patch is to just make the WebPage drive the UserActivity directly. Two reasons to do so: (1) to cleanup & simplify for further refactoring. (2) The current code isn't really achieving the desired effect. The page setting the flag in the throttler to get the activity to be set is now a less effective way of achieving this goal, since the PageActivityState bounces back across to the UI process & then messages back to the WebContent process to take the UserActivity. These extra hops defeat the purpose of making sure the boost from the initial message isn't lost. * page/PageThrottler.cpp: (WebCore::PageThrottler::PageThrottler): (WebCore::m_userInputHysteresis): Deleted. * page/PageThrottler.h: (WebCore::PageThrottler::didReceiveUserInput): Deleted. - removed PageActivityState::UserInputActivity, didReceiveUserInput, m_userInputHysteresis. 2016-10-21 Wenson Hsieh <wenson_hsieh@apple.com> Support (insertFrom|deleteBy)Composition and (insert|delete)CompositionText inputTypes for InputEvents https://bugs.webkit.org/show_bug.cgi?id=163460 <rdar://problem/28784142> Reviewed by Darin Adler. Adds basic support for the composition inputTypes in the InputEvent spec. See w3.org/TR/input-events, github.com/w3c/input-events/issues/41 and github.com/w3c/input-events/issues/42 for more details. While input events are fired in the correct order with respect to each other, additional work will be required to ensure that input events are fired in the correct order with respect to composition(start|update|end) events and textInput events. This is held off until the expected ordering of events is officially defined in the spec. Tests: fast/events/before-input-events-prevent-insert-composition.html fast/events/before-input-events-prevent-recomposition.html fast/events/input-events-ime-composition.html fast/events/input-events-ime-recomposition.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::apply): * editing/CompositeEditCommand.h: (WebCore::CompositeEditCommand::isBeforeInputEventCancelable): Adds a new virtual method hook for subclasses to mark their `beforeinput` events as non-cancelable (see TypingCommand::isBeforeInputEventCancelable). By default, `beforeinput` events are cancelable. * editing/EditAction.h: Adds 4 new EditActions corresponding to the 4 composition-related inputTypes. These are: EditActionTypingDeletePendingComposition => "deleteCompositionText" EditActionTypingDeleteFinalComposition => "deleteByComposition" EditActionTypingInsertPendingComposition => "insertCompositionText" EditActionTypingInsertFinalComposition => "insertFromComposition" * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): * editing/Editor.cpp: (WebCore::dispatchBeforeInputEvent): (WebCore::dispatchBeforeInputEvents): (WebCore::Editor::willApplyEditing): (WebCore::Editor::insertTextWithoutSendingTextEvent): (WebCore::Editor::setComposition): In setComposition(text, mode), tweak the logic for committing a composition to always delete the selection before inserting the final composition text. In setComposition(text, underlines, start, end), catch the case where we're beginning to recompose an existing range in the DOM and delete the recomposed text first. * editing/TypingCommand.cpp: (WebCore::editActionForTypingCommand): (WebCore::TypingCommand::TypingCommand): (WebCore::TypingCommand::deleteSelection): Adds a TextCompositionType parameter so that call sites (see Editor::setComposition) can indicate what state the edited composition is in. This allows us to differentiate between deletion of finalized composition text in preparation of recomposing a range in the DOM, and deletion of composition text that has not yet been committed in preparation for inserting a finalized composition into the DOM. (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::forwardDeleteKeyPressed): (WebCore::TypingCommand::insertText): (WebCore::TypingCommand::insertLineBreak): (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent): (WebCore::TypingCommand::insertParagraphSeparator): (WebCore::TypingCommand::isBeforeInputEventCancelable): (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::willAddTypingToOpenCommand): * editing/TypingCommand.h: 2016-10-21 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure shadow user agent sheets parse in UASheetMode https://bugs.webkit.org/show_bug.cgi?id=163810 Reviewed by Dean Jackson. * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForElement): (WebCore::makeInlineStyleSheetCacheKey): (WebCore::InlineStyleSheetOwner::createSheet): (WebCore::parserContextForForElement): Deleted. 2016-10-21 Jer Noble <jer.noble@apple.com> YouTube stalls when seeking beyond buffered range https://bugs.webkit.org/show_bug.cgi?id=162813 Reviewed by Eric Carlson. When seeking a MediaPlayerPrivateMediaSourceAVFObjC, we will first seek the AVSampleBufferRenderSynchronizer, flush and enqueue non-displaying frames, enqueue regular frames, then begin playback. The above stall will occur when we enqueue so many non- displaying frames that the display layer is not ready for normal ones before playback begins. Then, when the synchronizer attempts to synchronize the enqueued audio and video renderers, the only available samples are back at the original media time, and so it "seeks" by updating the CMTimebase back to the original media time, causing playback to appear "stalled". The overall solution is to "flush" the contents of the renderers before the seek, so that the synchronizer doesn't reset the currentTime, and to only restart the synchronizer when there are visible (or audible) samples available for display. Breaking the fix down into sections: = Don't enqueue too many non-displaying samples at once: - Rename SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples() to SourceBufferPrivate::flush(), and no longer pass in an array of non-displaying samples. - Add a new virtual method to MediaSample, createNonDisplayingCopy(), used by SourceBuffer to enqueue non-displaying samples. - in SourceBuffer::reenqueueMediaForTime(), use that new createNonDisplayingCopy() method to enqueue non-displaying samples in the same queue as regular samples. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::provideMediaData): (WebCore::SourceBuffer::reenqueueMediaForTime): * platform/MediaSample.h: (WebCore::MediaSample::isNonDisplaying): * platform/graphics/SourceBufferPrivate.h: (WebCore::SourceBufferPrivate::flush): (WebCore::SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples): Renamed -> flush(). * platform/graphics/avfoundation/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::CMSampleBufferIsNonDisplaying): (WebCore::MediaSampleAVFObjC::flags): (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::SourceBufferPrivateAVFObjC::willSeek): (WebCore::createNonDisplayingCopy): Moved to MediaSampleAVFObjC. (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples): Renamed -> flush(). * platform/mock/mediasource/MockBox.h: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: (WebCore::MockMediaSample::flags): (WebCore::MockMediaSample::createNonDisplayingCopy): * platform/mock/mediasource/MockSourceBufferPrivate.h: = Don't start playing until all renderers have visible/audible samples: - SourceBufferPrivateAVFObjC will notify its associated MediaPlayerPrivateMediaSourceAVFObjC when it flushes and receives visible/audible samples. - The MediaPlayer will store audio renderers as keys to a HashMap which allows it to track which have available samples. - This requires changing all the places where we loop over the available renderers. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): (WebCore::SourceBufferPrivateAVFObjC::flush): (WebCore::SourceBufferPrivateAVFObjC::willSeek): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::allRenderersHaveAvailableSamples): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): Deleted. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldBePlaying): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal): * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h: * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::willSeek): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: = Don't display new samples mid-seek. - MediaSource should clear its m_pendingSeekTime ivar, which is used whyn SourceBuffer queries whether or not a seek is pending, when instructing its SourceBuffers to seekToTime(). - This allows SourceBuffer to decline to enqueue new samples during a MediaSource seek operation. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::completeSeek): 2016-10-20 Dean Jackson <dino@apple.com> SVG should not paint selection within a mask https://bugs.webkit.org/show_bug.cgi?id=163772 <rdar://problem/28705129> Reviewed by Simon Fraser. When masking content, we shouldn't paint the text selection as we are rendering into the masking offscreen buffer. Test: svg/masking/mask-should-not-paint-selection.html * rendering/PaintPhase.h: Add a new behavior - PaintBehaviorSkipSelectionHighlight. * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paint): Don't update the selectionStyle if PaintBehaviorSkipSelectionHighlight is true. * rendering/svg/SVGRenderingContext.cpp: (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Add PaintBehaviorSkipSelectionHighlight to the PaintInfo. 2016-10-21 Chris Dumez <cdumez@apple.com> [Web IDL] MediaControlsHost has invalid operation overloads https://bugs.webkit.org/show_bug.cgi?id=163793 Reviewed by Darin Adler. MediaControlsHost has invalid operation overloads: - sortedTrackListForMenu() - displayNameForTrack() The parameter is nullable for both overloads which is not valid IDL. - sortedTrackListForMenu(): The parameter is no longer nullable. This is a minor behavior change and it should be safe since this is Apple-specific and only called from mediaControlsApple.js which uses HTMLMediaElement.videoTracks and HTMLMediaElement.audioTracks as input, both of which are not nullable. Note that we could have also kept one of the parameters as nullable to not change behavior but allowing null does not seem useful here. - displayNameForTrack(): Use a union instead of overloading, no behavior change. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::sortedTrackListForMenu): (WebCore::MediaControlsHost::displayNameForTrack): * Modules/mediacontrols/MediaControlsHost.h: * Modules/mediacontrols/MediaControlsHost.idl: 2016-10-21 Jeremy Jones <jeremyj@apple.com> Implement basic pointer lock behavior for WebKit and WebKit2. https://bugs.webkit.org/show_bug.cgi?id=162745 Reviewed by Simon Fraser. When ENABLE_POINTER_LOCK is enabled, these tests now pass with DumpRenderTree. LayoutTests/pointer-lock/lock-already-locked.html LayoutTests/pointer-lock/lock-element-not-in-dom.html LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html LayoutTests/pointer-lock/mouse-event-api.html Export pointer lock symbols and cancel pointer lock on "escape". * dom/Document.h: Export symbols. * dom/Element.h: Export symbols. * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): Cancel pointer lock on "escape". * page/PointerLockController.cpp: Add missing include. * page/PointerLockController.h: Export symbols. 2016-10-21 Jer Noble <jer.noble@apple.com> WebCore::PlatformMediaSession::stopSession + 13 https://bugs.webkit.org/show_bug.cgi?id=163799 Reviewed by Eric Carlson. Because m_sessions can be mutated by removeSession() while iterating over m_sessions, and because PlatformMediaSessions are not refcounted, it is not enough to copy m_sessions into a copied Vector before iterating. Instead, wrap iteration of m_sessions in a convenience function, which sets an iteration counter which, when cleared, removes all null entries from m_session. In parallel, modify removeSession() to check this iteration counter, and replace the session with a null value rather than mutating the m_sessions vector itself. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::has): (WebCore::PlatformMediaSessionManager::activeAudioSessionRequired): (WebCore::PlatformMediaSessionManager::canProduceAudio): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::currentSessionsMatching): (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground): (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground): (WebCore::PlatformMediaSessionManager::systemWillSleep): (WebCore::PlatformMediaSessionManager::systemDidWake): (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument): (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess): (WebCore::PlatformMediaSessionManager::forEachSession): (WebCore::PlatformMediaSessionManager::anyOfSessions): * platform/audio/PlatformMediaSessionManager.h: 2016-10-21 Darin Adler <darin@apple.com> Move some more assorted classes from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163775 Reviewed by Chris Dumez. * Modules/fetch/WorkerGlobalScopeFetch.cpp: (WebCore::WorkerGlobalScopeFetch::fetch): Remove unnecessary calls to WorkerGlobalScope::scriptExcutionObject, which just returns the scope itself. * Modules/notifications/Notification.cpp: Added now-needed include. * Modules/webdatabase/DOMWindowWebDatabase.cpp: Ditto. * WebCore.xcodeproj/project.pbxproj: Added WindowOrWorkerGlobalScope.idl. * bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp: (WebCore::JSDedicatedWorkerGlobalScope::postMessage): Pass a reference instead of a pointer to handlePostMessage. * bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::postMessage): Ditto. * bindings/js/JSMessagePortCustom.h: Use pragma once. Change handlePostMessage to take a reference to the object instead of a pointer, and also to use propagateException since postMessage now uses ExceptionOr. * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorker::postMessage): Pass a reference instead of a pointer to handlePostMessage. (WebCore::constructJSWorker): Use the version of toJSNewlyCreated that handles propagating an exception from ExceptionOr. * bindings/js/JSWorkerGlobalScopeCustom.cpp: (WebCore::JSWorkerGlobalScope::visitAdditionalChildren): Use auto. Remove unnecessary round trip through the scriptExecutionContext function. (WebCore::JSWorkerGlobalScope::importScripts): Use reserveInitialCapacity and uncheckedAppend to build up the vector of strings. Use propagateException to deal with ExceptionOr result. * dom/MessagePort.cpp: (WebCore::MessagePort::MessagePort): Initialize boolean data members in the class definition instead of here. (WebCore::MessagePort::postMessage): Use ExceptionOr. (WebCore::MessagePort::entangle): Use an rvalue reference. (WebCore::MessagePort::dispatchMessages): Use ExceptionOr. (WebCore::MessagePort::disentanglePorts): Ditto. Also use a more efficient idiom that does half as much hashing as the old algorithm, and got rid an unneeded local variable. (WebCore::MessagePort::entanglePorts): Use an rvalue reference. * dom/MessagePort.h: Updated for above changes. * fileapi/FileReader.cpp: (WebCore::FileReader::create): Use auto. (WebCore::FileReader::FileReader): Initialize scalars in the class definition. (WebCore::FileReader::~FileReader): Call cancel on the loader directly instead of sharing code with the stop function. (WebCore::FileReader::stop): Moved the body of the terminate function here. (WebCore::FileReader::readAsArrayBuffer): Use ExceptionOr. (WebCore::FileReader::readAsBinaryString): Ditto. (WebCore::FileReader::readAsText): Ditto. (WebCore::FileReader::readAsDataURL): Ditto. (WebCore::FileReader::readInternal): Ditto. Also add a cast now that we derive privately from FileReaderLoaderClient. (WebCore::FileReader::abort): Call stop instead of terminate. (WebCore::FileReader::terminate): Deleted. Moved code into stop. (WebCore::FileReader::didReceiveData): Moved comment to where the constant is. * fileapi/FileReader.h: Updated for above changes. Made more functions private and used final instead of override. * fileapi/FileReader.idl: Use non-legacy exceptions. * fileapi/FileReaderSync.cpp: (WebCore::FileReaderSync::readAsArrayBuffer): Use ExceptionOr. (WebCore::FileReaderSync::readAsBinaryString): Ditto. (WebCore::FileReaderSync::readAsText): Ditto. (WebCore::FileReaderSync::readAsDataURL): Ditto. (WebCore::FileReaderSync::startLoading): Ditto. (WebCore::FileReaderSync::startLoadingString): Added. Helper to cut down on repeated code in functions above. * fileapi/FileReaderSync.h: Updated for above changes. * fileapi/FileReaderSync.idl: Use non-legacy exceptions. * page/Base64Utilities.cpp: (WebCore::Base64Utilities::btoa): Use ExceptionOr. (WebCore::Base64Utilities::atob): Ditto. * page/Base64Utilities.h: Updated for above changes. * page/DOMWindow.cpp: (WebCore::DOMWindow::navigator): Pass a reference to the frame. (WebCore::DOMWindow::postMessage): Use ExceptionOr when calling MessagePort::disentanglePorts. Also udpated for changes to the PostMessageTimer. * page/Navigator.cpp: (WebCore::Navigator::Navigator): Take a reference. (WebCore::shouldHideFourDot): Ditto (WebCore::Navigator::appVersion): Pass a reference. (WebCore::Navigator::plugins): Return a reference. (WebCore::Navigator::mimeTypes): Ditto. * page/Navigator.h: Updated for above changes. Also marked the class final and moved derivation from RefCounted to NavigatorBase. * page/NavigatorBase.h: Addded derivation from RefCounted since both derived classes want that, and the destructor is already virtual. * page/WindowOrWorkerGlobalScope.idl: Use non-legacy exceptions. * page/WorkerNavigator.cpp: (WebCore::WorkerNavigator::~WorkerNavigator): Deleted. * page/WorkerNavigator.h: Moved derivation from RefCounted to NavigatorBase. Also marked class final. * workers/AbstractWorker.cpp: (WebCore::AbstractWorker::resolveURL): Use ExceptionOr. * workers/AbstractWorker.h: Updated for above changes. * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::create): Use RefPtr&& instead of PassRefPtr. (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope): Ditto. (WebCore::DedicatedWorkerGlobalScope::postMessage): Use ExceptionOr. (WebCore::DedicatedWorkerGlobalScope::importScripts): Ditto. * workers/DedicatedWorkerGlobalScope.h: Updated for above changes. * workers/DedicatedWorkerGlobalScope.idl: Use non-legacy exceptions. * workers/Worker.cpp: (WebCore::Worker::create): Use ExceptionOr. (WebCore::Worker::postMessage): Ditto. * workers/Worker.h: Updated for above changes. * workers/Worker.idl: Use non-legacy exception. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): Moved initialization of m_closing to class definition. (WebCore::WorkerGlobalScope::~WorkerGlobalScope): Removed call to deleted notifyObserversOfStop function. (WebCore::WorkerGlobalScope::importScripts): Use ExceptionOr. Also use reserveInitialCapacity and uncheckedAppend to build a vector. (WebCore::WorkerGlobalScope::addConsoleMessage): Use an rvalue reference. Also moved the body of one of the addMessageToWorkerConsole overloads into one of the overloads of this function, and changed the other to call addMessage. (WebCore::WorkerGlobalScope::addMessage): Moved the body of the other addMessageToWorkerConsole here. (WebCore::WorkerGlobalScope::addMessageToWorkerConsole): Deleted. (WebCore::WorkerGlobalScope::Observer::Observer): Deleted. (WebCore::WorkerGlobalScope::Observer::~Observer): Deleted. (WebCore::WorkerGlobalScope::Observer::stopObserving): Deleted. (WebCore::WorkerGlobalScope::registerObserver): Deleted. (WebCore::WorkerGlobalScope::unregisterObserver): Deleted. (WebCore::WorkerGlobalScope::notifyObserversOfStop): Deleted. * workers/WorkerGlobalScope.h: Removed unneeded includes. Moved many virtual function overrides into the private section. Marked many functions final instead of just override. Removed unused Observer class and m_workerObservers set. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Removed call to deleted WorkerGlobalScope::notifyObserversOfStop function. 2016-10-21 Antti Koivisto <antti@apple.com> Tighten ComputedStyleExtractor to use Element instead of Node https://bugs.webkit.org/show_bug.cgi?id=163798 Reviewed by Andreas Kling. Also make its functions non-const as they may compute style. * css/CSSComputedStyleDeclaration.cpp: (WebCore::styleElementForNode): (WebCore::ComputedStyleExtractor::ComputedStyleExtractor): If we are called with a Node figure out the style Element in constructor. (WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword): (WebCore::ComputedStyleExtractor::useFixedFontDefaultSize): (WebCore::ComputedStyleExtractor::styledElement): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): (WebCore::CSSComputedStyleDeclaration::copyProperties): (WebCore::elementOrItsAncestorNeedsStyleRecalc): Use composed tree iterator for increased correctness in shadow trees. (WebCore::updateStyleIfNeededForElement): (WebCore::computeRenderStyleForProperty): (WebCore::ComputedStyleExtractor::customPropertyValue): (WebCore::ComputedStyleExtractor::customPropertyText): (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::CSSComputedStyleDeclaration::length): (WebCore::CSSComputedStyleDeclaration::item): (WebCore::ComputedStyleExtractor::propertyMatches): (WebCore::ComputedStyleExtractor::copyProperties): (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties): (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand): (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand): (WebCore::ComputedStyleExtractor::copyPropertiesInSet): (WebCore::CSSComputedStyleDeclaration::getPropertyValue): (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue): (WebCore::ComputedStyleExtractor::styledNode): Deleted. (WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted. (WebCore::updateStyleIfNeededForNode): Deleted. * css/CSSComputedStyleDeclaration.h: * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::svgPropertyValue): * editing/EditingStyle.cpp: (WebCore::EditingStyle::removeEquivalentProperties): * editing/EditingStyle.h: 2016-10-21 Chris Dumez <cdumez@apple.com> WebGL2RenderingContext.texSubImage3D() should use a union instead of overloading https://bugs.webkit.org/show_bug.cgi?id=163792 Reviewed by Darin Adler. WebGL2RenderingContext.texSubImage3D() should use a union instead of overloading for - https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7 (for texSubImage3D) - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 (for TexImageSource) * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::texSubImage3D): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGL2RenderingContext.idl: 2016-10-21 Zalan Bujtas <zalan@apple.com> Do not mutate the render tree while collecting selection repaint rects. https://bugs.webkit.org/show_bug.cgi?id=163800 <rdar://problem/28806886> Reviewed by David Hyatt. RenderListItem not only mutates the tree while in layout but it also uses the old descendant context to find the insertion point. This patch strictly ensures that we only do it while in layout and never in other cases such as collecting repaint rects. This gets redundant when webkit.org/b/163789 is fixed. Test: fast/lists/crash-when-list-marker-is-moved-during-selection.html * rendering/RenderListItem.cpp: (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): 2016-10-21 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support horizontal-bt writing mode https://bugs.webkit.org/show_bug.cgi?id=163797 Reviewed by Zalan Bujtas. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-20 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Correct some memory leaks and other minor bugs https://bugs.webkit.org/show_bug.cgi?id=163769 Reviewed by Alex Christensen. Several D2D handles were being leaked. Direct2D sometimes returns an infinite rect containing { -inf, -inf, FloatMax, FloatMax }, sometimes { -FloatMax, -FloatMax, inf, inf }, and various combinations thereof. This caused most SVG drawing to decide no screen rect was contained in the "infinite rect" so nothing would be drawn. Tested by existing layout tests. * platform/graphics/GraphicsContext.h: * platform/graphics/win/FloatRectDirect2D.cpp: (WebCore::isInfiniteRect): Recognize various infinite rects in Windows. (WebCore::FloatRect::FloatRect): Convert a Windows infinite rect to the style we use inside WebKit. * platform/graphics/win/FontCascadeDirect2D.cpp: (WebCore::FontCascade::drawGlyphs): Use cached brushes if possible. * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: (WebCore::GlyphPage::fill): Don't terminate on this error case. * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::generateGradient): Don't leak gradients. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Added. (WebCore::GraphicsContext::brushWithColor): Added. (WebCore::GraphicsContextPlatformPrivate::concatCTM): Perform transform multiplication in the right order (hint: it's not distributive). (WebCore::GraphicsContext::drawWithShadow): Use convenience method. (WebCore::GraphicsContext::fillRect): Ditto. (WebCore::GraphicsContext::platformFillRoundedRect): Ditto. (WebCore::GraphicsContext::clearRect): Ditto. (WebCore::GraphicsContext::setPlatformStrokeColor): Ditto. (WebCore::GraphicsContext::setPlatformFillColor): Ditto. * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::polygonPathFromPoints): No need to convert manually. (WebCore::Path::~Path): Don't leak ID2D1Geometry entities. (WebCore::Path::appendGeometry): Ditto. (WebCore::Path::createGeometryWithFillMode): Ditto. (WebCore::Path::Path): Ditto. (WebCore::Path::operator=): Ditto. (WebCore::Path::strokeBoundingRect): Provide an implementation. (WebCore::Path::addRect): No need for manual casting here. 2016-10-21 Wenson Hsieh <wenson_hsieh@apple.com> Fix minor style issue in the signature of StaticRange::create https://bugs.webkit.org/show_bug.cgi?id=163786 <rdar://problem/28853079> Reviewed by Alex Christensen. Change `Ref<WebCore::Node> &&` to `Ref<Node>&&`. * dom/StaticRange.cpp: (WebCore::StaticRange::create): 2016-10-21 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add support for -webkit-line-box-contain https://bugs.webkit.org/show_bug.cgi?id=163794 Reviewed by Zalan Bujtas. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeLineBoxContain): (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-21 Dave Hyatt <hyatt@apple.com> [CSS Parser] Add support for @-webkit-region rules https://bugs.webkit.org/show_bug.cgi?id=163787 Reviewed by Zalan Bujtas. * css/StyleRule.cpp: (WebCore::StyleRuleRegion::StyleRuleRegion): * css/StyleRule.h: * css/parser/CSSAtRuleID.cpp: (WebCore::cssAtRuleID): * css/parser/CSSAtRuleID.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeAtRule): (WebCore::CSSParserImpl::consumePageRule): (WebCore::CSSParserImpl::consumeRegionRule): * css/parser/CSSParserImpl.h: 2016-10-21 David Kilzer <ddkilzer@apple.com> Bug 163757: Use IntSize::unclampedArea() in PDFDocumentImage::updateCachedImageIfNeeded() <https://webkit.org/b/163757> Reviewed by Brent Fulgham. No new tests since there is no change in nominal behavior. * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Use IntSize::unclampedArea() where manual calculations were used previously. Also gets rid of more safeCast<size_t>() use. 2016-10-21 Chris Dumez <cdumez@apple.com> [Web IDL] Support unions in our overload resolution algorithm https://bugs.webkit.org/show_bug.cgi?id=163764 Reviewed by Darin Adler. Support unions in our overload resolution algorithm as per: - https://heycam.github.io/webidl/#es-overloads - https://heycam.github.io/webidl/#dfn-distinguishable * bindings/scripts/CodeGeneratorJS.pm: (IsIDLTypeDistinguishableWithUnionForOverloadResolution): (AreTypesDistinguishableForOverloadResolution): (GetOverloadThatMatches): (GenerateOverloadedFunctionOrConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/TestObj.idl: 2016-10-21 Chris Dumez <cdumez@apple.com> AudioNode.connect(): First parameter should not be nullable https://bugs.webkit.org/show_bug.cgi?id=163773 Reviewed by Darin Adler. AudioNode.connect()'s first parameter should not be nullable: - https://webaudio.github.io/web-audio-api/#idl-def-AudioNode. We were throwing a SYNTAX_ERR when passing null, we now throw a TypeError instead. No new tests, updated existing test. * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::connect): * Modules/webaudio/AudioBasicInspectorNode.h: * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::connect): * Modules/webaudio/AudioNode.h: * Modules/webaudio/AudioNode.idl: 2016-10-21 Wenson Hsieh <wenson_hsieh@apple.com> Implement InputEvent.getTargetRanges() for the input events spec https://bugs.webkit.org/show_bug.cgi?id=162947 <rdar://problem/28853079> Reviewed by Darin Adler. Implements InputEvent.getTargetRanges(). See individual method changes below for more details. Adds a new hook for subclasses of CompositeEditCommand to vend a list of target StaticRanges when retrieving target ranges for an editing command on a contenteditable area. Tests: fast/events/before-input-delete-empty-list-target-ranges.html fast/events/before-input-delete-text-target-ranges.html fast/events/before-input-replace-text-target-ranges.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: Add StaticRange.idl, StaticRange.cpp and StaticRange.h. * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setInputEventsEnabled): (WebCore::RuntimeEnabledFeatures::inputEventsEnabled): Add a new runtime bindings flag for InputEvents and guard both InputEvent and StaticRange behind it. * dom/DOMAllInOne.cpp: * dom/InputEvent.cpp: (WebCore::InputEvent::InputEvent): * dom/InputEvent.h: * dom/InputEvent.idl: * dom/StaticRange.cpp: Copied from Source/WebCore/dom/InputEvent.cpp. (WebCore::StaticRange::StaticRange): (WebCore::StaticRange::create): (WebCore::StaticRange::createFromRange): Convenience method for creating a StaticRange from a Range's start/end container and offset. (WebCore::StaticRange::startContainer): (WebCore::StaticRange::endContainer): (WebCore::StaticRange::collapsed): * dom/StaticRange.h: Copied from Source/WebCore/dom/InputEvent.cpp. (WebCore::StaticRange::startOffset): (WebCore::StaticRange::endOffset): * dom/StaticRange.idl: Copied from Source/WebCore/editing/ReplaceRangeWithTextCommand.h. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::willApplyCommand): (WebCore::CompositeEditCommand::targetRanges): Virtual method that returns a list of target ranges which are associated with this command. (WebCore::CompositeEditCommand::targetRangesForBindings): Non-virtual method that calls the above targetRanges(). Takes whether or not the CompositeEditCommand is editing a textarea or plain text input into account. (WebCore::CompositeEditCommand::moveParagraphs): * editing/CompositeEditCommand.h: * editing/EditCommand.cpp: (WebCore::EditCommand::frame): * editing/EditCommand.h: (WebCore::EditCommand::document): * editing/Editor.cpp: (WebCore::dispatchBeforeInputEvent): (WebCore::dispatchInputEvent): (WebCore::dispatchBeforeInputEvents): Changed the `beforeinput` event dispatch to use the regular Node::dispatchEvent instead of dispatchScopedEvent. This is because if the page prevents the `beforeinput` event, we need to know immediately in order to bail from the default action. (WebCore::dispatchInputEvents): (WebCore::Editor::willApplyEditing): Added a list of static ranges as a parameter when calling on the Editor to dispatch `beforeinput` events. By default, this uses the composite edit command's targetRangesForBindings(), though it may be special cased by subclasses of CompositeEditCommand (see ReplaceRangeWithTextCommand, SpellingCorrectionCommand, and TypingCommand). * editing/Editor.h: * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::targetRanges): * editing/ReplaceRangeWithTextCommand.h: * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::targetRanges): * editing/SpellingCorrectionCommand.h: * editing/TypingCommand.cpp: (WebCore::editActionIsDeleteByTyping): (WebCore::TypingCommand::shouldDeferWillApplyCommandUntilAddingTypingCommand): (WebCore::TypingCommand::willApplyCommand): (WebCore::TypingCommand::willAddTypingToOpenCommand): (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::forwardDeleteKeyPressed): Moves the firing of the `beforeinput` until after the selection range to delete has been computed. * editing/TypingCommand.h: 2016-10-21 Antti Koivisto <antti@apple.com> Style resolver should be updated lazily https://bugs.webkit.org/show_bug.cgi?id=163721 Reviewed by Andreas Kling. Currently when stylesheets change in some way we generally update style resolvers and invalidate style immediately. We should do this lazily to avoid unnecessary work. Also improve naming of the stylesheet invalidation functions and use more optimal functions in some places. * css/CSSComputedStyleDeclaration.cpp: (WebCore::updateStyleIfNeededForNode): * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::didMutateRules): (WebCore::CSSStyleSheet::didMutate): (WebCore::CSSStyleSheet::setDisabled): * css/StyleResolver.cpp: (WebCore::StyleResolver::StyleResolver): Initialize root style font with null font selector. This avoids hitting a CSSFontSelector assert in fast/media/mq-relative-constraints-08.html where media query evaluation requires font information before it is ready. Exposed by increased laziness in this patch. * dom/Document.cpp: (WebCore::Document::setContentLanguage): (WebCore::Document::updateLayoutIgnorePendingStylesheets): (WebCore::Document::isPageBoxVisible): (WebCore::Document::pageSizeAndMarginsInPixels): (WebCore::Document::processHttpEquiv): (WebCore::Document::setSelectedStylesheetSet): (WebCore::Document::didInsertInDocumentShadowRoot): (WebCore::Document::didRemoveInDocumentShadowRoot): * dom/Document.h: (WebCore::Document::inDocumentShadowRoots): Track all shadow roots in the document. This allows us to find and flush style scopes cheaply. * dom/Element.cpp: (WebCore::Element::computedStyle): * dom/ExtensionStyleSheets.cpp: (WebCore::ExtensionStyleSheets::ExtensionStyleSheets): (WebCore::ExtensionStyleSheets::clearPageUserSheet): (WebCore::ExtensionStyleSheets::updatePageUserSheet): (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache): (WebCore::ExtensionStyleSheets::addUserStyleSheet): (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting): (WebCore::ExtensionStyleSheets::addDisplayNoneSelector): (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet): (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired): Deleted. Since updates are now done lazily we don't need a special timer for extension stylesheets. * dom/ExtensionStyleSheets.h: * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): (WebCore::ProcessingInstruction::sheetLoaded): (WebCore::ProcessingInstruction::removedFrom): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::ShadowRoot): (WebCore::ShadowRoot::insertedInto): (WebCore::ShadowRoot::removedFrom): (WebCore::ShadowRoot::styleScope): * dom/ShadowRoot.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::setDisabledState): (WebCore::HTMLLinkElement::parseAttribute): (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::removePendingSheet): * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::parseAttribute): * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): (WebCore::InspectorCSSAgent::forcePseudoState): (WebCore::InspectorCSSAgent::resetPseudoStates): * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setEmulatedMedia): * page/Frame.cpp: (WebCore::Frame::setPrinting): * page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::setPagination): (WebCore::FrameView::setViewportSizeForCSSViewportUnits): * page/Page.cpp: (WebCore::Page::setViewMode): (WebCore::Page::setNeedsRecalcStyleInAllFrames): (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames): * style/StyleScope.cpp: (WebCore::Style::Scope::setPreferredStylesheetSetName): (WebCore::Style::Scope::setSelectedStylesheetSetName): (WebCore::Style::Scope::removePendingSheet): (WebCore::Style::Scope::removeStyleSheetCandidateNode): (WebCore::Style::Scope::activeStyleSheetsForInspector): (WebCore::Style::Scope::flushPendingUpdate): Also flush descendant shadow roots. (WebCore::Style::Scope::scheduleUpdate): (WebCore::Style::Scope::didChangeActiveStyleSheetCandidates): Make lazy. (WebCore::Style::Scope::didChangeStyleSheetContents): Make lazy. (WebCore::Style::Scope::didChangeStyleSheetEnvironment): Environment changes also affect author shadow roots. (WebCore::Style::Scope::styleSheetsForStyleSheetList): (WebCore::Style::Scope::scheduleActiveSetUpdate): Deleted. (WebCore::Style::Scope::didChangeCandidatesForActiveSet): Deleted. (WebCore::Style::Scope::didChangeContentsOrInterpretation): Deleted. Improved naming of these and split didChangeContentsOrInterpretation into two separate functions. * style/StyleScope.h: (WebCore::Style::Scope::styleSheetsForStyleSheetList): Deleted. (WebCore::Style::Scope::setPreferredStylesheetSetName): Deleted. (WebCore::Style::Scope::setSelectedStylesheetSetName): Deleted. * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::rebuildFontFace): (WebCore::SVGFontFaceElement::removedFrom): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Ensure that cationsStyleSheetOverride really becomes empty. Some tests rely on not having suprise inserted stylesheets. Previously this was racy and the patch affected order of things. (WebCore::Internals::styleChangeType): * xml/XMLTreeViewer.cpp: (WebCore::XMLTreeViewer::transformDocumentToTreeView): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::end): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::doEnd): 2016-10-21 Xabier Rodriguez Calvar <calvaris@igalia.com> and Adam Bergkvist <adam.bergkvist@ericsson.com> WebRTC: [OpenWebRTC] Move SDPProcessorScriptResource(Gtk) to openwebrtc directory https://bugs.webkit.org/show_bug.cgi?id=163778 Reviewed by Philippe Normand. Move SDPProcessorScriptResourceGtk from the platform gtk directory to the port generic openwebrtc directory to make it usable by other ports. Also drop the Gtk-suffix. No change of behavior. * PlatformGTK.cmake: * platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp: (WebCore::SDPProcessorScriptResource::scriptString): Deleted. * platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp: Renamed from Source/WebCore/platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp. (WebCore::SDPProcessorScriptResource::scriptString): 2016-10-21 Miguel Gomez <magomez@igalia.com> [GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint https://bugs.webkit.org/show_bug.cgi?id=163511 Reviewed by Carlos Garcia Campos. Perform the video repaint in the main thread when accelerated compositing is disabled. Added a new method to MediaPlayerClient to get whether accelerated compositing is enabled from the MediaPlayer. This is needed because mediaPlayerAcceleratedCompositingEnabled() will return false while HTMLMediaElement doesn't have a RenderVideo, even when accelerated compositing is enabled. Covered by existent tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled): * html/HTMLMediaElement.h: * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::repaint): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2016-10-21 Adam Bergkvist <adam.bergkvist@ericsson.com> WebRTC: [GTK] Add MediaEndpointOwr - an OpenWebRTC WebRTC backend https://bugs.webkit.org/show_bug.cgi?id=163327 Reviewed by Philippe Normand. Add MediaEndpointOwr which is a MediaEndpoint implementation (WebRTC backend) based on OpenWebRTC [1]. The WebRTC backend can be tested with a manual test. Automatic testing is still done with MockMediaEndpoint. [1] http://www.openwebrtc.org/ Testing: Added manual test (webrtc-one-tab-p2p.html) * CMakeLists.txt: * platform/GStreamer.cmake: * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: Added. (WebCore::createMediaEndpointOwr): (WebCore::MediaEndpointOwr::MediaEndpointOwr): (WebCore::MediaEndpointOwr::~MediaEndpointOwr): (WebCore::MediaEndpointOwr::setConfiguration): (WebCore::cryptoDataCallback): (WebCore::MediaEndpointOwr::generateDtlsInfo): (WebCore::MediaEndpointOwr::getDefaultAudioPayloads): (WebCore::MediaEndpointOwr::getDefaultVideoPayloads): (WebCore::payloadsContainType): (WebCore::MediaEndpointOwr::filterPayloads): (WebCore::MediaEndpointOwr::updateReceiveConfiguration): (WebCore::findRtxPayload): (WebCore::MediaEndpointOwr::updateSendConfiguration): (WebCore::MediaEndpointOwr::addRemoteCandidate): (WebCore::MediaEndpointOwr::replaceMutedRemoteSourceMid): (WebCore::MediaEndpointOwr::createMutedRemoteSource): (WebCore::MediaEndpointOwr::replaceSendSource): (WebCore::MediaEndpointOwr::stop): (WebCore::MediaEndpointOwr::transceiverIndexForSession): (WebCore::MediaEndpointOwr::sessionMid): (WebCore::MediaEndpointOwr::matchTransceiverByMid): (WebCore::MediaEndpointOwr::dispatchNewIceCandidate): (WebCore::MediaEndpointOwr::dispatchGatheringDone): (WebCore::MediaEndpointOwr::processIceTransportStateChange): (WebCore::MediaEndpointOwr::dispatchDtlsFingerprint): (WebCore::MediaEndpointOwr::unmuteRemoteSource): (WebCore::MediaEndpointOwr::prepareSession): (WebCore::MediaEndpointOwr::prepareMediaSession): (WebCore::parseHelperServerUrl): (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers): (WebCore::MediaEndpointOwr::internalAddRemoteCandidate): (WebCore::gotCandidate): (WebCore::candidateGatheringDone): (WebCore::iceConnectionStateChange): (WebCore::gotIncomingSource): * platform/mediastream/openwebrtc/MediaEndpointOwr.h: Added. (WebCore::OwrTransceiver::create): (WebCore::OwrTransceiver::~OwrTransceiver): (WebCore::OwrTransceiver::mid): (WebCore::OwrTransceiver::session): (WebCore::OwrTransceiver::owrIceState): (WebCore::OwrTransceiver::setOwrIceState): (WebCore::OwrTransceiver::gotEndOfRemoteCandidates): (WebCore::OwrTransceiver::markGotEndOfRemoteCandidates): (WebCore::OwrTransceiver::OwrTransceiver): * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr): (WebCore::RealtimeMediaSourceOwr::swapOutShallowSource): Add support for an initially muted source. This is used for early creation of remote sources. 2016-10-21 Javier Fernandez <jfernandez@igalia.com> [css-grid] Content Alignment broken with indefinite sized grid container https://bugs.webkit.org/show_bug.cgi?id=163724 Reviewed by Manuel Rego Casasnovas. The Grid Tracks sizing algorithm receives as parameter the available space to be used as space for tracks. We hold a variable to store the remaining free space for each dimension. When the grid container size is indefinite we can't compute the available free space after computing track sizes until such indefinite size is resolved. No new tests, just added some additional test cases. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::layoutBlock): Compute freeSpace for Rows after doing layout and resolving the indefinite height. 2016-10-21 Jer Noble <jer.noble@apple.com> CRASH in SourceBuffer::sourceBufferPrivateDidReceiveSample + 2169 https://bugs.webkit.org/show_bug.cgi?id=163735 Reviewed by Eric Carlson. Test: media/media-source/media-source-sample-wrong-track-id.html When SourceBuffer receives a sample in sourceBufferPrivateDidReceiveSample() containing a trackID not previously seen in an initialization segment, it creates a default TrackBuffer object to contain that track's samples. One of the fields in TrackBuffer, description, is normally filled out when an initialization segment is received, but with this default TrackBuffer, it's still null when it's checked later in sourceBufferPrivateDidReceiveSample(). Rather than adding a null-check on trackBuffer.description, drop any sample that has a trackID which was not present during a previous initialization segment. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): 2016-10-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Configures but fails to link with ENABLE_OPENGL=OFF https://bugs.webkit.org/show_bug.cgi?id=163449 Reviewed by Michael Catanzaro. Only define sharingGLContext in PlatformDisplay if EGL or GLX are enabled. * platform/graphics/PlatformDisplay.cpp: * platform/graphics/PlatformDisplay.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::~PlatformDisplayX11): 2016-10-20 Filip Pizlo <fpizlo@apple.com> The tracking of the coarse-grain Heap state (allocating or not, collector or not, eden vs full) should respect the orthogonality between allocating and collecting https://bugs.webkit.org/show_bug.cgi?id=163738 Reviewed by Geoffrey Garen. No new tests because no change in behavior. * bindings/js/GCController.cpp: (WebCore::GCController::garbageCollectNow): 2016-10-20 Chris Dumez <cdumez@apple.com> [Bindings] Start using signature->idlType instead of signature->type in the overload resolution code https://bugs.webkit.org/show_bug.cgi?id=163767 Reviewed by Darin Adler. Start using signature->idlType instead of signature->type in the overload resolution code to prepare for union type support. * bindings/scripts/CodeGeneratorJS.pm: (ComputeEffectiveOverloadSet): (AreTypesDistinguishableForOverloadResolution): (GetDistinguishingArgumentIndex): (GetOverloadThatMatches): (GenerateOverloadedFunctionOrConstructor): 2016-10-20 Myles C. Maxfield <mmaxfield@apple.com> Implement WebGL2 bufferData() and bufferSubData() methods https://bugs.webkit.org/show_bug.cgi?id=163759 Reviewed by Dean Jackson. These new overloads simply clip the input array buffer. Test: fast/canvas/webgl/bufferData-offset-length.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::bufferData): (WebCore::WebGL2RenderingContext::bufferSubData): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGL2RenderingContext.idl: 2016-10-20 Chris Dumez <cdumez@apple.com> "Download Linked File" context menu action should use 'download' attribute as suggested filename https://bugs.webkit.org/show_bug.cgi?id=163742 <rdar://problem/28840734> Reviewed by Darin Adler. Add convenience method to HitTestResult to return the URL element's download attribute. * rendering/HitTestResult.cpp: (WebCore::HitTestResult::URLElementDownloadAttribute): * rendering/HitTestResult.h: 2016-10-20 Nan Wang <n_wang@apple.com> AX: VoiceOver is not detecting ARIA treeview if it contains role="presentation" https://bugs.webkit.org/show_bug.cgi?id=163763 Reviewed by Chris Fleizach. Test: accessibility/mac/aria-tree-with-presentation-role.html Web authors sometimes use presentation role in the aria tree to hide elements. We should consider this a valid case if they specify tree items and groups correctly. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::hierarchicalLevel): * accessibility/AccessibilityTree.cpp: (WebCore::AccessibilityTree::nodeHasTreeItemChild): (WebCore::AccessibilityTree::isTreeValid): * accessibility/AccessibilityTree.h: 2016-10-20 Myles C. Maxfield <mmaxfield@apple.com> Many WebGL functions which don't throw are marked as possibly throwing https://bugs.webkit.org/show_bug.cgi?id=163747 Reviewed by Dean Jackson. Mechanically remove the exception code. No new tests because there is no behavior change. * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: (WebCore::getObjectParameter): (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): (WebCore::JSWebGLRenderingContextBase::getProgramParameter): (WebCore::JSWebGLRenderingContextBase::getShaderParameter): (WebCore::JSWebGLRenderingContextBase::getUniform): (WebCore::dataFunctionf): (WebCore::dataFunctioni): (WebCore::dataFunctionMatrix): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::texSubImage2D): * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::texSubImage2D): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::activeTexture): (WebCore::WebGLRenderingContextBase::attachShader): (WebCore::WebGLRenderingContextBase::bindAttribLocation): (WebCore::WebGLRenderingContextBase::bindBuffer): (WebCore::WebGLRenderingContextBase::bindFramebuffer): (WebCore::WebGLRenderingContextBase::bindRenderbuffer): (WebCore::WebGLRenderingContextBase::bindTexture): (WebCore::WebGLRenderingContextBase::bufferData): (WebCore::WebGLRenderingContextBase::bufferSubData): (WebCore::WebGLRenderingContextBase::compileShader): (WebCore::WebGLRenderingContextBase::createShader): (WebCore::WebGLRenderingContextBase::detachShader): (WebCore::WebGLRenderingContextBase::disableVertexAttribArray): (WebCore::WebGLRenderingContextBase::drawArrays): (WebCore::WebGLRenderingContextBase::drawElements): (WebCore::WebGLRenderingContextBase::enableVertexAttribArray): (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer): (WebCore::WebGLRenderingContextBase::framebufferTexture2D): (WebCore::WebGLRenderingContextBase::getActiveAttrib): (WebCore::WebGLRenderingContextBase::getActiveUniform): (WebCore::WebGLRenderingContextBase::getAttachedShaders): (WebCore::WebGLRenderingContextBase::getBufferParameter): (WebCore::WebGLRenderingContextBase::getProgramParameter): (WebCore::WebGLRenderingContextBase::getProgramInfoLog): (WebCore::WebGLRenderingContextBase::getRenderbufferParameter): (WebCore::WebGLRenderingContextBase::getShaderParameter): (WebCore::WebGLRenderingContextBase::getShaderInfoLog): (WebCore::WebGLRenderingContextBase::getShaderPrecisionFormat): (WebCore::WebGLRenderingContextBase::getShaderSource): (WebCore::WebGLRenderingContextBase::getTexParameter): (WebCore::WebGLRenderingContextBase::getUniform): (WebCore::WebGLRenderingContextBase::getUniformLocation): (WebCore::WebGLRenderingContextBase::getVertexAttrib): (WebCore::WebGLRenderingContextBase::linkProgram): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::shaderSource): (WebCore::WebGLRenderingContextBase::videoFrameToImage): (WebCore::WebGLRenderingContextBase::texImage2D): (WebCore::WebGLRenderingContextBase::uniform1f): (WebCore::WebGLRenderingContextBase::uniform1fv): (WebCore::WebGLRenderingContextBase::uniform1i): (WebCore::WebGLRenderingContextBase::uniform1iv): (WebCore::WebGLRenderingContextBase::uniform2f): (WebCore::WebGLRenderingContextBase::uniform2fv): (WebCore::WebGLRenderingContextBase::uniform2i): (WebCore::WebGLRenderingContextBase::uniform2iv): (WebCore::WebGLRenderingContextBase::uniform3f): (WebCore::WebGLRenderingContextBase::uniform3fv): (WebCore::WebGLRenderingContextBase::uniform3i): (WebCore::WebGLRenderingContextBase::uniform3iv): (WebCore::WebGLRenderingContextBase::uniform4f): (WebCore::WebGLRenderingContextBase::uniform4fv): (WebCore::WebGLRenderingContextBase::uniform4i): (WebCore::WebGLRenderingContextBase::uniform4iv): (WebCore::WebGLRenderingContextBase::uniformMatrix2fv): (WebCore::WebGLRenderingContextBase::uniformMatrix3fv): (WebCore::WebGLRenderingContextBase::uniformMatrix4fv): (WebCore::WebGLRenderingContextBase::useProgram): (WebCore::WebGLRenderingContextBase::validateProgram): (WebCore::WebGLRenderingContextBase::vertexAttribPointer): (WebCore::WebGLRenderingContextBase::restoreCurrentFramebuffer): (WebCore::WebGLRenderingContextBase::restoreCurrentTexture2D): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2016-10-19 Myles C. Maxfield <mmaxfield@apple.com> [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9 https://bugs.webkit.org/show_bug.cgi?id=163374 Reviewed by Darin Adler. Because of platform lack of support for variations in in-memory fonts, this feature should be disabled on the affected OSes. No tests because there is no behavior change (on the relevant platforms). * Configurations/FeatureDefines.xcconfig: 2016-10-20 Brady Eidson <beidson@apple.com> IndexedDB 2.0: Support IDBObjectStore name assignment. <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/objectstore-rename-1-private.html storage/indexeddb/modern/objectstore-rename-1.html Touches a *lot* of code sites, but none of them are particularly interesting. They are all just getting the new name spread out to all of the various objects that need it. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::renameObjectStore): * Modules/indexeddb/IDBDatabase.h: * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::setName): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBObjectStore.idl: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameObjectStoreOnServer): (WebCore::IDBTransaction::didRenameObjectStoreOnServer): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::renameObjectStore): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore): (WebCore::IDBClient::IDBConnectionToServer::didRenameObjectStore): * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: * Modules/indexeddb/server/IDBBackingStore.h: * Modules/indexeddb/server/IDBConnectionToClient.cpp: (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore): (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore): * Modules/indexeddb/server/IDBConnectionToClient.h: * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::renameObjectStore): * Modules/indexeddb/server/IDBServer.h: * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed): (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): * Modules/indexeddb/server/MemoryBackingStoreTransaction.h: * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore): * Modules/indexeddb/server/MemoryIDBBackingStore.h: * Modules/indexeddb/server/MemoryObjectStore.h: (WebCore::IDBServer::MemoryObjectStore::rename): * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): * Modules/indexeddb/server/SQLiteIDBBackingStore.h: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore): (WebCore::IDBServer::UniqueIDBDatabase::performRenameObjectStore): (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameObjectStore): * Modules/indexeddb/server/UniqueIDBDatabase.h: * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp: (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameObjectStore): * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h: * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameObjectStore): * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: * Modules/indexeddb/shared/IDBDatabaseInfo.cpp: (WebCore::IDBDatabaseInfo::renameObjectStore): * Modules/indexeddb/shared/IDBDatabaseInfo.h: * Modules/indexeddb/shared/IDBObjectStoreInfo.h: (WebCore::IDBObjectStoreInfo::rename): * Modules/indexeddb/shared/IDBResultData.cpp: (WebCore::IDBResultData::renameObjectStoreSuccess): * Modules/indexeddb/shared/IDBResultData.h: * Modules/indexeddb/shared/InProcessIDBServer.cpp: (WebCore::InProcessIDBServer::didRenameObjectStore): (WebCore::InProcessIDBServer::renameObjectStore): * Modules/indexeddb/shared/InProcessIDBServer.h: 2016-10-20 Chris Dumez <cdumez@apple.com> Make table.deleteRow(-1) a no-op when there are no rows https://bugs.webkit.org/show_bug.cgi?id=163746 Reviewed by Alex Christensen. Make table.deleteRow(-1) a no-op when there are no rows, instead of throwing: - https://github.com/whatwg/html/pull/1924 This is more consistent with the behavior of tbody.deleteRow(-1) and tr.deleteCell(-1). This is also consistent with Gecko. Blink is doing the same change via: - https://codereview.chromium.org/2427963004/ No new tests, updated existing tests. * html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::deleteRow): 2016-10-20 Dave Hyatt <hyatt@apple.com> [CSS Parser] Make sure to handle prefixed transform-style https://bugs.webkit.org/show_bug.cgi?id=163756 Reviewed by Dean Jackson. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-20 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix crash when parsing -webkit-margin-collapse https://bugs.webkit.org/show_bug.cgi?id=163753 Reviewed by Dean Jackson. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseShorthand): 2016-10-20 Chris Dumez <cdumez@apple.com> Passing a number as the pixel parameter to texImage2D() doesn't thrown an exception https://bugs.webkit.org/show_bug.cgi?id=163715 Reviewed by Darin Adler. Enable strict type checking for typed arrays in the bindings, similarly do what we do for other wrapper types, as per Web IDL. No new tests, updated existing tests. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GenerateParametersCheck): 2016-10-20 Myles C. Maxfield <mmaxfield@apple.com> Improve error message when passing a null ArrayBuffer to bufferData() https://bugs.webkit.org/show_bug.cgi?id=163745 Reviewed by Dean Jackson. Test: fast/canvas/webgl/bufferData-nullable-array-buffer-view.html Update the idl file to accept a nullable ArrayBuffer, and throw the relevant error with a more helpful error string. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::bufferData): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2016-10-20 Zalan Bujtas <zalan@apple.com> Stop searching for first-letter containers at multi-column boundary. https://bugs.webkit.org/show_bug.cgi?id=163739 <rdar://problem/28810750> We should not cross the multi-column boundary while searching for the first-letter container. While moving first-letter renderers to a multi-column parent, it could result in finding the wrong container and end up adding a new wrapper under the original container (from where we are moving the renderers). Reviewed by David Hyatt. Test: fast/css-generated-content/first-letter-move-to-multicolumn-crash.html * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildrenTo): * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::blockForAccompanyingFirstLetter): 2016-10-19 Dean Jackson <dino@apple.com> Support CSS Shapes Level 1 without a prefix https://bugs.webkit.org/show_bug.cgi?id=163709 <rdar://problem/28859369> Reviewed by Myles Maxfield. Support the unprefixed form of CSS Shapes, now that it is in CR. We have a few failing tests: - Some image-based shaping failures, now skipped. https://bugs.webkit.org/show_bug.cgi?id=163706 - Some false negatives, where my understanding of the CSS OM seems to suggest that the W3C tests are incorrect. https://bugs.webkit.org/show_bug.cgi?id=163708 Tests: imported/w3c/csswg-test/css-shapes-1 * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSPropertyNames.in: * css/CSSValueKeywords.in: * css/parser/CSSParser.cpp: (WebCore::isSimpleLengthPropertyID): (WebCore::CSSParser::parseValue): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 2016-10-20 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix region, column and page break parsing https://bugs.webkit.org/show_bug.cgi?id=163743 Reviewed by Simon Fraser. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): Add the missing values for break support. * css/parser/CSSPropertyParser.cpp: (WebCore::isLegacyBreakProperty): (WebCore::CSSPropertyParser::parseValueStart): Add a special case for handling legacy break properties. Blink treats them like shorthands, but we can't do that without breaking the old parser, so for now we add a special case. (WebCore::mapFromPageBreakBetween): (WebCore::mapFromColumnBreakBetween): (WebCore::mapFromRegionBreakBetween): Updated to have the AvoidXXX values (where XXX is Column/Page/Region). (WebCore::CSSPropertyParser::parseShorthand): Remove the consumeLegacyBreak from the shorthand function, since we can't treat the legacy break properties as shorthands yet. 2016-10-20 Sam Weinig <sam@webkit.org> Add convenience function that combines WTF::visit(...) with WTF::makeVisitor(...) https://bugs.webkit.org/show_bug.cgi?id=163713 Reviewed by Dan Bernstein. Switch uses of WTF::visit to use WTF::switchOn. * dom/MessageEvent.cpp: (WebCore::MessageEvent::source): * dom/Node.cpp: (WebCore::nodeSetPreTransformedFromNodeOrStringVector): (WebCore::Node::convertNodesOrStringsIntoNode): * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::add): * html/track/TrackEvent.cpp: (WebCore::TrackEvent::TrackEvent): * testing/TypeConversions.h: (WebCore::TypeConversions::typeConversionsDictionaryUnionType): 2016-10-20 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix font family parsing and add CSS region property parsing https://bugs.webkit.org/show_bug.cgi?id=163741 Reviewed by Zalan Bujtas. * css/parser/CSSParser.cpp: (WebCore::isKeywordPropertyID): (WebCore::parseKeywordValue): (WebCore::CSSParser::parseValue): Modify the old CSSParser to have its own keyword check, since keywords were incorrectly added to the new parser when this check was consolidated. Column and region breaks are considered keyword properties by the old parser, but not by the new parser, since the new parser special cases them and maps them into the generic break property. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): Update for regions to make sure all the region properties are there. Remove the column and region break properties, since they're not supposed to be here in the new parser. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFamilyName): Fix font parsing to make font family values so that fonts work. (WebCore::consumeFlowProperty): Add a function for handling -webkit-flow-from and -webkit-flow-into. (WebCore::CSSPropertyParser::parseSingleValue): Add support for the region properties. (WebCore::mapFromRegionBreakBetween): (WebCore::mapFromColumnRegionOrPageBreakInside): (WebCore::mapFromLegacyBreakProperty): (WebCore::CSSPropertyParser::consumeLegacyBreakProperty): (WebCore::mapFromColumnOrPageBreakInside): Deleted. Update to handle the region break properties in the same way that column break properties are handled. 2016-10-20 Jer Noble <jer.noble@apple.com> CRASH in WebCore::MediaSource::seekToTime + 185 https://bugs.webkit.org/show_bug.cgi?id=163652 Reviewed by Eric Carlson. Test: media/media-source/media-source-seek-detach-crash.html Add isClosed() checks (which are effectively m_private null-checks) everywhere m_private is dereferenced. The one place where m_private is cleared without setting the state to closed is stop(), so make stop() set the state to closed as well (without firing any events). * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::seekToTime): (WebCore::MediaSource::completeSeek): (WebCore::MediaSource::monitorSourceBuffers): (WebCore::MediaSource::streamEndedWithError): (WebCore::MediaSource::stop): 2016-10-20 Andreas Kling <akling@apple.com> Drop StyleResolver and SelectorQueryCache when entering PageCache. <https://webkit.org/b/154238> Reviewed by Antti Koivisto. Stop keeping these around for cached pages to save lots of memory. We can easily rebuild them if a cached navigation occurs, and this way we also don't need to worry about invalidating style for cached pages in all the right places. Restoring a cached page will now lead to a forced style recalc. We don't try to defer this (beyond a zero-timer) since it's going to happen anyway, and it's nicer to front-load the cost rather than stuttering on the first user content interaction. * dom/Document.cpp: (WebCore::Document::setPageCacheState): * history/CachedPage.cpp: (WebCore::CachedPage::restore): (WebCore::CachedPage::clear): * history/CachedPage.h: (WebCore::CachedPage::markForVisitedLinkStyleRecalc): Deleted. (WebCore::CachedPage::markForFullStyleRecalc): Deleted. * history/PageCache.cpp: (WebCore::PageCache::markPagesForVisitedLinkStyleRecalc): Deleted. (WebCore::PageCache::markPagesForFullStyleRecalc): Deleted. * history/PageCache.h: * page/Frame.cpp: (WebCore::Frame::setPageAndTextZoomFactors): * page/Page.cpp: (WebCore::Page::setViewScaleFactor): (WebCore::Page::setDeviceScaleFactor): (WebCore::Page::setPagination): (WebCore::Page::setPaginationLineGridEnabled): (WebCore::Page::setVisitedLinkStore): 2016-10-20 Carlos Alberto Lopez Perez <clopez@igalia.com> [GTK] Build fix after r207616 https://bugs.webkit.org/show_bug.cgi?id=163333 Reviewed by Carlos Garcia Campos. EGL_PLATFORM_X11_KHR and EGL_PLATFORM_WAYLAND_KHR are not defined on the EGL headers shipped by Mesa 10.3 (shipped by Debian 8) * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::initializeEGLDisplay): 2016-10-20 Fujii Hironori <Hironori.Fujii@sony.com> [CMake] CMake does not support the dep files for implicit dependency https://bugs.webkit.org/show_bug.cgi?id=161433 Reviewed by Brent Fulgham. Created a Perl script to generate all IDL bindings for CMake. This script can regenerate outdated bindings by based on the supplemental dependency and dep files created by '--write-dependencies' switch of generate-bindings.pl. add_custom_target is used to invoke the script instead of add_custom_command because Ninja deletes all output files before executing the command in case of add_custom_command. USES_TERMINAL option of add_custom_target has two effects: 1) Not buffering output of the command 2) Invoking the command in the special Ninja pool which inhibits parallel build One needs to use CMake 3.2 or later to enable this feature. * CMakeLists.txt: Specified target names for GENERATE_BINDINGS. Added dependency for the targets. * bindings/scripts/generate-bindings-all.pl: Added. 2016-10-20 Adam Jackson <ajax@redhat.com> Prefer eglGetPlatformDisplay to eglGetDisplay https://bugs.webkit.org/show_bug.cgi?id=163333 Reviewed by Carlos Garcia Campos. eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL what kind of display it is, so let's use it. * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::initializeEGLDisplay): 2016-10-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Avoid including egl.h headers in internal headers https://bugs.webkit.org/show_bug.cgi?id=163722 Reviewed by Žan Doberšek. egl.h includes eglplatform.h that decides the native types for the platform at compile time. However, we support to build with X11 and Wayland at the same time and decide what to use at runtime. Currently GLContext.h includes eglplatform.h after wayland-egl.h if Wayland is enabled. That means that the wayland native types are used by default from all cpp files including GLContext.h. It currently works in X11 because we cast the value anyway and for example EGLNativeWindowType is a pointer in Wayland that can be casted to unsigned long in X11 to represent the X Window. This is very fragile in any case, we should avoid adding egl headers in our headers and only include it in cpp files. But we also need to ensure we don't use X11 and Wayland in the same cpp file. * PlatformGTK.cmake: * platform/graphics/GLContext.cpp: (WebCore::GLContext::createContextForWindow): * platform/graphics/GLContext.h: * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createWindowContext): (WebCore::GLContextEGL::createContext): (WebCore::GLContextEGL::~GLContextEGL): * platform/graphics/egl/GLContextEGL.h: * platform/graphics/egl/GLContextEGLWayland.cpp: Added. (WebCore::GLContextEGL::GLContextEGL): (WebCore::GLContextEGL::createWindowSurfaceWayland): (WebCore::GLContextEGL::createWaylandContext): (WebCore::GLContextEGL::destroyWaylandWindow): * platform/graphics/egl/GLContextEGLX11.cpp: Added. (WebCore::GLContextEGL::GLContextEGL): (WebCore::GLContextEGL::createWindowSurfaceX11): (WebCore::GLContextEGL::createPixmapContext): * platform/graphics/glx/GLContextGLX.cpp: (WebCore::GLContextGLX::createWindowContext): (WebCore::GLContextGLX::createContext): (WebCore::GLContextGLX::GLContextGLX): * platform/graphics/glx/GLContextGLX.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: * platform/graphics/x11/PlatformDisplayX11.cpp: 2016-10-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Avoid strstr() when checking (E)GL extensions https://bugs.webkit.org/show_bug.cgi?id=161958 Reviewed by Žan Doberšek. Add static method GLContext::isExtensionSupported() to properly search extenstions in the given extension list, and use it instead of strstr(). * platform/graphics/GLContext.cpp: (WebCore::GLContext::isExtensionSupported): * platform/graphics/GLContext.h: * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createSurfacelessContext): * platform/graphics/glx/GLContextGLX.cpp: (WebCore::hasSGISwapControlExtension): 2016-10-20 Per Arne Vollan <pvollan@apple.com> [Win][Direct2D] Implement ImageBufferData::getData. https://bugs.webkit.org/show_bug.cgi?id=163668 Reviewed by Brent Fulgham. Render data to a bitmap in system memory, which data can be read from. * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::getData): * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::ImageBuffer): 2016-10-20 Carlos Garcia Campos <cgarcia@igalia.com> Wrong use of EGL_DEPTH_SIZE https://bugs.webkit.org/show_bug.cgi?id=155536 Reviewed by Michael Catanzaro. What happens here is that the driver doesn't implement EGL_DEPTH_SIZE and the default value, which is 0, is returned. Then XCreatePixmap fails because 0 is not a valid depth. The thing is that even if EGL_DEPTH_SIZE or EGL_BUFFER_SIZE returned a valid depth, it still might not be supported by the default screen and XCreatePixmap can fail. What we need to ensure is that the depth we pass is compatible with the X display, not only with the EGL config, to avoid failures when creating the pixmap. So, we can use EGL_NATIVE_VISUAL_ID instead, and then ask X for the visual info for that id. If it isn't found then we just return before creating the pixmap, but if the visual is found then we can be sure that the depth of the visual will not make the pixmap creation fail. However, with the driver I'm using it doesn't matter how we create the pixmap that eglCreatePixmapSurface always fails, again with X errors that are fatal by default. Since the driver is not free, I assume it doesn't support eglCreatePixmapSurface or it's just buggy, so the only option we have here is trap the x errors and ignore them. It turns out that the X errors are not fatal in this case, because eglCreatePixmapSurface ends up returning a surface, and since these are offscreen contexts, it doesn't really matter if they contain an invalid pixmap, because we never do swap buffer on them, so just ignoring the X errors fixes the crashes and makes everythig work. This patch adds a helper class XErrorTrapper that allows to trap XErrors and decide what to do with them (ignore, warn or crash) or even not consider a particular set of errors as errors. * PlatformEfl.cmake: Add new file to compilation. * PlatformGTK.cmake: Ditto. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createPixmapContext): Use EGL_NATIVE_VISUAL_ID instead of EGL_DEPTH_SIZE to figure out the depth to be passed to XCreatePixmap. Also use the XErrorTrapper class to ignore all BadDrawable errors produced by eglCreatePixmapSurface() and only show a warning about all other X errors. * platform/graphics/x11/XErrorTrapper.cpp: Added. (WebCore::xErrorTrappersMap): (WebCore::XErrorTrapper::XErrorTrapper): (WebCore::XErrorTrapper::~XErrorTrapper): (WebCore::XErrorTrapper::errorCode): (WebCore::XErrorTrapper::errorEvent): * platform/graphics/x11/XErrorTrapper.h: Added. (WebCore::XErrorTrapper::XErrorTrapper): 2016-10-20 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr> WebRTC: The MediaStreamTrackEvent init dictionary needs a required track member https://bugs.webkit.org/show_bug.cgi?id=146232 Update MediaStreamTrackEvent IDL as per specification. Reviewed by Darin Adler. No additional test required, rebase existings tests. * Modules/mediastream/MediaStreamTrackEvent.idl: 2016-10-19 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: mute support https://bugs.webkit.org/show_bug.cgi?id=163677 <rdar://problem/28851582> Reviewed by Dean Jackson. We introduce the MuteSupport class which brings support for muting the media by clicking on the mute button in the media controls and correctly reflecting the media's muted state should the media be muted via the media API. Tests: media/modern-media-controls/mute-support/mute-support-button-click.html media/modern-media-controls/mute-support/mute-support-media-api.html media/modern-media-controls/mute-support/mute-support-muted.html * Modules/modern-media-controls/media/media-controller.js: (MediaController): * Modules/modern-media-controls/media/mute-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js. (MuteSupport.prototype.get control): (MuteSupport.prototype.get mediaEvents): (MuteSupport.prototype.buttonWasClicked): (MuteSupport.prototype.syncControl): (MuteSupport): * WebCore.xcodeproj/project.pbxproj: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsScript): 2016-10-19 Alex Christensen <achristensen@webkit.org> Revert r207151 https://bugs.webkit.org/show_bug.cgi?id=163675 Reviewed by Brent Fulgham. This code is still useful for comparison with Windows. I'll remove it again soon. No new tests. No change in behavior. * WebCore.xcodeproj/project.pbxproj: * WebCorePrefix.h: * loader/DocumentLoader.h: * loader/EmptyClients.h: * loader/FrameLoaderClient.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveAuthenticationChallenge): * loader/ResourceLoader.h: * loader/SubresourceLoader.h: * loader/cf/ResourceLoaderCFNet.cpp: * loader/cocoa/SubresourceLoaderCocoa.mm: (WebCore::SubresourceLoader::willCacheResponse): * loader/mac/DocumentLoaderMac.cpp: * loader/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::willCacheResponse): * page/mac/PageMac.mm: (WebCore::Page::platformInitialize): (WebCore::Page::addSchedulePair): (WebCore::Page::removeSchedulePair): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::WebCoreNSURLAuthenticationChallengeClient::create): (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge): * platform/mac/WebCoreSystemInterface.h: * platform/network/NetworkStorageSession.h: * platform/network/ProtectionSpace.h: * platform/network/ProtectionSpaceBase.cpp: * platform/network/ResourceHandle.cpp: * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.cpp: * platform/network/ResourceHandleClient.h: * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/ResourceRequestBase.cpp: * platform/network/cf/AuthenticationCF.cpp: (WebCore::AuthenticationChallenge::AuthenticationChallenge): (WebCore::AuthenticationChallenge::setAuthenticationClient): Deleted. (WebCore::AuthenticationChallenge::authenticationClient): Deleted. (WebCore::AuthenticationChallenge::platformCompare): Deleted. (WebCore::createCF): Deleted. (WebCore::core): Deleted. * platform/network/cf/AuthenticationCF.h: * platform/network/cf/AuthenticationChallenge.h: * platform/network/cf/CookieJarCFNet.cpp: * platform/network/cf/CredentialStorageCFNet.cpp: (WebCore::CredentialStorage::getFromPersistentStorage): (WebCore::CredentialStorage::saveToPersistentStorage): * platform/network/cf/LoaderRunLoopCF.cpp: * platform/network/cf/LoaderRunLoopCF.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::cookieStorage): * platform/network/cf/ProtectionSpaceCFNet.cpp: * platform/network/cf/ProtectionSpaceCFNet.h: * platform/network/cf/ResourceError.h: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::shouldSniffConnectionProperty): (WebCore::ResourceHandle::createCFURLConnection): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::schedule): (WebCore::ResourceHandle::unschedule): * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp: * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: * platform/network/cf/ResourceRequest.h: (WebCore::ResourceRequest::encodingRequiresPlatformData): * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction): (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction): (WebCore::ResourceRequest::doUpdatePlatformRequest): (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): (WebCore::ResourceRequest::doUpdateResourceRequest): (WebCore::ResourceRequest::setStorageSession): * platform/network/cf/ResourceRequestCFNet.h: * platform/network/cf/ResourceResponse.h: * platform/network/cf/ResourceResponseCFNet.cpp: (WebCore::ResourceResponse::cfURLResponse): * platform/network/cf/SynchronousLoaderClientCFNet.cpp: * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace): * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: * platform/network/cocoa/CredentialCocoa.h: * platform/network/cocoa/CredentialCocoa.mm: (WebCore::Credential::Credential): (WebCore::Credential::cfCredential): * platform/network/cocoa/ProtectionSpaceCocoa.h: * platform/network/cocoa/ProtectionSpaceCocoa.mm: (WebCore::ProtectionSpace::ProtectionSpace): (WebCore::ProtectionSpace::cfSpace): * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::nsURLRequest): * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::ResourceResponse::platformCertificateInfo): (WebCore::ResourceResponse::nsURLResponse): (WebCore::ResourceResponse::ResourceResponse): * platform/network/ios/QuickLook.h: * platform/network/ios/QuickLook.mm: (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): (-[WebQuickLookHandleAsDelegate detachHandle]): (WebCore::QuickLookHandle::create): (WebCore::QuickLookHandle::cfResponse): * platform/network/mac/AuthenticationMac.mm: (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): (WebCore::core): (WebCore::mac): * platform/network/mac/CookieJarMac.mm: (WebCore::setCookiesFromDOM): (WebCore::addCookie): (WebCore::cookieStorage): * platform/network/mac/CredentialStorageMac.mm: * platform/network/mac/FormDataStreamMac.h: * platform/network/mac/FormDataStreamMac.mm: * platform/network/mac/ResourceErrorMac.mm: (NSErrorFromCFError): (WebCore::ResourceError::ResourceError): (WebCore::ResourceError::nsError): (WebCore::ResourceError::operator NSError *): * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::getConnectionTimingData): * platform/network/mac/ResourceRequestMac.mm: Added. (WebCore::ResourceRequest::ResourceRequest): (WebCore::ResourceRequest::updateNSURLRequest): * platform/network/mac/SynchronousLoaderClient.mm: * platform/network/mac/WebCoreResourceHandleAsDelegate.h: * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: * platform/network/mac/WebCoreURLResponse.mm: * platform/win/TemporaryLinkStubs.cpp: * testing/js/WebCoreTestSupportPrefix.h: 2016-10-19 Jer Noble <jer.noble@apple.com> REGRESSION (r206025): All YouTube videos play with black bars on all four sides https://bugs.webkit.org/show_bug.cgi?id=163308 Reviewed by Darin Adler. Test: media/media-source/media-source-resize.html After r206025, we do not fire resize events when the size change notification happens equal- to-or-before the current time, which can happen at the very beginning of a stream. Take care of this case by checking that the target time isn't actually in the past inside of sizeWillChangeAtTime(), and also always skip the boundary time observer when there was no previous size (such as after a flush due to a seek). * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples): (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): 2016-10-19 Nan Wang <n_wang@apple.com> AX: [Mac] Mark element AXAPI should comform to specs https://bugs.webkit.org/show_bug.cgi?id=163707 Reviewed by Chris Fleizach. Created a new role for mark elements on Mac and exposed the role description. Changes are covered in modified test expectaions. * English.lproj/Localizable.strings: * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::determineAccessibilityRole): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]): * accessibility/mac/AccessibilityObjectMac.mm: (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (createAccessibilityRoleMap): (-[WebAccessibilityObjectWrapper roleDescription]): * platform/LocalizedStrings.cpp: (WebCore::AXMarkText): * platform/LocalizedStrings.h: 2016-10-19 Alex Christensen <achristensen@webkit.org> Re-enable URLParser for non-Safari Cocoa apps after r207321 https://bugs.webkit.org/show_bug.cgi?id=163690 Reviewed by Darin Adler. I disabled the URLParser for non-Safari applications in r207305 to give me time to make URLParser more compatible, which I did in r207321 Updated some API tests which will be investigated in https://bugs.webkit.org/show_bug.cgi?id=163127 * platform/URLParser.cpp: (WebCore::URLParser::setEnabled): (WebCore::URLParser::enabled): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setURLParserEnabled): Deleted. * testing/js/WebCoreTestSupport.h: 2016-10-19 Myles C. Maxfield <mmaxfield@apple.com> CSS font-variation-settings does not handle uppercase axis names in variable fonts https://bugs.webkit.org/show_bug.cgi?id=163546 Reviewed by Dean Jackson. Remove the extra toASCIILower() call. Test: fast/text/variations/case-axis-names.html * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseFontVariationTag): 2016-10-19 Anders Carlsson <andersca@apple.com> Remove m_redirectURLs from HistoryItem https://bugs.webkit.org/show_bug.cgi?id=163704 Reviewed by Dan Bernstein. * history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem): (WebCore::HistoryItem::reset): * history/HistoryItem.h: 2016-10-19 Joone Hur <joone.hur@intel.com> Add a plain space instead of between text nodes https://bugs.webkit.org/show_bug.cgi?id=123163 Reviewed by Ryosuke Niwa. When we rebalance white spaces, can be added as space under some conditions. This patch adds a condition that the next sibling text node should not exist. No new tests, updated existing test. * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): * editing/htmlediting.cpp: (WebCore::stringWithRebalancedWhitespace): * editing/htmlediting.h: 2016-10-19 Sam Weinig <sam@webkit.org> Add support for sequences and dictionaries in unions https://bugs.webkit.org/show_bug.cgi?id=163695 Reviewed by Chris Dumez. Tests: - Updated js/dom/webidl-type-mapping.html * bindings/generic/IDLTypes.h: Add additional helper predicates and fix formatting. * bindings/js/JSDOMBinding.h: Export hasIteratorMethod for use in testing. * bindings/js/JSDOMConvert.h: - Change return type of Converter<IDLDictionary<T>> to T, from Optional<T>. - Add support for unions conversion step 12 (parts 1-3). * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): Support complex default value computations for unions using the convert infrastructure. (GenerateParametersCheck): (GenerateConstructorDefinition): Remove incorrect .value() calls now that Converter<IDLDictionary<T>> returns T. * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: Update bindings test results. * testing/TypeConversions.h: (WebCore::TypeConversions::setTypeConversionsDictionary): (WebCore::TypeConversions::typeConversionsDictionaryLongValue): (WebCore::TypeConversions::typeConversionsDictionaryStringValue): (WebCore::TypeConversions::typeConversionsDictionarySequenceValue): (WebCore::TypeConversions::typeConversionsDictionaryUnionType): * testing/TypeConversions.idl: Add some complex types to allow testing IDL conversions from tests. 2016-10-19 Ryosuke Niwa <rniwa@webkit.org> Annotate more DOM and HTML IDLs with CEReactions https://bugs.webkit.org/show_bug.cgi?id=163653 Reviewed by Darin Adler. Added CEReactions to more IDL files. Test: fast/custom-elements/reactions-for-webkit-extensions.html * bindings/js/JSDOMStringMapCustom.cpp: (WebCore::JSDOMStringMap::deleteProperty): Instantiate CustomElementReactionStack, which is equivalent to adding CEReactions in IDL. (WebCore::JSDOMStringMap::putDelegate): Ditto. * dom/Document.idl: * dom/Element.idl: * html/HTMLElement.idl: * page/DOMSelection.idl: 2016-10-19 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r207557. This change caused animations/font-variations tests to time out on pre-Sierra Macs. Reverted changeset: "[macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9" https://bugs.webkit.org/show_bug.cgi?id=163374 http://trac.webkit.org/changeset/207557 2016-10-19 Dave Hyatt <hyatt@apple.com> [CSS Parser] Support -webkit-border-fit https://bugs.webkit.org/show_bug.cgi?id=163687 Reviewed by Zalan Bujtas. Add support for -webkit-border-fit to isValidKeywordPropertyAndValue. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 2016-10-19 Dave Hyatt <hyatt@apple.com> [CSS Parser] class and id parsing need to be case-insensitive in HTML quirks mode https://bugs.webkit.org/show_bug.cgi?id=163685 Reviewed by Zalan Bujtas. Class and ID parsing should be case-insensitive in quirks mode. Apply the same hack that the old parser did and lowercase the class and ids in place. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeId): (WebCore::CSSSelectorParser::consumeClass): 2016-10-19 Nan Wang <n_wang@apple.com> AX: crash: com.apple.WebCore: WebCore::AccessibilityObject::findMatchingObjects + 600 https://bugs.webkit.org/show_bug.cgi?id=163682 Reviewed by Chris Fleizach. There's a null pointer crash when we ask for startObject->parentObjectUnignored() in AccessibilityObject::findMatchingObject. Added a null check for the startObject to fix that. Test: accessibility/mac/search-predicate-crash.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::findMatchingObjects): 2016-10-19 David Kilzer <ddkilzer@apple.com> Bug 163670: Refine assertions in WebCore::ImageData constructors <https://webkit.org/b/163670> <rdar://problem/27497338> Reviewed by Brent Fulgham. No new tests because there is no change in nominal behavior. * html/ImageData.cpp: (WebCore::ImageData::ImageData(const IntSize&)): Change to use ASSERT() since the worst-case scenario here is a nullptr deref. Switch to IntSize::area() to compute the area. (WebCore::ImageData::ImageData(const IntSize&, Ref<Uint8ClampedArray>&&)): Add ASSERT() identical to the previous constructor, and change ASSERT_WITH_SECURITY_IMPLICATION() to only fire when m_data is not nullptr and the length check fails. Switch to IntSize::area() to compute the area. 2016-10-19 Myles C. Maxfield <mmaxfield@apple.com> [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9 https://bugs.webkit.org/show_bug.cgi?id=163374 Reviewed by Darin Adler. Because of platform lack of support for variations in in-memory fonts, this feature should be disabled on the affected OSes. No tests because there is no behavior change (on the relevant platforms). * Configurations/FeatureDefines.xcconfig: 2016-10-19 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix background-position parsing https://bugs.webkit.org/show_bug.cgi?id=163681 Reviewed by Dean Jackson. The new parser has a more efficient parsed representation of background positions. When background-position is "center" or when no length unit is specified for a dimension, then rather than creating a pair, the new parser makes a singleton primitive value. Patch the StyleBuilder code to handle this case, resolving center to (left,50%) or (top,50%) as appropriate and also handling top/left without any associated length. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapFillXPosition): (WebCore::CSSToStyleMap::mapFillYPosition): 2016-10-19 Antoine Quint <graouts@apple.com> [Modern Media Controls] Media Controller: click-to-start support https://bugs.webkit.org/show_bug.cgi?id=163659 <rdar://problem/28845656> Reviewed by Dean Jackson. We introduce the MediaControllerSupport class which will allow a number of media controller features to be implemented by subclasses each devoted to implementing a specific subset of media controller features. With this bug, we add the correct behavior for click-to-start, only showing the start button under the right circumstances. A MediaController object indicates which media control to attach click event listeners to through the `control` property, and a list of media events it should register on the media element through the `mediaEvents` property. Then, as the user interacts with the specified control and the media, the Button delegation method `buttonWasClicked()` and the `syncControl()` methods are called to allow for the media state to be correctly set and represented in the media controls. Custom event handling for the specified events can also be achieved by subclassing the `handleEvent()` method. Tests: media/modern-media-controls/start-support/start-support-audio.html media/modern-media-controls/start-support/start-support-autoplay.html media/modern-media-controls/start-support/start-support-click-to-start.html media/modern-media-controls/start-support/start-support-error.html media/modern-media-controls/start-support/start-support-fullscreen.html media/modern-media-controls/start-support/start-support-manual-play.html media/modern-media-controls/start-support/start-support-no-source.html * Modules/modern-media-controls/media/media-controller-support.js: Added. (MediaControllerSupport): (MediaControllerSupport.prototype.get control): (MediaControllerSupport.prototype.get mediaEvents): (MediaControllerSupport.prototype.buttonWasClicked): (MediaControllerSupport.prototype.handleEvent): (MediaControllerSupport.prototype.syncControl): * Modules/modern-media-controls/media/media-controller.js: (MediaController): (MediaController.prototype.buttonWasClicked): Deleted. * Modules/modern-media-controls/media/start-support.js: Added. (StartSupport.prototype.get control): (StartSupport.prototype.get mediaEvents): (StartSupport.prototype.buttonWasClicked): (StartSupport.prototype.handleEvent): (StartSupport.prototype.syncControl): (StartSupport.prototype._shouldShowStartButton): (StartSupport): 2016-10-19 Aaron Chu <aaron_chu@apple.com> Web Inspector: AXI: expose computed tree node and heading level https://bugs.webkit.org/show_bug.cgi?id=130825 <rdar://problem/16442349> Reviewed by Joseph Pecoraro. Exposing two new accessibility properties: Heading Level and Hierarchical Level. Updated Test: LayoutTest/inspector/dom/getAccessibilityPropertiesForNode.html * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): 2016-10-19 Adam Bergkvist <adam.bergkvist@ericsson.com> WebRTC: Implement MediaEndpointPeerConnection::stop() https://bugs.webkit.org/show_bug.cgi?id=163660 Reviewed by Philippe Normand. Make MediaEndpointPeerConnection::stop() stop its MediaEndpoint. Testing: This fix deals with cleanup and tearing down resources down in the platform layer and is not covered by automated tests. It is however observable in the manual test added in [1] where the remote videos should stop when the connections are closed. [1] http://webkit.org/b/163327 * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::stop): 2016-10-19 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix -webkit-mask-box-image parsing https://bugs.webkit.org/show_bug.cgi?id=163676 Reviewed by Dean Jackson. -webkit-mask-box-image is not a shorthand in our current code, so treat it the same as the legacy -webkit-border-image. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseShorthand): 2016-10-19 Carlos Alberto Lopez Perez <clopez@igalia.com> [GTK][EFL] Build fix after r207543. https://bugs.webkit.org/show_bug.cgi?id=163671 Unreviewed. Fix typo on the filename of the included header: Mac filesystem is case insensitive, but Linux filesystems are case sensitive. * css/parser/CSSPropertyParser.cpp: 2016-10-19 Zalan Bujtas <zalan@apple.com> Use anonymous table row for new child at RenderTableRow::addChild() if available. https://bugs.webkit.org/show_bug.cgi?id=163651 <rdar://problem/28705022> Reviewed by David Hyatt. We should try to prevent the continuation siblings from getting separated and inserted into wrapper renderers. It makes finding these continuation siblings difficult. This patch adds a checks for anonymous table rows so that we could find a closer common ancestor of beforeChild/new child. Test: fast/table/crash-when-table-has-continuation-and-content-inserted.html * rendering/RenderObject.cpp: (WebCore::RenderObject::showRenderObject): Add continuation information. * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): 2016-10-19 Joseph Pecoraro <pecoraro@apple.com> Cleanup WebCore/workers https://bugs.webkit.org/show_bug.cgi?id=163635 Reviewed by Chris Dumez. * workers/*: Cleanup like pragma once, nullptr, remove stale includes, declarations. 2016-10-19 Chris Dumez <cdumez@apple.com> MouseEvent's coordinates should be 0 for simulated clicks https://bugs.webkit.org/show_bug.cgi?id=163648 Reviewed by Darin Adler. MouseEvent's coordinates should be 0 / 0 for simulated clicks triggered by JavaScript (i.e. via element.click()). This behavior matches Chrome and Firefox. WebKit was computing actual coordinates for the element which was expensive, especially because computing screenX / screenY required a synchronous IPC with the UI process. Test: fast/events/element-click-no-coords.html * dom/Element.cpp: (WebCore::Element::dispatchSimulatedClick): * dom/SimulatedClick.cpp: (WebCore::simulateMouseEvent): (WebCore::simulateClick): * dom/SimulatedClick.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::click): 2016-10-19 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix transform parsing https://bugs.webkit.org/show_bug.cgi?id=163671 Reviewed by Dean Jackson. The new parser turned function names into CSSValueIDs and made CSSFunctionValue store them. This meant it could be used to handle transform values, with the function name representing the transform operation efficiently as a CSSValueID. The old parser, however, creates WebKitCSSTransformValues. This value does not exist in the new parser. Rather than forcing the old and new parser over to CSSFunctionValues, I opted to just make the new parser build WebkitCSSTransformValues too. The main reason I did this is that WebkitCSSTransformValue is actually exposed to the Web via IDL. To be safe, I am not eliminating it (even though Blink has). * css/parser/CSSPropertyParser.cpp: (WebCore::consumeTranslate3d): (WebCore::consumeNumbers): (WebCore::consumePerspective): (WebCore::transformOperationForCSSValueID): (WebCore::consumeTransformValue): 2016-10-19 Darin Adler <darin@apple.com> Move XPath from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163656 Reviewed by Chris Dumez. * dom/Document.cpp: (WebCore::Document::createExpression): Use ExceptionOr. (WebCore::Document::createNSResolver): Return Ref. (WebCore::Document::evaluate): Use ExceptionOr. * dom/Document.h: Updated for above changes. * dom/Document.idl: Use non-legacy exceptions for the functions above. * inspector/InspectorNodeFinder.cpp: (WebCore::InspectorNodeFinder::searchUsingXPath): Call XPath functions with new interface. * xml/DOMParser.cpp: (WebCore::DOMParser::DOMParser): Marked inline. (WebCore::DOMParser::create): Moved here from header. (WebCore::DOMParser::parseFromString): Use ExceptionOr. * xml/DOMParser.h: Updated for above changes. * xml/DOMParser.idl: Use non-legacy exception. * xml/XPathEvaluator.cpp: (WebCore::XPathEvaluator::createExpression): Use ExceptionOr. (WebCore::XPathEvaluator::evaluate): Ditto. * xml/XPathEvaluator.h: Updated for above changes. * xml/XPathEvaluator.idl: Use non-legacy exceptions. * xml/XPathExpression.cpp: (WebCore::XPathExpression::createExpression): Use ExceptionOr. (WebCore::XPathExpression::evaluate): Ditto. * xml/XPathExpression.h: Updated for above changes. * xml/XPathExpression.idl: Use non-legacy exceptions. * xml/XPathGrammar.y: Added include of XPathStep.h. * xml/XPathParser.cpp: (WebCore::XPath::Parser::Parser): Initialize three scalar data members in the class definition rather than here. (WebCore::XPath::Parser::parseStatement): Use ExceptionOr. * xml/XPathParser.h: Updated for above changes. * xml/XPathResult.cpp: (WebCore::XPathResult::XPathResult): Use a reference rather than a pointer for the document. Alao initialize two scalar data members in the class definition rather than here. (WebCore::XPathResult::convertTo): Use ExceptionOr. (WebCore::XPathResult::numberValue): Ditto. (WebCore::XPathResult::stringValue): Ditto. (WebCore::XPathResult::booleanValue): Ditto. (WebCore::XPathResult::singleNodeValue): Ditto. (WebCore::XPathResult::snapshotLength): Ditto. (WebCore::XPathResult::iterateNext): Ditto. (WebCore::XPathResult::snapshotItem): Ditto. * xml/XPathResult.h: Updated for the changes above. * xml/XPathResult.idl: Use non-legacy exceptions. 2016-10-19 Nan Wang <n_wang@apple.com> AX: [Mac] Meter element should use AXValueDescription to descrbe the status of the value https://bugs.webkit.org/show_bug.cgi?id=163610 Reviewed by Chris Fleizach. Exposed the goodness of the meter value in AXValueDescription. Test: accessibility/mac/meter-gauge-value-description.html * English.lproj/Localizable.strings: * accessibility/AccessibilityProgressIndicator.cpp: (WebCore::AccessibilityProgressIndicator::gaugeRegionValueDescription): * accessibility/AccessibilityProgressIndicator.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper valueDescriptionForMeter]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * platform/LocalizedStrings.cpp: (WebCore::AXMeterGaugeRegionOptimumText): (WebCore::AXMeterGaugeRegionSuboptimalText): (WebCore::AXMeterGaugeRegionLessGoodText): * platform/LocalizedStrings.h: 2016-10-19 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix named color parsing https://bugs.webkit.org/show_bug.cgi?id=163662 Reviewed by Zalan Bujtas. Named color parsing in the old parser for extended colors relied on constructing a Color with the name and doing a lookup that way. The new parser allows the back end to hold a primitive identifier value for extended colors. StyleColor contains a helper function for looking up the correct color. This patch switches both the old and the new parsers over to the new StyleColor function. Also remove some asserts from the CSSSelectorList, since the new parser allows it to be empty and detects parsing failure that way. * css/CSSSelectorList.cpp: (WebCore::CSSSelectorList::CSSSelectorList): (WebCore::CSSSelectorList::operator=): * css/StyleColor.cpp: (WebCore::StyleColor::isColorKeyword): * css/StyleResolver.cpp: (WebCore::StyleResolver::colorFromPrimitiveValue): (WebCore::colorForCSSValue): Deleted. 2016-10-19 Youenn Fablet <youenn@apple.com> Remove SecurityOrigin::taintsCanvas https://bugs.webkit.org/show_bug.cgi?id=163594 Reviewed by Darin Adler. No change of behavior. * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::wouldTaintOrigin): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canReceiveDragData): (WebCore::SecurityOrigin::taintsCanvas): Deleted. * page/SecurityOrigin.h: 2016-10-18 Dave Hyatt <hyatt@apple.com> [CSS Parser] Fix compound selector parsing. https://bugs.webkit.org/show_bug.cgi?id=163649 Reviewed by Darin Adler. The new CSS parser is failing to handle compound selectors. The code has an assumption that the first value in the RelationType enum is SubSelector. This patch changes the enum to have the same name used in Blink, RelationType, and to make the ordering be exactly the same. * css/CSSSelector.h: (WebCore::CSSSelector::relation): (WebCore::CSSSelector::setRelation): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): (WebCore::canMatchHoverOrActiveInQuirksMode): (WebCore::SelectorChecker::determineLinkMatchType): * css/SelectorFilter.cpp: (WebCore::SelectorFilter::collectIdentifierHashes): * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::insertTagHistory): (WebCore::CSSParserSelector::appendTagHistory): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::setRelation): * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeComplexSelector): (WebCore::CSSSelectorParser::consumeCombinator): * css/parser/CSSSelectorParser.h: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): (WebCore::SelectorCompiler::constructFragmentsInternal): 2016-10-19 Javier Fernandez <jfernandez@igalia.com> Web Inspector: Debugger buttons positioned incorrectly, align-content default value is unexpected https://bugs.webkit.org/show_bug.cgi?id=163572 Reviewed by Sergio Villar Senin. We only allow the new CSS Box Alignment syntax when the Grid Layout feature is enabled. Due to flexbox backward compatibility we have implemented a different code path for the style initial/default values assignment. However, we have incorrectly resolved both align-content and justify-content to 'flex-start' when grid layout is disabled. This patch changes the approach, so we set 'normal' (the value specified by the new syntax) for both properties, but using the values defined in the old syntax (Flexbox specification) at computed style resolution. Since 'stretch' is the default value for the align-content property, this issue implies that any flexbox line with an undefined height will be laid out incorrectly, if not explicitly set via CSS, because flex items can't use the available height, even though they use 'stretch' for their 'align-self' properties. Test: css3/flexbox/flexbox-lines-must-be-stretched-by-default.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): (WebCore::ComputedStyleExtractor::propertyValue): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialContentAlignment): 2016-10-19 Carlos Alberto Lopez Perez <clopez@igalia.com> [GTK] REGRESSION(r207396) Build broken with Clang. https://bugs.webkit.org/show_bug.cgi?id=163599 Suggested and reviewed by Darin Adler. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::getStringValue): 2016-10-19 Darin Adler <darin@apple.com> Try to fix build. * page/PerformanceUserTiming.cpp: Add back class name; needed by some compiler versions. 2016-10-19 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix the build after r207522. * page/PerformanceUserTiming.cpp: Include PerformanceTiming.h. 2016-10-19 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix the build after r207519. The build error is: IDL ATTRIBUTE CHECKER ERROR: Unknown IDL attribute [PassContext] is found at TestRunner.idl. Because PassContext was removed from IDLAttributes.txt in rr207519, but it's implemented by CodeGeneratorTestRunner.pm and used by TestRunner.idl. * bindings/scripts/IDLAttributes.txt: Bring back PassContext. 2016-10-19 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix the build with GCC 4.9 after r207463. Add constructors to MediaConstraintsData. * Modules/mediastream/MediaConstraintsImpl.h: (WebCore::MediaConstraintsData::MediaConstraintsData): 2016-10-19 Jer Noble <jer.noble@apple.com> [Mac][MSE] Movies with a 'mehd' box have a zero-duration https://bugs.webkit.org/show_bug.cgi?id=163641 Reviewed by Darin Adler. Test: media/media-source/media-source-init-segment-duration.html The canonical (ISO/IEC 14496-12:2012) way to signal the duration of a fragmented media file is to add a 'mehd' box to the 'mvex' container box specifying the duration of the fragment. Support this through the AVAsset -overallDurationHint property. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): * platform/spi/mac/AVFoundationSPI.h: 2016-10-18 Darin Adler <darin@apple.com> Move many miscellaneous classes from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163645 Reviewed by Ryosuke Niwa. * bindings/js/JSCryptoCustom.cpp: (WebCore::JSCrypto::getRandomValues): Use propagateException. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::handlePostMessage): Ditto. (WebCore::JSDOMWindow::setTimeout): Use toJSNumber. (WebCore::JSDOMWindow::setInterval): Ditto. * bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::nameGetter): Use propagateException. (WebCore::JSStorage::deleteProperty): Ditto. (WebCore::JSStorage::getOwnPropertyNames): Ditto. (WebCore::JSStorage::putDelegate): Ditto. * loader/appcache/DOMApplicationCache.cpp: (WebCore::DOMApplicationCache::update): Use ExceptionOr. (WebCore::DOMApplicationCache::swapCache): Ditto. * loader/appcache/DOMApplicationCache.h: Update for above changes. * loader/appcache/DOMApplicationCache.idl: Use non-legacy exceptions. * page/Crypto.cpp: (WebCore::Crypto::getRandomValues): Use ExceptionOr. (WebCore::Crypto::webkitSubtle): Ditto. * page/Crypto.h: Updated for above changes. * page/Crypto.idl: Use non-legacy exceptions. * page/DOMWindow.cpp: (WebCore::DOMWindow::DOMWindow): Initialize many data members in the class definition instead of here. (WebCore::DOMWindow::page): Use nullptr. (WebCore::DOMWindow::screen): Ditto. (WebCore::DOMWindow::crypto): Ditto. (WebCore::DOMWindow::locationbar): Ditto. (WebCore::DOMWindow::menubar): Ditto. (WebCore::DOMWindow::personalbar): Ditto. (WebCore::DOMWindow::scrollbars): Ditto. (WebCore::DOMWindow::statusbar): Ditto. (WebCore::DOMWindow::toolbar): Ditto. (WebCore::DOMWindow::applicationCache): Ditto. (WebCore::DOMWindow::sessionStorage): Use ExceptionOr. (WebCore::DOMWindow::localStorage): Ditto. (WebCore::DOMWindow::postMessage): Ditto. (WebCore::DOMWindow::frameElement): Use nullptr. (WebCore::DOMWindow::self): Ditto. (WebCore::DOMWindow::opener): Ditto. (WebCore::DOMWindow::parent): Ditto. (WebCore::DOMWindow::top): Ditto. (WebCore::DOMWindow::getComputedStyle): Use Ref. (WebCore::DOMWindow::setTimeout): Use ExceptionOr. (WebCore::DOMWindow::setInterval): Ditto. (WebCore::didAddStorageEventListener): Use a reference instead of a pointer, and ignore return value instead of using IGNORE_EXCEPTION. (WebCore::DOMWindow::addEventListener): Pass reference to function above. (WebCore::DOMWindow::dispatchEvent): Use enum class version of PageStatus. * page/DOMWindow.h: Updated for changes above. Also changed indentatation. * page/DOMWindow.idl: Use non-legacy exceptions. * page/EventSource.cpp: (WebCore::EventSource::create): Use ExceptionOr. * page/EventSource.h: Updated for change above. * page/EventSource.idl: Use non-legacy exception. * page/Location.cpp: (WebCore::Location::setProtocol): Use ExceptionOr. * page/Location.h: Updated for change above. * page/Location.idl: Use non-legacy exception. * page/Performance.cpp: (WebCore::Performance::Performance): Remove unnecessary initialization of smart pointer to null, and moved initialization of m_resourceTimingBufferSize to the header. (WebCore::Performance::navigation): Made non-const and return a reference. (WebCore::Performance::timing): Ditto. (WebCore::Performance::addResourceTiming): Change LoadTiming argument to use a const& instead of passing in a copy. (WebCore::Performance::webkitMark): Use ExceptionOr and make_unique. (WebCore::Performance::webkitClearMarks): Ditto. (WebCore::Performance::webkitMeasure): Ditto. (WebCore::Performance::webkitClearMeasures): Ditto. (WebCore::Performance::reduceTimeResolution): Use std::floor. * page/Performance.h: Updated for above changes. Removed unneeded includes. Made more things private. Removed unneeded reference counting of UserTiming. * page/Performance.idl: Use non-legacy exceptions. * page/PerformanceUserTiming.cpp: (WebCore::restrictedMarkFunction): Removed unneeded class name. (WebCore::UserTiming::UserTiming): Take a reference instead of a pointer. (WebCore::UserTiming::mark): Use ExceptionOr. (WebCore::UserTiming::findExistingMarkStartTime): Ditto. (WebCore::UserTiming::measure): Ditto. (WebCore::getEntrySequenceByName): Simplified code using HashMap::get. * page/PerformanceUserTiming.h: Updated for above changes. Removed reference counting since this is a single-owner object. * page/UserMessageHandler.cpp: (WebCore::UserMessageHandler::postMessage): Use ExceptionOr. * page/UserMessageHandler.h: Updated for above change. * page/UserMessageHandler.idl: Use non-legacy exception. * storage/Storage.cpp: (WebCore::Storage::length): Use ExceptionOr. (WebCore::Storage::key): Ditto. (WebCore::Storage::getItem): Ditto. (WebCore::Storage::setItem): Ditto. (WebCore::Storage::removeItem): Ditto. (WebCore::Storage::clear): Ditto. (WebCore::Storage::contains): Ditto. * storage/Storage.h: Updated for above change. * storage/Storage.idl: Use non-legacy exceptions. * storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames): Updated for ExceptionOr. (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames): Ditto. 2016-10-18 Darin Adler <darin@apple.com> Move internal testing classes from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163553 Reviewed by Ryosuke Niwa. * bindings/js/JSDOMBinding.h: Added toJSArray. Also exported a function that is now needed in the testing library. * bindings/scripts/CodeGeneratorJS.pm: (NativeToJSValue): Added code to handle the jsArray case with an exception. * css/parser/CSSPropertyParser.cpp: Fix #if to make code compile when CSS_SCROLL_SNAP is not enabled. * dom/Element.cpp: (WebCore::Element::createShadowRoot): Changed return type to a raw pointer. There is no reason it needs to be a RefPtr. * dom/Element.h: Updated for above change. * svg/SVGPathStringBuilder.h: Exported class and made more public so it can be used in test code. * svg/SVGPathUtilities.cpp: (WebCore::pathIteratorForBuildingString): Deleted. Needed only for test code, so moved into there. (WebCore::buildStringFromPath): Deleted. Ditto. * svg/SVGPathUtilities.h: Removed buildStringFromPath. * testing/InternalSettings.cpp: Simplified the guard macro and used the all capitals style that our style guide prescribes for non-function-like macros. (WebCore::InternalSettings::create): Moved here, no longer inline Use m_page. (WebCore::InternalSettings::resetToConsistentState): Updated since settings returns a reference. (WebCore::InternalSettings::settings): Changed to return a reference and assert that m_page is not null; functions all check m_page for null first. (WebCore::InternalSettings::setTouchEventEmulationEnabled): Updated to use ExceptionOr, do an m_page check, and use settings that returns a reference. (WebCore::InternalSettings::setStandardFontFamily): Ditto. (WebCore::InternalSettings::setSerifFontFamily): Ditto. (WebCore::InternalSettings::setSansSerifFontFamily): Ditto. (WebCore::InternalSettings::setFixedFontFamily): Ditto. (WebCore::InternalSettings::setCursiveFontFamily): Ditto. (WebCore::InternalSettings::setFantasyFontFamily): Ditto. (WebCore::InternalSettings::setPictographFontFamily): Ditto. (WebCore::InternalSettings::setTextAutosizingEnabled): Ditto. (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride): Ditto. (WebCore::InternalSettings::setMediaTypeOverride): Ditto. (WebCore::InternalSettings::setCanStartMedia): Ditto. (WebCore::InternalSettings::setAllowsAirPlayForMediaPlayback): Ditto. (WebCore::InternalSettings::setEditingBehavior): Ditto. (WebCore::InternalSettings::setShouldDisplayTrackKind): Ditto. (WebCore::InternalSettings::shouldDisplayTrackKind): Ditto. (WebCore::InternalSettings::setStorageBlockingPolicy): Ditto. (WebCore::InternalSettings::setPreferMIMETypeForImages): Ditto. (WebCore::InternalSettings::setImagesEnabled): Ditto. (WebCore::InternalSettings::setPDFImageCachingPolicy): Ditto. (WebCore::InternalSettings::setMinimumTimerInterval): Ditto. (WebCore::InternalSettings::setDefaultVideoPosterURL): Ditto. (WebCore::InternalSettings::setForcePendingWebGLPolicy): Ditto. (WebCore::InternalSettings::setTimeWithoutMouseMovementBeforeHidingControls): Ditto. (WebCore::InternalSettings::setUseLegacyBackgroundSizeShorthandBehavior): Ditto. (WebCore::InternalSettings::setAutoscrollForDragAndDropEnabled): Ditto. (WebCore::InternalSettings::setFontFallbackPrefersPictographs): Ditto. (WebCore::InternalSettings::setWebFontsAlwaysFallBack): Ditto. (WebCore::InternalSettings::setQuickTimePluginReplacementEnabled): Ditto. (WebCore::InternalSettings::setYouTubeFlashPluginReplacementEnabled): Ditto. (WebCore::InternalSettings::setBackgroundShouldExtendBeyondPage): Ditto. (WebCore::InternalSettings::setShouldConvertPositionStyleOnCopy): Ditto. (WebCore::InternalSettings::setScrollingTreeIncludesFrames): Ditto. (WebCore::InternalSettings::setAllowsInlineMediaPlayback): Ditto. (WebCore::InternalSettings::setAllowsInlineMediaPlaybackAfterFullscreen): Ditto. (WebCore::InternalSettings::setInlineMediaPlaybackRequiresPlaysInlineAttribute): Ditto. (WebCore::InternalSettings::setIndexedDBWorkersEnabled): Ditto. (WebCore::InternalSettings::userInterfaceDirectionPolicy): Ditto. (WebCore::InternalSettings::setUserInterfaceDirectionPolicy): Ditto. (WebCore::InternalSettings::systemLayoutDirection): Ditto. (WebCore::InternalSettings::setSystemLayoutDirection): Ditto. (WebCore::InternalSettings::variationFontsEnabled): Ditto. (WebCore::InternalSettings::setVariationFontsEnabled): Ditto. (WebCore::InternalSettings::forcedPrefersReducedMotionValue): Ditto. (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): Ditto. * testing/InternalSettings.h: Updated for above changes. Also moved Backup to make it private instead of public. * testing/InternalSettings.idl: Use non-legacy execption. Also removed unneeded exception for setIndexedDBWorkersEnabled. * testing/Internals.cpp: Marked InspectorStubFrontend final and made everything private. (WebCore::Internals::setCanShowModalDialogOverride): Use ExceptionOr. (WebCore::Internals::lastSpatialNavigationCandidateCount): Ditto. (WebCore::Internals::animationsAreSuspended): Ditto. (WebCore::Internals::suspendAnimations): Ditto. (WebCore::Internals::resumeAnimations): Ditto. (WebCore::Internals::pauseAnimationAtTimeOnElement): Ditto. (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement): Ditto. (WebCore::Internals::pauseTransitionAtTimeOnElement): Ditto. (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement): Ditto. (WebCore::Internals::elementRenderTreeAsText): Ditto. (WebCore::Internals::ensureShadowRoot): Ditto. (WebCore::Internals::createShadowRoot): Ditto. (WebCore::Internals::shadowRootType): Ditto. (WebCore::Internals::isTimerThrottled): Ditto. (WebCore::Internals::formControlStateOfPreviousHistoryItem): Ditto. (WebCore::Internals::setFormControlStateOfPreviousHistoryItem): Ditto. (WebCore::Internals::absoluteCaretBounds): Ditto. (WebCore::Internals::inspectorHighlightRects): Ditto. (WebCore::Internals::inspectorHighlightObject): Ditto. (WebCore::Internals::markerCountForNode): Ditto. (WebCore::Internals::markerAt): Ditto. (WebCore::Internals::markerRangeForNode): Ditto. (WebCore::Internals::markerDescriptionForNode): Ditto. (WebCore::Internals::dumpMarkerRects): Ditto. (WebCore::Internals::setMarkedTextMatchesAreHighlighted): Ditto. (WebCore::Internals::setScrollViewPosition): Ditto. (WebCore::Internals::setViewBaseBackgroundColor): Ditto. (WebCore::Internals::setPagination): Ditto. (WebCore::Internals::setPaginationLineGridEnabled): Ditto. (WebCore::Internals::configurationForViewport): Ditto. (WebCore::Internals::wasLastChangeUserEdit): Ditto. (WebCore::Internals::scrollElementToRect): Ditto. (WebCore::Internals::autofillFieldName): Ditto. (WebCore::Internals::paintControlTints): Ditto. (WebCore::Internals::rangeForDictionaryLookupAtLocation): Ditto. (WebCore::Internals::setDelegatesScrolling): Ditto. (WebCore::Internals::lastSpellCheckRequestSequence): Ditto. (WebCore::Internals::lastSpellCheckProcessedSequence): Ditto. (WebCore::Internals::wheelEventHandlerCount): Ditto. (WebCore::Internals::touchEventHandlerCount): Ditto. (WebCore::Internals::nodesFromRect): Ditto. (WebCore::Internals::setBatteryStatus): Ditto. (WebCore::Internals::setDeviceProximity): Ditto. (WebCore::Internals::hasSpellingMarker): Ditto. (WebCore::Internals::hasAutocorrectedMarker): Ditto. (WebCore::Internals::handleAcceptedCandidate): Ditto. (WebCore::Internals::isOverwriteModeEnabled): Ditto. (WebCore::Internals::toggleOverwriteModeEnabled): Ditto. (WebCore::Internals::countMatchesForText): Ditto. (WebCore::Internals::countFindMatches): Ditto. (WebCore::Internals::setInspectorIsUnderTest): Ditto. (WebCore::Internals::hasGrammarMarker): Ditto. (WebCore::Internals::numberOfScrollableAreas): Ditto. (WebCore::Internals::isPageBoxVisible): Ditto. (WebCore::Internals::layerTreeAsText): Ditto. (WebCore::Internals::repaintRectsAsText): Ditto. (WebCore::Internals::scrollingStateTreeAsText): Ditto. (WebCore::Internals::mainThreadScrollingReasons): Ditto. (WebCore::Internals::nonFastScrollableRects): Ditto. (WebCore::Internals::setElementUsesDisplayListDrawing): Ditto. (WebCore::Internals::setElementTracksDisplayListReplay): Ditto. (WebCore::Internals::displayListForElement): Ditto. (WebCore::Internals::replayDisplayListForElement): Ditto. (WebCore::Internals::garbageCollectDocumentResources): Ditto. (WebCore::Internals::insertAuthorCSS): Ditto. (WebCore::Internals::insertUserCSS): Ditto. (WebCore::Internals::pageProperty): Ditto. (WebCore::Internals::pageSizeAndMarginsInPixels): Ditto. (WebCore::Internals::setPageScaleFactor): Ditto. (WebCore::Internals::setPageZoomFactor): Ditto. (WebCore::Internals::setTextZoomFactor): Ditto. (WebCore::Internals::setUseFixedLayout): Ditto. (WebCore::Internals::setFixedLayoutSize): Ditto. (WebCore::Internals::setViewExposedRect): Ditto. (WebCore::Internals::setHeaderHeight): Ditto. (WebCore::Internals::setFooterHeight): Ditto. (WebCore::Internals::setTopContentInset): Ditto. (WebCore::Internals::setApplicationCacheOriginQuota): Ditto. (WebCore::Internals::startTrackingRepaints): Ditto. (WebCore::Internals::stopTrackingRepaints): Ditto. (WebCore::Internals::startTrackingLayerFlushes): Ditto. (WebCore::Internals::layerFlushCount): Ditto. (WebCore::Internals::startTrackingStyleRecalcs): Ditto. (WebCore::Internals::styleRecalcCount): Ditto. (WebCore::Internals::startTrackingCompositingUpdates): Ditto. (WebCore::Internals::compositingUpdateCount): Ditto. (WebCore::Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks): Ditto. (WebCore::Internals::getCurrentCursorInfo): Ditto. (WebCore::Internals::mediaElementHasCharacteristic): Ditto. (WebCore::Internals::captionsStyleSheetOverride): Ditto. (WebCore::Internals::setCaptionsStyleSheetOverride): Ditto. (WebCore::Internals::setPrimaryAudioTrackLanguageOverride): Ditto. (WebCore::Internals::setCaptionDisplayMode): Ditto. (WebCore::Internals::selectionBounds): Ditto. (WebCore::Internals::isVibrating): Ditto. (WebCore::Internals::isPluginUnavailabilityIndicatorObscured): Ditto. (WebCore::Internals::beginMediaSessionInterruption): Ditto. (WebCore::Internals::setMediaSessionRestrictions): Ditto. (WebCore::Internals::postRemoteControlCommand): Ditto. (WebCore::Internals::setMockMediaPlaybackTargetPickerState): Ditto. (WebCore::Internals::installMockPageOverlay): Ditto. (WebCore::Internals::pageOverlayLayerTreeAsText): Ditto. (WebCore::Internals::scrollSnapOffsets): Ditto. (WebCore::Internals::pathStringWithShrinkWrappedRects): Moved the code that builds the path string in here for now since it's only used for this testing. (WebCore::Internals::resourceLoadStatisticsForOrigin): Take a const String&. * testing/Internals.h: Updated for above changes. * testing/Internals.idl: Use non-legacy exceptions. 2016-10-18 Chris Dumez <cdumez@apple.com> [Web IDL] Drop webkit-specific extended attributes that are no longer useful https://bugs.webkit.org/show_bug.cgi?id=163643 Reviewed by Ryosuke Niwa. Drop webkit-specific IDL extended attributes that are no longer useful: - [CustomReturn]: I believe this used to be for ObjC bindings. It has no impact in JS bindings. - [Deletable]: It only had an impact on static attributes and was only used on HTMLAllCollection.all, which is not static. I updated the bindings generator to so that static attributes are now configurable by default (unless marked as [Unforgeable], as per Web IDL [1]. This causes Notification.permission (This only static attribute we have) to become deletable. This behavior is consistent with the specification and with Chrome. I added test coverage for this. - [ImplementationNamespace]: Implemented but unused. - [PassContext]: Not implemented and unused. - [TypedArray=*]: Not implemented and unused. [1] https://heycam.github.io/webidl/#es-attributes Test: fast/notifications/notification-permisssion-deletable.html * bindings/scripts/CodeGeneratorJS.pm: (GetNamespaceForInterface): (GenerateImplementation): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * dom/Node.idl: * html/HTMLDocument.idl: 2016-10-18 Sam Weinig <sam@webkit.org> Replace std::experimental::variant with WTF::Variant (or similar) https://bugs.webkit.org/show_bug.cgi?id=163626 Reviewed by Chris Dumez. Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc. into the WTF namespace. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::isBlob): (WebCore::FetchBody::isFormData): (WebCore::FetchBody::isArrayBuffer): (WebCore::FetchBody::isArrayBufferView): (WebCore::FetchBody::isURLSearchParams): (WebCore::FetchBody::isText): (WebCore::FetchBody::blobBody): (WebCore::FetchBody::formDataBody): (WebCore::FetchBody::arrayBufferBody): (WebCore::FetchBody::arrayBufferViewBody): (WebCore::FetchBody::textBody): (WebCore::FetchBody::urlSearchParamsBody): * bindings/generic/IDLTypes.h: * dom/ExceptionOr.h: (WebCore::ExceptionOr<ReturnType>::hasException): (WebCore::ExceptionOr<ReturnType>::releaseException): (WebCore::ExceptionOr<ReturnType>::releaseReturnValue): * dom/MessageEvent.cpp: (WebCore::MessageEvent::source): * dom/MessageEvent.h: * dom/Node.cpp: (WebCore::nodeSetPreTransformedFromNodeOrStringVector): (WebCore::Node::convertNodesOrStringsIntoNode): * dom/Node.h: * html/HTMLOptionsCollection.h: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::add): * html/HTMLSelectElement.h: * html/track/TrackEvent.cpp: (WebCore::TrackEvent::TrackEvent): * html/track/TrackEvent.h: 2016-10-18 Chris Dumez <cdumez@apple.com> Unreviewed, rebaseline bindings tests after Sam's r207505. * bindings/scripts/test/JS/JSTestCallback.cpp: (WebCore::JSTestCallback::callbackWithSerializedScriptValueParam): * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: (WebCore::JSTestCallbackFunction::callbackWithSerializedScriptValueParam): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionSerializedValueCaller): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::jsTestSerializedScriptValueInterfaceValueGetter): (WebCore::jsTestSerializedScriptValueInterfaceReadonlyValueGetter): (WebCore::jsTestSerializedScriptValueInterfaceCachedValueGetter): (WebCore::jsTestSerializedScriptValueInterfaceCachedReadonlyValueGetter): (WebCore::setJSTestSerializedScriptValueInterfaceValueFunction): (WebCore::setJSTestSerializedScriptValueInterfaceCachedValueFunction): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::jsTestTypedefsImmutableSerializedScriptValueGetter): (WebCore::setJSTestTypedefsImmutableSerializedScriptValueFunction): 2016-10-18 Chris Dumez <cdumez@apple.com> [Web IDL] Kill support for [LegacyConstructorTemplate=Event] / [LegacyInitializedByEventConstructor] https://bugs.webkit.org/show_bug.cgi?id=163630 Reviewed by Darin Adler. Kill support for [LegacyConstructorTemplate=Event] / [LegacyInitializedByEventConstructor] in our IDL now that all our events use proper constructors instead. * bindings/scripts/CodeGenerator.pm: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateConstructorDefinition): (GenerateConstructorHelperMethods): (IsConstructable): * bindings/scripts/IDLAttributes.txt: * dom/Event.h: (WebCore::Event::create): * dom/Event.idl: * dom/UIEvent.h: (WebCore::UIEvent::create): * dom/UIEvent.idl: 2016-10-18 Chris Dumez <cdumez@apple.com> Changing details.open should cause a toggle event to be fired asynchronously https://bugs.webkit.org/show_bug.cgi?id=163568 Reviewed by Darin Adler. Changing details.open should cause a toggle event to be fired asynchronously: - https://html.spec.whatwg.org/#details-notification-task-steps Firefox and Chrome implement this, we don't. Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html * dom/EventNames.h: * dom/GlobalEventHandlers.idl: * html/HTMLAttributeNames.in: * html/HTMLDetailsElement.cpp: (WebCore::detailToggleEventSender): (WebCore::HTMLDetailsElement::~HTMLDetailsElement): (WebCore::HTMLDetailsElement::dispatchPendingEvent): (WebCore::HTMLDetailsElement::parseAttribute): * html/HTMLDetailsElement.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::createEventHandlerNameMap): 2016-10-18 Dave Hyatt <hyatt@apple.com> [CSS Parser] Enable basic parser testing. https://bugs.webkit.org/show_bug.cgi?id=163639 Reviewed by Dean Jackson. * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): Remove the ASSERT_NOT_REACHED on the new shadow selectors. We need to implement this eventually, but it's better to not assert on that for now. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::isHostPseudoSelector): Make sure to check that we're a pseudoclass selector first, since otherwise we'll assert. * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching): Make sure to check that we're a pseudoelement selector first, since otherwise we'll assert. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::addExpandedPropertyForValue): copyRef is needed here, since a singleton value is being propagated to all the expanded shorthand properties. (WebCore::parseSingleShadow): (WebCore::CSSPropertyParser::consumeFont): Remove the font properties that aren't part of our shorthand. We will need to revisit this eventually as it seems some of the font properties should be reset as part of this shorthand but aren't. ' * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeInteger): Just return a number for now instead of the parser_integer type. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): Clean this up so that it doesn't assert by making sure to add qualifying checks for the appropriate match type. 2016-10-18 Ryosuke Niwa <rniwa@webkit.org> Update the comment for HTML Imports as there is now a proposal to use ES6 Modules for this. Also replace the contact by me since I'm most familiar with this feature. * features.json: 2016-10-18 Ryosuke Niwa <rniwa@webkit.org> Update the status of shadow DOM API to "Done" with a comment saying we're still fixing bugs. Also update my contact information since I'm no longer on Twitter. * features.json: 2016-10-18 Chris Dumez <cdumez@apple.com> Provide better form validation messages https://bugs.webkit.org/show_bug.cgi?id=163584 Reviewed by Darin Adler. Provide better form validation messages that match more closely the ones from Chrome and Firefox. No new tests, updated existing tests. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::validationMessageValueMissingText): (WebCore::validationMessageValueMissingForCheckboxText): (WebCore::validationMessageValueMissingForFileText): (WebCore::validationMessageValueMissingForMultipleFileText): (WebCore::validationMessageValueMissingForRadioText): (WebCore::validationMessageValueMissingForSelectText): (WebCore::validationMessageTypeMismatchText): (WebCore::validationMessageTypeMismatchForEmailText): (WebCore::validationMessageTypeMismatchForMultipleEmailText): (WebCore::validationMessageTypeMismatchForURLText): (WebCore::validationMessagePatternMismatchText): (WebCore::validationMessageTooShortText): (WebCore::validationMessageTooLongText): (WebCore::validationMessageRangeUnderflowText): (WebCore::validationMessageRangeOverflowText): (WebCore::validationMessageStepMismatchText): (WebCore::validationMessageBadInputForNumberText): 2016-10-18 Dave Hyatt <hyatt@apple.com> Fix GTK build. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-18 Sam Weinig <sam@webkit.org> Simplify SerializedScriptValue, MessagePortArray and ArrayBufferArray to ease generation https://bugs.webkit.org/show_bug.cgi?id=163625 Reviewed by Chris Dumez. - Replace uses of MessagePortArray (a.k.a. Vector<RefPtr<MessagePort>, 1>) with Vector<RefPtr<MessagePort>>. - Replace uses of ArrayBufferArray (a.k.a. Vector<RefPtr<ArrayBuffer>, 1>) with Vector<RefPtr<ArrayBuffer>>. - Add convenience functions to SerializedScriptValue to allow calling with fewer parameters. - Move MessagePorts and ArrayBuffers more where possible. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::putOrAdd): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): * bindings/js/IDBBindingUtilities.cpp: (WebCore::deserializeIDBValueToJSValue): * bindings/js/JSCustomEventCustom.cpp: (WebCore::JSCustomEvent::detail): * bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::state): (WebCore::JSHistory::pushState): (WebCore::JSHistory::replaceState): * bindings/js/JSPopStateEventCustom.cpp: (WebCore::JSPopStateEvent::state): * dom/CustomEvent.cpp: (WebCore::CustomEvent::trySerializeDetail): * dom/ErrorEvent.cpp: (WebCore::ErrorEvent::sanitizedErrorValue): (WebCore::ErrorEvent::trySerializeError): * dom/PopStateEvent.cpp: (WebCore::PopStateEvent::trySerializeState): * page/DOMWindow.cpp: (WebCore::DOMWindow::postMessage): * page/DOMWindow.h: * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::postMessage): * workers/DedicatedWorkerGlobalScope.h: * workers/Worker.cpp: (WebCore::Worker::postMessage): * workers/Worker.h: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::handlePostMessage): * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): * bindings/js/JSDictionary.h: Updated for new SerializedScriptValue interface/vector naming. * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): Update handleInitMessageEvent to check for exceptions and use convert for the MessagePort sequence. * bindings/js/JSMessagePortCustom.cpp: (WebCore::extractTransferables): (WebCore::fillMessagePortArray): Deleted. * bindings/js/JSMessagePortCustom.h: (WebCore::handlePostMessage): Rename fillMessagePortArray to extractTransferables to better express what it does. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): (WebCore::CloneSerializer::CloneSerializer): (WebCore::CloneSerializer::fillTransferMap): (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneDeserializer::deserialize): (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readTerminal): (WebCore::SerializedScriptValue::transferArrayBuffers): (WebCore::SerializedScriptValue::create): (WebCore::SerializedScriptValue::deserialize): * bindings/js/SerializedScriptValue.h: Simplify interface to allow more callers to avoid passing default arguments. Use ExecState& more. * bindings/scripts/CodeGeneratorJS.pm: (GetNativeVectorType): Remove special case for MessagePort. (JSValueToNative): (NativeToJSValue): Updated for new SerializedScriptValue interface. * dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): (WebCore::MessageEvent::create): (WebCore::MessageEvent::initMessageEvent): (WebCore::MessageEvent::trySerializeData): * dom/MessageEvent.h: Store the MessagePort sequence as a Vector<RefPtr<MessagePort>> rather than in a unique_ptr. * dom/MessageEvent.idl: Update last type in init functions to be sequence<MessagePort> rather than Array. They are still custom, as we don't quite generate these correctly yet. * dom/MessagePort.cpp: (WebCore::MessagePort::postMessage): (WebCore::MessagePort::dispatchMessages): (WebCore::MessagePort::disentanglePorts): (WebCore::MessagePort::entanglePorts): * dom/MessagePort.h: Update interface to take MessagePort vectors by rvalue reference. 2016-10-18 Chris Dumez <cdumez@apple.com> [iOS] Drop JSDictionary::convertValue() overload taking a TouchList https://bugs.webkit.org/show_bug.cgi?id=163620 Reviewed by Sam Weinig. Drop JSDictionary::convertValue() overload taking a TouchList now that TouchEvent is using a proper constructor with a TouchEventInit dictionary on iOS. * bindings/js/JSDictionary.cpp: 2016-10-18 Dean Jackson <dino@apple.com> Remove CSS_SHAPES feature definition. This should always be on. https://bugs.webkit.org/show_bug.cgi?id=163628 <rdar://problem/28834613> Reviewed by Tim Horton. CSS Shapes is in Candidate Recommendation. It's a core part of CSS. It should always be enabled. * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::shapePropertyValue): (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSPropertyNames.in: * css/CSSValueKeywords.in: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertShapeValue): * css/parser/CSSParser.cpp: (WebCore::isSimpleLengthPropertyID): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseShapeProperty): * css/parser/CSSParser.h: * inspector/InspectorOverlay.cpp: (WebCore::buildObjectForShapeOutside): (WebCore::buildObjectForElementData): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/FloatingObjects.cpp: (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded): (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded): (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded): * rendering/RenderBlock.cpp: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::positionNewFloats): * rendering/RenderBox.cpp: (WebCore::RenderBox::~RenderBox): (WebCore::RenderBox::styleDidChange): (WebCore::RenderBox::updateShapeOutsideInfoAfterStyleChange): (WebCore::isCandidateForOpaquenessTest): (WebCore::RenderBox::imageChanged): * rendering/RenderBox.h: (WebCore::RenderBox::markShapeOutsideDependentsForLayout): * rendering/RenderElement.cpp: (WebCore::RenderElement::~RenderElement): (WebCore::RenderElement::updateShapeImage): (WebCore::RenderElement::initializeStyle): (WebCore::RenderElement::setStyle): * rendering/RenderElement.h: (WebCore::RenderElement::hasShapeOutside): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForWithReason): * rendering/line/LineWidth.cpp: (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): (WebCore::LineWidth::wrapNextToShapeOutside): (WebCore::LineWidth::fitBelowFloats): * rendering/line/LineWidth.h: * rendering/shapes/ShapeOutsideInfo.cpp: * rendering/shapes/ShapeOutsideInfo.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresLayout): (WebCore::RenderStyle::changeRequiresRepaint): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialShapeImageThreshold): * rendering/style/ShapeValue.cpp: * rendering/style/ShapeValue.h: * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator==): * rendering/style/StyleRareNonInheritedData.h: * style/StylePendingResources.cpp: (WebCore::Style::loadPendingResources): 2016-10-18 Chris Dumez <cdumez@apple.com> convertDictionary<>() no longer needs to return an Optional<> type https://bugs.webkit.org/show_bug.cgi?id=163624 Reviewed by Sam Weinig. convertDictionary<>() no longer needs to return an Optional<> type now that our dictionary structures are all default constructible after <https://trac.webkit.org/changeset/206974>. * bindings/js/JSDOMConvert.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryHeaderContent): (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::convertDictionary<TestEventConstructor::Init>): * bindings/scripts/test/JS/JSTestEventConstructor.h: * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): (WebCore::convertDictionary<AlternateDictionaryName>): (WebCore::convertDictionary<TestObj::ParentDictionary>): (WebCore::convertDictionary<TestObj::ChildDictionary>): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<DictionaryImplName>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: 2016-10-18 Chris Dumez <cdumez@apple.com> Leverage new union type support for HTMLSelectElement.add() / HTMLOptionsCollection.add() https://bugs.webkit.org/show_bug.cgi?id=163608 Reviewed by Ryosuke Niwa. Leverage new union type support for HTMLSelectElement.add() / HTMLOptionsCollection.add(): - https://html.spec.whatwg.org/#htmlselectelement - https://html.spec.whatwg.org/#htmloptionscollection No new tests, rebaseline existing test. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateParametersCheck): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmptyCaller): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::constructJSTestOverloadedConstructorsWithSequence1): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::jsTestTypedefsPrototypeFunctionFuncCaller): * html/HTMLOptGroupElement.idl: * html/HTMLOptionsCollection.cpp: (WebCore::HTMLOptionsCollection::add): * html/HTMLOptionsCollection.h: * html/HTMLOptionsCollection.idl: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::add): (WebCore::HTMLSelectElement::setOption): (WebCore::HTMLSelectElement::setLength): * html/HTMLSelectElement.h: * html/HTMLSelectElement.idl: 2016-10-18 Aaron Chu <aaron_chu@apple.com> Web Inspector: AXI: focused/focusable state should be based on Accessibility Object instead of Element https://bugs.webkit.org/show_bug.cgi?id=163088 <rdar://problem/16421985> Reviewed by Darin Adler. Changed code in InspectDOMAgent so that it determines the focusability of a Node based on the AccessibilityNodeObject and not the Element class. Covered by existing tests: LayoutTests/inspector/dom/getAccessibilityPropertiesForNode.html * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): 2016-10-18 Anders Carlsson <andersca@apple.com> Get rid of more WebHistoryItem cruft https://bugs.webkit.org/show_bug.cgi?id=163623 Reviewed by Tim Horton. * history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem): * history/HistoryItem.h: (WebCore::HistoryItem::setViewportArguments): (WebCore::HistoryItem::bookmarkID): Deleted. (WebCore::HistoryItem::setBookmarkID): Deleted. (WebCore::HistoryItem::sharedLinkUniqueIdentifier): Deleted. (WebCore::HistoryItem::setSharedLinkUniqueIdentifier): Deleted. 2016-10-18 Dave Hyatt <hyatt@apple.com> Fix Windows build. * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): 2016-10-18 Antoine Quint <graouts@apple.com> Modern media controls don't update their rendering correctly https://bugs.webkit.org/show_bug.cgi?id=163603 <rdar://problem/28826022> Reviewed by Dean Jackson. There are rendering issues when we use an absolutely-positioned element as the top-most element in a media element's shadow root (webkit.org/b/163592). Since we only need for that element to be positioned, we can use "position: relative" instead, which removes the rendering issues. * Modules/modern-media-controls/controls/media-controls.css: (.media-controls): (.media-controls,): Deleted. 2016-10-18 Dean Jackson <dino@apple.com> Add preliminary support for extended colors to WebCore::Color https://bugs.webkit.org/show_bug.cgi?id=162878 <rdar://problem/28596413> Follow-up review comments from Darin Adler. * html/canvas/CanvasGradient.cpp: (WebCore::CanvasGradient::addColorStop): Use nullptr. * platform/graphics/Color.cpp: (WebCore::Color::Color): Explicitly zero before assigning the pointer. * platform/graphics/Color.h: Add some comments about the failings of operator== and hash. (WebCore::Color::Color): Add some static_asserts to the constructors. Move the empty and deleted values to static constants. (WebCore::Color::isHashTableDeletedValue): (WebCore::Color::hash): Replacement for asUint64, which was only being used for a hash. (WebCore::Color::asUint64): Deleted. * platform/graphics/ColorHash.h: Use new hash functions. Use "using" instead of typedef. (WTF::ColorHash::hash): 2016-10-18 Ryosuke Niwa <rniwa@webkit.org> REGRESSION (r201471): Keyboard remains visible when swiping back on twitter.com https://bugs.webkit.org/show_bug.cgi?id=163581 <rdar://problem/27739558> Reviewed by Simon Fraser. The bug was caused by Chrome::elementDidBlur not getting called, which resulted in StopAssistingNode not getting sent to the UI process. Test: fast/forms/ios/hide-keyboard-on-node-removal.html * dom/Document.cpp: (WebCore::Document::setFocusedElement): Restore the behavior prior to r201471 by calling Chrome::elementDidBlur explicitly. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::dispatchBlurEvent): Added a comment about ordering. 2016-10-17 Anders Carlsson <andersca@apple.com> Move some history specific HistoryItem code to WebHistoryItem https://bugs.webkit.org/show_bug.cgi?id=163567 Reviewed by Tim Horton. * history/HistoryItem.cpp: (WebCore::HistoryItem::addRedirectURL): Deleted. (WebCore::HistoryItem::redirectURLs): Deleted. (WebCore::HistoryItem::setRedirectURLs): Deleted. * history/HistoryItem.h: 2016-10-18 Dave Hyatt <hyatt@apple.com> [CSS Parser] Get all the properties turned on https://bugs.webkit.org/show_bug.cgi?id=163605 Reviewed by Dean Jackson. * WebCore.xcodeproj/project.pbxproj: * css/CSSFunctionValue.h: * css/CSSPendingSubstitutionValue.cpp: Added. (WebCore::CSSPendingSubstitutionValue::customCSSText): * css/CSSPendingSubstitutionValue.h: Added. (WebCore::CSSPendingSubstitutionValue::create): (WebCore::CSSPendingSubstitutionValue::shorthandValue): (WebCore::CSSPendingSubstitutionValue::shorthandPropertyId): (WebCore::CSSPendingSubstitutionValue::equals): (WebCore::CSSPendingSubstitutionValue::CSSPendingSubstitutionValue): * css/CSSValue.cpp: (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): * css/CSSValue.h: (WebCore::CSSValue::isPendingSubstitutionValue): * css/CSSValueKeywords.in: * css/StylePropertyShorthand.cpp: (WebCore::transitionShorthandForParsing): * css/StylePropertyShorthand.h: * css/parser/CSSParser.cpp: (WebCore::CSSParser::completeURL): * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseValue): (WebCore::CSSParserImpl::consumeDeclaration): (WebCore::CSSParserImpl::consumeDeclarationValue): * css/parser/CSSParserMode.h: (WebCore::CSSParserContext::completeURL): * css/parser/CSSParserToken.cpp: (WebCore::CSSParserToken::parseAsCSSPropertyID): (WebCore::CSSParserToken::parseAsUnresolvedCSSPropertyID): Deleted. * css/parser/CSSParserToken.h: * css/parser/CSSPropertyParser.cpp: (WebCore::cssPropertyID): (WebCore::CSSPropertyParser::addProperty): (WebCore::CSSPropertyParser::addExpandedPropertyForValue): (WebCore::CSSPropertyParser::parseValue): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseValueStart): (WebCore::CSSPropertyParser::consumeCSSWideKeyword): (WebCore::consumeTransformOrigin): (WebCore::consumeWillChange): (WebCore::consumeFontFeatureTag): (WebCore::consumeFontFeatureSettings): (WebCore::consumePage): (WebCore::consumeQuotes): (WebCore::FontVariantLigaturesParser::consumeLigature): (WebCore::FontVariantLigaturesParser::finalizeValue): (WebCore::consumeFontVariantLigatures): (WebCore::consumeFontVariantCaps): (WebCore::FontVariantNumericParser::consumeNumeric): (WebCore::FontVariantNumericParser::finalizeValue): (WebCore::consumeFontVariantNumeric): (WebCore::consumeFontVariantCSS21): (WebCore::consumeFontVariantList): (WebCore::consumeFontWeight): (WebCore::consumeFamilyName): (WebCore::consumeGenericFamily): (WebCore::consumeFontFamily): (WebCore::consumeSpacing): (WebCore::consumeTabSize): (WebCore::consumeTextSizeAdjust): (WebCore::consumeFontSize): (WebCore::consumeLineHeight): (WebCore::createPrimitiveValuePair): (WebCore::consumeCounter): (WebCore::consumePageSize): (WebCore::consumeSize): (WebCore::consumeTextIndent): (WebCore::validWidthOrHeightKeyword): (WebCore::consumeMaxWidthOrHeight): (WebCore::consumeWidthOrHeight): (WebCore::consumeMarginOrOffset): (WebCore::consumeClipComponent): (WebCore::consumeClip): (WebCore::consumeTouchAction): (WebCore::consumeLineClamp): (WebCore::consumeLocale): (WebCore::consumeColumnWidth): (WebCore::consumeColumnCount): (WebCore::consumeColumnGap): (WebCore::consumeColumnSpan): (WebCore::consumeZoom): (WebCore::consumeAnimationIterationCount): (WebCore::consumeAnimationName): (WebCore::consumeTransitionProperty): (WebCore::consumeCubicBezier): (WebCore::consumeAnimationTimingFunction): (WebCore::consumeAnimationValue): (WebCore::isValidAnimationPropertyList): (WebCore::consumeAnimationPropertyList): (WebCore::CSSPropertyParser::consumeAnimationShorthand): (WebCore::consumeZIndex): (WebCore::parseSingleShadow): (WebCore::consumeShadow): (WebCore::consumeFilterFunction): (WebCore::consumeFilter): (WebCore::consumeTextDecorationLine): (WebCore::consumeTextEmphasisStyle): (WebCore::consumeOutlineColor): (WebCore::consumeLineWidth): (WebCore::consumeBorderWidth): (WebCore::consumeTextStrokeWidth): (WebCore::consumeColumnRuleWidth): (WebCore::consumeTranslate3d): (WebCore::consumeNumbers): (WebCore::consumePerspective): (WebCore::consumeTransformValue): (WebCore::consumeTransform): (WebCore::consumePositionLonghand): (WebCore::consumePositionX): (WebCore::consumePositionY): (WebCore::consumePaintStroke): (WebCore::consumePaintOrder): (WebCore::consumeNoneOrURI): (WebCore::consumeFlexBasis): (WebCore::consumeStrokeDasharray): (WebCore::consumeBaselineShift): (WebCore::consumeRxOrRy): (WebCore::consumeCursor): (WebCore::consumeAttr): (WebCore::consumeCounterContent): (WebCore::consumeContent): (WebCore::consumePositionList): (WebCore::consumeScrollSnapCoordinate): (WebCore::consumeScrollSnapPoints): (WebCore::consumeBorderRadiusCorner): (WebCore::consumeVerticalAlign): (WebCore::consumeShapeRadius): (WebCore::consumeBasicShapeCircle): (WebCore::consumeBasicShapeEllipse): (WebCore::consumeBasicShapePolygon): (WebCore::complete4Sides): (WebCore::consumeRadii): (WebCore::consumeBasicShapeInset): (WebCore::consumeBasicShape): (WebCore::consumeWebkitClipPath): (WebCore::consumeShapeOutside): (WebCore::consumeContentDistributionOverflowPosition): (WebCore::consumeBorderImageRepeatKeyword): (WebCore::consumeBorderImageRepeat): (WebCore::consumeBorderImageSlice): (WebCore::consumeBorderImageOutset): (WebCore::consumeBorderImageWidth): (WebCore::consumeBorderImageComponents): (WebCore::consumeWebkitBorderImage): (WebCore::consumeReflect): (WebCore::consumeImageOrientation): (WebCore::consumeBackgroundBlendMode): (WebCore::consumeBackgroundAttachment): (WebCore::consumeBackgroundBox): (WebCore::consumeBackgroundComposite): (WebCore::consumePrefixedBackgroundBox): (WebCore::consumeBackgroundSize): (WebCore::consumeGridAutoFlow): (WebCore::consumeBackgroundComponent): (WebCore::addBackgroundValue): (WebCore::consumeCommaSeparatedBackgroundComponent): (WebCore::consumeSelfPositionKeyword): (WebCore::consumeSelfPositionOverflowPosition): (WebCore::consumeAlignItems): (WebCore::consumeJustifyItems): (WebCore::consumeFitContent): (WebCore::consumeCustomIdentForGridLine): (WebCore::consumeGridLine): (WebCore::isGridTrackFixedSized): (WebCore::consumeGridBreadth): (WebCore::consumeGridTrackSize): (WebCore::consumeGridLineNames): (WebCore::consumeGridTrackRepeatFunction): (WebCore::consumeGridTrackList): (WebCore::consumeGridTemplatesRowsOrColumns): (WebCore::consumeGridTemplateAreas): (WebCore::consumeFontFaceUnicodeRange): (WebCore::consumeFontFaceSrcURI): (WebCore::consumeFontFaceSrcLocal): (WebCore::consumeFontFaceSrc): (WebCore::CSSPropertyParser::parseFontFaceDescriptor): (WebCore::CSSPropertyParser::consumeSystemFont): (WebCore::CSSPropertyParser::consumeFont): (WebCore::CSSPropertyParser::consumeFontVariantShorthand): (WebCore::CSSPropertyParser::consumeBorderSpacing): (WebCore::consumeSingleViewportDescriptor): (WebCore::CSSPropertyParser::parseViewportDescriptor): (WebCore::consumeColumnWidthOrCount): (WebCore::CSSPropertyParser::consumeColumns): (WebCore::CSSPropertyParser::consumeShorthandGreedily): (WebCore::CSSPropertyParser::consumeFlex): (WebCore::CSSPropertyParser::consumeBorder): (WebCore::CSSPropertyParser::consume4Values): (WebCore::CSSPropertyParser::consumeBorderImage): (WebCore::CSSPropertyParser::consumeLegacyBreakProperty): (WebCore::consumeBackgroundPosition): (WebCore::consumeRepeatStyleComponent): (WebCore::consumeRepeatStyle): (WebCore::CSSPropertyParser::consumeBackgroundShorthand): (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand): (WebCore::CSSPropertyParser::consumeGridAreaShorthand): (WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns): (WebCore::CSSPropertyParser::consumeGridTemplateShorthand): (WebCore::CSSPropertyParser::consumeGridShorthand): (WebCore::CSSPropertyParser::parseShorthand): (WebCore::unresolvedCSSPropertyID): Deleted. * css/parser/CSSPropertyParser.h: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeIdent): (WebCore::CSSPropertyParserHelpers::consumeCustomIdent): (WebCore::CSSPropertyParserHelpers::consumeString): (WebCore::CSSPropertyParserHelpers::consumeImageSet): * css/parser/CSSPropertyParserHelpers.h: 2016-10-18 Brent Fulgham <bfulgham@apple.com> Correct Document::removeAllEventListeners https://bugs.webkit.org/show_bug.cgi?id=163558 <rdar://problem/28716840> Reviewed by Chris Dumez. Tested by fast/dom/node-move-to-new-document-crash-main.html. * dom/Document.cpp: (WebCore::Document::removeAllEventListeners): Clear out the wheel and touch event targets when clearing all data. 2016-10-18 Dean Jackson <dino@apple.com> Remove dependency cycle with UIKit https://bugs.webkit.org/show_bug.cgi?id=163577 <rdar://problem/28786160> Reviewed by Tim Horton. Soft link against UIKit. Followup patch because I screwed up and forgot to edit the simulator configuration. * Configurations/WebCoreTestSupport.xcconfig: 2016-10-18 Said Abou-Hallawa <sabouhallawa@apple.com> SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property https://bugs.webkit.org/show_bug.cgi?id=116470 Reviewed by Simon Fraser. When we encounter a shorthand css property, we set m_implicitShorthand to true to tell addProperty() later that the individual properties are all set through a short hand one. We need to make sure that setting m_implicitShorthand to true will not be leaked after finishing parsing the short hand property. Test: fast/css/implicit-property-restore.html * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseFillShorthand): (WebCore::CSSParser::parseShorthand): (WebCore::CSSParser::parse4Values): (WebCore::CSSParser::parseBorderRadius): (WTF::ImplicitScope::ImplicitScope): Deleted. (WTF::ImplicitScope::~ImplicitScope): Deleted. Get rid of ImplicitScope and replace its calls by TemporaryChange<bool>. * css/parser/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGValue): Restore m_implicitShorthand value after setting it temporarily to true. 2016-10-18 Chris Dumez <cdumez@apple.com> Update TrackEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163580 Reviewed by Sam Weinig. Update TrackEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor as in the specification: - https://html.spec.whatwg.org/#the-trackevent-interface No new tests, updated existing tests. * html/track/TrackEvent.cpp: (WebCore::TrackEvent::TrackEvent): * html/track/TrackEvent.h: * html/track/TrackEvent.idl: 2016-10-18 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r207409. https://bugs.webkit.org/show_bug.cgi?id=163602 Introduced many test failures and timeouts, causing release bot to exit early (Requested by mcatanzaro on #webkit). Reverted changeset: "[GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint" https://bugs.webkit.org/show_bug.cgi?id=163511 http://trac.webkit.org/changeset/207409 2016-10-18 Eric Carlson <eric.carlson@apple.com> [MediaStream] Resolve constraints and enumerate devices in the UI process https://bugs.webkit.org/show_bug.cgi?id=162147 <rdar://problem/28803569> Reviewed by Darin Adler. Restructure gUM constraint validation and MediaDevices.enumerateDevices so all media device access happens in the UI process. No new tests, updated results of existing tests. * CMakeLists.txt: Add MediaDevicesEnumerationRequest.cpp, delete UserMediaPermissionCheck.cpp. * Modules/mediastream/MediaConstraintsImpl.cpp: (WebCore::MediaConstraintsImpl::create): Only create from MediaConstraintsData. (WebCore::MediaConstraintsImpl::initialize): Deleted. * Modules/mediastream/MediaConstraintsImpl.h: * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: Added. (WebCore::MediaDevicesEnumerationRequest::create): (WebCore::MediaDevicesEnumerationRequest::MediaDevicesEnumerationRequest): (WebCore::MediaDevicesEnumerationRequest::~MediaDevicesEnumerationRequest): (WebCore::MediaDevicesEnumerationRequest::userMediaDocumentOrigin): (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): (WebCore::MediaDevicesEnumerationRequest::contextDestroyed): (WebCore::MediaDevicesEnumerationRequest::start): (WebCore::MediaDevicesEnumerationRequest::cancel): (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): (WebCore::MediaDevicesEnumerationRequest::finish): * Modules/mediastream/MediaDevicesEnumerationRequest.h: Added. * Modules/mediastream/MediaDevicesRequest.cpp: (WebCore::MediaDevicesRequest::~MediaDevicesRequest): Clear the enumeration request. (WebCore::MediaDevicesRequest::contextDestroyed): Ditto. (WebCore::MediaDevicesRequest::start): Create and use a MediaDevicesEnumerationRequest. (WebCore::MediaDevicesRequest::didCompletePermissionCheck): Deleted. * Modules/mediastream/MediaDevicesRequest.h: * Modules/mediastream/UserMediaClient.h: * Modules/mediastream/UserMediaController.h: (WebCore::UserMediaController::enumerateMediaDevices): New. (WebCore::UserMediaController::cancelMediaDevicesEnumerationRequest): New. (WebCore::UserMediaController::checkUserMediaPermission): Deleted. (WebCore::UserMediaController::cancelUserMediaPermissionCheck): Deleted. * Modules/mediastream/UserMediaPermissionCheck.h: Deleted. * Modules/mediastream/UserMediaPermissionCheck.cpp: Deleted. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::UserMediaRequest): (WebCore::UserMediaRequest::start): (WebCore::UserMediaRequest::allow): (WebCore::UserMediaRequest::deny): (WebCore::UserMediaRequest::constraintsValidated): Deleted. (WebCore::UserMediaRequest::userMediaAccessGranted): Deleted. (WebCore::UserMediaRequest::userMediaAccessDenied): Deleted. (WebCore::UserMediaRequest::constraintsInvalid): Deleted. (WebCore::UserMediaRequest::didCreateStream): Deleted. (WebCore::UserMediaRequest::failedToCreateStreamWithConstraintsError): Deleted. (WebCore::UserMediaRequest::failedToCreateStreamWithPermissionError): Deleted. * Modules/mediastream/UserMediaRequest.h: * WebCore.xcodeproj/project.pbxproj: Add MediaDevicesEnumerationRequest.*. * platform/mediastream/CaptureDevice.h: (WebCore::CaptureDevice::CaptureDevice): (WebCore::CaptureDevice::setPersistentId): Add setter for argument decoder. (WebCore::CaptureDevice::setLabel): Ditto. (WebCore::CaptureDevice::setGroupId): Ditto. (WebCore::CaptureDevice::setKind): Ditto. * platform/mediastream/CaptureDeviceManager.h: Remove unnecessary include. * platform/mediastream/MediaConstraints.h: (WebCore::MediaConstraint::encode): New. (WebCore::MediaConstraint::decode): Ditto. (WebCore::NumericConstraint::encode): Ditto. (WebCore::NumericConstraint::decode): Ditto. * platform/mediastream/MediaStreamCreationClient.h: Deleted. * platform/mediastream/RealtimeMediaSourceCenter.h: Use completion handlers instead of client interface. * platform/mediastream/mac/AVCaptureDeviceManager.mm: (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Drive-by fix: don't initialize group id, we don't support it. * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints): Update for interface change. (WebCore::RealtimeMediaSourceCenterMac::createMediaStream): Ditto. * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints): Ditto. (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Ditto. (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): Ditto. * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h: * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints): Ditto. (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Ditto. * platform/mock/MockRealtimeMediaSourceCenter.h: 2016-10-18 Zan Dobersek <zdobersek@igalia.com> [WebIDL] Support BufferSource https://bugs.webkit.org/show_bug.cgi?id=163541 Reviewed by Youenn Fablet. Add support for the BufferSource typedef in WebIDL. The implementation adds the necessary handling for this type in the generator scripts and the specialization of the Converter<> template for the IDLBufferSource struct that enables exposing ArrayBuffer or ArrayBufferView objects by having WebCore::BufferSource objects pointing to their data. The SourceBuffer interface in the MSE module has the appendBuffer() operation modified to accept a BufferSource parameter, instead of overloading it for ArrayBuffer and ArrayBufferView parameters. The bindings generator tests cover BufferSource as both an operation parameter and as a dictionary member. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::appendBuffer): (WebCore::SourceBuffer::appendBufferInternal): * Modules/mediasource/SourceBuffer.h: * Modules/mediasource/SourceBuffer.idl: * WebCore.xcodeproj/project.pbxproj: * bindings/generic/IDLTypes.h: * bindings/js/BufferSource.h: Added. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLBufferSource>::convert): * bindings/scripts/CodeGenerator.pm: (SkipIncludeHeader): (IsWrapperType): * bindings/scripts/CodeGeneratorJS.pm: (AddClassForwardIfNeeded): (GetBaseIDLType): (IsHandledByDOMConvert): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::jsTestObjPrototypeFunctionBufferSourceParameter): (WebCore::jsTestObjPrototypeFunctionBufferSourceParameterCaller): * bindings/scripts/test/TestObj.idl: 2016-10-18 Javier Fernandez <jfernandez@igalia.com> [css-grid] Different width of grid container between initial load and refresh https://bugs.webkit.org/show_bug.cgi?id=163535 Reviewed by Manuel Rego Casasnovas. Grid's layout logic manages two different override sizes; one it's designed to implement the grid item's stretching behavior, identified with the concept of 'overrideContentLogicalSize'; there is another override size, known as overrideContainingBlockContentLogicalSize, used to implement the Grid Area abstraction, which will behave as the actual containing block of any grid item. During grid's layout logic these override sizes are set according to the CSS style rules. This affects how the grid container and its children are going to be sized during layout. Grid Tracks sizing algorithm depends on these override sizes. In order to ensure that the tracks sizing algorithm produces the same results when it's run consecutively several times, we need to clear these override sizes and perform a layout of the affected grid items. Otherwise, the affected items will return sizing values which depend on the override values set in the previous layout, which in some cases, like orthogonal flows, may change through different runs of the sizing algorithm. Test: fast/css-grid-layout/repeating-layout-must-produce-the-same-results.html * rendering/RenderGrid.cpp: (WebCore::RenderGrid::layoutBlock): 2016-10-18 Youenn Fablet <youenn@apple.com> CachedResourceLoader should not need to remove fragment identifier https://bugs.webkit.org/show_bug.cgi?id=163015 Reviewed by Darin Adler. No expected change for non-window port. For window port, CachedResourceLoader will strip the fragment identifier of the URL passed to subresourceForURL before querying the memory cache. Removing the fragment identifier from the request stored in CachedResourceRequest. The fragment identifier is stored in a separate field. This allows CachedResourceLoader to not care about fragment identifier. CachedResource can then get access to it. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::finishRequestInitialization): Deleted. * loader/cache/CachedResource.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::cachedResource): Updated the method taking a const String& to strip the fragment identifier if needed. Updated the method taking a const URL& to assert if the fragment identifier is present. (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::CachedResourceRequest): (WebCore::CachedResourceRequest::splitFragmentIdentifierFromRequestURL): * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::releaseFragmentIdentifier): (WebCore::CachedResourceRequest::clearFragmentIdentifier): * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::shouldRemoveFragmentIdentifier): (WebCore::MemoryCache::removeFragmentIdentifierIfNeeded): (WebCore::MemoryCache::revalidationSucceeded): (WebCore::MemoryCache::resourceForRequest): * loader/cache/MemoryCache.h: 2016-10-18 Antti Koivisto <antti@apple.com> Rename setNeedsStyleRecalc to invalidateStyle https://bugs.webkit.org/show_bug.cgi?id=163542 Reviewed by Darin Adler. Also rename StyleChangeType enum and some related functions for clarity. For example element.setNeedsStyleRecalc(SyntheticStyleChange); becomes element.invalidateStyleAndLayerComposition(); * WebCore.xcodeproj/project.pbxproj: * css/StyleInvalidationAnalysis.cpp: (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): * dom/Document.cpp: (WebCore::Document::recalcStyle): (WebCore::Document::updateViewportUnitsOnResize): (WebCore::Document::setCSSTarget): (WebCore::unwrapFullScreenRenderer): (WebCore::Document::setAnimatingFullScreen): * dom/Element.cpp: (WebCore::Element::setActive): (WebCore::Element::setFocus): (WebCore::Element::setHovered): (WebCore::Element::attributeChanged): (WebCore::Element::invalidateStyle): (WebCore::Element::invalidateStyleAndLayerComposition): (WebCore::Element::invalidateStyleForSubtree): (WebCore::Element::invalidateStyleAndRenderersForSubtree): Move public invalidation functions to Element tightening typing. Use separate functions instead of enum values. This way the call sites look nicer and only useful combinations are exposed. (WebCore::Element::addShadowRoot): (WebCore::checkForEmptyStyleChange): (WebCore::checkForSiblingStyleChanges): (WebCore::Element::needsStyleInvalidation): (WebCore::Element::setContainsFullScreenElement): * dom/Element.h: (WebCore::Element::setHasFocusWithin): * dom/Node.cpp: (WebCore::computeEditabilityFromComputedStyle): (WebCore::Node::adjustStyleValidity): Update validity and mode separately. There was a potential bug here where SyntheticStyleChange could overwrite FullStyleChange (no known repro). (WebCore::Node::updateAncestorsForStyleRecalc): (WebCore::Node::invalidateStyle): (WebCore::Node::insertedInto): (WebCore::Node::setNeedsStyleRecalc): Deleted. * dom/Node.h: (WebCore::Node::needsStyleRecalc): (WebCore::Node::styleValidity): (WebCore::Node::styleResolutionShouldRecompositeLayer): (WebCore::Node::setHasValidStyle): (WebCore::Node::styleChangeType): Deleted. (WebCore::Node::clearNeedsStyleRecalc): Deleted. (WebCore::Node::setStyleChange): Deleted. * dom/RadioButtonGroups.cpp: (WebCore::RadioButtonGroup::remove): (WebCore::RadioButtonGroup::setNeedsStyleRecalcForAllButtons): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::setResetStyleInheritance): * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::didChangeSlot): * dom/StyledElement.cpp: (WebCore::StyledElement::attributeChanged): (WebCore::StyledElement::styleAttributeChanged): (WebCore::StyledElement::invalidateStyleAttribute): * dom/Text.cpp: (WebCore::Text::updateRendererAfterContentChange): * dom/VisitedLinkState.cpp: (WebCore::VisitedLinkState::invalidateStyleForAllLinks): (WebCore::VisitedLinkState::invalidateStyleForLink): * editing/FrameSelection.cpp: (WebCore::FrameSelection::focusedOrActiveStateChanged): * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::minOrMaxAttributeChanged): * html/FileInputType.cpp: (WebCore::FileInputType::setValue): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::parseAttribute): * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::parseAttribute): * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::getContext): (WebCore::HTMLCanvasElement::createImageBuffer): * html/HTMLElement.cpp: (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged): (WebCore::HTMLElement::calculateAndAdjustDirectionality): * html/HTMLFieldSetElement.cpp: (WebCore::HTMLFieldSetElement::addInvalidDescendant): (WebCore::HTMLFieldSetElement::removeInvalidDescendant): * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::disabledStateChanged): (WebCore::HTMLFormControlElement::readOnlyAttributeChanged): (WebCore::HTMLFormControlElement::requiredAttributeChanged): (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck): (WebCore::HTMLFormControlElement::updateValidity): * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::registerFormElement): (WebCore::HTMLFormElement::registerInvalidAssociatedFormControl): (WebCore::HTMLFormElement::removeInvalidAssociatedFormControlIfNeeded): (WebCore::HTMLFormElement::resetDefaultButton): * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::scheduleinvalidateStyleAndLayerComposition): (WebCore::HTMLFrameOwnerElement::scheduleSetNeedsStyleRecalc): Deleted. * html/HTMLFrameOwnerElement.h: * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::parseAttribute): (WebCore::HTMLFrameSetElement::willRecalcStyle): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::runPostTypeUpdateTasks): (WebCore::HTMLInputElement::parseAttribute): (WebCore::HTMLInputElement::setChecked): (WebCore::HTMLInputElement::setIndeterminate): (WebCore::HTMLInputElement::setAutoFilled): (WebCore::HTMLInputElement::maxLengthAttributeChanged): (WebCore::HTMLInputElement::minLengthAttributeChanged): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::parseAttribute): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerRenderingModeChanged): (WebCore::HTMLMediaElement::setVideoFullscreenLayer): * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::parseAttribute): (WebCore::HTMLObjectElement::childrenChanged): (WebCore::HTMLObjectElement::renderFallbackContent): * html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::parseAttribute): * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::parseAttribute): (WebCore::HTMLOptionElement::setSelectedState): * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::setDisplayState): (WebCore::HTMLPlugInImageElement::willRecalcStyle): (WebCore::HTMLPlugInImageElement::finishParsingChildren): (WebCore::HTMLPlugInImageElement::resumeFromDocumentSuspension): (WebCore::HTMLPlugInImageElement::removeSnapshotTimerFired): (WebCore::HTMLPlugInImageElement::restartSnapshottedPlugIn): * html/HTMLProgressElement.cpp: (WebCore::HTMLProgressElement::didElementStateChange): * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::parseAttribute): (WebCore::HTMLSelectElement::setRecalcListItems): (WebCore::HTMLSelectElement::parseMultipleAttribute): (WebCore::HTMLSelectElement::reset): * html/HTMLTableElement.cpp: (WebCore::isTableCellAncestor): (WebCore::setTableCellsChanged): (WebCore::HTMLTableElement::parseAttribute): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::setValueCommon): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::updatePlaceholderVisibility): * html/InputType.cpp: (WebCore::InputType::setValue): * html/NumberInputType.cpp: (WebCore::NumberInputType::minOrMaxAttributeChanged): * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::subtreeHasChanged): * mathml/MathMLElement.cpp: (WebCore::MathMLElement::parseAttribute): * mathml/MathMLSelectElement.cpp: (WebCore::MathMLSelectElement::updateSelectedChild): * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::setNeedsStyleRecalc): * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::clear): (WebCore::AnimationControllerPrivate::updateAnimations): (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): (WebCore::AnimationControllerPrivate::pauseAnimationAtTime): (WebCore::AnimationControllerPrivate::pauseTransitionAtTime): (WebCore::AnimationController::cancelAnimations): * rendering/RenderImage.cpp: (WebCore::RenderImage::imageChanged): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): * rendering/RenderObject.cpp: (WebCore::RenderObject::updateDragState): * rendering/svg/SVGResourcesCache.cpp: (WebCore::SVGResourcesCache::clientStyleChanged): * style/AttributeChangeInvalidation.cpp: (WebCore::Style::AttributeChangeInvalidation::invalidateStyle): * style/ClassChangeInvalidation.cpp: (WebCore::Style::ClassChangeInvalidation::invalidateStyle): * style/IdChangeInvalidation.cpp: (WebCore::Style::IdChangeInvalidation::invalidateStyle): * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): * style/StyleScope.cpp: (WebCore::Style::Scope::updateActiveStyleSheets): * style/StyleTreeResolver.cpp: (WebCore::Style::resetStyleForNonRenderedDescendants): (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::createAnimatedElementUpdate): (WebCore::Style::TreeResolver::popParent): (WebCore::Style::clearNeedsStyleResolution): (WebCore::Style::TreeResolver::resolveComposedTree): * style/StyleUpdate.h: * style/StyleValidity.h: Added. StyleChangeType enum splits into Style::Validity and Style::InvalidationMode. Move to a file of its own. * svg/SVGAElement.cpp: (WebCore::SVGAElement::svgAttributeChanged): * svg/SVGAnimateElementBase.cpp: (WebCore::applyCSSPropertyToTarget): (WebCore::removeCSSPropertyFromTarget): * svg/SVGElement.cpp: (WebCore::SVGElement::willRecalcStyle): * svg/SVGElement.h: (WebCore::SVGElement::invalidateSVGPresentationAttributeStyle): * svg/SVGTests.cpp: (WebCore::SVGTests::handleAttributeChange): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::invalidateShadowTree): * testing/Internals.cpp: (WebCore::styleValidityToToString): (WebCore::Internals::styleChangeType): (WebCore::styleChangeTypeToString): Deleted. 2016-10-17 Sergio Villar Senin <svillar@igalia.com> [css-grid] Constrain by min|max-height on auto repeat computation https://bugs.webkit.org/show_bug.cgi?id=163540 Reviewed by Darin Adler. The max-height (if definite) is used to compute the number of auto repeat rows whenever the height is indefinite. We were using the min-height only in case both values were indefinite. Although not explicitly mentioned by grid specs, it's reasonable to assume that the min-height trumps the used value of height/max-height like it always does, per CSS 2.2. Note that the number of rows still needs to fit within that size even if using min-height, because we're just using min-height to compute the used value of the height property. If both height and max-height are indefinite we keep doing the same, i.e., compute the minimum number of rows that fulfill min-height (if definite). * rendering/RenderGrid.cpp: (WebCore::RenderGrid::computeAutoRepeatTracksCount): 2016-10-17 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Use NativeCallFrameTracer for operations used for DOMJIT slow calls https://bugs.webkit.org/show_bug.cgi?id=163586 Reviewed by Saam Barati. * domjit/JSNodeDOMJIT.cpp: (WebCore::toWrapperSlow): 2016-10-18 Ryuan Choi <ryuan.choi@navercorp.com> [EFL] Build break since r207442 https://bugs.webkit.org/show_bug.cgi?id=163587 Unreviewed. Since r207442, setRGB is moved to private. * rendering/RenderThemeEfl.cpp: (WebCore::fillColorsFromEdjeClass): 2016-10-17 Dean Jackson <dino@apple.com> Remove dependency cycle with UIKit https://bugs.webkit.org/show_bug.cgi?id=163577 <rdar://problem/28786160> Reviewed by Tim Horton. Soft link against UIKit. * Configurations/WebCoreTestSupport.xcconfig: * testing/Internals.mm: 2016-10-17 Dean Jackson <dino@apple.com> Allow creation of ExtendedColors and make Color immutable https://bugs.webkit.org/show_bug.cgi?id=163557 <rdar://problem/28805360> Reviewed by Darin Adler and Dave Hyatt. 1. Support the creation of ExtendedColor objects via the Color class. 2. Fix the remaining few places where a Color object is modified after creation, instead creating a new Color. Move all the mutation methods into the private section, making Color now immutable. Changes to Color are covered by existing tests. Changes to ExtendedColor are covered by the ExtendedColor API test. * css/parser/CSSParser.cpp: (WebCore::CSSParser::fastParseColor): Return a new named Color. * dom/Document.cpp: (WebCore::Document::resetActiveLinkColor): Set to be the named "red" color. * html/HTMLElement.cpp: (WebCore::HTMLElement::addHTMLColorToStyle): Use the string-based constructor where possible. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS): No need to use the string "black" here - we have a constant value. * platform/graphics/cairo/GraphicsContextCairo.cpp: Don't use setRGB. * platform/graphics/Color.cpp: (WebCore::findNamedColor): Move this up in the file. (WebCore::Color::Color): Copy in the code from setNamedColor. Also add a constructor for ExtendedColor. (WebCore::Color::serialized): Call ExtendedColor's serializer if necessary. (WebCore::Color::cssText): Ditto. (WebCore::Color::setNamedColor): Deleted. (WebCore::Color::tagAsExtended): Deleted. * platform/graphics/Color.h: Add a new constructor. (WebCore::Color::setRGB): Move to private. * platform/graphics/ExtendedColor.cpp: (WebCore::ExtendedColor::cssText): Implement serializer. * platform/graphics/ExtendedColor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorIncludingFallback): Construct a new Color rather than changing an existing object. 2016-10-17 Simon Fraser <simon.fraser@apple.com> Implement DOMRect/DOMRectReadOnly https://bugs.webkit.org/show_bug.cgi?id=163464 Reviewed by Darin Adler. Implement the DOMRectInit/DOMRectReadOnly/DOMRect interfaces specified in https://dev.w3.org/fxtf/geometry/ DOMRects allow negative height/width and require double storage, so we can't just use FloatRect for storage. They also require handling of NaN and Infinity. To have the left/right/top/bottom accessors follow IEEE NaN rules, we need to use custom min/max functions that return NaN if either argument is NaN, so add nanPropagatingMin/nanPropagatingMax helpers to MathExtras.h. Test: fast/dom/domrect.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMRect.h: Added. (WebCore::DOMRect::create): (WebCore::DOMRect::fromRect): (WebCore::DOMRect::setX): (WebCore::DOMRect::setY): (WebCore::DOMRect::setWidth): (WebCore::DOMRect::setHeight): (WebCore::DOMRect::DOMRect): * dom/DOMRect.idl: Added. * dom/DOMRectInit.h: Added. * dom/DOMRectInit.idl: Added. * dom/DOMRectReadOnly.h: Added. (WebCore::DOMRectReadOnly::create): (WebCore::DOMRectReadOnly::fromRect): (WebCore::DOMRectReadOnly::x): (WebCore::DOMRectReadOnly::y): (WebCore::DOMRectReadOnly::width): (WebCore::DOMRectReadOnly::height): (WebCore::DOMRectReadOnly::top): (WebCore::DOMRectReadOnly::right): (WebCore::DOMRectReadOnly::bottom): (WebCore::DOMRectReadOnly::left): (WebCore::DOMRectReadOnly::DOMRectReadOnly): * dom/DOMRectReadOnly.idl: Added. 2016-10-17 Antoine Quint <graouts@apple.com> [Modern Media Controls] Basic MediaController https://bugs.webkit.org/show_bug.cgi?id=163539 <rdar://problem/28797542> Reviewed by Darin Adler. We add a new main.js file which acts as the entry point by implementing the createControls() function that HTMLMediaElement::ensureMediaControlsInjectedScript() once the shadow root has been created. That functions creates an instance of the new MediaController class, which is the controller object that will handle communication between the media controls and the media element. At first, this MediaController class is very limited and assumes macOS inline layout traits and forces a start button to be shown over the media, which can be played to start the media and show the full controls. More functionality will be added by future patches. Tests: media/modern-media-controls/media-controller/media-controller-click-to-start.html media/modern-media-controls/media-controller/media-controller-constructor.html media/modern-media-controls/media-controller/media-controller-resize.html * Modules/modern-media-controls/main.js: Added. (createControls): * Modules/modern-media-controls/media/media-controller.js: Added. (MediaController): (MediaController.prototype.set pageScaleFactor): (MediaController.prototype.set usesLTRUserInterfaceLayoutDirection): (MediaController.prototype.handleEvent): (MediaController.prototype.buttonWasClicked): (MediaController.prototype._updateControlsSize): * WebCore.xcodeproj/project.pbxproj: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsStyleSheet): (WebCore::RenderThemeMac::mediaControlsScript): 2016-10-17 Anders Carlsson <andersca@apple.com> Remove an unused HistoryItem function https://bugs.webkit.org/show_bug.cgi?id=163565 Reviewed by Tim Horton. * history/HistoryItem.cpp: (WebCore::HistoryItem::isAncestorOf): Deleted. * history/HistoryItem.h: 2016-10-17 Nan Wang <n_wang@apple.com> AX: [Mac] mapping for output elements https://bugs.webkit.org/show_bug.cgi?id=163471 Reviewed by Chris Fleizach. Mapped the output element to status role and exposed its text content as AXTitle. Test: accessibility/mac/output-element.html * English.lproj/Localizable.strings: * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::visibleText): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isOutput): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::determineAccessibilityRole): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper roleDescription]): * platform/LocalizedStrings.cpp: (WebCore::AXOutputText): * platform/LocalizedStrings.h: * platform/efl/LocalizedStringsEfl.cpp: (WebCore::AXOutputText): * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::AXOutputText): 2016-10-17 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Use DOMJIT::Patchpoint in IC https://bugs.webkit.org/show_bug.cgi?id=163223 Reviewed by Saam Barati. Make DOMJITPatchpointParams non-const. * domjit/DOMJITHelpers.h: (WebCore::DOMJITHelpers::toWrapper): * domjit/JSNodeDOMJIT.cpp: (WebCore::createCallDOMForOffsetAccess): (WebCore::checkNode): (WebCore::NodeNodeTypeDOMJIT::callDOM): 2016-10-17 Chris Dumez <cdumez@apple.com> Move form.reportValidity() behind InteractiveFormValidation setting https://bugs.webkit.org/show_bug.cgi?id=163550 Reviewed by Darin Adler. Move form.reportValidity() behind InteractiveFormValidation setting for consistency given that the two features are strongly related. Also enable the setting by default so we can get feedback on the implementation. Demos: - Interactive form validation: http://jsfiddle.net/tj_vantoll/HdSqt/ - Report validity: https://googlechrome.github.io/samples/report-validity/ * bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setInteractiveFormValidationEnabled): (WebCore::RuntimeEnabledFeatures::interactiveFormValidationEnabled): * html/HTMLButtonElement.idl: * html/HTMLFieldSetElement.idl: * html/HTMLFormElement.idl: * html/HTMLInputElement.idl: * html/HTMLKeygenElement.idl: * html/HTMLObjectElement.idl: * html/HTMLOutputElement.idl: * html/HTMLSelectElement.idl: * html/HTMLTextAreaElement.idl: 2016-10-17 Antoine Quint <graouts@apple.com> [Modern Media Controls] Add a MediaControlsHost API to retrieve images as base64 https://bugs.webkit.org/show_bug.cgi?id=163502 <rdar://problem/28792017> Reviewed by Darin Adler. Add a new `base64StringForIconAndPlatform()` method to MediaControlsHost such that we may load images from the modern-media-controls directory in the WebCore.framework bundle. We use this new method in the iconService singleton when a `mediaControlsHost` is set, which will be set in a later patch. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::base64StringForIconAndPlatform): * Modules/mediacontrols/MediaControlsHost.h: * Modules/mediacontrols/MediaControlsHost.idl: * Modules/modern-media-controls/controls/icon-service.js: (const.iconService.new.IconService.prototype.urlForIconNameAndLayoutTraits): (const.iconService.new.IconService): * rendering/RenderTheme.h: (WebCore::RenderTheme::mediaControlsBase64StringForIconAndPlatform): (WebCore::RenderTheme::mediaControlsScript): Deleted. * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsBase64StringForIconAndPlatform): 2016-10-17 Antoine Quint <graouts@apple.com> [Modern Media Controls] Add a MediaControlsHost API to retrieve the shadow root CSS https://bugs.webkit.org/show_bug.cgi?id=163501 <rdar://problem/28792014> Reviewed by Darin Adler. Add a new `shadowRootCSSText` property to MediaControlsHost so that we may obtain the concatenated CSS sources for the media controls shadow root via JS. Actually using this API will be done in a later patch. We also no longer inject those styles as a user-agent stylesheet when the runtime flag is on since it will no longer be necessary. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::shadowRootCSSText): * Modules/mediacontrols/MediaControlsHost.h: * Modules/mediacontrols/MediaControlsHost.idl: * css/CSSDefaultStyleSheets.cpp: (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement): 2016-10-17 Simon Fraser <simon.fraser@apple.com> Implement DOMPoint/DOMPointReadOnly https://bugs.webkit.org/show_bug.cgi?id=133916 Reviewed by Darin Adler. Patch mostly by Dirk Schultz <krit@webkit.org>. Implement DOMPoint/DOMPointReadOnly following https://drafts.fxtf.org/geometry/ (although we may need to match https://www.w3.org/TR/geometry-1/ to be compatible with Chrome). Test: geometry/DOMPoint-001.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMPoint.h: Added. * dom/DOMPoint.idl: Added. * dom/DOMPointInit.h: Added. * dom/DOMPointInit.idl: Added. * dom/DOMPointReadOnly.h: Added. (WebCore::DOMPointReadOnly::create): (WebCore::DOMPointReadOnly::fromPoint): (WebCore::DOMPointReadOnly::x): (WebCore::DOMPointReadOnly::y): (WebCore::DOMPointReadOnly::z): (WebCore::DOMPointReadOnly::w): (WebCore::DOMPointReadOnly::DOMPointReadOnly): * dom/DOMPointReadOnly.idl: Added. 2016-10-17 Antoine Quint <graouts@apple.com> [Modern Media Controls] Use modern-media-controls module sources for media controls stylesheet and script injection https://bugs.webkit.org/show_bug.cgi?id=163500 <rdar://problem/28792010> Reviewed by Darin Adler. Add files from the Modules/modern-media-controls directory to the Xcode project and add a copy phase to copy those files with their directory stucture as a subdirectory of the WebCore.framework Resources directory. Additionally, use the modern-media-controls Module CSS and JS files when concatenating the media controls scripts and styles in RenderTheme when the runtime flag is on. * WebCore.xcodeproj/project.pbxproj: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::mediaControlsStyleSheet): (WebCore::RenderThemeMac::mediaControlsScript): 2016-10-17 Simon Fraser <simon.fraser@apple.com> Fix typo in error message. * bindings/scripts/CodeGeneratorJS.pm: (GenerateSerializerFunction): 2016-10-17 Fujii Hironori <Hironori.Fujii@sony.com> preprocessor.pm: cl.exe outputs processing filenames if Windows Perl is used https://bugs.webkit.org/show_bug.cgi?id=163435 Reviewed by Alex Christensen. cl.exe outputs processing filenames to stderr. Suppress this annoying messages by using open3 instead of open2. * bindings/scripts/preprocessor.pm: (applyPreprocessor): Use open3 in case of Windows Perl. 2016-10-17 Mark Lam <mark.lam@apple.com> Use the reject() helper function for conditionally throwing TypeErrors. https://bugs.webkit.org/show_bug.cgi?id=163491 Reviewed by Filip Pizlo. No new tests because this patch does not introduce new behavior. * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createRsaKeyGenParams): * bindings/js/JSIDBDatabaseCustom.cpp: (WebCore::JSIDBDatabase::createObjectStore): * bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::invokeMethod): 2016-10-17 Miguel Gomez <magomez@igalia.com> [GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint https://bugs.webkit.org/show_bug.cgi?id=163511 Reviewed by Carlos Garcia Campos. Perform the video repaint in the main thread when accelerated compositing is disabled. Covered by existent tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::repaint): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2016-10-17 Konstantin Tokarev <annulen@yandex.ru> Eleminate code duplication between ResourceRequest encoding/decoding implementations https://bugs.webkit.org/show_bug.cgi?id=163507 Reviewed by Carlos Garcia Campos. ResourceRequestBase::encodeWithoutPlatformData() and Soup implementation of ArgumentCoder<ResourceRequest>::encodePlatformData() share most of the code, ditto for decoding implementations. No new tests needed. * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::encodeBase): (WebCore::ResourceRequestBase::decodeBase): (WebCore::ResourceRequestBase::encodeWithoutPlatformData): (WebCore::ResourceRequestBase::decodeWithoutPlatformData): * platform/network/soup/ResourceRequest.h: (WebCore::ResourceRequest::encodeWithPlatformData): (WebCore::ResourceRequest::decodeWithPlatformData): 2016-10-17 Michael Catanzaro <mcatanzaro@igalia.com> Move user agent quirks to cross-platform location https://bugs.webkit.org/show_bug.cgi?id=163508 Reviewed by Carlos Garcia Campos. Tested by Tools/TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp. * PlatformGTK.cmake: * platform/UserAgent.h: Renamed from Source/WebCore/platform/gtk/UserAgentGtk.h. * platform/UserAgentQuirks.cpp: Added. Moved from UserAgentGtk.cpp. (WebCore::urlRequiresChromeBrowser): Sneakily tighten up Google domain detection, it should only apply to sites if the base domain matches google.*, not any base domain that starts with google. (WebCore::urlRequiresMacintoshPlatform): (WebCore::UserAgentQuirks::quirksForURL): (WebCore::UserAgentQuirks::stringForQuirk): * platform/UserAgentQuirks.h: Moved from UserAgentGtk.cpp. prepare-ChangeLog thinks it was renamed from Source/WebCore/platform/efl/UserAgentEfl.h, but prepare-ChangeLog is dumb. (WebCore::UserAgentQuirks::UserAgentQuirks): (WebCore::UserAgentQuirks::add): (WebCore::UserAgentQuirks::contains): (WebCore::UserAgentQuirks::isEmpty): * platform/efl/UserAgentEfl.cpp: (WebCore::standardUserAgentForURL): * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): (WebCore::standardUserAgentForURL): (): Deleted. (WebCore::UserAgentQuirks::UserAgentQuirks): Deleted. (WebCore::UserAgentQuirks::add): Deleted. (WebCore::UserAgentQuirks::contains): Deleted. (WebCore::UserAgentQuirks::isEmpty): Deleted. (WebCore::urlRequiresChromeBrowser): Deleted. (WebCore::urlRequiresMacintoshPlatform): Deleted. 2016-10-17 Alberto Garcia <berto@igalia.com> [GTK] gobject-introspection on package build with webkit2gtk fails without active X session https://bugs.webkit.org/show_bug.cgi?id=163105 Reviewed by Carlos Garcia Campos. Don't call XCompositeQueryExtension() or XDamageQueryExtension() if m_display is NULL. * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::supportsXComposite): (WebCore::PlatformDisplayX11::supportsXDamage): 2016-10-16 Nan Wang <n_wang@apple.com> AX: [Mac] roleDescription for AXTextField input types https://bugs.webkit.org/show_bug.cgi?id=163419 <rdar://problem/28766192> Reviewed by Darin Adler. Provided more detailed role description for input types that exposed as standard text fields on the mac. Changes are covered in modified test expectation. * English.lproj/Localizable.strings: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper roleDescription]): * platform/LocalizedStrings.cpp: (WebCore::AXEmailFieldText): (WebCore::AXTelephoneFieldText): (WebCore::AXURLFieldText): (WebCore::AXDateFieldText): (WebCore::AXTimeFieldText): * platform/LocalizedStrings.h: * platform/efl/LocalizedStringsEfl.cpp: (WebCore::AXEmailFieldText): (WebCore::AXTelephoneFieldText): (WebCore::AXURLFieldText): (WebCore::AXDateFieldText): (WebCore::AXTimeFieldText): * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::AXEmailFieldText): (WebCore::AXTelephoneFieldText): (WebCore::AXURLFieldText): (WebCore::AXDateFieldText): (WebCore::AXTimeFieldText): 2016-10-16 Chris Dumez <cdumez@apple.com> Update WebKit localizable strings https://bugs.webkit.org/show_bug.cgi?id=163513 Reviewed by Dan Bernstein. Update WebKit localizable strings as it was missing the "too short" one needed by form validation. This was causing a "Localized string not found" message to be shown when testing the following sample on WebKit ToT: - https://googlechrome.github.io/samples/report-validity/ * English.lproj/Localizable.strings: 2016-10-16 Chris Dumez <cdumez@apple.com> REGRESSION (r206750): Crash when pressing Caps Lock if “Use the Caps Lock key to switch to and from U.S.” is selected in Input Sources preferences https://bugs.webkit.org/show_bug.cgi?id=163506 <rdar://problem/28792483> Reviewed by Darin Adler. As per the NSEvent documentation [1], calling [NSEvent characters] is only valid on key up / key down events and will raise an NSInternalInconsistencyException if accessed on any other kind of event object. The crash happens when keyForKeyEvent() is called with the third kind of key event (NSFlagsChanged) which is used for detecting modifier keys. We normally detect the modifier key and return early before calling [NSEvent characters]. However, in some rare cases, we fail to detect the modifier key and we fall through. To address the issue, we now return "Unidentified" for NSFlagsChanged events, if we fail to detect the modifier key and before calling [NSEvent characters]. [1] https://developer.apple.com/reference/appkit/nsevent/1534183-characters No new test, not easily testable. * platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyForKeyEvent): 2016-10-16 Darin Adler <darin@apple.com> Move CSS classes from ExceptionCode to Exception https://bugs.webkit.org/show_bug.cgi?id=163494 Reviewed by Sam Weinig. Removed the "get" prefix from the names of many CSSPrimitiveValue functions to match WebKit coding style and to disambiguate them from the public CSS DOM functions that raise exceptions. * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::propertyNamePrefix): Use enum class. (WebCore::parseJavaScriptCSSPropertyName): Tweak style a bit. (WebCore::stylePropertyGetter): Refactor to simplify structure. (WebCore::stylePropertyGetterPixelOrPosPrefix): Ditto. Also use floatValue. (WebCore::JSCSSStyleDeclaration::putDelegate): Use findIgnoringASCIICase, and use propagateException to handle ExcpetionOr. (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): Tweak style a bit. (WebCore::JSCSSStyleDeclaration::getOwnPropertyNames): Use a lambda to initialize a global here. * bindings/js/JSDOMBinding.h: Added toJSString to support bindings for functions returning ExceptionOr<String>. * bindings/scripts/gobject-generate-headers.pl: Deleted. * css/BasicShapeFunctions.cpp: (WebCore::convertToLengthSize): Use pairValue. (WebCore::convertToCenterCoordinate): Use valueID and pairValue. (WebCore::cssValueToBasicShapeRadius): Ditto. * css/CSSBasicShapes.cpp: (WebCore::serializePositionOffset): Ditto. (WebCore::buildSerializablePositionOffset): Ditto. (WebCore::CSSBasicShapeCircle::cssText): Ditto. (WebCore::CSSBasicShapeEllipse::cssText): Ditto. (WebCore::updateCornerRadiusWidthAndHeight): Ditto. * css/CSSBorderImageSliceValue.h: Use quadValue. * css/CSSCalculationValue.cpp: (WebCore::determineCategory): Use floatValue and doubleValue. * css/CSSCharsetRule.h: Use ExceptionOr. Also made more things private. * css/CSSCharsetRule.idl: Use non-legacy exceptions. * css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::setCssText): Use ExceptionOr. (WebCore::ComputedStyleExtractor::propertyMatches): Use valueID. (WebCore::CSSComputedStyleDeclaration::setProperty): Use ExceptionOr. (WebCore::CSSComputedStyleDeclaration::removeProperty): Ditto. (WebCore::CSSComputedStyleDeclaration::setPropertyInternal): Ditto. (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue): Return a Ref instead of a RefPtr. * css/CSSComputedStyleDeclaration.h: Updated for above changes. * css/CSSCrossfadeValue.cpp: (WebCore::CSSCrossfadeValue::fixedSize): Use floatValue. (WebCore::CSSCrossfadeValue::image): Ditto. (WebCore::CSSCrossfadeValue::blend): Use doubleValue. * css/CSSFontFace.cpp: (WebCore::CSSFontFace::calculateStyleMask): Use valueID. (WebCore::CSSFontFace::calculateWeightMask): Ditto. * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::familyNameFromPrimitive): Ditto. (WebCore::CSSFontFaceSet::matchingFaces): Use ExceptoinOr. (WebCore::CSSFontFaceSet::check): Ditto. * css/CSSFontFaceSet.h: Updated for above changes. * css/CSSGradientValue.cpp: (WebCore::compareStops): Use doubleValue. (WebCore::CSSGradientValue::addStops): Use floatValue. (WebCore::positionFromValue): Use floatValue and valudID. (WebCore::CSSLinearGradientValue::customCSSText): Use doubleValue and valueID. (WebCore::CSSLinearGradientValue::createGradient): Use floatValue and valueID. (WebCore::CSSRadialGradientValue::customCSSText): Use doubleValue and valueID. (WebCore::CSSRadialGradientValue::resolveRadius): Use floatValue. (WebCore::CSSRadialGradientValue::createGradient): Use valueID. * css/CSSGroupingRule.cpp: (WebCore::CSSGroupingRule::insertRule): Use ExceptionOr. (WebCore::CSSGroupingRule::deleteRule): Ditto. * css/CSSGroupingRule.h: Updated for above changes. * css/CSSImageGeneratorValue.cpp: (WebCore::CSSImageGeneratorValue::subimageIsPending): Use valueID. (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue): Ditto. * css/CSSImageSetValue.cpp: (WebCore::CSSImageSetValue::fillImageSet): Use floatValue. * css/CSSMediaRule.idl: Use non-legacy exceptions. * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::computeDegrees): Use doubleValue. (WebCore::CSSPrimitiveValue::setFloatValue): Use ExceptionOr. (WebCore::CSSPrimitiveValue::getFloatValue): Replaced getDoubleValue with this, since getDoubleValue is unused, moving the call to clampTo into this function. Also changed this to use ExceptionOr. (WebCore::CSSPrimitiveValue::doubleValue): Renamed from getDoubleValue. (WebCore::CSSPrimitiveValue::doubleValueInternal): Use Optional instead of a bool and an out argument to return the value and check for type failure. (WebCore::CSSPrimitiveValue::setStringValue): Use ExceptionOr. (WebCore::CSSPrimitiveValue::getStringValue): Ditto. (WebCore::CSSPrimitiveValue::stringValue): Renamed from getStringValue. (WebCore::CSSPrimitiveValue::getCounterValue): Use ExceptionOr. (WebCore::CSSPrimitiveValue::getRectValue): Use ExceptionOr. (WebCore::CSSPrimitiveValue::getQuadValue): Deleted. (WebCore::CSSPrimitiveValue::getLengthRepeatValue): Deleted. (WebCore::CSSPrimitiveValue::getRGBColorValue): Use ExceptionOr. (WebCore::CSSPrimitiveValue::getPairValue): Deleted. (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Use new names for functions. * css/CSSPrimitiveValue.h: Reorganized the class, moved large inline function bodies out of the class definition. Updated for the above changes. * css/CSSPrimitiveValue.idl: Use non-legacy exceptions. * css/CSSPrimitiveValueMappings.h: Use value instead of getValue, etc. * css/CSSRule.cpp: (WebCore::CSSRule::setCssText): Use ExceptionOr. * css/CSSRule.h: Updated for above change. * css/CSSRule.idl: Use non-legacy exceptions. * css/CSSStyleDeclaration.h: Use ExceptionOr. * css/CSSStyleDeclaration.idl: Use non-legacy exceptions. * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::deprecatedInsertRule): Use ExceptionOr. (WebCore::CSSStyleSheet::insertRule): Ditto. (WebCore::CSSStyleSheet::deleteRule): Ditto. (WebCore::CSSStyleSheet::addRule): Ditto. * css/CSSStyleSheet.h: Updated for the above changes. * css/CSSStyleSheet.idl: Use non-legacy exceptions. * css/CSSSupportsRule.idl: Use non-legacy exceptions. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapFillAttachment): Use valueID instead of getValueID, etc. (WebCore::convertToLengthSize): Ditto. (WebCore::CSSToStyleMap::mapFillSize): Ditto. (WebCore::CSSToStyleMap::mapFillXPosition): Ditto. (WebCore::CSSToStyleMap::mapFillYPosition): Ditto. (WebCore::CSSToStyleMap::mapFillMaskSourceType): Ditto. (WebCore::CSSToStyleMap::mapAnimationDirection): Ditto. (WebCore::CSSToStyleMap::mapAnimationFillMode): Ditto. (WebCore::CSSToStyleMap::mapAnimationIterationCount): Ditto. (WebCore::CSSToStyleMap::mapAnimationName): Ditto. (WebCore::CSSToStyleMap::mapAnimationPlayState): Ditto. (WebCore::CSSToStyleMap::mapAnimationProperty): Ditto. (WebCore::CSSToStyleMap::mapAnimationTimingFunction): Ditto. (WebCore::CSSToStyleMap::mapAnimationTrigger): Ditto. (WebCore::CSSToStyleMap::mapNinePieceImageSlice): Ditto. (WebCore::CSSToStyleMap::mapNinePieceImageQuad): Ditto. (WebCore::CSSToStyleMap::mapNinePieceImageRepeat): Ditto. * css/CSSValue.h: Use ExceptionOr. * css/CSSValue.idl: Use non-legacy exceptions. * css/Counter.h: Use stringValue instead of getStringValue, etc. * css/FontFace.cpp: (WebCore::FontFace::create): Use ExceptionOr. (WebCore::FontFace::setFamily): Ditto. (WebCore::FontFace::setStyle): Ditto. (WebCore::FontFace::setWeight): Ditto. (WebCore::FontFace::setStretch): Ditto. (WebCore::FontFace::setUnicodeRange): Ditto. (WebCore::FontFace::setVariant): Ditto. (WebCore::FontFace::setFeatureSettings): Ditto. * css/FontFace.h: Updated for above changes. * css/FontFace.idl: Use non-legacy exceptions. * css/FontFaceSet.cpp: (WebCore::FontFaceSet::load): Use ExceptionOr. (WebCore::FontFaceSet::check): Ditto. * css/FontFaceSet.h: Updated for above changes. * css/FontFaceSet.idl: Use non-legacy exceptions. * css/FontVariantBuilder.cpp: (WebCore::extractFontVariantLigatures): Use valueID instead of getValueID, etc. (WebCore::extractFontVariantNumeric): Ditto. (WebCore::extractFontVariantEastAsian): Ditto. * css/MediaList.cpp: (WebCore::MediaList::setMediaText): Use ExceptionOr. (WebCore::MediaList::deleteMedium): Ditto. (WebCore::MediaList::appendMedium): Ditto. * css/MediaList.h: Updated for above changes. * css/MediaList.idl: Use non-legacy exceptions. * css/MediaQueryEvaluator.cpp: (WebCore::doubleValue): Use valueID instead of getValueID, etc. (WebCore::colorGamutEvaluate): Ditto. (WebCore::invertedColorsEvaluate): Ditto. (WebCore::orientationEvaluate): Ditto. (WebCore::evaluateResolution): Ditto. (WebCore::computeLength): Ditto. (WebCore::viewModeEvaluate): Ditto. (WebCore::hoverEvaluate): Ditto. (WebCore::pointerEvaluate): Ditto. (WebCore::prefersReducedMotionEvaluate): Ditto. * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::setCssText): Use ExceptionOr. (WebCore::PropertySetCSSStyleDeclaration::setProperty): Ditto. (WebCore::PropertySetCSSStyleDeclaration::removeProperty): Ditto. (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal): Ditto. (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): Ditto. * css/PropertySetCSSStyleDeclaration.h: Updated for above changes. Also marked a couple additional functions private. * css/StyleBuilderConverter.h: Use doubleValue instead of getDoubleValue, etc. * css/StyleBuilderCustom.h: Ditto. * css/StyleProperties.cpp: (WebCore::StyleProperties::getLayeredShorthandValue): Ditto. * css/StyleResolver.cpp: (WebCore::StyleResolver::MatchResult::addMatchedProperties): Ditto. (WebCore::StyleResolver::colorFromPrimitiveValueIsDerivedFromElement): Ditto. (WebCore::StyleResolver::colorFromPrimitiveValue): Ditto. (WebCore::StyleResolver::createFilterOperations): Ditto. * css/TransformFunctions.cpp: (WebCore::transformsForValue): Ditto. * css/ViewportStyleResolver.cpp: (WebCore::ViewportStyleResolver::getViewportArgumentValue): Ditto. * css/WebKitCSSMatrix.cpp: (WebCore::WebKitCSSMatrix::WebKitCSSMatrix): Tweaked constructors a bit, getting rid of the one that uses an ExceptionCode. (WebCore::WebKitCSSMatrix::create): Moved in here, and use ExceptionOr. (WebCore::WebKitCSSMatrix::setMatrixValue): Use ExceptionOr. (WebCore::WebKitCSSMatrix::multiply): Tweak coding style a bit. (WebCore::WebKitCSSMatrix::inverse): Use ExceptionOr. (WebCore::WebKitCSSMatrix::translate): Return a Ref instead of RefPtr. (WebCore::WebKitCSSMatrix::scale): Ditto. (WebCore::WebKitCSSMatrix::rotate): Ditto. (WebCore::WebKitCSSMatrix::rotateAxisAngle): Ditto. (WebCore::WebKitCSSMatrix::skewX): Ditto. (WebCore::WebKitCSSMatrix::skewY): Ditto. (WebCore::WebKitCSSMatrix::toString): Tweaked formatting a bit. * css/WebKitCSSMatrix.h: Updated for above changes. * css/WebKitCSSMatrix.idl: Use non-legacy extensions. * css/makeprop.pl: (handleCurrentColorValue): Use valueID instead of getValueID. (generateValueSetter): Ditto. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parse4ValuesFillPosition): Use valueID instead of getValueID, etc. (WebCore::CSSParser::parse3ValuesFillPosition): Ditto. (WebCore::CSSParser::parseFillPosition): Ditto. (WebCore::CSSParser::parseFillRepeat): Ditto. (WebCore::CSSParser::parseGridPosition): Ditto. (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns): Ditto. (WebCore::isGridTrackFixedSized): Ditto. (WebCore::CSSParser::parseRadialGradient): Ditto. (WebCore::CSSParser::parseBuiltinFilterArguments): Ditto. * css/parser/CSSParserValues.cpp: (WebCore::CSSParserValue::createCSSValue): Removed the unneeded call to setPrimitiveType here. The createParserOperator returns an object that already has the correct primitive type. * css/parser/CSSPropertyParser.cpp: Updated most cases of calling the old getXXXValue functions, but not sure if it's right since it is commented out code that I did not compile. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::clampRGBComponent): Use intValue instead of getIntValue, etc. (WebCore::CSSPropertyParserHelpers::parseHSLParameters): Ditto. (WebCore::CSSPropertyParserHelpers::isHorizontalPositionKeywordOnly): Ditto. (WebCore::CSSPropertyParserHelpers::isVerticalPositionKeywordOnly): Ditto. (WebCore::CSSPropertyParserHelpers::positionFromThreeOrFourValues): Ditto. (WebCore::CSSPropertyParserHelpers::consumeRadialGradient): Ditto. * dom/Range.cpp: Added now-needed include of ExceptionCode.h. * dom/SelectorQuery.cpp: Ditto. * editing/ApplyStyleCommand.cpp: (WebCore::toIdentifier): Use valueID instead of getValueID, etc. (WebCore::ApplyStyleCommand::computedFontSize): Ditto. * editing/EditingStyle.cpp: (WebCore::identifierForStyleProperty): Ditto. (WebCore::HTMLElementEquivalent::valueIsPresentInStyle): Ditto. (WebCore::EditingStyle::extractFontSizeDelta): Ditto. (WebCore::EditingStyle::textDirection): Ditto. (WebCore::EditingStyle::prepareToApplyAt): Ditto. (WebCore::EditingStyle::textDirectionForSelection): Ditto. (WebCore::fontWeightIsBold): Ditto. (WebCore::legacyFontSizeFromCSSValue): Ditto. (WebCore::isTransparentColorValue): Ditto. (WebCore::hasTransparentBackgroundColor): Ditto. (WebCore::backgroundColorInEffect): Ditto. * editing/Editor.cpp: (WebCore::Editor::applyEditingStyleToElement): Removed IGNORE_EXCEPTION; that is what we do by default for things returning ExceptionOr. * editing/RemoveCSSPropertyCommand.cpp: (WebCore::RemoveCSSPropertyCommand::doApply): Ditto. (WebCore::RemoveCSSPropertyCommand::doUnapply): Ditto. * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): Ditto. * editing/cocoa/HTMLConverter.mm: (floatValueFromPrimitiveValue): Use floatValue instead of getFloatValue, etc. * editing/markup.cpp: (WebCore::propertyMissingOrEqualToNone): Ditto. * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::addRule): Updated to call ExceptionOr-returning functions. (WebCore::InspectorStyleSheet::deleteRule): Ditto. (WebCore::InspectorStyleSheet::setStyleText): Ditto. * svg/SVGLength.cpp: (WebCore::SVGLength::fromCSSPrimitiveValue): Use floatValue instead of getFloatValue. 2016-10-16 Antoine Quint <graouts@apple.com> [Modern Media Controls] Styles for StartButton are missing https://bugs.webkit.org/show_bug.cgi?id=163499 <rdar://problem/28792009> Reviewed by Darin Adler. Add styling for StartButton so that instances are always displayed in the center of their container. Test: media/modern-media-controls/start-button/start-button-styles.html * Modules/modern-media-controls/controls/start-button.css: Added. (button.start): (button.start > *): (button.start > div): (button.start > img): (button.start:active > img): 2016-10-16 Simon Fraser <simon.fraser@apple.com> Implement serializer = { attribute } https://bugs.webkit.org/show_bug.cgi?id=163466 Follow-up fix to die if "serializer {...}" lists an attribute not present on the interface. I don't think this is testable with the current bindings tests. * bindings/scripts/CodeGeneratorJS.pm: (GenerateSerializerFunction): 2016-10-16 Simon Fraser <simon.fraser@apple.com> Add the "Geometry Interfaces" to features.json. * features.json: 2016-10-16 Carlos Garcia Campos <cgarcia@igalia.com> Document request not updated after willSendRequest is called for a redirect https://bugs.webkit.org/show_bug.cgi?id=163436 Reviewed by Michael Catanzaro. The first willSendRequest happens before DocumentLoader::startLoadingMainResource(), that calls setRequest, but the second one happens after DocumentLoader::redirectReceived() and then the request is never updated again. Covered by GTK+ unit tests. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willContinueMainResourceLoadAfterRedirect): Set the new request. * loader/DocumentLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): Notify the document loader when loading the main resource and called for a redirection. 2016-10-15 Said Abou-Hallawa <sabouhallawa@apple.com> Delete the animated image catchup code https://bugs.webkit.org/show_bug.cgi?id=163410 Reviewed by Simon Fraser. This patch fixes two issues in the animated image workflow: 1) Setting the animation timer should follow the following rules: -- Initial case: Which happens before drawing the first frame. We should set the timer to fire after the current_frame_duration. -- Late case (Slow animation): This happens if the current_time is past the next_frame_desired_time. In this case we should fire the timer immediately. -- Early case (Fast animation): This happens when there is still time before the next_frame_desired_time. In this case we should set the timer to fire after the difference between the next_frame_desired_time and the current_time. 2) Deleting the code for catching up the current_frame: This code used to run in the slow animation case. It was never used on iOS. It was trying to adjust the current_frame according to the current_time as if there were no delay. It turned out that this might cause a bigger delay because most likely the decoder decodes the image frames incrementally; i.e. to decode frame k, it has to have frame (k - 1) decoded. Test: fast/images/ordered-animated-image-frames.html * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): Remove the iOS specific code. (WebCore::BitmapImage::startAnimation): Move the animation finishing code from BitmapImage::internalAdvanceAnimation() to this function. Simplify the timer duration code as it is described above. (WebCore::BitmapImage::advanceAnimation): Merge BitmapImage::internalAdvanceAnimation() into this function. (WebCore::BitmapImage::resetAnimation): (WebCore::BitmapImage::internalAdvanceAnimation): Deleted. * platform/graphics/BitmapImage.h: * platform/graphics/Image.cpp: (WebCore::Image::drawTiled): * platform/graphics/Image.h: (WebCore::Image::startAnimation): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::startAnimation): * svg/graphics/SVGImage.h: Remove the catchup code form the Image and SVGImage classes. 2016-10-15 Darin Adler <darin@apple.com> Move Web SQL database and WebSockets off legacy exceptions https://bugs.webkit.org/show_bug.cgi?id=163284 Reviewed by Chris Dumez. * Modules/webdatabase/DOMWindowWebDatabase.cpp: (WebCore::DOMWindowWebDatabase::openDatabase): Use ExceptionOr. * Modules/webdatabase/DOMWindowWebDatabase.h: Update for above. * Modules/webdatabase/DOMWindowWebDatabase.idl: Ditto. * Modules/webdatabase/SQLResultSet.cpp: (WebCore::SQLResultSet::SQLResultSet): Move initialization of many data members into the class definition. (WebCore::SQLResultSet::insertId): Use ExceptionOr. (WebCore::SQLResultSet::rowsAffected): Moved into class definition. (WebCore::SQLResultSet::rows): Ditto. (WebCore::SQLResultSet::setInsertId): Ditto. (WebCore::SQLResultSet::setRowsAffected): Ditto. * Modules/webdatabase/SQLResultSet.h: Updated for above. * Modules/webdatabase/SQLResultSet.idl: Use non-legacy exceptions. Added a FIXME about the mismatch between long and int64_t. * Modules/webdatabase/SQLStatement.cpp: (WebCore::SQLStatement::execute): Use reference instead of pointer. * Modules/websockets/WebSocket.cpp: (WebCore::isValidProtocolString): Use StringView. (WebCore::WebSocket::subprotocolSeparator): Fixed capitalization and spelling error in the name of this function. (WebCore::WebSocket::WebSocket): Move initialization of many data members into the class definition. (WebCore::WebSocket::create): Use ExceptionOr. (WebCore::WebSocket::connect): Ditto. (WebCore::WebSocket::send): Ditto. (WebCore::WebSocket::close): Ditto. (WebCore::WebSocket::binaryType): Update to use enum class. (WebCore::WebSocket::setBinaryType): Use ExecptionOr and update to use enum class. (WebCore::WebSocket::didReceiveBinaryData): Ditto. * Modules/websockets/WebSocket.h: Updated for above. Changed the BinaryType enum into an enum class. * Modules/websockets/WebSocket.idl: Use non-legacy exceptions. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::checkResponseHeaders): Updated for name change to subprotocolSeparator. * dom/ExceptionOr.h: Added a constructor for scalar types that does not require an rvalue reference. We can refine this more later, but for now this is sufficient to obviate the need for WTFMove where it otherwise would have been needed in the code above. * inspector/InspectorDatabaseAgent.cpp: Use reference instead of pointer. * page/DOMWindow.idl: Touched this file to work around bugs in the dependency analysis of the current CMake build system, since otherwise it doesn't process the change to the partial interface WebSocket. Edited lots of comments, removed many others, and tweaked formatting. 2016-10-14 Sam Weinig <sam@webkit.org> MessageEvent's source property should be a (DOMWindow or MessagePort)? rather than a EventTarget? https://bugs.webkit.org/show_bug.cgi?id=163475 Reviewed by Simon Fraser. Start fleshing out union support, starting with MessageEvent. - Simplify things a bit for now by requiring interface types to use RefPtr<T> as their type when used in sequences and unions. We should revisit this later, and see if we can use Ref<T> where possible, but it causes complications for dictionaries, since they want a Ref<T> uninitialized. * bindings/generic/IDLTypes.h: Switch IDLInterface to use RefPtr<T> as its implementation type. * bindings/js/JSDOMConvert.h: (WebCore::Detail::VariadicConverterBase::convert): - Remove isJSDOMWrapperType() optimization. It was not correct, due to not being able to detect window and window shell, and not always an optimization, e.g. in the case of a single interface. - Switch from JSC::jsDynamicCast<WrapperType*>() to WrapperType::toWrapped() which can be faster and handles window and window shell correctly. - Also fix an issue where we would wrongly assert that one interface had to match. * bindings/js/JSDOMWrapper.h: (WebCore::isJSDOMWrapperType): Deleted. Remove unused predicate. * bindings/scripts/IDLParser.pm: (parseType): Add missing support for nullable unions. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/TestObj.idl: Add new tests for unions (both non-null and nullable) in dictionaries. * dom/ContainerNode.cpp: (WebCore::ContainerNode::append): (WebCore::ContainerNode::prepend): * dom/ContainerNode.h: * dom/Node.cpp: (WebCore::nodeSetPreTransformedFromNodeOrStringVector): (WebCore::Node::convertNodesOrStringsIntoNode): (WebCore::Node::before): (WebCore::Node::after): (WebCore::Node::replaceWith): * dom/Node.h: Add using declaration for NodeOrString and change it to use RefPtr<Node>. * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): * dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): (WebCore::MessageEvent::create): (WebCore::MessageEvent::initMessageEvent): (WebCore::MessageEvent::source): (WebCore::isValidSource): Deleted. * dom/MessageEvent.h: * dom/MessageEvent.idl: * page/DOMWindow.cpp: (WebCore::PostMessageTimer::event): Change MessageEvent's source to be a std::experimental::variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>. For now, we only enforce this on setting, and leave the getter a EventTarget?, but that should not be observable, and will rectified in subsequent patches. 2016-10-15 Chris Dumez <cdumez@apple.com> Add support for reportValidity() on form and form control elements https://bugs.webkit.org/show_bug.cgi?id=163479 Reviewed by Darin Adler. Add support for reportValidity() on form and form control elements: - https://html.spec.whatwg.org/#dom-form-reportvalidity - https://html.spec.whatwg.org/#dom-cva-reportvalidity Firefox and Chrome already support this. Demo: https://googlechrome.github.io/samples/report-validity/ No new tests, rebaselined existing tests. * html/HTMLButtonElement.idl: * html/HTMLFieldSetElement.idl: * html/HTMLFormElement.idl: * html/HTMLInputElement.idl: * html/HTMLKeygenElement.idl: * html/HTMLObjectElement.idl: * html/HTMLOutputElement.idl: * html/HTMLSelectElement.idl: * html/HTMLTextAreaElement.idl: Add reportValidity() operation. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::checkValidity): (WebCore::HTMLFormControlElement::reportValidity): Add implementation for reportValidity() for form control elements. First, it calls checkValidity() and returns early if there is no constraint violation. if the JS canceled the 'invalid' event fired by checkValidity(), then return early as well, as per the specification. If the element is focusable, we scroll to it, focus it and show the validation message. Otherwise, we log a error message to the console. The last part of the behavior matches what we already did in HTMLFormElement::validateInteractively() and complies with the behavior in the specification. (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): Add utility function to scroll to the form control element, focus it and show its validation message. This code was moved from HTMLFormElement::validateInteractively() so that it could be reused in HTMLFormControlElement::reportValidity(). * html/HTMLFormControlElement.h: * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::validateInteractively): Move the early abort checks to the existing call site (prepareForSubmission) so that we can reuse this method for reportValidity(). (WebCore::HTMLFormElement::prepareForSubmission): Only call validateInteractively() if we really should validate. Those checks used to be in validateInteractively() but I moved them here so we could more easily reuse validateInteractively(). (WebCore::HTMLFormElement::checkValidity): (WebCore::HTMLFormElement::checkInvalidControlsAndCollectUnhandled): Update Vector type to be a Vector of HTMLFormControlElement given that we only add HTMLFormControlElement objects to it and that it results it simpler code. (WebCore::HTMLFormElement::reportValidity): Add implementation for reportValidity() for form elements. The implementation calls our already existing validateInteractively() method, as per the specification. * html/HTMLFormElement.h: * html/HTMLObjectElement.h: reportValidity() returns true unconditionally for object elements, similarly to checkValidity(). 2016-10-15 Simon Fraser <simon.fraser@apple.com> Sort the project file. * WebCore.xcodeproj/project.pbxproj: 2016-10-15 Simon Fraser <simon.fraser@apple.com> Implement serializer = { attribute } https://bugs.webkit.org/show_bug.cgi?id=163466 Reviewed by Darin Adler. Fix the code generator to generate code for serializer = { attribute }. In IDLParser, extend domSerializable with flags for the 'inherit', 'getter' and 'attribute' values (the first two are still unsupported). Fix parseSerializationPattern() to detect these; it needs to create the domSerializable() now. Basic support for isSerializableAttribute() is added (primitive types only). GenerateSerializerFunction is fixed to output code for the serializable attributes in the order specified in "serializer = {}", as specified in WebIDL. Removed custom serialization for ClientRect and PerformanceTiming. Other minor cleanup to always get $interfaceName from $interface->name, and to fix ObjectConstructor.h to be included as <runtime/ObjectConstructor.h>. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSClientRectCustom.cpp: Removed. * bindings/js/JSPerformanceTimingCustom.cpp: Removed. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GenerateSerializerFunction): * bindings/scripts/IDLParser.pm: (parseSerializerRest): (parseSerializationPattern): (parseSerializationAttributes): (isSerializableAttribute): (applyMemberList): * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionToJSONCaller): * bindings/scripts/test/JS/JSTestSerialization.cpp: Added. * bindings/scripts/test/JS/JSTestSerialization.h: Added. * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestSerialization.idl: Copied from Source/WebCore/dom/ClientRect.idl. * dom/ClientRect.idl: * page/PerformanceTiming.idl: 2016-10-15 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Restore user agent quirk for Yahoo https://bugs.webkit.org/show_bug.cgi?id=163481 Reviewed by Carlos Garcia Campos. finance.yahoo.com is sending a mobile version in response to our standard user agent. * platform/gtk/UserAgentGtk.cpp: (WebCore::urlRequiresMacintoshPlatform): 2016-10-15 Chris Dumez <cdumez@apple.com> Setting HTMLMediaElement.volume to NaN or Inf should throw a TypeError https://bugs.webkit.org/show_bug.cgi?id=163472 Reviewed by Sam Weinig. Setting HTMLMediaElement.volume to NaN or Inf should throw a TypeError: - https://html.spec.whatwg.org/#dom-media-volume This is because the attribute is of type double (not unrestricted double in the IDL). Chrome and Firefox agree with the specification. WebKit throws an IndexSizeErr instead. No new tests, rebaselined existing test. * html/HTMLMediaElement.idl: 2016-10-15 Zalan Bujtas <zalan@apple.com> CounterNode::resetRenderers is so inefficient. https://bugs.webkit.org/show_bug.cgi?id=163480 Reviewed by Simon Fraser. CounterNode::resetRenderers() removes all the associated renderers from this CounterNode and sets the dirty bit on them. This patch does all that in a loop, instead of traversing the linked tree on each removal. No change in functionality. * rendering/CounterNode.cpp: (WebCore::CounterNode::CounterNode): (WebCore::CounterNode::~CounterNode): (WebCore::CounterNode::nextInPreOrderAfterChildren): (WebCore::CounterNode::lastDescendant): (WebCore::CounterNode::addRenderer): These assertions do not seem super useful. (WebCore::CounterNode::removeRenderer): (WebCore::CounterNode::resetRenderers): (WebCore::CounterNode::insertAfter): (WebCore::CounterNode::removeChild): * rendering/CounterNode.h: * rendering/RenderCounter.cpp: (WebCore::makeCounterNode): (WebCore::RenderCounter::RenderCounter): (WebCore::RenderCounter::~RenderCounter): (WebCore::RenderCounter::originalText): (WebCore::updateCounters): (WebCore::RenderCounter::invalidate): Deleted. * rendering/RenderCounter.h: 2016-10-15 Antoine Quint <graouts@apple.com> [Modern Media Controls] macOS inline controls https://bugs.webkit.org/show_bug.cgi?id=163444 <rdar://problem/27989473> Reviewed by Dean Jackson. Introducing the new MacOSMediaControls and MacOSInlineMediaControls classes. MacOSMediaControls is a MediaControls subclass that adds specific buttons to the macOS platform and sets the layout traits to be macOS. This class has a new subclass, MacOSInlineMediaControls, which sets the layout traits to also include inline and implements custom layout to drop controls as necessary as the width of the controls varies. It also shows the volume slider when the mute button is hovered. Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-buttons-styles.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-constructor.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-controls-bar-styles.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-volume-slider-visibility.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-volume-styles.html media/modern-media-controls/macos-inline-media-controls/macos-inline-media-dropping-controls.html media/modern-media-controls/macos-media-controls/macos-media-controls.html * Modules/modern-media-controls/controls/macos-inline-media-controls.css: Added. (.media-controls.mac.inline > .controls-bar): (.media-controls.mac.inline > .controls-bar > *): (.media-controls.mac.inline button): (.media-controls.mac.inline button:active): (.media-controls.mac.inline > .controls-bar button): (.media-controls.mac.inline > .controls-bar,): (.media-controls.mac.inline button.play-pause): (.media-controls.mac.inline button.skip-back): (.media-controls.mac.inline .scrubber.slider): (.media-controls.mac.inline button.mute): (.media-controls.mac.inline button.airplay): (.media-controls.mac.inline button.pip): (.media-controls.mac.inline button.tracks): (.media-controls.mac.inline button.fullscreen): (.media-controls.mac.inline .time-label): (.media-controls.mac.inline .volume-slider-container): (.media-controls.mac.inline .volume-slider-container:before): (.media-controls.mac.inline .volume.slider): * Modules/modern-media-controls/controls/macos-inline-media-controls.js: Added. (MacOSInlineMediaControls.prototype.layout): (MacOSInlineMediaControls.prototype.handleEvent): * Modules/modern-media-controls/controls/macos-media-controls.js: Added. (MacOSMediaControls): 2016-10-14 Antti Koivisto <antti@apple.com> 100% CPU on homedepot.com page https://bugs.webkit.org/show_bug.cgi?id=163452 <rdar://problem/28730708> Reviewed by Simon Fraser. The site has a keyframe animation on body. Currently this causes the animation to invalidate the style of the entire document. Animations use SyntheticStyleChange to invalidate elements when animation progresses and currently that causes full subtree invalidation. However animation only ever affect individual elements and the normal style resolution mechanism should be able to deal with things like inheritance as needed. Test: fast/animation/animation-style-update-size.html * dom/Document.cpp: (WebCore::Document::recalcStyle): * dom/Document.h: (WebCore::Document::lastStyleUpdateSizeForTesting): Testing support. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): Don't force subtree style resolution for SyntheticStyleChange. * style/StyleUpdate.h: (WebCore::Style::Update::size): * testing/Internals.cpp: (WebCore::Internals::lastStyleUpdateSize): * testing/Internals.h: * testing/Internals.idl: 2016-10-14 Chris Dumez <cdumez@apple.com> Setting HTMLMediaElement.muted to the same value should not fire a volume change event https://bugs.webkit.org/show_bug.cgi?id=163474 Reviewed by Eric Carlson. Setting HTMLMediaElement.muted to the same value should not fire a volume change event: - https://html.spec.whatwg.org/#dom-media-muted Chrome and Firefox agree with the specification. No new tests, rebaselined existing test. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setMuted): 2016-10-14 Dean Jackson <dino@apple.com> Add Display P3 ColorSpace https://bugs.webkit.org/show_bug.cgi?id=162880 <rdar://problem/28598564> Reviewed by Sam Weinig. Re-landing with a version that hopefully compiles on El Capitan. Add a new ColorSpace for Display P3. This will be tested once the Color class can create objects that reference other color spaces. * platform/graphics/ColorSpace.h: * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::displayP3ColorSpaceRef): * platform/graphics/cg/GraphicsContextCG.h: (WebCore::cachedCGColorSpace): 2016-10-14 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Minor cleanups https://bugs.webkit.org/show_bug.cgi?id=162953 Reviewed by Dean Jackson. Code cleanup. No change in behavior. * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::frameIsCompleteAtIndex): (WebCore::ImageDecoder::frameBytesAtIndex): 2016-10-14 Alex Christensen <achristensen@webkit.org> Fix CMake build. * PlatformMac.cmake: 2016-10-14 Anders Carlsson <andersca@apple.com> Pass on networking settings to the PKPaymentRequest https://bugs.webkit.org/show_bug.cgi?id=163462 rdar://problem/28567629 Reviewed by Dan Bernstein. Add new SPI. * platform/spi/cocoa/PassKitSPI.h: 2016-10-14 Dean Jackson <dino@apple.com> CSS parsing should use Color not RGBA32 https://bugs.webkit.org/show_bug.cgi?id=163423 <rdar://problem/28766903> Reviewed by Simon Fraser. Re-landing this after it was rolled out in https://trac.webkit.org/r207342. In order to allow CSS to use the ExtendedColor variant of Color, we need to stop using RGBA32. This is a fairly big change that goes through all the places in the parser related to colors, and moves them from RGBA32 to Color. No change in functionality, so covered by existing tests. * WebCore.xcodeproj/project.pbxproj: Add the new ColorHash.h file. * css/CSSPrimitiveValue.cpp: CSSPrimitiveValue now can hold a Color* rather than an unsigned int for colors. (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::cleanup): (WebCore::CSSPrimitiveValue::getRGBColorValue): (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): (WebCore::CSSPrimitiveValue::cloneForCSSOM): (WebCore::CSSPrimitiveValue::equals): * css/CSSPrimitiveValue.h: Move to Color* and also use some nullptrs. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add a new inline constructor. * css/CSSValuePool.cpp: Move to Color. (WebCore::CSSValuePool::CSSValuePool): (WebCore::CSSValuePool::createColorValue): * css/CSSValuePool.h: Change the ColorValueCache to a new type. * css/StyleResolver.cpp: Move to Color. (WebCore::StyleResolver::colorFromPrimitiveValue): * css/parser/CSSParser.cpp: (WebCore::parseColorValue): (WebCore::CSSParser::parseColor): (WebCore::CSSParser::parseColorFromString): (WebCore::CSSParser::parseSystemColor): (WebCore::fastParseColorInternal): (WebCore::CSSParser::fastParseColor): (WebCore::CSSParser::parseColorFromValue): * css/parser/CSSParser.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::fastParseColorInternal): (WebCore::CSSParserFastPaths::parseColor): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeColor): * css/parser/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGValue): (WebCore::CSSParser::parseSVGPaint): (WebCore::CSSParser::parseSVGColor): * editing/EditingStyle.cpp: (WebCore::cssValueToColor): (WebCore::textColorFromStyle): (WebCore::backgroundColorFromStyle): (WebCore::rgbaBackgroundColorInEffect): (WebCore::EditingStyle::prepareToApplyAt): (WebCore::isTransparentColorValue): (WebCore::cssValueToRGBA): Deleted. * editing/cocoa/HTMLConverter.mm: (HTMLConverterCaches::colorPropertyValueForNode): * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::parseAttribute): * html/canvas/CanvasGradient.cpp: (WebCore::CanvasGradient::addColorStop): * html/canvas/CanvasRenderingContext2D.cpp: Ditto, but leave a FIXME to remind myself to come back when colorWithOverrideAlpha has been updated. (WebCore::CanvasRenderingContext2D::setStrokeStyle): (WebCore::CanvasRenderingContext2D::setFillStyle): (WebCore::CanvasRenderingContext2D::setShadowColor): (WebCore::CanvasRenderingContext2D::setShadow): * html/canvas/CanvasStyle.cpp: (WebCore::isCurrentColorString): (WebCore::parseColor): (WebCore::currentColor): (WebCore::parseColorOrCurrentColor): (WebCore::CanvasStyle::createFromString): (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): * html/canvas/CanvasStyle.h: * svg/SVGColor.cpp: (WebCore::SVGColor::colorFromRGBColorString): * platform/graphics/Color.h: Add new constructors for the special empty and deleted Color values used in HashTables. (WebCore::Color::Color): (WebCore::Color::isHashTableDeletedValue): (WebCore::Color::asUint64): New accessor to get the raw uint64_t value. * platform/graphics/ColorHash.h: Added. Implement the traits for a Color HashTable. (WTF::ColorHash::hash): (WTF::ColorHash::equal): (WTF::HashTraits<WebCore::Color>::emptyValue): (WTF::HashTraits<WebCore::Color>::constructDeletedValue): (WTF::HashTraits<WebCore::Color>::isDeletedValue): 2016-10-14 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Implement basic SVG support https://bugs.webkit.org/show_bug.cgi?id=163349 Reviewed by Brent Fulgham. Direct2D needs access to the target graphics context when generating bitmap images so that it can properly match pixel format and other settings. Add implementations for a number of drawing primitives used in the SVG test cases. Correct some differences between CG and Direct2D for drawing different primitives. No new tests. Tested by existing 'svg' tests. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::frameImageAtIndex): Take optional target graphics context. Also pass the graphics context to the image decoder. (WebCore::BitmapImage::nativeImage): Accept an optional target context. (WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto. (WebCore::BitmapImage::draw): Pass target graphics context to the 'frameImageAtIndex' method. * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: * platform/graphics/ImageBuffer.cpp: (WebCore::ImageBuffer::create): Moved from header. Add create function that takes an optional GraphicsContext argument. * platform/graphics/ImageBuffer.h: * platform/graphics/ImageFrameCache.cpp: Add missing include needed to build under Direct2D. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::setDecoderTargetContext): Added. (WebCore::ImageSource::setRenderTarget): Deleted. * platform/graphics/ImageSource.h: * platform/graphics/Pattern.h: * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContextPlatformPrivate::endDraw): Log error state instead of crashing each time. (WebCore::GraphicsContext::drawEllipse): Ellipses are defined in D2D as a center, an X-radius, and a Y-radius. (WebCore::GraphicsContext::applyStrokePattern): (WebCore::GraphicsContext::applyFillPattern): (WebCore::GraphicsContext::clearRect): Use 'Clear' function if possible. Don't clear anything if the clear rect is outside the drawing area. (WebCore::GraphicsContext::strokeRect): Provide implementation (needed by SVG). (WebCore::GraphicsContext::platformFillEllipse): Ellipses are defined in D2D as a center, an X-radius, and a Y-radius. (WebCore::GraphicsContext::platformStrokeEllipse): Ditto. * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::createCompatibleBuffer): Accept optional GraphicsContext argument. (WebCore::ImageBuffer::ImageBuffer): Ditto. * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::setTargetContext): Renamed from 'setRenderTarget'. (WebCore::ImageDecoder::createFrameImageAtIndex): Take optional GraphicsContext argument. (WebCore::ImageDecoder::setRenderTarget): Deleted. * platform/graphics/win/ImageDecoderDirect2D.h: * platform/graphics/win/ImageDirect2D.cpp: (WebCore::BitmapImage::setRenderTarget): Deleted. * platform/graphics/win/NativeImageDirect2D.cpp: Add missing include. * platform/graphics/win/PatternDirect2D.cpp: (WebCore::Pattern::createPlatformPattern): Revise for new signature. * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Pass GraphicsContext to ImageBuffer constructor. (WebCore::FilterEffectRendererHelper::beginFilterEffect): Pass target context to filter when allocating backing store. * rendering/FilterEffectRenderer.h: Add GraphicsContext as argument to constructor. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::hasFilterThatIsPainting): Supply GraphicsContext argument when building new FilterEffectRenderer and helper. (WebCore::RenderLayer::setupFilters): Ditto. * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImageForCurrentFrame): Revise to take optional GraphicsContext argument. (WebCore::SVGImage::nativeImage): Ditto. * svg/graphics/SVGImage.h: * svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::nativeImageForCurrentFrame): Ditto. * svg/graphics/SVGImageForContainer.h: 2016-10-14 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r207319. Regressed Dromaeo and may have caused crashes under GuardMalloc (rdar://problem/28780835) Reverted changeset: "[Web IDL] Add support for [SameObject] extended attribute" https://bugs.webkit.org/show_bug.cgi?id=163414 http://trac.webkit.org/changeset/207319 2016-10-14 Anders Carlsson <andersca@apple.com> Clean up BackForwardClient https://bugs.webkit.org/show_bug.cgi?id=163454 Reviewed by Sam Weinig. Remove iOS specific member functions that are only used from WebKit. * history/BackForwardClient.h: * loader/EmptyClients.cpp: 2016-10-13 Anders Carlsson <andersca@apple.com> Move BackForwardList from WebCore to WebKitLegacy https://bugs.webkit.org/show_bug.cgi?id=163418 Reviewed by Tim Horton. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::BackForwardController): * history/BackForwardController.h: * loader/EmptyClients.cpp: (WebCore::fillWithEmptyClients): * page/Page.cpp: (WebCore::Page::Page): 2016-10-14 Manuel Rego Casasnovas <rego@igalia.com> [css-grid] Changing the argument on fit-content() doesn't cause the grid to be relayout https://bugs.webkit.org/show_bug.cgi?id=163434 Reviewed by Sergio Villar Senin. When fit-content() was implemented a new attribute m_fitContentTrackBreadth was added to GridTrackSize. However we forgot to include it in the == operator implementation, so we were missing the changes on that value. Now if you change the argument of a fit-content() track, the track size is properly recomputed. Test: fast/css-grid-layout/grid-change-fit-content-argument.html * rendering/style/GridTrackSize.h: (WebCore::GridTrackSize::operator==): Check m_fitContentTrackBreadth. 2016-10-14 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r207317. https://bugs.webkit.org/show_bug.cgi?id=163448 This change caused an existing LayoutTest to fail on all platforms (Requested by ryanhaddad on #webkit). Reverted changeset: "CSS parsing should use Color not RGBA32" https://bugs.webkit.org/show_bug.cgi?id=163423 http://trac.webkit.org/changeset/207317 2016-10-14 Antti Koivisto <antti@apple.com> Share inline stylesheets between shadow trees https://bugs.webkit.org/show_bug.cgi?id=163353 Reviewed by Ryosuke Niwa and Andreas Kling. If shadow trees have identical inline stylesheets the data structures can be shared. In future this will also allow sharing style resolvers. * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::createInline): Move StyleSheetContents construction to the client. * css/parser/CSSParserMode.h: (WebCore::CSSParserContextHash::hash): (WebCore::CSSParserContextHash::equal): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Make CSSParserContext hashable. * dom/ExtensionStyleSheets.cpp: (WebCore::createExtensionsStyleSheet): (WebCore::ExtensionStyleSheets::pageUserSheet): (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache): Don't use CSSStyleSheet::createInline, these are not really inline stylesheets. Code cleanups. * dom/InlineStyleSheetOwner.cpp: (WebCore::parserContextForForElement): (WebCore::makeInlineStyleSheetCacheKey): (WebCore::inlineStyleSheetCache): Implement a simple cache for sharing stylesheets with identical text and context. (WebCore::InlineStyleSheetOwner::createSheet): (WebCore::InlineStyleSheetOwner::clearCache): * dom/InlineStyleSheetOwner.h: * platform/MemoryPressureHandler.cpp: (WebCore::MemoryPressureHandler::releaseNoncriticalMemory): 2016-10-14 Chris Dumez <cdumez@apple.com> [Mac] Allow throttling of background tabs that have media elements with no audible audio https://bugs.webkit.org/show_bug.cgi?id=163402 <rdar://problem/28056151> Reviewed by Gavin Barraclough. Allow throttling of background tabs that have media elements with no audible audio. We were taking an media assertion from the PageThrottler as soon as there was a media element playing on the page. This prevented throttling of background tabs even if those media elements had no audible audio, which was unfortunate. We now have more fine-grained rules for when HTMLMediaElement should take an assertion. I also added release logging to help debug such issues in the future. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setMuted): (WebCore::HTMLMediaElement::updateVolume): (WebCore::HTMLMediaElement::updatePlayState): (WebCore::HTMLMediaElement::updateAudioAssertionState): (WebCore::HTMLMediaElement::effectiveMuted): Deleted. * html/HTMLMediaElement.h: 2016-10-14 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Cleanup patch, fix small inconsistencies https://bugs.webkit.org/show_bug.cgi?id=163329 Reviewed by Youenn Fablet. Cleanup patch, fixed 3 small inconsistences between implementation and spec. No change in behaviour. * Modules/streams/ReadableStream.idl: Added optional parameter in getReader. * Modules/streams/ReadableStreamDefaultController.js: (error): Call readableStreamDefaultControllerError instead of readableStreamError. * Modules/streams/ReadableStreamInternals.js: Added missing ASSERT in readableStreamDefaultControllerCallPullIfNeeded. 2016-10-14 Youenn Fablet <youenn@apple.com> http://trac.webkit.org/changeset/207330 broke Mac Windows build https://bugs.webkit.org/show_bug.cgi?id=163442 Unreviewed. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::toPlatformRequestCachePolicy): Do not explicitly use CFURLRequestCachePolicy enumeration values. 2016-10-14 Zan Dobersek <zdobersek@igalia.com> [Cairo] GraphicsContext3D::ImageExtractor fails to extract images https://bugs.webkit.org/show_bug.cgi?id=163439 Reviewed by Carlos Garcia Campos. In the Cairo implementation of GraphicsContext3D::ImageExtractor, don't check for frame completeness at index 0. This information is now cached only after the frame for that index is decoded and marked as completed, which is done after this check. Becuase of this the current check forces extractImage() to return early and abort WebGL texture uploads from image sources. This bug was most likely exposed after the refactoring in r206481. https://trac.webkit.org/changeset/206481 * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): 2016-10-14 Youenn Fablet <youenn@apple.com> MediaResourceLoader should use CachedResource::ressourceError to do CORS checks https://bugs.webkit.org/show_bug.cgi?id=163279 Reviewed by Darin Adler. Covered by existing tests. * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::responseReceived): Making use of CachedResource::ressourceError to detect CORS failures. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Activating loader options checks before reusing the resource. (WebCore::isResourceSuitableForDirectReuse): Disabling direct reuse of MediaResource since reuse of raw resources does not work yet for media resources. 2016-10-14 Youenn Fablet <youenn@apple.com> Make NetworkCache aware of fetch cache mode https://bugs.webkit.org/show_bug.cgi?id=163332 Reviewed by Antti Koivisto. Tests: imported/w3c/web-platform-tests/fetch/api/request/request-cache-default-conditional.html imported/w3c/web-platform-tests/fetch/api/request/request-cache-default.html imported/w3c/web-platform-tests/fetch/api/request/request-cache-force-cache.html imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-cache.html imported/w3c/web-platform-tests/fetch/api/request/request-cache-no-store.html imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html imported/w3c/web-platform-tests/fetch/api/request/request-cache-reload.html * loader/cache/CachedResourceLoader.cpp: (WebCore::updateRequestAccordingCacheMode): Setting request cache policy according cache mode. Basically, these two are about the same. (WebCore::CachedResourceLoader::determineRevalidationPolicy): Making use of cache policy instead of cache mode. * platform/network/ResourceRequestBase.h: Adding new cache policies, aligned with fetch cache modes. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::toPlatformRequestCachePolicy): If policy is not supported by CFNetwork, fallback to ReloadIgnoringCacheData. This is the best approximate we might find. (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): (WebCore::ResourceRequest::doUpdateResourceRequest): Only updating cache policy, if cache policy is the default. * platform/network/cf/ResourceRequestCFNet.h: * platform/network/cocoa/ResourceRequestCocoa.mm: Doing the same modifications as for ResourceRequestCFNet. (WebCore::ResourceRequest::doUpdateResourceRequest): (WebCore::toPlatformRequestCachePolicy): (WebCore::ResourceRequest::doUpdatePlatformRequest): 2016-10-13 Youenn Fablet <youenn@apple.com> Binding generated code for private operations should assert for casted-this checks https://bugs.webkit.org/show_bug.cgi?id=163326 Reviewed by Darin Adler. Covered by existing tests. Private operations are not exposed to user scripts and are only called by built-in scripts or other WebKit-controlled code. The call sites already ensure that the caller is of the right type so there is no need to do that work twice. Introducing a casted-this-error Assert mode for casted-this checks, which may be reused for other binding generated code. Updated binding generator to use that mode for private operations. * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::callPromiseOperation): (WebCore::BindingCaller::callOperation): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::jsTestGlobalObjectInstanceFunctionTestPrivateFunction): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionPrivateMethod): 2016-10-13 Carlos Garcia Campos <cgarcia@igalia.com> WebView and WebPage URLs not updated after URL is modified by InjectedBundlePageResourceLoadClient::willSendRequestForFrame https://bugs.webkit.org/show_bug.cgi?id=146306 Reviewed by Darin Adler. Notify about the provisional URL change when new request set for main resource load in DocumentLoader has a different URL than the previous one. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::setRequest): 2016-10-13 Youenn Fablet <youenn@apple.com> Update serializer and iterator binding generated code https://bugs.webkit.org/show_bug.cgi?id=163325 Reviewed by Darin Adler. No change of behavior. Covered by existing tests and rebased binding generated code. Making use of BindingCaller::callOperation within serializer and iterator operations. Refactored serializer code to use direct attribute getters. * bindings/js/JSDOMIterator.h: (WebCore::iteratorCreate): (WebCore::iteratorForEach): * bindings/scripts/CodeGeneratorJS.pm: (GenerateSerializerFunction): (GenerateImplementationIterableFunctions): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::jsTestIterablePrototypeFunctionSymbolIteratorCaller): (WebCore::jsTestIterablePrototypeFunctionSymbolIterator): (WebCore::jsTestIterablePrototypeFunctionEntriesCaller): (WebCore::jsTestIterablePrototypeFunctionEntries): (WebCore::jsTestIterablePrototypeFunctionKeysCaller): (WebCore::jsTestIterablePrototypeFunctionKeys): (WebCore::jsTestIterablePrototypeFunctionValuesCaller): (WebCore::jsTestIterablePrototypeFunctionValues): (WebCore::jsTestIterablePrototypeFunctionForEachCaller): (WebCore::jsTestIterablePrototypeFunctionForEach): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::jsTestNodePrototypeFunctionSymbolIteratorCaller): (WebCore::jsTestNodePrototypeFunctionSymbolIterator): (WebCore::jsTestNodePrototypeFunctionEntriesCaller): (WebCore::jsTestNodePrototypeFunctionEntries): (WebCore::jsTestNodePrototypeFunctionKeysCaller): (WebCore::jsTestNodePrototypeFunctionKeys): (WebCore::jsTestNodePrototypeFunctionValuesCaller): (WebCore::jsTestNodePrototypeFunctionValues): (WebCore::jsTestNodePrototypeFunctionForEachCaller): (WebCore::jsTestNodePrototypeFunctionForEach): (WebCore::jsTestNodePrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionToJSON): 2016-10-13 Alex Christensen <achristensen@webkit.org> Fix API test after r207318. https://bugs.webkit.org/show_bug.cgi?id=162951 This fixes the API test WebKit2.PendingAPIRequestURL which asserted when trying to hash a null String. * loader/DocumentLoader.cpp: (WebCore::isRemoteWebArchive): If the mimeType is a null String, it is not in the set webArchiveMIMETypes, so return false instead of hashing it. 2016-10-13 Alex Christensen <achristensen@webkit.org> Hosts of URLs with non-special schemes should be case-sensitive, and non-ASCII characters in such hosts should be punycode-encoded https://bugs.webkit.org/show_bug.cgi?id=163413 Reviewed by Tim Horton. This retains compatibility with the canonicalization Chrome, Firefox, and Safari with uppercase characters in the hosts of URLs with unrecognized schemes. Safari treats such characters as the host, while Firefox and Chrome treat such characters as part of the path, starting with the "//" after the ':' Behavior of non-ASCII characters is inconsistent, and since we need to have a host, we should punycode-encode the host to be consistent with special schemes because percent-encoding hosts sometimes is inconsistent. This solution was proposed to the spec in https://github.com/whatwg/url/issues/148 Covered by updated API and layout tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasInvalidDomainCharacter): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::formURLDecode): (WebCore::percentDecode): Deleted. (WebCore::domainToASCII): Deleted. (WebCore::hasInvalidDomainCharacter): Deleted. (WebCore::formURLDecode): Deleted. * platform/URLParser.h: 2016-10-13 Chris Dumez <cdumez@apple.com> [Web IDL] Add support for [SameObject] extended attribute https://bugs.webkit.org/show_bug.cgi?id=163414 Reviewed by Darin Adler. Add support for [SameObject] Web IDL extended attribute: - https://heycam.github.io/webidl/#SameObject Start using it on DOM / HTML attributes where the specification mandates it. Test: js/dom/SameObject-support.html * bindings/scripts/CodeGeneratorJS.pm: (ShouldCacheAttribute): (GenerateHeader): (GenerateImplementation): * bindings/scripts/IDLAttributes.txt: * dom/DataTransfer.idl: * dom/Document.idl: * dom/Element.idl: * dom/MutationRecord.idl: * dom/Node.idl: * dom/NodeIterator.idl: * dom/ParentNode.idl: * dom/TreeWalker.idl: * html/HTMLAnchorElement.idl: * html/HTMLAreaElement.idl: * html/HTMLButtonElement.idl: * html/HTMLDataListElement.idl: * html/HTMLDocument.idl: * html/HTMLElement.idl: * html/HTMLFieldSetElement.idl: * html/HTMLFormElement.idl: * html/HTMLIFrameElement.idl: * html/HTMLInputElement.idl: * html/HTMLKeygenElement.idl: * html/HTMLLinkElement.idl: * html/HTMLMapElement.idl: * html/HTMLMediaElement.idl: * html/HTMLMeterElement.idl: * html/HTMLOutputElement.idl: * html/HTMLProgressElement.idl: * html/HTMLSelectElement.idl: * html/HTMLTableElement.idl: * html/HTMLTableRowElement.idl: * html/HTMLTableSectionElement.idl: * html/HTMLTextAreaElement.idl: * page/Location.idl: * page/Navigator.idl: 2016-10-13 Andy Estes <aestes@apple.com> [iOS] Support Web Archive previews generated by QuickLook https://bugs.webkit.org/show_bug.cgi?id=162951 <rdar://problem/28607920> Reviewed by Brady Eidson. QuickLook might generate a Web Archive preview for some resource types, but WebKit would refuse to load it due to the prohibition on loading remote Web Archives. Even though the original resource might be from a remote origin, the QuickLook-generated preview is a trusted local resource, so allow it to be loaded. No test possible. * loader/DocumentLoader.cpp: (WebCore::isRemoteWebArchive): Added. Moved the remote web archive check from continueAfterContentPolicy() to here, and added a check for responses containing the QuickLook preview protocol. (WebCore::DocumentLoader::continueAfterContentPolicy): Called isRemoteWebArchive(). 2016-10-13 Dean Jackson <dino@apple.com> CSS parsing should use Color not RGBA32 https://bugs.webkit.org/show_bug.cgi?id=163423 <rdar://problem/28766903> Reviewed by Simon Fraser. In order to allow CSS to use the ExtendedColor variant of Color, we need to stop using RGBA32. This is a fairly big change that goes through all the places in the parser related to colors, and moves them from RGBA32 to Color. No change in functionality, so covered by existing tests. * WebCore.xcodeproj/project.pbxproj: Add the new ColorHash.h file. * css/CSSPrimitiveValue.cpp: CSSPrimitiveValue now can hold a Color* rather than an unsigned int for colors. (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::cleanup): (WebCore::CSSPrimitiveValue::getRGBColorValue): (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): (WebCore::CSSPrimitiveValue::cloneForCSSOM): (WebCore::CSSPrimitiveValue::equals): * css/CSSPrimitiveValue.h: Move to Color* and also use some nullptrs. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Add a new inline constructor. * css/CSSValuePool.cpp: Move to Color. (WebCore::CSSValuePool::CSSValuePool): (WebCore::CSSValuePool::createColorValue): * css/CSSValuePool.h: Change the ColorValueCache to a new type. * css/StyleResolver.cpp: Move to Color. (WebCore::StyleResolver::colorFromPrimitiveValue): * css/parser/CSSParser.cpp: (WebCore::parseColorValue): (WebCore::CSSParser::parseColor): (WebCore::CSSParser::parseColorFromString): (WebCore::CSSParser::parseSystemColor): (WebCore::fastParseColorInternal): (WebCore::CSSParser::fastParseColor): (WebCore::CSSParser::parseColorFromValue): * css/parser/CSSParser.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::fastParseColorInternal): (WebCore::CSSParserFastPaths::parseColor): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeColor): * css/parser/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGValue): (WebCore::CSSParser::parseSVGPaint): (WebCore::CSSParser::parseSVGColor): * editing/EditingStyle.cpp: (WebCore::cssValueToColor): (WebCore::textColorFromStyle): (WebCore::backgroundColorFromStyle): (WebCore::rgbaBackgroundColorInEffect): (WebCore::EditingStyle::prepareToApplyAt): (WebCore::isTransparentColorValue): (WebCore::cssValueToRGBA): Deleted. * editing/cocoa/HTMLConverter.mm: (HTMLConverterCaches::colorPropertyValueForNode): * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::parseAttribute): * html/canvas/CanvasGradient.cpp: (WebCore::CanvasGradient::addColorStop): * html/canvas/CanvasRenderingContext2D.cpp: Ditto, but leave a FIXME to remind myself to come back when colorWithOverrideAlpha has been updated. (WebCore::CanvasRenderingContext2D::setStrokeStyle): (WebCore::CanvasRenderingContext2D::setFillStyle): (WebCore::CanvasRenderingContext2D::setShadowColor): (WebCore::CanvasRenderingContext2D::setShadow): * html/canvas/CanvasStyle.cpp: (WebCore::isCurrentColorString): (WebCore::parseColor): (WebCore::currentColor): (WebCore::parseColorOrCurrentColor): (WebCore::CanvasStyle::createFromString): (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): * html/canvas/CanvasStyle.h: * svg/SVGColor.cpp: (WebCore::SVGColor::colorFromRGBColorString): * platform/graphics/Color.h: Add new constructors for the special empty and deleted Color values used in HashTables. (WebCore::Color::Color): (WebCore::Color::isHashTableDeletedValue): (WebCore::Color::asUint64): New accessor to get the raw uint64_t value. * platform/graphics/ColorHash.h: Added. Implement the traits for a Color HashTable. (WTF::ColorHash::hash): (WTF::ColorHash::equal): (WTF::HashTraits<WebCore::Color>::emptyValue): (WTF::HashTraits<WebCore::Color>::constructDeletedValue): (WTF::HashTraits<WebCore::Color>::isDeletedValue): 2016-10-13 Nan Wang <n_wang@apple.com> AX: [Mac] better accessibility support for Summary elements https://bugs.webkit.org/show_bug.cgi?id=163367 <rdar://problem/28745010> Reviewed by Chris Fleizach. Exposed summary elements as AXButton and used the text node's content as AXTitle. Also exposed the details parent's expanded status on the summary element, so that users would see it as a collapsed/expanded button. Changes are covered in the modified tests. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::parentObjectUnignored): (WebCore::AccessibilityObject::scrollViewAncestor): (WebCore::AccessibilityObject::headingElementForNode): (WebCore::AccessibilityObject::matchedParent): (WebCore::AccessibilityObject::isDescendantOfObject): (WebCore::AccessibilityObject::isInsideARIALiveRegion): (WebCore::AccessibilityObject::elementAccessibilityHitTest): (WebCore::AccessibilityObject::isExpanded): (WebCore::AccessibilityObject::isARIAHidden): (WebCore::AccessibilityObject::focusableAncestor): (WebCore::AccessibilityObject::editableAncestor): * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isSummary): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityListAncestor]): (-[WebAccessibilityObjectWrapper _accessibilityLandmarkAncestor]): (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]): (-[WebAccessibilityObjectWrapper _accessibilityFieldsetAncestor]): (-[WebAccessibilityObjectWrapper tableCellParent]): (-[WebAccessibilityObjectWrapper tableParent]): (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]): (-[WebAccessibilityObjectWrapper convertRectToScreenSpace:]): (-[WebAccessibilityObjectWrapper detailParentForSummaryObject:]): (-[WebAccessibilityObjectWrapper detailParentForObject:]): (matchedParent): Deleted. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]): (createAccessibilityRoleMap): (-[WebAccessibilityObjectWrapper roleDescription]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2016-10-13 Zalan Bujtas <zalan@apple.com> [Clean RenderTree] LayoutTests/imported/blink/fast/table/crash-bad-child-table-continuation.html fails. https://bugs.webkit.org/show_bug.cgi?id=163399 Reviewed by David Hyatt. When we try to insert a renderer before a child whose direct parent is a (anonymus) RenderTable, continuation logic should dismiss the RenderTable as the parent and find a more appropriate ancestor. RenderTables assumes a certain descendant tree structure which might not be available in the continuation. Will be testable with webkit.org/b/162834 * rendering/RenderInline.cpp: (WebCore::canUseAsParentForContinuation): (WebCore::RenderInline::addChildToContinuation): 2016-10-13 Alex Christensen <achristensen@webkit.org> Disable URLParser for non-Safari iOS and Mac apps for now https://bugs.webkit.org/show_bug.cgi?id=163397 Reviewed by Tim Horton. r207268 was an awful hack, and it was insufficient. Disable the URLParser for other apps for now. Hopefully we can enable it everywhere soon. No change in behavior for testing infrastructure. Old URLs were well tested before making the switch, and nothing has changed for them. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::setEnabled): (WebCore::URLParser::enabled): * platform/URLParser.h: 2016-10-13 Chris Dumez <cdumez@apple.com> Rename [ConstructorTemplate=*] to [LegacyConstructorTemplate=*] https://bugs.webkit.org/show_bug.cgi?id=163390 Reviewed by Darin Adler. Rename [ConstructorTemplate=*] to [LegacyConstructorTemplate=*] as the modern way of doing this is to use a constructor that takes in a dictionary. I am working on getting rid of this extended attribute entirely but the remaining uses require better support for union types. * Modules/applepay/ApplePayValidateMerchantEvent.idl: * Modules/indexeddb/IDBVersionChangeEvent.idl: * Modules/mediastream/RTCTrackEvent.idl: * bindings/scripts/CodeGenerator.pm: (IsConstructorTemplate): * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinition): (IsConstructable): * bindings/scripts/IDLAttributes.txt: * dom/Event.idl: * dom/ProgressEvent.idl: * dom/UIEvent.idl: * html/track/TrackEvent.idl: 2016-10-13 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r207297. This change broke the iOS build. Reverted changeset: "Disable URLParser for non-Safari iOS and Mac apps for now" https://bugs.webkit.org/show_bug.cgi?id=163397 http://trac.webkit.org/changeset/207297 2016-10-13 Anders Carlsson <andersca@apple.com> Get rid of the HistoryItemVector typedef https://bugs.webkit.org/show_bug.cgi?id=163398 Reviewed by Beth Dakin. Expand the HistoryitemVector typedef instead to make it more clear what types we are dealing with. * history/BackForwardList.cpp: (WebCore::BackForwardList::backListWithLimit): (WebCore::BackForwardList::forwardListWithLimit): (WebCore::BackForwardList::entries): * history/BackForwardList.h: * history/HistoryItem.cpp: (WebCore::HistoryItem::children): * history/HistoryItem.h: * loader/HistoryController.cpp: (WebCore::HistoryController::currentFramesMatchItem): 2016-10-13 Antoine Quint <graouts@apple.com> [Modern Media Controls] MediaControls base class https://bugs.webkit.org/show_bug.cgi?id=163387 <rdar://problem/28753955> Reviewed by Dean Jackson. Introducing the new MediaControls class which will serve as a basis for all media controls. We will introduce specific MediaControls subclasses for macOS inline, macOS fullscreen and iOS inline in future patches. Tests: media/modern-media-controls/media-controls/media-controls-constructor.html media/modern-media-controls/media-controls/media-controls-placard.html media/modern-media-controls/media-controls/media-controls-start-button.html * Modules/modern-media-controls/controls/media-controls.css: Added. (.media-controls,): * Modules/modern-media-controls/controls/media-controls.js: Added. (MediaControls.): (MediaControls.prototype.get showsStartButton): (MediaControls.prototype.set showsStartButton): (MediaControls.prototype.get showsPlacard): (MediaControls.prototype.showPlacard): (MediaControls.prototype.hidePlacard): 2016-10-13 Alex Christensen <achristensen@webkit.org> Disable URLParser for non-Safari iOS and Mac apps for now https://bugs.webkit.org/show_bug.cgi?id=163397 Reviewed by Tim Horton. r207268 was an awful hack, and it was insufficient. Disable the URLParser for other apps for now. Hopefully we can enable it everywhere soon. No change in behavior for testing infrastructure. Old URLs were well tested before making the switch, and nothing has changed for them. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::setEnabled): (WebCore::URLParser::enabled): * platform/URLParser.h: 2016-10-13 Antoine Quint <graouts@apple.com> [Modern Media Controls] TimeControl and TimeLabel https://bugs.webkit.org/show_bug.cgi?id=163356 <rdar://problem/28741376> Reviewed by Dean Jackson. We introduce the TimeControl and TimeLabel classes. A TimeControl object provides two TimeLabels, one for the elapsed time, one for the remaining time, and a Scrubber in between them. Depending on a TimeControl's width, it will adjust its layout such that the scrubber takes all the available space between the labels, and can indicate whether it's large enough to meet the minimal required width to show the scrubber, such that a container node may decide not to show the TimeControl at all. TimeLabel nodes simply show an integer time value in miliseconds in a nicely formatted way. Tests: media/modern-media-controls/time-control/time-control.html media/modern-media-controls/time-label/time-label.html * Modules/modern-media-controls/controls/time-control.js: Added. (TimeControl.prototype.get width): (TimeControl.prototype.set width): (TimeControl.prototype.get isSufficientlyWide): * Modules/modern-media-controls/controls/time-label.css: Added. (.time-label): * Modules/modern-media-controls/controls/time-label.js: Added. (TimeLabel.prototype.get value): (TimeLabel.prototype.set value): (TimeLabel.prototype.commitProperty): (TimeLabel.prototype._formattedTime): 2016-10-13 Jer Noble <jer.noble@apple.com> CRASH at WebCore::SourceBuffer::removeCodedFrames + 37 https://bugs.webkit.org/show_bug.cgi?id=163336 Reviewed by Alex Christensen. Test: media/media-source/media-source-remove-crash.html A null-deref crash can occur if a SourceBuffer is removed from a MediaSource after SourceBuffer.remove() is called, but before the removeTimer is fired. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::removeTimerFired): 2016-10-13 Michael Catanzaro <mcatanzaro@igalia.com> [SOUP] SHOULD NEVER BE REACHED ../../Source/WebCore/platform/URL.cpp(1291) : void WebCore::URL::parse(const WTF::String&) https://bugs.webkit.org/show_bug.cgi?id=163392 Reviewed by Alex Christensen. Fix the URL constructor to work with URLParser. * platform/soup/URLSoup.cpp: (WebCore::URL::URL): 2016-10-13 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r207286. Caused LayoutTest http/tests/misc/acid3.html to fail. Reverted changeset: "Share inline stylesheets between shadow trees" https://bugs.webkit.org/show_bug.cgi?id=163353 http://trac.webkit.org/changeset/207286 2016-10-13 Sergio Villar Senin <svillar@igalia.com> [css-grid] Use min-size instead of min-content contribution for intrinsic maximums resolution https://bugs.webkit.org/show_bug.cgi?id=163283 Reviewed by Manuel Rego Casasnovas. This was recently modified in the specs https://hg.csswg.org/drafts/diff/575fb847e29d/css-grid/Overview.bs. Specifically this is addressing the last one. It used to be "min-content contribution" but now it says "min-size contribution". * rendering/RenderGrid.cpp: (WebCore::RenderGrid::currentItemSizeForTrackSizeComputationPhase): 2016-10-11 Sergio Villar Senin <svillar@igalia.com> [css-grid] Fix intrinsic maximums resolution with fit-content and auto https://bugs.webkit.org/show_bug.cgi?id=163282 Reviewed by Manuel Rego Casasnovas. The step 2.5 in section 12.5 https://drafts.csswg.org/css-grid/#algo-content of the specs, details how to sizes tracks with intrinsic max track sizing functions. Not so long ago there were only two max track sizing functions min-content and max-content (auto was always resolved to max-content). However there were some recent changes that force us to consider 2 new values: auto (which is not internally translated to max-content although it still works the same) and specially the newly added fit-content. Some of the new test cases are commented due to bug http://wkb.ug/163283. Test: fast/css-grid-layout/grid-intrinsic-maximums.html * rendering/RenderGrid.cpp: (WebCore::RenderGrid::shouldProcessTrackForTrackSizeComputationPhase): * rendering/style/GridTrackSize.h: (WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes): (WebCore::GridTrackSize::hasIntrinsicMinTrackBreadth): (WebCore::GridTrackSize::hasIntrinsicMaxTrackBreadth): (WebCore::GridTrackSize::hasAutoOrMinContentMinTrackBreadthAndIntrinsicMaxTrackBreadth): 2016-10-13 Miguel Gomez <magomez@igalia.com> [GTK] Video playback doesn't work properly with accelerated compositing disabled https://bugs.webkit.org/show_bug.cgi?id=163386 Reviewed by Carlos Garcia Campos. Trigger a repaint of the player when a new frame arrives and accelerated compositing is disabled. Covered by existent tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): 2016-10-13 Antti Koivisto <antti@apple.com> Share inline stylesheets between shadow trees https://bugs.webkit.org/show_bug.cgi?id=163353 Reviewed by Ryosuke Niwa and Andreas Kling. If shadow trees have identical inline stylesheets the data structures can be shared. In future this will also allow sharing style resolvers. * css/parser/CSSParserMode.h: (WebCore::CSSParserContextHash::hash): (WebCore::CSSParserContextHash::equal): (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Make CSSParserContext hashable. * dom/InlineStyleSheetOwner.cpp: (WebCore::makeInlineStyleSheetCacheKey): (WebCore::inlineStyleSheetCache): Implement a simple cache for sharing stylesheets with identical text and context. (WebCore::InlineStyleSheetOwner::createSheet): (WebCore::InlineStyleSheetOwner::clearCache): * dom/InlineStyleSheetOwner.h: * platform/MemoryPressureHandler.cpp: (WebCore::MemoryPressureHandler::releaseNoncriticalMemory): 2016-10-13 Antti Koivisto <antti@apple.com> Revert patch landed with wrong commit message. 2016-10-12 Per Arne Vollan <pvollan@apple.com> [Win] Encode function pointers. https://bugs.webkit.org/show_bug.cgi?id=163331 Reviewed by Brent Fulgham. We should encode stored function pointers. * platform/win/SoftLinking.h: 2016-10-13 Youenn Fablet <youenn@apple.com> Remove CachedResourceRequest::mutableResourceRequest https://bugs.webkit.org/show_bug.cgi?id=163277 Reviewed by Sam Weinig. No change of behavior. Removing CachedResourceRequest::mutableResourceRequest requires call sites to either update the ResourceRequest before creating the CachedResourceRequest or to add methods at CachedResourceRequest. Adding CachedResourceRequest::releaseResourceRequest for CachedResource constructor. Most new CachedResourceRequest methods are used by CachedResourceLoader which is passed a CachedResourceRequest. This allows code in CachedResourceLoader to be easier to read. * css/CSSImageSetValue.cpp: (WebCore::CSSImageSetValue::loadBestFitImage): * css/CSSImageValue.cpp: (WebCore::CSSImageValue::loadImage): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestScriptWithCache): * loader/CrossOriginAccessControl.cpp: (WebCore::createAccessControlPreflightRequest): * loader/CrossOriginAccessControl.h: * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::startPreflight): (WebCore::CrossOriginPreflightChecker::doPreflight): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::loadRequest): * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): (WebCore::CachedResourceLoader::prepareFetch): (WebCore::CachedResourceLoader::updateHTTPRequestHeaders): (WebCore::CachedResourceLoader::requestResource): (WebCore::acceptHeaderValueFromType): Deleted. (WebCore::updateRequestAccordingCacheMode): Deleted. * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin): (WebCore::CachedResourceRequest::updateForAccessControl): (WebCore::CachedResourceRequest::upgradeInsecureRequestIfNeeded): (WebCore::CachedResourceRequest::setDomainForCachePartition): (WebCore::acceptHeaderValueFromType): (WebCore::CachedResourceRequest::setAcceptHeaderIfNone): (WebCore::CachedResourceRequest::updateAccordingCacheMode): (WebCore::CachedResourceRequest::removeFragmentIdentifierIfNeeded): (WebCore::CachedResourceRequest::applyBlockedStatus): * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::releaseResourceRequest): (WebCore::CachedResourceRequest::setCachingPolicy): (WebCore::CachedResourceRequest::mutableResourceRequest): Deleted. (WebCore::CachedResourceRequest::setCacheModeToNoStore): Deleted. * loader/icon/IconLoader.cpp: (WebCore::IconLoader::startLoading): * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp: (WebCore::WebCoreAVCFResourceLoader::startLoading): * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::startLoading): 2016-10-13 Antti Koivisto <antti@apple.com> Support scoped style for user agent shadow trees https://bugs.webkit.org/show_bug.cgi?id=163212 <rdar://problem/28715318> Reviewed by Ryosuke Niwa and Andreas Kling. This patch adds support for user agent shadow trees that have scoped style. This means that the shadows can be styled via <style> elements contained in the tree instead of using pseudo elements on the global UA sheet. Since the style is scoped it can use normal id and class selectors. Elements in the shadow tree can still be exposed for author styling if needed by giving them pseudo ids The patch also uses the new mechanism for the <meter> element. The mechanism is not optimized yet, each shadow tree gets its own copy of style-related data structures. This can be improved later. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * css/ElementRuleCollector.cpp: (WebCore::MatchRequest::MatchRequest): (WebCore::ElementRuleCollector::addMatchedRule): (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules): Make treeContextOrdinal an int so we can use negative ordinals. This is used to allow author pseudo elements from earlier tree context to win over the shadow tree (matching CSS scoping spec language). * css/ElementRuleCollector.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::MatchResult::addMatchedProperties): (WebCore::StyleResolver::CascadedProperties::addImportantMatches): * css/StyleResolver.h: * css/html.css: (meter::-webkit-meter-inner-element): Deleted. (meter::-webkit-meter-bar): Deleted. (meter::-webkit-meter-optimum-value): Deleted. (meter::-webkit-meter-suboptimum-value): Deleted. (meter::-webkit-meter-even-less-good-value): Deleted. Remove meter pseudo elements from the UA sheet. * html/HTMLMeterElement.cpp: (WebCore::HTMLMeterElement::childShouldCreateRenderer): Don't create shadow renderers when we have appearance (are using RenderMeter). (WebCore::setValueClass): Move this logic here from MeterShadowElement.cpp. Set both class and pseudo id. The latter is needed to keep author styling working. (WebCore::HTMLMeterElement::didElementStateChange): (WebCore::HTMLMeterElement::renderMeter): RenderMeter is now only instantiated when appearance is enabled. (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot): Build the shadow tree out of <div>s instead of special shadow elements. * html/HTMLMeterElement.h: * html/shadow/MeterShadowElement.cpp: Removed. * html/shadow/MeterShadowElement.h: Removed. Not needed anymore. * html/shadow/meterElementShadow.css: Added. (div#inner): (div#bar): (div#value): (div#value.optimum): (div#value.suboptimum): (div#value.even-less-good): Stylesheet for meter element shadow tree using normal id and class selectors. * style/StyleScope.cpp: (WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver): Switch to per-scope style resolver for UA shadow trees if there is stylesheets in the tree. (WebCore::Style::Scope::resolver): (WebCore::Style::Scope::resolverIfExists): * style/StyleScope.h: 2016-10-12 Chris Dumez <cdumez@apple.com> [Web IDL] Drop support for legacy [ConstructorConditional=*] https://bugs.webkit.org/show_bug.cgi?id=163368 Reviewed by Ryosuke Niwa. Drop support for legacy [ConstructorConditional=*] webkit-specific IDL extended attribute. This was introduced to disable DOM4 event constructors at compile time. However, nowadays, those constructors are enabled everywhere. * Configurations/FeatureDefines.xcconfig: * bindings/scripts/CodeGenerator.pm: (GenerateConstructorConditionalString): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorHelperMethods): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::getConstructData): Deleted. * bindings/scripts/test/TestInterface.idl: * dom/UIEvent.idl: 2016-10-12 Chris Dumez <cdumez@apple.com> The bindings generator should provide a better error message when it does not find a dictionary definition https://bugs.webkit.org/show_bug.cgi?id=163377 Reviewed by Ryosuke Niwa. The bindings generator should provide a better error message when it does not find a dictionary definition. * bindings/scripts/CodeGenerator.pm: (GetDictionaryByName): * bindings/scripts/CodeGeneratorJS.pm: (assert): (GenerateDictionaryImplementationContent): (GenerateHeader): (GenerateDictionaryHeader): 2016-10-12 Chris Dumez <cdumez@apple.com> Update WebKitMediaKeyMessageEvent / WebKitMediaKeyNeededEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163369 Reviewed by Ryosuke Niwa. Update WebKitMediaKeyMessageEvent / WebKitMediaKeyNeededEvent to stop using legacy [ConstructorTemplate=Event] and use regular constructors instead. This also adds support for having dictionary members that are typed arrays because this was needed. Test: fast/events/webkit-media-key-events-constructor.html * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent): * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: (WebCore::WebKitMediaKeyMessageEvent::create): (WebCore::WebKitMediaKeyMessageEvent::createForBindings): Deleted. * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent): * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: (WebCore::WebKitMediaKeyNeededEvent::create): (WebCore::WebKitMediaKeyNeededEvent::createForBindings): Deleted. * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLInterface<JSC::GenericTypedArrayView<Adaptor>>>::convert): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): * dom/InputEvent.cpp: (WebCore::InputEvent::InputEvent): * dom/InputEvent.h: * dom/InputEvent.idl: 2016-10-12 Chris Dumez <cdumez@apple.com> Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements https://bugs.webkit.org/show_bug.cgi?id=163358 Reviewed by Kent Tamura. Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements. As per the specification, we only want optgroup elements that are direct children of the select element. This also matches the behavior of Chrome. Test: fast/dom/HTMLSelectElement/nested-optgroup.html * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::recalcListItems): 2016-10-12 Zalan Bujtas <zalan@apple.com> RenderRubyRun should not mark child renderers dirty at the end of layout. https://bugs.webkit.org/show_bug.cgi?id=163359 <rdar://problem/28711840> Reviewed by David Hyatt. The current layout logic does not support marking renderers dirty for subsequent layouts. Layout needs to exit with a clean tree. Should relayoutChild be insufficient, we could also mark the base/text dirty for the justified content. Test: fast/ruby/rubyrun-has-bad-child.html * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::updateRubyForJustifiedText): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::layout): (WebCore::RenderRubyRun::layoutBlock): * rendering/RenderRubyRun.h: 2016-10-12 Simon Fraser <simon.fraser@apple.com> Crash when using megaplan.ru https://bugs.webkit.org/show_bug.cgi?id=163276 rdar://problem/28446672 Reviewed by Sam Weinig. Make sure we allocate enough space in the vector of CGPoints that we use for path building. Test: css3/masking/large-clip-path.html * platform/graphics/cg/PathCG.cpp: (WebCore::Path::polygonPathFromPoints): 2016-10-12 Alex Christensen <achristensen@webkit.org> Fix out-of-bounds reading in URLParser when parsing improperly percent-encoded values https://bugs.webkit.org/show_bug.cgi?id=163376 Reviewed by Saam Barati. Covered by new API tests, which used to crash under asan. * platform/URLParser.cpp: (WebCore::percentDecode): If you subtract 2 from size_t's smaller than 2, you're gonna have a bad time. 2016-10-12 Alex Christensen <achristensen@webkit.org> Mail needs nonspecial URLs to keep case in host and not have slash after host https://bugs.webkit.org/show_bug.cgi?id=163373 Reviewed by Saam Barati. Mail uses urls like scheme://HoSt which were not changed when canonicalized before enabling the URLParser but now are canonicalized to scheme://host/ I manually verified this fixes the issue. This should be reverted once Mail will accept modern canonicalized URLs. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: If the application is mail and the scheme is nonspecial, don't make the host lower case and don't add a slash after the host. 2016-10-11 Dean Jackson <dino@apple.com> Add preliminary support for extended colors to WebCore::Color https://bugs.webkit.org/show_bug.cgi?id=162878 <rdar://problem/28596413> Reviewed by Darin Adler. Add an ExtendedColor class that will hold the data necessary for wider-than-sRGB (and more precise) colors. In order to avoid increasing the size of Color, implement a tagged pointer that is either referencing an ExtendedColor, or is a 64-bit number with the top 32-bits being the RGBA, and the bottom 2 bits indicating an invalid RGBA or a valid RGBA, plus the tag. Add copy constructors and operator= so that the new Color objects are correctly copied. There isn't yet a way to create an ExtendedColor. That's coming in a followup patch (and will require changes to the CSS parser). Covered by existing tests, and new API tests in Color. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: Add new files. * platform/graphics/Color.cpp: Update everything to use m_rgbaAndFlags instead of m_color + m_valid. (WebCore::Color::Color): (WebCore::Color::~Color): (WebCore::Color::operator=): (WebCore::Color::nameForRenderTreeAsText): (WebCore::Color::setNamedColor): (WebCore::Color::light): (WebCore::Color::dark): (WebCore::Color::setValid): (WebCore::Color::setExtended): (WebCore::Color::isExtended): (WebCore::Color::asExtended): * platform/graphics/Color.h: Implement the tagged union. (WebCore::Color::Color): (WebCore::Color::isValid): (WebCore::Color::red): (WebCore::Color::green): (WebCore::Color::blue): (WebCore::Color::alpha): (WebCore::Color::rgb): (WebCore::Color::setRGB): (WebCore::operator==): * platform/graphics/ExtendedColor.cpp: New file. Holds floating point red, green, blue and alpha, plus a color space. (WebCore::ExtendedColor::create): (WebCore::ExtendedColor::~ExtendedColor): (WebCore::ExtendedColor::ref): (WebCore::ExtendedColor::deref): * platform/graphics/ExtendedColor.h: (WebCore::ExtendedColor::red): (WebCore::ExtendedColor::green): (WebCore::ExtendedColor::blue): (WebCore::ExtendedColor::alpha): (WebCore::ExtendedColor::colorSpace): (WebCore::ExtendedColor::ExtendedColor): * platform/graphics/cg/ColorCG.cpp: Update the constructors for the platform specific color classes. (WebCore::Color::Color): * platform/graphics/gtk/ColorGtk.cpp: (WebCore::Color::Color): * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::Color): * rendering/RenderEmbeddedObject.cpp: Use NeverDestroyed. (WebCore::replacementTextRoundedRectPressedColor): (WebCore::replacementTextRoundedRectColor): (WebCore::replacementTextColor): (WebCore::unavailablePluginBorderColor): * rendering/RenderFrameSet.cpp: Ditto. (WebCore::borderStartEdgeColor): (WebCore::borderEndEdgeColor): (WebCore::borderFillColor): * rendering/RenderTableCell.cpp: This grows in size slightly because it can no longer pack bits. 2016-10-12 Antoine Quint <graouts@apple.com> [Modern Media Controls] Sliders: scrubber and volume https://bugs.webkit.org/show_bug.cgi?id=163328 <rdar://problem/28733838> Reviewed by Dean Jackson. We add a new Slider class that provides a custom slider backed by an invisible <input type="range"> element and a fill underlay to provide a custom color between the left edge of the slider and the slider thumb. As the slider's value changes, a UI delegate receives messages to track such changes. Tests: media/modern-media-controls/scrubber/scrubber.html media/modern-media-controls/slider/slider-constructor.html media/modern-media-controls/slider/slider-fill.html media/modern-media-controls/slider/slider-styles.html media/modern-media-controls/volume-slider/volume-slider-value.html media/modern-media-controls/volume-slider/volume-slider.html * Modules/modern-media-controls/controls/scrubber.css: Added. (.scrubber.slider > input::-webkit-slider-thumb): * Modules/modern-media-controls/controls/scrubber.js: Added. (Scrubber): * Modules/modern-media-controls/controls/slider.css: Added. (.slider): (.slider > input,): (.slider > .fill): (.slider > input): (.slider > input::-webkit-slider-thumb): * Modules/modern-media-controls/controls/slider.js: Added. (Slider.prototype.get value): (Slider.prototype.set value): (Slider.prototype.get width): (Slider.prototype.set width): (Slider.prototype.handleEvent): (Slider.prototype.commitProperty): (Slider.prototype._handleInputEvent): (Slider.prototype._handleChangeEvent): (Slider.prototype._updateFill): * Modules/modern-media-controls/controls/volume-slider.css: Added. (.volume.slider > input::-webkit-slider-thumb): * Modules/modern-media-controls/controls/volume-slider.js: Added. (VolumeSlider): 2016-10-12 Wenson Hsieh <wenson_hsieh@apple.com> Add experimental support for the "formatForeColor" inputType https://bugs.webkit.org/show_bug.cgi?id=163348 <rdar://problem/28739334> Reviewed by Ryosuke Niwa. Adds support for the "formatForeColor" attribute. This patch introduces a simple hook in Editor.cpp to extract data for an input event from an EditingStyle when performing an editing action. Test: fast/events/input-events-forecolor-data.html * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): * editing/Editor.cpp: (WebCore::inputEventDataForEditingStyleAndAction): Added a new static helper to compute the data attribute of an InputEvent when handling a style change. (WebCore::Editor::computeAndSetTypingStyle): 2016-10-12 Chris Dumez <cdumez@apple.com> [Web IDL] Generated bindings include the wrong header when ImplementedAs is used on a dictionary https://bugs.webkit.org/show_bug.cgi?id=163352 Reviewed by Ryosuke Niwa. Generated bindings include the wrong header when ImplementedAs is used on a dictionary. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryHeader): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameterCaller): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<DictionaryImplName>): (WebCore::convertDictionary<TestStandaloneDictionary>): Deleted. * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: * bindings/scripts/test/TestStandaloneDictionary.idl: 2016-10-12 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT][JSC] Explore the way to embed nodeType into JSC::JSType in WebCore https://bugs.webkit.org/show_bug.cgi?id=163245 Reviewed by Filip Pizlo. Node.nodeType accessor is so frequently called. For example, jQuery's $ function uses this to distinguish DOM objects from the other JS objects. So every time you call `$(dom)`, nodeType accessor is called. In addition to that, jQuery's prev, next, parent etc. also uses this `nodeType`. And Ember.js also uses it. And ... So this function is super critical for DOM performance. The challenge is that there is no room for putting NodeType into C++ Node class. Node class has a 32bit field to store some data. However, these bits are already exhausted. Extending Node class is unacceptable since it significantly enlarges memory consumption of WebKit (Node is everywhere!). Unfortunately, current Node::nodeType is implemented as a virtual function even though this function is frequently called from JS world. Interestingly, we already store some duplicate data in JSObject, JSC::JSType. WebCore already extends it with JSElementType, JSNodeType, and JSDocumentWrapperType. And these types are corresponding to specific NodeTypes. For example, JSElementType should have ELEMENT_NODE type. This patch further extends this JSC::JSType in WebCore side safely. We embed NodeType bits into JSC::JSType. This design offers significantly faster nodeType implementation. Furthermore, it makes DOMJIT easy for nodeType accessor. Even without the IC change[1], Dromaeo dom-query shows 8 - 10% improvement, 1452.96 runs/s vs 1578.56 runs/s. We can expect that this improvement will be applied to the other benchmarks / real applications when the IC change is landed. [1]: https://bugs.webkit.org/show_bug.cgi?id=163226 * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMWrapper.h: * bindings/js/JSNodeCustom.h: (WebCore::JSNode::nodeType): * bindings/scripts/CodeGeneratorJS.pm: (GetJSTypeForNode): (GenerateHeader): * dom/Node.idl: * dom/NodeConstants.h: Copied from Source/JavaScriptCore/domjit/DOMJITGetterSetter.h. * domjit/JSNodeDOMJIT.cpp: (WebCore::createCallDOMForOffsetAccess): (WebCore::NodeFirstChildDOMJIT::callDOM): (WebCore::NodeLastChildDOMJIT::callDOM): (WebCore::NodeNextSiblingDOMJIT::callDOM): (WebCore::NodePreviousSiblingDOMJIT::callDOM): (WebCore::NodeParentNodeDOMJIT::callDOM): (WebCore::NodeNodeTypeDOMJIT::checkDOM): (WebCore::NodeNodeTypeDOMJIT::callDOM): 2016-10-12 Chris Dumez <cdumez@apple.com> Update more events to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163339 Reviewed by Ryosuke Niwa. Update more events to stop using legacy [ConstructorTemplate=Event] and use regular constructors instead. No new tests, updated existing tests. * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::convertDictionary<TestEventConstructor::Init>): (WebCore::JSTestEventConstructorConstructor::construct): (WebCore::JSTestEventConstructorConstructor::prototypeForStructure): (WebCore::JSTestEventConstructor::JSTestEventConstructor): (WebCore::JSTestEventConstructor::createPrototype): (WebCore::JSTestEventConstructorPrototype::create): Deleted. (WebCore::JSTestEventConstructorPrototype::createStructure): Deleted. (WebCore::JSTestEventConstructorPrototype::JSTestEventConstructorPrototype): Deleted. (WebCore::setJSTestEventConstructorConstructor): Deleted. (WebCore::JSTestEventConstructor::getConstructor): Deleted. * bindings/scripts/test/JS/JSTestEventConstructor.h: (WebCore::JSTestEventConstructor::wrapped): (WebCore::JSTestEventConstructor::create): Deleted. (WebCore::toJS): Deleted. (WebCore::toJSNewlyCreated): Deleted. * bindings/scripts/test/TestEventConstructor.idl: * css/CSSFontFaceLoadEvent.cpp: (WebCore::CSSFontFaceLoadEvent::CSSFontFaceLoadEvent): * css/CSSFontFaceLoadEvent.h: * css/CSSFontFaceLoadEvent.idl: * html/canvas/WebGLContextEvent.cpp: (WebCore::WebGLContextEvent::WebGLContextEvent): * html/canvas/WebGLContextEvent.h: * html/canvas/WebGLContextEvent.idl: * storage/StorageEvent.cpp: (WebCore::StorageEvent::create): (WebCore::StorageEvent::StorageEvent): * storage/StorageEvent.h: * storage/StorageEvent.idl: 2016-10-12 Andreas Kling <akling@apple.com> Make Document::existingAXObjectCache() fast with accessibility disabled. <https://webkit.org/b/163347> Reviewed by Antti Koivisto. Instruments says we were spending 2.3% of Dromaeo/dom-modify.html in this function, traversing ancestors. Track whether we've ever had a cache, and use that knowledge to return early if possible. * dom/Document.cpp: (WebCore::Document::existingAXObjectCache): (WebCore::Document::axObjectCache): 2016-10-12 Jeremy Huddleston Sequoia <jeremyhu@apple.com> [SOUP] trunk r207192 fails to compile due to missing std::function being unavailable (missing #include <functional>) https://bugs.webkit.org/show_bug.cgi?id=163340 Reviewed by Michael Catanzaro. * platform/network/soup/SoupNetworkSession.h: Add missing #include <functional> 2016-10-12 Brent Fulgham <bfulgham@apple.com> [WebGL] Revise vertex array attribute checks to account for lazy memory allocation. https://bugs.webkit.org/show_bug.cgi?id=163149 <rdar://problem/28629774> Reviewed by Dean Jackson. Tested by fast/canvas/webgl/webgl-drawarrays-crash-2.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateVertexAttributes): 2016-10-12 Wenson Hsieh <wenson_hsieh@apple.com> Now playing media sessions are always cleared for the active foreground tab https://bugs.webkit.org/show_bug.cgi?id=163310 <rdar://problem/28573301> Reviewed by Jer Noble. Currently, we clear out Now Playing info whenever we set the visibility of Now Playing controls to Never. This is incorrect, as the Now Playing session needs to still be active (just not visible) in this state. Instead, we should not be taking the active/foregrounded-ness of a media session for Now Playing into account in MediaElementSession::canShowControlsManager so that even if a media session is in the active/foreground tab, we will update the Now Playing session with the latest info. However, when setting the visibility, we now check and see if the session allows Now Playing visibility, and set the Now Playing visibility to Always or Never depending on the answer. Tweaked existing unit tests in NowPlayingControlsTests. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager): (WebCore::MediaElementSession::allowsNowPlayingControlsVisibility): (WebCore::MediaElementSession::pageAllowsNowPlayingControls): Deleted. * html/MediaElementSession.h: * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::allowsNowPlayingControlsVisibility): * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): 2016-10-12 Zalan Bujtas <zalan@apple.com> Refactor LineLayoutState's float box handling. https://bugs.webkit.org/show_bug.cgi?id=163286 Reviewed by David Hyatt. We keep track of float boxes both per line (RootInlineBox::m_floats) and per flow block (LineLayoutState::m_floats) during layout. As we lay out the lines and iterate through RootInlineBox::m_floats, we increment LineLayoutState::m_floatIndex. This LineLayoutState::m_floatIndex is later used to find the matching float box in the per-block-flow float list. This logic works fine as long as the lists and the index manipulation are tightly coded. However due to the complexity of the line/float layout code, this is no longer the case. This patch makes float box handling more secure by changing this index based setup to a list iterator. It helps to eliminate potential vector overflow issues. LineLayoutState::FloatList (new class) keeps track of all the floats for the block flow. It groups the float box related functions/members and provides an iterator interface to ensure safer syncing between this and the line based floats. No change in functionality. * rendering/RenderBlockFlow.h: * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::appendFloatingObjectToLastLine): (WebCore::repaintDirtyFloats): (WebCore::RenderBlockFlow::layoutRunsAndFloats): (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): (WebCore::RenderBlockFlow::linkToEndLineIfNeeded): (WebCore::RenderBlockFlow::layoutLineBoxes): (WebCore::RenderBlockFlow::checkFloatInCleanLine): (WebCore::RenderBlockFlow::determineStartPosition): (WebCore::RenderBlockFlow::determineEndPosition): (WebCore::RenderBlockFlow::repaintDirtyFloats): Deleted. (WebCore::RenderBlockFlow::checkFloatsInCleanLine): Deleted. * rendering/line/LineLayoutState.h: (WebCore::FloatWithRect::create): (WebCore::FloatWithRect::renderer): (WebCore::FloatWithRect::rect): (WebCore::FloatWithRect::everHadLayout): (WebCore::FloatWithRect::adjustRect): (WebCore::FloatWithRect::FloatWithRect): (WebCore::LineLayoutState::FloatList::append): (WebCore::LineLayoutState::FloatList::setLastFloat): (WebCore::LineLayoutState::FloatList::lastFloat): (WebCore::LineLayoutState::FloatList::setLastCleanFloat): (WebCore::LineLayoutState::FloatList::lastCleanFloat): (WebCore::LineLayoutState::FloatList::floatWithRect): (WebCore::LineLayoutState::FloatList::begin): (WebCore::LineLayoutState::FloatList::end): (WebCore::LineLayoutState::FloatList::find): (WebCore::LineLayoutState::FloatList::isEmpty): (WebCore::LineLayoutState::LineLayoutState): (WebCore::LineLayoutState::floatList): (WebCore::LineLayoutState::lastFloat): Deleted. (WebCore::LineLayoutState::setLastFloat): Deleted. (WebCore::LineLayoutState::floats): Deleted. (WebCore::LineLayoutState::floatIndex): Deleted. (WebCore::LineLayoutState::setFloatIndex): Deleted. 2016-10-12 Said Abou-Hallawa <sabouhallawa@apple.com> Unreviewed, fix Windows build break after r207182. * platform/graphics/cg/ImageDecoderCG.cpp: 2016-10-12 Chris Dumez <cdumez@apple.com> Update remaining DOM events to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163319 Reviewed by Darin Adler. Update remaining DOM events to stop using legacy [ConstructorTemplate=Event] and use regular constructors instead. No new tests, updated existing tests. * dom/AutocompleteErrorEvent.h: * dom/AutocompleteErrorEvent.idl: * dom/BeforeLoadEvent.h: * dom/BeforeLoadEvent.idl: * dom/CompositionEvent.cpp: (WebCore::CompositionEvent::CompositionEvent): * dom/CompositionEvent.h: * dom/CompositionEvent.idl: * dom/ErrorEvent.cpp: (WebCore::ErrorEvent::ErrorEvent): * dom/ErrorEvent.h: * dom/ErrorEvent.idl: * dom/FocusEvent.cpp: (WebCore::FocusEvent::FocusEvent): * dom/FocusEvent.h: * dom/FocusEvent.idl: * dom/HashChangeEvent.h: * dom/HashChangeEvent.idl: * dom/OverflowEvent.cpp: (WebCore::OverflowEvent::OverflowEvent): * dom/OverflowEvent.h: * dom/OverflowEvent.idl: * dom/PageTransitionEvent.cpp: (WebCore::PageTransitionEvent::PageTransitionEvent): * dom/PageTransitionEvent.h: * dom/PageTransitionEvent.idl: * dom/PopStateEvent.cpp: (WebCore::PopStateEvent::PopStateEvent): (WebCore::PopStateEvent::create): * dom/PopStateEvent.h: * dom/PopStateEvent.idl: * dom/SecurityPolicyViolationEvent.h: * dom/SecurityPolicyViolationEvent.idl: * dom/TouchEvent.cpp: (WebCore::TouchEvent::TouchEvent): * dom/TouchEvent.h: * dom/TouchEvent.idl: * dom/TransitionEvent.cpp: (WebCore::TransitionEvent::TransitionEvent): * dom/TransitionEvent.h: * dom/TransitionEvent.idl: * dom/WebKitAnimationEvent.cpp: (WebCore::WebKitAnimationEvent::WebKitAnimationEvent): * dom/WebKitAnimationEvent.h: * dom/WebKitAnimationEvent.idl: * dom/WebKitTransitionEvent.cpp: (WebCore::WebKitTransitionEvent::WebKitTransitionEvent): * dom/WebKitTransitionEvent.h: * dom/WebKitTransitionEvent.idl: 2016-10-12 Chris Dumez <cdumez@apple.com> Stop using PassRefPtr in platform/efl https://bugs.webkit.org/show_bug.cgi?id=163321 Reviewed by Laszlo Gombos. Stop using PassRefPtr in platform/efl. * platform/efl/BatteryProviderEfl.cpp: (WebCore::batteryProperties): (WebCore::BatteryProviderEfl::setBatteryStatus): (WebCore::BatteryProviderEfl::dispatchEvent): * platform/efl/BatteryProviderEfl.h: * platform/efl/BatteryProviderEflClient.h: * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp: (WebCore::PlatformSpeechSynthesisProviderEfl::voiceName): (WebCore::PlatformSpeechSynthesisProviderEfl::speak): * platform/efl/PlatformSpeechSynthesisProviderEfl.h: 2016-10-12 Youenn Fablet <youenn@apple.com> Attribute setter binding generated code should use more references https://bugs.webkit.org/show_bug.cgi?id=163275 Reviewed by Alex Christensen. No change of behavior. * bindings/scripts/CodeGeneratorJS.pm: (JSValueToNative): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: 2016-10-11 Youenn Fablet <youenn@apple.com> Refactor binding generated casted-this checks for methods https://bugs.webkit.org/show_bug.cgi?id=163198 Reviewed by Darin Adler. Covered by existing tests and binding rebased tests.. Introducing BindingCaller::callMethod and callPromiseMethod to encapsulate casted-this checks for methods. This is supported for all methods except seralizer and iterators methods. Introduced castForMethod similarly to castForAttribute. Moved this from static methods of JSClass to static methods of BindingCaller<JSClass> This allows removing the corresponding declarations from JSClass header file. Note the difference of handling thisValue between the two in case of CustomProxyToJSObject. This should be made more consistent. In case of bad casted this check, CustomProxyToJSObject objects will throw a TypeError with an error message like other methods. Before the patch, a TypeError without error message was thrown. EventTarget being different, added a specialization of BindingCaller for it. This allows also removing some binding generated code dedicated to EventTarget. A similar approach might also be done for CustomProxyToJSObject objects to further simplify the binding generator. * bindings/js/JSDOMBinding.cpp: (WebCore::rejectPromiseWithThisTypeError): * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::callPromiseMethod): (WebCore::BindingCaller::callMethod): * bindings/js/JSEventTargetCustom.h: (WebCore::BindingCaller<JSEventTarget>::callMethod): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): (GenerateFunctionCastedThis): Deleted. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterface.h: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.h: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNode.h: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSTestTypedefs.h: 2016-10-11 Youenn Fablet <youenn@apple.com> MediaResourceLoader::requestResource should take a ResourceRequest&& as input https://bugs.webkit.org/show_bug.cgi?id=160397 Reviewed by Alex Christensen. No change in behavior. * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): Passing a ResourceRequest&& as input parameter. * loader/MediaResourceLoader.h: * platform/graphics/PlatformMediaResourceLoader.h: Ditto. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcStart): Creating an extra copy since MediaResourceLoader::requestResource expects a Resourcerequest&&. 2016-10-11 Chris Dumez <cdumez@apple.com> Update AnimationEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163312 Reviewed by Ryosuke Niwa. Update AnimationEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor as in the specification: - https://drafts.csswg.org/css-animations/#interface-animationevent * dom/AnimationEvent.cpp: (WebCore::AnimationEvent::AnimationEvent): * dom/AnimationEvent.h: * dom/AnimationEvent.idl: 2016-10-11 Chris Dumez <cdumez@apple.com> Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163311 Reviewed by Ryosuke Niwa. Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor instead, as in the specification: - https://www.w3.org/TR/2015/WD-proximity-20150903/#deviceproximityevent-interface * Modules/proximity/DeviceProximityEvent.cpp: (WebCore::DeviceProximityEvent::DeviceProximityEvent): * Modules/proximity/DeviceProximityEvent.h: (WebCore::DeviceProximityEvent::create): (WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted. * Modules/proximity/DeviceProximityEvent.idl: 2016-10-11 Gyuyoung Kim <gyuyoung.kim@webkit.org> Unreviewed, EFL build fix because of r207173. * testing/InternalSettings.cpp: (WebCore::InternalSettings::forcedPrefersReducedMotionValue): 2016-10-11 Said Abou-Hallawa <sabouhallawa@apple.com> [CG] Add the option to immediately decode an image frame and control its memory caching https://bugs.webkit.org/show_bug.cgi?id=163298 Reviewed by Simon Fraser. This patch fixes two things. (1) An option is added to immediately decode an image frame. This can be done by adding kCGImageSourceShouldCacheImmediately to the ImageSource options dictionary. (2) BitmapImage should also control when the image frame is actually deleted from memory. This can be done by calling CGImageSourceCreateThumbnailAtIndex(). CG does not keep a reference to the returned CGImageRef. * platform/graphics/ImageFrame.h: Adding the DecodingMode enum class. Ideally this should be a member of ImageDecoder class. But since we have three header files for ImageDecoder, this can be added here till the three files combined in one header file. * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::setRenderTarget): Deleted. * platform/graphics/ImageFrameCache.h: * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::setRenderTarget): * platform/graphics/ImageSource.h: (WebCore::ImageSource::setRenderTarget): Deleted. Unrelated change. The native image decoder is available from the ImageSource. ImageSource::setTarget() does not need not to get it through ImageFrameCache. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::createImageSourceOptions): Clean this function by using CFMutableDictionary. (WebCore::imageSourceOptions): Cache two default ImageSource options and create new ones for the non default cases. (WebCore::ImageDecoder::createFrameImageAtIndex): Use the appropriate ImageSource function * platform/graphics/cg/ImageDecoderCG.h: * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::createFrameImageAtIndex): * platform/graphics/win/ImageDecoderDirect2D.h: * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::createFrameImageAtIndex): * platform/image-decoders/ImageDecoder.h: Change functions' signature to include a DecodingMode argument. 2016-10-11 Chris Dumez <cdumez@apple.com> select.options may return too many option elements https://bugs.webkit.org/show_bug.cgi?id=163296 Reviewed by Ryosuke Niwa. select.options may return too many option elements. We're only supposed to return the option element children of the select element, and the option element children of all the optgroup element children of the select element, in tree order: - https://html.spec.whatwg.org/#dom-select-options - https://html.spec.whatwg.org/#concept-select-option-list Firefox and Chrome agrees with the specification. However, WebKit was returning all the option elements that are descendants of the select element. Test: imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html * html/HTMLOptionsCollection.h: 2016-10-11 Alex Christensen <achristensen@webkit.org> Fix assertion when creating first WebCore::URL from non-main thread after r207162 https://bugs.webkit.org/show_bug.cgi?id=163304 Reviewed by Filip Pizlo. This fixes assertions when running UserContentWorld.NormalWorld API tests. * platform/text/TextEncodingRegistry.cpp: (WebCore::buildBaseTextCodecMaps): (WebCore::atomicCanonicalTextEncodingName): The new URLParser requires a TextEncoding& in its constructor, which defaults to UTF8Encoding. When creating the first TextEncoding in a process, it calls buildBaseTextCodecMaps which asserts it's on the main thread because it initializes static variables. Since we are getting a lock right after this call anyway, just put this function call inside the lock. 2016-10-11 Dean Jackson <dino@apple.com> color-gamut media query shouldn't ASSERT on invalid values https://bugs.webkit.org/show_bug.cgi?id=163303 <rdar://problem/28724566> Reviewed by Simon Fraser. Remove the ASSERT_NOT_REACHED in the evaluation, since it can be hit when there is a valid CSS keyword that is not expected in the query. Updated fast/media/mq-color-gamut.html * css/MediaQueryEvaluator.cpp: (WebCore::colorGamutEvaluate): 2016-10-11 Chris Dumez <cdumez@apple.com> Update MediaStream events to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163289 Reviewed by Sam Weinig. Update MediaStream events to stop using legacy [ConstructorTemplate=Event] and use regular constructors instead. * Modules/mediastream/MediaStreamEvent.cpp: (WebCore::MediaStreamEvent::create): (WebCore::MediaStreamEvent::MediaStreamEvent): * Modules/mediastream/MediaStreamEvent.h: * Modules/mediastream/MediaStreamEvent.idl: * Modules/mediastream/MediaStreamTrackEvent.cpp: (WebCore::MediaStreamTrackEvent::create): (WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent): * Modules/mediastream/MediaStreamTrackEvent.h: * Modules/mediastream/MediaStreamTrackEvent.idl: * Modules/mediastream/OverconstrainedErrorEvent.h: (WebCore::OverconstrainedErrorEvent::create): (WebCore::OverconstrainedErrorEvent::OverconstrainedErrorEvent): (WebCore::OverconstrainedErrorEvent::~OverconstrainedErrorEvent): Deleted. * Modules/mediastream/OverconstrainedErrorEvent.idl: * Modules/mediastream/RTCDTMFToneChangeEvent.cpp: (WebCore::RTCDTMFToneChangeEvent::create): (WebCore::RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent): * Modules/mediastream/RTCDTMFToneChangeEvent.h: * Modules/mediastream/RTCDTMFToneChangeEvent.idl: * Modules/mediastream/RTCTrackEvent.cpp: (WebCore::RTCTrackEvent::create): (WebCore::RTCTrackEvent::RTCTrackEvent): * Modules/mediastream/RTCTrackEvent.h: * Modules/mediastream/RTCTrackEvent.idl: 2016-10-11 Chris Dumez <cdumez@apple.com> Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163288 Reviewed by Darin Adler. Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event] and use a constructor as in the specification: - https://dvcs.w3.org/hg/IndieUI/raw-file/default/src/indie-ui-events.html#UIRequestEvent * Modules/indieui/UIRequestEvent.cpp: (WebCore::UIRequestEvent::create): (WebCore::UIRequestEvent::UIRequestEvent): (WebCore::UIRequestEvent::createForBindings): Deleted. * Modules/indieui/UIRequestEvent.h: * Modules/indieui/UIRequestEvent.idl: 2016-10-11 Dean Jackson <dino@apple.com> Implement prefers-reduced-motion media query https://bugs.webkit.org/show_bug.cgi?id=163250 <rdar://problem/28704129> Reviewed by Simon Fraser. Implement the prefers-reduced-motion media query, as described in https://github.com/w3c/csswg-drafts/issues/442. Tests: fast/media/mq-prefers-reduced-motion-forced-value.html fast/media/mq-prefers-reduced-motion.html * Configurations/WebCoreTestSupport.xcconfig: Link against AppKit and UIKit. * css/CSSValueKeywords.in: New keyword for "reduce". * css/MediaFeatureNames.h: Add prefers-reduced-motion. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): * css/MediaQueryExp.cpp: (WebCore::featureWithValidIdent): (WebCore::isFeatureValidWithoutValue): * platform/Theme.h: New API to detect the system accessibility settings. (WebCore::Theme::userPrefersReducedMotion): * platform/ios/ThemeIOS.h: * platform/ios/ThemeIOS.mm: (WebCore::ThemeIOS::userPrefersReducedMotion): * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::userPrefersReducedMotion): * testing/Internals.cpp: Expose the same API to internals, so that a test can examine the value too. (WebCore::Internals::userPrefersReducedMotion): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion): * page/Settings.h: New setting to override the system value... * page/Settings.in: * testing/InternalSettings.cpp: ... plumbed through internals. (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::forcedPrefersReducedMotionValue): (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): * testing/InternalSettings.h: * testing/InternalSettings.idl: * testing/Internals.cpp: (WebCore::Internals::userPrefersReducedMotion): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion): 2016-10-10 Ryosuke Niwa <rniwa@webkit.org> Annotate DOM API with CEReactions https://bugs.webkit.org/show_bug.cgi?id=163268 Reviewed by Darin Adler. Added CEReactions IDL attribute to APIs defined in https://dom.spec.whatwg.org. No new tests since existing tests cover the code change. Added a dedicated code generation test: JSTestCEReactions.idl and TestCEReactionsStringifier.idl. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Generate CustomElementReactionStack in attribute setters. In the case of PutForwards, check the extended attributes of the target attribute's stringifier. * bindings/scripts/test/JS/JSTestCEReactions.cpp: Added. * bindings/scripts/test/JS/JSTestCEReactions.h: Added. * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: Added. * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: Added. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack): Deleted. * bindings/scripts/test/TestCEReactions.idl: Added. * bindings/scripts/test/TestCEReactionsStringifier.idl: Added. * bindings/scripts/test/TestObj.idl: * dom/Attr.idl: * dom/ChildNode.idl: * dom/Document.idl: * dom/Element.idl: * dom/NamedNodeMap.idl: * dom/Node.idl: * dom/ParentNode.idl: * dom/Range.idl: * html/DOMTokenList.idl: 2016-10-11 Chris Dumez <cdumez@apple.com> Update CloseEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163293 Reviewed by Darin Adler. Update CloseEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor as in the specification: - https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces No new tests, updated existing test. * Modules/websockets/CloseEvent.h: (WebCore::CloseEvent::create): (WebCore::CloseEvent::CloseEvent): * Modules/websockets/CloseEvent.idl: 2016-10-11 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] DOMJIT::Patchpoint should have a way to receive constant folded arguments https://bugs.webkit.org/show_bug.cgi?id=163224 Reviewed by Filip Pizlo. * domjit/DOMJITHelpers.h: (WebCore::DOMJITHelpers::toWrapper): * domjit/JSNodeDOMJIT.cpp: (WebCore::createCallDOMForOffsetAccess): 2016-10-11 Alex Christensen <achristensen@webkit.org> Enable URLParser by default https://bugs.webkit.org/show_bug.cgi?id=162660 <rdar://28601706> Reviewed by Sam Weinig. Covered by updates to many LayoutTests. * platform/URLParser.cpp: Make the default value true for URLParser::enabled. This is the most impactful and well-documented one-line change I've ever written. 2016-10-11 Daniel Bates <dabates@apple.com> [iOS] REGRESSION (r197953): User gesture required to load video in iOS 9-built apps https://bugs.webkit.org/show_bug.cgi?id=163244 <rdar://problem/27250015> Reviewed by Jer Noble. Adds a new setting to toggle requiring a user gesture to load a video (enabled by default). Disable this setting for apps built against iOS 9 or earlier. Tests: media/loadedmetadata-fires-without-user-gesture-when-setRequiresUserGestureToLoadVideo-false.html media/require-user-gesture-to-load-video.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): Only require a user gesture to load a video when Settings::requiresUserGestureToLoadVideo() is true. * page/Settings.cpp: Enable setting requiresUserGestureToLoadVideo by default. * page/Settings.in: Add setting, requiresUserGestureToLoadVideo. 2016-10-11 Sam Weinig <sam@webkit.org> Fix the iOS build. * bindings/js/JSDOMConvert.h: 2016-10-11 Daniel Bates <dabates@apple.com> [iOS] Sandbox QuickLook previews https://bugs.webkit.org/show_bug.cgi?id=163240 <rdar://problem/25961633> Fix bad merge following r207151. * platform/network/cf/ResourceResponse.h: Define m_isQuickLook. 2016-10-11 Daniel Bates <dabates@apple.com> [iOS] Sandbox QuickLook previews https://bugs.webkit.org/show_bug.cgi?id=163240 <rdar://problem/25961633> Reviewed by Brent Fulgham. Use a unique origin for- and limit the capabilities of- QuickLook previews. Tests: http/tests/quicklook/at-import-stylesheet-blocked.html http/tests/quicklook/base-url-blocked.html http/tests/quicklook/cross-origin-iframe-blocked.html http/tests/quicklook/csp-header-ignored.html http/tests/quicklook/document-domain-is-empty-string.html http/tests/quicklook/external-stylesheet-blocked.html http/tests/quicklook/hide-referer-on-navigation.html http/tests/quicklook/submit-form-blocked.html http/tests/quicklook/top-navigation-blocked.html * dom/Document.cpp: (WebCore::Document::processHttpEquiv): Call ContentSecurityPolicy::didReceiveHeader(). (WebCore::Document::processReferrerPolicy): Do not process referrer policy for QuickLook previews. (WebCore::Document::initSecurityContext): Apply sandbox for QuickLook previews. (WebCore::Document::shouldEnforceQuickLookSandbox): Added. (WebCore::Document::applyQuickLookSandbox): Added. * dom/Document.h: * page/csp/ContentSecurityPolicy.h: Change accessibility of didReceiveHeader() from private to public. (WebCore::ContentSecurityPolicy::processHTTPEquiv): Deleted. * platform/network/cf/ResourceResponse.h: (WebCore::ResourceResponse::isQuickLook): Added. (WebCore::ResourceResponse::setIsQuickLook): Added. * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Modified to mark resource response as a QuickLook preview, if appropriate. Also remove the name of the first argument and the need to use UNUSED_PARAM(connection) as we no longer make use of the first argument following r207151. * platform/network/ios/QuickLook.mm: (-[WebResourceLoaderQuickLookDelegate _sendDidReceiveResponseIfNecessary]): Ditto. * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto. Fix style nits, including renaming the function argument "r" to "resource" to better describe its purpose. 2016-10-11 Alex Christensen <achristensen@webkit.org> Fix bindings tests after r207150. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): 2016-10-11 Alex Christensen <achristensen@webkit.org> URLParser should percent-encode non-ASCII and non-printable characters in fragment https://bugs.webkit.org/show_bug.cgi?id=163287 Reviewed by Brady Eidson. Based on discussion in https://github.com/whatwg/url/issues/150 If that discussion decides to keep the spec as-is (which keeps non-ASCII characters in the fragment to match IE and Edge's behavior, which Chrome has followed for special schemes) then we can revert this change later after enabling the URL parser. Making this change keeps behavior matching Safari and Firefox, as well as Chrome's handling of non-special schemes, such as data URLs. Covered by updated API tests. * platform/URLParser.cpp: (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::currentPosition): (WebCore::URLParser::parse): (WebCore::URLParser::fragmentSyntaxViolation): Deleted. * platform/URLParser.h: No more non-ASCII characters in canonicalized URLs. 2016-10-11 Alex Christensen <achristensen@webkit.org> Remove dead networking code https://bugs.webkit.org/show_bug.cgi?id=163263 Reviewed by Daniel Bates. There are no more Cocoa platforms using CFURLConnection. USE(CFNETWORK) is being replaced by USE(CFURLCONNECTION) and it is only used on the AppleWin port. No change in behavior. * WebCore.xcodeproj/project.pbxproj: * WebCorePrefix.h: * loader/DocumentLoader.h: * loader/EmptyClients.h: * loader/FrameLoaderClient.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveAuthenticationChallenge): * loader/ResourceLoader.h: * loader/SubresourceLoader.h: * loader/cf/ResourceLoaderCFNet.cpp: * loader/cocoa/SubresourceLoaderCocoa.mm: (WebCore::SubresourceLoader::willCacheResponse): Deleted. * loader/mac/DocumentLoaderMac.cpp: * loader/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::willCacheResponse): Deleted. * page/mac/PageMac.mm: (WebCore::Page::platformInitialize): (WebCore::Page::addSchedulePair): (WebCore::Page::removeSchedulePair): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge): (WebCore::WebCoreNSURLAuthenticationChallengeClient::create): Deleted. (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): Deleted. * platform/mac/WebCoreSystemInterface.h: * platform/network/NetworkStorageSession.h: * platform/network/ProtectionSpace.h: * platform/network/ProtectionSpaceBase.cpp: * platform/network/ResourceHandle.cpp: * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.cpp: * platform/network/ResourceHandleClient.h: (WebCore::ResourceHandleClient::willCacheResponse): (WebCore::ResourceHandleClient::shouldCacheResponse): * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/ResourceRequestBase.cpp: * platform/network/cf/AuthenticationCF.cpp: (WebCore::AuthenticationChallenge::AuthenticationChallenge): (WebCore::createCF): (WebCore::core): * platform/network/cf/AuthenticationCF.h: * platform/network/cf/AuthenticationChallenge.h: * platform/network/cf/CookieJarCFNet.cpp: * platform/network/cf/CredentialStorageCFNet.cpp: (WebCore::CredentialStorage::getFromPersistentStorage): (WebCore::CredentialStorage::saveToPersistentStorage): Deleted. * platform/network/cf/LoaderRunLoopCF.cpp: * platform/network/cf/LoaderRunLoopCF.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::cookieStorage): * platform/network/cf/ProtectionSpaceCFNet.cpp: * platform/network/cf/ProtectionSpaceCFNet.h: * platform/network/cf/ResourceError.h: * platform/network/cf/ResourceErrorCF.cpp: * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::shouldSniffConnectionProperty): (WebCore::ResourceHandle::createCFURLConnection): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::schedule): Deleted. (WebCore::ResourceHandle::unschedule): Deleted. * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp: * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: * platform/network/cf/ResourceRequest.h: (WebCore::ResourceRequest::encodingRequiresPlatformData): * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction): (WebCore::ResourceRequest::doUpdatePlatformRequest): (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): (WebCore::ResourceRequest::doUpdateResourceRequest): (WebCore::ResourceRequest::setStorageSession): (WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction): Deleted. * platform/network/cf/ResourceRequestCFNet.h: * platform/network/cf/ResourceResponse.h: (WebCore::ResourceResponse::ResourceResponse): * platform/network/cf/ResourceResponseCFNet.cpp: (WebCore::ResourceResponse::cfURLResponse): (WebCore::ResourceResponse::platformCertificateInfo): * platform/network/cf/SynchronousLoaderClientCFNet.cpp: * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling): (WebCore::adjustMIMETypeIfNecessary): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse): (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace): * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: * platform/network/cocoa/CredentialCocoa.h: * platform/network/cocoa/CredentialCocoa.mm: (WebCore::Credential::Credential): Deleted. (WebCore::Credential::cfCredential): Deleted. * platform/network/cocoa/ProtectionSpaceCocoa.h: * platform/network/cocoa/ProtectionSpaceCocoa.mm: (WebCore::ProtectionSpace::ProtectionSpace): Deleted. (WebCore::ProtectionSpace::cfSpace): Deleted. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::nsURLRequest): * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::ResourceResponse::platformCertificateInfo): (WebCore::ResourceResponse::nsURLResponse): Deleted. (WebCore::ResourceResponse::ResourceResponse): Deleted. * platform/network/ios/QuickLook.h: * platform/network/ios/QuickLook.mm: (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted. (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted. (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted. (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted. (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted. (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted. (WebCore::QuickLookHandle::create): Deleted. (WebCore::QuickLookHandle::cfResponse): Deleted. * platform/network/ios/ResourceHandleIOS.mm: Removed. * platform/network/ios/ResourceRequestIOS.mm: Removed. * platform/network/mac/AuthenticationMac.mm: (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Deleted. (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): Deleted. (WebCore::core): Deleted. (WebCore::mac): Deleted. * platform/network/mac/CookieJarMac.mm: (WebCore::setCookiesFromDOM): (WebCore::cookieStorage): (WebCore::addCookie): * platform/network/mac/CredentialStorageMac.mm: * platform/network/mac/FormDataStreamMac.h: * platform/network/mac/FormDataStreamMac.mm: * platform/network/mac/ResourceErrorMac.mm: (NSErrorFromCFError): Deleted. (WebCore::ResourceError::ResourceError): Deleted. (WebCore::ResourceError::nsError): Deleted. (WebCore::ResourceError::operator NSError *): Deleted. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::continueWillCacheResponse): (WebCore::ResourceHandle::getConnectionTimingData): Deleted. * platform/network/mac/ResourceRequestMac.mm: Removed. * platform/network/mac/SynchronousLoaderClient.mm: (WebCore::SynchronousLoaderClient::platformBadResponseError): * platform/network/mac/WebCoreResourceHandleAsDelegate.h: * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: * platform/network/mac/WebCoreURLResponse.mm: (WebCore::synthesizeRedirectResponseIfNecessary): * platform/win/TemporaryLinkStubs.cpp: * testing/js/WebCoreTestSupportPrefix.h: 2016-10-10 Sam Weinig <sam@webkit.org> Use IDLTypes in more places https://bugs.webkit.org/show_bug.cgi?id=163247 Reviewed by Darin Adler. Switch JS -> Native type conversions to use convert<IDLType>(...) rather than convert<NativeType>(...). This allows us to differentiate things like conversion from JSValue to DOMString vs. JSValue to USVString which have different rules. * bindings/generic/IDLTypes.h: Add predicate for integer types. * bindings/js/IDBBindingUtilities.cpp: (WebCore::idbKeyPathFromValue): * bindings/js/JSApplePaySessionCustom.cpp: (WebCore::JSApplePaySession::completeShippingMethodSelection): (WebCore::JSApplePaySession::completeShippingContactSelection): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::createAesKeyGenParams): (WebCore::createRsaKeyGenParams): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::getCSSCanvasContext): * bindings/js/JSMockContentFilterSettingsCustom.cpp: (WebCore::JSMockContentFilterSettings::setDecisionPoint): (WebCore::toDecision): * bindings/js/JSNodeFilterCustom.cpp: (WebCore::JSNodeFilter::acceptNode): Switch to new convert<IDLType> style. * bindings/js/JSDOMBinding.h: (WebCore::toRefPtrNativeArray): Deleted. (WebCore::toNativeArray): Deleted. These can now be called as convert<IDLSequence<IDLInterface<T>>> and convert<IDLType> respectively. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLNullable<T>>::convert): (WebCore::Converter<IDLBoolean>::convert): (WebCore::Converter<IDLInterface<T>>::convert): (WebCore::Converter<IDLByte>::convert): (WebCore::Converter<IDLOctet>::convert): (WebCore::Converter<IDLShort>::convert): (WebCore::Converter<IDLUnsignedShort>::convert): (WebCore::Converter<IDLLong>::convert): (WebCore::Converter<IDLUnsignedLong>::convert): (WebCore::Converter<IDLLongLong>::convert): (WebCore::Converter<IDLUnsignedLongLong>::convert): (WebCore::Converter<IDLFloat>::convert): (WebCore::Converter<IDLUnrestrictedFloat>::convert): (WebCore::Converter<IDLDouble>::convert): (WebCore::Converter<IDLUnrestrictedDouble>::convert): (WebCore::Converter<IDLDOMString>::convert): (WebCore::Converter<IDLUSVString>::convert): (WebCore::Detail::ArrayConverter::convert): (WebCore::Converter<IDLSequence<T>>::convert): (WebCore::Converter<IDLFrozenArray<T>>::convert): (WebCore::Converter<IDLDictionary<T>>::convert): (WebCore::Converter<IDLEnumeration<T>>::convert): (WebCore::Detail::VariadicConverterBase::convert): (WebCore::Detail::VariadicConverterBase<IDLInterface<T>>::convert): (WebCore::convertVariadicArguments): (WebCore::convertWrapperType): Deleted. (WebCore::convertWrapperTypeSequence): Deleted. (WebCore::Converter<bool>::convert): Deleted. (WebCore::Converter<String>::convert): Deleted. (WebCore::Converter<Vector<T>>::convert): Deleted. (WebCore::Converter<int8_t>::convert): Deleted. (WebCore::Converter<uint8_t>::convert): Deleted. (WebCore::Converter<int16_t>::convert): Deleted. (WebCore::Converter<uint16_t>::convert): Deleted. (WebCore::Converter<int32_t>::convert): Deleted. (WebCore::Converter<uint32_t>::convert): Deleted. (WebCore::Converter<int64_t>::convert): Deleted. (WebCore::Converter<uint64_t>::convert): Deleted. Switch Converter to be specialized on IDLTypes. Add support for IDLNullable, IDLSequence, and IDLFrozenArray. * bindings/scripts/CodeGenerator.pm: (GetFlattenedMemberTypes): Deleted. (GetNumberOfNullableMemberTypes): Deleted. (GetIDLUnionMemberTypes): Deleted. (GetBaseIDLType): Deleted. (GetIDLType): Deleted. Move IDLType conversion logic to CodeGeneratorJS so it can use GetEnumerationClassName and GetDictionaryClassName. * bindings/scripts/CodeGeneratorJS.pm: (AddToImplIncludesForIDLType): Add support for sequences, FrozenArrays and external dictionaries. (GenerateEnumerationsImplementationContent): (GenerateEnumerationsHeaderContent): Change the name of parse<enum> and convert<enum> to parseEnumeration<enum> and convertEnumeration<enum> to make them more consistent with dictionary conversion specialization and not interfere with the convert function specialization. (GenerateDictionaryImplementationContent): Simplify by using convert<IDLType>. (GetFlattenedMemberTypes): (GetNumberOfNullableMemberTypes): (GetIDLUnionMemberTypes): (GetBaseIDLType): (GetIDLType): Moved from CodeGenerator.pm (IsHandledByDOMConvert): (JSValueToNative): Start switching JSValueToNative over to using convert<IDLType>. Use IsHandledByDOMConvert as a predicate for what is supported. * bindings/scripts/IDLParser.pm: (applyTypedefs): (cloneType): (applyTypedefsForSignature): (parseTypedef): (parseOperationOrIterator): (parseSpecialOperation): Make typedefs work with aggregate types (unions, sequences and FrozenArrays). * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: Update test results. * bindings/scripts/test/TestTypedefs.idl: Add additional tests for typedefs that use unions and sequences. * testing/InternalSettings.idl: Change the name of a parameter to avoid a name collision. 2016-10-11 Konstantin Tokarev <annulen@yandex.ru> Fixed compilation with !ENABLE(SVG_FONTS) https://bugs.webkit.org/show_bug.cgi?id=163281 Reviewed by Csaba Osztrogonác. No new tests needed. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): 2016-10-11 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r207140. * PlatformAppleWin.cmake: Add missing compile file. 2016-10-10 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Add initial Pattern handling implementation https://bugs.webkit.org/show_bug.cgi?id=163270 Reviewed by Simon Fraser. Provide an implemenation of Patterns for Direct2D. No new tests. Covered by fast/borders/border-image-01.html and others. * platform/graphics/GraphicsContext.h: * platform/graphics/Pattern.h: Add D2D definitions. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::solidStrokeBrush): Use a more generic return type. (WebCore::GraphicsContext::solidFillBrush): Ditto. (WebCore::GraphicsContext::patternStrokeBrush): Added. (WebCore::GraphicsContext::patternFillBrush): Added. (WebCore::GraphicsContext::drawPattern): Provide D2D implementation. (WebCore::GraphicsContext::applyStrokePattern): Ditto. (WebCore::GraphicsContext::applyFillPattern): Ditto. (WebCore::GraphicsContext::drawPath): Use stroke pattern if available. (WebCore::GraphicsContext::fillPath): Use fill pattern if available. (WebCore::GraphicsContext::strokePath): Use stroke pattern if available. (WebCore::GraphicsContext::fillRect): Use fill pattern if available. * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: * platform/graphics/win/PatternDirect2D.cpp: Added. 2016-10-11 Per Arne Vollan <pvollan@apple.com> [Win] Compile fix. https://bugs.webkit.org/show_bug.cgi?id=163272 Reviewed by Brent Fulgham. When compiling with older SDKs, some CoreText symbols are redefined. This patch checks if the relevant CoreText header file has been included before defining the symbol. * platform/spi/win/CoreTextSPIWin.h: 2016-10-11 Antoine Quint <graouts@apple.com> [Modern Media Controls] Buttons container https://bugs.webkit.org/show_bug.cgi?id=163238 <rdar://problem/28701864> Reviewed by Dean Jackson. We add a new ButtonsContainer class which contains a group of Button objects and positions them based on the provided padding and margin between buttons. Buttons that aren't enabled or marked as dropped are not added to the tree of LayoutNodes, and thus the DOM. Additionally, we fix a few issues we found while working on tests for ButtonsContainer where LayoutNodes would schedule layout callbacks even when they would not do any work during the layout callback due to not resetting the `needsLayout` flag to false and removing any scheduled tasks when a layout was completed. Finally, we fix a few style issues that had not been caught so far and an unused `size` property on IconButton. Tests: media/modern-media-controls/buttons-container/buttons-container-buttons-property.html media/modern-media-controls/buttons-container/buttons-container-constructor.html media/modern-media-controls/buttons-container/buttons-container-layout.html * Modules/modern-media-controls/controls/airplay-button.js: (AirplayButton.prototype.set on): (AirplayButton): * Modules/modern-media-controls/controls/buttons-container.css: (.buttons-container): * Modules/modern-media-controls/controls/buttons-container.js: (ButtonsContainer.prototype.get buttons): (ButtonsContainer.prototype.set buttons): (ButtonsContainer.prototype.layout): * Modules/modern-media-controls/controls/icon-button.js: * Modules/modern-media-controls/controls/layout-node.js: (LayoutNode.prototype.set needsLayout): (LayoutNode.prototype.markDirtyProperty): (LayoutNode.prototype._markNodeManipulation): (LayoutNode.prototype._updateDirtyState): (performScheduledLayout): (elementFromString): * Modules/modern-media-controls/controls/scheduler.js: (const.scheduler.new.prototype.unscheduleLayout): 2016-10-11 Youenn Fablet <youenn@apple.com> [Fetch API] Support Request cache mode https://bugs.webkit.org/show_bug.cgi?id=162281 Reviewed by Alex Christensen. Covered by updated test. Added support for only-if-cached mode at Request level. Added support for cache mode at CachedResourceLoader, by setting HTTP headers and ResourceRequest cache policy based on https://fetch.spec.whatwg.org/#concept-request-cache-mode and https://fetch.spec.whatwg.org/#http-network-or-cache-fetch. Disabled default cache policy computation (done in FrameLoader) when cache mode is different from the default. Activated no-store cache mode for EventSource as per https://html.spec.whatwg.org/#the-eventsource-interface. * Modules/fetch/FetchRequest.cpp: (WebCore::setCache): Adding support for only-if-cached. (WebCore::buildOptions): Throw if only-if-cached and fetch mode is not same-origin. * loader/FetchOptions.h: Adding support for only-if-cached. * loader/FrameLoader.cpp: (WebCore::FrameLoader::defaultRequestCachingPolicy): Introduced to ease readability. (WebCore::FrameLoader::addExtraFieldsToRequest): Updating cache policy only if request has the default cache policy. This allows bypassing the default behavior for fetch cache mode different from "default". * loader/FrameLoader.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::updateRequestAccordingCacheMode): Introduced to set headers and request cache policy according fetch cache mode. (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::loadResource): (WebCore::CachedResourceLoader::determineRevalidationPolicy): Ensure bypassing the memory cache in no-store and reload cases. We reload in case of cache mode=reload to refresh the meory cache entry. * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::setCacheModeToNoStore): * page/EventSource.cpp: (WebCore::EventSource::connect): Use no-store cache mode as per https://html.spec.whatwg.org/#the-eventsource-interface. * platform/network/HTTPHeaderMap.cpp: (WebCore::HTTPHeaderMap::addIfNotPresent): Helper routine. * platform/network/HTTPHeaderMap.h: * platform/network/HTTPHeaderValues.cpp: * platform/network/HTTPHeaderValues.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::addHTTPHeaderFieldIfNotPresent): (WebCore::ResourceRequestBase::addHTTPHeaderField): (WebCore::ResourceRequestBase::hasHTTPHeaderField): * platform/network/ResourceRequestBase.h: 2016-10-10 Antti Koivisto <antti@apple.com> Stop copying author shadow pseudo rules into shadow tree style resolver https://bugs.webkit.org/show_bug.cgi?id=163232 Reviewed by Darin Adler. * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::collectMatchingRules): (WebCore::ElementRuleCollector::matchAuthorRules): (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules): If we are resolving a user agent shadow tree also look up pseudo element rules from the host scope author sheet. This is needed to keep web exposed ::-webkit-foo pseudo elements working. (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules): Factor to a function. * css/ElementRuleCollector.h: * css/RuleSet.cpp: (WebCore::RuleSet::copyShadowPseudoElementRulesFrom): Deleted. * css/RuleSet.h: * dom/Document.cpp: (WebCore::Document::userAgentShadowTreeStyleResolver): * style/StyleScope.cpp: (WebCore::Style::Scope::updateStyleResolver): No need to awkwardly copy these rules anymore. 2016-10-11 Chris Dumez <cdumez@apple.com> Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163266 Reviewed by Darin Adler. Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor instead, as in the specification: - http://w3c.github.io/IndexedDB/#request-idbversionchangeevent This patch also fixes a bug where the IDBVersionChangeEvent was ignoring the EventInit dictionary members passed by the JavaScript (e.g. bubbles). No new tests, updated existing test. * Modules/indexeddb/IDBVersionChangeEvent.cpp: (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent): * Modules/indexeddb/IDBVersionChangeEvent.h: * Modules/indexeddb/IDBVersionChangeEvent.idl: * bindings/js/JSDOMConvert.h: (WebCore::convertNullable): (WebCore::convert): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): * bindings/scripts/test/TestObj.idl: 2016-10-11 Chris Dumez <cdumez@apple.com> Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163265 Reviewed by Darin Adler. Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor instead. * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp: (WebCore::WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent): * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h: (WebCore::WebKitPlaybackTargetAvailabilityEvent::createForBindings): (WebCore::WebKitPlaybackTargetAvailabilityEvent::~WebKitPlaybackTargetAvailabilityEvent): Deleted. * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl: 2016-10-10 Zan Dobersek <zdobersek@igalia.com> Add ENABLE_ENCRYPTED_MEDIA configuration option https://bugs.webkit.org/show_bug.cgi?id=163219 Reviewed by Darin Adler. * Configurations/FeatureDefines.xcconfig: Add the ENABLE_ENCRYPTED_MEDIA configuration option. It will be used to enable or disable the new EME implementation at build-time. * DerivedSources.make: Group the legacy option and the new option together. 2016-10-10 Youenn Fablet <youenn@apple.com> CachedResourceRequest constructor should be made more efficient https://bugs.webkit.org/show_bug.cgi?id=163210 Reviewed by Alex Christensen. No change of behavior. Refactoring to use one CachedResourceRequest constructor that will move its request and charset to improve efficiency. * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::requestStyleSheet): * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::CachedResourceRequest): * loader/cache/CachedResourceRequest.h: 2016-10-10 Adam Bergkvist <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com> WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly https://bugs.webkit.org/show_bug.cgi?id=163202 Reviewed by Eric Carlson. An RTCRtpTransceiver has a null mid until it's been associated with a media description (with a mid) [1]. During that time, it's identified by a provisional mid that might become its real mid, but the transceiver can also get its mid assigned by a remote media description. In the second case, the mid value is initially unknown. A transceiver's RTCRtpSender must directly (synchronously in the script) provide a muted remote source that is playable by, for example, a media element. This source is initially registered in the MediaEndpoint (WebRTC backend) with the transceiver's provisional mid. So, if the real mid is set by a remote description, the registered mid must be updated to preserve the association between the registered source and the transceiver. [1] https://w3c.github.io/webrtc-pc/archives/20160913/webrtc.html#dom-rtcrtptransceiver-mid Test: fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html * Modules/mediastream/MediaEndpointPeerConnection.cpp: Don't break after finding the first transceiver in the loop that builds the send source map. Update the mid used to register the muted remote source if the a transceiver's mid gets assigned by a remote media description. (WebCore::createSourceMap): (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): * platform/mediastream/MediaEndpoint.cpp: * platform/mediastream/MediaEndpoint.h: * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::MockMediaEndpoint): (WebCore::MockMediaEndpoint::updateReceiveConfiguration): (WebCore::MockMediaEndpoint::updateSendConfiguration): (WebCore::MockMediaEndpoint::createMutedRemoteSource): (WebCore::MockMediaEndpoint::replaceMutedRemoteSourceMid): (WebCore::MockMediaEndpoint::emulatePlatformEvent): Add "unmute-remote-sources-by-mid" action that emulates data arriving on media descriptions which unmutes the remote sources. (WebCore::MockMediaEndpoint::updateConfigurationMids): (WebCore::MockMediaEndpoint::unmuteRemoteSourcesByMid): (WebCore::MockMediaEndpoint::unmuteTimerFired): * platform/mock/MockMediaEndpoint.h: 2016-10-10 Darin Adler <darin@apple.com> Move audio module off of legacy exceptions https://bugs.webkit.org/show_bug.cgi?id=163269 Reviewed by Alex Christensen. * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::setFftSize): Use ExceptionOr. (WebCore::AnalyserNode::setMinDecibels): Ditto. (WebCore::AnalyserNode::setMaxDecibels): Ditto. (WebCore::AnalyserNode::setSmoothingTimeConstant): Ditto. * Modules/webaudio/AnalyserNode.h: Update for above. * Modules/webaudio/AnalyserNode.idl: Ditto. * Modules/webaudio/AudioBasicInspectorNode.cpp: (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode): Initialize m_needAutomaticPull in class definition. (WebCore::AudioBasicInspectorNode::connect): Use ExceptionOr. (WebCore::AudioBasicInspectorNode::disconnect): Ditto. * Modules/webaudio/AudioBasicInspectorNode.h: Updated for above. * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::createFromAudioFileData): Use reference. (WebCore::AudioBuffer::AudioBuffer): Initialize m_gain in class definition. (WebCore::AudioBuffer::getChannelData): Use ExceptionOr. (WebCore::AudioBuffer::channelData): Rename to disambiguate with getChannelData. (WebCore::AudioBuffer::zero): Use modern for loop. * Modules/webaudio/AudioBuffer.h: Update for above. * Modules/webaudio/AudioBuffer.idl: Ditto. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::process): Use reference. (WebCore::AudioBufferSourceNode::setBuffer): Use channelData. (WebCore::AudioBufferSourceNode::start): Use ExceptionOr. (WebCore::AudioBufferSourceNode::startPlaying): Ditto. * Modules/webaudio/AudioBufferSourceNode.h: Update for above. * Modules/webaudio/AudioBufferSourceNode.idl: Ditto. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::createBuffer): Use ExceptionOr. (WebCore::AudioContext::createMediaElementSource): Ditto. (WebCore::AudioContext::createMediaStreamSource): Ditto. (WebCore::AudioContext::createScriptProcessor): Ditto. (WebCore::AudioContext::createDelay): Ditto. (WebCore::AudioContext::createChannelSplitter): Ditto. (WebCore::AudioContext::createChannelMerger): Ditto. (WebCore::AudioContext::createPeriodicWave): Ditto. * Modules/webaudio/AudioContext.h: Update for above. * Modules/webaudio/AudioContext.idl: Ditto. * Modules/webaudio/AudioDestinationNode.h: Use unsigned instead of unsigned long for maxChannelCount. * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::connect): Use ExceptionOr. (WebCore::AudioNode::disconnect): Ditto. (WebCore::AudioNode::channelCount): Use unsigned. (WebCore::AudioNode::setChannelCount): Use ExceptionOr and unsigned. (WebCore::AudioNode::setChannelCountMode): Ditto. (WebCore::AudioNode::setChannelInterpretation): Ditto. * Modules/webaudio/AudioNode.h: Update for above. * Modules/webaudio/AudioNode.idl: Ditto. * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode): Initialize data members in class definition. (WebCore::AudioScheduledSourceNode::updateSchedulingInfo): Take a reference instead of a pointer to the audio bus. (WebCore::AudioScheduledSourceNode::start): Use ExceptionOr. (WebCore::AudioScheduledSourceNode::stop): Ditto. * Modules/webaudio/AudioScheduledSourceNode.h: Update for above. * Modules/webaudio/ConvolverNode.cpp: (WebCore::ConvolverNode::ConvolverNode): Initialize m_normalize in class definition. (WebCore::ConvolverNode::setBuffer): Use ExceptionOr. * Modules/webaudio/ConvolverNode.h: Update for above. * Modules/webaudio/ConvolverNode.idl: Ditto. * Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode): Initialize m_numberOfInputChannels in class definition. (WebCore::DefaultAudioDestinationNode::maxChannelCount): Use unsigned. (WebCore::DefaultAudioDestinationNode::setChannelCount): Use ExceptionOr. * Modules/webaudio/DefaultAudioDestinationNode.h: Update for changes above. * Modules/webaudio/DelayNode.cpp: (WebCore::DelayNode::DelayNode): Moved exception logic out of constructor. (WebCore::DelayNode::create): Added. Moved exception logic in here. (WebCore::DelayNode::delayTime): Moved typecast here from header. * Modules/webaudio/DelayNode.h: Update for above. * Modules/webaudio/OfflineAudioContext.cpp: (WebCore::OfflineAudioContext::OfflineAudioContext): Marked inline. (WebCore::OfflineAudioContext::create): Use ExceptionOr. (WebCore::OfflineAudioContext::~OfflineAudioContext): Deleted. Unneeded. * Modules/webaudio/OfflineAudioContext.h: Update for above. * Modules/webaudio/OfflineAudioContext.idl: Ditto. * Modules/webaudio/OfflineAudioDestinationNode.cpp: (WebCore::OfflineAudioDestinationNode::offlineRender): Use channelData. * Modules/webaudio/OscillatorNode.cpp: (WebCore::OscillatorNode::OscillatorNode): Updated for change to setType. (WebCore::OscillatorNode::setType): Use ExceptionOr. (WebCore::OscillatorNode::process): Use a reference. * Modules/webaudio/OscillatorNode.h: Update for above. * Modules/webaudio/OscillatorNode.idl: Ditto. * Modules/webaudio/ScriptProcessorNode.cpp: (WebCore::ScriptProcessorNode::process): Use channelData. * bindings/js/JSDOMBinding.h: Added overloads of toJS to it can be used on references to array buffers and array buffer views, not just pointers. 2016-10-10 Youenn Fablet <youenn@apple.com> Change HTTPHeaderValues from a struct to a namespace https://bugs.webkit.org/show_bug.cgi?id=163203 Reviewed by Alex Christensen. No change of behavior. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): * platform/network/HTTPHeaderValues.cpp: (WebCore::HTTPHeaderValues::textPlainContentType): (WebCore::HTTPHeaderValues::formURLEncodedContentType): (WebCore::HTTPHeaderValues::TextPlainContentType): Deleted. (WebCore::HTTPHeaderValues::FormURLEncodedContentType): Deleted. * platform/network/HTTPHeaderValues.h: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): 2016-10-10 Chris Dumez <cdumez@apple.com> Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163254 Reviewed by Darin Adler. Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor instead, as in the specification: - https://www.w3.org/TR/uievents/#interface-mouseevent - https://www.w3.org/TR/uievents/#interface-wheelevent * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateDictionaryHeader): Fix our broken dependency tracking when it comes to dictionaries. * dom/MouseEvent.cpp: (WebCore::MouseEvent::create): (WebCore::MouseEvent::MouseEvent): * dom/MouseEvent.h: * dom/MouseEvent.idl: * dom/MouseEventInit.h: Added. * dom/MouseEventInit.idl: Added. * dom/MouseRelatedEvent.cpp: (WebCore::MouseRelatedEvent::MouseRelatedEvent): * dom/MouseRelatedEvent.h: * dom/UIEventWithKeyState.h: (WebCore::UIEventWithKeyState::UIEventWithKeyState): * dom/WheelEvent.cpp: (WebCore::WheelEvent::WheelEvent): * dom/WheelEvent.h: * dom/WheelEvent.idl: 2016-10-10 Chris Dumez <cdumez@apple.com> Add support for languagechange event https://bugs.webkit.org/show_bug.cgi?id=163222 Reviewed by Ryosuke Niwa. Add support for languagechange event: - https://html.spec.whatwg.org/#dom-navigator-languages Firefox and Chrome already support this. Test: fast/dom/window-languagechange-event.html * dom/EventNames.h: * html/HTMLAttributeNames.in: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap): * page/DOMWindow.cpp: (WebCore::languagesChangedCallback): (WebCore::DOMWindow::DOMWindow): (WebCore::DOMWindow::~DOMWindow): (WebCore::DOMWindow::languagesChanged): (WebCore::DOMWindow::canShowModalDialog): Deleted. (WebCore::DOMWindow::removeEventListener): Deleted. * page/DOMWindow.h: * page/WindowEventHandlers.idl: 2016-10-10 Chris Dumez <cdumez@apple.com> Update GamepadEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163243 Reviewed by Darin Adler. Update GamepadEvent to stop using legacy [ConstructorTemplate=Event] and use a proper constructor as in the specification: - https://w3c.github.io/gamepad/#gamepadevent-interface * Modules/gamepad/GamepadEvent.cpp: (WebCore::GamepadEvent::GamepadEvent): * Modules/gamepad/GamepadEvent.h: (WebCore::GamepadEvent::create): (WebCore::GamepadEvent::~GamepadEvent): Deleted. * Modules/gamepad/GamepadEvent.idl: 2016-10-10 Darin Adler <darin@apple.com> Move Fetch from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163195 Reviewed by Chris Dumez. * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): Use ExceptionOr. (WebCore::FetchHeaders::append): Ditto. (WebCore::FetchHeaders::remove): Ditto. (WebCore::FetchHeaders::get): Ditto. (WebCore::FetchHeaders::has): Ditto. (WebCore::FetchHeaders::set): Ditto. (WebCore::FetchHeaders::filterAndFill): Ditto. (WebCore::FetchHeaders::Iterator::next): Got rid of unneeded code to clear out m_keys after the last call to next, since it will be deleted as soon as the iterator is deleted. * Modules/fetch/FetchHeaders.h: Use pragma once. Use ExceptionOr. * Modules/fetch/FetchHeaders.idl: Move to non-legacy exceptions. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): Use ExceptionOr. (WebCore::FetchRequest::clone): Ditto. * Modules/fetch/FetchRequest.h: Use pragma once. Use ExceptionOr. * Modules/fetch/FetchRequest.idl: Move to non-legacy exceptions. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::redirect): Use ExceptionOr. (WebCore::FetchResponse::setStatus): Ditto. * Modules/fetch/FetchResponse.h: Use ExceptionOr. * Modules/fetch/FetchResponse.idl: Move to non-legacy exceptions. * bindings/js/JSDOMBinding.h: Added implementation of toJSNullableString. * bindings/scripts/CodeGeneratorJS.pm: (NativeToJSValue): Call toJSNullableString and toJSString for functions that return ExceptionOr<String>. 2016-10-10 Nan Wang <n_wang@apple.com> AX: Expose invalid status for input types with that information https://bugs.webkit.org/show_bug.cgi?id=163252 <rdar://problem/28704409> Reviewed by Chris Fleizach. For input types with invalid input value, we should expose the invalid status to the assitive technology. Test: accessibility/mac/invalid-status-for-input-types.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::invalidStatus): 2016-10-10 Konstantin Tokarev <annulen@yandex.ru> Added override specifier to PluginViewBase::isPluginViewBase() https://bugs.webkit.org/show_bug.cgi?id=163218 Reviewed by Alex Christensen. No new tests needed. * plugins/PluginViewBase.h: 2016-10-10 Alex Christensen <achristensen@webkit.org> Don't run SecurityOrigin's port through URLParser https://bugs.webkit.org/show_bug.cgi?id=163253 Reviewed by Brady Eidson. No change in behavior. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier): (WebCore::SecurityOrigin::create): We used to parse URLs like "file://:0/" which are valid when using URL::parse but aren't valid when we start using the URLParser, which matches other browsers' failure to parse URLs with a port but no host. There is no reason to write and parse the port. Setting m_port directly accomplishes the same thing. 2016-10-10 Said Abou-Hallawa <sabouhallawa@apple.com> <Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero https://bugs.webkit.org/show_bug.cgi?id=138555 Reviewed by Simon Fraser. Ensure the dashArray has at least one non-zero element before calling GraphicsContext::setLineDash(). Call GraphicsContext::setStrokeStyle() instead, if the dashArray does not have one. * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::applyStrokeStyleToContext): 2016-10-10 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Correct Radial Graident Bug https://bugs.webkit.org/show_bug.cgi?id=163241 Reviewed by Darin Adler. Radial gradients were not working correctly under Direct2D because the points and radius values used were incorrect. D2D wants a center point and an offset, not a start and end point. It wants an X and Y radius (for an ellipse), not a radius at the start point, and a radius at the end point. Covered by existing fast/gradients/css-radial-gradients.html (and others). * platform/graphics/Image.cpp: (WebCore::Image::drawTiled): Remove 'notImplemented' code path. * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::generateGradient): Use correct input values to the Radial Gradient constructor. (WebCore::Gradient::fill): Generate a gradient if we have no active one to use. 2016-10-10 Jiewen Tan <jiewen_tan@apple.com> Rename CryptoAlgorithmParameters to CryptoAlgorithmParametersDeprecated https://bugs.webkit.org/show_bug.cgi?id=163163 <rdar://problem/28681544> Reviewed by Brent Fulgham. Replace all uses of 'CryptoAlgorithmParameters' with 'CryptoAlgorithmParametersDeprecated' in preparation for a new CryptoAlgorithmParameters type. No changes of behaviors. No new tests. * Modules/encryptedmedia/CDMSessionClearKey.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCryptoAlgorithmDictionary.cpp: * bindings/js/JSCryptoAlgorithmDictionary.h: * bindings/js/JSCryptoKeySerializationJWK.cpp: * bindings/js/JSCryptoKeySerializationJWK.h: * bindings/js/JSWebKitSubtleCryptoCustom.cpp: * crypto/CryptoAlgorithm.cpp: * crypto/CryptoAlgorithm.h: * crypto/CryptoAlgorithmParametersDeprecated.h: Renamed from Source/WebCore/crypto/CryptoAlgorithmParameters.h. * crypto/CryptoKeySerialization.h: * 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/algorithms/CryptoAlgorithmSHA1.cpp: * crypto/algorithms/CryptoAlgorithmSHA1.h: * crypto/algorithms/CryptoAlgorithmSHA224.cpp: * crypto/algorithms/CryptoAlgorithmSHA224.h: * crypto/algorithms/CryptoAlgorithmSHA256.cpp: * crypto/algorithms/CryptoAlgorithmSHA256.h: * crypto/algorithms/CryptoAlgorithmSHA384.cpp: * crypto/algorithms/CryptoAlgorithmSHA384.h: * crypto/algorithms/CryptoAlgorithmSHA512.cpp: * crypto/algorithms/CryptoAlgorithmSHA512.h: * crypto/keys/CryptoKeySerializationRaw.cpp: * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp: * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp: * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: * crypto/keys/CryptoKeySerializationRaw.h: * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: * crypto/mac/CryptoAlgorithmHMACMac.cpp: * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h. * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h. * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h. * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacParams.h. * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h. * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHash.h. * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h. * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaSsaParams.h. 2016-10-10 Darin Adler <darin@apple.com> Move NotificationCenter from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163217 Reviewed by Chris Dumez. * Modules/notifications/DOMWindowNotifications.cpp: (WebCore::DOMWindowNotifications::webkitNotifications): Pass reference to document instead of pointer. Also use auto and early return. * Modules/notifications/Notification.cpp: (WebCore::Notification::Notification): Move checks that can lead to throwing an exception out of the constructor into the create function. (WebCore::Notification::create): Changed to use ExceptionOr. Also moved checks that can lead to throwing an exception here. (WebCore::Notification::show): Update since NotificationController::client now returns a reference. (WebCore::Notification::permission): Ditto. (WebCore::Notification::requestPermission): Ditto. * Modules/notifications/Notification.h: Updated for above changes. * Modules/notifications/NotificationCenter.cpp: (WebCore::NotificationCenter::create): Take a reference to the script execution context instead of a pointer. (WebCore::NotificationCenter::NotificationCenter): Ditto. (WebCore::NotificationCenter::createNotification): Use ExceptionOr. (WebCore::NotificationCenter::requestPermission): Take an rvalue reference. * Modules/notifications/NotificationCenter.h: Use pragma once. Marked the class final. Updated for changes above. * Modules/notifications/NotificationCenter.idl: Use non-legacy exceptions. * Modules/notifications/NotificationController.cpp: (WebCore::NotificationController::NotificationController): Use a reference rather than a pointer for m_client, since it is never null. (WebCore::NotificationController::~NotificationController): Ditto. (WebCore::NotificationController::clientFrom): Updated for the change above. * Modules/notifications/NotificationController.h: Updated for the change above. * Modules/notifications/WorkerGlobalScopeNotifications.cpp: (WebCore::WorkerGlobalScopeNotifications::webkitNotifications): Updated to pass a reference for the script execution context. Also added FIXME about the fact that the client is always null. 2016-10-10 Antoine Quint <graouts@apple.com> [Modern Media Controls] Placards https://bugs.webkit.org/show_bug.cgi?id=163110 <rdar://problem/28669342> Reviewed by Dean Jackson. Inline media controls need to display placards when the video is no longer playing inline, such as when the video is playing fullscreen or via AirPlay. To that end, we introduce a new Placard class and two subclasses for display during fullscreen or AirPlay playback. Note that localization will be done in a later patch. Tests: media/modern-media-controls/airplay-placard/airplay-placard.html media/modern-media-controls/pip-placard/pip-placard.html media/modern-media-controls/placard/placard.html * Modules/modern-media-controls/controls/airplay-placard.js: (AirplayPlacard): * Modules/modern-media-controls/controls/icon-service.js: * Modules/modern-media-controls/controls/pip-placard.js: (PiPPlacard): * Modules/modern-media-controls/controls/placard.css: (.placard): (.placard .container): (.placard .icon): (.placard .title,): (.placard .title): (.placard .description): * Modules/modern-media-controls/controls/placard.js: (Placard.): * Modules/modern-media-controls/images/iOS/airplay-placard@1x.png: Added. * Modules/modern-media-controls/images/iOS/airplay-placard@2x.png: Added. * Modules/modern-media-controls/images/iOS/airplay-placard@3x.png: Added. * Modules/modern-media-controls/images/iOS/pip-placard@1x.png: Added. * Modules/modern-media-controls/images/iOS/pip-placard@2x.png: Added. * Modules/modern-media-controls/images/iOS/pip-placard@3x.png: Added. * Modules/modern-media-controls/images/macOS/airplay-placard@1x.png: Added. * Modules/modern-media-controls/images/macOS/airplay-placard@2x.png: Added. * Modules/modern-media-controls/images/macOS/pip-placard@1x.png: Added. * Modules/modern-media-controls/images/macOS/pip-placard@2x.png: Added. 2016-10-10 Chris Dumez <cdumez@apple.com> Add support for Navigator.languages attribute https://bugs.webkit.org/show_bug.cgi?id=163220 Reviewed by Darin Adler. Add support for Navigator.languages attribute: - https://html.spec.whatwg.org/#navigatorlanguage Firefox and Chrome already support this. Currently, we always return a single language for privacy reasons so this API does not actually bring anything new besides interoperability with other browsers and compliance with the HTML specification. No new tests, rebaselined existing tests. * page/NavigatorBase.cpp: (WebCore::NavigatorBase::languages): * page/NavigatorBase.h: * page/NavigatorLanguage.idl: 2016-10-10 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Implement dashed and dotted border line drawing https://bugs.webkit.org/show_bug.cgi?id=163235 Reviewed by Alex Christensen. Covered by existing fast/border tests. * platform/graphics/GraphicsContext.cpp: Use custom 'setPlatformStrokeStyle' for D2D. * platform/graphics/Path.cpp: (WebCore::Path::length): Don't use default implementation for Direct2D. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Initialize pointer to nullptr. (WebCore::GraphicsContext::drawRect): Use proper stroke style. (WebCore::GraphicsContextPlatformPrivate::setLineCap): Added. (WebCore::GraphicsContextPlatformPrivate::setLineJoin): Added. (WebCore::GraphicsContextPlatformPrivate::setStrokeStyle): Added. (WebCore::GraphicsContextPlatformPrivate::setMiterLimit): Added. (WebCore::GraphicsContextPlatformPrivate::setDashOffset): Added. (WebCore::GraphicsContextPlatformPrivate::setPatternWidth): Added. (WebCore::GraphicsContextPlatformPrivate::setPatternOffset): Added. (WebCore::GraphicsContextPlatformPrivate::setStrokeThickness): Added. (WebCore::GraphicsContextPlatformPrivate::setDashes): Added. (WebCore::GraphicsContextPlatformPrivate::recomputeStrokeStyle): Added. (WebCore::GraphicsContextPlatformPrivate::strokeStyle): Added. (WebCore::GraphicsContext::drawLine): Use proper stroke style. (WebCore::GraphicsContext::drawEllipse): Ditto. (WebCore::GraphicsContext::drawPath): Ditto. (WebCore::GraphicsContext::strokePath): Ditto. (WebCore::GraphicsContext::setPlatformStrokeStyle): Added. (WebCore::GraphicsContext::setMiterLimit): Tell D2D context about miter limit. (WebCore::GraphicsContext::setLineCap): Ditto for line cap. (WebCore::GraphicsContext::setLineDash): Ditto for dashes. (WebCore::GraphicsContext::setLineJoin): Ditto for join style. (WebCore::GraphicsContext::setPlatformStrokeThickness): Ditto for stroke thickness. (WebCore::GraphicsContext::platformStrokeEllipse): Use proper stroke style. * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::currentPoint): Zero-initialize a value. (WebCore::Path::length): Added. 2016-10-10 Chris Dumez <cdumez@apple.com> Update ProgressEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163221 Reviewed by Darin Adler. Update ProgressEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor as in the specification: - https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface * dom/ProgressEvent.cpp: (WebCore::ProgressEvent::ProgressEvent): * dom/ProgressEvent.h: (WebCore::ProgressEvent::create): * dom/ProgressEvent.idl: 2016-10-10 Wenson Hsieh <wenson_hsieh@apple.com> Address some review feedback from r206979 and r207010 https://bugs.webkit.org/show_bug.cgi?id=163236 Reviewed by Tim Horton. In TypingCommand.h, some methods on TypingCommand should be marked as final to reflect the fact that they override methods in CompositeEditCommand. Also, HTMLFormControlElement::dispatchFormControlInputEvent does not need to specify HTMLElement::dispatchInputEvent() when calling dispatchInputEvent(). No new tests, since there is no behavior change. * editing/TypingCommand.h: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent): 2016-10-10 Chris Dumez <cdumez@apple.com> Update MessageEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163187 Reviewed by Darin Adler. Update MessageEvent to stop using legacy [ConstructorTemplate=Event] and use a regular constructor as in the specification: - https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces No new tests, updated existing test. * bindings/js/JSDOMBinding.h: (WebCore::toRefPtrNativeArray): * bindings/js/JSDOMConvert.h: (WebCore::convertWrapperTypeSequence): (WebCore::convertWrapperType): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateDictionaryImplementationContent): (GetNativeType): * dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): (WebCore::MessageEvent::create): (WebCore::MessageEvent::trySerializeData): (WebCore::MessageEvent::createForBindings): Deleted. (WebCore::MessageEvent::initMessageEvent): Deleted. * dom/MessageEvent.h: * dom/MessageEvent.idl: 2016-10-10 Antoine Quint <graouts@apple.com> [Modern Media Controls] Buttons https://bugs.webkit.org/show_bug.cgi?id=163109 <rdar://problem/28668954> Reviewed by Dean Jackson. We introduce specific IconButton subclasses for the various buttons we will be using in media controls on macOS (inline and fullscreen) and iOS. One class, StartButton, is a subclass of Button and not IconButton because we're only interested in having it display an <img> element rather than use a mask and requires additional DOM structure. Tests: media/modern-media-controls/airplay-button/airplay-button-on.html media/modern-media-controls/airplay-button/airplay-button.html media/modern-media-controls/aspect-ratio-button/aspect-ratio-button.html media/modern-media-controls/forward-button/forward-button.html media/modern-media-controls/fullscreen-button/fullscreen-button.html media/modern-media-controls/mute-button/mute-button.html media/modern-media-controls/pip-button/pip-button.html media/modern-media-controls/play-pause-button/play-pause-button.html media/modern-media-controls/rewind-button/rewind-button.html media/modern-media-controls/skip-back-button/skip-back-button.html media/modern-media-controls/start-button/start-button.html media/modern-media-controls/tracks-button/tracks-button.html * Modules/modern-media-controls/controls/airplay-button.css: (button.airplay.on): * Modules/modern-media-controls/controls/airplay-button.js: (AirplayButton): (AirplayButton.prototype.set on): * Modules/modern-media-controls/controls/aspect-ratio-button.js: (AspectRatioButton): (AspectRatioButton.prototype.get scalesToFill): (AspectRatioButton.prototype.set scalesToFill): * Modules/modern-media-controls/controls/forward-button.js: (ForwardButton): * Modules/modern-media-controls/controls/fullscreen-button.js: (FullscreenButton): * Modules/modern-media-controls/controls/icon-button.js: * Modules/modern-media-controls/controls/icon-service.js: * Modules/modern-media-controls/controls/mute-button.js: (MuteButton): (MuteButton.prototype.get muted): (MuteButton.prototype.set muted): * Modules/modern-media-controls/controls/pip-button.js: (PiPButton): * Modules/modern-media-controls/controls/play-pause-button.js: (PlayPauseButton): (PlayPauseButton.prototype.get playing): (PlayPauseButton.prototype.set playing): * Modules/modern-media-controls/controls/rewind-button.js: (RewindButton): * Modules/modern-media-controls/controls/skip-back-button.js: (SkipBackButton): * Modules/modern-media-controls/controls/start-button.js: (StartButton): * Modules/modern-media-controls/controls/tracks-button.js: (TracksButton): * Modules/modern-media-controls/images/iOS/airplay@1x.png: Added. * Modules/modern-media-controls/images/iOS/airplay@2x.png: Added. * Modules/modern-media-controls/images/iOS/enter-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/iOS/enter-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/iOS/enter-fullscreen@3x.png: Added. * Modules/modern-media-controls/images/iOS/interval-skip-back@1x.png: Added. * Modules/modern-media-controls/images/iOS/interval-skip-back@2x.png: Added. * Modules/modern-media-controls/images/iOS/interval-skip-back@3x.png: Added. * Modules/modern-media-controls/images/iOS/pause@1x.png: Added. * Modules/modern-media-controls/images/iOS/pip-in@1x.png: Added. * Modules/modern-media-controls/images/iOS/pip-in@2x.png: Added. * Modules/modern-media-controls/images/iOS/pip-in@3x.png: Added. * Modules/modern-media-controls/images/iOS/play@1x.png: Added. * Modules/modern-media-controls/images/iOS/play@2x.png: Added. * Modules/modern-media-controls/images/iOS/play@3x.png: Added. * Modules/modern-media-controls/images/iOS/start@1x.png: Added. * Modules/modern-media-controls/images/macOS/airplay-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/airplay-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/macOS/airplay@1x.png: Added. * Modules/modern-media-controls/images/macOS/airplay@2x.png: Added. * Modules/modern-media-controls/images/macOS/enter-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/enter-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/macOS/exit-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/exit-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/macOS/forward@1x.png: Added. * Modules/modern-media-controls/images/macOS/forward@2x.png: Added. * Modules/modern-media-controls/images/macOS/interval-skip-back@1x.png: Added. * Modules/modern-media-controls/images/macOS/interval-skip-back@2x.png: Added. * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/macOS/media-selection@1x.png: Added. * Modules/modern-media-controls/images/macOS/media-selection@2x.png: Added. * Modules/modern-media-controls/images/macOS/pip-in@1x.png: Added. * Modules/modern-media-controls/images/macOS/pip-in@2x.png: Added. * Modules/modern-media-controls/images/macOS/play-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/play-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/macOS/play@1x.png: Added. * Modules/modern-media-controls/images/macOS/play@2x.png: Added. * Modules/modern-media-controls/images/macOS/rewind@1x.png: Added. * Modules/modern-media-controls/images/macOS/rewind@2x.png: Added. * Modules/modern-media-controls/images/macOS/scale-to-fill@1x.png: Added. * Modules/modern-media-controls/images/macOS/scale-to-fill@2x.png: Added. * Modules/modern-media-controls/images/macOS/scale-to-fit@1x.png: Added. * Modules/modern-media-controls/images/macOS/scale-to-fit@2x.png: Added. * Modules/modern-media-controls/images/macOS/volume-mute@1x.png: Added. * Modules/modern-media-controls/images/macOS/volume-mute@2x.png: Added. * Modules/modern-media-controls/images/macOS/volume@1x.png: Added. * Modules/modern-media-controls/images/macOS/volume@2x.png: Added. 2016-10-10 Nan Wang <n_wang@apple.com> AX: Update AXPlaceHolder algorithm https://bugs.webkit.org/show_bug.cgi?id=163229 Reviewed by Chris Fleizach. From https://w3c.github.io/html-aam/ When the placeholder and aria-placeholder attributes are both present, we should expose the value of the placeholder attribute. Updated the algorithm for that. Changes are covered in the modified test. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::placeholderValue): 2016-10-10 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Implement Node accessors in DOMJIT https://bugs.webkit.org/show_bug.cgi?id=163005 Reviewed by Filip Pizlo. This patch implements DOMJIT accessors in WebCore. We plan to offer 2 things in DOMJIT. 1. Hand written DOM inlining. We inject DOMJIT::Patchpoint compiler into JSC. And JSC uses this to inline DOM operation, and drop type checks. Since the operation is fully inlined, potentially it has large performance boost. Note that CSS Selector JIT compiler already does the similar things: accessing parentNode etc. directly by using offsets. 2. Exposing signature information. We will offer function type signature by some representation and pass it to JSC. JSC will use to drop type checks. Since IDL code generator already knows this, we can automatically generate such a information. Since we don't perform any inlining, the performance boost may be limited. But it's worth doing. This patch implements the first one, hand written DOM inlining facility. We add a new IDL attribute, "DOMJIT". This means that "This readonly attribute have a DOMJIT patchpoint compiler". We annotate several accessors at first. "firstChild", "lastChild", "nextSibling", "previousSibling", and "parentNode". And we implement DOMJIT::Patchpoint for that in JSNodeDOMJIT.cpp. This patchpoint will be integrated into JSC's DFG and FTL. And these tiers can drop type checks and inline the entire code of these accessors. JSC compiler still does not know much about DOM. And WebCore does not know much about each tier of JSC. WebCore just offers the generic patchpoints and they are used in both DFG and FTL tiers. The layer separation is still kept. While very small microbenchmark[1] shows performance benefit, still we cannot improve DOM benchmarks due to the lack of following implementations. Once the following implementations are implemented, we will get performance boost. 1. Super polymorphic sites. This inlining is super effective if we run some microbenchmarks. However, Dromaeo does not show so much performance benefit. This is because Dromaeo's dom-traverse.html is super polymorphic call site where JSC gives up optimization. For example, in the following dromaeo's benchmark, we can see so various DOM nodes at the `cur.firstChild` site, like, HTMLDivElement, HTMLAnchorElement, Text, Comment etc. JSC gives up optimization since we encounter so many Structures. This should be optimized since they share the large part of prototype-chain and they hit the exactly same CustomGetter, Node.prototype.firstChild. We will handle this and when we optimize it, this DOMJIT works well on Dromaeo. test( "firstChild", function(){ var nodes = document.body.childNodes, nl = nodes.length; for ( var i = 0; i < num; i++ ) { for ( var j = 0; j < nl; j++ ) { var cur = nodes[j]; while ( cur ) cur = cur.firstChild; ret = cur; } } }); 2. Emit code in IC. Currently, we only optimize DOMJIT accessors in DFG and FTL. However, we should leverage this DOMJIT::Patchpoint to emit inlined code even in Inline Caching (IC). We will emit CheckDOM's code for IC's guard phase, and emit CallDOM's code for IC's get phase. This offers performance benefit even if we live in baseline JIT code. And this should be easy. [1]: With the following one, we can see 3x improvement (26ms v.s. 80ms). var element = document.getElementsByTagName('div')[3]; var before = Date.now(); for (var i = 0; i < 1e7; ++i) element.firstChild; console.log(Date.now() - before); * CMakeLists.txt: * ForwardingHeaders/domjit/DOMJITGetterSetter.h: * ForwardingHeaders/domjit/DOMJITPatchpoint.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h. * ForwardingHeaders/domjit/DOMJITPatchpointParams.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWrapper.h: (WebCore::JSDOMWrapper::offsetOfWrapped): (WebCore::JSDOMWrapper::wrapped): Deleted. * bindings/js/ScriptWrappable.h: (WebCore::ScriptWrappable::offsetOfWrapper): * bindings/scripts/CodeGeneratorJS.pm: (GetJSCAttributesForAttribute): (GenerateHeader): (GeneratePropertiesHashTable): (GenerateImplementation): (GenerateHashTableValueArray): * bindings/scripts/IDLAttributes.txt: * dom/ContainerNode.h: (WebCore::ContainerNode::lastChildMemoryOffset): (WebCore::ContainerNode::lastChild): Deleted. * dom/Node.h: (WebCore::Node::flagIsContainer): (WebCore::Node::flagIsText): Deleted. * dom/Node.idl: * domjit/DOMJITHelpers.h: Added. (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal): (WebCore::DOMJITHelpers::branchIfNotWeakIsLive): (WebCore::DOMJITHelpers::tryLookUpWrapperCache): (WebCore::DOMJITHelpers::toWrapper): (WebCore::DOMJITHelpers::branchIfDOMWrapper): (WebCore::DOMJITHelpers::branchIfNotDOMWrapper): (WebCore::DOMJITHelpers::branchIfNode): (WebCore::DOMJITHelpers::branchIfNotNode): (WebCore::DOMJITHelpers::branchIfElement): (WebCore::DOMJITHelpers::branchIfNotElement): (WebCore::DOMJITHelpers::branchIfDocumentWrapper): (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper): * domjit/JSNodeDOMJIT.cpp: Added. (WebCore::toWrapperSlow): (WebCore::createCallDOMForOffsetAccess): (WebCore::checkNode): (WebCore::NodeFirstChildDOMJIT::checkDOM): (WebCore::NodeFirstChildDOMJIT::callDOM): (WebCore::NodeLastChildDOMJIT::checkDOM): (WebCore::NodeLastChildDOMJIT::callDOM): (WebCore::NodeNextSiblingDOMJIT::checkDOM): (WebCore::NodeNextSiblingDOMJIT::callDOM): (WebCore::NodePreviousSiblingDOMJIT::checkDOM): (WebCore::NodePreviousSiblingDOMJIT::callDOM): (WebCore::NodeParentNodeDOMJIT::checkDOM): (WebCore::NodeParentNodeDOMJIT::callDOM): 2016-10-10 Wenson Hsieh <wenson_hsieh@apple.com> Support InputEvent.data for the new InputEvent spec https://bugs.webkit.org/show_bug.cgi?id=163113 <rdar://problem/28681935> Reviewed by Darin Adler. Introduces InputEvent.data, a string attribute that, if non-null, indicates the text to be inserted by an input event. For text areas and text inputs, the 'insertText', 'insertFromPaste', 'insertFromDrop', and 'insertReplacementText' input types should cause subsequent `input` and `beforeinput` events to have non-null data. However, for contenteditable areas, only 'insertText' leads to having data in resulting InputEvents. To implement this, we introduce a new virtual method, CompositeEditCommand::inputEventData, which gives composite editing commands the chance to vend a data string for input events they might fire (by default, this is null). Tests: fast/events/input-events-paste-data.html fast/events/input-events-typing-data.html * dom/InputEvent.cpp: (WebCore::InputEvent::InputEvent): * dom/InputEvent.h: * dom/InputEvent.idl: Currently, our InputEventInit struct is wrong. According to the UI-Events spec at www.w3.org/TR/uievents/, the init struct for an InputEvent should contain a data string (added in this patch) as well as an isComposing flag (to be added in a future patch along with composition support). While adding support for the data attribute, we tweak the InputEvent IDL and headers slightly to adjust for this. * dom/Node.cpp: (WebCore::Node::dispatchInputEvent): * dom/Node.h: * editing/CompositeEditCommand.h: (WebCore::CompositeEditCommand::inputEventData): * editing/EditCommand.cpp: (WebCore::EditCommand::isEditingTextAreaOrTextInput): * editing/EditCommand.h: * editing/Editor.cpp: (WebCore::dispatchBeforeInputEvent): (WebCore::dispatchInputEvent): (WebCore::dispatchBeforeInputEvents): (WebCore::dispatchInputEvents): (WebCore::Editor::willApplyEditing): (WebCore::Editor::appliedEditing): (WebCore::Editor::setBaseWritingDirection): (WebCore::Editor::computeAndSetTypingStyle): * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::inputEventData): * editing/ReplaceRangeWithTextCommand.h: * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::inputEventData): * editing/ReplaceSelectionCommand.h: * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::inputEventData): * editing/SpellingCorrectionCommand.h: * editing/TypingCommand.cpp: (WebCore::TypingCommand::TypingCommand): (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::willAddTypingToOpenCommand): (WebCore::TypingCommand::insertTextRunWithoutNewlines): * editing/TypingCommand.h: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setEditingValue): (WebCore::HTMLInputElement::setValueFromRenderer): * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::listBoxOnChange): (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList): 2016-10-10 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r206972. https://bugs.webkit.org/show_bug.cgi?id=163227 Making EWS flaky (Requested by bfulgham_ on #webkit). Reverted changeset: "[CMake] CMake does not support the dep files for implicit dependency" https://bugs.webkit.org/show_bug.cgi?id=161433 http://trac.webkit.org/changeset/206972 2016-10-10 Darin Adler <darin@apple.com> Move media source from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163201 Reviewed by Chris Dumez. * Modules/mediasource/MediaSource.cpp: Removed unneeded includes. (WebCore::MediaSource::create): Use auto. (WebCore::MediaSource::MediaSource): Initialize m_mediaElement in class definition. (WebCore::MediaSource::setLiveSeekableRange): Use ExceptionOr. (WebCore::MediaSource::clearLiveSeekableRange): Ditto. (WebCore::MediaSource::setDuration): Ditto. (WebCore::MediaSource::setDurationInternal): Ditto. (WebCore::MediaSource::endOfStream): Ditto. (WebCore::MediaSource::streamEndedWithError): Use bufferedInternal. (WebCore::MediaSource::addSourceBuffer): Use ExceptionOr. (WebCore::MediaSource::removeSourceBuffer): Ditto. (WebCore::MediaSource::detachFromElement): Use removeSourceBuffer without IGNORE_EXCEPTION since that is now the default behavior. (WebCore::MediaSource::activeRanges): Use bufferedInternal. (WebCore::MediaSource::createSourceBufferPrivate): Use ExceptionOr. * Modules/mediasource/MediaSource.h: Removed unneeded includes. Made more things private and also private rather than protected. * Modules/mediasource/MediaSource.idl: Use non-legacy exceptions. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::buffered): Use ExceptionOr. (WebCore::SourceBuffer::setTimestampOffset): Ditto. (WebCore::SourceBuffer::setAppendWindowStart): Ditto. (WebCore::SourceBuffer::setAppendWindowEnd): Ditto. (WebCore::SourceBuffer::appendBuffer): Ditto. (WebCore::SourceBuffer::abort): Ditto. (WebCore::SourceBuffer::remove): Ditto. (WebCore::SourceBuffer::appendBufferInternal): Ditto. (WebCore::SourceBuffer::setMode): Ditto. * Modules/mediasource/SourceBuffer.h: Removed unneeded includes. Updated for above changes. Made more things private. * Modules/mediasource/SourceBuffer.idl: Use non-legacy exceptions. * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h: Added now-needed include of MediaSourcePrivate.h. 2016-10-10 Jer Noble <jer.noble@apple.com> Address flaky airplay-* LayouTests https://bugs.webkit.org/show_bug.cgi?id=163044 Reviewed by Brent Fulgham. Two separate problems conspired to make airplay tests a bit flaky: For one, when the HTMLMediaElement clears its MediaPlayer, it won't necessarily notify clients that it has stopped playing to a wireless target. The WebMediaSessionManager may eventually cause this value to reset, but it's asynchronous, and may fire after the next test starts. Reset this state explicitly. For two, the state of the mock playback target picker was not being reset between test invocations. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::clearMediaPlayer): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): 2016-10-10 Brent Fulgham <bfulgham@apple.com> Correct typo in comment (patining -> painting). * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::centerLineAndCutOffCorners): 2016-10-10 Brent Fulgham <bfulgham@apple.com> Reduce code duplication between CG, Cairo, and Direct2D https://bugs.webkit.org/show_bug.cgi?id=163157 Reviewed by Darin Adler. Move a number of routines that have been copied-and-pasted to different platform files into the main GraphicsContext.cpp file. No new tests because there is no change in behavior. * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::dashedLineCornerWidthForStrokeWidth): Added. (WebCore::GraphicsContext::dashedLinePatternWidthForStrokeWidth): Added. (WebCore::GraphicsContext::dashedLinePatternOffsetForPatternAndStrokeWidth): Added. (WebCore::GraphicsContext::centerLineAndCutOffCorners): Added. * platform/graphics/GraphicsContext.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::drawLine): Call new helper function. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawLine): Ditto. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::drawLine): Ditto. 2016-10-10 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback https://bugs.webkit.org/show_bug.cgi?id=163170 Reviewed by Michael Catanzaro. Do not assume NetworkingContext is non-null and valid before using it. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::gotHeadersCallback): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): 2016-10-10 Youenn Fablet <youenn@apple.com> Images and scripts should be said as clean based on CachedResource::isCORSSameOrigin https://bugs.webkit.org/show_bug.cgi?id=162390 Reviewed by Darin Adler. No observable change of behavior. Renaming CachedResource::isClean to isCORSSameOrigin to match html spec terminology. Making use of it to check whether images taint canvas and whether script errors should be sanitized. Some asserts are added to ensure that a resource fetched using one origin is not reused for another origin. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::sanitizeScriptError): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::initializeStyleSheet): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::wouldTaintOrigin): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::isOriginClean): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::isCORSSameOrigin): * loader/cache/CachedResource.h: 2016-10-10 Youenn Fablet <youenn@apple.com> [Fetch API] Memory cache should not bypass redirect mode https://bugs.webkit.org/show_bug.cgi?id=162959 Reviewed by Darin Adler. Test: http/tests/fetch/redirectmode-and-preload.html Ensure reloading of resources if the redirect modes are different between request and cached resource, and cached resource has redirections. As a temporary workaround, we activate resource update for raw resources in shouldUpdateCachedResourceWithCurrentRequest but disable it in canUpdateFromResource. This allows handling reloading of resources with different redirection mode in canUpdateFromResource. A future patch should allow loading cached raw resources from other cached raw resources. * loader/cache/CachedResource.h: (WebCore::CachedResource::hasRedirections): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): (WebCore::canUpdateFromResource): (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): 2016-10-10 Youenn Fablet <youenn@apple.com> Attribute getter binding generated code should use more references https://bugs.webkit.org/show_bug.cgi?id=163179 Reviewed by Darin Adler. No change of behavior. Using more references in attribute getter generated code since BindingCaller::attribute can do the pointer-to-references checks once for all. Needed to update GenerateCallWith and NativeToJSValue to handle the case where references (attribute getters) or pointers (methods and attribute setters) are to be used. Future refactoring should allign methods/attribute setters to attribute getters. * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::attribute): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GenerateCallWith): (NativeToJSValue): (JSValueToNative): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSattribute.cpp: 2016-10-10 Youenn Fablet <youenn@apple.com> Fix Mac Win build after https://trac.webkit.org/changeset/206966 https://bugs.webkit.org/show_bug.cgi?id=163199 Unreviewed. * bindings/js/JSDOMBinding.h: Marking rejectPromiseWithGetterTypeError as WEBCORE_EXPORT. 2016-10-09 Antti Koivisto <antti@apple.com> Enable optimized stylesheet updates in shadow trees https://bugs.webkit.org/show_bug.cgi?id=163180 Reviewed by Darin Adler. When we get a new stylesheet (for example when load completes) we invalidate only those elements in DOM that are affected by the new sheet. This patch makes the optimization also work in shadow trees. Test: fast/shadow-dom/scoped-style-invalidation.html * css/StyleInvalidationAnalysis.cpp: (WebCore::StyleInvalidationAnalysis::invalidateStyle): * css/StyleInvalidationAnalysis.h: * dom/Document.cpp: (WebCore::Document::didRemoveAllPendingStylesheet): * style/StyleScope.cpp: (WebCore::Style::Scope::removePendingSheet): (WebCore::Style::Scope::analyzeStyleSheetChange): (WebCore::Style::Scope::updateActiveStyleSheets): 2016-10-10 Youenn Fablet <youenn@apple.com> Refactor binding generated casted-this checks for attribute setters https://bugs.webkit.org/show_bug.cgi?id=163181 Reviewed by Darin Adler. No change of behavior. Covered by existing tests and binding expectations. Adding support for attribute setter in BindingCaller. Updating binding generator to make use of it. Future refactoring should use more reference and rename castedThis to thisObject, like for getters. * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::setAttribute): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: 2016-10-09 Darin Adler <darin@apple.com> Move encrypted media from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163194 Reviewed by Youenn Fablet. * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::createSession): Take a reference instead of a pointer. * Modules/encryptedmedia/CDM.h: Updated for above change. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer. (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto. (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that sets m_session to null. (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto. (WebCore::WebKitMediaKeySession::update): Use ExceptionOr. (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead of calling the keys function. (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of calling the setError function. (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto. (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly instead of writing !isClosed. (WebCore::WebKitMediaKeySession::setError): Deleted. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed unneeded includes. Changed create to take a reference instead of a pointer. Made most members and base classes private instead of public. Also removed a few now-unneeded functions. Made everything that was formerly protected private instead, since the two are the same in a final class. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments. Moved from MayThrowLegacyException to MayThrowException. * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: (WebCore::WebKitMediaKeys::create): Use ExceptionOr. (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference. Also initialize m_mediaElement in the class definition. (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr). (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference insteead of pointer to create. Also removed unneeded separate checks for null strings in code that already calls isEmpty. (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings in code that already calls isEmpty. (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit. (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto. * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes. Changed cdm() function to return a reference. Initialize m_mediaElement. Use private instead of protected. * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException and MayThrowException instead of the legacy versions. 2016-10-09 Zan Dobersek <zdobersek@igalia.com> ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix https://bugs.webkit.org/show_bug.cgi?id=162982 Reviewed by Jer Noble. Have the Web-exposed interfaces guarded by ENABLE_LEGACY_ENCRYPTED_MEDIA also use the WebKit prefix in the implementations. This will prevent conflicts between interfaces with same names in both the legacy API and the future EME API. Most of the interfaces in this legacy API already used the WebKit prefix when exposed via JS bindings. The only exception is MediaKeyNeededEvent, which gets prefixed in this patch. The interface implementations for this legacy API are also moved under the Modules/encryptedmedia/legacy/ directory. No new tests -- covered by existing tests (with the relevant changes reflected in the updated baselines). * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * Modules/encryptedmedia/CDM.cpp: * Modules/encryptedmedia/CDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::generateKeyRequest): (WebCore::CDMSessionClearKey::update): * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp. (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent): (WebCore::WebKitMediaKeyMessageEvent::~WebKitMediaKeyMessageEvent): (WebCore::WebKitMediaKeyMessageEvent::eventInterface): * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.h. (WebCore::WebKitMediaKeyMessageEvent::create): (WebCore::WebKitMediaKeyMessageEvent::createForBindings): * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl. * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.cpp. (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent): (WebCore::WebKitMediaKeyNeededEvent::~WebKitMediaKeyNeededEvent): (WebCore::WebKitMediaKeyNeededEvent::eventInterface): * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.h. (WebCore::WebKitMediaKeyNeededEvent::create): (WebCore::WebKitMediaKeyNeededEvent::createForBindings): * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.idl. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp. (WebCore::WebKitMediaKeySession::create): (WebCore::WebKitMediaKeySession::WebKitMediaKeySession): (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession): (WebCore::WebKitMediaKeySession::setError): (WebCore::WebKitMediaKeySession::close): (WebCore::WebKitMediaKeySession::cachedKeyForKeyId): (WebCore::WebKitMediaKeySession::sessionId): (WebCore::WebKitMediaKeySession::generateKeyRequest): (WebCore::WebKitMediaKeySession::keyRequestTimerFired): (WebCore::WebKitMediaKeySession::update): (WebCore::WebKitMediaKeySession::addKeyTimerFired): (WebCore::WebKitMediaKeySession::sendMessage): (WebCore::WebKitMediaKeySession::sendError): (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): (WebCore::WebKitMediaKeySession::hasPendingActivity): (WebCore::WebKitMediaKeySession::stop): (WebCore::WebKitMediaKeySession::activeDOMObjectName): (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension): * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.h. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl. * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp. (WebCore::WebKitMediaKeys::create): (WebCore::WebKitMediaKeys::WebKitMediaKeys): (WebCore::WebKitMediaKeys::~WebKitMediaKeys): (WebCore::WebKitMediaKeys::createSession): (WebCore::WebKitMediaKeys::isTypeSupported): (WebCore::WebKitMediaKeys::setMediaElement): (WebCore::WebKitMediaKeys::cdmMediaPlayer): (WebCore::WebKitMediaKeys::keyAdded): (WebCore::WebKitMediaKeys::cachedKeyForKeyId): * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.h. * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.idl. * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): * bindings/js/JSDictionary.h: * dom/EventNames.in: * dom/EventTargetFactory.in: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded): (WebCore::HTMLMediaElement::setMediaKeys): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::keys): * html/HTMLMediaElement.idl: * html/WebKitMediaKeyError.h: Renamed from Source/WebCore/html/MediaKeyError.h. (WebCore::WebKitMediaKeyError::create): (WebCore::WebKitMediaKeyError::WebKitMediaKeyError): * html/WebKitMediaKeyError.idl: Renamed from Source/WebCore/html/MediaKeyError.idl. * testing/MockCDM.cpp: (WebCore::MockCDMSession::generateKeyRequest): (WebCore::MockCDMSession::update): 2016-10-09 Zan Dobersek <zdobersek@igalia.com> Remove stale ENABLE(ENCRYPTED_MEDIA) code in HTMLMediaElement https://bugs.webkit.org/show_bug.cgi?id=163111 Reviewed by Alex Christensen. Remove three method implementations in HTMLMediaElement which had their declarations and the related WebIDL entries removed in the first ENCRYPTED_MEDIA purge in r206440. No new tests -- no changes in behavior. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): Deleted. (WebCore::HTMLMediaElement::webkitAddKey): Deleted. (WebCore::HTMLMediaElement::webkitCancelKeyRequest): Deleted. 2016-10-09 Wenson Hsieh <wenson_hsieh@apple.com> Support InputEvent.inputType for the new InputEvent spec https://bugs.webkit.org/show_bug.cgi?id=163025 <rdar://problem/28658092> Reviewed by Darin Adler. Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to map EditActions to inputType names, and also split out ambiguous EditActions (such as EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward, EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType. In places where we create CompositeEditCommands, we now pass in these specific EditActions where appropriate, and when dispatching `beforeinput` and `input` events, we ask the CompositeEditCommand for its input type name, which it derives from its editingAction. Tests: fast/events/before-input-prevent-biu.html fast/events/before-input-prevent-cut.html fast/events/before-input-prevent-paste.html fast/events/before-input-prevent-typing.html fast/events/before-input-prevent-undo.html * dom/InputEvent.h: * dom/Node.cpp: (WebCore::Node::dispatchInputEvent): * dom/Node.h: * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::apply): (WebCore::CompositeEditCommand::inputEventTypeName): Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events should have. * editing/CompositeEditCommand.h: (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted. * editing/EditAction.h: * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): * editing/EditCommand.h: * editing/Editor.cpp: (WebCore::Editor::willApplyEditing): (WebCore::Editor::appliedEditing): (WebCore::Editor::willUnapplyEditing): (WebCore::Editor::unappliedEditing): (WebCore::Editor::willReapplyEditing): (WebCore::Editor::reappliedEditing): (WebCore::Editor::computeAndSetTypingStyle): * editing/InsertListCommand.cpp: (WebCore::InsertListCommand::editingAction): * editing/InsertListCommand.h: (WebCore::InsertListCommand::preservesTypingStyle): Deleted. (WebCore::InsertListCommand::editingAction): Deleted. * editing/ReplaceRangeWithTextCommand.cpp: (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand): * editing/SpellingCorrectionCommand.cpp: (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand): * editing/TypingCommand.cpp: (WebCore::editActionForTypingCommand): (WebCore::TypingCommand::TypingCommand): (WebCore::TypingCommand::inputEventTypeName): The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using. Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to use the last updated editing action rather than the default (initial) editing action. (WebCore::TypingCommand::willAddTypingToOpenCommand): (WebCore::TypingCommand::insertTextRunWithoutNewlines): (WebCore::TypingCommand::insertParagraphSeparator): * editing/TypingCommand.h: 2016-10-09 Darin Adler <darin@apple.com> Move ApplePaySession from legacy to new DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163191 Reviewed by Sam Weinig. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::create): Use ExceptionOr. (WebCore::ApplePaySession::ApplePaySession): Moved initialization of two of the data members to class definition. (WebCore::ApplePaySession::supportsVersion): Use ExceptionOr. (WebCore::ApplePaySession::canMakePayments): Ditto. (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): Ditto. (WebCore::ApplePaySession::openPaymentSetup): Ditto. (WebCore::ApplePaySession::begin): Ditto. (WebCore::ApplePaySession::abort): Ditto. (WebCore::ApplePaySession::completeMerchantValidation): Ditto. (WebCore::ApplePaySession::completeShippingMethodSelection): Ditto. (WebCore::ApplePaySession::completeShippingContactSelection): Ditto. (WebCore::ApplePaySession::completePaymentMethodSelection): Ditto. (WebCore::ApplePaySession::completePayment): Ditto. (WebCore::ApplePaySession::validateMerchant): Use auto and get instead of using a RefPtr type and * for event dispatching. (WebCore::ApplePaySession::didAuthorizePayment): Ditto. (WebCore::ApplePaySession::didSelectShippingMethod): Ditto. (WebCore::ApplePaySession::didSelectShippingContact): Ditto. (WebCore::ApplePaySession::didSelectPaymentMethod): Ditto. (WebCore::ApplePaySession::didCancelPayment): Ditto. (WebCore::ApplePaySession::paymentCoordinator): Moved dereferencing inside the downcast. * Modules/applepay/ApplePaySession.h: Updated for changes above. * Modules/applepay/ApplePaySession.idl: Use MayThrowException. * bindings/js/JSApplePaySessionCustom.cpp: (WebCore::JSApplePaySession::completeShippingMethodSelection): Use propagateException. (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto. (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto. * bindings/js/JSDOMBinding.h: Added implementation of toJSBoolean. * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinition): Generate the different arguments for toJSNewlyCreated when ConstructorMayThrowException is specified that activate the version of that function that handles exceptions. * bindings/scripts/IDLAttributes.txt: Added ConstructorMayThrowException. 2016-10-09 Darin Adler <darin@apple.com> Replace all uses of ExceptionCodeWithMessage with WebCore::Exception https://bugs.webkit.org/show_bug.cgi?id=163178 Reviewed by Sam Weinig. * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::stringToDirection): Return an Optional instead of using an ExceptionCode out argument, since this function just needs to indicate failure, not actually throw an exception. (WebCore::IDBCursor::update): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBCursor::advance): Ditto. (WebCore::IDBCursor::continueFunction): Ditto. (WebCore::IDBCursor::deleteFunction): Ditto. * Modules/indexeddb/IDBCursor.h: Updated for above changes. * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically. Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBDatabase::transaction): Ditto. (WebCore::IDBDatabase::deleteObjectStore): Ditto. * Modules/indexeddb/IDBDatabase.h: Updated for above changes. * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::open): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBFactory::openInternal): Ditto. (WebCore::IDBFactory::deleteDatabase): Ditto. (WebCore::IDBFactory::cmp): Ditto. * Modules/indexeddb/IDBFactory.h: Updated for above changes. * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBIndex::count): Ditto. (WebCore::IDBIndex::doCount): Ditto. (WebCore::IDBIndex::openKeyCursor): Ditto. (WebCore::IDBIndex::get): Ditto. (WebCore::IDBIndex::doGet): Ditto. (WebCore::IDBIndex::getKey): Ditto. (WebCore::IDBIndex::doGetKey): Ditto. * Modules/indexeddb/IDBIndex.h: Updated for above changes. * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * Modules/indexeddb/IDBKeyRange.cpp: (WebCore::IDBKeyRange::only): Return ExceptionOr instead of using an ExceptionCode out argument. (WebCore::IDBKeyRange::lowerBound): Ditto. (WebCore::IDBKeyRange::upperBound): Ditto. (WebCore::IDBKeyRange::bound): Ditto. * Modules/indexeddb/IDBKeyRange.h: Updated for above changes. * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of MayThrowLegacyException. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBObjectStore::get): Ditto. (WebCore::IDBObjectStore::add): Ditto. (WebCore::IDBObjectStore::put): Ditto. (WebCore::IDBObjectStore::putForCursorUpdate): Ditto. (WebCore::IDBObjectStore::putOrAdd): Ditto. (WebCore::IDBObjectStore::deleteFunction): Ditto. (WebCore::IDBObjectStore::doDelete): Ditto. (WebCore::IDBObjectStore::clear): Ditto. (WebCore::IDBObjectStore::createIndex): Ditto. (WebCore::IDBObjectStore::index): Ditto. (WebCore::IDBObjectStore::deleteIndex): Ditto. (WebCore::IDBObjectStore::count): Ditto. (WebCore::IDBObjectStore::doCount): Ditto. * Modules/indexeddb/IDBObjectStore.h: Updated for above changes. * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::errorCode): Deleted. Was dead code. (WebCore::IDBRequest::error): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. * Modules/indexeddb/IDBRequest.h: Updated for above changes. * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of GetterMayThrowLegacyExceptionWithMessage. * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::stringToMode): Return an Optional instead of using an ExceptionCode out argument, since this function just needs to indicate failure, not actually throw an exception. (WebCore::IDBTransaction::db): Tweaked code a bit. (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr. (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort. (WebCore::IDBTransaction::abort): Return ExceptionOr instead of using an ExceptionCodeWithMessage out argument. (WebCore::IDBTransaction::internalAbort): Added a version that asserts instead of throwing an exception for internal use. (WebCore::IDBTransaction::stop): Call internalAbort. * Modules/indexeddb/IDBTransaction.h: Updated for above changes. * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return a Ref instead of a RefPtr, since the function can never return null. (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto. * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated exception handling to use ExceptionOr instead of ExceptionCodeWithMessage. (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto. * Modules/mediastream/MediaEndpointSessionDescription.cpp: (WebCore::MediaEndpointSessionDescription::create): Ditto. * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change. * bindings/js/JSDOMBinding.cpp: (WebCore::createDOMException): Added overload for Exception. (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage. Updated code to call the new createDOMException function. (WebCore::setDOMExceptionSlow): Ditto. (WebCore::setDOMException): Ditto. * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed interface of toJSNumber and toJSNullableNumber and implemented toJSNumber. * bindings/js/JSDOMPromise.cpp: (WebCore::DeferredPromise::reject): Added overload that takes an Exception. * bindings/js/JSDOMPromise.h: Updated for above change. * bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::pushState): Use propagateException to deal with ExceptionOr instead of ExceptionCodeWithMessage. (WebCore::JSHistory::replaceState): Ditto. * bindings/js/JSIDBDatabaseCustom.cpp: (WebCore::JSIDBDatabase::createObjectStore): Use toJS and to deal with ExceptionOr rather than setDOMException to deal with ExceptionCodeWithMessage. * bindings/js/JSIDBRequestCustom.cpp: (WebCore::JSIDBRequest::result): Use propagateException and Exception rather than setDOMException and ExceptionCodeWithMessage. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage, SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage. (GenerateReturnParameters): Ditto. (GenerateImplementationFunctionCall): Ditto. (GenerateConstructorDefinition): Ditto. * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage, SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage. * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated. * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes. * dom/CustomElementRegistry.idl: Use MayThrowException instead of MayThrowLegacyExceptionWithMessage. * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma once, removed include of WTFString.h and switched to using instead of typedef. * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject to cut down a little on unnecessary reference count churn. * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB classes to use the new versions rather than the old ExceptionCodeWithMessage versions. * page/DOMWindow.cpp: (WebCore::DOMWindow::history): Pass a reference instead of a pointer. * page/History.cpp: (WebCore::History::History): Take a reference instead of a pointer. (WebCore::History::length): Tweaked to use a local variable. (WebCore::History::state): Return a pointer instead of a PassRefPtr. (WebCore::History::stateInternal): Ditto. Also use early return consistently. (WebCore::History::isSameAsCurrentState): Updated for above change. (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an ExceptionCodeWithMessage out argument. * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final. Updated for changes above. * page/History.idl: Use MayThrowException instead of MayThrowLegacyException. 2016-10-07 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level https://bugs.webkit.org/show_bug.cgi?id=163145 Reviewed by Darin Adler. The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless of whether they have been invalidated or not. Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache. Test: fast/dom/NodeList/form-labels-length.html * dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches. * dom/Document.h: * dom/Node.cpp: (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all. We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it is not a safe operation. 2016-10-09 Chris Dumez <cdumez@apple.com> Update generated bindings code so that dictionary structures no longer need explicit constructors https://bugs.webkit.org/show_bug.cgi?id=163188 Reviewed by Darin Adler. Update generated bindings code so that dictionary structures no longer need explicit constructors. We now call the default constructor and then initialize the members one by one. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): (WebCore::convertDictionary<AlternateDictionaryName>): (WebCore::convertDictionary<TestObj::ParentDictionary>): (WebCore::convertDictionary<TestObj::ChildDictionary>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<TestStandaloneDictionary>): * dom/ClipboardEvent.h: * dom/CustomEvent.h: * dom/EventInit.h: (WebCore::EventInit::EventInit): Deleted. * dom/EventModifierInit.h: (WebCore::EventModifierInit::EventModifierInit): Deleted. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * dom/UIEventInit.h: (WebCore::UIEventInit::UIEventInit): Deleted. * editing/Editor.cpp: (WebCore::Editor::dispatchCPPEvent): 2016-10-09 Fujii Hironori <Hironori.Fujii@sony.com> [CMake] CMake does not support the dep files for implicit dependency https://bugs.webkit.org/show_bug.cgi?id=161433 Reviewed by Brent Fulgham. Created a Perl script to generate all IDL bindings for CMake. This script can regenerate outdated bindings by based on the supplemental dependency and dep files created by '--write-dependencies' switch of generate-bindings.pl. add_custom_target is used to invoke the script instead of add_custom_command because Ninja deletes all output files before executing the command in case of add_custom_command. USES_TERMINAL option of add_custom_target has two effects: 1) Not buffering output of the command 2) Invoking the command in the special Ninja pool which inhibits parallel build One needs to use CMake 3.2 or later to enable this feature. * CMakeLists.txt: Specified target names for GENERATE_BINDINGS. Added dependency for the targets. * bindings/scripts/generate-bindings-all.pl: Added. 2016-10-09 Chris Dumez <cdumez@apple.com> Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163176 Reviewed by Darin Adler. Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event] and use a proper constructor instead, like in the specification: - https://www.w3.org/TR/uievents/#interface-keyboardevent Also add support for passing modifierAltGraph / modifierCapsLock in the inialization dictionary as we support those modifiers via getModifierState(). No new tests, extended existing test. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/EventModifierInit.h: Added. (WebCore::EventModifierInit::EventModifierInit): * dom/EventModifierInit.idl: Added. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): (WebCore::KeyboardEvent::getModifierState): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * dom/MouseRelatedEvent.cpp: (WebCore::MouseRelatedEvent::MouseRelatedEvent): * dom/MouseRelatedEvent.h: * dom/UIEvent.cpp: (WebCore::UIEvent::UIEvent): * dom/UIEvent.h: (WebCore::UIEvent::create): Deleted. * dom/UIEventInit.h: Added. (WebCore::UIEventInit::UIEventInit): * dom/UIEventInit.idl: Added. * dom/UIEventWithKeyState.h: (WebCore::UIEventWithKeyState::altGraphKey): (WebCore::UIEventWithKeyState::capsLockKey): (WebCore::UIEventWithKeyState::UIEventWithKeyState): (WebCore::UIEventWithKeyState::ctrlKey): Deleted. (WebCore::UIEventWithKeyState::shiftKey): Deleted. (WebCore::UIEventWithKeyState::altKey): Deleted. (WebCore::UIEventWithKeyState::metaKey): Deleted. 2016-10-09 Youenn Fablet <youenn@apple.com> Promise attribute getters should reject promises in case of casted-this errors https://bugs.webkit.org/show_bug.cgi?id=163167 Reviewed by Darin Adler. Covered by updated test and binding test. * bindings/js/JSDOMBinding.cpp: (WebCore::throwGetterTypeError): (WebCore::rejectPromiseWithGetterTypeError): Added to reject promises for attribute getters * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::attribute): Introducing promise rejection for type cast errors. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSTestObj.cpp: Rebased test. As can be seen, only custom promise attributes are supported. (WebCore::jsTestObjTestReadOnlyPromiseAttribute): (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter): * bindings/scripts/test/TestObj.idl: 2016-10-08 Chris Dumez <cdumez@apple.com> [Mac] Write WebArchive to the pasteboard when copying image in WebKit https://bugs.webkit.org/show_bug.cgi?id=163100 Reviewed by Darin Adler. Write WebArchive to the pasteboard when copying image in WebKit. This fixes pasting such images to a content editable field in WebKit because Web archives take priority over RTFD when reading from the pasteboard in WebKit. Using RTFD when pasting the image in WebKit was causing issues because: 1. The pasted image would not be displayed because our RTFD import code is buggy. 2. The pasted image URL was a webkit-fake-url:// 3. Formatting associated to the image (e.g. inline style) would be lost No new tests, unskipped existing test on WebKit2. * editing/Editor.h: * editing/mac/EditorMac.mm: (WebCore::Editor::imageInWebArchiveFormat): (WebCore::Editor::writeImageToPasteboard): * platform/Pasteboard.h: * platform/mac/PasteboardMac.mm: (WebCore::writableTypesForImage): (WebCore::Pasteboard::write): (WebCore::Pasteboard::Pasteboard): Deleted. (WebCore::Pasteboard::createForCopyAndPaste): Deleted. 2016-10-08 Chris Dumez <cdumez@apple.com> Update CustomEvent to stop using legacy [ConstructorTemplate=Event] https://bugs.webkit.org/show_bug.cgi?id=163174 Reviewed by Darin Adler. Update CustomEvent to stop using legacy [ConstructorTemplate=Event] and use an actual constructor instead, like in the specification: - https://dom.spec.whatwg.org/#interface-customevent There is a very minor behavior change when explictly passing undefined as detail value in CustomEventInit. We used to initialize detail to undefined but we now initialize it to null instead, which is its default value. The new behavior matches the one of Chrome and Firefox. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): * bindings/scripts/test/TestObj.idl: * dom/CustomEvent.cpp: (WebCore::CustomEvent::CustomEvent): * dom/CustomEvent.h: * dom/CustomEvent.idl: * dom/Document.cpp: (WebCore::Document::createEvent): * dom/Event.cpp: (WebCore::Event::Event): * dom/Event.h: 2016-10-08 Chris Dumez <cdumez@apple.com> Add support for ClipboardEvent https://bugs.webkit.org/show_bug.cgi?id=163164 Reviewed by Darin Adler. Add support for ClipboardEvent: - https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces Firefox and Chrome both already support this. This gives us 5 more points on html5test.com. Tests: editing/pasteboard/clipboard-event.html fast/events/clipboard-event-constructor.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSEventCustom.cpp: (WebCore::toJSNewlyCreated): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (WillConvertUndefinedToDefaultParameterValue): We use [] as implicit default value for dictionary parameters. This change is so we call convertDictionary<>() even if the parameter is undefined because we want to pass a struct to the implementation initialized with the default member values defined in the IDL. * dom/ClipboardEvent.cpp: (WebCore::ClipboardEvent::ClipboardEvent): (WebCore::ClipboardEvent::eventInterface): * dom/ClipboardEvent.h: * dom/ClipboardEvent.idl: Added. * dom/Event.cpp: (WebCore::Event::Event): * dom/Event.h: * dom/Event.idl: * dom/EventInit.h: Added. * dom/EventInit.idl: Added. * dom/EventNames.in: * dom/MouseEvent.h: (WebCore::MouseEvent::dataTransfer): * editing/Editor.cpp: (WebCore::Editor::dispatchCPPEvent): 2016-10-06 Darin Adler <darin@apple.com> Next step on moving to modern way to return DOM exceptions https://bugs.webkit.org/show_bug.cgi?id=163016 Reviewed by Ryosuke Niwa. * Modules/fetch/FetchRequest.idl: Added MayThrowException to initializeWith since it throws an exception. * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::invokeCallback): * bindings/js/JSCustomSQLStatementErrorCallback.cpp: (WebCore::JSSQLStatementErrorCallback::handleEvent): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMBinding.cpp: (WebCore::reportException): (WebCore::reportCurrentException): * bindings/js/JSErrorHandler.cpp: (WebCore::JSErrorHandler::handleEvent): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSMutationCallback.cpp: (WebCore::JSMutationCallback::call): * bindings/js/JSNodeFilterCustom.cpp: (WebCore::JSNodeFilter::acceptNode): * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::executeFunctionInContext): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::evaluate): * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::reportException): Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception, or in some cases use auto instead. * bindings/js/JSDOMBinding.cpp: (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString for clarity. (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro. (WebCore::propagateExceptionSlowPath): Added. (WebCore::propagateException): Added. (WebCore::setDOMException): Removed overload that takes an exception code and message string separately; no longer needed. * bindings/js/JSDOMBinding.h: Include the ExceptionOr header rather than forward declaring. Added more of the ExceptionOr handling functions; some just declared and not yet defined. Updated for changes to ExceptionOr interface. Removed the createDOMException function that takes only an exception code; not needed outside JSDOMBinding.cpp. * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead of ExceptionCode. Added some FIXMEs as well. (WebCore::JSXMLHttpRequest::responseText): Ditto. (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Fixed if statements to follow WebKit coding style rather than using extra braces. Added call to propagateException for SetterMayThrowException. (GenerateSerializerFunction): Fixed if statements as above. (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with void return type and MayThrowException. (GenerateReturnParameters): Tweaked coding style a bit. (addIterableProperties): Fixed if statements as above. (NativeToJSValue): Added code to handle various cases of GetterMayThrowException and MayThrowException. (GenerateConstructorDefinition): Used encodedJSValue() instead of JSValue::encode(JSValue()), a longer way to say the same thing. * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException, MayThrowException, and SetterMayThrowException. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSattribute.cpp: Regenerated results. * bindings/scripts/test/TestObj.idl: Added some test cases. * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocumentType): Tweaked formatting. (WebCore::DOMImplementation::createDocument): Ditto. * dom/DOMImplementation.idl: Added MayThrowException to two functions since I am abandoning, for now, the ability to throw exceptions without any extended attribute in the IDL file. This feature may return at some point if we figure out a way to do it for functions without return values as well as functions with. * dom/Document.cpp: (WebCore::Document::exitPointerLock): Rewrote to streamline logic. (WebCore::Document::pointerLockElement): Ditto. (WebCore::Document::inputCursor): Added. No need for this to be inlined. (WebCore::Document::setInputCursor): Changed to take Ref&&. (WebCore::Document::getSelection): Added. Moved here from TreeScope. * dom/Document.h: Updated for above changes. * dom/Document.idl: Tweaked formatting. * dom/Exception.h: Merged the two constructors into one with a default argument value, which should be equally efficient. Added releaseMessage function. Added assertion that this is only created for actual exceptions with non-zero ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no exception, we do not create an Exception if there is no exception. * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced exceptionCode and exceptionMessage with releaseException. Added ExceptionOr<void> specialization. * dom/TreeScope.cpp: (WebCore::TreeScope::~TreeScope): Removed code dealing with m_selection, which is now in Document. (WebCore::TreeScope::getSelection): Deleted. * dom/TreeScope.h: Removed DOMSelection. * page/DOMSelection.cpp: (WebCore::selectionShadowAncestor): Changed to take a reference rather than a guaranteed-non-null pointer. (WebCore::DOMSelection::DOMSelection): Changed to take a Frame& instead of of a TreeScope*. (WebCore::DOMSelection::clearTreeScope): Deleted. (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor. (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid of case where this returns a null string. Use ASCIILiteral. (WebCore::DOMSelection::rangeCount): Streamlined code. (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for null which is already handled by the isValidForPosition function. Removed non-helpful FIXME. (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of ExceptionCode. (WebCore::DOMSelection::collapseToStart): Ditto. (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame for null which is already handled by the isValidForPosition function. Removed non-helpful FIXME. (WebCore::DOMSelection::setPosition): Ditto. (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of ExceptionCode. (WebCore::DOMSelection::getRangeAt): Ditto. (WebCore::DOMSelection::isValidForPosition): Changed to return false when m_frame is null rather than asserting is is non-null and having every caller check m_frame before calling this. * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded comments. Use ExceptionOr rather than ExceptionCode. * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException. * page/DOMWindow.cpp: (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically to make it more obvious if any are accidentally omitted or listed twice. (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns the selection like all the other objects, rather than having it be owned by the document instead. * page/DOMWindow.h: Added m_selection, sorted all the other related properties alphabetically so it's easy to compare the list here with elsewhere. * replay/ReplayController.cpp: (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor with a reference rather than a pointer. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode. (WebCore::XMLHttpRequest::responseXML): Ditto. (WebCore::XMLHttpRequest::setTimeout): Ditto. (WebCore::XMLHttpRequest::setResponseType): Ditto. (WebCore::XMLHttpRequest::setWithCredentials): Ditto. (WebCore::XMLHttpRequest::open): Ditto. (WebCore::XMLHttpRequest::prepareToSend): Changed to return an Optional<ExceptionOr> to reflect the three different states: an exception, a value to return without sending, or "continue with the send algorithm". The old code did this with a boolean plus an exception code. This sounds confusing but is easy to read at the call sites, so probably OK to keep. (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode. (WebCore::XMLHttpRequest::sendBytesData): Ditto. (WebCore::XMLHttpRequest::createRequest): Ditto. (WebCore::XMLHttpRequest::overrideMimeType): Ditto. (WebCore::XMLHttpRequest::setRequestHeader): Ditto. * xml/XMLHttpRequest.h: Updated for changes above. * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically. Changed from MayThrowLegacyException to MayThrowException. 2016-10-06 Sam Weinig <sam@webkit.org> Autogenerate passing union types as part of a functions variadic arguments https://bugs.webkit.org/show_bug.cgi?id=162919 Reviewed by Darin Adler. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: Remove deleted files. * bindings/generic/IDLTypes.h: Switch to use std::reference_wrapper as it's implementation type. We may need more granularity here in the future, but this will work for now. * bindings/js/JSCharacterDataCustom.cpp: Removed. * bindings/js/JSDocumentTypeCustom.cpp: Removed. * bindings/js/JSNodeOrString.cpp: Removed. * bindings/js/JSNodeOrString.h: Removed. * bindings/js/JSDOMBinding.h: (WebCore::VariadicHelperBase::convert): Deleted. (WebCore::toArguments): Deleted. Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make it work in terms of IDLTypes. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLInterface<T>>::convert): (WebCore::VariadicConverterBase::convert): (WebCore::VariadicConverterBase<IDLInterface<T>>::convert): (WebCore::convertVariadicArguments): * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::prepend): Deleted. (WebCore::JSDocument::append): Deleted. * bindings/js/JSDocumentFragmentCustom.cpp: (WebCore::JSDocumentFragment::prepend): Deleted. (WebCore::JSDocumentFragment::append): Deleted. * bindings/js/JSElementCustom.cpp: (WebCore::JSElement::before): Deleted. (WebCore::JSElement::after): Deleted. (WebCore::JSElement::replaceWith): Deleted. (WebCore::JSElement::prepend): Deleted. (WebCore::JSElement::append): Deleted. Remove now generated functions. * bindings/scripts/CodeGenerator.pm: (assert): Add assert to help debugging. (ParseInterface): Don't treat union types as interfaces. (GetFlattenedMemberTypes): (GetNumberOfNullableMemberTypes): (GetIDLUnionMemberTypes): Implement WebIDL algorithms for getting the flattened member list of union, and use it to construct the c++ IDLType. (GetBaseIDLType): (GetIDLType): Add helper to convert an parsed idlType to a c++ IDLType. (IsWrapperType): Don't treat union types as wrappers. * bindings/scripts/CodeGeneratorJS.pm: (AddToImplIncludesForIDLType): Add helper for adding #includes based on a parsed idlType. It recursively handles union types. (GenerateParametersCheck): Use the new convertVariadicArguments function to handle all variadic arguments, including union types. * bindings/scripts/IDLParser.pm: (parseDictionaryMember): (parseAttributeRest): (parseOptionalOrRequiredArgument): (parseExceptionField): Add an idlType to domSignature and populate it. * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13): (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod): (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod): (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod): (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::constructJSTestOverloadedConstructors5): * bindings/scripts/test/TestObj.idl: Add and update tests. * dom/ChildNode.idl: * dom/ParentNode.idl: Remove Custom extended attribute. * dom/ContainerNode.cpp: * dom/ContainerNode.h: * dom/Node.cpp: * dom/Node.h: Switch to using std::reference_wrapper instead of Ref<> for passed in parameters. 2016-10-08 Youenn Fablet <youenn@apple.com> [Fetch API] Request constructor should provide exception messages https://bugs.webkit.org/show_bug.cgi?id=162382 Reviewed by Darin Adler. No change of behavior, except that exceptions now have error messages. Added support of exception messages to ExceptionOr. Making use of ExceptionOr for Request constructor parameter checking. * Modules/fetch/FetchRequest.cpp: (WebCore::setReferrerPolicy): (WebCore::setMode): (WebCore::setCredentials): (WebCore::setCache): (WebCore::setRedirect): (WebCore::setMethod): (WebCore::setReferrer): (WebCore::buildOptions): (WebCore::FetchRequest::initializeOptions): (WebCore::FetchRequest::initializeWith): * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchRequest.idl: * bindings/js/JSDOMBinding.cpp: (WebCore::setDOMException): * bindings/js/JSDOMBinding.h: (WebCore::toJS): (WebCore::toJSNewlyCreated): * dom/Exception.h: (WebCore::Exception::code): (WebCore::Exception::message): (WebCore::Exception::Exception): * dom/ExceptionOr.h: (WebCore::ExceptionOr<ReturnType>::exceptionMessage): 2016-10-08 Youenn Fablet <youenn@apple.com> Refactor binding generated casted-this checks https://bugs.webkit.org/show_bug.cgi?id=162677 Reviewed by Darin Adler. No change of behavior. Split the attribute getter function in two, one with the signature expected by JSCore and one used after casted-this checks. The second function takes directly a JSXX object and returns a JSValue instead of an EncodedJSValue. In the future, the second function should only take references. Introducing BindingCaller as a way to templatize binding code used to cast thisValue with the desired JSXX value. This allows implementing the first function using the second function as template parameter. Introducing JSClass::castForAttribute as a way to encapsulate differences in the way to handle thisValue access. * bindings/js/JSDOMBinding.h: (WebCore::BindingCaller::attribute): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.h: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestException.h: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterface.h: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNode.h: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSTestTypedefs.h: * bindings/scripts/test/JS/JSattribute.cpp: * bindings/scripts/test/JS/JSattribute.h: 2016-10-08 Enrique Ocaña González <eocanha@igalia.com> Missing include in MediaDescription https://bugs.webkit.org/show_bug.cgi?id=162873 Reviewed by Xabier Rodriguez-Calvar. Added missing header. * platform/MediaDescription.h: 2016-10-08 Antti Koivisto <antti@apple.com> Move StyleResolver ownership from Document/ShadowRoot to Style::Scope https://bugs.webkit.org/show_bug.cgi?id=163148 Reviewed by Andreas Kling. Reduce duplication between Document and ShadowRoot. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::didMutateRules): * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::matchHostPseudoClassRules): (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules): * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::documentElementUserAgentStyle): * css/StyleMedia.cpp: (WebCore::StyleMedia::matchMedium): * css/parser/SizesAttributeParser.cpp: (WebCore::SizesAttributeParser::mediaConditionMatches): * dom/Document.cpp: (WebCore::Document::~Document): (WebCore::Document::childrenChanged): (WebCore::Document::isPageBoxVisible): (WebCore::Document::pageSizeAndMarginsInPixels): (WebCore::Document::userAgentShadowTreeStyleResolver): (WebCore::Document::fontsNeedUpdate): (WebCore::Document::didClearStyleResolver): (WebCore::Document::updateViewportUnitsOnResize): (WebCore::Document::createStyleResolver): Deleted. (WebCore::Document::clearStyleResolver): Deleted. * dom/Document.h: (WebCore::Document::styleResolverIfExists): Deleted. (WebCore::Document::ensureStyleResolver): Deleted. * dom/Element.cpp: (WebCore::Element::styleResolver): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::styleResolver): Deleted. (WebCore::ShadowRoot::styleResolverIfExists): Deleted. (WebCore::ShadowRoot::resetStyleResolver): Deleted. * dom/ShadowRoot.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::getMatchedCSSRules): * page/FrameView.cpp: (WebCore::FrameView::layout): * page/Page.cpp: (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): * page/PrintContext.cpp: (WebCore::PrintContext::pageProperty): * platform/MemoryPressureHandler.cpp: (WebCore::MemoryPressureHandler::releaseCriticalMemory): * style/AttributeChangeInvalidation.cpp: (WebCore::Style::mayBeAffectedByHostStyle): * style/ClassChangeInvalidation.cpp: (WebCore::Style::mayBeAffectedByHostStyle): * style/IdChangeInvalidation.cpp: (WebCore::Style::mayBeAffectedByHostStyle): * style/StyleScope.cpp: (WebCore::Style::Scope::resolver): (WebCore::Style::Scope::resolverIfExists): (WebCore::Style::Scope::clearResolver): (WebCore::Style::Scope::analyzeStyleSheetChange): (WebCore::Style::Scope::updateActiveStyleSheets): (WebCore::Style::Scope::updateStyleResolver): (WebCore::Style::Scope::styleResolver): Deleted. (WebCore::Style::Scope::styleResolverIfExists): Deleted. * style/StyleScope.h: * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::resolve): (WebCore::Style::SharingResolver::canShareStyleWithElement): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::Scope::Scope): (WebCore::Style::TreeResolver::resolve): 2016-10-07 Chris Dumez <cdumez@apple.com> window.navigator.language incorrectly returns all lowercase string https://bugs.webkit.org/show_bug.cgi?id=163096 Reviewed by Darin Adler. Update navigator.language so that it no longer returns an all lowercase string (e.g. 'en-us' -> 'en-US'). This matches the behavior of other browsers and the specification which indicate we should return a BCP 47 language tag: - https://html.spec.whatwg.org/#dom-navigator-language - https://tools.ietf.org/html/bcp47 The other call sites relying on userPreferredLanguages() use case insensitive comparison so they will not break. No new tests, updated existing test. * platform/Language.h: 2016-10-07 Wenson Hsieh <wenson_hsieh@apple.com> Support onbeforeinput event handling for the new InputEvent spec https://bugs.webkit.org/show_bug.cgi?id=163021 <rdar://problem/28658073> Reviewed by Darin Adler. Adds support for parsing the onbeforeinput attribute, and for sending default-preventable `beforeinput` InputEvents to the page. To do this, we introduce two new virtual methods: willApplyCommand and didApplyCommand on the CompositeEditCommand that are called before and after CompositeEditCommand::doApply, respectively. willApplyCommand indicates whether or not the composite editor command should proceed with applying the command. Tweaks existing layout tests and adds new tests. Tests: fast/events/before-input-events-different-start-end-elements.html fast/events/before-input-events-prevent-default-in-textfield.html fast/events/before-input-events-prevent-default.html * dom/Document.idl: * dom/Element.idl: * dom/EventNames.h: * dom/Node.cpp: (WebCore::Node::dispatchInputEvent): (WebCore::Node::defaultEventHandler): Currently, we fire input events in Node in response to dispatching a webkitEditableContentChangedEvent. After some discussion, Ryosuke and I believe that it will be ok to instead directly dispatch the input event where we would normally dispatch a webkitEditableContentChangedEvent. * editing/CompositeEditCommand.cpp: (WebCore::EditCommandComposition::unapply): (WebCore::EditCommandComposition::reapply): Added calls to Editor::willUnapplyEditing and Editor::willReapplyEditing. (WebCore::CompositeEditCommand::willApplyCommand): (WebCore::CompositeEditCommand::apply): (WebCore::CompositeEditCommand::didApplyCommand): Added new virtual functions, willApplyCommand and didApplyCommand, that surround a call to CompositeEditCommand::doApply. By default, they call willApplyEditing and appliedEditing on the editor, but may be overridden in special cases, such as in TypingCommand, where we invoke appliedEditing after adding a new typing command to the last open command. If willApplyCommand returns false, CompositeEditCommand::apply will bail and not proceed with the command. * editing/CompositeEditCommand.h: * editing/Editor.cpp: (WebCore::dispatchBeforeInputEvent): (WebCore::dispatchBeforeInputEvents): (WebCore::dispatchInputEvents): (WebCore::Editor::willApplyEditing): (WebCore::Editor::appliedEditing): (WebCore::Editor::willUnapplyEditing): (WebCore::Editor::unappliedEditing): (WebCore::Editor::willReapplyEditing): (WebCore::Editor::reappliedEditing): (WebCore::Editor::computeAndSetTypingStyle): (WebCore::dispatchEditableContentChangedEvents): Deleted. * editing/Editor.h: * editing/TypingCommand.cpp: (WebCore::TypingCommand::willApplyCommand): (WebCore::TypingCommand::didApplyCommand): (WebCore::TypingCommand::willAddTypingToOpenCommand): (WebCore::TypingCommand::insertTextRunWithoutNewlines): (WebCore::TypingCommand::insertLineBreak): (WebCore::TypingCommand::insertParagraphSeparator): (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent): (WebCore::TypingCommand::deleteKeyPressed): (WebCore::TypingCommand::forwardDeleteKeyPressed): (WebCore::TypingCommand::deleteSelection): These now invoke willAddTypingToOpenCommand before proceeding with creating the command and applying it. The flow is now: - willAddTypingToOpenCommand - create and apply a new command - typingAddedToOpenCommand * editing/TypingCommand.h: (WebCore::TypingCommand::preservesTypingStyle): Deleted. (WebCore::TypingCommand::shouldRetainAutocorrectionIndicator): Deleted. (WebCore::TypingCommand::setShouldRetainAutocorrectionIndicator): Deleted. (WebCore::TypingCommand::shouldStopCaretBlinking): Deleted. * html/HTMLAttributeNames.in: * html/HTMLElement.cpp: (WebCore::HTMLElement::createEventHandlerNameMap): 2016-10-07 Nan Wang <n_wang@apple.com> AX: <figcaption> should be AXTitleUIElement for other content inside the <figure> https://bugs.webkit.org/show_bug.cgi?id=108996 Reviewed by Chris Fleizach. Exposed the figcaption element to be the AXTitleUIElement for the figure element. And used the figcaption's content as the accessible name of the figure. Also, updated the figure element's role description on Mac. Accessible name and description calculation for figure elements: https://w3c.github.io/html-aam/#figure-and-figcaption-elements Test: accessibility/mac/figure-element.html * English.lproj/Localizable.strings: * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::captionForFigure): (WebCore::AccessibilityNodeObject::alternativeText): * accessibility/AccessibilityNodeObject.h: * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isFigure): (WebCore::AccessibilityObject::isSuperscriptStyleGroup): Deleted. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::exposesTitleUIElement): (WebCore::AccessibilityRenderObject::titleUIElement): (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper roleDescription]): * platform/LocalizedStrings.cpp: (WebCore::AXFigureText): * platform/LocalizedStrings.h: * platform/efl/LocalizedStringsEfl.cpp: (WebCore::AXFigureText): * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::AXFigureText): 2016-10-07 Alex Christensen <achristensen@webkit.org> Non-special URL fragments should percent-encode non-ASCII characters https://bugs.webkit.org/show_bug.cgi?id=163153 Reviewed by Tim Horton. This is needed to keep compatibility with data URLs with non-ASCII characters after a '#' which works in Chrome, Firefox, and Safari, while maintaining compatibility with Chrome, IE, and Edge which keep non-ASCII characters in the fragments of special URLs. This was proposed to the spec in https://github.com/whatwg/url/issues/150 Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::syntaxViolation): Removed assertion because we now have fragments that need percent encoding but are all ASCII. (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parse): 2016-10-07 Brent Fulgham <bfulgham@apple.com> EventHandler functions that need to guarantee event handler lifetime need to use Ref<Frame> https://bugs.webkit.org/show_bug.cgi?id=98617 <rdar://problem/12778649> Reviewed by Daniel Bates. Improve stability by ensuring that the Frame holding an active EventHandler is kept alive while in the process of handling events and executing JavaScript. No new tests since there is no change in behavior. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEventSingleClick): Protect the Frame with a Ref<>. (WebCore::EventHandler::handleMousePressEvent): Ditto. (WebCore::EventHandler::handleMouseDraggedEvent): Ditto. (WebCore::EventHandler::eventMayStartDrag): Ditto. (WebCore::EventHandler::handleMouseReleaseEvent): Ditto. (WebCore::EventHandler::hitTestResultAtPoint): Ditto. (WebCore::EventHandler::scrollRecursively): Ditto. (WebCore::EventHandler::logicalScrollRecursively): Ditto. (WebCore::EventHandler::selectCursor): Ditto. (WebCore::EventHandler::handleMouseDoubleClickEvent): Ditto. (WebCore::EventHandler::mouseMoved): Ditto. (WebCore::EventHandler::handleMouseMoveEvent): Ditto. (WebCore::EventHandler::handleMouseForceEvent): Ditto. (WebCore::EventHandler::dispatchDragEvent): Ditto. (WebCore::EventHandler::updateDragAndDrop): Ditto. (WebCore::EventHandler::cancelDragAndDrop): Ditto. (WebCore::EventHandler::performDragAndDrop): Ditto. (WebCore::EventHandler::prepareMouseEvent): Ditto. (WebCore::EventHandler::updateMouseEventTargetNode): Ditto. (WebCore::EventHandler::dispatchMouseEvent): Ditto. (WebCore::EventHandler::platformCompleteWheelEvent): Ditto. (WebCore::EventHandler::handleWheelEvent): Ditto. (WebCore::EventHandler::defaultWheelEventHandler): Ditto. (WebCore::EventHandler::sendContextMenuEvent): Ditto. (WebCore::EventHandler::sendContextMenuEventForKey): Ditto. (WebCore::EventHandler::hoverTimerFired): Ditto. (WebCore::EventHandler::keyEvent): Ditto. (WebCore::EventHandler::defaultKeyboardEventHandler): Ditto. (WebCore::EventHandler::handleDrag): Ditto. (WebCore::EventHandler::handleTextInputEvent): Ditto. (WebCore::EventHandler::defaultSpaceEventHandler): Ditto. (WebCore::EventHandler::defaultTabEventHandler): Ditto. (WebCore::EventHandler::sendScrollEvent): Ditto. (WebCore::EventHandler::handleTouchEvent): Ditto. * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::focusDocumentView): Ditto. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformCompleteWheelEvent): Ditto. 2016-10-07 Chris Dumez <cdumez@apple.com> Regression(r201970): productSub / vendor / vendorSub should not be exposed on WorkerNavigator https://bugs.webkit.org/show_bug.cgi?id=163124 Reviewed by Ryosuke Niwa. productSub / vendor / vendorSub should not be exposed on WorkerNavigator: - https://html.spec.whatwg.org/#navigatorid Test case: - http://w3c-test.org/submissions/3881/html/webappapis/system-state-and-capabilities/the-navigator-object/NavigatorID.worker Note that the specification also restricts NavigatorID's appCodeName and product attributes to Window. However, it seems the HTML specification is about to get updated so that these get exposed to workers: - https://github.com/whatwg/html/pull/1870 No new tests, updated existing test. * bindings/scripts/generate-bindings.pl: (shouldPropertyBeExposed): * page/NavigatorID.idl: 2016-10-07 Alex Christensen <achristensen@webkit.org> Disable URLParser logs by default in all builds https://bugs.webkit.org/show_bug.cgi?id=163135 Reviewed by Brady Eidson. In debug builds with the URLParser enabled, some tests time out because parameters to generate log strings are being evaluated for each character of each URL and then not being used if URLParser logs are disabled. Generating these unused parameters is too slow even for debug builds. Let's only generate them if they are to be used. No change in behaviour. * platform/URLParser.cpp: (WebCore::URLParser::parse): (WebCore::URLParser::allValuesEqual): 2016-10-07 Andreas Kling <akling@apple.com> [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache. <https://webkit.org/b/163098> <rdar://problem/28663488> Reviewed by Antti Koivisto. Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired. Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks. The fix is just to switch the order of those two lines. This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that were relying on didRemoveFrameFromHierarchy to release their isolated worlds. Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache * history/CachedFrame.cpp: (WebCore::CachedFrame::destroy): 2016-10-07 Nan Wang <n_wang@apple.com> AX: AXRoleDescription for details and summary elements https://bugs.webkit.org/show_bug.cgi?id=163094 Reviewed by Chris Fleizach. details and summary elements should have AXRoleDescription that is consistent with other elements that have custom AXSubRole. Test: accessibility/mac/details-summary-role-description.html * English.lproj/Localizable.strings: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper roleDescription]): * platform/LocalizedStrings.cpp: (WebCore::AXDetailsText): (WebCore::AXSummaryText): * platform/LocalizedStrings.h: * platform/efl/LocalizedStringsEfl.cpp: (WebCore::AXDetailsText): (WebCore::AXSummaryText): * platform/gtk/LocalizedStringsGtk.cpp: (WebCore::AXDetailsText): (WebCore::AXSummaryText): 2016-10-07 Ryan Haddad <ryanhaddad@apple.com> Fix the Windows build after r206917. Unreviewed build fix. * dom/DOMAllInOne.cpp: 2016-10-07 Antti Koivisto <antti@apple.com> Rename AuthorStyleSheets to Style::Scope https://bugs.webkit.org/show_bug.cgi?id=163108 Reviewed by Andreas Kling. It represents the style scope in DOM. Also move the file under style/. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::styleSheetScope): * css/CSSStyleSheet.h: * css/InspectorCSSOMWrappers.cpp: (WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets): * css/InspectorCSSOMWrappers.h: * css/StyleSheetList.cpp: (WebCore::StyleSheetList::styleSheets): (WebCore::StyleSheetList::detachFromDocument): * dom/AuthorStyleSheets.cpp: Removed. * dom/AuthorStyleSheets.h: Removed. * dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::setContentLanguage): (WebCore::Document::recalcStyle): (WebCore::Document::needsStyleRecalc): (WebCore::Document::updateStyleIfNeeded): (WebCore::Document::updateLayoutIgnorePendingStylesheets): (WebCore::Document::createStyleResolver): (WebCore::Document::didRemoveAllPendingStylesheet): (WebCore::Document::usesStyleBasedEditability): (WebCore::Document::processHttpEquiv): (WebCore::Document::preferredStylesheetSet): (WebCore::Document::selectedStylesheetSet): (WebCore::Document::setSelectedStylesheetSet): (WebCore::Document::haveStylesheetsLoaded): * dom/Document.h: (WebCore::Document::styleScope): (WebCore::Document::authorStyleSheets): Deleted. * dom/ExtensionStyleSheets.cpp: (WebCore::ExtensionStyleSheets::clearPageUserSheet): (WebCore::ExtensionStyleSheets::updatePageUserSheet): (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache): (WebCore::ExtensionStyleSheets::addUserStyleSheet): (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting): (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::insertedIntoDocument): (WebCore::InlineStyleSheetOwner::removedFromDocument): (WebCore::InlineStyleSheetOwner::clearDocumentData): (WebCore::InlineStyleSheetOwner::createSheet): (WebCore::InlineStyleSheetOwner::sheetLoaded): (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet): * dom/InlineStyleSheetOwner.h: (WebCore::InlineStyleSheetOwner::styleScope): (WebCore::InlineStyleSheetOwner::styleSheetScope): Deleted. * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::~ProcessingInstruction): (WebCore::ProcessingInstruction::checkStyleSheet): (WebCore::ProcessingInstruction::sheetLoaded): (WebCore::ProcessingInstruction::insertedInto): (WebCore::ProcessingInstruction::removedFrom): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::styleResolver): (WebCore::ShadowRoot::styleScope): (WebCore::ShadowRoot::updateStyle): (WebCore::ShadowRoot::authorStyleSheets): Deleted. * dom/ShadowRoot.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::~HTMLLinkElement): (WebCore::HTMLLinkElement::setDisabledState): (WebCore::HTMLLinkElement::parseAttribute): (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::insertedInto): (WebCore::HTMLLinkElement::removedFrom): (WebCore::HTMLLinkElement::addPendingSheet): (WebCore::HTMLLinkElement::removePendingSheet): * html/HTMLStyleElement.cpp: * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets): (WebCore::InspectorCSSAgent::forcePseudoState): (WebCore::InspectorCSSAgent::buildObjectForRule): (WebCore::InspectorCSSAgent::resetPseudoStates): * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setEmulatedMedia): * page/DOMWindow.cpp: (WebCore::DOMWindow::getMatchedCSSRules): * page/Frame.cpp: (WebCore::Frame::setPrinting): * page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::setPagination): (WebCore::FrameView::setViewportSizeForCSSViewportUnits): * page/Page.cpp: (WebCore::Page::setViewMode): (WebCore::Page::setNeedsRecalcStyleInAllFrames): (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames): * style/StyleScope.cpp: Copied from dom/AuthorStyleSheets.cpp. (WebCore::Style::Scope::Scope): (WebCore::Style::Scope::styleResolver): (WebCore::Style::Scope::styleResolverIfExists): (WebCore::Style::Scope::forNode): (WebCore::Style::Scope::removePendingSheet): (WebCore::Style::Scope::addStyleSheetCandidateNode): (WebCore::Style::Scope::removeStyleSheetCandidateNode): (WebCore::Style::Scope::collectActiveStyleSheets): (WebCore::Style::Scope::analyzeStyleSheetChange): (WebCore::Style::Scope::updateActiveStyleSheets): (WebCore::Style::Scope::updateStyleResolver): (WebCore::Style::Scope::activeStyleSheetsForInspector): (WebCore::Style::Scope::activeStyleSheetsContains): (WebCore::Style::Scope::flushPendingUpdate): (WebCore::Style::Scope::clearPendingUpdate): (WebCore::Style::Scope::scheduleActiveSetUpdate): (WebCore::Style::Scope::didChangeCandidatesForActiveSet): (WebCore::Style::Scope::didChangeContentsOrInterpretation): (WebCore::Style::Scope::pendingUpdateTimerFired): (WebCore::AuthorStyleSheets::AuthorStyleSheets): Deleted. (WebCore::AuthorStyleSheets::styleResolver): Deleted. (WebCore::AuthorStyleSheets::styleResolverIfExists): Deleted. (WebCore::AuthorStyleSheets::forNode): Deleted. (WebCore::AuthorStyleSheets::removePendingSheet): Deleted. (WebCore::AuthorStyleSheets::addStyleSheetCandidateNode): Deleted. (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Deleted. (WebCore::AuthorStyleSheets::collectActiveStyleSheets): Deleted. (WebCore::AuthorStyleSheets::analyzeStyleSheetChange): Deleted. (WebCore::AuthorStyleSheets::updateActiveStyleSheets): Deleted. (WebCore::AuthorStyleSheets::updateStyleResolver): Deleted. (WebCore::AuthorStyleSheets::activeStyleSheetsForInspector): Deleted. (WebCore::AuthorStyleSheets::activeStyleSheetsContains): Deleted. (WebCore::AuthorStyleSheets::flushPendingUpdate): Deleted. (WebCore::AuthorStyleSheets::clearPendingUpdate): Deleted. (WebCore::AuthorStyleSheets::scheduleActiveSetUpdate): Deleted. (WebCore::AuthorStyleSheets::didChangeCandidatesForActiveSet): Deleted. (WebCore::AuthorStyleSheets::didChangeContentsOrInterpretation): Deleted. (WebCore::AuthorStyleSheets::pendingUpdateTimerFired): Deleted. * style/StyleScope.h: Copied from dom/AuthorStyleSheets.h. * style/StyleTreeResolver.cpp: * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::rebuildFontFace): (WebCore::SVGFontFaceElement::removedFrom): * xml/XMLTreeViewer.cpp: (WebCore::XMLTreeViewer::transformDocumentToTreeView): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::end): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::doEnd): 2016-10-07 Zalan Bujtas <zalan@apple.com> https://vuldb.com/?cvssv3.2012 takes long time to load. https://bugs.webkit.org/show_bug.cgi?id=162994 <rdar://problem/28593746> Reviewed by Darin Adler. Stop visiting cousins when we hit the style sharing search threshold. In addition to mistakenly ignoring the threshold at SharingResolver::findSibling(), we continued on searching for cousin elements. Test: fast/selectors/slow-style-sharing-with-long-cousin-list.html * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::resolve): (WebCore::Style::SharingResolver::findSibling): (WebCore::Style::SharingResolver::locateCousinList): 2016-10-07 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Implement generic reader functions https://bugs.webkit.org/show_bug.cgi?id=163003 Reviewed by Darin Adler. Implements reader generic functions defined by spec in order to prepare BYOBReader integration. Generic functions factorize some code that is used by both DefaultReader and BYOBReader. No change in behaviour. * Modules/streams/ReadableStreamDefaultReader.js: (cancel): Rely on readableStreamReaderGenericCancel. (releaseLock): Rely on readableStreamReaderGenericRelease. * Modules/streams/ReadableStreamInternals.js: (privateInitializeReadableStreamDefaultReader): Rely on readableStreamReaderGenericInitialize. (readableStreamReaderGenericInitialize): Added. (readableStreamReaderGenericCancel): Added. (readableStreamReaderGenericRelease): Added. 2016-10-07 Adam Bergkvist <adam.bergkvist@ericsson.com> WebRTC: Misc gardening: Use typedefs consistently and remove unused code https://bugs.webkit.org/show_bug.cgi?id=163104 Reviewed by Philippe Normand. Miscellaneous WebRTC gardening. See file list below for details. Testing: No change in behavior. * Modules/mediastream/MediaEndpointPeerConnection.cpp: * Modules/mediastream/MediaEndpointPeerConnection.h: Move NotImplemented include to cpp-file. * platform/mediastream/MediaEndpoint.h: Use MediaPayloadVector typedef (instead of Vector<RefPtr<MediaPayload>>). * platform/mediastream/PeerMediaDescription.h: (WebCore::PeerMediaDescription::source): Deleted. (WebCore::PeerMediaDescription::setSource): Deleted. Sources are passed to updateSendConfiguration() via a source map and not added to each PeerMediaDescription anymore. Remove unused code. * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::getDefaultAudioPayloads): (WebCore::MockMediaEndpoint::getDefaultVideoPayloads): Use MediaPayloadVector typedef. * platform/mock/MockMediaEndpoint.h: Use MediaPayloadVector typedef. 2016-10-07 Gwang Yoon Hwang <yoon@igalia.com> [GTK] Remove unneeded creation of TextureMapperPlatformLayerProxy https://bugs.webkit.org/show_bug.cgi?id=163101 Reviewed by Žan Doberšek. Covered by existing tests. * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBufferData::ImageBufferData): Modified not to create TextureMapperPlatformLayerProxy if it is not created for the accelerated 2d canvas. 2016-10-07 Fujii Hironori <Hironori.Fujii@sony.com> Use 'use lib $FindBin::Bin' to append Perl module include path https://bugs.webkit.org/show_bug.cgi?id=162256 Reviewed by Carlos Garcia Campos. Some Perl scripts are needed to be executed with '-I' switch to explicitly append Perl module include path. Use 'use lib' as well as other Perl scripts do. * CMakeLists.txt: Removed '-I' options from invocation of Perl. * DerivedSources.make: Ditto. * bindings/scripts/generate-bindings.pl: Use 'use lib'. * bindings/scripts/preprocess-idls.pl: Ditto. * css/make-css-file-arrays.pl: Ditto. * css/makegrammar.pl: Ditto. * css/makeprop.pl: Ditto. * css/makevalues.pl: Ditto. * dom/make_dom_exceptions.pl: Ditto. * dom/make_event_factory.pl: Ditto. * dom/make_names.pl: Ditto. * page/make_settings.pl: Ditto. 2016-10-07 Youenn Fablet <youenn@apple.com> Refactor CachedResourceClient::notifyFinished https://bugs.webkit.org/show_bug.cgi?id=162060 Reviewed by Darin Adler. No change of behavior. Making CachedResourceClient and CachedRawResourceClient callbacks take CachedResource references and not pointers. In most cases, the CachedResource parameter is only used for assertions. Removing that parameter might be contemplated in the future. The only real case is in RenderImage. Removed the CachedResource parameter from ContentFilter methods as code was calling these methods with null values. * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::notifyFinished): * dom/LoadableClassicScript.h: * html/HTMLImageLoader.cpp: (WebCore::HTMLImageLoader::notifyFinished): * html/HTMLImageLoader.h: * loader/ContentFilter.cpp: (WebCore::ContentFilter::continueAfterResponseReceived): (WebCore::ContentFilter::continueAfterDataReceived): (WebCore::ContentFilter::continueAfterNotifyFinished): (WebCore::ContentFilter::deliverResourceData): * loader/ContentFilter.h: * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::notifyFinished): * loader/CrossOriginPreflightChecker.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::notifyFinished): (WebCore::DocumentLoader::handleSubstituteDataLoadNow): (WebCore::DocumentLoader::redirectReceived): (WebCore::DocumentLoader::responseReceived): (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::dataReceived): * loader/DocumentLoader.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): (WebCore::DocumentThreadableLoader::dataSent): (WebCore::DocumentThreadableLoader::responseReceived): (WebCore::DocumentThreadableLoader::dataReceived): (WebCore::DocumentThreadableLoader::notifyFinished): * loader/DocumentThreadableLoader.h: * loader/ImageLoader.cpp: (WebCore::ImageLoader::notifyFinished): * loader/ImageLoader.h: * loader/LinkLoader.cpp: (WebCore::LinkLoader::triggerEvents): (WebCore::LinkLoader::notifyFinished): * loader/LinkLoader.h: * loader/LinkPreloadResourceClients.cpp: (WebCore::LinkPreloadResourceClient::triggerEvents): * loader/LinkPreloadResourceClients.h: * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::responseReceived): (WebCore::MediaResource::shouldCacheResponse): (WebCore::MediaResource::redirectReceived): (WebCore::MediaResource::dataSent): (WebCore::MediaResource::dataReceived): (WebCore::MediaResource::notifyFinished): (WebCore::MediaResource::getOrCreateReadBuffer): * loader/MediaResourceLoader.h: * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::processNewCueData): (WebCore::TextTrackLoader::deprecatedDidReceiveCachedResource): (WebCore::TextTrackLoader::notifyFinished): * loader/TextTrackLoader.h: * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::notifyClientsDataWasReceived): (WebCore::CachedRawResource::didAddClient): (WebCore::CachedRawResource::redirectReceived): (WebCore::CachedRawResource::responseReceived): (WebCore::CachedRawResource::shouldCacheResponse): (WebCore::CachedRawResource::didSendData): * loader/cache/CachedRawResourceClient.h: (WebCore::CachedRawResourceClient::dataSent): (WebCore::CachedRawResourceClient::responseReceived): (WebCore::CachedRawResourceClient::shouldCacheResponse): (WebCore::CachedRawResourceClient::dataReceived): (WebCore::CachedRawResourceClient::redirectReceived): (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::checkNotify): (WebCore::CachedResource::didAddClient): * loader/cache/CachedResourceClient.h: (WebCore::CachedResourceClient::notifyFinished): (WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource): * loader/cache/CachedTextTrack.cpp: (WebCore::CachedTextTrack::updateData): * loader/icon/IconLoader.cpp: (WebCore::IconLoader::notifyFinished): * loader/icon/IconLoader.h: * loader/soup/CachedRawResourceSoup.cpp: * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp: (WebCore::WebCoreAVCFResourceLoader::responseReceived): (WebCore::WebCoreAVCFResourceLoader::dataReceived): (WebCore::WebCoreAVCFResourceLoader::notifyFinished): (WebCore::WebCoreAVCFResourceLoader::fulfillRequestWithResource): * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h: * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h: * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::responseReceived): (WebCore::WebCoreAVFResourceLoader::dataReceived): (WebCore::WebCoreAVFResourceLoader::notifyFinished): (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource): * rendering/RenderImage.cpp: (WebCore::RenderImage::notifyFinished): * rendering/RenderImage.h: * rendering/RenderLayerFilterInfo.cpp: (WebCore::RenderLayer::FilterInfo::setRenderer): (WebCore::RenderLayer::FilterInfo::notifyFinished): * rendering/RenderLayerFilterInfo.h: * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::notifyFinished): * svg/SVGFEImageElement.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::notifyFinished): * svg/SVGUseElement.h: * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::notifyFinished): * xml/parser/XMLDocumentParser.h: 2016-10-06 Youenn Fablet <youenn@apple.com> CachedXSLStylesheet does not need to be updated according Origin/Fetch mode https://bugs.webkit.org/show_bug.cgi?id=162389 Reviewed by Darin Adler. No change of behavior. Making clear that there is no reason to update cached XSLT resources according the origin, given that CORS is never checked and loading is always same-origin. Renaming CachedResource::isClean to CachedResource::isCORSSameOrigin to better match spec terminology. Updating HTMLLinkElement accordingly. * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::initializeStyleSheet): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::isCORSSameOrigin): Ensuring that this method is not called for resource types for which CORS is not to be used. (WebCore::CachedResource::isClean): Deleted. * loader/cache/CachedResource.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): 2016-10-06 Youenn Fablet <youenn@apple.com> Add a place for common HTTP Header values https://bugs.webkit.org/show_bug.cgi?id=163002 Reviewed by Alex Christensen. No change of behavior. Introducing HTTPHeaderValues with two Content-Type values. * CMakeLists.txt: * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): * WebCore.xcodeproj/project.pbxproj: * platform/network/HTTPHeaderValues.cpp: Added. (WebCore::HTTPHeaderValues::TextPlainContentType): (WebCore::HTTPHeaderValues::FormURLEncodedContentType): * platform/network/HTTPHeaderValues.h: Added. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): 2016-10-06 Youenn Fablet <youenn@apple.com> CachedResourceRequest should not need to store defer and preload options https://bugs.webkit.org/show_bug.cgi?id=163004 Reviewed by Alex Christensen. No change of behavior. Removing CachedResourceRequest defer and preload fields. These fields are computed inside CachedResourceLoader instead. Updated setting of priority from CachedResourceRequest to CachedResource. Priority is set for any new resource (this covers all cases where no cached resource can be reused from the memory cache). Priority is set for a cached resource if the request is not a preload request. * loader/LinkLoader.cpp: (WebCore::LinkLoader::preloadIfNeeded): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::canRequest): (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::determineRevalidationPolicy): (WebCore::CachedResourceLoader::requestPreload): * loader/cache/CachedResourceLoader.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::CachedResourceRequest): * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::priority): (WebCore::CachedResourceRequest::forPreload): Deleted. (WebCore::CachedResourceRequest::setForPreload): Deleted. (WebCore::CachedResourceRequest::defer): Deleted. (WebCore::CachedResourceRequest::setDefer): Deleted. 2016-10-06 Myles C. Maxfield <mmaxfield@apple.com> Variation fonts don't affect glyph advances https://bugs.webkit.org/show_bug.cgi?id=163093 Reviewed by Darin Adler. Work around known bug <rdar://problem/28662086>. For variation fonts, CTFontGetAdvancesForGlyphs() gives correct answers but CTFontGetUnsummedAdvancesForGlyphsAndStyle() doesn't. Test: fast/text/variations/advances.html * platform/graphics/FontPlatformData.h: (WebCore::FontPlatformData::hasVariations): * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::platformWidthForGlyph): * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::FontPlatformData::FontPlatformData): 2016-10-06 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r206713. https://bugs.webkit.org/show_bug.cgi?id=163097 triggers apparent codegen bug on ARM 32-bit (Requested by smfr on #webkit). Reverted changeset: "Support transitions/animations of background-position with right/bottom-relative values" https://bugs.webkit.org/show_bug.cgi?id=162048 http://trac.webkit.org/changeset/206713 2016-10-06 Daniel Bates <dabates@apple.com> Remove unused WebCore::contentDispositionType() https://bugs.webkit.org/show_bug.cgi?id=163095 Reviewed by Alex Christensen. The function WebCore::contentDispositionType() was only used by the Chromium and Qt ports to parse the Content-Disposition HTTP header. Both of these ports have long since been removed from the repository. We should remove WebCore::contentDispositionType(). * platform/network/HTTPParsers.cpp: (WebCore::contentDispositionType): Deleted. * platform/network/HTTPParsers.h: 2016-10-06 Ryosuke Niwa <rniwa@webkit.org> Upgrading and constructing element should always report exception instead of rethrowing https://bugs.webkit.org/show_bug.cgi?id=162996 Reviewed by Darin Adler. The latest HTML specification specifies that we must report exceptions thrown during element upgrades: https://html.spec.whatwg.org/#upgrades In addition, F2F during 2016 TPAC had a consensus that we should do the same for document.createElement: https://github.com/w3c/webcomponents/issues/569 Since the HTML parser already reports the exception thrown during custom element construction as it does not have any JS stack, these changes make exceptions thrown during upgrades and constructions. In our implementation, this only reduces the code complexity as now we can push the logic to fallback to HTMLUnknownElement into JSCustomElementInterface's constructElement, which has been renamed to constructElementWithFallback, and eliminate ShouldClearException enum class entirely. Moreover, constructElementWithFallback can now return Ref instead of RefPtr. No new tests. Existing tests have been updated. * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::constructElementWithFallback): Create a HTMLUnknownElement if an attempt to construct a custom element had failed in lieu of returning nullptr. (WebCore::JSCustomElementInterface::tryToConstructCustomElement): Renamed from constructElement. Always report exceptions (the same behavior as ShouldClearException::Clear). (WebCore::JSCustomElementInterface::upgradeElement): Report exceptions instead of rethrowing. * bindings/js/JSCustomElementInterface.h: * dom/Document.cpp: (WebCore::createHTMLElementWithNameValidation): * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): 2016-10-06 Chris Dumez <cdumez@apple.com> Overwriting an attribute event listener can lead to wrong event listener firing order https://bugs.webkit.org/show_bug.cgi?id=163083 Reviewed by Darin Adler. Overwriting an attribute event listener could lead to wrong event listener firing order in WebKit. This is because we were removing the old event listener and then appending the new one instead of actually *replacing* the old one. No new tests, rebaselined existing tests. * dom/EventListenerMap.cpp: (WebCore::EventListenerMap::replace): * dom/EventListenerMap.h: * dom/EventTarget.cpp: (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::hasActiveEventListeners): Deleted. (WebCore::EventTarget::dispatchEventForBindings): Deleted. * dom/EventTarget.h: 2016-10-06 Alex Christensen <achristensen@webkit.org> URLParser: Non-ASCII characters in Non-UTF-8 encoded queries of relative URLs with ws, wss, or nonspecial schemes should be UTF-8 encoded https://bugs.webkit.org/show_bug.cgi?id=163089 Reviewed by Tim Horton. This is a change similar to r206818 but with relative URLs. This matches the spec, URL::parse, and other browsers' behavior. Covered by new API tests for URLParser. This also fixes tests like http/tests/misc/url-in-utf32le.html when URLParser is enabled. * platform/URL.cpp: (WebCore::URL::URL): Use the same encoding for the URL constructor whether or not the URLParser is enabled. * platform/URLParser.cpp: (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::parse): (WebCore::isSpecial): Deleted. * platform/URLParser.h: Use UTF-8 for non-special, ws, or wss schemes. 2016-10-06 Zalan Bujtas <zalan@apple.com> Add back ASSERT(!needsLayout) to RenderTableSection which is now valid https://bugs.webkit.org/show_bug.cgi?id=92954 <rdar://problem/12147973> Reviewed by Dan Bernstein. LayoutTests pass fine now with this assert on. Covered by existing tests. * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::paint): 2016-10-06 Jiewen Tan <jiewen_tan@apple.com> Add a dummy SubtleCrypto interface https://bugs.webkit.org/show_bug.cgi?id=162992 <rdar://problem/28643573> Reviewed by Brent Fulgham. Add a dummy SubtleCrypto interface and rename KeyPair to CryptoKeyPair. Tests: crypto/subtle/gc-2.html crypto/subtle/gc-3.html crypto/subtle/gc.html crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html crypto/webkitSubtle/aes-cbc-generate-key.html crypto/webkitSubtle/aes-cbc-import-jwk.html crypto/webkitSubtle/aes-cbc-invalid-length.html crypto/webkitSubtle/aes-cbc-unwrap-failure.html crypto/webkitSubtle/aes-cbc-unwrap-rsa.html crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html crypto/webkitSubtle/aes-cbc-wrap-rsa.html crypto/webkitSubtle/aes-cbc-wrong-key-class.html crypto/webkitSubtle/aes-export-key.html crypto/webkitSubtle/aes-kw-key-manipulation.html crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html crypto/webkitSubtle/aes-postMessage.html crypto/webkitSubtle/argument-conversion.html crypto/webkitSubtle/array-buffer-view-offset.html crypto/webkitSubtle/crypto-key-algorithm-gc.html crypto/webkitSubtle/crypto-key-usages-gc.html crypto/webkitSubtle/hmac-check-algorithm.html crypto/webkitSubtle/hmac-export-key.html crypto/webkitSubtle/hmac-generate-key.html crypto/webkitSubtle/hmac-import-jwk.html crypto/webkitSubtle/hmac-postMessage.html crypto/webkitSubtle/hmac-sign-verify-empty-key.html crypto/webkitSubtle/hmac-sign-verify.html crypto/webkitSubtle/import-jwk.html crypto/webkitSubtle/jwk-export-use-values.html crypto/webkitSubtle/jwk-import-use-values.html crypto/webkitSubtle/rsa-export-generated-keys.html crypto/webkitSubtle/rsa-export-key.html crypto/webkitSubtle/rsa-export-private-key.html crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html crypto/webkitSubtle/rsa-indexeddb-non-exportable.html crypto/webkitSubtle/rsa-indexeddb-private.html crypto/webkitSubtle/rsa-indexeddb.html crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html crypto/webkitSubtle/rsa-oaep-key-manipulation.html crypto/webkitSubtle/rsa-oaep-plaintext-length.html crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html crypto/webkitSubtle/rsa-postMessage.html crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html crypto/webkitSubtle/sha-1.html crypto/webkitSubtle/sha-224.html crypto/webkitSubtle/sha-256.html crypto/webkitSubtle/sha-384.html crypto/webkitSubtle/sha-512.html crypto/webkitSubtle/unimplemented-unwrap-crash.html crypto/webkitSubtle/unwrapKey-check-usage.html crypto/webkitSubtle/wrapKey-check-usage.html crypto/workers/subtle/aes-postMessage-worker.html crypto/workers/subtle/gc-worker.html crypto/workers/subtle/hmac-postMessage-worker.html crypto/workers/subtle/hrsa-postMessage-worker.html crypto/workers/subtle/multiple-postMessage-worker.html crypto/workers/subtle/rsa-postMessage-worker.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * PlatformEfl.cmake: * PlatformGTK.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * crypto/CryptoKeyPair.idl: * crypto/SubtleCrypto.cpp: (WebCore::SubtleCrypto::SubtleCrypto): * crypto/SubtleCrypto.h: (WebCore::SubtleCrypto::create): * crypto/SubtleCrypto.idl: Added. * page/Crypto.cpp: (WebCore::Crypto::Crypto): (WebCore::Crypto::subtle): * page/Crypto.h: * page/Crypto.idl: 2016-10-06 Anders Carlsson <andersca@apple.com> Crash when ApplePaySession.completeMerchantValidation is not passed a dictionary https://bugs.webkit.org/show_bug.cgi?id=163074 rdar://problem/27824842 Reviewed by Tim Horton. Raise a type error on a null initializer object. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::completeMerchantValidation): 2016-10-06 Antti Koivisto <antti@apple.com> Mutating styleSheet in shadow tree doesn't update the style https://bugs.webkit.org/show_bug.cgi?id=162744 <rdar://problem/28550588> Reviewed by Ryosuke Niwa. We weren't always invalidating the right AuthorStyleSheets (to be renamed) instance for the scope after mutations. Test: fast/shadow-dom/mutating-stylesheet-in-shadow-tree.html * css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::didMutateRules): (WebCore::CSSStyleSheet::didMutate): (WebCore::CSSStyleSheet::clearOwnerNode): (WebCore::CSSStyleSheet::rootStyleSheet): (WebCore::CSSStyleSheet::ownerDocument): (WebCore::CSSStyleSheet::styleSheetScope): Invalidate the right scope after stylesheet mutations. * css/CSSStyleSheet.h: * dom/AuthorStyleSheets.cpp: (WebCore::AuthorStyleSheets::styleResolver): (WebCore::AuthorStyleSheets::styleResolverIfExists): Take care to update the right style resolver. (WebCore::AuthorStyleSheets::forNode): (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Start the update timer so clients don't need to request update separately. (WebCore::AuthorStyleSheets::analyzeStyleSheetChange): (WebCore::AuthorStyleSheets::updateActiveStyleSheets): (WebCore::AuthorStyleSheets::updateStyleResolver): * dom/AuthorStyleSheets.h: * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::insertedIntoDocument): Save the scope we were inserted into so removals can be done reliably. (WebCore::InlineStyleSheetOwner::removedFromDocument): Use and clear the saved scope. Remove didChangeCandidatesForActiveSet() as it is now done by removeStyleSheetCandidateNode() call. (WebCore::InlineStyleSheetOwner::clearDocumentData): (WebCore::InlineStyleSheetOwner::createSheet): (WebCore::InlineStyleSheetOwner::sheetLoaded): (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet): (WebCore::authorStyleSheetsForElement): Deleted. * dom/InlineStyleSheetOwner.h: (WebCore::InlineStyleSheetOwner::styleSheetScope): * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::styleResolverIfExists): * dom/ShadowRoot.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::removedFrom): Remove didChangeCandidatesForActiveSet() as it is now done by removeStyleSheetCandidateNode() call. * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::~HTMLStyleElement): (WebCore::HTMLStyleElement::parseAttribute): Fix a bug where we wouldn't create stylesheet if a style element was activated by removing a media attribute. (WebCore::HTMLStyleElement::insertedInto): (WebCore::HTMLStyleElement::removedFrom): * page/DOMWindow.cpp: (WebCore::DOMWindow::getMatchedCSSRules): * svg/SVGStyleElement.cpp: (WebCore::SVGStyleElement::~SVGStyleElement): (WebCore::SVGStyleElement::insertedInto): (WebCore::SVGStyleElement::removedFrom): 2016-10-06 Alex Christensen <achristensen@webkit.org> Skip tabs and newlines between end of query and beginning of fragment in non-UTF-8-encoded URLs https://bugs.webkit.org/show_bug.cgi?id=163071 Reviewed by Tim Horton. Covered by a new API test that would have asserted before this change. * platform/URLParser.cpp: (WebCore::URLParser::encodeQuery): Skip tabs and newlines before asserting that we are at the end. 2016-10-06 Alex Christensen <achristensen@webkit.org> URLParser should parse file URLs with ports consistently https://bugs.webkit.org/show_bug.cgi?id=163075 Reviewed by Brady Eidson. Covered by API tests. We used to assert when parsing the newly tested URLs. * platform/URLParser.cpp: (WebCore::URLParser::parse): 2016-10-06 Chris Dumez <cdumez@apple.com> [WebIDL] Add support for having dictionaries in their own IDL file https://bugs.webkit.org/show_bug.cgi?id=162912 Reviewed by Darin Adler. Add support for having dictionaries in their own IDL file so that they can be shared by multiple interfaces. Leverage this new support to merge Element::ScrollToOptions and DOMWindow::ScrollToOptions. No new tests, extended bindings tests. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGenerator.pm: (ProcessDocument): (IDLFileForInterface): (GetDictionaryByName): (IsDictionaryType): (HasEnumImplementationNameOverride): Deleted. (GetEnumImplementationNameOverride): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionary): (GetEnumerationClassName): (GenerateEnumerationImplementationContent): (GenerateEnumerationHeaderContent): (GetDictionaryClassName): (GenerateDefaultValue): (GenerateDictionaryHeaderContent): (GenerateDictionariesHeaderContent): (GenerateDictionaryImplementationContent): (GenerateDictionariesImplementationContent): (GenerateHeader): (GenerateImplementation): (GenerateParametersCheck): (GenerateDictionaryHeader): (GenerateDictionaryImplementation): (GenerateCallbackHeader): (GenerateCallbackImplementation): (GetNativeType): (JSValueToNative): (GetNestedClassName): Deleted. (GenerateConversionRuleWithLeadingComma): Deleted. (addIterableProperties): Deleted. * bindings/scripts/preprocess-idls.pl: (containsInterfaceOrExceptionFromIDL): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameter): (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot): Deleted. * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: Added. (WebCore::convertDictionary<TestStandaloneDictionary>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: Added. * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestStandaloneDictionary.idl: Added. * dom/Element.h: * dom/Element.idl: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::scrollTo): * page/DOMWindow.h: * page/DOMWindow.idl: * page/ScrollToOptions.h: Added. * page/ScrollToOptions.idl: Added. 2016-10-06 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix. * platform/graphics/Image.cpp: Add missing include for 'NotImplemented' when building under Direct2D. 2016-10-06 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Add Direct2D CMake rules https://bugs.webkit.org/show_bug.cgi?id=162925 Reviewed by Brent Fulgham. Modify PlatformAppleWin.cmake to conditionally build the CoreGraphics and CoreAnimation implementation, or the Direct2D files, depending on whether the USE_DIRECT2D macro is set in the CMake build options. By default it builds the normal CA/CG way. Add a stub GraphicsLayer implementation for Direct2D. No new tests because there is no change in our active ports. * PlatformAppleWin.cmake: Conditionalize the build for CA/CG or Direct2D. * config.h: Make sure CA is turned of for Direct2D builds. * page/win/FrameWinDirect2D.cpp: Add missing include file. * platform/graphics/win/GraphicsLayerDirect2D.cpp: Added. * platform/graphics/win/GraphicsLayerDirect2D.h: Added. 2016-10-06 Yusuke Suzuki <utatane.tea@gmail.com> [WebCore][JSC] Use new @throwTypeError and @throwRangeError intrinsics https://bugs.webkit.org/show_bug.cgi?id=163001 Reviewed by Keith Miller. Replace `throw new @XXXError(...)` to @throwXXXError intrinsic. It reduces the size of bytecode sequence and facilitate inlining. No behavior change. * Modules/fetch/FetchHeaders.js: (initializeFetchHeaders): * Modules/fetch/FetchInternals.js: (fillFetchHeaders): * Modules/fetch/FetchRequest.js: (initializeFetchRequest): * Modules/fetch/FetchResponse.js: (initializeFetchResponse): (clone): * Modules/mediastream/NavigatorUserMedia.js: (webkitGetUserMedia): * Modules/mediastream/RTCPeerConnection.js: (initializeRTCPeerConnection): (getLocalStreams): (getStreamById): (addStream): * Modules/streams/ReadableStream.js: (initializeReadableStream): (getReader): * Modules/streams/ReadableStreamDefaultController.js: (enqueue): (error): (close): * Modules/streams/ReadableStreamDefaultReader.js: (releaseLock): * Modules/streams/ReadableStreamInternals.js: (privateInitializeReadableStreamDefaultReader): (privateInitializeReadableStreamDefaultController): (doStructuredClone): (readableStreamError): * Modules/streams/StreamInternals.js: (validateAndNormalizeQueuingStrategy): (enqueueValueWithSize): * Modules/streams/WritableStream.js: (initializeWritableStream): (state): * xml/XMLHttpRequest.js: (response): 2016-10-06 John Wilander <wilander@apple.com> Update Resource Load Statistics https://bugs.webkit.org/show_bug.cgi?id=162811 Reviewed by Alex Christensen. No new tests. The counting is based on top privately owned domains which currently is not supported by layout tests nor API tests. * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): Now captures statistics for web sockets too. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadResourceSynchronously): * loader/ResourceLoadObserver.cpp: Now captures statistics for synchronous XHR too. (WebCore::is3xxRedirect): Convenience function. (WebCore::ResourceLoadObserver::shouldLog): Convenience function. (WebCore::ResourceLoadObserver::logFrameNavigation): Updated to make use of new convenience functions. (WebCore::ResourceLoadObserver::logSubresourceLoading): Updated to make use of new convenience functions. (WebCore::ResourceLoadObserver::logWebSocketLoading): Added. (WebCore::ResourceLoadObserver::logUserInteraction): Updated to make use of new convenience functions. (WebCore::ResourceLoadObserver::primaryDomain): Now makes use of the Public Suffix list. Removed old custom parsing of primary domain. * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatisticsStore.cpp: (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Convenience function. (WebCore::ResourceLoadStatisticsStore::processStatistics): Deleted. * loader/ResourceLoadStatisticsStore.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): Moved logging call higher up and added a check for whether we are loading the main resource. The reason for moving it up is to capture the request before some data may be cleared out in redirect handling. We also want to capture failed CORS requests since they are sent and then cancelled on the way back. 2016-10-06 Adam Bergkvist <adam.bergkvist@ericsson.com> WebRTC: Add support for the iceconnectionstatechange event in MediaEndpointPeerConnection https://bugs.webkit.org/show_bug.cgi?id=162961 Reviewed by Eric Carlson. Implement MediaEndpointPeerConnection's iceTransportStateChanged callback. When called, it updates the ICE transport state of the corresponding transceiver and determines if the RTCPeerConnection's aggregated iceConnectionState needs to be updated. Update MediaEndpointMock's emulatePlatformEvent feature to support a new action: "step-ice-transport-states". When initiated, this action replays a predefined set of ICE transport state changes on a set of transceivers which can be observed via the iceTransportStateChanged (mentioned above). Test: fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::deriveAggregatedIceConnectionState): (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): * Modules/mediastream/MediaEndpointPeerConnection.h: * platform/mediastream/MediaEndpoint.h: (WebCore::MediaEndpointClient::~MediaEndpointClient): * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::MockMediaEndpoint): (WebCore::MockMediaEndpoint::emulatePlatformEvent): (WebCore::MockMediaEndpoint::stepIceTransportStates): (WebCore::MockMediaEndpoint::iceTransportTimerFired): * platform/mock/MockMediaEndpoint.h: 2016-10-06 Youenn Fablet <youenn@apple.com> CachedResource client handling methods should take reference https://bugs.webkit.org/show_bug.cgi?id=163014 Reviewed by Alex Christensen. No change of behavior. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::~CachedScriptSourceProvider): (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * css/CSSCrossfadeValue.cpp: (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue): (WebCore::CSSCrossfadeValue::loadSubimages): * css/CSSFilterImageValue.cpp: (WebCore::CSSFilterImageValue::~CSSFilterImageValue): (WebCore::CSSFilterImageValue::loadSubimages): * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::CSSFontFaceSource): (WebCore::CSSFontFaceSource::~CSSFontFaceSource): * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::~StyleRuleImport): (WebCore::StyleRuleImport::requestStyleSheet): * dom/DataTransfer.cpp: (WebCore::DragImageLoader::startLoading): (WebCore::DragImageLoader::stopLoading): * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::create): (WebCore::LoadableClassicScript::~LoadableClassicScript): * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::~ProcessingInstruction): (WebCore::ProcessingInstruction::checkStyleSheet): (WebCore::ProcessingInstruction::parseStyleSheet): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::~HTMLLinkElement): (WebCore::HTMLLinkElement::process): * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::~CrossOriginPreflightChecker): (WebCore::CrossOriginPreflightChecker::startPreflight): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::detachFromFrame): (WebCore::DocumentLoader::clearMainResource): (WebCore::DocumentLoader::becomeMainResourceClient): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::~DocumentThreadableLoader): (WebCore::DocumentThreadableLoader::clearResource): (WebCore::DocumentThreadableLoader::loadRequest): * loader/ImageLoader.cpp: (WebCore::ImageLoader::~ImageLoader): (WebCore::ImageLoader::clearImageWithoutConsideringPendingLoadEvent): (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): * loader/LinkLoader.cpp: (WebCore::LinkLoader::~LinkLoader): (WebCore::LinkLoader::notifyFinished): (WebCore::LinkLoader::loadLink): * loader/LinkPreloadResourceClients.h: (WebCore::LinkPreloadResourceClient::addResource): (WebCore::LinkPreloadResourceClient::clearResource): * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::MediaResource): (WebCore::MediaResource::stop): * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::~TextTrackLoader): (WebCore::TextTrackLoader::cancelLoad): (WebCore::TextTrackLoader::load): * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::didAddClient): * loader/cache/CachedCSSStyleSheet.h: * loader/cache/CachedFont.cpp: (WebCore::CachedFont::didAddClient): * loader/cache/CachedFont.h: * loader/cache/CachedImage.cpp: (WebCore::CachedImage::didAddClient): (WebCore::CachedImage::didRemoveClient): * loader/cache/CachedImage.h: * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::didAddClient): * loader/cache/CachedRawResource.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::addClient): (WebCore::CachedResource::didAddClient): (WebCore::CachedResource::addClientToSet): (WebCore::CachedResource::removeClient): (WebCore::CachedResource::switchClientsToRevalidatedResource): (WebCore::CachedResource::Callback::timerFired): * loader/cache/CachedResource.h: (WebCore::CachedResource::hasClient): (WebCore::CachedResource::didRemoveClient): * loader/cache/CachedSVGDocumentReference.cpp: (WebCore::CachedSVGDocumentReference::~CachedSVGDocumentReference): (WebCore::CachedSVGDocumentReference::load): * loader/cache/CachedXSLStyleSheet.cpp: (WebCore::CachedXSLStyleSheet::didAddClient): * loader/cache/CachedXSLStyleSheet.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::addImageToCache): (WebCore::MemoryCache::removeImageFromCache): * loader/icon/IconLoader.cpp: (WebCore::IconLoader::startLoading): (WebCore::IconLoader::stopLoading): * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp: (WebCore::WebCoreAVCFResourceLoader::startLoading): (WebCore::WebCoreAVCFResourceLoader::stopLoading): * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::startLoading): (WebCore::WebCoreAVFResourceLoader::stopLoading): * rendering/RenderImageResource.cpp: (WebCore::RenderImageResource::shutdown): (WebCore::RenderImageResource::setCachedImage): * rendering/RenderLayerFilterInfo.cpp: (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients): (WebCore::RenderLayer::FilterInfo::removeReferenceFilterClients): * rendering/style/StyleCachedImage.cpp: (WebCore::StyleCachedImage::addClient): (WebCore::StyleCachedImage::removeClient): * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::clearResourceReferences): (WebCore::SVGFEImageElement::requestImageResource): * svg/SVGFontFaceUriElement.cpp: (WebCore::SVGFontFaceUriElement::~SVGFontFaceUriElement): (WebCore::SVGFontFaceUriElement::loadFont): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::~SVGUseElement): (WebCore::SVGUseElement::updateExternalDocument): * xml/XSLImportRule.cpp: (WebCore::XSLImportRule::~XSLImportRule): (WebCore::XSLImportRule::setXSLStyleSheet): (WebCore::XSLImportRule::loadSheet): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::notifyFinished): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::~XMLDocumentParser): (WebCore::XMLDocumentParser::endElementNs): 2016-10-05 Philippe Normand <pnormand@igalia.com> [GStreamer][OWR] GL rendering support https://bugs.webkit.org/show_bug.cgi?id=162972 Reviewed by Žan Doberšek. When GStreamer-GL is enabled the GL context needs to be properly passed to the GStreamer pipeline running within the OpenWebRTC video renderer. This is now supported using a new OpenWebRTC API that allows the renderer to request the context from the application using a callback registered within the renderer. The player's GL context/display set-up was refactored to a new method, requestGLContext, which is used as callback for the OpenWebRTC request_context handler. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: (WebCore::MediaPlayerPrivateGStreamerBase::gstGLContext): (WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink): 2016-10-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Icon service and the IconButton class https://bugs.webkit.org/show_bug.cgi?id=162970 <rdar://problem/28631803> Reviewed by Dean Jackson. We introduce the new IconButton class to display buttons that show an icon in modern media controls. An IconButton uses a CSS mask-image to display the icon such that we may set the actual button color to any value by setting the element's background-color property. Icons are obtained through the `iconService` singleton which knows how to load the right icon for the current layout traits and resolution. Icons loaded through the icon service are cached. In a later patch, we will be introducing functionality, through the MediaControlsHost, to load the icon from the WebCore bundle. Tests: media/modern-media-controls/icon-button/icon-button-active-state.html media/modern-media-controls/icon-button/icon-button.html media/modern-media-controls/icon-service/icon-service.html * Modules/modern-media-controls/controls/button.css: (button): * Modules/modern-media-controls/controls/icon-button.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/button.css. (button.icon): (button.icon:active): * Modules/modern-media-controls/controls/icon-button.js: Added. (IconButton): (IconButton.prototype.get iconName): (IconButton.prototype.set iconName): (IconButton.prototype.handleEvent): (IconButton.prototype.layout): (IconButton.prototype._imageDidLoad): (IconButton.prototype._updateImage): * Modules/modern-media-controls/controls/icon-service.js: Copied from Source/WebCore/Modules/modern-media-controls/controls/layout-item.js. (const.iconService.new.IconService): (const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits): (const.iconService.new.IconService.prototype.urlForIconNameAndLayoutTraits): * Modules/modern-media-controls/controls/layout-item.js: * Modules/modern-media-controls/images/iOS/pause@2x.png: Added. * Modules/modern-media-controls/images/iOS/pause@3x.png: Added. * Modules/modern-media-controls/images/iOS/start@2x.png: Added. * Modules/modern-media-controls/images/iOS/start@3x.png: Added. * Modules/modern-media-controls/images/macOS/pause-fullscreen@1x.png: Added. * Modules/modern-media-controls/images/macOS/pause-fullscreen@2x.png: Added. * Modules/modern-media-controls/images/macOS/pause@1x.png: Added. * Modules/modern-media-controls/images/macOS/pause@2x.png: Added. * Modules/modern-media-controls/images/macOS/start@1x.png: Added. * Modules/modern-media-controls/images/macOS/start@2x.png: Added. 2016-10-06 Miguel Gomez <magomez@igalia.com> [GTK] Fix build with GSTREAMER_GL enabled and ACCELERATED_2D_CANVAS disabled https://bugs.webkit.org/show_bug.cgi?id=163008 Reviewed by Carlos Garcia Campos. Put functions using cairo-gl behind appropriate guards. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::paintToCairoSurface): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2016-10-06 Miguel Gomez <magomez@igalia.com> [GTK] Copying video textures to webgl should not depend on cairo-gl https://bugs.webkit.org/show_bug.cgi?id=162904 Reviewed by Žan Doberšek. Perform the texture copy without using cairo-gl. Covered by existent tests. * platform/GStreamer.cmake: Add the new VideoTextureCopierGStreamer class to the build. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture): Use VideoTextureCopierGStreamer to perform the copy. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Add a VideoTextureCopierGStreamer as a class attribute. * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp: Added. (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer): (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer): (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix): Recalculates the matrix used as the texture coordinates transformation. (WebCore::VideoTextureCopierGStreamer::updateTransformationMatrix): Recalculates the matrices used as the vertices coordinates transformation. (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture): Performs the texture copy by using a shader that applies the rotation needed to follow the video orientation. * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h: Added. 2016-10-06 Gwang Yoon Hwang <yoon@igalia.com> [GTK] Build fix for X11 and GStreamerGL after r183731 https://bugs.webkit.org/show_bug.cgi?id=163000 Reviewed by Philippe Normand. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: Include gstgldisplay_egl.h if platform uses EGL. 2016-10-06 Mario Sanchez Prada <mario@endlessm.com> [GStreamer] Can't play any video with GSTREAMER_GL enabled https://bugs.webkit.org/show_bug.cgi?id=162669 Reviewed by Philippe Normand. Make sure an EGLDisplay type is passed when creating the GstGlDisplay for the EGL code path, instead of a native X11 display type, so that we get a valid GstGlDisplay as a result, not a dummy one. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): 2016-10-06 Youenn Fablet <youenn@apple.com> [Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode. https://bugs.webkit.org/show_bug.cgi?id=162785 Reviewed by Alex Christensen. Covered by rebased and existing tests. Ensuring non-HTTP redirection URLs are not followed at DocumentThreadableLoader level for fetch API only. This should be applied to all clients at some point, but there is still some uncertainty for data URLs. Did some refactoring to better separate the case of security checks in case of regular request or redirected request. This allows in particular to handle more clearly the case of data URLs which are allowed in all modes for regular requests. But they are not allowed for same-origin redirected requests. * WebCore.xcodeproj/project.pbxproj: * loader/DocumentThreadableLoader.cpp: (WebCore::reportRedirectionWithBadScheme): Reporting bad scheme redirection error. (WebCore::DocumentThreadableLoader::redirectReceived): Checking that redirection URLs are HTTP(s) in case of Fetch API. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::checkInsecureContent): (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): (WebCore::isSameOriginDataURL): (WebCore::CachedResourceLoader::canRequest): (WebCore::CachedResourceLoader::canRequestAfterRedirection): (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceLoader.h: 2016-10-06 Youenn Fablet <youenn@apple.com> [Fetch API] Use ReadableStream pull to transfer binary data to stream when application needs it https://bugs.webkit.org/show_bug.cgi?id=162892 Reviewed by Alex Christensen. Covered by existing tests. Before this patch, FetchResponse was never resolving the start promise. This way, it could enqueue data, error or close the stream whenever desired. With this patch, FetchResponse will feed the stream when being asked to. This allows keeping the data in WebCore until the application needs it. This is only implemented for network data. For other data owned by response (blob, text...), data will be enqueued like previously as fast as possible. Note that FetchResponse can enqueue/error/close the stream at any time since JSFetchResponse has a reference to the stream. And the stream has a reference to the controller. In addition to transfer binary chunks to ReadableStream only when needed, WebCore is now aware of the data stored in the response, which may allow applying backpressure to the network source in the future. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): Enqueuing only if stream is pulling. Otherwise, storing in FetchBodyConsumer. If stream is pulling, we enqueue both buffered data and received chunk. (WebCore::FetchResponse::consumeBodyAsStream): Resolving pull promise if we enqueued some buffered data. (WebCore::FetchResponse::closeStream): (WebCore::FetchResponse::feedStream): If we have some buffered data, we enqueue it. If there is no loader, the stream can be closed. * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponseSource.cpp: (WebCore::FetchResponseSource::doPull): (WebCore::FetchResponseSource::close): (WebCore::FetchResponseSource::error): * Modules/fetch/FetchResponseSource.h: * Modules/streams/ReadableStreamSource.h: (WebCore::ReadableStreamSource::isPulling): Renamed from isStarting. (WebCore::ReadableStreamSource::isStarting): Deleted. 2016-10-06 Adam Bergkvist <adam.bergkvist@ericsson.com> WebRTC: Add support for the icecandidate event in MediaEndpointPeerConnection https://bugs.webkit.org/show_bug.cgi?id=162957 Reviewed by Eric Carlson. Implement MediaEndpointPeerConnection's gotIceCandidate and doneGatheringCandidates callbacks. These are used by the MediaEndpoint (WebRTC backend implementation) to notify about ICE events. Add API to Internals to emulate WebRTC platform events, such as dispatching a set of ICE candidates followed by a gathering done indication. Initially, only a single action, "dispatch-fake-ice-candidates", is supported, but the intention is to extend the set of actions to support more test cases. Test: fast/mediastream/RTCPeerConnection-icecandidate-event.html * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::emulatePlatformEvent): (WebCore::MediaEndpointPeerConnection::gotIceCandidate): (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceTransport.h: Added. RTCIceCandidate will eventually be part of the JS API, but right now it's only used to keep track of the ICE states related to a RTCRtpTranscevier. (WebCore::RTCIceTransport::create): (WebCore::RTCIceTransport::~RTCIceTransport): (WebCore::RTCIceTransport::transportState): (WebCore::RTCIceTransport::setTransportState): (WebCore::RTCIceTransport::gatheringState): (WebCore::RTCIceTransport::setGatheringState): (WebCore::RTCIceTransport::RTCIceTransport): * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::emulatePlatformEvent): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCRtpTransceiver.cpp: (WebCore::RTCRtpTransceiver::RTCRtpTransceiver): * Modules/mediastream/RTCRtpTransceiver.h: (WebCore::RTCRtpTransceiver::iceTransport): * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/MediaEndpoint.h: (WebCore::MediaEndpoint::emulatePlatformEvent): * platform/mediastream/PeerConnectionStates.h: * platform/mock/MockMediaEndpoint.cpp: (WebCore::MockMediaEndpoint::MockMediaEndpoint): (WebCore::MockMediaEndpoint::updateReceiveConfiguration): (WebCore::MockMediaEndpoint::emulatePlatformEvent): (WebCore::MockMediaEndpoint::dispatchFakeIceCandidates): (WebCore::MockMediaEndpoint::iceCandidateTimerFired): * platform/mock/MockMediaEndpoint.h: * testing/Internals.cpp: (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent): Generic API to signal down to the WebRTC platform mock. * testing/Internals.h: * testing/Internals.idl: 2016-10-06 Nan Wang <n_wang@apple.com> AX:[Mac] Unable to edit text input, textarea fields in iframe using VO naivgation https://bugs.webkit.org/show_bug.cgi?id=162999 Reviewed by Chris Fleizach. In WebKit1, the top web area setting the selection to an input element inside an iframe will make the input field not editable. The issue is that when the web area and the input element have different documents, the setSelection function in FrameSelection will set the selection on the input's frame and cause the caret to disappear. I fixed it by not setting the selection in such case. Test: accessibility/mac/wk1-set-selected-text-marker-range-input-element.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange): 2016-10-05 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r206845. https://bugs.webkit.org/show_bug.cgi?id=162998 broke el capitan build (Requested by alexchristensen on #webkit). Reverted changeset: "Add Display P3 ColorSpace" https://bugs.webkit.org/show_bug.cgi?id=162880 http://trac.webkit.org/changeset/206845 2016-10-05 Youenn Fablet <youenn@apple.com> Reuse CodeGenerator::UpdateFile in Tools CodeGenerator https://bugs.webkit.org/show_bug.cgi?id=162960 Reviewed by Alex Christensen. No change of behavior. * bindings/scripts/CodeGenerator.pm: (UpdateFile): Adding FIXME to enable lazy writing when feasible. 2016-10-05 Michael Catanzaro <mcatanzaro@igalia.com> [SOUP] HostTLSCertificateSet should not use SHA-1 hashes to compare certificates https://bugs.webkit.org/show_bug.cgi?id=162965 Reviewed by Carlos Garcia Campos. Use SHA-256 instead. No new tests, covered by TestSSL. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::HostTLSCertificateSet::computeCertificateHash): 2016-10-05 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Bump Chrome version in Chrome user agent quirk https://bugs.webkit.org/show_bug.cgi?id=162984 Reviewed by Carlos Garcia Campos. * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-10-05 Dean Jackson <dino@apple.com> Add Display P3 ColorSpace https://bugs.webkit.org/show_bug.cgi?id=162880 <rdar://problem/28598564> Reviewed by Sam Weinig. Add a new ColorSpace for Display P3. This will be tested once the Color class can create objects that reference other color spaces. * platform/graphics/ColorSpace.h: * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::displayP3ColorSpaceRef): * platform/graphics/cg/GraphicsContextCG.h: (WebCore::cachedCGColorSpace): 2016-10-05 Wenson Hsieh <wenson_hsieh@apple.com> Introduce InputEvent bindings in preparation for the input events spec https://bugs.webkit.org/show_bug.cgi?id=162954 Reviewed by Ryosuke Niwa. Creates new bindings for InputEvent. Also introduces a runtime switch that allows Node to dispatch InputEvents rather than generic events of type 'input'. Adds a new test verifying that when the switch is enabled, inputs and contenteditable divs fire these new InputEvents on input. So far, only inputType is a part of the object prototype, since we will be implementing this first. getTargetRanges() will follow once the finer details of StaticRange are hashed out. See https://bugs.webkit.org/show_bug.cgi?id=162947 for more details. Tests: fast/events/input-events-fired-when-typing.html fast/events/ios/input-events-fired-when-typing-in-contenteditable.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: * dom/Event.cpp: (WebCore::Event::composed): (WebCore::Event::isInputEvent): * dom/Event.h: * dom/EventNames.in: * dom/InputEvent.cpp: Added. (WebCore::InputEvent::InputEvent): * dom/InputEvent.h: Added. * dom/InputEvent.idl: Added. * dom/Node.cpp: (WebCore::Node::dispatchInputEvent): (WebCore::Node::defaultEventHandler): * dom/Node.h: * editing/Editor.cpp: (WebCore::Editor::setBaseWritingDirection): * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setEditingValue): (WebCore::HTMLInputElement::setValueFromRenderer): * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::listBoxOnChange): (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList): * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTimelineElement::defaultEventHandler): * page/Settings.in: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2016-10-05 Alex Christensen <achristensen@webkit.org> URLParser should parse IPv4 addresses as the last two pieces of an IPv6 address https://bugs.webkit.org/show_bug.cgi?id=162991 Reviewed by Saam Barati. The last 32 bits of an IPv6 address can be written in the form of an IPv4 address, but the syntax is stricter than if it were just an IPv4 address. There must be 4 pieces, and each piece must be decimal (no octal or hex allowed). These should serialize to regular hex IPv6 addresses. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Piece): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv4PieceInsideIPv6): (WebCore::URLParser::parseIPv4AddressInsideIPv6): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parseIPv4Number): Deleted. * platform/URLParser.h: 2016-10-05 Myles C. Maxfield <mmaxfield@apple.com> Put variation fonts work behind a compile-time flag https://bugs.webkit.org/show_bug.cgi?id=162949 Reviewed by Simon Fraser. No new tests because there is no behavior change. * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSFontVariationValue.cpp: * css/CSSFontVariationValue.h: * css/CSSPropertyNames.in: * css/CSSValue.cpp: (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): * css/CSSValue.h: (WebCore::CSSValue::isFontFeatureValue): Deleted. (WebCore::CSSValue::isFontVariationValue): Deleted. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertFontVariationSettings): Deleted. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInheritFontFeatureSettings): Deleted. (WebCore::StyleBuilderCustom::applyInheritFontVariationSettings): Deleted. * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::operator==): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseFontVariationSettings): Deleted. * css/parser/CSSParserMode.h: * page/Settings.in: * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::blendFunc): Deleted. * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::FontDescriptionKey): (WebCore::FontDescriptionKey::operator==): (WebCore::FontDescriptionKey::computeHash): * platform/graphics/FontDescription.cpp: * platform/graphics/FontDescription.h: (WebCore::FontDescription::operator==): (WebCore::FontDescription::setFeatureSettings): Deleted. (WebCore::FontDescription::setVariationSettings): Deleted. * platform/graphics/FontTaggedSettings.cpp: (WebCore::operator<<): Deleted. * platform/graphics/FontTaggedSettings.h: (WebCore::FontVariationSettings::isEmpty): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::cascadeToLastResortAndVariationsFontDescriptor): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::setFontVariationSettings): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::fontVariationSettings): Deleted. * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::variationFontsEnabled): (WebCore::InternalSettings::setVariationFontsEnabled): * testing/InternalSettings.h: 2016-10-05 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r206830 * platform/graphics/win/FontPlatformDataWin.cpp: Add missing include when building with Direct2D. 2016-10-05 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Disable some CoreGraphics and CoreAnimation-based logic when building for D2D https://bugs.webkit.org/show_bug.cgi?id=162977 Reviewed by Alex Christensen. Currently the Direct2D implementation does not support some of the accelerated compositing features that require CoreAnimation. During this bring-up, we want to disable these routines so that we can build and run in (mostly) unaccelerated drawing. This patch mostly consists of adding "#if USE(CG)" and "#if USE(CA)" to files that are specific to those implementations. This change should have no impact on non-Direct2D ports. No change in behavior for active ports. * config.h: Turn of CG when building in Direct2D. * css/CSSFontFaceSource.cpp: * loader/cache/CachedFont.cpp: * loader/cache/CachedSVGFont.cpp: * page/CaptionUserPreferencesMediaAF.cpp: * page/win/FrameCGWin.cpp: * page/win/FrameDirect2D.cpp: Added. * platform/graphics/Font.cpp: * platform/graphics/FontCache.cpp: * platform/graphics/FontPlatformData.cpp: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/ca/GraphicsLayerCA.cpp: * platform/graphics/ca/PlatformCALayer.cpp: * platform/graphics/ca/TileController.cpp: * platform/graphics/ca/TileGrid.cpp: * platform/graphics/ca/TileGrid.h: * platform/graphics/ca/win/CACFLayerTreeHost.cpp: * platform/graphics/ca/win/LayerChangesFlusher.cpp: * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: * platform/graphics/ca/win/PlatformCAAnimationWin.h: * platform/graphics/ca/win/PlatformCAFiltersWin.cpp: * platform/graphics/ca/win/PlatformCALayerWin.cpp: * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp: * platform/graphics/cg/GradientCG.cpp: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/cg/ImageBufferCG.cpp: * platform/graphics/cg/ImageBufferDataCG.cpp: * platform/graphics/cg/PDFDocumentImage.cpp: * platform/graphics/cg/PatternCG.cpp: * platform/graphics/cg/SubimageCacheWithTimer.cpp: * platform/graphics/win/FontCGWin.cpp: * platform/graphics/win/FontPlatformDataCGWin.cpp: * platform/graphics/win/GlyphPageTreeNodeCGWin.cpp: * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: * platform/graphics/win/GradientDirect2D.cpp: * platform/graphics/win/PathDirect2D.cpp: Fix a few build problems I didn't notice while building without Direct2D active. * platform/graphics/win/SimpleFontDataCGWin.cpp: * platform/graphics/win/SimpleFontDataWin.cpp: * platform/win/DragImageCGWin.cpp: * platform/win/DragImageDirect2D.cpp: Added. * rendering/RenderMediaControls.cpp: 2016-10-05 Chris Dumez <cdumez@apple.com> KeyboardEvent.getModifierState() should support "CapsLock" modifier https://bugs.webkit.org/show_bug.cgi?id=162861 Reviewed by Darin Adler. Add support for "CapsLock" modifier on Mac / iOS for KeyboardEvent's getModifierState() API, as per: - https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate No new tests, updated existing test. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): (WebCore::KeyboardEvent::getModifierState): * dom/KeyboardEvent.h: * platform/PlatformEvent.h: * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::modifiersForEvent): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyIdentifierForKeyEvent): 2016-10-05 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Improve OS X UA quirk https://bugs.webkit.org/show_bug.cgi?id=162613 Reviewed by Carlos Garcia Campos. Include OS X version number in user agent, like Safari does. * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-10-05 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Improve comment in platformVersionForUAString https://bugs.webkit.org/show_bug.cgi?id=162612 Reviewed by Carlos Garcia Campos. * platform/gtk/UserAgentGtk.cpp: (WebCore::platformVersionForUAString): 2016-10-05 Zalan Bujtas <zalan@apple.com> Missing quotation mark when <q> gets reparented. https://bugs.webkit.org/show_bug.cgi?id=162940 Reviewed by Darin Adler. When an opening RenderQuote gets removed due to some change in the render tree, we notify the closing RenderQuote so that it can update its content (") accordingly (and vice versa). However when the same RenderQuote is added back to the render tree (aka reparenting), we fail to let the other RenderQuote know about it and its content becomes stale. This patch ensures that when either the opening or closing part of the quotation mark gets reparented, we inform the other, corresponding opening/closing renderer about it. Test: fast/css-generated-content/missing-quotes-with-dynamic-content.html * dom/PseudoElement.cpp: (WebCore::PseudoElement::didAttachRenderers): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::insertedIntoTree): * rendering/RenderQuote.h: 2016-10-05 Alex Christensen <achristensen@webkit.org> URLParser should correctly strip unnecessary 0's in IPv6 addresses https://bugs.webkit.org/show_bug.cgi?id=162979 Reviewed by Brady Eidson. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv6Host): Strip leading 0's and any 0's before the last 0 if the value is 0. 2016-10-05 Alex Christensen <achristensen@webkit.org> UTF-8 encode queries of nonspecial and websocket schemes https://bugs.webkit.org/show_bug.cgi?id=162956 Reviewed by Geoffrey Garen and Brady Eidson. The URL spec says in the query state: 'If url is not special or url's scheme is either "ws" or "wss", set encoding to UTF-8.' This should be determined as soon as we are done parsing the scheme. Covered by new API tests. This also fixes tests like fast/loader/javascript-url-encoding-2.html when URLParser is enabled. * platform/URLParser.cpp: (WebCore::isValidSchemeCharacter): Renamed Scheme to ValidScheme so I can use Scheme as the name of an enum class in the same namespace. (WebCore::isSpecial): (WebCore::scheme): Separate functionality so we can have different behavior for different sets of ws and wss schemes, special, and non-special schemes. (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::parse): Set isUTF8Encoding to true when we finish parsing the scheme if the scheme is ws, wss, or non-special, according to spec. This also matches existing behavior. This way we will already know whether to go into UTF8Query or NonUTF8Query state when we see a '?'. (WebCore::isSpecialScheme): Deleted. 2016-10-05 Alex Christensen <achristensen@webkit.org> Prepare to enable URLParser https://bugs.webkit.org/show_bug.cgi?id=162974 Reviewed by Brady Eidson. * platform/URL.cpp: (WebCore::URL::serialize): When we enable the URLParser, this attempt to make serialized URLs more spec compliant won't be needed any more. 2016-10-05 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Add initial D2D Path and Gradient implementation https://bugs.webkit.org/show_bug.cgi?id=162923 Reviewed by Alex Christensen. This patch lands a set of new files that implements initial Path and Gradient features on Windows using Direct2D. No new tests until complete backend lands. * platform/graphics/Gradient.h: * platform/graphics/Path.cpp: * platform/graphics/Path.h: * platform/graphics/win/GradientDirect2D.cpp: Added. * platform/graphics/win/PathDirect2D.cpp: Added. 2016-10-05 Romain Bellessort <romain.bellessort@crf.canon.fr> [Readable Streams API] Align function names with spec https://bugs.webkit.org/show_bug.cgi?id=162967 Reviewed by Darin Adler. Align function names with spec. Behaviour was already in line with spec, but previous function names had sometimes been preserved to track the changes more easily. This led to some inconsistencies (for instance, enqueueInReadableStream was still used even though it works on a controller instead of a stream) and it also made it more difficult to compare spec and implementation. No change in behaviour. * Modules/fetch/FetchInternals.js: (consumeStream): Updated with new function names. * Modules/fetch/FetchResponse.js: (clone): Updated with new function names. * Modules/streams/ReadableStream.js: (tee): Updated with new function names. * Modules/streams/ReadableStreamDefaultController.js: (enqueue): Updated with new function names. (error): Updated with new function names. * Modules/streams/ReadableStreamDefaultReader.js: (read): Updated with new function names. * Modules/streams/ReadableStreamInternals.js: (privateInitializeReadableStreamDefaultController): Updated with new function names. (readableStreamDefaultControllerError): Updated with new function names. (readableStreamTee): Updated with new function names. (readableStreamTeePullFunction): Updated with new function names. (readableStreamTeeBranch2CancelFunction): Updated with new function names. (readableStreamError): Updated with new function names. (readableStreamCancel): Updated with new function names. (readableStreamDefaultControllerPull): Updated with new function names. (readableStreamDefaultControllerClose): Updated with new function names. (readableStreamClose): Updated with new function names. (readableStreamDefaultControllerEnqueue): Updated with new function names. (readableStreamDefaultReaderRead): Updated with new function names. 2016-10-05 Chris Dumez <cdumez@apple.com> [Bindings] Declare dictionary / enumeration template specializations in the header https://bugs.webkit.org/show_bug.cgi?id=162929 Reviewed by Darin Adler. Declare dictionary / enumeration template specializations in the header so that: - They can be used from custom bindings code. - Dictionaries / enumerations can be used to their own IDL files to share them (Bug 162912). No new tests, rebaselined bindings tests. * WebCore.xcodeproj/project.pbxproj: * bindings/generic/IDLTypes.h: * bindings/js/JSDOMConvert.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateInterface): (GenerateEnumerationImplementationContent): (GenerateEnumerationHeaderContent): (GenerateDictionaryHeaderContent): (GenerateHeader): (GenerateCallbackHeader): (GenerateCallbackImplementation): (GenerateDefaultValue): Deleted. (GenerateDictionaryImplementationContent): Deleted. (GenerateParametersCheck): Deleted. * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: 2016-10-05 Zan Dobersek <zdobersek@igalia.com> Rename ENABLE_ENCRYPTED_MEDIA_V2 to ENABLE_LEGACY_ENCRYPTED_MEDIA https://bugs.webkit.org/show_bug.cgi?id=162903 Reviewed by Alex Christensen. Rename build guards for the remaining implementation of the legacy EME API to ENABLE_LEGACY_ENCRYPTED_MEDIA. This will allow for the future implementation of the near-finished API to be guarded with the simple ENABLE_ENCRYPTED_MEDIA guards. No new tests -- no change in behavior. * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.cpp: * DerivedSources.make: * Modules/encryptedmedia/CDM.cpp: * Modules/encryptedmedia/CDM.h: * Modules/encryptedmedia/CDMPrivate.h: * Modules/encryptedmedia/CDMPrivateClearKey.cpp: * Modules/encryptedmedia/CDMPrivateClearKey.h: * Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp: * Modules/encryptedmedia/CDMPrivateMediaPlayer.h: * Modules/encryptedmedia/CDMSessionClearKey.cpp: * Modules/encryptedmedia/CDMSessionClearKey.h: * Modules/encryptedmedia/MediaKeyMessageEvent.cpp: * Modules/encryptedmedia/MediaKeyMessageEvent.h: * Modules/encryptedmedia/MediaKeyMessageEvent.idl: * Modules/encryptedmedia/MediaKeyNeededEvent.cpp: * Modules/encryptedmedia/MediaKeyNeededEvent.h: * Modules/encryptedmedia/MediaKeyNeededEvent.idl: * Modules/encryptedmedia/MediaKeySession.cpp: * Modules/encryptedmedia/MediaKeySession.h: * Modules/encryptedmedia/MediaKeySession.idl: * Modules/encryptedmedia/MediaKeys.cpp: * Modules/encryptedmedia/MediaKeys.h: * Modules/encryptedmedia/MediaKeys.idl: * bindings/js/JSDictionary.cpp: * bindings/js/JSDictionary.h: * dom/Element.idl: * dom/EventNames.in: * dom/EventTargetFactory.in: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): (WebCore::HTMLMediaElement::webkitAddKey): * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: * html/MediaError.h: * html/MediaError.idl: * html/MediaKeyError.h: * html/MediaKeyError.idl: * page/Settings.h: * platform/graphics/CDMSession.h: * platform/graphics/MediaPlayer.cpp: * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp: * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::MediaPlayerPrivateAVFoundationCF::supportsKeySystem): (WebCore::AVFWrapper::shouldWaitForLoadingOfResource): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem): (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): (WebCore::playerKVOProperties): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h: * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): * testing/Internals.cpp: * testing/Internals.h: * testing/Internals.idl: * testing/MockCDM.cpp: * testing/MockCDM.h: 2016-10-05 Daniel Bates <dabates@apple.com> Do not follow redirects when sending violation report https://bugs.webkit.org/show_bug.cgi?id=162520 <rdar://problem/27957639> Reviewed by Alex Christensen. Do not follow redirects when sending a Content Security Policy or XSS Auditor violation report as redirects can be used to forward report details to a third-party. This changes makes WebKit more closely conform to the reporting requirements in section Reporting of the Content Security Level 2 standard: <https://w3c.github.io/webappsec-csp/2/#violation-reports> (Editor's Draft, 25 April 2016). Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-and-do-not-follow-redirect-when-sending-report.php http/tests/security/xssAuditor/report-script-tag-and-do-not-follow-redirect-when-sending-report.html http/tests/security/xssAuditor/report-script-tag-full-block-and-do-not-follow-redirect-when-sending-report.html * loader/LoaderStrategy.h: Modified createPingHandle() to take a boolean, shouldFollowRedirects, whether to follow redirect responses for a ping request. * loader/PingLoader.cpp: (WebCore::PingLoader::loadImage): Pass ShouldFollowRedirects::Yes to PingLoader::startPingLoad to keep our current behavior. (WebCore::PingLoader::sendPing): Ditto. Note our current behavior of following redirects matches the behavior described in the section "Hyperlink auditing" of the HTML standard: <https://html.spec.whatwg.org/multipage/semantics.html#hyperlink-auditing> (23 September 2016). (WebCore::PingLoader::sendViolationReport): Pass ShouldFollowRedirects::No to PingLoader::startPingLoad so that we do not follow redirects when sending a violation report. (WebCore::PingLoader::startPingLoad): Modified to take argument shouldFollowRedirects whether to follow redirect responses for a ping request. * loader/PingLoader.h: * platform/network/PingHandle.h: Add boolean m_shouldFollowRedirects. I grouped this boolean with the existing boolean, m_shouldUseCredentialStorage, as opposed to appending to the end of the class definition to avoid increasing object size as clang will coalesces the two bools into a single machine word. Override ResourceHandleClient::willSendRequest() and ResourceHandleClient::willSendRequestAsync() to follow a redirect, if applicable. 2016-10-05 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Move global TLS errors handling from ResourceHandle to SoupNetworkSession https://bugs.webkit.org/show_bug.cgi?id=162910 Reviewed by Alex Christensen. So that it will be shared with network session code. Also remove setHostAllowsAnyHTTPSCertificate() that we have never actually used. * platform/network/ResourceHandle.h: * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::tlsErrorsChangedCallback): Use SoupNetworkSession::checkTLSErrors(). * platform/network/soup/SoupNetworkSession.cpp: (WebCore::HostTLSCertificateSet::add): (WebCore::HostTLSCertificateSet::contains): (WebCore::HostTLSCertificateSet::computeCertificateHash): (WebCore::clientCertificates): (WebCore::SoupNetworkSession::setShouldIgnoreTLSErrors): (WebCore::SoupNetworkSession::checkTLSErrors): (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost): * platform/network/soup/SoupNetworkSession.h: 2016-10-05 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Move request HTTP body handling to ResourceRequestSoup and simplify it https://bugs.webkit.org/show_bug.cgi?id=162891 Reviewed by Michael Catanzaro. We are currently adding the HTTP body to the message in ResourceHandleSoup, but we could do it as part of the ResourceRequest::updateSoupMessage() method, since the HTTP body is indeed part of the request. The code can be also simplified, especially the handling of files, by using SharedBuffer that already mmaps the file when possible, instead of using GMappedFile API. * platform/SharedBuffer.h: Add createSoupBuffer() method. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::createSoupMessageForHandleAndRequest): (WebCore::milisecondsSinceRequest): Deleted. (WebCore::ResourceHandle::didStartRequest): Deleted. (WebCore::startingCallback): Deleted. (WebCore::networkEventCallback): Deleted. (WebCore::ResourceHandle::start): Deleted. (WebCore::ResourceHandle::releaseForDownload): Deleted. (WebCore::ResourceHandle::timeoutFired): Deleted. * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: (WebCore::appendEncodedBlobItemToSoupMessageBody): Helper method to append the blob to the request message body. (WebCore::ResourceRequest::updateSoupMessageBody): Add HTTPBody to the request message body. (WebCore::ResourceRequest::updateSoupMessage): Call updateSoupMessageBody() to also update the body. * platform/soup/SharedBufferSoup.cpp: (WebCore::SharedBuffer::createSoupBuffer): Returns a new SoupBuffer for the SharedBuffer. 2016-10-04 Chris Dumez <cdumez@apple.com> Implement KeyboardEvent.code from the UI Event spec https://bugs.webkit.org/show_bug.cgi?id=149584 Reviewed by Darin Adler. Add support for Keyboard.code attribute: - https://w3c.github.io/uievents/#dom-keyboardevent-code - https://w3c.github.io/uievents-code/ The feature is only enabled on Mac for now as the implementation is platform-specific and Mac only. Test: fast/events/keyboardevent-code.html * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * platform/PlatformKeyboardEvent.h: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): (WebCore::PlatformKeyboardEvent::code): (WebCore::PlatformKeyboardEvent::unmodifiedText): Deleted. * platform/mac/PlatformEventFactoryMac.h: * platform/mac/PlatformEventFactoryMac.mm: (WebCore::codeForKeyEvent): (WebCore::keyIdentifierForKeyEvent): * replay/SerializationMethods.cpp: (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue): (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue): 2016-10-04 Said Abou-Hallawa <sabouhallawa@apple.com> The dragged image should be the current frame only of the animated image https://bugs.webkit.org/show_bug.cgi?id=162109 Reviewed by Tim Horton. Instead of creating an NSImage with all the frames for the dragImage, create an NSImage with the current frame only. * dom/DataTransferMac.mm: (WebCore::DataTransfer::createDragImage): Call snapshotNSImage() to create the dragImage. * editing/cocoa/HTMLConverter.mm: (fileWrapperForElement): Call the Image function with its new name. * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: (WebCore::Image::nsImage): Rename getNSImage() to nsImage(). (WebCore::Image::snapshotNSImage): Returns the NSImage of the current frame. (WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation(). (WebCore::Image::getNSImage): Deleted. (WebCore::Image::getTIFFRepresentation): Deleted. * platform/graphics/mac/ImageMac.mm: (WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation(). (WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage(). (WebCore::BitmapImage::snapshotNSImage): Returns the NSImage of the current frame. (WebCore::BitmapImage::getTIFFRepresentation): Deleted. (WebCore::BitmapImage::getNSImage): Deleted. * platform/mac/CursorMac.mm: (WebCore::createCustomCursor): Call snapshotNSImage() since the cursor does not animate anyway. * platform/mac/DragImageMac.mm: (WebCore::createDragImageFromImage): Use snapshotNSImage() for the dragImage. * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::write): Call the Image function with its new name. 2016-10-04 Andy Estes <aestes@apple.com> [iOS] Crash in WebResourceLoaderQuickLookDelegate when the client cancels the navigation to a QuickLook resource https://bugs.webkit.org/show_bug.cgi?id=162950 <rdar://problem/23759114> Reviewed by Brady Eidson. When we receive data from QLPreviewConverter for the first time, we call ResourceLoader::didReceiveResponse() with the preview NSURLResponse from QuickLook. If the client decides to cancel this navigation in decidePolicyForResponse(), WebResourceLoaderQuickLookDelegate will end up with a null _resourceLoader after didReceiveResponse() returns. This change adds null checks in the methods that use _resourceLoader after calling -_sendDidReceiveResponseIfNecessary. New API test: QuickLook.CancelNavigationAfterResponse * platform/network/ios/QuickLook.mm: (-[WebResourceLoaderQuickLookDelegate connection:didReceiveDataArray:]): Changed to only call ResourceLoader::didReceiveDataArray() if _resourceLoader is non-null. (-[WebResourceLoaderQuickLookDelegate connection:didReceiveData:lengthReceived:]): Ditto for ResourceLoader::didReceiveData(). (-[WebResourceLoaderQuickLookDelegate connection:didFailWithError:]): Ditto for ResourceLoader::didFail(). 2016-10-04 Chris Dumez <cdumez@apple.com> Add support for KeyboardEvent.isComposing attribute https://bugs.webkit.org/show_bug.cgi?id=162921 Reviewed by Darin Adler. Add support for KeyboardEvent.isComposing attribute: - https://www.w3.org/TR/uievents/#dom-keyboardevent-iscomposing - https://www.w3.org/TR/uievents/#ref-for-dom-keyboardevent-iscomposing-3 Manual test: https://jsfiddle.net/ay92sr08/9/ No new tests, extended existing tests. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: 2016-10-03 Ryosuke Niwa <rniwa@webkit.org> ShadowRoot interface should have elementFromPoint https://bugs.webkit.org/show_bug.cgi?id=162882 Reviewed by Chris Dumez. Add elementFromPoint to ShadowRoot's prototype as specified at: https://www.w3.org/TR/shadow-dom/#extensions-to-the-documentorshadowroot-mixin with changes proposed at https://github.com/w3c/csswg-drafts/issues/556 Added TreeScope::retargetToScope which implements This patch also factors DocumentOrShadowRoot.idl out of Document and ShadowRoot interfaces to better match the latest DOM specification: https://dom.spec.whatwg.org/#mixin-documentorshadowroot Test: fast/shadow-dom/Document-prototype-elementFromPoint.html * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::nodeFromPoint): Moved to TreeScope. (WebCore::Document::elementFromPoint): Moved to TreeScope. * dom/Document.h: * dom/Document.idl: Moved elementFromPoint and activeElement to DocumentOrShadowRoot.idl. * dom/DocumentOrShadowRoot.idl: Added. * dom/EventPath.cpp: (WebCore::RelatedNodeRetargeter::checkConsistency): Use newly added TreeScope::retargetToScope. * dom/ShadowRoot.idl: Moved activeElement to DocumentOrShadowRoot.idl. * dom/TreeScope.cpp: (WebCore::TreeScope::retargetToScope): Added. Implements https://dom.spec.whatwg.org/#retarget efficiently. Instead of checking whether A (node) is a shadow-including inclusive ancestor of B (this scope) at each parent, find the lowest ancestor which contains both A and B, and return the self-inclusive ancestor of B in that tree. To find the lowest common ancestor in O(n), traverse all ancestors of A and B separately and do a top-down traversal. The last tree scope in which A's ancestor and B's ancestor match is the lowest common ancestor. (WebCore::TreeScope::nodeFromPoint): Moved from Document. (WebCore::TreeScope::elementFromPoint): Moved from Document. Use retargetToScope and parentInComposedTree instead of parentNode and ancestorInThisScope to match the semantics proposed in https://github.com/w3c/csswg-drafts/issues/556 * dom/TreeScope.h: 2016-10-04 Myles C. Maxfield <mmaxfield@apple.com> font-family: cursive should map to KaiTi in Chinese https://bugs.webkit.org/show_bug.cgi?id=162889 <rdar://problem/28363547> Reviewed by Tim Horton. According to Bobby Tung, this is a better mapping. Previously, we were relying on the system fallback mechanism. However, an explicit mapping is more robust. Test: fast/text/cursive-zh.html * page/cocoa/SettingsCocoa.mm: (WebCore::Settings::initializeDefaultFontFamilies): 2016-10-04 Alex Christensen <achristensen@webkit.org> URLParser: query-only URLs relative to file URLs should just add a query https://bugs.webkit.org/show_bug.cgi?id=162888 Reviewed by Tim Horton. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): Like bug 206749 but with queries instead of fragments. 2016-10-04 Alex Christensen <achristensen@webkit.org> URLParser should match URL::parse and other browsers when parsing a URL containing only scheme:// https://bugs.webkit.org/show_bug.cgi?id=162909 Reviewed by Tim Horton. If there's no host in this case we shouldn't fail, but rather make a valid URL with the // in the path. This matches Chrome, Firefox, and Safari's behavior. Covered by API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): 2016-10-04 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r206773. Exclude Direct2D definitions when building for normal CG Windows. * platform/graphics/GraphicsContext.h: 2016-10-04 Yusuke Suzuki <utatane.tea@gmail.com> [DOMJIT] Introduce DOMJIT::GetterSetter to tell JIT information https://bugs.webkit.org/show_bug.cgi?id=162916 Reviewed by Filip Pizlo. * ForwardingHeaders/domjit/DOMJITGetterSetter.h: Added. * PlatformEfl.cmake: * PlatformGTK.cmake: * PlatformMac.cmake: * PlatformWin.cmake: 2016-10-04 Chris Dumez <cdumez@apple.com> Return null when window.open() is popup blocked https://bugs.webkit.org/show_bug.cgi?id=162897 Reviewed by Michael Catanzaro. The return value of window.open() when the popup is blocked should be null: - https://github.com/whatwg/html/pull/1854 - https://github.com/whatwg/html/issues/1851 Firefox / Edge return null. No new tests, rebaselined existing tests. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::open): 2016-10-04 Chris Dumez <cdumez@apple.com> [Web IDL] Add support for dictionary inheritance https://bugs.webkit.org/show_bug.cgi?id=162907 Reviewed by Sam Weinig. Add support for dictionary inheritance to our Web IDL parser and bindings generator. Leverage this new support for EventTarget's EventListenerOptions / AddEventListenerOptions dictionaries, in order to match the DOM specification: - https://dom.spec.whatwg.org/#interface-eventtarget Also update the bindings generator to convert the dictionary members in lexicographical order, as per: - https://heycam.github.io/webidl/#es-dictionary (Step 5.1) No new tests, rebaselined bindings tests. * bindings/scripts/CodeGenerator.pm: (GetDictionaryByName): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): * bindings/scripts/IDLParser.pm: (parseDictionary): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): (WebCore::convertDictionary<AlternateDictionaryName>): (WebCore::convertDictionary<TestObj::ParentDictionary>): (WebCore::convertDictionary<TestObj::ChildDictionary>): * bindings/scripts/test/TestObj.idl: * dom/EventTarget.idl: 2016-10-04 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Add initial D2D GraphicsContext implementation https://bugs.webkit.org/show_bug.cgi?id=162917 Reviewed by Dean Jackson. This patch lands a set of new files that implement the GraphicsContext features on Windows using Direct2D. No new tests until complete backend lands. * platform/graphics/Color.h: Add new casting operator. * platform/graphics/FloatSize.h: Ditto. * platform/graphics/GraphicsContext.cpp: Update for Direct2D implementation. * platform/graphics/GraphicsContext.h: * platform/graphics/win/ColorDirect2D.cpp: (WebCore::Color::operator D2D1_VECTOR_4F): Added. * platform/graphics/win/GraphicsContextCGWin.cpp: Add compiler guard to avoid building when using Direct2D. * platform/graphics/win/GraphicsContextDirect2D.cpp: Added. * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Added. * platform/graphics/win/GraphicsContextWin.cpp: Update for Direct2D includes. * platform/graphics/win/TransformationMatrixDirect2D.cpp: Fix comment. 2016-10-04 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Remove SSLPolicyFlags from SoupNetworkSession https://bugs.webkit.org/show_bug.cgi?id=162906 Reviewed by Michael Catanzaro. All soup based ports are setting SSLUseSystemCAFile flag unconditionally, so we can just use that when creating the session like we do for all other construct parameters. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::createTestingSession): (WebCore::SoupNetworkSession::setupLogger): (WebCore::SoupNetworkSession::SoupNetworkSession): Deleted. (WebCore::SoupNetworkSession::clearOldSoupCache): Deleted. (WebCore::SoupNetworkSession::setHTTPProxy): Deleted. * platform/network/soup/SoupNetworkSession.h: (WebCore::SoupNetworkSession::soupSession): Deleted. 2016-10-04 Wenson Hsieh <wenson_hsieh@apple.com> Media controls are displayed in the incorrect state momentarily after switching between tabs playing media https://bugs.webkit.org/show_bug.cgi?id=162766 <rdar://problem/28533523> Reviewed by Jer Noble. When showing Now Playing controls for a media session, we should first set up the Now Playing info and playback state before telling MediaRemote to make the session visible. This is WebKit work in ensuring that when switching Now Playing sessions by switching tabs, we do not first display an invalid Now Playing state before updating to the expected state. Adds 2 new WebKit API tests in NowPlayingControlsTests: NowPlayingControlsHideAfterShowingClearsInfo and NowPlayingControlsClearInfoAfterSessionIsNoLongerValid. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingTitle): (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingDuration): (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingElapsedTime): (WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSession): Deleted. * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): 2016-10-04 Youenn Fablet <youenn@apple.com> [Fetch API] ReadableStream should be errored with TypeError values https://bugs.webkit.org/show_bug.cgi?id=162895 Reviewed by Alex Christensen. Test: imported/w3c/web-platform-tests/fetch/api/basic/error-after-response.html * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didFail): Removing FIXME. * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::error<String>): Erroring with TypeError values. 2016-10-03 Chris Dumez <cdumez@apple.com> Bindings do not throw a TypeError if a required dictionary member is missing https://bugs.webkit.org/show_bug.cgi?id=162734 Reviewed by Geoffrey Garen. Bindings should throw a TypeError if a required dictionary member is missing. For example, if there is a "required long id" member in a dictionary that is missing, our bindings would prevously pass 0 to the implementation instead of throwing a TypeError. Relevant specification: - https://heycam.github.io/webidl/#es-dictionary I aligned our bindings generator implementation with the specification, except for the support for dictionary inheritance that is still missing and will be addressed in a follow-up patch. No new tests, I rebaselined the bindings tests and this is already covered by fast/events/touch/touch-constructor.html on iOS. * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): * bindings/js/JSDOMConvert.h: (WebCore::convert): Deleted. (WebCore::Converter<bool>::convert): Deleted. (WebCore::Converter<String>::convert): Deleted. (WebCore::Converter<IDLDOMString>::convert): Deleted. (WebCore::Converter<IDLUSVString>::convert): Deleted. (WebCore::Converter<JSC::JSValue>::convert): Deleted. (WebCore::Converter<int8_t>::convert): Deleted. (WebCore::Converter<uint8_t>::convert): Deleted. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): (WebCore::convertDictionary<AlternateDictionaryName>): 2016-10-03 Zalan Bujtas <zalan@apple.com> [ListItems] Render tree should be all clean by the end of FrameView::layout(). https://bugs.webkit.org/show_bug.cgi?id=162832 Reviewed by Simon Fraser. List item markers are inserted into the tree during layout, right before laying out the list item (that's a big FIXME). At this point we already know what part of the tree needs to be laid out. Inserting a list item marker does not expand this dirty area. However whenever we insert a new renderer into the tree, we call setNeedsLayout on the contining block chain. In certain cases (floating renderers), it could potentially trigger some unintentional markings and we return from FrameView::layout() with a dirty subtree. This patch preemptively marks the list item and its marker dirty so that when the marker is getting inserted into the tree, we stop the marking at the parent. Not testable. * rendering/RenderListItem.cpp: (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): 2016-10-03 Myles C. Maxfield <mmaxfield@apple.com> Implement rendering of font-variation-settings https://bugs.webkit.org/show_bug.cgi?id=162782 Reviewed by Zalan Bujtas. (Re-landing after fixing tests.) Because the heavy lifting for font-variation-settings is done by CoreText, this patch is fairly minimal. It simply hooks up the CSS property to CoreText. There is an existing bug in CoreText where variations inside fonts do not survive the addition of a cascade list. Therefore, FontPlatformData::ctFont() needs to work around this (conditionally) by resupplying the variation at the same time as the cascade list. The CoreText bug is <rdar://problem/28449441>. Tests: fast/text/variations/duplicate.html fast/text/variations/exist.html fast/text/variations/inheritance.html fast/text/variations/order.html fast/text/variations/outofbounds.html * platform/graphics/FontCache.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::fontWithFamily): (WebCore::FontCache::createFontPlatformData): (WebCore::FontCache::systemFallbackForCharacters): * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::cascadeToLastResortAttributesDictionary): (WebCore::cascadeToLastResortAndVariationsFontDescriptor): (WebCore::FontPlatformData::ctFont): (WebCore::cascadeToLastResortFontDescriptor): Deleted. * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::updateCachedSystemFontDescription): 2016-10-03 Alex Christensen <achristensen@webkit.org> URLParser should strip tabs at all locations https://bugs.webkit.org/show_bug.cgi?id=162836 Reviewed by Geoffrey Garen. Covered by adding tabs to each location of each API test except tests that test the encoding of surrogate pairs, because inserting a tab between the pairs changes the encoding. * platform/URLParser.cpp: (WebCore::URLParser::takesTwoAdvancesUntilEnd): (WebCore::URLParser::parse): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): * platform/URLParser.h: 2016-10-03 Antti Koivisto <antti@apple.com> Remove Document::elementSheet() https://bugs.webkit.org/show_bug.cgi?id=162876 Reviewed by Andreas Kling. This is a Document owned stylesheet that exists as a context for parsing element inline style. It never contains any rules and is generally confusing. This patch removes the requirement for a stylesheet to be present for CSSParser to operate in the correct context. Inline style is now parsed without stylesheet and a context object is passed instead. * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::root): * bindings/js/JSCSSStyleDeclarationCustom.h: (WebCore::root): Deleted. * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::setCssText): (WebCore::PropertySetCSSStyleDeclaration::setProperty): (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): (WebCore::PropertySetCSSStyleDeclaration::cssParserContext): (WebCore::StyleRuleCSSStyleDeclaration::parentStyleSheet): (WebCore::StyleRuleCSSStyleDeclaration::cssParserContext): (WebCore::InlineCSSStyleDeclaration::parentStyleSheet): (WebCore::InlineCSSStyleDeclaration::cssParserContext): * css/PropertySetCSSStyleDeclaration.h: (WebCore::PropertySetCSSStyleDeclaration::didMutate): Deleted. * css/StyleProperties.cpp: (WebCore::MutableStyleProperties::setProperty): (WebCore::MutableStyleProperties::setCustomProperty): (WebCore::MutableStyleProperties::parseDeclaration): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseCustomPropertyValue): (WebCore::CSSParser::parseInlineStyleDeclaration): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseInlineStyleDeclaration): * dom/Document.cpp: (WebCore::Document::~Document): (WebCore::Document::updateBaseURL): (WebCore::Document::usesStyleBasedEditability): (WebCore::Document::setHasElementUsingStyleBasedEditability): (WebCore::Document::elementSheet): Deleted. * dom/Document.h: * dom/StyledElement.cpp: (WebCore::StyledElement::setInlineStyleFromString): (WebCore::StyledElement::invalidateStyleAttribute): The usesStyleBasedEditability bit used to be set via the elementSheet. Instead check for it after inline style mutations. (WebCore::StyledElement::setInlineStyleProperty): (WebCore::StyledElement::addPropertyToPresentationAttributeStyle): * dom/StyledElement.h: (WebCore::StyledElement::invalidateStyleAttribute): Deleted. * inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges): * svg/SVGAnimateElementBase.cpp: (WebCore::applyCSSPropertyToTarget): 2016-10-03 Brent Fulgham <bfulgham@apple.com> Avoid null dereference when changing focus in design mode. https://bugs.webkit.org/show_bug.cgi?id=162877 <rdar://problem/28061261> Reviewed by Chris Dumez. The bare m_frame pointer in DOMWindow can be cleared when setting focus to a new element. Check that the m_frame pointer is non-null before using it after calling a routine that could clear the pointer value. Test: fast/frames/iframe-focus-crash.html * page/DOMWindow.cpp: (WebCore::DOMWindow::focus): Check that the pointer is still non-null after setting the current focused element to nullptr. 2016-10-03 Chris Dumez <cdumez@apple.com> Add support for KeyboardEvent.key attribute https://bugs.webkit.org/show_bug.cgi?id=36267 Reviewed by Darin Adler. Add support for KeyboardEvent.key attribute: - https://w3c.github.io/uievents/#dom-keyboardevent-key This is behind a compile time flag that is only enabled on Mac and iOS and the implementation is still missing for other platforms. Test: fast/events/keyboardevent-key.html * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * platform/PlatformKeyboardEvent.h: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): (WebCore::PlatformKeyboardEvent::key): * platform/cocoa/KeyEventCocoa.h: * platform/cocoa/KeyEventCocoa.mm: (WebCore::keyForCharCode): * platform/ios/PlatformEventFactoryIOS.h: * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::keyForKeyEvent): (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): * platform/mac/PlatformEventFactoryMac.h: * platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyForKeyEvent): (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Deleted. * replay/SerializationMethods.cpp: (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue): (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue): 2016-10-03 Chris Dumez <cdumez@apple.com> Add support for KeyboardEvent.key attribute https://bugs.webkit.org/show_bug.cgi?id=36267 Reviewed by Darin Adler. Add support for KeyboardEvent.key attribute: - https://w3c.github.io/uievents/#dom-keyboardevent-key This is behind a compile time flag that is only enabled on Mac and iOS and the implementation is still missing for other platforms. Test: fast/events/keyboardevent-key.html * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * platform/PlatformKeyboardEvent.h: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): (WebCore::PlatformKeyboardEvent::key): * platform/cocoa/KeyEventCocoa.h: * platform/cocoa/KeyEventCocoa.mm: (WebCore::keyForCharCode): * platform/ios/PlatformEventFactoryIOS.h: * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::keyForKeyEvent): (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): * platform/mac/PlatformEventFactoryMac.h: * platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyForKeyEvent): (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Deleted. * replay/SerializationMethods.cpp: (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue): (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue): 2016-10-03 Alex Christensen <achristensen@webkit.org> URLParser: fragment-only URLs relative to file URLs should just add a fragment https://bugs.webkit.org/show_bug.cgi?id=162871 Reviewed by Geoffrey Garen. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): Instead of adding ///# after copying the base URL to the query, just add an #. 2016-10-03 Antoine Quint <graouts@apple.com> [Modern Media Controls] LayoutItem and Button classes https://bugs.webkit.org/show_bug.cgi?id=162868 <rdar://problem/28590166> Reviewed by Dean Jackson. We introduce the new Button class and its parent class LayoutItem. We will subclass Button a lot in coming patches, as it provides a way to create a button and provide a delegate to respond to UI events via the `uiDelegate` property. A Button extends a LayoutItem, another class that we'll subclass heavily in coming patches, which is simply a LayoutNode with a `layoutDelegate` which allows to set the node's `layoutTraits`, a bit-mask allowing to specify layout attributes such as the platform and playback styles. Tests: media/modern-media-controls/button/button.html media/modern-media-controls/layout-item/layout-item.html * Modules/modern-media-controls/controls/button.css: Added. (button): * Modules/modern-media-controls/controls/button.js: Added. (Button): (Button.prototype.get enabled): (Button.prototype.set enabled): (Button.prototype.handleEvent): (Button.prototype._handleUIEvent): * Modules/modern-media-controls/controls/layout-item.js: Added. (LayoutItem.prototype.get layoutTraits): (LayoutItem): 2016-10-03 Andy Estes <aestes@apple.com> ASSERTION FAILED: url.containsOnlyASCII() in WebCore::checkEncodedString() when parsing an invalid CSS cursor URL https://bugs.webkit.org/show_bug.cgi?id=162763 <rdar://problem/28572758> Reviewed by Youenn Fablet. CSSCursorImageValue copies the URL of its underlying CSSImageValue by using the ParsedURLString URL constructor on the String returned by CSSImageValue::url(). While CSSImageValues were always being constructed from a URL implicitly converted to a String, nothing ensured that the URL was valid. For invalid URLs, URL::string() returns the string it was constructed with, which might still represent a relative URL or contain non-ASCII characters, violating the preconditions of the ParsedURLString URL constructor and causing an assertion to fail in Debug builds. Fix this by having CSSImageValue store its image URL using a WebCore::URL rather than a String. CSSCursorImageValue can then copy this URL instead of attempting to re-parse a possibly-invalid URL string. Test: fast/css/cursor-with-invalid-url.html * css/CSSCursorImageValue.cpp: (WebCore::CSSCursorImageValue::CSSCursorImageValue): Copied m_imageValue.url() into m_originalURL instead of using the ParsedURLString URL constructor, since CSSImageValue::url() now returns a WebCore::URL. (WebCore::CSSCursorImageValue::loadImage): Created a URL from cursorElement->href() by calling Document::completeURL(). * css/CSSImageValue.cpp: (WebCore::CSSImageValue::CSSImageValue): Changed to take a URL&& instead of a const String&. (WebCore::CSSImageValue::loadImage): Stopped calling Document::completeURL(), since m_url is now a WebCore::URL. * css/CSSImageValue.h: Changed url() to return a const URL&, and changed m_url to be a URL. * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::collectStyleForPresentationAttribute): Removed a call to URL::string(). * html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLTablePartElement.cpp: (WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute): Ditto. 2016-10-03 Zalan Bujtas <zalan@apple.com> Log an error to stderr when FrameView::layout() fails to clean all the renderers. https://bugs.webkit.org/show_bug.cgi?id=162835 Reviewed by Simon Fraser. We've come across multiple layout/painting bugs caused by renderers left dirty after FrameView::layout(). This patch helps catching such issues early. Once all the blocking bugs are fixed (webkit.org/b/162835), logging should be replaced with ASSERT(). Not testable. * page/FrameView.cpp: (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker): (WebCore::FrameView::layout): 2016-10-03 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Add D2D Bitmap Image handling code https://bugs.webkit.org/show_bug.cgi?id=162761 Reviewed by Dean Jackson. This patch lands a set of new files that implement Image and BitmapImage features on Windows using Direct2D. The desired ID2D1RenderTarget handle is needed by the image decoder so that it can load the resulting bitmap into the GPU. No new tests until complete backend lands. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): Tell the Direct2D image decoder which render target to use. * platform/graphics/BitmapImage.h: * platform/graphics/ImageBuffer.cpp: * platform/graphics/ImageBuffer.h: * platform/graphics/ImageBufferData.h: * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::setRenderTarget): Added. * platform/graphics/ImageFrameCache.h: (WebCore::ImageFrameCache::decoder): Added. * platform/graphics/ImageSource.cpp: * platform/graphics/ImageSource.h: (WebCore::ImageSource::setRenderTarget): * platform/graphics/win/ImageBufferDataDirect2D.cpp: Added. * platform/graphics/win/ImageBufferDataDirect2D.h: Added. * platform/graphics/win/ImageBufferDirect2D.cpp: Added. * platform/graphics/win/ImageCGWin.cpp: * platform/graphics/win/ImageDecoderDirect2D.cpp: Added. * platform/graphics/win/ImageDecoderDirect2D.h: Added. * platform/graphics/win/ImageDirect2D.cpp: Added. * platform/graphics/win/NativeImageDirect2D.cpp: Added. 2016-10-03 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Remove unused methods toSoupMessage from ResourceRequest/Response https://bugs.webkit.org/show_bug.cgi?id=162867 Reviewed by Sergio Villar Senin. * platform/network/soup/ResourceRequest.h: * platform/network/soup/ResourceRequestSoup.cpp: (WebCore::ResourceRequest::updateSoupMessage): (WebCore::ResourceRequest::updateFromSoupMessage): Deleted. * platform/network/soup/ResourceResponse.h: * platform/network/soup/ResourceResponseSoup.cpp: (WebCore::ResourceResponse::updateFromSoupMessage): Deleted. 2016-10-03 Youenn Fablet <youenn@apple.com> Remove FetchBody::m_isEmpty https://bugs.webkit.org/show_bug.cgi?id=162857 Reviewed by Alex Christensen. No change of behavior. Moving handling of null bodies in FetchBodyOwner, by having an Optional<FetchBody> in FetchBodyOwner. Moving storage of m_contentType in FetchBodyOwner. Moving header storage from FetchResponse/FetchRequest to FetchBodyOwner, as it helps updating m_contentType. * Modules/fetch/FetchBody.cpp: removing m_isEmpty and m_contentType. (WebCore::FetchBody::extract): Computes the default content-type which is stored in FetchBodyOwner. (WebCore::FetchBody::blob): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingSucceeded): (WebCore::FetchBody::bodyForInternalRequest): (WebCore::FetchBody::clone): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::loadingBody): (WebCore::FetchBody::FetchBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::FetchBodyOwner): (WebCore::FetchBodyOwner::stop): (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::cloneBody): Needs to clone m_contentType as well. (WebCore::FetchBodyOwner::extractBody): (WebCore::FetchBodyOwner::updateContentType): (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::loadBlob): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::finishBlobLoading): * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): (WebCore::FetchBodyOwner::isBodyNull): * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): (WebCore::FetchRequest::internalRequest): (WebCore::FetchRequest::clone): * Modules/fetch/FetchRequest.h: (WebCore::FetchRequest::FetchRequest): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::initializeWith): (WebCore::FetchResponse::FetchResponse): (WebCore::FetchResponse::cloneForJS): (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): (WebCore::FetchResponse::BodyLoader::start): (WebCore::FetchResponse::createReadableStreamSource): * Modules/fetch/FetchResponse.h: 2016-10-03 Andy Estes <aestes@apple.com> ASSERTION FAILED: result in WebCore::CSSParser::parseURI https://bugs.webkit.org/show_bug.cgi?id=141638 <rdar://problem/27709952> Reviewed by Andreas Kling. CSSParser::parseURIInternal() failed to parse unquoted URLs with Unicode escape sequences greater than 0xFF, even when the destination character type was multi-byte. Fixed by checking the size of DestCharacterType instead of SrcCharacterType. Updated fast/css/url-with-multi-byte-unicode-escape.html to test for an unquoted URL. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseURIInternal): For code points greater than 0xFF, only returned false if sizeof(DestCharacterType) == 1. 2016-10-03 Alex Christensen <achristensen@webkit.org> URLParser: empty relative URLs should not copy fragment from the base URL https://bugs.webkit.org/show_bug.cgi?id=162864 Reviewed by Chris Dumez. Covered by new API tests. * platform/URL.cpp: (WebCore::URL::removeFragmentIdentifier): Optimize removing fragments, now that it happens more often. We don't need to reparse, because the result will always be equal to just a substring when removing the fragment at the end. * platform/URLParser.cpp: (WebCore::URLParser::copyASCIIStringUntil): (WebCore::URLParser::copyURLPartsUntil): (WebCore::containsOnlyC0ControlOrSpace): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): * platform/URLParser.h: Because we are not copying the fragment, we can simplify and remove some unreachable code. 2016-10-03 Chris Dumez <cdumez@apple.com> td.scope should only return known values https://bugs.webkit.org/show_bug.cgi?id=162755 Reviewed by Sam Weinig. td.scope should only return known values: - https://html.spec.whatwg.org/#dom-th-scope Firefox conforms to the specification. No new tests, rebaselined existing test. * html/HTMLTableCellElement.cpp: (WebCore::HTMLTableCellElement::scope): 2016-10-03 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Simplify AuthenticationChallenge https://bugs.webkit.org/show_bug.cgi?id=162784 Reviewed by Alex Christensen. We don't really need to keep references to the SoupSession and SoupMessage in AuthenticationChallenge, the SoupNetworkSession callback already forwards the challenge to the right ResourceHandle. * platform/network/soup/AuthenticationChallenge.h: (WebCore::AuthenticationChallenge::authenticationClient): (WebCore::AuthenticationChallenge::soupSession): Deleted. (WebCore::AuthenticationChallenge::soupMessage): Deleted. * platform/network/soup/AuthenticationChallengeSoup.cpp: (WebCore::AuthenticationChallenge::AuthenticationChallenge): (WebCore::AuthenticationChallenge::platformCompare): * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::receivedCancellation): * platform/network/soup/SoupNetworkSession.cpp: (WebCore::authenticateCallback): 2016-10-03 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Cleanup persistent credential storage code https://bugs.webkit.org/show_bug.cgi?id=162777 Reviewed by Alex Christensen. We have this feature behind ENABLE_CREDENTIAL_STORAGE flag, which is confusing, because we use credential storage unconditionally and this is only about persistent storage. Also the flag assumes libsecret is available, and since it's only used by GTK sometimes we use GTK ifdefs instead of CREDENTIAL_STORAGE. So, I think we should use USE(LIBSECRET) instead, and reduce a bit the ifdefs in common soup code. Another problem is that current implementation is always used, while it should depend on the current network storage session and never used in ephemeral sessions. This patch moves the code from CredentialBackingStore to NetworkStorageSessionSoup and modernizes a bit. * PlatformGTK.cmake: Remove CredentialBackingStore.cpp. * platform/gtk/GRefPtrGtk.cpp: Use USE(LIBSECRET) * platform/gtk/GRefPtrGtk.h: * platform/network/NetworkStorageSession.h: * platform/network/ResourceHandleInternal.h: * platform/network/gtk/CredentialBackingStore.cpp: Removed. * platform/network/gtk/CredentialBackingStore.h: Removed. * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::~NetworkStorageSession): (WebCore::schemeFromProtectionSpaceServerType): (WebCore::authTypeFromProtectionSpaceAuthenticationScheme): (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage): (WebCore::NetworkStorageSession::saveCredentialToPersistentStorage): (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted. (WebCore::NetworkStorageSession::switchToNewTestingSession): Deleted. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::gotHeadersCallback): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge): Deleted. (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): Deleted. (WebCore::ResourceHandle::receivedCancellation): Deleted. 2016-10-03 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix the build with coordinated graphics enabled after r206712. * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::attachNode): 2016-10-02 Chris Dumez <cdumez@apple.com> Add support for KeyboardEvent.getModifierState() operation https://bugs.webkit.org/show_bug.cgi?id=162855 Reviewed by Darin Adler. Add support for KeyboardEvent.getModifierState() operation: - https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate Test: fast/events/constructors/keyboard-event-getModifierState.html * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::getModifierState): * dom/KeyboardEvent.idl: 2016-10-02 Chris Dumez <cdumez@apple.com> Add support for KeyboardEvent.repeat attribute https://bugs.webkit.org/show_bug.cgi?id=162854 Reviewed by Darin Adler. Add support for KeyboardEvent.repeat attribute: - https://w3c.github.io/uievents/#dom-keyboardevent-repeat No new tests, extended existing test. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: 2016-10-02 Darin Adler <darin@apple.com> Rename ExceptionCode-based exception handling to "legacy" https://bugs.webkit.org/show_bug.cgi?id=162859 Reviewed by Chris Dumez. RaisesException is now MayThrowLegacyException. A follow-up patch soon will add MayThrowException for the new style, where we use ExceptionOr<> as the return type instead of an ExceptionCode out argument. * bindings/scripts/CodeGeneratorJS.pm: Removed the quotation marks from the syntax object->{PropertyName} so the renaming script could handle it. Tweaked various comments and logic for clarity. Changed to use the perl "x if y" syntax for brevity in many places. Renamed with the script and by hand. Added code to skip including the same header in both the implementation file and the header, just to make generated bindings slightly smaller and faster to compile. Used "using" instead of "typedef". * bindings/scripts/IDLAttributes.txt: Updated from old names to new ones. * Modules/applepay/ApplePaySession.idl: * Modules/encryptedmedia/MediaKeySession.idl: * Modules/encryptedmedia/MediaKeys.idl: * Modules/fetch/FetchHeaders.idl: * Modules/fetch/FetchRequest.idl: * Modules/fetch/FetchResponse.idl: * Modules/indexeddb/IDBCursor.idl: * Modules/indexeddb/IDBDatabase.idl: * Modules/indexeddb/IDBFactory.idl: * Modules/indexeddb/IDBIndex.idl: * Modules/indexeddb/IDBKeyRange.idl: * Modules/indexeddb/IDBObjectStore.idl: * Modules/indexeddb/IDBRequest.idl: * Modules/indexeddb/IDBTransaction.idl: * Modules/mediasource/MediaSource.idl: * Modules/mediasource/SourceBuffer.idl: * Modules/mediastream/MediaDevices.idl: * Modules/mediastream/RTCDTMFSender.idl: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCSessionDescription.idl: * Modules/navigatorcontentutils/NavigatorContentUtils.idl: * Modules/notifications/NotificationCenter.idl: * Modules/webaudio/AnalyserNode.idl: * Modules/webaudio/AudioBuffer.idl: * Modules/webaudio/AudioBufferSourceNode.idl: * Modules/webaudio/AudioContext.idl: * Modules/webaudio/AudioNode.idl: * Modules/webaudio/ConvolverNode.idl: * Modules/webaudio/OfflineAudioContext.idl: * Modules/webaudio/OscillatorNode.idl: * Modules/webdatabase/DOMWindowWebDatabase.idl: * Modules/webdatabase/SQLResultSet.idl: * Modules/websockets/WebSocket.idl: * bindings/scripts/test/TestImplements.idl: * bindings/scripts/test/TestInterface.idl: * bindings/scripts/test/TestNamedConstructor.idl: * bindings/scripts/test/TestNondeterministic.idl: * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestSupplemental.idl: * bindings/scripts/test/TestTypedefs.idl: * css/CSSCharsetRule.idl: * css/CSSMediaRule.idl: * css/CSSPrimitiveValue.idl: * css/CSSRule.idl: * css/CSSStyleDeclaration.idl: * css/CSSStyleSheet.idl: * css/CSSSupportsRule.idl: * css/CSSValue.idl: * css/FontFace.idl: * css/FontFaceSet.idl: * css/MediaList.idl: * css/WebKitCSSMatrix.idl: * dom/CharacterData.idl: * dom/ChildNode.idl: * dom/CustomElementRegistry.idl: * dom/DataTransferItemList.idl: * dom/Document.idl: * dom/Element.idl: * dom/EventTarget.idl: * dom/MessagePort.idl: * dom/MutationObserver.idl: * dom/NamedNodeMap.idl: * dom/Node.idl: * dom/ParentNode.idl: * dom/Range.idl: * dom/ShadowRoot.idl: * dom/Text.idl: * fileapi/FileReader.idl: * fileapi/FileReaderSync.idl: * html/DOMTokenList.idl: * html/DOMURL.idl: * html/HTMLCanvasElement.idl: * html/HTMLElement.idl: * html/HTMLEmbedElement.idl: * html/HTMLFrameElement.idl: * html/HTMLIFrameElement.idl: * html/HTMLInputElement.idl: * html/HTMLMarqueeElement.idl: * html/HTMLMediaElement.idl: * html/HTMLObjectElement.idl: * html/HTMLOptionElement.idl: * html/HTMLOptionsCollection.idl: * html/HTMLProgressElement.idl: * html/HTMLSelectElement.idl: * html/HTMLTableElement.idl: * html/HTMLTableRowElement.idl: * html/HTMLTableSectionElement.idl: * html/HTMLTextAreaElement.idl: * html/HTMLVideoElement.idl: * html/ImageData.idl: * html/MediaController.idl: * html/TimeRanges.idl: * html/URLUtils.idl: * html/canvas/CanvasGradient.idl: * html/canvas/CanvasPath.idl: * html/canvas/CanvasRenderingContext2D.idl: * html/canvas/OESVertexArrayObject.idl: * html/canvas/WebGLRenderingContextBase.idl: * html/track/DataCue.idl: * html/track/TextTrack.idl: * html/track/TextTrackCue.idl: * html/track/VTTCue.idl: * html/track/VTTRegion.idl: * loader/appcache/DOMApplicationCache.idl: * page/Crypto.idl: * page/DOMSelection.idl: * page/DOMWindow.idl: * page/EventSource.idl: * page/History.idl: * page/Location.idl: * page/Performance.idl: * page/UserMessageHandler.idl: * page/WindowOrWorkerGlobalScope.idl: * storage/Storage.idl: * svg/SVGAltGlyphElement.idl: * svg/SVGAngle.idl: * svg/SVGAnimatedBoolean.idl: * svg/SVGAnimatedEnumeration.idl: * svg/SVGAnimatedInteger.idl: * svg/SVGAnimatedNumber.idl: * svg/SVGAnimatedString.idl: * svg/SVGAnimationElement.idl: * svg/SVGColor.idl: * svg/SVGGlyphRefElement.idl: * svg/SVGGraphicsElement.idl: * svg/SVGLength.idl: * svg/SVGLengthList.idl: * svg/SVGMatrix.idl: * svg/SVGNumberList.idl: * svg/SVGPaint.idl: * svg/SVGPathSegList.idl: * svg/SVGPointList.idl: * svg/SVGPreserveAspectRatio.idl: * svg/SVGStringList.idl: * svg/SVGStyleElement.idl: * svg/SVGTextContentElement.idl: * svg/SVGTransformList.idl: * svg/SVGViewSpec.idl: * testing/InternalSettings.idl: * testing/Internals.idl: * workers/DedicatedWorkerGlobalScope.idl: * workers/Worker.idl: * xml/DOMParser.idl: * xml/XMLHttpRequest.idl: * xml/XPathEvaluator.idl: * xml/XPathExpression.idl: * xml/XPathResult.idl: Allowed the rename script to rename the exception-related extended attributes. * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSInterfaceName.h: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.h: * bindings/scripts/test/JS/JSTestCallback.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h: * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.h: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestEventTarget.h: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestException.h: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.h: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterface.h: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestIterable.h: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.h: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.h: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNode.h: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.h: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.h: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.h: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSTestTypedefs.h: * bindings/scripts/test/JS/JSattribute.cpp: * bindings/scripts/test/JS/JSattribute.h: * bindings/scripts/test/JS/JSreadonly.cpp: * bindings/scripts/test/JS/JSreadonly.h: Regenerated. 2016-10-02 Wenson Hsieh <wenson_hsieh@apple.com> Media controls for Soundcloud easily falls out of sync with what's actually playing https://bugs.webkit.org/show_bug.cgi?id=162843 <rdar://problem/28176874> Reviewed by Beth Dakin. Currently, audio elements are subject to the same main content restrictions as video elements. This is problematic on sites where audio elements are really the main content, such as soundcloud. We need a different heuristic for determining whether audio elements such as these should be allowed to show playback controls. Furthermore, we currently forbid autoplaying audio from showing controls if it has user gesture restrictions (i.e. it started playing via script). This is, again, problematic on sites where audio elements are played one after another (such as on soundcloud). Even though a subsequent audio element may have been triggered via script, we might want still want to show controls for it if the user has explicitly triggered other elements on the page to begin playing. However, if the user has not gestured on any media in the page, we still should not show controls for audio elements that begin playing via script. Adds two new unit tests to TestWebKitAPI simulating audio playback behavior on soundcloud. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::removeBehaviorRestriction): (WebCore::MediaElementSession::canShowControlsManager): (WebCore::MediaElementSession::allowsPlaybackControlsForAutoplayingAudio): * html/MediaElementSession.h: * page/Page.h: (WebCore::Page::allowsPlaybackControlsForAutoplayingAudio): (WebCore::Page::setAllowsPlaybackControlsForAutoplayingAudio): 2016-10-02 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r206683. This change caused API test WebKit2.FindMatches to fail on Mac. Reverted changeset: "The dragged image should be the current frame only of the animated image" https://bugs.webkit.org/show_bug.cgi?id=162109 http://trac.webkit.org/changeset/206683 2016-10-02 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r206692 and r206718. Seems to have caused >200 failures on Sierra Reverted changesets: "Implement rendering of font-variation-settings" https://bugs.webkit.org/show_bug.cgi?id=162782 http://trac.webkit.org/changeset/206692 "Tried to fix the build after r206692." http://trac.webkit.org/changeset/206718 2016-10-02 Dan Bernstein <mitz@apple.com> Tried to fix the build after r206692. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::cascadeToLastResortAndVariationsFontDescriptor): 2016-10-02 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r206716. https://bugs.webkit.org/show_bug.cgi?id=162858 It is breaking Mac CMake Debug build (Requested by youenn on #webkit). Reverted changeset: "[Fetch API] Forbid redirection to non-HTTP(s) URL in non- navigation mode." https://bugs.webkit.org/show_bug.cgi?id=162785 http://trac.webkit.org/changeset/206716 2016-10-02 Youenn Fablet <youenn@apple.com> [Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode. https://bugs.webkit.org/show_bug.cgi?id=162785 Reviewed by Alex Christensen. Covered by rebased and existing tests. Ensuring non-HTTP redirection URLs are not followed at DocumentThreadableLoader level for fetch API only. This should be applied to all clients at some point, but there is still some uncertainty for data URLs. Did some refactoring to better separate the case of security checks in case of regular request or redirected request. This allows in particular to handle more clearly the case of data URLs which are allowed in all modes for regular requests. But they are not allowed for same-origin redirected requests. * WebCore.xcodeproj/project.pbxproj: * loader/DocumentThreadableLoader.cpp: (WebCore::reportRedirectionWithBadScheme): Reporting bad scheme redirection error. (WebCore::DocumentThreadableLoader::redirectReceived): Checking that redirection URLs are HTTP(s) in case of Fetch API. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::checkInsecureContent): (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): (WebCore::isSameOriginDataURL): (WebCore::CachedResourceLoader::canRequest): (WebCore::CachedResourceLoader::canRequestAfterRedirection): (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceLoader.h: 2016-10-01 Simon Fraser <simon.fraser@apple.com> Support transitions/animations of background-position with right/bottom-relative values https://bugs.webkit.org/show_bug.cgi?id=162048 Reviewed by Dean Jackson. Make transitions between "background-position: 10px 20px" and "background-position: right 10px bottom 20px" work. We do this by by converting "right 10px" to "calc(100% - 10px)" when blending. Also improve logging of calculated lengths, and better animation logging for FillLayer properties. Test: transitions/background-position-transitions.html * page/animation/CSSPropertyAnimation.cpp: (WebCore::FillLayerAnimationPropertyWrapperBase::FillLayerAnimationPropertyWrapperBase): Keep the propertyID around so logging can use it. (WebCore::FillLayerAnimationPropertyWrapperBase::property): (WebCore::FillLayerPropertyWrapperGetter::FillLayerPropertyWrapperGetter): (WebCore::FillLayerPropertyWrapperGetter::value): (WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper): (WebCore::createCalculatedLength): (WebCore::FillLayerPositionPropertyWrapper::FillLayerPositionPropertyWrapper): (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper): (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper): (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper): (WebCore::CSSPropertyAnimation::blendProperties): Blend then log, so that the logging can show the result. * platform/CalculationValue.cpp: (WebCore::CalcExpressionNumber::dump): (WebCore::CalcExpressionBinaryOperation::dump): (WebCore::CalcExpressionLength::dump): (WebCore::CalcExpressionBlendLength::dump): (WebCore::operator<<): * platform/CalculationValue.h: * platform/Length.cpp: (WebCore::operator<<): 2016-10-01 Simon Fraser <simon.fraser@apple.com> Bad cast when CSS position programmatically changed from -webkit-sticky to fixed https://bugs.webkit.org/show_bug.cgi?id=160826 Reviewed by Zalan Bujtas. If a scrolling state tree node changed type (e.g. from sticky to fixed), we'd fail to recreate the node so keep a node with the wrong type. Fix by destroying the node and making a new one with a new ID in this case. The new ID is necessary to ensure that the scrolling tree is updated. Test: fast/scrolling/sticky-to-fixed.html * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::nodeTypeAndParentMatch): (WebCore::ScrollingStateTree::attachNode): (WebCore::ScrollingStateTree::stateNodeForID): * page/scrolling/ScrollingStateTree.h: 2016-10-01 Youenn Fablet <youenn@apple.com> removing FetchBoyd::m_type Remove FetchBody::m_type https://bugs.webkit.org/show_bug.cgi?id=162841 Reviewed by Sam Weinig. No change of behavior. Removing FetchBody::m_type and using m_data in lieu. Introducing temporarily FetchBody::m_isEmpty to handle the case of null bodies. Null body handling should be moved to FetchBodyOwner in a follow-up patch. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::FetchBody): (WebCore::FetchBody::extract): (WebCore::FetchBody::arrayBuffer): (WebCore::FetchBody::blob): (WebCore::FetchBody::json): (WebCore::FetchBody::text): (WebCore::FetchBody::consumeOnceLoadingFinished): (WebCore::FetchBody::consume): (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::loadingSucceeded): (WebCore::FetchBody::bodyForInternalRequest): (WebCore::FetchBody::clone): (WebCore::FetchBody::consumeText): Deleted. (WebCore::FetchBody::consumeBlob): Deleted. * Modules/fetch/FetchBody.h: (WebCore::FetchBody::isEmpty): (WebCore::FetchBody::isBlob): (WebCore::FetchBody::isFormData): (WebCore::FetchBody::isArrayBuffer): (WebCore::FetchBody::isArrayBufferView): (WebCore::FetchBody::isURLSearchParams): (WebCore::FetchBody::isText): (WebCore::FetchBody::FetchBody): (WebCore::FetchBody::setContentType): Deleted. (WebCore::FetchBody::urlSearchParamsBody): Deleted. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): (WebCore::FetchBodyOwner::blobLoadingSucceeded): (WebCore::FetchBodyOwner::finishBlobLoading): Deleted. * Modules/fetch/FetchBodyOwner.h: (WebCore::FetchBodyOwner::body): Deleted. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::fetch): (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::consume): (WebCore::FetchResponse::consumeBodyAsStream): (WebCore::FetchResponse::createReadableStreamSource): (WebCore::FetchResponse::finishConsumingStream): Deleted. * Modules/fetch/FetchResponse.h: 2016-09-30 David Kilzer <ddkilzer@apple.com> REGRESSION (r203424): WebCore::ImageBuffer::createCompatibleBuffer() in ImageBufferCG.cpp over-releases CGColorSpaceRef objects <https://webkit.org/b/162823> <rdar://problem/27723268> Reviewed by Joseph Pecoraro. Code is covered by existing tests, but no crashes have been observed in practice. May require running one test multiple times to reproduce. * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::createCompatibleBuffer): Don't use adoptCF() when the function doesn't return a +1 retained CGColorSpaceRef. 2016-09-30 Joonghun Park <jh718.park@samsung.com> [EFL] Fix build break since r206661. Unreviewed https://bugs.webkit.org/show_bug.cgi?id=162825 No new tests, no new behaviours. * rendering/RenderLayer.cpp: (WebCore::ClipRects::ClipRects): 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Declare that our variation fonts work is in progress https://bugs.webkit.org/show_bug.cgi?id=162816 Reviewed by Simon Fraser. * features.json: 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Turn variation fonts on by default https://bugs.webkit.org/show_bug.cgi?id=162818 Reviewed by Simon Fraser. No new tests because there is no behavior change. * page/Settings.in: * testing/InternalSettings.cpp: (WebCore::InternalSettings::variationFontsEnabled): 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Implement rendering of font-variation-settings https://bugs.webkit.org/show_bug.cgi?id=162782 Reviewed by Zalan Bujtas. Because the heavy lifting for font-variation-settings is done by CoreText, this patch is fairly minimal. It simply hooks up the CSS property to CoreText. There is an existing bug in CoreText where variations inside fonts do not survive the addition of a cascade list. Therefore, FontPlatformData::ctFont() needs to work around this (conditionally) by resupplying the variation at the same time as the cascade list. The CoreText bug is <rdar://problem/28449441>. Tests: fast/text/variations/duplicate.html fast/text/variations/exist.html fast/text/variations/inheritance.html fast/text/variations/order.html fast/text/variations/outofbounds.html * platform/graphics/FontCache.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::fontWithFamily): (WebCore::FontCache::createFontPlatformData): (WebCore::FontCache::systemFallbackForCharacters): * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::cascadeToLastResortAttributesDictionary): (WebCore::cascadeToLastResortAndVariationsFontDescriptor): (WebCore::FontPlatformData::ctFont): (WebCore::cascadeToLastResortFontDescriptor): Deleted. * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::updateCachedSystemFontDescription): 2016-09-29 Sam Weinig <sam@webkit.org> Add initial support for IDL union conversion https://bugs.webkit.org/show_bug.cgi?id=161576 Reviewed by Chris Dumez. * WebCore.xcodeproj/project.pbxproj: Add IDLTypes.h * bindings/generic/IDLTypes.h: Added. Add a basic type hierarchy for types defined by WebIDL and their corresponding WebCore implementation types. * bindings/js/JSDOMConvert.h: (WebCore::Converter<IDLDOMString>::convert): (WebCore::Converter<IDLUSVString>::convert): Add Converters for IDLDOMString and IDLUSVString. (WebCore::ConditionalConverter<typename ReturnType, typename T, bool enabled>) Add a struct to allow conditional conversion of types based on a compile boolean value. This allows the union code to work, by ensuring that code for types that don't exist doesn't get compiled. (WebCore::Converter<IDLUnion>::convert): Add template meta programming based version of the WebIDL conversion algorithm. It uses introspection of the typelist to conditionally execute the parts of the algorithm that apply and relies on the compiler eliminate the dead code it produces. This initial cut doesn't implement the full algorithm, just a subset needed to see if this method will work out. * bindings/js/JSDOMWrapper.h: (WebCore::isJSDOMWrapperType): Add JSDOMWrapperType to the list of well known types to allow quick checking of wrappers by the union code. * bindings/js/JSNodeOrString.cpp: (WebCore::toNodeOrStringVector): Switch to new IDLUnion based converter. 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Implement animation of font-variation-settings https://bugs.webkit.org/show_bug.cgi?id=162783 Reviewed by Simon Fraser. Modify CSSPropertyAnimation to understand FontVariationSettings objects and how to interpolate them. If two FontVariationSettings objects are unlike (meaning they specify different variation axes), for now the interpolation simply returns an empty object. This might change in the future, but for now, this is a reasonable place to start. Because CSSPropertyAnimation interacts with RenderStyles instead of FontDescriptions, this patch adds a transparent accessor from the RenderStyle to the inner FontDescription. Tests: animations/font-variation-settings-order.html animations/font-variation-settings-unlike.html animations/font-variation-settings.html * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::PropertyWrapperFontVariationSettings::PropertyWrapperFontVariationSettings): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::setFontVariationSettings): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::fontVariationSettings): 2016-09-30 Antoine Quint <graouts@apple.com> [Modern Media Controls] layout nodes https://bugs.webkit.org/show_bug.cgi?id=162799 <rdar://problem/28569301> Reviewed by Dean Jackson. Modern media controls will be using a tree of LayoutNode objects that commit to the DOM in coordinated `requestAnimationFrame()` calls to ensure all layouts are done in an efficient and coordinated manner. As a preamble, we introduced the `scheduler` singleton in https://webkit.org/b/162726 which is in charge of scheduling callbacks. A LayoutNode is created by providing an Element to its constructor, or an HTML string. Not providing a parameter creates a simple <div>. When we set a property on a LayoutNode, we call `markDirtyProperty(propertyName)` which keeps track of dirty properties in the `_dirtyProperties` set. When this set is non-empty, the node is marked as dirty and registered in the global `dirtyNodes` map, asking the shared scheduler that a layout is needed. When the layout is performed, all nodes in the `dirtyNodes` map are processed such that `commitProperty(propertyName)` is called to commit dirty properties for a given node to the DOM, and `layout()` is called to allow subclasses of LayoutNode to conduct custom layout logic that goes beyond committing a given property. Another reason why a node may be marked as dirty is when a DOM hierarchy change is needed. A host of DOM-like methods are exposed to allow flexible manipulations of nodes, with an extra `children` property which allows wholesale change of a node's subtree with a single array property assignment. Changes to the DOM hierarchy are performed in the same scheduler callback as style properties. Nodes can be marked for layout explicitly with by setting the `needsLayout` property. Tests: media/modern-media-controls/layout-node/addChild.html media/modern-media-controls/layout-node/children.html media/modern-media-controls/layout-node/constructor.html media/modern-media-controls/layout-node/height.html media/modern-media-controls/layout-node/insertAfter.html media/modern-media-controls/layout-node/insertBefore.html media/modern-media-controls/layout-node/parent.html media/modern-media-controls/layout-node/remove.html media/modern-media-controls/layout-node/removeChild.html media/modern-media-controls/layout-node/subclassing.html media/modern-media-controls/layout-node/visible.html media/modern-media-controls/layout-node/width.html media/modern-media-controls/layout-node/x.html media/modern-media-controls/layout-node/y.html * Modules/modern-media-controls/controls/layout-node.js: Added. (LayoutNode): (LayoutNode.prototype.get x): (LayoutNode.prototype.set x): (LayoutNode.prototype.get y): (LayoutNode.prototype.set y): (LayoutNode.prototype.get width): (LayoutNode.prototype.set width): (LayoutNode.prototype.get height): (LayoutNode.prototype.set height): (LayoutNode.prototype.get visible): (LayoutNode.prototype.set visible): (LayoutNode.prototype.get needsLayout): (LayoutNode.prototype.set needsLayout): (LayoutNode.prototype.get parent): (LayoutNode.prototype.get children): (LayoutNode.prototype.set children): (LayoutNode.prototype.addChild): (LayoutNode.prototype.insertBefore): (LayoutNode.prototype.insertAfter): (LayoutNode.prototype.removeChild): (LayoutNode.prototype.remove): (LayoutNode.prototype.markDirtyProperty): (LayoutNode.prototype.commitProperty): (LayoutNode.prototype.layout): (LayoutNode.prototype._markNodeManipulation): (LayoutNode.prototype._updateDirtyState): (LayoutNode.prototype._updateChildren): (performScheduledLayout): (elementFromString): 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> The dragged image should be the current frame only of the animated image https://bugs.webkit.org/show_bug.cgi?id=162109 Reviewed by Tim Horton. Instead of creating an NSImage with all the frames for the dragImage, create an NSImage with the current frame only. * dom/DataTransferMac.mm: (WebCore::DataTransfer::createDragImage): Call currentFrameNSImage() to create the dragImage. * editing/cocoa/HTMLConverter.mm: (fileWrapperForElement): Call the Image function with its new name. * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: (WebCore::Image::nsImage): Rename getNSImage() to nsImage(). (WebCore::Image::currentFrameNSImage): Returns the NSImage of the current frame. (WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation(). (WebCore::Image::getNSImage): Deleted. (WebCore::Image::getTIFFRepresentation): Deleted. * platform/graphics/mac/ImageMac.mm: (WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation(). (WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage(). (WebCore::BitmapImage::currentFrameNSImage): Returns the NSImage of the current frame. (WebCore::BitmapImage::getTIFFRepresentation): Deleted. (WebCore::BitmapImage::getNSImage): Deleted. * platform/mac/CursorMac.mm: (WebCore::createCustomCursor): Call currentFrameNSImage() since the cursor does not animate anyway. * platform/mac/DragImageMac.mm: (WebCore::createDragImageFromImage): Use currentFrameNSImage() for the dragImage. * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::write): Call the Image function with its new name. 2016-09-30 Chris Dumez <cdumez@apple.com> [iOS] Allow sequence<Touch> input in TouchEvent constructor https://bugs.webkit.org/show_bug.cgi?id=162806 <rdar://problem/28566429> Reviewed by Ryosuke Niwa. Allow sequence<Touch> input in TouchEvent constructor in addition to TouchList objects. It is convenient for developers to pass arrays of Touch objects. No new tests, already covered by: imported/w3c/web-platform-tests/touch-events/touch-touchevent-constructor.html * bindings/js/JSDOMBinding.h: (WebCore::toRefNativeArray): (WebCore::toRefPtrNativeArray): * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Parse font-variation-settings https://bugs.webkit.org/show_bug.cgi?id=162781 Reviewed by Simon Fraser. CSS Fonts level 4 [1] details the font-variation-settings property which allows variations to be applied to fonts which accept it. The property accepts a list of key/value pairs where the keys are four-character Ascii codes and the values are floating point values. The implementation uses font-feature-settings as a model, but with one big difference: font-variation-settings can be animated. The set of variation points are animated individually. This font variations work is being done behind a run-time switch, which is settable from the Safari Develop menu. Now that FontDescription is growing, I'd like to do an investigation into the possibility of moving some of the rare pieces of it into their own class to reduce memory. However, upon advice, this investigation will be fairly involved and should be done in its own bug. Test: fast/text/variations/getComputedStyle.html * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSAllInOne.cpp: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSFontVariationValue.cpp: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp. (WebCore::CSSFontVariationValue::CSSFontVariationValue): (WebCore::CSSFontVariationValue::customCSSText): (WebCore::CSSFontVariationValue::equals): * css/CSSFontVariationValue.h: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp. * css/CSSPropertyNames.in: * css/CSSValue.cpp: (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): * css/CSSValue.h: (WebCore::CSSValue::isFontVariationValue): (WebCore::CSSValue::isFontFeatureValue): Deleted. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertFontVariationSettings): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInitialFontVariationSettings): (WebCore::StyleBuilderCustom::applyInheritFontVariationSettings): (WebCore::StyleBuilderCustom::applyInheritFontFeatureSettings): Deleted. * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::operator==): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseFontFeatureSettings): (WebCore::CSSParser::parseFontVariationTag): (WebCore::CSSParser::parseFontVariationSettings): * css/parser/CSSParser.h: * css/parser/CSSParserMode.h: * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::FontDescriptionKey): (WebCore::FontDescriptionKey::operator==): (WebCore::FontDescriptionKey::computeHash): * platform/graphics/FontDescription.cpp: * platform/graphics/FontDescription.h: (WebCore::FontDescription::variationSettings): (WebCore::FontDescription::setVariationSettings): (WebCore::FontDescription::operator==): (WebCore::FontDescription::featureSettings): Deleted. (WebCore::FontDescription::setFeatureSettings): Deleted. * platform/graphics/FontTaggedSettings.cpp: (WebCore::FontVariationSettings::hash): (WebCore::operator<<): * platform/graphics/FontTaggedSettings.h: 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Followup patch to r206664 https://bugs.webkit.org/show_bug.cgi?id=162774 Unreviewed. No new tests because there is no behavior change. * platform/graphics/FontTaggedSettings.h: (WebCore::FourCharacterTagHashTraits::isDeletedValue): Deleted. 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Fix fast/text/trak-optimizeLegibility.html https://bugs.webkit.org/show_bug.cgi?id=162779 Reviewed by Simon Fraser. I accidentally created this test to allow an unnecessary delta in the width comparison. This covered the fact that the fonts were not being selected correctly in our testing code. Update the font selection code to work with system fonts correctly and update the test to not use a delta when performing width comparisons. Test: fast/text/trak-optimizeLegibility.html * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::isSystemFont): (WebCore::platformFontLookupWithFamily): 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Create runtime flag for variation font work https://bugs.webkit.org/show_bug.cgi?id=162780 Reviewed by Alex Christensen. No new tests because there is no behavior change. Variation font work should be behind a runtime flag. * page/Settings.in: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::variationFontsEnabled): (WebCore::InternalSettings::setVariationFontsEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2016-09-30 Myles C. Maxfield <mmaxfield@apple.com> Templatize internal FontFeatureSettings class for variation font support https://bugs.webkit.org/show_bug.cgi?id=162774 Reviewed by Alex Christensen. Font features and font variations are similar in that they are identified by four-character tags and an associated value. However, the value is an int for font features and is a float for font variations. In order to simplify code, we can use the same class for both, and use a template argument to distinguish between the two. Then, typedefs can be used to name them. No new tests because there is no behavior change. * WebCore.xcodeproj/project.pbxproj: Rename FontFeatureSettings.{cpp,h} to FontTaggedSettings.{cpp,h} * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSFontFace.h: * css/CSSFontFaceSource.h: * css/CSSFontFeatureValue.cpp: (WebCore::CSSFontFeatureValue::CSSFontFeatureValue): * css/CSSFontFeatureValue.h: * css/FontFace.cpp: (WebCore::FontFace::featureSettings): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseFontFeatureTag): * loader/cache/CachedFont.h: * platform/graphics/FontDescription.h: * platform/graphics/FontFeatureSettings.cpp: (WebCore::FontFeature::FontFeature): Deleted. (WebCore::FontFeature::operator==): Deleted. (WebCore::FontFeature::operator<): Deleted. (WebCore::FontFeatureSettings::insert): Deleted. (WebCore::FontFeatureSettings::hash): Deleted. * platform/graphics/FontFeatureSettings.h: Removed. (WebCore::fontFeatureTag): Deleted. (WebCore::FontFeatureTagHash::hash): Deleted. (WebCore::FontFeatureTagHash::equal): Deleted. (WebCore::FontFeatureTagHashTraits::constructDeletedValue): Deleted. (WebCore::FontFeatureTagHashTraits::isDeletedValue): Deleted. (WebCore::FontFeature::operator!=): Deleted. (WebCore::FontFeature::tag): Deleted. (WebCore::FontFeature::value): Deleted. (WebCore::FontFeature::enabled): Deleted. (WebCore::FontFeatureSettings::operator==): Deleted. (WebCore::FontFeatureSettings::operator!=): Deleted. (WebCore::FontFeatureSettings::size): Deleted. (WebCore::FontFeatureSettings::operator[]): Deleted. (WebCore::FontFeatureSettings::at): Deleted. (WebCore::FontFeatureSettings::begin): Deleted. (WebCore::FontFeatureSettings::end): Deleted. * platform/graphics/FontTaggedSettings.cpp: Renamed from Source/WebCore/platform/graphics/FontFeatureSettings.cpp. (WebCore::FontFeatureSettings::hash): * platform/graphics/FontTaggedSettings.h: Added. (WebCore::fontFeatureTag): (WebCore::FourCharacterTagHash::hash): (WebCore::FourCharacterTagHash::equal): (WebCore::FourCharacterTagHashTraits::constructDeletedValue): (WebCore::FourCharacterTagHashTraits::isDeletedValue): (WebCore::FontTaggedSetting::operator!=): (WebCore::FontTaggedSetting::tag): (WebCore::FontTaggedSetting::value): (WebCore::FontTaggedSetting::enabled): (WebCore::FontTaggedSetting<T>::FontTaggedSetting): (WebCore::=): (WebCore::FontTaggedSetting<T>::operator<): (WebCore::FontTaggedSettings::operator==): (WebCore::FontTaggedSettings::operator!=): (WebCore::FontTaggedSettings::isEmpty): (WebCore::FontTaggedSettings::size): (WebCore::FontTaggedSettings::operator[]): (WebCore::FontTaggedSettings::at): (WebCore::FontTaggedSettings::begin): (WebCore::FontTaggedSettings::end): (WebCore::FontTaggedSettings<T>::insert): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::tagEquals): (WebCore::appendOpenTypeFeature): * platform/graphics/mac/FontCustomPlatformData.h: 2016-09-30 Chris Dumez <cdumez@apple.com> Fragment serialization should always use 'xml:' prefix for attributes in XML namespace https://bugs.webkit.org/show_bug.cgi?id=162803 Reviewed by Sam Weinig. Fragment serialization should always use 'xml:' prefix for attributes in XML namespace: - https://html.spec.whatwg.org/#serialising-html-fragments """ If the attribute is in the XML namespace -> The attribute's serialized name is the string "xml:" followed by the attribute's local name. """ - https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm """ If ns is the XML namespace, then let qualified name be the concatenation of the string "xml:" and the value of node's localName. """ Firefox complies with the specification. No new tests, rebaselined existing test. * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendAttribute): 2016-09-30 Zalan Bujtas <zalan@apple.com> Unreviewed, rolling out r206611. Scroll perf did not recover. Reverted changeset: "Unreviewed, rolling out r206483." https://bugs.webkit.org/show_bug.cgi?id=162750 http://trac.webkit.org/changeset/206611 2016-09-30 Zalan Bujtas <zalan@apple.com> Remove ClipRects's custom refcounting. https://bugs.webkit.org/show_bug.cgi?id=162798 Reviewed by Simon Fraser. It's safer to use RefCounted<>. No change in functionality. * rendering/RenderLayer.cpp: (WebCore::ClipRects::ClipRects): (WebCore::ClipRectsCache::getClipRects): (WebCore::ClipRectsCache::setClipRects): (WebCore::ClipRectsCache::getIndex): (WebCore::RenderLayer::updateClipRects): (WebCore::ClipRects::ref): Deleted. (WebCore::ClipRects::deref): Deleted. 2016-09-30 Chris Dumez <cdumez@apple.com> FileSaver.js does not work in WebKit https://bugs.webkit.org/show_bug.cgi?id=162788 Reviewed by Sam Weinig. FileSaver.js does not work in WebKit: - https://eligrey.com/demos/FileSaver.js/ It works in Firefox and Chrome, but in WebKit, we were getting a "Synthetic clicks on anchors that have a download attribute are ignored." warning. We were too strict in restricting synthetic clicks. We now allow synthetic clicks as long as they are triggered by a user gesture. Test: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2016-09-30 Joseph Pecoraro <pecoraro@apple.com> Breakpoints on blank lines or comments don't break https://bugs.webkit.org/show_bug.cgi?id=9885 <rdar://problem/6134406> Reviewed by Mark Lam. Tests: inspector/debugger/breakpoints/resolved-dump-all-pause-locations.html inspector/debugger/breakpoints/resolved-dump-each-line.html * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): 2016-09-30 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Stepping out of a function finishes the line that called it. https://bugs.webkit.org/show_bug.cgi?id=155325 <rdar://problem/25094578> Reviewed by Mark Lam. Tests: inspector/debugger/stepping/stepInto.html inspector/debugger/stepping/stepOut.html inspector/debugger/stepping/stepOver.html inspector/debugger/stepping/stepping-arrow-functions.html inspector/debugger/stepping/stepping-classes.html inspector/debugger/stepping/stepping-control-flow.html inspector/debugger/stepping/stepping-function-calls.html inspector/debugger/stepping/stepping-function-default-parameters.html inspector/debugger/stepping/stepping-literal-construction.html inspector/debugger/stepping/stepping-loops.html inspector/debugger/stepping/stepping-misc.html inspector/debugger/stepping/stepping-switch.html inspector/debugger/stepping/stepping-template-string.html inspector/debugger/stepping/stepping-try-catch-finally.html * inspector/InspectorDOMDebuggerAgent.h: * inspector/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::stepInto): Deleted. Setting this state in step-into does not make sense since we do not know when the debugger resumes and won't know when to clear it. 2016-09-30 Alex Christensen <achristensen@webkit.org> Fix off-by-one error in URLParser::parseIPv4Host https://bugs.webkit.org/show_bug.cgi?id=162789 Reviewed by Tim Horton. The spec says "If any but the last item in numbers is greater than 255, return failure." This means check up to size - 1, not size - 2. Covered by a new API test. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Host): 2016-09-30 Alex Christensen <achristensen@webkit.org> URLParser: parsing a URL with an empty host and a colon should fail https://bugs.webkit.org/show_bug.cgi?id=162795 Reviewed by Tim Horton. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseHostAndPort): 2016-09-30 Alex Christensen <achristensen@webkit.org> URLParser: handle syntax violations in non-UTF-8 encoded queries https://bugs.webkit.org/show_bug.cgi?id=162770 Reviewed by Tim Horton. There is a fast path for queries of URLs that use UTF-8 encoding, which are quite common. For non-UTF-8 encoded queries, which are less common, we put the code points in a Vector<UChar> and encode them all at once. If there is a syntax violation in the query, we need to copy the syntax-violation-free string up to the beginning of the query, then encode the query. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::percentEncodeByte): (WebCore::URLParser::encodeQuery): (WebCore::URLParser::parse): * platform/URLParser.h: 2016-09-27 Anders Carlsson <andersca@apple.com> Remove a couple of unused members from PlatformKeyboardEvent https://bugs.webkit.org/show_bug.cgi?id=162641 Reviewed by Tim Horton. * platform/PlatformKeyboardEvent.h: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): (WebCore::PlatformKeyboardEvent::nativeVirtualKeyCode): Deleted. (WebCore::PlatformKeyboardEvent::macCharCode): Deleted. * platform/mac/PlatformEventFactoryMac.mm: (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): * replay/SerializationMethods.cpp: (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue): (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue): 2016-09-30 Antti Koivisto <antti@apple.com> Remove "rem" unit optimization for document element font size changes https://bugs.webkit.org/show_bug.cgi?id=162778 Reviewed by Alex Christensen. We awkwardly track from the parser level if any stylesheet in a document uses any rem units. This is only used to minimally optimize a case where document element's (<html>) font size changes dynamically. In practice such changes are rare. Browsing around I couldn't find a single case where this optimization got used. Even if it was used it would be of low value as a full style resolution is likely to happen anyway (as font inherits) and the only thing really saved is that we don't need to invalidate the matched properties cache. * css/CSSGrammar.y.in: * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::StyleSheetContents): * css/StyleSheetContents.h: * dom/AuthorStyleSheets.cpp: (WebCore::AuthorStyleSheets::updateActiveStyleSheets): * dom/AuthorStyleSheets.h: (WebCore::AuthorStyleSheets::usesRemUnits): Deleted. (WebCore::AuthorStyleSheets::setUsesRemUnit): Deleted. * dom/Document.cpp: (WebCore::Document::recalcStyle): (WebCore::Document::updateBaseURL): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): 2016-09-30 Zalan Bujtas <zalan@apple.com> RenderLayer::clipRects may return nullptr. https://bugs.webkit.org/show_bug.cgi?id=162729 Reviewed by Chris Dumez. This patch refactors RenderLayer::updateClipRects(), parentClipRects() and backgroundClipRect() so that we don't have to rely on this seemingly unsafe line: clipRects = *parent()->clipRects(clipRectsContext); Now updateClipRects() returns the computed/cached clip rects as opposed to update and refetch them. While this patch makes the code look more readable/safer, it also eliminates cached item tripple retrievals. No change in functionality. * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::getClipRects): (WebCore::ClipRectsCache::setClipRects): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::clipRects): (WebCore::RenderLayer::calculateClipRects): * rendering/RenderLayer.h: 2016-09-30 Youenn Fablet <youenn@apple.com> Add a way to go from a RefPtr<T> to Ref<const T> https://bugs.webkit.org/show_bug.cgi?id=162683 Reviewed by Alex Christensen. No change of behavior. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> Unreviewed, fix 32-bit build. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::decodedSizeChanged): 2016-09-30 Youenn Fablet <youenn@apple.com> FetchBody should use UTF8Encoding to encode text data https://bugs.webkit.org/show_bug.cgi?id=162775 Reviewed by Sam Weinig. Covered by added tests. Removing unnecesary vector allocation when extracting UTF8 bytes from a Request/Response text/URLSearchParams body. Making use of UTF8Encoding for consistency with the upload code path. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::consumeText): (WebCore::extractBytesFromText): Deleted. 2016-09-30 Said Abou-Hallawa <sabouhallawa@apple.com> Change the MemoryCache and CachedResource adjustSize functions to take a long argument https://bugs.webkit.org/show_bug.cgi?id=162708 <rdar://problem/28555702> Reviewed by Brent Fulgham. Because the MemoryCache stores the size of the cached memory in unsigned, two problems my happen when reporting a change in the size of the memory: 1. Signed integer overflow -- which can happen because MemoryCache::adjustSize() takes a signed integer argument. If the allocated or the freed memory size is larger than the maximum of a signed integer, an overflow will happen. For the image caching code, this can be seen where the unsigned decodedSize is casted to an integer before passing it to ImageObserver::decodedSizeChanged(). 2. Unsigned integer overflow -- which can happen if the new allocated memory size plus the currentSize exceeds the maximum of unsigned. This can be seen in MemoryCache::adjustSize() where we add delta to m_liveSize or m_deadSize without checking whether this addition will overflow or not. We do not assert for overflow although we assert for underflow. The fix for these two problems can be the following: 1. Make all the adjustSize functions all the way till MemoryCache::adjustSize() take a signed long integer argument. 2. Do not create a NativeImagePtr for an ImageFrame if its frameBytes plus the ImageFrameCache::decodedSize() will exceed the maximum of an unsigned integer. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::decodedSizeChanged): Change the argument to be long. No overflow will happen when casting the argument from unsigned to long. * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setDecodedSize): Use long integer casting when calling MemoryCache::adjustSize(). (WebCore::CachedResource::setEncodedSize): Ditto. * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::MemoryCache): Add as static assert to ensure sizeof(long long) can hold any unsigned or its negation. (WebCore::MemoryCache::revalidationSucceeded): Use long integer casting when calling MemoryCache::adjustSize(). (WebCore::MemoryCache::remove): Ditto. (WebCore::MemoryCache::adjustSize): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long. * loader/cache/MemoryCache.h: * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::destroyIncompleteDecodedData): Call a function with its new name. (WebCore::ImageFrameCache::decodedSizeChanged): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long. (WebCore::ImageFrameCache::decodedSizeIncreased): Use long integer casting when calling decodedSizeChanged(). (WebCore::ImageFrameCache::decodedSizeDecreased): Ditto. (WebCore::ImageFrameCache::decodedSizeReset): Ditto. (WebCore::ImageFrameCache::didDecodeProperties): Ditto. (WebCore::ImageFrameCache::frameAtIndex): Do not create the NativeImage if adding its frameByes to the MemoryCache will cause numerical overflow. (WebCore::ImageFrameCache::decodedSizeIncremented): Deleted. This function is renamed decodedSizeIncreased(). (WebCore::ImageFrameCache::decodedSizeDecremented): Deleted. This function is renamed decodedSizeDecreased(). * platform/graphics/ImageFrameCache.h: * platform/graphics/ImageObserver.h: * platform/graphics/IntSize.h: (WebCore::IntSize::unclampedArea): Returns the area of an IntSize in size_t. * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::decodedSizeChanged): Use long integer casting when calling ImageObserver::decodedSizeChanged(). 2016-09-30 Chris Dumez <cdumez@apple.com> Add support for ImageData.data attribute https://bugs.webkit.org/show_bug.cgi?id=162767 Reviewed by Sam Weinig. Add support for ImageData.data attribute: - https://html.spec.whatwg.org/#imagedata Firefox already supports it. No new tests, updated existing tests. * html/ImageData.idl: 2016-09-30 Youenn Fablet <youenn@apple.com> DumpRenderTree crashed in com.apple.WebCore: WTF::Optional<WebCore::FetchBodyOwner::BlobLoader>::operator bool const + 12 https://bugs.webkit.org/show_bug.cgi?id=162483 Reviewed by Alex Christensen. Test: fetch/closing-while-fetching-blob.html No change of behavior. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::stop): Asserting m_blobLoader is null (meaning that unsetPendingActivity was done) only in case FetchBodyOwner has no risk being destroyed. 2016-09-30 Youenn Fablet <youennf@gmail.com> [Fetch API] Add support for URLSearchParams body https://bugs.webkit.org/show_bug.cgi?id=162667 Reviewed by Alex Christensen. Tests: imported/w3c/web-platform-tests/fetch/api/basic/request-upload-worker.html imported/w3c/web-platform-tests/fetch/api/basic/request-upload.html * Modules/fetch/FetchBody.cpp: (WebCore::extractBytesFromText): Moving to a static function that should be moved to a String method. (WebCore::FetchBody::FetchBody): Adding constructor for URLSearchParams. (WebCore::FetchBody::extract): Adding URLSearchParams body initialization. (WebCore::FetchBody::consume): Consuming URLSearchParams bodies. (WebCore::FetchBody::consumeAsStream): Ditto. (WebCore::FetchBody::consumeText): Updated to take a parameter to handle both text and URLSearchParams bodies. (WebCore::FetchBody::bodyForInternalRequest): Add URLSearchParams body upload. (WebCore::FetchBody::clone): Add URLSearchParams body cloning * Modules/fetch/FetchBody.h: (WebCore::FetchBody::urlSearchParamsBody): * html/URLSearchParams.cpp: (WebCore::URLSearchParams::toString): * html/URLSearchParams.h: 2016-09-29 Simon Fraser <simon.fraser@apple.com> Re-order the arguments to drawPattern() functions https://bugs.webkit.org/show_bug.cgi?id=162772 Reviewed by Zalan Bujtas. Re-order the arguments to have the destination rect come near the front, leaving CompositeOperator and BlendMode hanging out at the back like other drawing functions. No behavior change. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::drawPattern): * platform/graphics/BitmapImage.h: * platform/graphics/CrossfadeGeneratedImage.cpp: (WebCore::CrossfadeGeneratedImage::drawPattern): * platform/graphics/CrossfadeGeneratedImage.h: * platform/graphics/GeneratedImage.h: * platform/graphics/GradientImage.cpp: (WebCore::GradientImage::drawPattern): * platform/graphics/GradientImage.h: * platform/graphics/GraphicsContext.h: * platform/graphics/Image.cpp: (WebCore::Image::drawTiled): * platform/graphics/Image.h: * platform/graphics/ImageBuffer.h: * platform/graphics/NamedImageGeneratedImage.cpp: (WebCore::NamedImageGeneratedImage::drawPattern): * platform/graphics/NamedImageGeneratedImage.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::drawPattern): * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::drawPattern): * platform/graphics/cairo/ImageCairo.cpp: (WebCore::Image::drawPattern): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawPattern): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::drawPattern): * platform/graphics/cg/ImageCG.cpp: This file can probably be removed and the code moved, since the code is almost the same as the cairo code, and not platform-specific. (WebCore::Image::drawPattern): * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::DrawPattern::DrawPattern): (WebCore::DisplayList::DrawPattern::apply): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::DrawPattern::create): * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::drawPattern): * platform/graphics/displaylists/DisplayListRecorder.h: * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::drawPatternForContainer): * svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::drawPattern): * svg/graphics/SVGImageForContainer.h: 2016-09-29 Chris Dumez <cdumez@apple.com> Add support for download attribute on area elements https://bugs.webkit.org/show_bug.cgi?id=162765 Reviewed by Brent Fulgham. Add support for download attribute on area elements: - https://html.spec.whatwg.org/#htmlanchorelement Because HTMLAreaElement inherits from HTMLAnchorElement on native side, and because HTMLAnchorElement already supports the download attribute, all that was needed was to add the download attribute to HTMLAreaElement.idl file. Test: http/tests/download/area-download.html * html/HTMLAreaElement.idl: 2016-09-29 Ryosuke Niwa <rniwa@webkit.org> Editor::findStringAndScrollToVisible is unused https://bugs.webkit.org/show_bug.cgi?id=162762 Reviewed by Simon Fraser. Deleted the unused function. * editing/Editor.cpp: (WebCore::Editor::findStringAndScrollToVisible): Deleted. * editing/Editor.h: 2016-09-29 Jiewen Tan <jiewen_tan@apple.com> Expose CryptoKey to web workers https://bugs.webkit.org/show_bug.cgi?id=162640 <rdar://problem/28182204> Reviewed by Brent Fulgham. Tests: crypto/workers/aes-postMessage-worker.html crypto/workers/hmac-postMessage-worker.html crypto/workers/hrsa-postMessage-worker.html crypto/workers/multiple-postMessage-worker.html crypto/workers/rsa-postMessage-worker.html * crypto/CryptoKey.idl: * crypto/SerializedCryptoKeyWrap.h: * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::deleteDefaultWebCryptoMasterKey): Add a way to delete the default web crypto master key such that we can test these APIs and cleanup. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::wrapCryptoKey): (WebCore::WorkerGlobalScope::unwrapCryptoKey): * workers/WorkerGlobalScope.h: 2016-09-29 Nan Wang <n_wang@apple.com> AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1 https://bugs.webkit.org/show_bug.cgi?id=162471 Reviewed by Simon Fraser. If the author has defined a maximum scale, we should honor that when keyboard focus moves to a text field, instead of using the forceAlwaysUserScalableMaximumScale. Tests: fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html * page/ViewportConfiguration.cpp: (WebCore::ViewportConfiguration::allowsUserScaling): (WebCore::ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable): (WebCore::ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling): Deleted. * page/ViewportConfiguration.h: (WebCore::ViewportConfiguration::maximumScaleIgnoringAlwaysScalable): (WebCore::ViewportConfiguration::maximumScale): Deleted. 2016-09-29 Alex Christensen <achristensen@webkit.org> Fix syntax violation handling in IPv4 address parsing https://bugs.webkit.org/show_bug.cgi?id=162756 Reviewed by Tim Horton. When we are parsing the up to 4 numbers in an IPv4 address, if we find a syntax violation (the canonicalized address would be different than the input string) then wait to report it until we have determined that this is a valid IPv4 address that will be canonicalized. If it is not a valid IPv4 address, then we will just treat the characters as the host, and that could be no syntax violation. Covered by a new API test and existing API tests. * platform/URLParser.cpp: (WebCore::URLParser::URLParser): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): * platform/URLParser.h: 2016-09-29 Chris Dumez <cdumez@apple.com> Fix post-landing nits after r206561. https://bugs.webkit.org/show_bug.cgi?id=162659 Reviewed by Alex Christensen. Uses more StringViews and constness. * dom/SecurityContext.cpp: (WebCore::SecurityContext::isSupportedSandboxPolicy): * dom/SecurityContext.h: * html/DOMTokenList.cpp: (WebCore::DOMTokenList::DOMTokenList): (WebCore::DOMTokenList::supports): * html/DOMTokenList.h: (WebCore::DOMTokenList::DOMTokenList): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::relList): * html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::sandbox): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::relList): * html/LinkRelAttribute.cpp: (WebCore::LinkRelAttribute::isSupported): * html/LinkRelAttribute.h: 2016-09-29 Alex Christensen <achristensen@webkit.org> URLParser should correctly parse ports with leading 0's https://bugs.webkit.org/show_bug.cgi?id=162752 * platform/URLParser.cpp: (WebCore::URLParser::parsePort): Followup. Remove branches based on Geoffrey's feedback. 2016-09-29 Alex Christensen <achristensen@webkit.org> URLParser should correctly parse ports with leading 0's https://bugs.webkit.org/show_bug.cgi?id=162752 Reviewed by Tim Horton. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parsePort): 2016-09-29 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r206483. https://bugs.webkit.org/show_bug.cgi?id=162750 May have caused iOS perf regression (Requested by smfr on #webkit). Reverted changeset: "REGRESSION (r204552): Yelp carousel animation is not smooth." https://bugs.webkit.org/show_bug.cgi?id=162632 http://trac.webkit.org/changeset/206483 2016-09-29 Alex Christensen <achristensen@webkit.org> URLParser: make parsing invalid IPv4 addresses more robust and correct https://bugs.webkit.org/show_bug.cgi?id=162746 Reviewed by Tim Horton. If parsing an IPv4 address fails, the characters are just treated as a regular domain. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): 2016-09-29 Alex Christensen <achristensen@webkit.org> URLParser: IPv6 addresses followed by a colon are invalid https://bugs.webkit.org/show_bug.cgi?id=162747 Reviewed by Tim Horton. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv6Host): 2016-09-29 Antoine Quint <graouts@apple.com> [Modern Media Controls] scheduler for layout nodes https://bugs.webkit.org/show_bug.cgi?id=162726 <rdar://problem/28543043> Reviewed by Dean Jackson. For the work on the modern media controls we will be using a tree of LayoutNode objects that will commit to the DOM in coordinated `requestAnimationFrame()` calls to ensure all layouts are done in an efficient and coordinated manner. As a preamble, we introduce a `scheduler` singleton which provides a single public method `scheduleLayout(callback)` to queue callbacks to be fired in the next `requestAnimationFrame()` callback. Tests: media/modern-media-controls/scheduler/not-reentrant.html media/modern-media-controls/scheduler/single-callback-when-registered-multiple-times.html * Modules/modern-media-controls/controls/scheduler.js: Added. (const.scheduler.new.prototype.scheduleLayout): (const.scheduler.new.prototype._requestFrameIfNeeded): (const.scheduler.new.prototype._frameDidFire): (const.scheduler.new.prototype._layout): 2016-09-28 Ryosuke Niwa <rniwa@webkit.org> Text nodes assigned to a linked slot are not clickable https://bugs.webkit.org/show_bug.cgi?id=162091 <rdar://problem/28383300> Reviewed by Antti Koivisto. The bug was caused by updateMouseEventTargetNode adjusting the target to its parent element when the original target was a text node. Fixed the bug by using the parent element in the composed tree. Also fixed the bug that the hit testing was not finding the anchor element and keeping the cursor in I-beam by traversing the composed tree instead. Test: fast/shadow-dom/click-text-inside-linked-slot.html * dom/Node.cpp: (WebCore::Node::enclosingLinkEventParentOrSelf): Fixed the cursor problem. * page/EventHandler.cpp: (WebCore::EventHandler::updateMouseEventTargetNode): Fixed the activation problem. 2016-09-29 Sam Weinig <sam@webkit.org> Allow overriding some NSURLSessionConfiguration properties on a per-NetworkProcess basis <rdar://problem/27648683> https://bugs.webkit.org/show_bug.cgi?id=162735 Reviewed by Dan Bernstein. * platform/spi/cf/CFNetworkSPI.h: Forward declare _sourceApplicationSecondaryIdentifier and _CTDataConnectionServiceType 2016-09-29 Antti Koivisto <antti@apple.com> Remove addSubresourceStyleURLs functions https://bugs.webkit.org/show_bug.cgi?id=162731 Reviewed by Ryosuke Niwa. Use the generic std::function taking traverseSubresources instead. This prevents bugs caused by the code paths not being in sync. These functions are only used by the legacy webarchive code to gather URLs to locate CachedResources from the memory cache. This can be improved further by returning the cached resources themselves instead of the URLs. * css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): Deleted. * css/CSSFontFaceSrcValue.h: * css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): Deleted. * css/CSSPrimitiveValue.h: * css/CSSReflectValue.cpp: (WebCore::CSSReflectValue::addSubresourceStyleURLs): Deleted. * css/CSSReflectValue.h: * css/CSSValue.cpp: (WebCore::CSSValue::addSubresourceStyleURLs): Deleted. * css/CSSValue.h: * css/CSSValueList.cpp: (WebCore::CSSValueList::addSubresourceStyleURLs): Deleted. * css/CSSValueList.h: * css/StyleProperties.cpp: (WebCore::StyleProperties::addSubresourceStyleURLs): Deleted. * css/StyleProperties.h: * css/StyleRuleImport.h: * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::traverseSubresources): Fix a bug where this would miss @import rules in @imported stylesheets. Include the CachedResource for the imported stylesheet itself. Tested by the test cases under LayoutTests/webarchive (WebCore::StyleSheetContents::addSubresourceStyleURLs): Deleted. * css/StyleSheetContents.h: * dom/StyledElement.cpp: (WebCore::StyledElement::addSubresourceAttributeURLs): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::addSubresourceAttributeURLs): * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::addSubresourceAttributeURLs): 2016-09-29 Brent Fulgham <bfulgham@apple.com> [Win][Direct2D] Add D2D Font handling code https://bugs.webkit.org/show_bug.cgi?id=162712 Reviewed by Brent Fulgham. This patch lands a set of new files that implement No new tests until complete backend lands. * platform/graphics/Font.h: * platform/graphics/FontCascade.h: (WebCore::FontCascade::syntheticObliqueAngle): Added helper function. * platform/graphics/FontPlatformData.h: (WebCore::FontPlatformData::dwFont): Added. (WebCore::FontPlatformData::dwFontFace): Ditto. * platform/graphics/GlyphBuffer.h: * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::FontCascade::drawGlyphs): Use helper function. * platform/graphics/win/FontCGWin.cpp: (WebCore::FontCascade::drawGlyphs): Ditto. * platform/graphics/win/FontCacheWin.cpp: (WebCore::FontCache::createFontPlatformData): Add case for Direct2D. * platform/graphics/win/FontCascadeDirect2D.cpp: Added. * platform/graphics/win/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Fix whitespace. (WebCore::FontCustomPlatformData::fontPlatformData): Add Direct2D case. * platform/graphics/win/FontPlatformDataCGWin.cpp: (WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers. * platform/graphics/win/FontPlatformDataCairoWin.cpp: (WebCore::FontPlatformData::FontPlatformData): Ditto. * platform/graphics/win/FontPlatformDataDirect2D.cpp: Added. * platform/graphics/win/FontPlatformDataWin.cpp: (WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers. * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: Added. * platform/graphics/win/SimpleFontDataDirect2D.cpp: Added. * platform/graphics/win/TextAnalyzerHelper.cpp: Added. * platform/graphics/win/TextAnalyzerHelper.h: Added. 2016-09-29 Alex Christensen <achristensen@webkit.org> URLParser should fail to parse unclosed IPv6 addresses https://bugs.webkit.org/show_bug.cgi?id=162715 Reviewed by Tim Horton. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseHostAndPort): 2016-09-29 Alex Christensen <achristensen@webkit.org> URLParser should ignore tabs at all possible locations https://bugs.webkit.org/show_bug.cgi?id=162711 Reviewed by Tim Horton. The URL spec says to remove all tabs and newlines before parsing a URL. To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator. This is fragile, but faster. It can be completely tested, though. That is what this patch does. Covered by an addition to the API tests that tries inserting one tab at each location of each test. * platform/URLParser.cpp: (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::isPercentEncodedDot): (WebCore::URLParser::isSingleDotPathSegment): (WebCore::URLParser::isDoubleDotPathSegment): (WebCore::URLParser::consumeSingleDotPathSegment): (WebCore::URLParser::consumeDoubleDotPathSegment): (WebCore::URLParser::checkLocalhostCodePoint): (WebCore::URLParser::isAtLocalhost): (WebCore::URLParser::isLocalhost): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::isPercentEncodedDot): Deleted. (WebCore::isSingleDotPathSegment): Deleted. (WebCore::isDoubleDotPathSegment): Deleted. (WebCore::consumeSingleDotPathSegment): Deleted. (WebCore::consumeDoubleDotPathSegment): Deleted. * platform/URLParser.h: (WebCore::URLParser::advance): 2016-09-29 Simon Fraser <simon.fraser@apple.com> Fix hit testing on display:block <svg> elements https://bugs.webkit.org/show_bug.cgi?id=162717 rdar://problem/23261130 Reviewed by Zalan Bujtas. RenderSVGRoot::nodeAtPoint() needs to test for both the HitTestBlockBackground and HitTestChildBlockBackground phases, since we only get the HitTestChildBlockBackground phase when the <svg> is a block. This is similar to code in RenderTable::nodeAtPoint(), and matches Blink code. This fixes the point dragging on http://anthonydugois.com/svg-path-builder/. Test: svg/hittest/block-svg.html * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::nodeAtPoint): 2016-09-29 Chris Dumez <cdumez@apple.com> Assigning non-numeric to input.minlength should set minlength to 0 https://bugs.webkit.org/show_bug.cgi?id=162727 Reviewed by Ryosuke Niwa. There was a typo when we were updating the m_minLength member from the 'min' content attribute instead of the 'minlength' one. Test: imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): 2016-09-29 Chris Dumez <cdumez@apple.com> [Web IDL] Fix overload resolution when the distinguishing argument is a Window https://bugs.webkit.org/show_bug.cgi?id=162728 Reviewed by Ryosuke Niwa. Fix overload resolution when the distinguishing argument is a Window. Window is special because we could have a window or a proxy to the Window (JSDOMWindowShell). * bindings/scripts/CodeGeneratorJS.pm: (GenerateOverloadedFunctionOrConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): * bindings/scripts/test/TestObj.idl: 2016-09-29 Per Arne Vollan <pvollan@apple.com> [Win] Compile fix. https://bugs.webkit.org/show_bug.cgi?id=162262 Reviewed by Anders Carlsson. If CoreText.h is included, we will get redefinition compile errors on some older SDK versions. * platform/spi/win/CoreTextSPIWin.h: 2016-09-29 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Remove WebCoreSynchronousLoader from ResourceHandleSoup https://bugs.webkit.org/show_bug.cgi?id=162723 Reviewed by Sergio Villar Senin. Since all soup based ports switched to NetworkProcess this is dead code. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::platformLoadResourceSynchronously): 2016-09-29 Nan Wang <n_wang@apple.com> AX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription https://bugs.webkit.org/show_bug.cgi?id=162586 Reviewed by Chris Fleizach. Exposed the label element's text as AXDescription for meter elements. Also refactored the code for fetching the label element's text and taken care of the case where aria-label and aria-labelledby attributes are used on label elements. Test: accessibility/mac/meter-with-label-element.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::isLabelable): (WebCore::AccessibilityNodeObject::textForLabelElement): (WebCore::AccessibilityNodeObject::titleElementText): (WebCore::AccessibilityNodeObject::title): (WebCore::AccessibilityNodeObject::usesAltTagForTextComputation): Deleted. * accessibility/AccessibilityNodeObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::exposesTitleUIElement): 2016-09-29 Romain Bellessort <romain.bellessort@crf.canon.fr> [Streams API] Improve ReadableStreamDefaultController.h/cpp https://bugs.webkit.org/show_bug.cgi?id=160293 Reviewed by Youenn Fablet. Various small improvements in ReadableStreamDefaultController code (helper methods and asserts). No change in behaviour. * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked): Added an assert and updated based on new helper methods. * bindings/js/ReadableStreamDefaultController.h: (WebCore::ReadableStreamDefaultController::close): Updated based on new helper methods. (WebCore::ReadableStreamDefaultController::error): Updated based on new helper methods. (WebCore::ReadableStreamDefaultController::enqueue): Added an assert and updated based on new helper methods. (WebCore::ReadableStreamDefaultController::jsController): New helper method. (WebCore::ReadableStreamDefaultController::globalObject): Return reference instead of pointer. (WebCore::ReadableStreamDefaultController::globalExec): New helper; return reference after performing an assert. (WebCore::ReadableStreamDefaultController::error<String>): Added an assert and updated based on new helper methods. 2016-09-29 Jon Davis <jond@apple.com> Added Beacon API to the Feature Status page. https://bugs.webkit.org/show_bug.cgi?id=162630 Reviewed by Alex Christensen. * features.json: 2016-09-28 Chris Dumez <cdumez@apple.com> Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped() https://bugs.webkit.org/show_bug.cgi?id=162709 Reviewed by Alex Christensen. Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped() as it is unused. This is the quickest way to allow DOMWindow / EventTarget members in IDL dictionaries. This is because the generated bindings code relies on convertWrapperType() in JSDOMConvert.h which calls toWrapped() with a single parameter. Right now, the only type that requires an ExecState for its toWrapped() is XPathNSResolver (which should likely be a callback interface rather than a regular interface). * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::toWrapped): * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::convertValue): * bindings/js/JSEventTargetCustom.cpp: (WebCore::JSEventTarget::toWrapped): * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (JSValueToNative): 2016-09-28 Chris Dumez <cdumez@apple.com> Log console messages when the anchor download attribute is ignored https://bugs.webkit.org/show_bug.cgi?id=162703 Reviewed by Alex Christensen. Log console messages when the anchor download attribute is ignored so that the developer can better understand what's happening. No new tests, rebaselined existing tests. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2016-09-28 Chris Dumez <cdumez@apple.com> Add support for DOMTokenList.supports() https://bugs.webkit.org/show_bug.cgi?id=162659 Reviewed by Ryosuke Niwa. Add support for DOMTokenList.supports(): - https://dom.spec.whatwg.org/#dom-domtokenlist-supports Firefox and Chrome already recently implemented it (Chrome since version 50 and Firefox since version 49). Test: fast/dom/DOMTokenList-supports.html * dom/SecurityContext.cpp: (WebCore::SecurityContext::isSupportedSandboxPolicy): (WebCore::SecurityContext::enforceSandboxFlags): Deleted. * dom/SecurityContext.h: * html/DOMTokenList.cpp: (WebCore::DOMTokenList::DOMTokenList): (WebCore::DOMTokenList::supports): (WebCore::DOMTokenList::replace): Deleted. * html/DOMTokenList.h: (WebCore::DOMTokenList::DOMTokenList): * html/DOMTokenList.idl: * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::parseAttribute): (WebCore::HTMLAnchorElement::relList): * html/HTMLAnchorElement.idl: * html/HTMLAreaElement.idl: * html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::sandbox): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::relList): * html/HTMLTableCellElement.idl: * html/LinkRelAttribute.cpp: (WebCore::LinkRelAttribute::isSupported): (WebCore::LinkRelAttribute::LinkRelAttribute): Deleted. * html/LinkRelAttribute.h: 2016-09-28 Ryosuke Niwa <rniwa@webkit.org> DOMTokenList’s value and stringifier should not return parsed tokens https://bugs.webkit.org/show_bug.cgi?id=161076 Reviewed by Chris Dumez. Updated our implementation of DOMTokenList.prototype.value and its toString function to match the latest DOM specification: https://dom.spec.whatwg.org/#interface-domtokenlist "value" attribute, on getting, runs its serialize steps, which simply gets the attribute value. On setting, it sets the attribute value with the given value. The stringification behavior returns the same serialize steps as "value" attribute on getting. This change simplifies our implementation of DOMTokenList and removes the need for m_cachedValue, which has been removed in this patch. No new tests since existing tests cover this. * html/DOMTokenList.cpp: (WebCore::DOMTokenList::value): Just call getAttribute. (WebCore::DOMTokenList::setValue): Just call setAttribute. (WebCore::DOMTokenList::updateTokensFromAttributeValue): (WebCore::DOMTokenList::associatedAttributeValueChanged): (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): Moved the code to update the tokens from from the attribute value. This is the "update steps". * html/DOMTokenList.h: 2016-09-28 Jer Noble <jer.noble@apple.com> CRASH at WebCore::CDMSessionAVStreamSession::update + 950 https://bugs.webkit.org/show_bug.cgi?id=162701 Reviewed by Beth Dakin. If the SourceBuffer backing a <video> element is removed before CDMSessionAVStreamSession::update() gets a chance to run, the protectedSourceBuffer will be null. Just bail early and indicate an error. * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::update): 2016-09-28 Alex Christensen <achristensen@webkit.org> URLParser should properly handle unexpected periods and overflows in IPv4 addresses https://bugs.webkit.org/show_bug.cgi?id=162655 Reviewed by Geoffrey Garen. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): * platform/URLParser.h: 2016-09-28 Wenson Hsieh <wenson_hsieh@apple.com> Some media tests are crashing due to soft-linking failures https://bugs.webkit.org/show_bug.cgi?id=162698 Reviewed by Jer Noble. We should be handling soft-linking failures for MRMediaRemoteSetNowPlayingVisibility gracefully. Guards these calls with canLoad_MediaRemote_MRMediaRemoteSetParentApplication and also use the SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER macro when soft linking. * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): * platform/mac/MediaRemoteSoftLink.cpp: * platform/mac/MediaRemoteSoftLink.h: 2016-09-28 Alex Christensen <achristensen@webkit.org> URLParser should ignore tabs in authority https://bugs.webkit.org/show_bug.cgi?id=162694 Reviewed by Geoffrey Garen. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parseAuthority): 2016-09-28 Alex Christensen <achristensen@webkit.org> URLParser should ignore extra slashes after scheme:// and handle a missing slash after the port https://bugs.webkit.org/show_bug.cgi?id=162690 Reviewed by Geoffrey Garen. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): 2016-09-28 Alex Christensen <achristensen@webkit.org> URLParser should correctly canonicalize uppercase IPv6 addresses https://bugs.webkit.org/show_bug.cgi?id=162680 Reviewed by Tim Horton. Covered by a new API test. * platform/URLParser.cpp: (WebCore::URLParser::parseIPv6Host): If there is an uppercase character in the IPv6 address part, then it is a syntax violation because the canonicalized IPv6 address differs from the input String. 2016-09-28 Chris Dumez <cdumez@apple.com> Unreviewed, fix iOS build. * bindings/js/ios/TouchConstructors.cpp: 2016-09-28 Chris Dumez <cdumez@apple.com> It should be possible to dispatch events on template documents https://bugs.webkit.org/show_bug.cgi?id=162687 Reviewed by Ryosuke Niwa. It should be possible to dispatch events on template documents. Firefox supports this. Chrome does not but this is likely not intentional as Chrome generally supports dispatching events on frameless documents. Test: fast/dom/template-document-dispatchEvent.html * dom/Document.cpp: (WebCore::Document::ensureTemplateDocument): 2016-09-27 Dean Jackson <dino@apple.com> Use Color references where possible https://bugs.webkit.org/show_bug.cgi?id=162643 <rdar://problem/28506550> Reviewed by Simon Fraser. There were a bunch of places where we pass or use Colors by value. As the Color class gets a bit more complicated, it would be nice to avoid copying, so use references where possible. * css/CSSGradientValue.cpp: (WebCore::interpolate): * css/StyleColor.h: (WebCore::StyleColor::getColor): (WebCore::StyleColor::resolve): * css/StyleResolver.h: (WebCore::StyleResolver::State::backgroundColor): * dom/Document.h: (WebCore::Document::textColor): * editing/FrameSelection.cpp: (WebCore::disappearsIntoBackground): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::setShadow): * html/canvas/CanvasRenderingContext2D.h: * html/track/TextTrackCueGeneric.h: * page/PageOverlay.cpp: (WebCore::PageOverlay::setBackgroundColor): * page/PageOverlay.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::PropertyWrapperColor::PropertyWrapperColor): (WebCore::PropertyWrapperMaybeInvalidColor::PropertyWrapperMaybeInvalidColor): (WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::fillRectWithRoundedHole): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::strokeColor): (WebCore::GraphicsContext::fillColor): * platform/graphics/InbandTextTrackPrivateClient.h: (WebCore::GenericCueData::foregroundColor): (WebCore::GenericCueData::setForegroundColor): (WebCore::GenericCueData::backgroundColor): (WebCore::GenericCueData::setBackgroundColor): (WebCore::GenericCueData::highlightColor): (WebCore::GenericCueData::setHighlightColor): * platform/graphics/ca/TileController.h: * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawRect): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::platformFillRoundedRect): (WebCore::GraphicsContext::fillRectWithRoundedHole): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::DrawFocusRingPath::color): (WebCore::DisplayList::DrawFocusRingRects::color): (WebCore::DisplayList::FillRectWithColor::color): (WebCore::DisplayList::FillCompositedRect::color): (WebCore::DisplayList::FillRoundedRect::color): (WebCore::DisplayList::FillRectWithRoundedHole::color): * platform/graphics/filters/FEDiffuseLighting.cpp: (WebCore::FEDiffuseLighting::lightingColor): * platform/graphics/filters/FEDiffuseLighting.h: * platform/graphics/filters/FEDropShadow.h: (WebCore::FEDropShadow::shadowColor): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::floodColor): (WebCore::FEFlood::platformApplySoftware): * platform/graphics/filters/FEFlood.h: * platform/graphics/filters/FESpecularLighting.cpp: (WebCore::FESpecularLighting::lightingColor): * platform/graphics/filters/FESpecularLighting.h: * platform/graphics/filters/FilterOperation.h: * rendering/BorderEdge.h: (WebCore::BorderEdge::color): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::paintBoxDecorations): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintSelection): * rendering/InlineTextBox.h: * rendering/RenderFrameSet.cpp: (WebCore::borderStartEdgeColor): (WebCore::borderEndEdgeColor): (WebCore::borderFillColor): * rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutlineForLine): * rendering/RenderInline.h: * rendering/RenderLayerCompositor.h: * rendering/RenderView.cpp: (WebCore::RenderView::paintBoxDecorations): * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::paintTextDecoration): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextWithShadows): * rendering/style/BorderValue.h: (WebCore::BorderValue::color): * rendering/style/CollapsedBorderValue.h: (WebCore::CollapsedBorderValue::color): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::color): (WebCore::RenderStyle::visitedLinkColor): (WebCore::RenderStyle::setColor): (WebCore::RenderStyle::setVisitedLinkColor): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::borderLeftColor): (WebCore::RenderStyle::borderRightColor): (WebCore::RenderStyle::borderTopColor): (WebCore::RenderStyle::borderBottomColor): (WebCore::RenderStyle::backgroundColor): (WebCore::RenderStyle::columnRuleColor): (WebCore::RenderStyle::outlineColor): (WebCore::RenderStyle::textEmphasisColor): (WebCore::RenderStyle::textFillColor): (WebCore::RenderStyle::textStrokeColor): (WebCore::RenderStyle::visitedLinkBackgroundColor): (WebCore::RenderStyle::visitedLinkBorderLeftColor): (WebCore::RenderStyle::visitedLinkBorderRightColor): (WebCore::RenderStyle::visitedLinkBorderBottomColor): (WebCore::RenderStyle::visitedLinkBorderTopColor): (WebCore::RenderStyle::visitedLinkOutlineColor): (WebCore::RenderStyle::visitedLinkColumnRuleColor): (WebCore::RenderStyle::textDecorationColor): (WebCore::RenderStyle::visitedLinkTextDecorationColor): (WebCore::RenderStyle::visitedLinkTextEmphasisColor): (WebCore::RenderStyle::visitedLinkTextFillColor): (WebCore::RenderStyle::visitedLinkTextStrokeColor): (WebCore::RenderStyle::stopColor): (WebCore::RenderStyle::floodColor): (WebCore::RenderStyle::lightingColor): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::build): * svg/SVGFEDropShadowElement.cpp: (WebCore::SVGFEDropShadowElement::build): * svg/SVGFEFloodElement.cpp: (WebCore::SVGFEFloodElement::build): * svg/SVGFESpecularLightingElement.cpp: (WebCore::SVGFESpecularLightingElement::build): * svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::buildStops): 2016-09-28 Ryosuke Niwa <rniwa@webkit.org> assignedNodes should include fallback contents when flattened option is set https://bugs.webkit.org/show_bug.cgi?id=162656 Reviewed by Antti Koivisto. Fixed the bug by traversing through fallback contents when there are no assigned nodes. Tests: imported/w3c/web-platform-tests/shadow-dom/slots.html imported/w3c/web-platform-tests/shadow-dom/slots-fallback.html * html/HTMLSlotElement.cpp: (WebCore::flattenAssignedNodes): (WebCore::HTMLSlotElement::assignedNodes): 2016-09-27 Wenson Hsieh <wenson_hsieh@apple.com> Adopt MediaRemote SPI to achieve desired Now Playing behavior https://bugs.webkit.org/show_bug.cgi?id=162658 <rdar://problem/28499358> Reviewed by Jer Noble. Restores the changes previously rolled out in r206444, and adopts new MediaRemote SPI to achieve the desired behavior for media in background tabs without breaking other features. Introduces 2 new unit tests in NowPlayingControlsTests. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::pageAllowsNowPlayingControls): * page/Page.cpp: (WebCore::Page::setViewState): * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSession): * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): * platform/mac/MediaRemoteSoftLink.cpp: * platform/mac/MediaRemoteSoftLink.h: * platform/spi/mac/MediaRemoteSPI.h: 2016-09-28 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION(r206481): ASSERTION FAILED: isDecoderAvailable() https://bugs.webkit.org/show_bug.cgi?id=162665 Reviewed by Simon Fraser. Remove a wrong assertion from ImageSource::destroyDecodedData(). Before r206481, the original function BitmapImage::destroyDecodedData() did not have this assertion. Destroying the decoded ImageFrames can happen after releasing the ImageDecoder. And it can happen also if decoding the image fails and BitmapImage::isNull() is true. See CachedImage::finishLoading(). * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::destroyDecodedData): 2016-09-28 Youenn Fablet <youenn@apple.com> WebCore::ResourceErrorBase::setType is crashing https://bugs.webkit.org/show_bug.cgi?id=162484 <rdar://problem/28390828> Reviewed by Alex Christensen. Test: http/tests/xmlhttprequest/on-network-timeout-error-during-preflight.html Behavior is slightly changed as we are no longer casting Timeout preflight errors as AccessControl errors. This is more inline with fetch spec which prescribes to send back any error received by preflight as response error for fetch. Ideally, we should not need to change errors received during preflight loads but the error type is important for some clients: - EventSource may try to reconnect if error is not AccessControl - XMLHttpRequest will send abort events in case of Cancellation errors and timeout events in case of Timeout errors * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::notifyFinished): Setting error type to AccessControl except in case of Timeout. (WebCore::CrossOriginPreflightChecker::doPreflight): Ditto. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::preflightFailure): Removing ASSERT since Timeout errors may be returned. * platform/network/ResourceErrorBase.h: (WebCore::ResourceErrorBase::isGeneral): New getter. 2016-09-28 Jer Noble <jer.noble@apple.com> PiP shows incorrect state of play button. https://bugs.webkit.org/show_bug.cgi?id=162652 Reviewed by Eric Carlson. After getting a new WebPlaybackSessionModel, the first thing WebVideoFullscreenInterfaceMac should do is query for it's playbackRate() and isPlaying() properties. * platform/mac/WebVideoFullscreenInterfaceMac.mm: (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac): 2016-09-28 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Add Chrome UA quirk https://bugs.webkit.org/show_bug.cgi?id=162617 Reviewed by Carlos Garcia Campos. Add Chrome UA quirk and use it on typekit.net, typekit.com, youtube.com, slack.com, and any domain that begins with "google". * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): (WebCore::urlRequiresChromeBrowser): (WebCore::standardUserAgentForURL): 2016-09-28 Jer Noble <jer.noble@apple.com> [MSE][Mac] In SourceBufferPrivateAVFObjC::abort(), support reseting parser to the last appended initialization segment. https://bugs.webkit.org/show_bug.cgi?id=135164 Reviewed by Eric Carlson. Test: media/media-source/media-source-abort-resets-parser.html Use the -[AVStreamDataParser appendStreamData:withFlags:] to implement "resetting" the parser. In this case, the parser isn't explicitly reset during resetParserState(), but rather a flag is set so that the next append signals a data discontinuity, and the parser is reset at that point. Because a previous append operation may be in-flight during this abort(), care must be taken to invalidate any operations which may have already started on a background thread. So SourceBufferPrivateAVFObjC will use a separate WeakPtrFactory for its append operations, will invalidate any outstanding WeakPtrs during an abort(), and will block until the previous append() operation completes. This will require the WebAVStreamDataParserListener object to occasionally have it's WeakPtr pointing back to the SourceBufferPrivateAVFObjC to be reset after an abort(), so make that ivar an @property. Rather than passing a RetainPtr to itself in all the callbacks it handles, the WebAVStreamDataParserListener can just pass in a copy of its own WeakPtr (which may be invalidated during an abort()). Break the distinct operations of "abort()" and "resetParserState()" into their own methods in SourceBufferPrivate and all its subclasses. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::resetParserState): (WebCore::SourceBuffer::abortIfUpdating): * platform/graphics/SourceBufferPrivate.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]): (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]): (-[WebAVStreamDataParserListener streamDataParser:didFailToParseStreamDataWithError:]): (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]): (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]): (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]): (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]): (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::append): (WebCore::SourceBufferPrivateAVFObjC::abort): (WebCore::SourceBufferPrivateAVFObjC::resetParserState): (-[WebAVStreamDataParserListener initWithParser:parent:]): Deleted. * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::resetParserState): * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: (WebCore::MockSourceBufferPrivate::resetParserState): * platform/mock/mediasource/MockSourceBufferPrivate.h: * platform/spi/mac/AVFoundationSPI.h: 2016-09-28 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] User agent should always claim to be Intel https://bugs.webkit.org/show_bug.cgi?id=162610 Reviewed by Carlos Garcia Campos. We should always claim to be running on Intel regardless of actual CPU type. See discussion in bug #162548 for details. In particular, we can never advertise ARM because it causes dumb websites to send mobile pages. * platform/gtk/UserAgentGtk.cpp: (WebCore::platformVersionForUAString): (WebCore::buildUserAgentString): (WebCore::cpuDescriptionForUAString): Deleted. 2016-09-28 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Adjust OS X UA quirks list https://bugs.webkit.org/show_bug.cgi?id=162616 Reviewed by Carlos Garcia Campos. Remove the OS X quirk for yahoo.com as it's no longer needed. Add quirks for taobao.com and whatsapp.com. * platform/gtk/UserAgentGtk.cpp: (WebCore::urlRequiresMacintoshPlatform): (WebCore::standardUserAgentForURL): 2016-09-28 Alejandro G. Castro <alex@igalia.com> Add WebIDL special operation support: serializer https://bugs.webkit.org/show_bug.cgi?id=156293 Reviewed by Youenn Fablet. Added support for the serializer special operation for WebIDLs, current implementation adds support for: - just the keyword: serializer; It will return all the attributes of in an object. - map of entries with the attributes: serializer = {attribute1, attribute2, ...} It creates a toJSON method that returns the serialized value converted into an ECMAScript value. For more information check the definition of the operation: http://heycam.github.io/webidl/#idl-serializers We have created a new function in the API of the objects that are marked as serializer. Used the support to add new API for RTCIceCandidate and RTCSessionDescription. Updated the tests expectations of the bindings. Tests: bindings/scripts/test/TestNode.idl bindings/scripts/test/TestObj.idl fast/mediastream/RTCIceCandidate.html fast/mediastream/RTCSessionDescription.html * Modules/mediastream/RTCIceCandidate.idl: Added the serializer operation. * Modules/mediastream/RTCSessionDescription.idl: Added the serializer operation. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Added the calls to the serializer code generator. (GenerateSerializerFunction): Added, generates the toJSON function adding all the serializable->attributes value to an object as defined in the spec. * bindings/scripts/IDLParser.pm: Modified the serializer parser that was unused to support the WebIDL spec parts. Added a new domSerializable type to store the list of attributes in the possible map. (parseSerializer): Modified the function to follow the semicolon rule in the spec, now the serializer line must have a semicolon like any other line. (parseSerializerRest): The function now has to get the attributes list from the pattern parsing function and add them to the domSerializable item. (parseSerializationPattern): Now this function returns the list of attributes in the serializable map or list if we have one. (parseSerializationAttributes): Added, this function replaces the Map and List functions, the currently supported parts are similar for both situations. (applyMemberList): Added the serializable item to the interface variable and populate the serializable in case there is not a defined map. (parseSerializationPatternMap): Replaced with parseSerializationAttributes. (parseSerializationPatternList): Ditto. * bindings/scripts/test/JS/JSTestNode.cpp: Modified the expected result. (WebCore::jsTestNodePrototypeFunctionToJSON): * bindings/scripts/test/JS/JSTestObj.cpp: Modified the expected result. (WebCore::jsTestObjPrototypeFunctionToJSON): * bindings/scripts/test/TestNode.idl: Added the serializer test. * bindings/scripts/test/TestObj.idl: Added serializer map test. 2016-09-28 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Simplify platformForUAString https://bugs.webkit.org/show_bug.cgi?id=162614 Reviewed by Carlos Garcia Campos. Note in particular that the previous PLATFORM(MAC) check was wrong here, as that is never true for GTK; this patch risks changing it to OS(MAC_OS_X), on the hope that advertising Mac when running on Mac might not break anything. If it does, then we should remove it and just always pretend to be on X11. * platform/gtk/UserAgentGtk.cpp: (WebCore::platformForUAString): 2016-09-28 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Bump fake Safari version in UA https://bugs.webkit.org/show_bug.cgi?id=162615 Reviewed by Carlos Garcia Campos. Pretend to be Safari 10.0 to fix sites that don't work when we pretend to be Safari 8.0. * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-09-28 Khaled Hosny <khaledhosny@eglug.org> Use new woff2 API https://bugs.webkit.org/show_bug.cgi?id=162608 Reviewed by Michael Catanzaro. Test: fast/text/woff2-totalsfntsize.html * platform/graphics/WOFFFileFormat.cpp: (WebCore::WOFF2VectorOut::WOFF2VectorOut): (WebCore::WOFF2VectorOut::Write): (WebCore::WOFF2VectorOut::Size): (WebCore::convertWOFFToSfnt): 2016-09-28 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Add warning comment in UserAgentGtk.cpp https://bugs.webkit.org/show_bug.cgi?id=162618 Reviewed by Carlos Garcia Campos. * platform/gtk/UserAgentGtk.cpp: 2016-09-28 Romain Bellessort <romain.bellessort@crf.canon.fr> [Streams API] Align cancelReadableStream() with spec https://bugs.webkit.org/show_bug.cgi?id=162556 Reviewed by Xabier Rodriguez-Calvar. Aligned cancelReadableStream() with Streams API. In particular, private cancel() method was added to ReadableStreamDefaultController and function name was replaced by readableStreamCancel(). Implementation of cancel() (as well as pull()) is actually made in ReadableStreamInternals.js to avoid creating new function for each controller. No change in behaviour. * Modules/streams/ReadableStream.js: (cancel): Updated with reference to readableStreamCancel(). * Modules/streams/ReadableStreamDefaultReader.js: (cancel): Updated with reference to readableStreamCancel(). * Modules/streams/ReadableStreamInternals.js: (privateInitializeReadableStreamDefaultController): Refer to external functions (cancel/pull) to avoid creating new functions. (teeReadableStreamBranch2CancelFunction): Updated with reference to readableStreamCancel(). (readableStreamCancel): New name for cancelReadableStream(), behaviour aligned with spec. (readableStreamDefaultControllerCancel): Added to avoid creating new function for each controller. (readableStreamDefaultControllerPull): Added to avoid creating new function for each controller. (readFromReadableStreamDefaultReader): Updated call to pull method to pass controller. * bindings/js/WebCoreBuiltinNames.h: Added "cancel". 2016-09-27 Joonghun Park <jh718.park@samsung.com> [EFL] Fix debug build break since r206481. Unreviewed https://bugs.webkit.org/show_bug.cgi?id=162662 No new tests, no new behaviours. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::draw): 2016-09-27 Nan Wang <n_wang@apple.com> AX: CrashTracer: com.apple.WebKit.WebContent at WebCore::AXObjectCache::localCaretRectForCharacterOffset(WebCore::RenderObject*&, WebCore::CharacterOffset const&) + 116 https://bugs.webkit.org/show_bug.cgi?id=162654 Reviewed by Chris Fleizach. rangeForUnorderedCharacterOffsets() can return a null Range but we failed to do a null check in localCaretRectForCharacterOffset() before dereferencing it. Test: accessibility/mac/bounds-for-range-crash.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::localCaretRectForCharacterOffset): 2016-09-27 Alex Christensen <achristensen@webkit.org> Inline critical functions in URLParser https://bugs.webkit.org/show_bug.cgi?id=162653 Reviewed by Myles C. Maxfield. This gives me about a 15% speed improvement. * platform/URLParser.cpp: (WebCore::CodePointIterator::CodePointIterator): (WebCore::CodePointIterator::operator==): (WebCore::CodePointIterator::operator!=): (WebCore::CodePointIterator::operator=): (WebCore::CodePointIterator::atEnd): (WebCore::CodePointIterator::codeUnitsSince): (WebCore::CodePointIterator<LChar>::operator): (WebCore::CodePointIterator<UChar>::operator): (WebCore::appendCodePoint): (WebCore::isC0Control): (WebCore::isC0ControlOrSpace): (WebCore::isTabOrNewline): (WebCore::isInSimpleEncodeSet): (WebCore::isInDefaultEncodeSet): (WebCore::isInUserInfoEncodeSet): (WebCore::isInvalidDomainCharacter): (WebCore::isPercentOrNonASCII): (WebCore::isSlashQuestionOrHash): (WebCore::isValidSchemeCharacter): (WebCore::URLParser::advance): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::percentEncodeByte): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::isDefaultPort): (WebCore::isSpecialScheme): (WebCore::isPercentEncodedDot): (WebCore::isSingleDotPathSegment): (WebCore::isDoubleDotPathSegment): (WebCore::consumeSingleDotPathSegment): (WebCore::consumeDoubleDotPathSegment): (WebCore::URLParser::popPath): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::zeroSequenceLength): (WebCore::findLongestZeroSequence): (WebCore::pow256): (WebCore::percentDecode): (WebCore::containsOnlyASCII): (WebCore::domainToASCII): (WebCore::hasInvalidDomainCharacter): (WebCore::formURLDecode): (WebCore::serializeURLEncodedForm): 2016-09-27 Zalan Bujtas <zalan@apple.com> REGRESSION (r204552): Yelp carousel animation is not smooth. https://bugs.webkit.org/show_bug.cgi?id=162632 Reviewed by Simon Fraser. For composited state changes when the layers don't need rebuilding, the updateGeometry() traversal is post-order (see webkit.org/162634), so we can't rely on the offsetfromRenderer() value when computing the graphics layer position on the descendants. We need this workaround until after webkit.org/162634 gets fixed. Tests: compositing/hidpi-composited-container-and-graphics-layer-gap-changes.html compositing/hidpi-negative-composited-bounds-on-device-pixel.html * rendering/RenderLayerBacking.cpp: (WebCore::computeOffsetFromAncestorGraphicsLayer): (WebCore::ComputedOffsets::ComputedOffsets): (WebCore::ComputedOffsets::fromAncestorGraphicsLayer): (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect): 2016-09-27 Said Abou-Hallawa <sabouhallawa@apple.com> Move caching the ImageFrame from BitmapImage to ImageSource https://bugs.webkit.org/show_bug.cgi?id=155498 Reviewed by Simon Fraser. BitmapImage has two modes of operation regarding its image decoding state. The first mode happens when a remote image is loaded as encoded data and which requires an ImageDecoder to generate the image metadata and the the ImageFrames. The second mode happens when a BitmapImage is created with a NativeImagePtr. In this case, no ImageDecoder is needed. To remove this burden from the BitmapImage the member 'm_frames' is removed from BitmapImage. A new member named 'm_frameCache' of type ImageFrameCache is added to ImageSource. This class handles caching and recaching the image metadata and the ImageFrames if the image needs decoding. When the BitmapImage is initialized with a memory image, the ImageFrameCache initializes its metadata and ImageFrames directly from the NativeImagePtr. The plan for ImageFrameCache is to be extended for the asynchronous image decoding and also to be used by the non CG image decoders which cache other copies of the ImageFrames. This double caching should be removed. When the BitmapImage is replying to the ImageFrame queries, it will ask the ImageSource which will pass the query the ImageFrameCache. ImageFrameCache will ensure the requested ImageFrame is cached and is valid for the requested SubSamplingLevel before accessing the data members of this ImageFrame. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: Add and ImageFrameCache.cpp to the WebCore project. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::BitmapImage): Move initializing the image metadata to ImageSource. Add initializers for the remaining members in the class declaration. (WebCore::BitmapImage::destroyDecodedData): Move most of the logic of this function to ImageFrameCache::destroyDecodedData(). The only part which can't be moved is the call invalidatePlatformData(). (WebCore::BitmapImage::destroyDecodedDataIfNecessary): Move the logic of this function to ImageFrameCache::destroyDecodedDataIfNecessary(). (WebCore::BitmapImage::dataChanged): Move the logic of this function to ImageSource::dataChanged(). (WebCore::BitmapImage::frameImageAtIndex): Move most of the logic of this function to ImageFrameCache::frameImageAtIndex(). The only part which can't be moved is the call invalidatePlatformData() if the required subsampling level is different from the subsampling level for the cached frame image. (WebCore::BitmapImage::draw): Replace the BitmapImage cached metadata with the corresponding ImageSource cached metadata. (WebCore::BitmapImage::drawPattern): Ditto. (WebCore::BitmapImage::shouldAnimate): Ditto. (WebCore::BitmapImage::startAnimation): Ditto. (WebCore::BitmapImage::internalAdvanceAnimation): Ditto. (WebCore::BitmapImage::dump): Call ImageSource::dump() to dump the image cached metadata. (WebCore::BitmapImage::haveFrameImageAtIndex): Deleted. (WebCore::BitmapImage::destroyMetadataAndNotify): Deleted. (WebCore::BitmapImage::cacheFrame): Deleted. (WebCore::BitmapImage::didDecodeProperties): Deleted. (WebCore::BitmapImage::updateSize): Deleted. (WebCore::BitmapImage::size): Deleted. (WebCore::BitmapImage::sizeRespectingOrientation): Deleted. (WebCore::BitmapImage::hotSpot): Deleted. (WebCore::BitmapImage::frameCount): Deleted. (WebCore::BitmapImage::isSizeAvailable): Deleted. (WebCore::BitmapImage::ensureFrameAtIndexIsCached): Deleted. (WebCore::BitmapImage::frameIsCompleteAtIndex): Deleted. (WebCore::BitmapImage::frameDurationAtIndex): Deleted. (WebCore::BitmapImage::frameHasAlphaAtIndex): Deleted. (WebCore::BitmapImage::currentFrameKnownToBeOpaque): Deleted. (WebCore::BitmapImage::frameOrientationAtIndex): Deleted. (WebCore::BitmapImage::singlePixelSolidColor): Deleted. (WebCore::BitmapImage::repetitionCount): Deleted. * platform/graphics/BitmapImage.h: Managing the ImageFrames caching is moved to ImageFrameCache. Caching the image metadata is now moved to the ImageSource. * platform/graphics/GeneratedImage.h: * platform/graphics/Image.h: (WebCore::Image::orientationForCurrentFrame): (WebCore::Image::singlePixelSolidColor): Change currentFrameKnownToBeOpaque(), orientationForCurrentFrame() and singlePixelSolidColor() to be const. * platform/graphics/ImageFrame.cpp: (WebCore::ImageFrame::defaultFrame): Returns an empty ImageFrame to get the default ImageFrame metadata. (WebCore::ImageFrame::fillMetadata): Deleted. Moved to ImageFrameCache. (WebCore::ImageFrame::initialize): Deleted. Ditto. * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::setDuration): Change the type of the argument to float instead of unsigned. (WebCore::ImageFrame::hasAlpha): Protect the unset m_hasAlpha by checking hasMetadata() first. * platform/graphics/ImageFrameCache.cpp: Added. (WebCore::ImageFrameCache::ImageFrameCache): Two constructors similar to what we do for ImageSource and BitmapImage. (WebCore::ImageFrameCache::destroyDecodedData): Moved from BitmapImage.cpp. (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Ditto. (WebCore::ImageFrameCache::destroyIncompleteDecodedData): Ditto. (WebCore::ImageFrameCache::decodedSizeChanged): Ditto. (WebCore::ImageFrameCache::decodedSizeIncremented): Ditto. (WebCore::ImageFrameCache::decodedSizeDecremented): Ditto. (WebCore::ImageFrameCache::decodedSizeReset): Ditto. (WebCore::ImageFrameCache::didDecodeProperties): Ditto. (WebCore::ImageFrameCache::growFrames): Grows the size of m_frames if necessary. (WebCore::ImageFrameCache::setNativeImage): Initializes the ImageFrame metadata directly from the NativeImagePtr. (WebCore::ImageFrameCache::setFrameNativeImage): Initializes the ImageFrame image and the metadata. (WebCore::ImageFrameCache::setFrameMetadata): Initializes the ImageFrame metadata from the ImageDecoder. (WebCore::ImageFrameCache::frameAtIndex): Returns an ImageFrame given its index. Cache or recache the requested ImageFrame if necessary. (WebCore::ImageFrameCache::clearMetadata): Invalidates the cached image metadata. (WebCore::ImageFrameCache::metadata): A template function which returns an image metadata property. (WebCore::ImageFrameCache::frameMetadataAtIndex): A template function which returns an ImageFrame metadata property. (WebCore::ImageFrameCache::isSizeAvailable): An image metadata property. (WebCore::ImageFrameCache::frameCount): Ditto. (WebCore::ImageFrameCache::repetitionCount): Ditto. (WebCore::ImageFrameCache::filenameExtension): Ditto. (WebCore::ImageFrameCache::hotSpot): Ditto. (WebCore::ImageFrameCache::size): An image metadata property but we get it from the first ImageFrame. (WebCore::ImageFrameCache::sizeRespectingOrientation): Ditto. (WebCore::ImageFrameCache::singlePixelSolidColor): Ditto. (WebCore::ImageFrameCache::frameIsCompleteAtIndex): An ImageFrame metadata property. (WebCore::ImageFrameCache::frameHasAlphaAtIndex): Ditto. (WebCore::ImageFrameCache::frameHasImageAtIndex): Ditto. (WebCore::ImageFrameCache::frameHasInvalidNativeImageAtIndex): Ditto. (WebCore::ImageFrameCache::frameSubsamplingLevelAtIndex): Ditto. (WebCore::ImageFrameCache::frameSizeAtIndex): Ditto. (WebCore::ImageFrameCache::frameBytesAtIndex): Ditto. (WebCore::ImageFrameCache::frameDurationAtIndex): Ditto. (WebCore::ImageFrameCache::frameOrientationAtIndex): Ditto. (WebCore::ImageFrameCache::frameImageAtIndex): Ditto. * platform/graphics/ImageFrameCache.h: Added. (WebCore::ImageFrameCache::setDecoder): Sets the current ImageDecoder which is owned by the ImageSource. (WebCore::ImageFrameCache::decodedSize): Returns the size of the cached NativeImages. (WebCore::ImageFrameCache::isDecoderAvailable): Returns whether an ImageDecoder is available. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ImageSource): Initializes the ImageFrameCache based on the image decoding state. (WebCore::ImageSource::clearFrameBufferCache): Replace initialized() with isDecoderAvailable(). (WebCore::ImageSource::clear): Clears the ImageDecoder of the ImageFrameCache. (WebCore::ImageSource::destroyDecodedData): Moved from BitmapImage.cpp. (WebCore::ImageSource::destroyDecodedDataIfNecessary): Ditto. (WebCore::ImageSource::ensureDecoderAvailable): Creates an ImageDecoder if necessary and sets it in ImageFrameCache. (WebCore::ImageSource::setData): (WebCore::ImageSource::dataChanged): Moved from BitmapImage.cpp. (WebCore::ImageSource::isAllDataReceived): (WebCore::ImageSource::maximumSubsamplingLevel): Rename calculateMaximumSubsamplingLevel() to maximumSubsamplingLevel(). (WebCore::ImageSource::subsamplingLevelForScale): (WebCore::ImageSource::createFrameImageAtIndex): (WebCore::ImageSource::dump): (WebCore::ImageSource::calculateMaximumSubsamplingLevel): Deleted. Renamed to maximumSubsamplingLevel(). (WebCore::ImageSource::updateMetadata): Deleted. Not needed. Caching the image metadata is the responsibility of ImageFrameCache. (WebCore::ImageSource::bytesDecodedToDetermineProperties): Deleted. Not needed. (WebCore::ImageSource::isSizeAvailable): Deleted. Moved to ImageSource.h. (WebCore::ImageSource::size): Deleted. Ditto. (WebCore::ImageSource::sizeRespectingOrientation): Deleted. Ditto. (WebCore::ImageSource::frameCount): Deleted. Ditto. (WebCore::ImageSource::repetitionCount): Deleted. Ditto. (WebCore::ImageSource::filenameExtension): Deleted. Ditto. (WebCore::ImageSource::hotSpot): Deleted. Ditto. (WebCore::ImageSource::frameIsCompleteAtIndex): Deleted. Ditto. (WebCore::ImageSource::frameHasAlphaAtIndex): Deleted. Ditto. (WebCore::ImageSource::frameAllowSubsamplingAtIndex): Deleted. Ditto. (WebCore::ImageSource::frameSizeAtIndex): Deleted. Ditto. (WebCore::ImageSource::frameBytesAtIndex): Deleted. Ditto. (WebCore::ImageSource::frameDurationAtIndex): Deleted. Ditto. (WebCore::ImageSource::frameOrientationAtIndex): Deleted. Ditto. * platform/graphics/ImageSource.h: (WebCore::ImageSource::isDecoderAvailable): initialized() was renamed to isDecoderAvailable(). (WebCore::ImageSource::decodedSize): Send the query to ImageFrameCache. (WebCore::ImageSource::isSizeAvailable): Ditto. (WebCore::ImageSource::frameCount): Ditto. (WebCore::ImageSource::repetitionCount): Ditto. (WebCore::ImageSource::filenameExtension): Ditto. (WebCore::ImageSource::hotSpot): Ditto. (WebCore::ImageSource::size): Ditto. (WebCore::ImageSource::sizeRespectingOrientation): Ditto. (WebCore::ImageSource::singlePixelSolidColor): Ditto. (WebCore::ImageSource::frameIsCompleteAtIndex): Ditto. (WebCore::ImageSource::frameHasAlphaAtIndex): Ditto. (WebCore::ImageSource::frameHasImageAtIndex): Ditto. (WebCore::ImageSource::frameHasInvalidNativeImageAtIndex): Ditto. (WebCore::ImageSource::frameSubsamplingLevelAtIndex): Ditto. (WebCore::ImageSource::frameSizeAtIndex): Ditto. (WebCore::ImageSource::frameBytesAtIndex): Ditto. (WebCore::ImageSource::frameDurationAtIndex): Ditto. (WebCore::ImageSource::frameOrientationAtIndex): Ditto. (WebCore::ImageSource::frameImageAtIndex): Ditto. (WebCore::ImageSource::decoder): Deleted. Not needed. (WebCore::ImageSource::initialized): Deleted. Was renamed to isDecoderAvailable(). (WebCore::ImageSource::setNeedsUpdateMetadata): Deleted. Not needed. * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/graphics/cg/GraphicsContext3DCG.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): Ditto. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoder::ImageDecoder): Make the constructor of ImageDecoder be the same for all ports. (WebCore::ImageDecoder::setData): Removed unused overloaded function. (WebCore::ImageDecoder::size): Deleted. Removed unused function. * platform/graphics/cg/ImageDecoderCG.h: (WebCore::ImageDecoder::create): Make the constructor of CG ImageDecoder be like the other ports. (WebCore::ImageDecoder::isAllDataReceived): Make this property owned by ImageDecoder. * platform/graphics/cg/PDFDocumentImage.h: Change currentFrameKnownToBeOpaque() to be const. * platform/graphics/efl/GraphicsContext3DEfl.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/graphics/mac/ImageMac.mm: (WebCore::BitmapImage::invalidatePlatformData): m_frames is owned by ImageFrameCache. ImageFrameCache::frameCount() has to be equal to ImageFrame::m_frames.size(). * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::create): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/image-decoders/ImageDecoder.h: (WebCore::ImageDecoder::ImageDecoder): Ditto. (WebCore::ImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata(). * platform/image-decoders/bmp/BMPImageDecoder.cpp: (WebCore::BMPImageDecoder::BMPImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/image-decoders/bmp/BMPImageDecoder.h: * platform/image-decoders/gif/GIFImageDecoder.cpp: (WebCore::GIFImageDecoder::GIFImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. (WebCore::GIFImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata(). * platform/image-decoders/gif/GIFImageDecoder.h: * platform/image-decoders/gif/GIFImageReader.cpp: * platform/image-decoders/gif/GIFImageReader.h: * platform/image-decoders/ico/ICOImageDecoder.cpp: (WebCore::ICOImageDecoder::ICOImageDecoder): (WebCore::ICOImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata(). (WebCore::ICOImageDecoder::decode): Move resizing the m_frameBufferCache from ICOImageDecoder::frameCount() to ICOImageDecoder::decode(). (WebCore::ICOImageDecoder::decodeAtIndex): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/image-decoders/ico/ICOImageDecoder.h: * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: (WebCore::JPEGImageDecoder::JPEGImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/image-decoders/jpeg/JPEGImageDecoder.h: * platform/image-decoders/png/PNGImageDecoder.cpp: (WebCore::PNGImageDecoder::PNGImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource. * platform/image-decoders/png/PNGImageDecoder.h: (WebCore::PNGImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata(). * platform/image-decoders/webp/WEBPImageDecoder.cpp: (WebCore::WEBPImageDecoder::WEBPImageDecoder): * platform/image-decoders/webp/WEBPImageDecoder.h: * svg/graphics/SVGImage.h: Make currentFrameKnownToBeOpaque() be const. * svg/graphics/SVGImageForContainer.h: Ditto. 2016-09-27 Alex Christensen <achristensen@webkit.org> Correctly parse URLs with the first tab in the fragment https://bugs.webkit.org/show_bug.cgi?id=162650 Reviewed by Saam Barati. Covered by a new API test. * platform/URLParser.cpp: (WebCore::URLParser::fragmentSyntaxViolation): 2016-09-27 Chris Dumez <cdumez@apple.com> <a download> does not honor the same-origin requirement https://bugs.webkit.org/show_bug.cgi?id=156100 Reviewed by Alex Christensen. We now completely ignore the "download" attribute on anchors if the href URL is cross-origin. We therefore navigate to the URL instead of forcefully downloading it in this case and leave it up to the server to give us the right headers if it should be downloaded. This is conservative and matches Firefox. Chrome and the HTML specification ignore only the suggested filename if the URL is cross-origin but still download the file. No new tests, updated existing test. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2016-09-27 Alex Christensen <achristensen@webkit.org> URLParser: Handle windows drive letters after two slashes in relative URLs according to spec https://bugs.webkit.org/show_bug.cgi?id=162646 Reviewed by Saam Barati. Covered by new API tests. * platform/URLParser.cpp: (WebCore::CodePointIterator::codeUnitsSince): (WebCore::URLParser::appendWindowsDriveLetter): (WebCore::URLParser::parse): (WebCore::isWindowsDriveLetter): Deleted. (WebCore::URLParser::checkWindowsDriveLetter): Deleted. * platform/URLParser.h: 2016-09-27 Alex Christensen <achristensen@webkit.org> URLs with @ in the user should only search for the last @ until the end of the authority and host https://bugs.webkit.org/show_bug.cgi?id=162635 Reviewed by Geoffrey Garen. Covered by new API tests. * platform/URLParser.cpp: (WebCore::URLParser::parse): 2016-09-27 Chris Dumez <cdumez@apple.com> It should be possible to dispatch events on documents created using DOMParser https://bugs.webkit.org/show_bug.cgi?id=26147 Reviewed by Ryosuke Niwa. It should be possible to dispatch events on documents created using DOMParser. It did not work because we were not setting the context document on the newly created document in DOMParser::parseFromString(). Firefox and Chrome both already support this. Test: fast/dom/parsed-document-dispatchEvent.html * xml/DOMParser.cpp: (WebCore::DOMParser::DOMParser): (WebCore::DOMParser::parseFromString): * xml/DOMParser.h: (WebCore::DOMParser::create): * xml/DOMParser.idl: 2016-09-26 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Improve performance of complex text codepath https://bugs.webkit.org/show_bug.cgi?id=161936 Reviewed by Simon Fraser. CoreText exposes a bit on the CTRunStatus which represents whether the run actually uses the glyph origins concept introduced in r205396. If this bit is not set, we can use the (slightly faster) call to CTRunGetAdvances() instead of CTRunGetBaseAdvancesAndOrigins(). In addition, if none of the runs have this bit set, we don't need to allocate storage for the vector of origins at all, thereby using less memory. No new tests because there is no behavior change. * platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::advance): (WebCore::ComplexTextController::adjustGlyphsAndAdvances): * platform/graphics/mac/ComplexTextController.h: (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins): (WebCore::ComplexTextController::glyphOrigin): * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): * platform/spi/cocoa/CoreTextSPI.h: 2016-09-27 Ryosuke Niwa <rniwa@webkit.org> Import w3c shadow DOM tests and fix one assertion https://bugs.webkit.org/show_bug.cgi?id=162629 Reviewed by Chris Dumez. The assertion failure was caused by RelatedNodeRetargeter's constructor mixing up the ancestor tree scopes for the target and the related target. Fixed the bug by reversing the two. Tests: imported/w3c/web-platform-tests/shadow-dom/event-composed-path-with-related-target.html * dom/EventPath.cpp: (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter): i and m_ancestorTreeScopes are for the related target and j and targetTreeScopeAncestors are for the target. 2016-09-27 Chris Dumez <cdumez@apple.com> It should be possible to dispatch events on documents that do not have a browsing context https://bugs.webkit.org/show_bug.cgi?id=162620 Reviewed by Ryosuke Niwa. It should be possible to dispatch events on documents that do not have a browsing context (e.g. Documents created using DOMImplementation.createHTMLDocument()). Gecko and Blink both allow this but WebKit did not. The approach chosen to support this is similar to the one in Blink. When constructing a new document (e.g. using DOMImplementation.createHTMLDocument()) we now keep track of the context document. When requesting the scriptExecutionContext(), we now return the context document if the document has one instead of the document itself. Test: imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document.html * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::visitAdditionalChildren): * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): (WebCore::DOMImplementation::createHTMLDocument): * dom/Document.cpp: (WebCore::Document::create): (WebCore::Document::cloneDataFromDocument): (WebCore::Document::contextDocument): (WebCore::Document::takeDOMWindowFrom): Deleted. * dom/Document.h: (WebCore::Document::setContextDocument): (WebCore::Node::scriptExecutionContext): (WebCore::Node::isDocumentNode): Deleted. * dom/Document.idl: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseXML): 2016-09-27 Alex Christensen <achristensen@webkit.org> Implement URLParser::syntaxViolation https://bugs.webkit.org/show_bug.cgi?id=162593 Reviewed by Geoffrey Garen. Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., and the String can be used untouched. When this happens, we do not want to allocate and copy the String. We want to just add a reference to an existing String. Sometimes we need to canonicalize the String because there has been a syntaxViolation, defined as any String that is different than its canonicalized URL String. In such cases we need to allocate a new String and fill it with the canonicalized URL String. When a syntaxViolation happens for the first time, we know that everything in the input String up to that point is equal to what it would have been if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where instead of just looking at the input URL String, we canonicalize each code point into the buffer. Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs, as well as additional spec compliance when parsing empty and null URLs relative to other URLs. Both are covered by new API tests. Existing behavior covered by existing API tests. This is about a 15% speed improvement on my URL parsing benchmark. * platform/URL.cpp: (WebCore::assertProtocolIsGood): (WebCore::URL::protocolIs): (WebCore::protocolIs): * platform/URL.h: * platform/URLParser.cpp: (WebCore::isTabOrNewline): (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): (WebCore::URLParser::isWindowsDriveLetter): (WebCore::URLParser::appendToASCIIBuffer): (WebCore::URLParser::checkWindowsDriveLetter): (WebCore::URLParser::shouldCopyFileURL): (WebCore::URLParser::utf8PercentEncode): (WebCore::URLParser::utf8QueryEncode): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::syntaxViolation): (WebCore::URLParser::fragmentSyntaxViolation): (WebCore::URLParser::parsedDataView): (WebCore::URLParser::currentPosition): (WebCore::URLParser::URLParser): (WebCore::URLParser::parse): (WebCore::URLParser::parseAuthority): (WebCore::URLParser::parseIPv4Number): (WebCore::URLParser::parseIPv4Host): (WebCore::URLParser::parseIPv6Host): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): (WebCore::URLParser::incrementIteratorSkippingTabAndNewLine): Deleted. (WebCore::URLParser::syntaxError): Deleted. (WebCore::parseIPv4Number): Deleted. * platform/URLParser.h: (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines): 2016-09-27 Wenson Hsieh <wenson_hsieh@apple.com> Related videos on YouTube (and YouTube playlists) cause media controls to disappear https://bugs.webkit.org/show_bug.cgi?id=162621 <rdar://problem/28484193> Reviewed by Jer Noble. Tweaks the main content media heuristic for better Now Playing behavior on YouTube by making the following changes: - Remove the strict requirement for audio to be actively playing for the session to be able to show controls for the purpose of Now Playing, making it the same as our policy for the controls manager. - Make playback requirement restrictions apply only for the controls manager. Videos that do not autoplay will still have the correct behavior with respect to Now Playing, since we will bail in the hasEverNotifiedAboutPlaying() check. - Only consider the main content heuristic as preventing media controls from showing up for the purposes of the controls manager. Now Playing should instead account for this by preferring elements large enough for main content after collecting all of the candidate sessions. * html/HTMLMediaElement.cpp: (WebCore::mediaElementSessionInfoForSession): (WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession): (WebCore::HTMLMediaElement::updatePlayState): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager): * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::sessionWillBeginPlayback): 2016-09-27 Chris Dumez <cdumez@apple.com> Second parameter to MutationObserver.observe() should be optional https://bugs.webkit.org/show_bug.cgi?id=162627 Reviewed by Ryosuke Niwa. Second parameter to MutationObserver.observe() should be optional: - https://dom.spec.whatwg.org/#interface-mutationobserver Firefox agrees with the specification. There is no real behavior change except that MutationObserver.prototype.observe.length is now 1 instead of 2. Passing only one parameter will still throw a TypeError because the Dictionary is empty. However, this parameter needs to be marked as optional because Web IDL requires the last parameter to be optional if it is a Dictionary. No new tests, rebaselined existing test. * dom/MutationObserver.idl: 2016-09-20 Anders Carlsson <andersca@apple.com> PlatformEvent::m_modifiers should be an OptionSet https://bugs.webkit.org/show_bug.cgi?id=162326 Reviewed by Daniel Bates. * page/EventHandler.cpp: (WebCore::EventHandler::handleAccessKey): * page/EventHandler.h: * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::accessKeyModifiers): * platform/PlatformEvent.h: (WebCore::PlatformEvent::shiftKey): (WebCore::PlatformEvent::ctrlKey): (WebCore::PlatformEvent::altKey): (WebCore::PlatformEvent::metaKey): (WebCore::PlatformEvent::modifiers): (WebCore::PlatformEvent::PlatformEvent): * platform/PlatformKeyboardEvent.h: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::modifiersForEvent): (WebCore::typeForEvent): * replay/SerializationMethods.cpp: (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue): (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue): * replay/WebInputs.json: 2016-09-27 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> [GTK] Handle Wayland & X11 correctly for GST_GL https://bugs.webkit.org/show_bug.cgi?id=162619 Reviewed by Carlos Garcia Campos. The checks for GST_GL consider X11 and Wayland are exclusive alternatives, but it turns out we can enable both! We need to check them independently and also include a runtime check. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): fix checks for X11 and Wayland to handle the case where both are enabled. Includes a runtime check. 2016-09-27 Eric Carlson <eric.carlson@apple.com> [MediaStream] Restructure MediaConstraints classes https://bugs.webkit.org/show_bug.cgi?id=162571 Reviewed by Jer Noble. No new tests, no functional changes. * Modules/mediastream/MediaConstraintsImpl.cpp: (WebCore::MediaConstraintsImpl::initialize): Deleted, no longer used. * Modules/mediastream/MediaConstraintsImpl.h: * bindings/js/JSMediaDevicesCustom.cpp: (WebCore::createStringConstraint): Return Optional<> instead of RefPtr<>. (WebCore::createBooleanConstraint): Ditto. (WebCore::createDoubleConstraint): Ditto. (WebCore::createIntConstraint): Ditto. (WebCore::parseMediaTrackConstraintSetForKey): Deal with above change. * platform/mediastream/CaptureDeviceManager.cpp: (CaptureDeviceManager::verifyConstraintsForMediaType): Use constraints.mandatoryConstraints.filter instead of direct enumeration. (CaptureDeviceManager::sessionSupportsConstraint): Use downcast<>. (CaptureDeviceManager::isSupportedFrameRate): Ditto. * platform/mediastream/MediaConstraints.cpp: (WebCore::StringConstraint::find): Lose the ConstraintType parameter. (WebCore::StringConstraint::merge): Use downcast<>. (WebCore::FlattenedConstraint::set): Use ConstraintHolder. (WebCore::FlattenedConstraint::merge): Ditto. (WebCore::MediaTrackConstraintSetMap::forEach): New. (WebCore::MediaTrackConstraintSetMap::filter): Ditto. (WebCore::MediaTrackConstraintSetMap::isEmpty): Ditto. (WebCore::MediaTrackConstraintSetMap::set): Ditto. (WebCore::MediaConstraint::copy): Deleted. (WebCore::IntConstraint::copy): Deleted. (WebCore::DoubleConstraint::copy): Deleted. (WebCore::BooleanConstraint::copy): Deleted. (WebCore::StringConstraint::copy): Deleted. * platform/mediastream/MediaConstraints.h: (WebCore::MediaConstraint::MediaConstraint): (WebCore::MediaConstraint::isEmpty): (WebCore::MediaConstraint::isMandatory): (WebCore::MediaConstraint::merge): (WebCore::MediaConstraint::isInt): (WebCore::MediaConstraint::isDouble): (WebCore::MediaConstraint::isBoolean): (WebCore::MediaConstraint::isString): (WebCore::MediaConstraint::dataType): (WebCore::MediaConstraint::constraintType): (WebCore::NumericConstraint::getMin): (WebCore::NumericConstraint::getMax): (WebCore::NumericConstraint::getExact): (WebCore::NumericConstraint::getIdeal): (WebCore::NumericConstraint::fitnessDistance): (WebCore::NumericConstraint::validForRange): (WebCore::NumericConstraint::find): (WebCore::NumericConstraint::NumericConstraint): (WebCore::NumericConstraint::innerMerge): (WebCore::FlattenedConstraint::isEmpty): (WebCore::FlattenedConstraint::iterator::iterator): (WebCore::FlattenedConstraint::iterator::operator*): (WebCore::FlattenedConstraint::iterator::operator++): (WebCore::FlattenedConstraint::iterator::operator==): (WebCore::FlattenedConstraint::iterator::operator!=): (WebCore::FlattenedConstraint::begin): (WebCore::FlattenedConstraint::end): (WebCore::FlattenedConstraint::ConstraintHolder::create): (WebCore::FlattenedConstraint::ConstraintHolder::~ConstraintHolder): (WebCore::FlattenedConstraint::ConstraintHolder::constraint): (WebCore::FlattenedConstraint::ConstraintHolder::dataType): (WebCore::FlattenedConstraint::ConstraintHolder::constraintType): (WebCore::FlattenedConstraint::ConstraintHolder::ConstraintHolder): (WebCore::MediaConstraint::getMin): Deleted. (WebCore::MediaConstraint::getMax): Deleted. (WebCore::MediaConstraint::getExact): Deleted. (WebCore::MediaConstraint::getIdeal): Deleted. (WebCore::MediaConstraint::validForRange): Deleted. (WebCore::MediaConstraint::find): Deleted. (WebCore::MediaConstraint::fitnessDistance): Deleted. (WebCore::MediaConstraint::type): Deleted. * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::fitnessDistance): Use downcast<>. (WebCore::applyNumericConstraint): (WebCore::RealtimeMediaSource::applyConstraint): Ditto. (WebCore::RealtimeMediaSource::selectSettings): Ditto. Use constraints.mandatoryConstraints.filter instead of direct enumeration. (WebCore::RealtimeMediaSource::applyConstraints): (WebCore::RealtimeMediaSource::setSampleRate): Sample rate is an int, not a double. (WebCore::RealtimeMediaSource::setSampleSize): Sample size is also an int. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVCaptureDeviceManager.mm: (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Use downcast<>. * platform/mock/MediaConstraintsMock.cpp: (WebCore::isIntMediaConstraintSatisfiable): Use downcast<>. (WebCore::isDoubleMediaConstraintSatisfiable): Ditto. (WebCore::isBooleanMediaConstraintSatisfiable): Ditto. (WebCore::isStringMediaConstraintSatisfiable): (WebCore::isSatisfiable): (WebCore::MediaConstraintsMock::verifyConstraints): Use constraints.mandatoryConstraints.filter instead of direct enumeration. * platform/mock/MediaConstraintsMock.h: * platform/mock/MockRealtimeAudioSource.h: * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): 2016-09-27 Wenson Hsieh <wenson_hsieh@apple.com> Some Now Playing behavior is broken after r206315 https://bugs.webkit.org/show_bug.cgi?id=162625 <rdar://problem/28496755> Reviewed by Jer Noble. Reverts the part of our heuristic that disables Now Playing in active tabs in the main window. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::pageAllowsNowPlayingControls): * page/Page.cpp: (WebCore::Page::setViewState): 2016-09-27 Ryan Haddad <ryanhaddad@apple.com> Remove an unneeded assert in InspectorOverlay.cpp https://bugs.webkit.org/show_bug.cgi?id=162581 Reviewed by Alexey Proskuryakov. This assertion was added to catch unknown issues, but it is firing frequently enough on certain Inspector tests that it is causing more harm than good. * inspector/InspectorOverlay.cpp: (WebCore::buildQuadObjectForCSSRegionContentClip): (WebCore::evaluateCommandInOverlay): 2016-09-27 Jer Noble <jer.noble@apple.com> Remove deprecated ENCRYPTED_MEDIA implementation. https://bugs.webkit.org/show_bug.cgi?id=161010 Reviewed by Eric Carlson. Remove all references to the deprecated ENABLE_ENCRYPTED_MEDIA (leaving in place the soon-to-be deprecated ENABLE_ENCRYPTED_MEDIA_V2). * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/objc/DOMHTMLMediaElement.h: * bindings/objc/DOMHTMLMediaElement.mm: (-[DOMHTMLMediaElement canPlayType:]): (-[DOMHTMLMediaElement canPlayType:keySystem:]): Deleted. * bindings/js/JSDictionary.cpp: * bindings/js/JSDictionary.h: * dom/Element.idl: * dom/EventNames.in: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::exceptionCodeForMediaKeyException): Deleted. (WebCore::HTMLMediaElement::canPlayType): Deleted. (WebCore::HTMLMediaElement::mediaPlayerKeyAdded): Deleted. (WebCore::HTMLMediaElement::mediaPlayerKeyError): Deleted. (WebCore::HTMLMediaElement::mediaPlayerKeyMessage): Deleted. (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded): Deleted. * html/HTMLMediaElement.h: * html/HTMLMediaElement.idl: * html/MediaError.h: * html/MediaError.idl: * html/MediaKeyError.h: * html/MediaKeyError.idl: * html/MediaKeyEvent.cpp: Removed. (WebCore::MediaKeyEvent::MediaKeyEvent): Deleted. (WebCore::MediaKeyEvent::~MediaKeyEvent): Deleted. (WebCore::MediaKeyEvent::eventInterface): Deleted. * html/MediaKeyEvent.h: Removed. * html/MediaKeyEvent.idl: Removed. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::nextBestMediaEngine): (WebCore::MediaPlayer::generateKeyRequest): Deleted. (WebCore::MediaPlayer::addKey): Deleted. (WebCore::MediaPlayer::cancelKeyRequest): Deleted. (WebCore::MediaPlayer::keyAdded): Deleted. (WebCore::MediaPlayer::keyError): Deleted. (WebCore::MediaPlayer::keyMessage): Deleted. (WebCore::MediaPlayer::keyNeeded): Deleted. * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerKeyAdded): Deleted. (WebCore::MediaPlayerClient::mediaPlayerKeyError): Deleted. (WebCore::MediaPlayerClient::mediaPlayerKeyMessage): Deleted. (WebCore::MediaPlayerClient::mediaPlayerKeyNeeded): Deleted. * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::addKey): Deleted. (WebCore::MediaPlayerPrivateInterface::generateKeyRequest): Deleted. (WebCore::MediaPlayerPrivateInterface::cancelKeyRequest): Deleted. * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::update): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem): (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType): Deleted. (WebCore::MediaPlayerPrivateAVFoundationObjC::generateKeyRequest): Deleted. (WebCore::MediaPlayerPrivateAVFoundationObjC::addKey): Deleted. (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelKeyRequest): Deleted. * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivateQTKit::supportsType): Deleted. * testing/MockCDM.h: 2016-09-27 Youenn Fablet <youenn@apple.com> [Fetch API] Use Ref<const T> in FetchBody::m_data variant https://bugs.webkit.org/show_bug.cgi?id=162599 Reviewed by Alex Christensen. Covered by existing tests. Using Ref<const T> for all variants of m_data except for FormData since FetchBody is actually creating it and may modifiy it. Updating blob loading code path to use a const Blob& instead of a Blob&. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::FetchBody): (WebCore::FetchBody::extract): (WebCore::FetchBody::clone): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::blobBody): (WebCore::FetchBody::arrayBufferBody): (WebCore::FetchBody::arrayBufferViewBody): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::loadBlob): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): * Modules/fetch/FetchLoader.h: 2016-09-27 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed typo fix * platform/gtk/UserAgentGtk.cpp: (WebCore::standardUserAgent): 2016-09-27 Youenn Fablet <youenn@apple.com> Clean-up CachedImage constructor https://bugs.webkit.org/show_bug.cgi?id=162601 Reviewed by Sam Weinig. No change of behavior. Removing an unused constructor. Specializing one constructor for manually cached images. Cleaning initialization of some CachedImage fields. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImage): * loader/cache/CachedImage.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::addImageToCache): 2016-09-27 Michael Catanzaro <mcatanzaro@igalia.com> [FreeType] Add comment further justifying use of FT_LOAD_FORCE_AUTOHINT https://bugs.webkit.org/show_bug.cgi?id=162607 Reviewed by Martin Robinson. * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: (WebCore::FontCustomPlatformData::FontCustomPlatformData): 2016-09-27 Mario Sanchez Prada <mario@endlessm.com> Build fails for X11+EGL due to missing gst_gl_display_x11_new_with_display() https://bugs.webkit.org/show_bug.cgi?id=162606 Reviewed by Gustavo Noronha Silva. Use the right check to retrieve the right instance of GstGLDisplay depending on whether we're using GLX or EGL, not X11 or Wayland. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): 2016-09-27 Youenn Fablet <youenn@apple.com> [GTK][EFL] imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html is failing https://bugs.webkit.org/show_bug.cgi?id=162547 Reviewed by Michael Catanzaro. Covered by existing tests. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::createTestingSession): Setting the underlying soupSession. 2016-09-27 Youenn Fablet <youenn@apple.com> [Fetch API] Remove ReadableStreamSource firstReadCallback https://bugs.webkit.org/show_bug.cgi?id=162339 Reviewed by Sam Weinig. No observable change of behavior. Removing ReadableStreamSource firstReadCallback. This makes the enqueuing of data to happen when the stream is created. In the future, we may want to implement doPull() to enqueue data when stream actually needs it. * Modules/fetch/FetchResponseSource.cpp: (WebCore::FetchResponseSource::doPull): Introduced as we introduce pull() in ReadableStreamSource. * Modules/fetch/FetchResponseSource.h: * Modules/streams/ReadableStreamInternals.js: (readFromReadableStreamDefaultReader): Removing firstReadCallback use. * Modules/streams/ReadableStreamSource.h: Renaming m_startPromise in m_promise since m_promise may store start and pull promises. (WebCore::ReadableStreamSource::isStarting): (WebCore::ReadableStreamSource::start): (WebCore::ReadableStreamSource::pull): Introduced to support ReadableStreamSource pulling. (WebCore::ReadableStreamSource::startFinished): (WebCore::ReadableStreamSource::pullFinished): Ditto. (WebCore::ReadableStreamSource::clean): * Modules/streams/ReadableStreamSource.idl: Ditto. * bindings/js/JSReadableStreamSourceCustom.cpp: Refactoring to use callPromiseFunction (WebCore::startReadableStream): (WebCore::JSReadableStreamSource::start): (WebCore::pullReadableStream): Introduced to support ReadableStreamSource pulling. (WebCore::JSReadableStreamSource::pull): Ditto. * bindings/js/WebCoreBuiltinNames.h: Removing firstReadCallback 2016-09-27 Myles C. Maxfield <mmaxfield@apple.com> REGRESSION(r205883): Letterpressed text is invisible https://bugs.webkit.org/show_bug.cgi?id=162590 <rdar://problem/28141512> Reviewed by Simon Fraser. r205883 removed the last place where we use CGFonts directly in WebKit. However, our letterpress code is sensitive to the current state of the CGContext. Tests: fast/text/letterpress-different.html fast/text/letterpress-paint.html * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::showLetterpressedGlyphsWithAdvances): 2016-09-27 Youenn Fablet <youenn@apple.com> [Fetch API] Refactor FetchBody to use std::experimental::variant https://bugs.webkit.org/show_bug.cgi?id=162559 Reviewed by Alex Christensen. Covered by exiting tests. Using variant to represent the variant data types. Adding nullptr as a specific type for default empty values and to allow clean-up. Adding FetchBody::clone as the default copy constructor is deleted with this change. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::FetchBody): (WebCore::FetchBody::json): (WebCore::FetchBody::text): (WebCore::FetchBody::consumeAsStream): (WebCore::FetchBody::consumeArrayBuffer): (WebCore::FetchBody::consumeArrayBufferView): (WebCore::FetchBody::consumeText): (WebCore::FetchBody::consumeBlob): (WebCore::FetchBody::extractFromText): (WebCore::FetchBody::bodyForInternalRequest): (WebCore::FetchBody::clone): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::blobBody): (WebCore::FetchBody::formDataBody): (WebCore::FetchBody::arrayBufferBody): (WebCore::FetchBody::arrayBufferViewBody): (WebCore::FetchBody::textBody): * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::clone): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::cloneForJS): 2016-09-26 Joonghun Park <jh718.park@samsung.com> [EFL] Fix debug build break since r204205. Unreviewed https://bugs.webkit.org/show_bug.cgi?id=162596 No new tests, no new behaviours. * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::frameImageAtIndex): 2016-09-26 Wenson Hsieh <wenson_hsieh@apple.com> If you play a youtube video from now playing after it finished in Safari, controls disappear https://bugs.webkit.org/show_bug.cgi?id=162589 <rdar://problem/28484047> Reviewed by Jer Noble. Tweaks the main content heuristic slightly to remove the "mostly in mainframe" requirement in the case of Now Playing. This was added in the case of the controls manager as an additional way to identify video elements that should not show controls, since we relax audio and video constraints for showing videos in the controls manager, so that a video element is prevented from showing controls on grounds of lacking audio only if it has never had audio before. In the case of Now Playing, we have stricter requirements for videos, which must have audio, which makes the mainframe heuristic not necessary. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager): 2016-09-26 Antti Koivisto <antti@apple.com> Setter on style element's textContent or cssText doesn't trigger style recalc https://bugs.webkit.org/show_bug.cgi?id=160331 <rdar://problem/27609715> Reviewed by Ryosuke Niwa and Daniel Bates. We would not notify the parent when text node content changed in a shadow tree. Test: fast/shadow-dom/shadow-style-text-mutation.html * dom/AuthorStyleSheets.cpp: (WebCore::AuthorStyleSheets::updateActiveStyleSheets): Invalidate shadow root children instead of the root itself when doing full invalidation. The invalidity bits have no meaning for non-element, non-texts. * dom/CharacterData.cpp: (WebCore::CharacterData::parserAppendData): (WebCore::CharacterData::setDataAndUpdate): (WebCore::CharacterData::notifyParentAfterChange): Add a helper and call it also in shadow trees. (WebCore::CharacterData::dispatchModifiedEvent): * dom/CharacterData.h: 2016-09-26 Antti Koivisto <antti@apple.com> Input elements don't work inside shadow tree https://bugs.webkit.org/show_bug.cgi?id=160427 Reviewed by Darin Adler. There is a bug in ComposedTreeIterator. If the iterator is initialized with an initial state where the root is inside a shadow tree it won't iterate into slots. If an input element is in a shadow tree it generates narrowly scoped style updates. When RenderTreeUpdater applies such an update the update root will be inside the shadow tree and the bug will prevent the render tree for slotted content from updating. Added tests for both the iterator behavior and the specific symptom with input elements. Tests: fast/shadow-dom/composed-tree-shadow-child-subtree.html fast/shadow-dom/input-element-in-shadow.html * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::ComposedTreeIterator): Check and cache if the root is inside shadow tree. (WebCore::ComposedTreeIterator::traverseNextInShadowTree): * dom/ComposedTreeIterator.h: (WebCore::ComposedTreeIterator::traverseNext): If it is, always use the shadow traversal code path. 2016-09-26 Wenson Hsieh <wenson_hsieh@apple.com> Seeking video doesn't update seek position https://bugs.webkit.org/show_bug.cgi?id=162575 <rdar://problem/28457219> Reviewed by Jer Noble. On ToT, seeking in a video causes the playhead to stutter, and does not actually update media remote's seek position. This is partly due to how we do not update media remote with new information when beginning to respond to remote seek commands, so media remote continues to think that a playing video is still playing despite the user attempting to seek through it. To fix this, we introduce timer-based guards around remote seek commands, such that a seek "gesture" begins when we receive the first seek command and ends when no seek command has been received in a set amount of time (this is 0.5 seconds, which is approximately what other clients around the platform use). Also, when responding to a remote seek, perform the seek with no tolerance. This prevents the playhead from stuttering at the end of a seek from the final requested destination of the seek to the last actually seeked time in the video. When beginning to seek, we must pause the media. Through existing mechanisms, this causes the media session manager to update its Now Playing information, which informs media remote that we are no longer playing and prevents us from stuttering. However, when ending a seek, we must also trigger an additional update to again refresh media remote's view of the current time. This prevents a flicker when playing media after seeking. Unit tests to be added in a follow-up due to time constraints. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::handleSeekToPlaybackPosition): (WebCore::HTMLMediaElement::seekToPlaybackPositionEndedTimerFired): (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): * html/HTMLMediaElement.h: * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::scheduleUpdateNowPlayingInfo): (WebCore::PlatformMediaSessionManager::sessionDidEndRemoteScrubbing): (WebCore::PlatformMediaSessionManager::sessions): Deleted. * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): (WebCore::MediaSessionManagerMac::scheduleUpdateNowPlayingInfo): (WebCore::MediaSessionManagerMac::sessionDidEndRemoteScrubbing): (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): 2016-09-26 Chris Dumez <cdumez@apple.com> [WK2] BlobDownloadClient should use asynchronous IPC to decide destination path https://bugs.webkit.org/show_bug.cgi?id=162568 Reviewed by Alex Christensen. Update BlobResourceHandle to wait for continueDidReceiveResponse() to be called after it calls the client's didReceiveResponseAsync(), before actually reading the Blob Data. No new tests, covered by existing tests. * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::continueDidReceiveResponse): (WebCore::BlobResourceHandle::getSizeForNext): (WebCore::BlobResourceHandle::notifyResponseOnSuccess): (WebCore::BlobResourceHandle::notifyResponseOnError): 2016-09-26 Daniel Bates <dabates@apple.com> Mark Ping{Handle, Load} as final https://bugs.webkit.org/show_bug.cgi?id=162576 Reviewed by Alex Christensen. We should not support subclassing of a ping handle or overriding its ResourceHandleClient callbacks because there are security/privacy implications with a ping request. We should not encourage subclassing without careful consideration. * platform/network/PingHandle.h: 2016-09-26 Daniel Bates <dabates@apple.com> Rename IOS_TEXT_AUTOSIZING to TEXT_AUTOSIZING https://bugs.webkit.org/show_bug.cgi?id=162365 Reviewed by Simon Fraser. Repurpose the feature name TEXT_AUTOSIZING for the ENABLE(IOS_TEXT_AUTOSIZING)-guarded code as this code represents WebKit's automatic text size adjustment machinery and is compiled on both macOS and iOS. * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSPropertyNames.in: * css/StyleBuilderCustom.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::updateFont): * css/StyleResolver.h: * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::CSSParser::parseValue): * css/parser/CSSParser.h: * css/parser/CSSParserMode.h: * dom/Document.cpp: (WebCore::Document::destroyRenderTree): * dom/Document.h: * editing/EditingStyle.cpp: * page/FrameView.cpp: (WebCore::FrameView::layout): * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: * page/Settings.in: * platform/graphics/FontCascade.h: * platform/graphics/FontDescription.cpp: * platform/graphics/FontDescription.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::RenderBlockFlow): * rendering/RenderBlockFlow.h: * rendering/RenderElement.cpp: * rendering/RenderElement.h: * rendering/RenderObject.cpp: * rendering/RenderObject.h: * rendering/RenderText.cpp: (WebCore::RenderText::RenderText): * rendering/RenderText.h: * rendering/TextAutoSizing.cpp: * rendering/TextAutoSizing.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresLayout): * rendering/style/RenderStyle.h: * rendering/style/StyleInheritedData.cpp: (WebCore::StyleInheritedData::StyleInheritedData): (WebCore::StyleInheritedData::operator==): * rendering/style/StyleInheritedData.h: * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator==): * rendering/style/StyleRareInheritedData.h: * rendering/style/TextSizeAdjustment.h: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setTextAutosizingEnabled): (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride): * testing/InternalSettings.h: 2016-09-26 Nan Wang <n_wang@apple.com> AX: Progress: [Mac] Content in label element should be used as AXTitle or AXDescription https://bugs.webkit.org/show_bug.cgi?id=162573 Reviewed by Chris Fleizach. Exposed the label element's text as the AXTitle of the progress indicator. Test: accessibility/mac/progress-with-label-element.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::titleElementText): (WebCore::AccessibilityNodeObject::title): 2016-09-26 Ryan Haddad <ryanhaddad@apple.com> Rebaseline bindings tests after r206386. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: 2016-09-26 Youenn Fablet <youenn@apple.com> ASSERTION FAILED: m_origin || m_type == CachedResource::MainResource https://bugs.webkit.org/show_bug.cgi?id=162472 <rdar://problem/28431522> Reviewed by Chris Dumez. Covered by existing tests. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImage): Fixing the last CachedImage constructor. Using CachedResource protected constructor. * loader/cache/CachedResource.h: Small clean-up. 2016-09-26 Youenn Fablet <youenn@apple.com> [GTK][EFL] imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html is failing https://bugs.webkit.org/show_bug.cgi?id=162547 Reviewed by Carlos Garcia Campos. Covered by LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/accept-header.html now passing. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::createTestingSession): Setting a default Accept-Language value. 2016-09-26 Mark Lam <mark.lam@apple.com> Added RETURN_IF_EXCEPTION() macro and use it for exception checks. https://bugs.webkit.org/show_bug.cgi?id=162521 Reviewed by Saam Barati. No new tests because this patch is mostly refactoring. The only change in behavior is that functions that have a JSValue return type will now return the empty JSValue when an exception is thrown. I tested this behavior by running the existing JSC and layout tests. * bindings/js/ArrayValue.cpp: (WebCore::ArrayValue::get): * bindings/js/IDBBindingUtilities.cpp: (WebCore::toJS): * bindings/js/JSApplePaySessionCustom.cpp: (WebCore::JSApplePaySession::completeShippingMethodSelection): (WebCore::JSApplePaySession::completeShippingContactSelection): (WebCore::JSApplePaySession::completePaymentMethodSelection): * bindings/js/JSAudioTrackCustom.cpp: (WebCore::JSAudioTrack::setKind): (WebCore::JSAudioTrack::setLanguage): * bindings/js/JSBlobCustom.cpp: (WebCore::constructJSBlob): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): * bindings/js/JSCommandLineAPIHostCustom.cpp: (WebCore::getJSListenerFunctions): * bindings/js/JSCryptoAlgorithmDictionary.cpp: (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier): (WebCore::getHashAlgorithm): (WebCore::createAesCbcParams): (WebCore::createAesKeyGenParams): (WebCore::createHmacKeyParams): (WebCore::createRsaKeyGenParams): (WebCore::createRsaOaepParams): * bindings/js/JSCryptoKeySerializationJWK.cpp: (WebCore::getStringFromJSON): (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): (WebCore::buildJSONForRSAComponents): (WebCore::addUsagesToJSON): (WebCore::JSCryptoKeySerializationJWK::serialize): * bindings/js/JSCustomElementInterface.cpp: (WebCore::constructCustomElementSynchronously): (WebCore::JSCustomElementInterface::upgradeElement): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::getCustomElementCallback): (WebCore::JSCustomElementRegistry::define): (WebCore::whenDefinedPromise): * bindings/js/JSDOMBinding.cpp: (WebCore::valueToUSVString): (WebCore::hasIteratorMethod): (WebCore::toSmallerInt): (WebCore::toSmallerUInt): (WebCore::toInt32EnforceRange): (WebCore::toUInt32EnforceRange): (WebCore::toInt64EnforceRange): (WebCore::toUInt64EnforceRange): * bindings/js/JSDOMBinding.h: (WebCore::toJSSequence): (WebCore::toJS): (WebCore::jsFrozenArray): * bindings/js/JSDOMPromise.cpp: (WebCore::rejectPromiseWithExceptionIfAny): * bindings/js/JSDOMStringMapCustom.cpp: (WebCore::JSDOMStringMap::putDelegate): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setLocation): (WebCore::JSDOMWindow::open): (WebCore::JSDOMWindow::showModalDialog): (WebCore::handlePostMessage): (WebCore::JSDOMWindow::setTimeout): (WebCore::JSDOMWindow::setInterval): * bindings/js/JSDataCueCustom.cpp: (WebCore::constructJSDataCue): * bindings/js/JSDeviceMotionEventCustom.cpp: (WebCore::readAccelerationArgument): (WebCore::readRotationRateArgument): (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): * bindings/js/JSDictionary.cpp: (WebCore::JSDictionary::tryGetProperty): (WebCore::JSDictionary::convertValue): * bindings/js/JSDictionary.h: (WebCore::JSDictionary::tryGetPropertyAndResult): * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::getCSSCanvasContext): * bindings/js/JSFileCustom.cpp: (WebCore::constructJSFile): * bindings/js/JSGeolocationCustom.cpp: (WebCore::JSGeolocation::getCurrentPosition): (WebCore::JSGeolocation::watchPosition): * bindings/js/JSHTMLAllCollectionCustom.cpp: (WebCore::callHTMLAllCollection): * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::JSHTMLCanvasElement::getContext): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): * bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::pushState): (WebCore::JSHistory::replaceState): * bindings/js/JSIDBDatabaseCustom.cpp: (WebCore::JSIDBDatabase::createObjectStore): * bindings/js/JSMessageEventCustom.cpp: (WebCore::handleInitMessageEvent): * bindings/js/JSMessagePortCustom.cpp: (WebCore::fillMessagePortArray): * bindings/js/JSMessagePortCustom.h: (WebCore::handlePostMessage): * bindings/js/JSMockContentFilterSettingsCustom.cpp: (WebCore::JSMockContentFilterSettings::setDecisionPoint): (WebCore::toDecision): (WebCore::JSMockContentFilterSettings::setDecision): (WebCore::JSMockContentFilterSettings::setUnblockRequestDecision): * bindings/js/JSNodeFilterCustom.cpp: (WebCore::JSNodeFilter::acceptNode): * bindings/js/JSNodeOrString.cpp: (WebCore::toNodeOrStringVector): * bindings/js/JSSQLTransactionCustom.cpp: (WebCore::JSSQLTransaction::executeSql): * bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::convertToSpecifiedUnits): * bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::getOwnPropertyNames): * bindings/js/JSTextTrackCustom.cpp: (WebCore::JSTextTrack::setLanguage): * bindings/js/JSVideoTrackCustom.cpp: (WebCore::JSVideoTrack::setKind): (WebCore::JSVideoTrack::setLanguage): * bindings/js/JSWebGL2RenderingContextCustom.cpp: (WebCore::JSWebGL2RenderingContext::getIndexedParameter): * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: (WebCore::getObjectParameter): (WebCore::JSWebGLRenderingContextBase::getExtension): (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): (WebCore::JSWebGLRenderingContextBase::getParameter): (WebCore::JSWebGLRenderingContextBase::getProgramParameter): (WebCore::JSWebGLRenderingContextBase::getShaderParameter): (WebCore::toVector): (WebCore::dataFunctionf): (WebCore::dataFunctionMatrix): * bindings/js/JSWebKitSubtleCryptoCustom.cpp: (WebCore::cryptoKeyFormatFromJSValue): (WebCore::cryptoKeyUsagesFromJSValue): (WebCore::JSWebKitSubtleCrypto::generateKey): (WebCore::importKey): (WebCore::JSWebKitSubtleCrypto::importKey): (WebCore::exportKey): (WebCore::JSWebKitSubtleCrypto::exportKey): (WebCore::JSWebKitSubtleCrypto::unwrapKey): * bindings/js/JSWorkerCustom.cpp: (WebCore::constructJSWorker): * bindings/js/JSWorkerGlobalScopeCustom.cpp: (WebCore::JSWorkerGlobalScope::importScripts): (WebCore::JSWorkerGlobalScope::setTimeout): (WebCore::JSWorkerGlobalScope::setInterval): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::ReadableStreamDefaultController::invoke): * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::create): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): (GenerateImplementation): (GenerateParametersCheck): (GenerateImplementationFunctionCall): (GenerateConstructorDefinition): * html/HTMLMediaElement.cpp: (WebCore::controllerJSValue): (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange): (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com> -Wtautological-compare triggered in URLParser::internalValuesConsistent https://bugs.webkit.org/show_bug.cgi?id=162551 Reviewed by Alex Christensen. Fix logic error. * platform/URLParser.cpp: (WebCore::URLParser::internalValuesConsistent): 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com> Add CairoUniquePtr and use it in FontPlatformDataFreetype.cpp https://bugs.webkit.org/show_bug.cgi?id=162557 Reviewed by Alex Christensen. * platform/graphics/cairo/CairoUniquePtr.h: Added. (WebCore::CairoPtrDeleter<cairo_font_options_t>::operator()): * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::getDefaultCairoFontOptions): Return a smart pointer. (WebCore::FontPlatformData::buildScaledFont): Use smart pointer. 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com> Silence unused parameter warnings from Geoclue2Interface.c https://bugs.webkit.org/show_bug.cgi?id=162545 Reviewed by Carlos Garcia Campos. * PlatformGTK.cmake: 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com> std::unique_ptr deleter functions should not check if pointer is null https://bugs.webkit.org/show_bug.cgi?id=162558 Reviewed by Alex Christensen. std::unique_ptr already does this before calling the deleter. * platform/graphics/x11/XUniquePtr.h: (WebCore::XPtrDeleter::operator()): (WebCore::XPtrDeleter<XImage>::operator()): (WebCore::XPtrDeleter<_XGC>::operator()): (WebCore::XPtrDeleter<__GLXcontextRec>::operator()): 2016-09-26 Per Arne Vollan <pvollan@apple.com> [Win][Debug] Compile fix. https://bugs.webkit.org/show_bug.cgi?id=162550 Reviewed by Alex Christensen. Windows headers need the FragmentForwardIterator '==' operator in debug mode. * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::FragmentForwardIterator::operator==): 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Unnecessary extern functions in FontPlatformDataFreeType.cpp https://bugs.webkit.org/show_bug.cgi?id=162555 Reviewed by Carlos Garcia Campos. These functions should be file-static. * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::convertFontConfigSubpixelOrder): (WebCore::convertFontConfigHintStyle): (WebCore::setCairoFontOptionsFromFontConfigPattern): == Rolled over to ChangeLog-2016-09-26 ==